Completed
Push — master ( 7e56d1...afdb22 )
by Yannick
05:45
created
require/class.SpotterLive.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 	/**
15 15
 	* Get SQL query part for filter used
16 16
 	* @param Array $filter the filter
17
-	* @return Array the SQL part
17
+	* @return string the SQL part
18 18
 	*/
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter;
Please login to merge, or discard this patch.
Indentation   +203 added lines, -203 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 
13 13
 
14 14
 	/**
15
-	* Get SQL query part for filter used
16
-	* @param Array $filter the filter
17
-	* @return Array the SQL part
18
-	*/
15
+	 * Get SQL query part for filter used
16
+	 * @param Array $filter the filter
17
+	 * @return Array the SQL part
18
+	 */
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter;
21 21
 		if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter);
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
 	}
51 51
 
52 52
 	/**
53
-	* Gets all the spotter information based on the latest data entry
54
-	*
55
-	* @return Array the spotter information
56
-	*
57
-	*/
53
+	 * Gets all the spotter information based on the latest data entry
54
+	 *
55
+	 * @return Array the spotter information
56
+	 *
57
+	 */
58 58
 	public function getLiveSpotterData($limit = '', $sort = '', $filter = array())
59 59
 	{
60 60
 		global $globalDBdriver, $globalLiveInterval;
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
 	}
94 94
 
95 95
 	/**
96
-	* Gets Minimal Live Spotter data
97
-	*
98
-	* @return Array the spotter information
99
-	*
100
-	*/
96
+	 * Gets Minimal Live Spotter data
97
+	 *
98
+	 * @return Array the spotter information
99
+	 *
100
+	 */
101 101
 	public function getMinLiveSpotterData($filter = array())
102 102
 	{
103 103
 		global $globalDBdriver, $globalLiveInterval;
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
 	}
143 143
 
144 144
 	/**
145
-	* Gets Minimal Live Spotter data since xx seconds
146
-	*
147
-	* @return Array the spotter information
148
-	*
149
-	*/
145
+	 * Gets Minimal Live Spotter data since xx seconds
146
+	 *
147
+	 * @return Array the spotter information
148
+	 *
149
+	 */
150 150
 	public function getMinLastLiveSpotterData($filter = array())
151 151
 	{
152 152
 		global $globalDBdriver, $globalLiveInterval;
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 			$query  = 'SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
161 161
 			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 
162 162
 			ORDER BY spotter_live.flightaware_id, spotter_live.date';
163
-                } else {
163
+				} else {
164 164
 /*
165 165
 			$query  = "SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
166 166
 			FROM spotter_live WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 //			echo $query;
173 173
 		}
174 174
 
175
-    		try {
175
+			try {
176 176
 			$sth = $this->db->prepare($query);
177 177
 			$sth->execute();
178 178
 		} catch(PDOException $e) {
@@ -184,11 +184,11 @@  discard block
 block discarded – undo
184 184
 	}
185 185
 
186 186
 	/**
187
-	* Gets number of latest data entry
188
-	*
189
-	* @return String number of entry
190
-	*
191
-	*/
187
+	 * Gets number of latest data entry
188
+	 *
189
+	 * @return String number of entry
190
+	 *
191
+	 */
192 192
 	public function getLiveSpotterCount($filter = array())
193 193
 	{
194 194
 		global $globalDBdriver, $globalLiveInterval;
@@ -214,11 +214,11 @@  discard block
 block discarded – undo
214 214
 	}
215 215
 
216 216
 	/**
217
-	* Gets all the spotter information based on the latest data entry and coord
218
-	*
219
-	* @return Array the spotter information
220
-	*
221
-	*/
217
+	 * Gets all the spotter information based on the latest data entry and coord
218
+	 *
219
+	 * @return Array the spotter information
220
+	 *
221
+	 */
222 222
 	public function getLiveSpotterDatabyCoord($coord, $filter = array())
223 223
 	{
224 224
 		global $globalDBdriver, $globalLiveInterval;
@@ -243,11 +243,11 @@  discard block
 block discarded – undo
243 243
 	}
244 244
 
245 245
 	/**
246
-	* Gets all the spotter information based on a user's latitude and longitude
247
-	*
248
-	* @return Array the spotter information
249
-	*
250
-	*/
246
+	 * Gets all the spotter information based on a user's latitude and longitude
247
+	 *
248
+	 * @return Array the spotter information
249
+	 *
250
+	 */
251 251
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
252 252
 	{
253 253
 		$Spotter = new Spotter($this->db);
@@ -257,145 +257,145 @@  discard block
 block discarded – undo
257 257
 				return false;
258 258
 			}
259 259
 		}
260
-        if ($lng != '')
261
-                {
262
-                        if (!is_numeric($lng))
263
-                        {
264
-                                return false;
265
-                        }
266
-                }
267
-
268
-                if ($radius != '')
269
-                {
270
-                        if (!is_numeric($radius))
271
-                        {
272
-                                return false;
273
-                        }
274
-                }
260
+		if ($lng != '')
261
+				{
262
+						if (!is_numeric($lng))
263
+						{
264
+								return false;
265
+						}
266
+				}
267
+
268
+				if ($radius != '')
269
+				{
270
+						if (!is_numeric($radius))
271
+						{
272
+								return false;
273
+						}
274
+				}
275 275
 		$additional_query = '';
276
-        if ($interval != '')
277
-                {
278
-                        if (!is_string($interval))
279
-                        {
280
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
281
-			        return false;
282
-                        } else {
283
-                if ($interval == '1m')
284
-                {
285
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
286
-                } else if ($interval == '15m'){
287
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
288
-                } 
289
-            }
290
-                } else {
291
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
292
-        }
293
-
294
-                $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 
276
+		if ($interval != '')
277
+				{
278
+						if (!is_string($interval))
279
+						{
280
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
281
+					return false;
282
+						} else {
283
+				if ($interval == '1m')
284
+				{
285
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
286
+				} else if ($interval == '15m'){
287
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
288
+				} 
289
+			}
290
+				} else {
291
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
292
+		}
293
+
294
+				$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 
295 295
                    WHERE spotter_live.latitude <> '' 
296 296
                                    AND spotter_live.longitude <> '' 
297 297
                    ".$additional_query."
298 298
                    HAVING distance < :radius  
299 299
                                    ORDER BY distance";
300 300
 
301
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
301
+				$spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
302 302
 
303
-                return $spotter_array;
304
-        }
303
+				return $spotter_array;
304
+		}
305 305
 
306 306
     
307
-        /**
308
-	* Gets all the spotter information based on a particular callsign
309
-	*
310
-	* @return Array the spotter information
311
-	*
312
-	*/
307
+		/**
308
+		 * Gets all the spotter information based on a particular callsign
309
+		 *
310
+		 * @return Array the spotter information
311
+		 *
312
+		 */
313 313
 	public function getLastLiveSpotterDataByIdent($ident)
314 314
 	{
315 315
 		$Spotter = new Spotter($this->db);
316 316
 		date_default_timezone_set('UTC');
317 317
 
318 318
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
319
-                $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';
319
+				$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';
320 320
 
321 321
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident));
322 322
 
323 323
 		return $spotter_array;
324 324
 	}
325 325
 
326
-        /**
327
-	* Gets all the spotter information based on a particular callsign
328
-	*
329
-	* @return Array the spotter information
330
-	*
331
-	*/
326
+		/**
327
+		 * Gets all the spotter information based on a particular callsign
328
+		 *
329
+		 * @return Array the spotter information
330
+		 *
331
+		 */
332 332
 	public function getDateLiveSpotterDataByIdent($ident,$date)
333 333
 	{
334 334
 		$Spotter = new Spotter($this->db);
335 335
 		date_default_timezone_set('UTC');
336 336
 
337 337
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
338
-                $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';
338
+				$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';
339 339
 
340
-                $date = date('c',$date);
340
+				$date = date('c',$date);
341 341
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
342 342
 
343 343
 		return $spotter_array;
344 344
 	}
345 345
 
346
-        /**
347
-	* Gets last spotter information based on a particular callsign
348
-	*
349
-	* @return Array the spotter information
350
-	*
351
-	*/
346
+		/**
347
+		 * Gets last spotter information based on a particular callsign
348
+		 *
349
+		 * @return Array the spotter information
350
+		 *
351
+		 */
352 352
 	public function getLastLiveSpotterDataById($id)
353 353
 	{
354 354
 		$Spotter = new Spotter($this->db);
355 355
 		date_default_timezone_set('UTC');
356 356
 
357 357
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
358
-                $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';
358
+				$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';
359 359
 
360 360
 		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id));
361 361
 
362 362
 		return $spotter_array;
363 363
 	}
364 364
 
365
-        /**
366
-	* Gets last spotter information based on a particular callsign
367
-	*
368
-	* @return Array the spotter information
369
-	*
370
-	*/
365
+		/**
366
+		 * Gets last spotter information based on a particular callsign
367
+		 *
368
+		 * @return Array the spotter information
369
+		 *
370
+		 */
371 371
 	public function getDateLiveSpotterDataById($id,$date)
372 372
 	{
373 373
 		$Spotter = new Spotter($this->db);
374 374
 		date_default_timezone_set('UTC');
375 375
 
376 376
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
377
-                $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';
378
-                $date = date('c',$date);
377
+				$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';
378
+				$date = date('c',$date);
379 379
 		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date));
380 380
 
381 381
 		return $spotter_array;
382 382
 	}
383 383
 
384
-        /**
385
-	* Gets altitude information based on a particular callsign
386
-	*
387
-	* @return Array the spotter information
388
-	*
389
-	*/
384
+		/**
385
+		 * Gets altitude information based on a particular callsign
386
+		 *
387
+		 * @return Array the spotter information
388
+		 *
389
+		 */
390 390
 	public function getAltitudeLiveSpotterDataByIdent($ident)
391 391
 	{
392 392
 
393 393
 		date_default_timezone_set('UTC');
394 394
 
395 395
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
396
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
396
+				$query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
397 397
 
398
-    		try {
398
+			try {
399 399
 			
400 400
 			$sth = $this->db->prepare($query);
401 401
 			$sth->execute(array(':ident' => $ident));
@@ -408,12 +408,12 @@  discard block
 block discarded – undo
408 408
 		return $spotter_array;
409 409
 	}
410 410
 
411
-        /**
412
-	* Gets all the spotter information based on a particular id
413
-	*
414
-	* @return Array the spotter information
415
-	*
416
-	*/
411
+		/**
412
+		 * Gets all the spotter information based on a particular id
413
+		 *
414
+		 * @return Array the spotter information
415
+		 *
416
+		 */
417 417
 	public function getAllLiveSpotterDataById($id,$liveinterval = false)
418 418
 	{
419 419
 		global $globalDBdriver, $globalLiveInterval;
@@ -441,18 +441,18 @@  discard block
 block discarded – undo
441 441
 		return $spotter_array;
442 442
 	}
443 443
 
444
-        /**
445
-	* Gets all the spotter information based on a particular ident
446
-	*
447
-	* @return Array the spotter information
448
-	*
449
-	*/
444
+		/**
445
+		 * Gets all the spotter information based on a particular ident
446
+		 *
447
+		 * @return Array the spotter information
448
+		 *
449
+		 */
450 450
 	public function getAllLiveSpotterDataByIdent($ident)
451 451
 	{
452 452
 		date_default_timezone_set('UTC');
453 453
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
454 454
 		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
455
-    		try {
455
+			try {
456 456
 			
457 457
 			$sth = $this->db->prepare($query);
458 458
 			$sth->execute(array(':ident' => $ident));
@@ -466,23 +466,23 @@  discard block
 block discarded – undo
466 466
 
467 467
 
468 468
 	/**
469
-	* Deletes all info in the table
470
-	*
471
-	* @return String success or false
472
-	*
473
-	*/
469
+	 * Deletes all info in the table
470
+	 *
471
+	 * @return String success or false
472
+	 *
473
+	 */
474 474
 	public function deleteLiveSpotterData()
475 475
 	{
476 476
 		global $globalDBdriver;
477 477
 		if ($globalDBdriver == 'mysql') {
478 478
 			//$query  = "DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= spotter_live.date";
479 479
 			$query  = 'DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= spotter_live.date';
480
-            		//$query  = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)";
480
+					//$query  = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)";
481 481
 		} else {
482 482
 			$query  = "DELETE FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date";
483 483
 		}
484 484
         
485
-    		try {
485
+			try {
486 486
 			
487 487
 			$sth = $this->db->prepare($query);
488 488
 			$sth->execute();
@@ -494,18 +494,18 @@  discard block
 block discarded – undo
494 494
 	}
495 495
 
496 496
 	/**
497
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
498
-	*
499
-	* @return String success or false
500
-	*
501
-	*/
497
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
498
+	 *
499
+	 * @return String success or false
500
+	 *
501
+	 */
502 502
 	public function deleteLiveSpotterDataNotUpdated()
503 503
 	{
504 504
 		global $globalDBdriver, $globalDebug;
505 505
 		if ($globalDBdriver == 'mysql') {
506 506
 			//$query = 'SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < spotter_live.date) LIMIT 800 OFFSET 0';
507
-    			$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
508
-    			try {
507
+				$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
508
+				try {
509 509
 				
510 510
 				$sth = $this->db->prepare($query);
511 511
 				$sth->execute();
@@ -513,8 +513,8 @@  discard block
 block discarded – undo
513 513
 				return "error";
514 514
 			}
515 515
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
516
-                        $i = 0;
517
-                        $j =0;
516
+						$i = 0;
517
+						$j =0;
518 518
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
519 519
 			foreach($all as $row)
520 520
 			{
@@ -522,20 +522,20 @@  discard block
 block discarded – undo
522 522
 				$j++;
523 523
 				if ($j == 30) {
524 524
 					if ($globalDebug) echo ".";
525
-				    	try {
525
+						try {
526 526
 						
527 527
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
528 528
 						$sth->execute();
529 529
 					} catch(PDOException $e) {
530 530
 						return "error";
531 531
 					}
532
-                                	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
533
-                                	$j = 0;
532
+									$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
533
+									$j = 0;
534 534
 				}
535 535
 				$query_delete .= "'".$row['flightaware_id']."',";
536 536
 			}
537 537
 			if ($i > 0) {
538
-    				try {
538
+					try {
539 539
 					
540 540
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
541 541
 					$sth->execute();
@@ -546,9 +546,9 @@  discard block
 block discarded – undo
546 546
 			return "success";
547 547
 		} elseif ($globalDBdriver == 'pgsql') {
548 548
 			//$query = "SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < spotter_live.date) LIMIT 800 OFFSET 0";
549
-    			//$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
550
-    			$query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
551
-    			try {
549
+				//$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
550
+				$query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
551
+				try {
552 552
 				
553 553
 				$sth = $this->db->prepare($query);
554 554
 				$sth->execute();
@@ -592,17 +592,17 @@  discard block
 block discarded – undo
592 592
 	}
593 593
 
594 594
 	/**
595
-	* Deletes all info in the table for an ident
596
-	*
597
-	* @return String success or false
598
-	*
599
-	*/
595
+	 * Deletes all info in the table for an ident
596
+	 *
597
+	 * @return String success or false
598
+	 *
599
+	 */
600 600
 	public function deleteLiveSpotterDataByIdent($ident)
601 601
 	{
602 602
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
603 603
 		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
604 604
         
605
-    		try {
605
+			try {
606 606
 			
607 607
 			$sth = $this->db->prepare($query);
608 608
 			$sth->execute(array(':ident' => $ident));
@@ -614,17 +614,17 @@  discard block
 block discarded – undo
614 614
 	}
615 615
 
616 616
 	/**
617
-	* Deletes all info in the table for an id
618
-	*
619
-	* @return String success or false
620
-	*
621
-	*/
617
+	 * Deletes all info in the table for an id
618
+	 *
619
+	 * @return String success or false
620
+	 *
621
+	 */
622 622
 	public function deleteLiveSpotterDataById($id)
623 623
 	{
624 624
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
625 625
 		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
626 626
         
627
-    		try {
627
+			try {
628 628
 			
629 629
 			$sth = $this->db->prepare($query);
630 630
 			$sth->execute(array(':id' => $id));
@@ -637,11 +637,11 @@  discard block
 block discarded – undo
637 637
 
638 638
 
639 639
 	/**
640
-	* Gets the aircraft ident within the last hour
641
-	*
642
-	* @return String the ident
643
-	*
644
-	*/
640
+	 * Gets the aircraft ident within the last hour
641
+	 *
642
+	 * @return String the ident
643
+	 *
644
+	 */
645 645
 	public function getIdentFromLastHour($ident)
646 646
 	{
647 647
 		global $globalDBdriver, $globalTimezone;
@@ -667,14 +667,14 @@  discard block
 block discarded – undo
667 667
 			$ident_result = $row['ident'];
668 668
 		}
669 669
 		return $ident_result;
670
-        }
670
+		}
671 671
 
672 672
 	/**
673
-	* Check recent aircraft
674
-	*
675
-	* @return String the ident
676
-	*
677
-	*/
673
+	 * Check recent aircraft
674
+	 *
675
+	 * @return String the ident
676
+	 *
677
+	 */
678 678
 	public function checkIdentRecent($ident)
679 679
 	{
680 680
 		global $globalDBdriver, $globalTimezone;
@@ -700,14 +700,14 @@  discard block
 block discarded – undo
700 700
 			$ident_result = $row['flightaware_id'];
701 701
 		}
702 702
 		return $ident_result;
703
-        }
703
+		}
704 704
 
705 705
 	/**
706
-	* Check recent aircraft by id
707
-	*
708
-	* @return String the ident
709
-	*
710
-	*/
706
+	 * Check recent aircraft by id
707
+	 *
708
+	 * @return String the ident
709
+	 *
710
+	 */
711 711
 	public function checkIdRecent($id)
712 712
 	{
713 713
 		global $globalDBdriver, $globalTimezone;
@@ -733,14 +733,14 @@  discard block
 block discarded – undo
733 733
 			$ident_result = $row['flightaware_id'];
734 734
 		}
735 735
 		return $ident_result;
736
-        }
736
+		}
737 737
 
738 738
 	/**
739
-	* Check recent aircraft by ModeS
740
-	*
741
-	* @return String the ModeS
742
-	*
743
-	*/
739
+	 * Check recent aircraft by ModeS
740
+	 *
741
+	 * @return String the ModeS
742
+	 *
743
+	 */
744 744
 	public function checkModeSRecent($modes)
745 745
 	{
746 746
 		global $globalDBdriver, $globalTimezone;
@@ -767,19 +767,19 @@  discard block
 block discarded – undo
767 767
 			$ident_result = $row['flightaware_id'];
768 768
 		}
769 769
 		return $ident_result;
770
-        }
770
+		}
771 771
 
772 772
 	/**
773
-	* Adds a new spotter data
774
-	*
775
-	* @param String $flightaware_id the ID from flightaware
776
-	* @param String $ident the flight ident
777
-	* @param String $aircraft_icao the aircraft type
778
-	* @param String $departure_airport_icao the departure airport
779
-	* @param String $arrival_airport_icao the arrival airport
780
-	* @return String success or false
781
-	*
782
-	*/
773
+	 * Adds a new spotter data
774
+	 *
775
+	 * @param String $flightaware_id the ID from flightaware
776
+	 * @param String $ident the flight ident
777
+	 * @param String $aircraft_icao the aircraft type
778
+	 * @param String $departure_airport_icao the departure airport
779
+	 * @param String $arrival_airport_icao the arrival airport
780
+	 * @return String success or false
781
+	 *
782
+	 */
783 783
 	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '')
784 784
 	{
785 785
 		global $globalURL, $globalArchive, $globalDebug;
@@ -915,10 +915,10 @@  discard block
 block discarded – undo
915 915
 		$arrival_airport_country = '';
916 916
 		
917 917
             	
918
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
919
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
920
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
921
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
918
+				if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
919
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
920
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
921
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
922 922
             	
923 923
 		$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) 
924 924
 		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)';
@@ -929,13 +929,13 @@  discard block
 block discarded – undo
929 929
 			
930 930
 			$sth = $this->db->prepare($query);
931 931
 			$sth->execute($query_values);
932
-                } catch(PDOException $e) {
933
-                	return "error : ".$e->getMessage();
934
-                }
932
+				} catch(PDOException $e) {
933
+					return "error : ".$e->getMessage();
934
+				}
935 935
 		if (isset($globalArchive) && $globalArchive && $putinarchive && !$noarchive) {
936
-		    if ($globalDebug) echo '(Add to SBS archive : ';
937
-		    $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);
938
-		    if ($globalDebug) echo $result.')';
936
+			if ($globalDebug) echo '(Add to SBS archive : ';
937
+			$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);
938
+			if ($globalDebug) echo $result.')';
939 939
 		}
940 940
 		return "success";
941 941
 
Please login to merge, or discard this patch.
Braces   +71 added lines, -24 removed lines patch added patch discarded remove patch
@@ -26,7 +26,9 @@  discard block
 block discarded – undo
26 26
 				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
27 27
 			}
28 28
 		}
29
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
29
+		if (is_array($globalFilter)) {
30
+			$filter = array_merge($filter,$globalFilter);
31
+		}
30 32
 		$filter_query_join = '';
31 33
 		$filter_query_where = '';
32 34
 		foreach($filters as $flt) {
@@ -71,8 +73,11 @@  discard block
 block discarded – undo
71 73
 				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
72 74
 			}
73 75
 		}
74
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
75
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
76
+		if ($filter_query_where == '' && $where) {
77
+			$filter_query_where = ' WHERE';
78
+		} elseif ($filter_query_where != '' && $and) {
79
+			$filter_query_where .= ' AND';
80
+		}
76 81
 		$filter_query = $filter_query_join.$filter_query_where;
77 82
 		return $filter_query;
78 83
 	}
@@ -108,7 +113,9 @@  discard block
 block discarded – undo
108 113
 			$orderby_query = ' '.$search_orderby_array[$sort]['sql'];
109 114
 		}
110 115
 
111
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
116
+		if (!isset($globalLiveInterval)) {
117
+			$globalLiveInterval = '200';
118
+		}
112 119
 		if ($globalDBdriver == 'mysql') {
113 120
 			//$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 30 SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
114 121
 			$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'.$filter_query.$orderby_query;
@@ -133,7 +140,9 @@  discard block
 block discarded – undo
133 140
 
134 141
 		$filter_query = $this->getFilter($filter,true,true);
135 142
 
136
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
143
+		if (!isset($globalLiveInterval)) {
144
+			$globalLiveInterval = '200';
145
+		}
137 146
 		if ($globalDBdriver == 'mysql') {
138 147
 //			$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$orderby_query";
139 148
 //			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, a.aircraft_shadow FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate INNER JOIN (SELECT * FROM aircraft) a on spotter_live.aircraft_icao = a.icao';
@@ -180,7 +189,9 @@  discard block
 block discarded – undo
180 189
 
181 190
 		$filter_query = $this->getFilter($filter,true,true);
182 191
 
183
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
192
+		if (!isset($globalLiveInterval)) {
193
+			$globalLiveInterval = '200';
194
+		}
184 195
 		if ($globalDBdriver == 'mysql') {
185 196
 
186 197
 			$query  = 'SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
@@ -220,7 +231,9 @@  discard block
 block discarded – undo
220 231
 		global $globalDBdriver, $globalLiveInterval;
221 232
 		$filter_query = $this->getFilter($filter,true,true);
222 233
 
223
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
234
+		if (!isset($globalLiveInterval)) {
235
+			$globalLiveInterval = '200';
236
+		}
224 237
 		if ($globalDBdriver == 'mysql') {
225 238
 			//$query  = 'SELECT COUNT(*) as nb FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query;
226 239
 			$query = 'SELECT COUNT(DISTINCT spotter_live.flightaware_id) as nb FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
@@ -250,7 +263,9 @@  discard block
 block discarded – undo
250 263
 	{
251 264
 		global $globalDBdriver, $globalLiveInterval;
252 265
 		$Spotter = new Spotter($this->db);
253
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
266
+		if (!isset($globalLiveInterval)) {
267
+			$globalLiveInterval = '200';
268
+		}
254 269
 		$filter_query = $this->getFilter($filter);
255 270
 
256 271
 		if (is_array($coord)) {
@@ -258,7 +273,9 @@  discard block
 block discarded – undo
258 273
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
259 274
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
260 275
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
261
-		} else return array();
276
+		} else {
277
+			return array();
278
+		}
262 279
 		if ($globalDBdriver == 'mysql') {
263 280
 			//$query  = "SELECT spotter_output.* FROM spotter_output WHERE spotter_output.flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
264 281
 			$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;
@@ -449,11 +466,15 @@  discard block
 block discarded – undo
449 466
 		//$query  = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date';
450 467
 		if ($globalDBdriver == 'mysql') {
451 468
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
452
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
469
+			if ($liveinterval) {
470
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
471
+			}
453 472
 			$query .= ' ORDER BY date';
454 473
 		} else {
455 474
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
456
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
475
+			if ($liveinterval) {
476
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
477
+			}
457 478
 			$query .= ' ORDER BY date';
458 479
 		}
459 480
 
@@ -548,7 +569,9 @@  discard block
 block discarded – undo
548 569
 				$i++;
549 570
 				$j++;
550 571
 				if ($j == 30) {
551
-					if ($globalDebug) echo ".";
572
+					if ($globalDebug) {
573
+						echo ".";
574
+					}
552 575
 				    	try {
553 576
 						
554 577
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -856,7 +879,9 @@  discard block
 block discarded – undo
856 879
 			{
857 880
 				return false;
858 881
 			}
859
-		} else return '';
882
+		} else {
883
+			return '';
884
+		}
860 885
 
861 886
 		if ($longitude != '')
862 887
 		{
@@ -864,7 +889,9 @@  discard block
 block discarded – undo
864 889
 			{
865 890
 				return false;
866 891
 			}
867
-		} else return '';
892
+		} else {
893
+			return '';
894
+		}
868 895
 
869 896
 		if ($waypoints != '')
870 897
 		{
@@ -880,7 +907,9 @@  discard block
 block discarded – undo
880 907
 			{
881 908
 				return false;
882 909
 			}
883
-		} else $altitude = 0;
910
+		} else {
911
+			$altitude = 0;
912
+		}
884 913
 
885 914
 		if ($heading != '')
886 915
 		{
@@ -888,7 +917,9 @@  discard block
 block discarded – undo
888 917
 			{
889 918
 				return false;
890 919
 			}
891
-		} else $heading = 0;
920
+		} else {
921
+			$heading = 0;
922
+		}
892 923
 
893 924
 		if ($groundspeed != '')
894 925
 		{
@@ -896,9 +927,13 @@  discard block
 block discarded – undo
896 927
 			{
897 928
 				return false;
898 929
 			}
899
-		} else $groundspeed = 0;
930
+		} else {
931
+			$groundspeed = 0;
932
+		}
900 933
 		date_default_timezone_set('UTC');
901
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
934
+		if ($date == '') {
935
+			$date = date("Y-m-d H:i:s", time());
936
+		}
902 937
 
903 938
         
904 939
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -942,10 +977,18 @@  discard block
 block discarded – undo
942 977
 		$arrival_airport_country = '';
943 978
 		
944 979
             	
945
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
946
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
947
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
948
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
980
+            	if ($squawk == '' || $Common->isInteger($squawk) === false ) {
981
+            		$squawk = NULL;
982
+            	}
983
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) {
984
+            		$verticalrate = NULL;
985
+            	}
986
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
987
+            		$groundspeed = 0;
988
+            	}
989
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
990
+            		$heading = 0;
991
+            	}
949 992
             	
950 993
 		$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) 
951 994
 		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)';
@@ -960,9 +1003,13 @@  discard block
 block discarded – undo
960 1003
                 	return "error : ".$e->getMessage();
961 1004
                 }
962 1005
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
963
-		    if ($globalDebug) echo '(Add to SBS archive : ';
1006
+		    if ($globalDebug) {
1007
+		    	echo '(Add to SBS archive : ';
1008
+		    }
964 1009
 		    $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);
965
-		    if ($globalDebug) echo $result.')';
1010
+		    if ($globalDebug) {
1011
+		    	echo $result.')';
1012
+		    }
966 1013
 		}
967 1014
 		return "success";
968 1015
 
Please login to merge, or discard this patch.
Spacing   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -16,64 +16,64 @@  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;
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
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
29
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
30 30
 		$filter_query_join = '';
31 31
 		$filter_query_where = '';
32
-		foreach($filters as $flt) {
32
+		foreach ($filters as $flt) {
33 33
 			if (isset($flt['airlines']) && !empty($flt['airlines'])) {
34 34
 				if ($flt['airlines'][0] != '') {
35 35
 					if (isset($flt['source'])) {
36
-						$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'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
36
+						$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'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
37 37
 					} else {
38
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
38
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
39 39
 					}
40 40
 				}
41 41
 			}
42 42
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
43 43
 				if (isset($flt['source'])) {
44
-					$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'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
44
+					$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'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
45 45
 				} else {
46
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
46
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
47 47
 				}
48 48
 			}
49 49
 			if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']))) {
50 50
 				if (isset($flt['source'])) {
51
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
51
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
52 52
 				}
53 53
 			}
54 54
 		}
55 55
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
56 56
 			if ($filter['airlines'][0] != '') {
57
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
57
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
58 58
 			}
59 59
 		}
60 60
 		if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
61 61
 			$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 ";
62 62
 		}
63 63
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
64
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
64
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
65 65
 		}
66 66
 		if (isset($filter['source']) && !empty($filter['source'])) {
67
-			$filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
67
+			$filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')";
68 68
 		}
69 69
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
70 70
 			$filter_query_where = " WHERE ident = '".$filter['ident']."'";
71 71
 		}
72 72
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
73 73
 			if ($filter_query_where == '') {
74
-				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
74
+				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
75 75
 			} else {
76
-				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
76
+				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
77 77
 			}
78 78
 		}
79 79
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
 		if ($limit != '')
100 100
 		{
101 101
 			$limit_array = explode(',', $limit);
102
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
103
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
102
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
103
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
104 104
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
105 105
 			{
106 106
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 		} else {
121 121
 			$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;
122 122
 		}
123
-		$spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true);
123
+		$spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true);
124 124
 
125 125
 		return $spotter_array;
126 126
 	}
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 		global $globalDBdriver, $globalLiveInterval;
137 137
 		date_default_timezone_set('UTC');
138 138
 
139
-		$filter_query = $this->getFilter($filter,true,true);
139
+		$filter_query = $this->getFilter($filter, true, true);
140 140
 
141 141
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
142 142
 		if ($globalDBdriver == 'mysql') {
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 //			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, a.aircraft_shadow FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate INNER JOIN (SELECT * FROM aircraft) a on spotter_live.aircraft_icao = a.icao';
145 145
 //			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query;
146 146
 
147
-			$query  = 'SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
147
+			$query = 'SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
148 148
 			FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao'.$filter_query." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'";
149 149
 
150 150
 //			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date ORDER BY spotter_live.date GROUP BY spotter_live.flightaware_id'.$filter_query;
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 			//$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE NOW() AT TIME ZONE 'UTC' - '30 SECONDS'->INTERVAL <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
155 155
 			//$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE NOW() AT TIME ZONE 'UTC' - '".$globalLiveInterval." SECONDS'->INTERVAL <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate$orderby_query";
156 156
 			//$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, a.aircraft_shadow FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_live.aircraft_icao = a.icao';
157
-			$query  = "SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
157
+			$query = "SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
158 158
 			FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao".$filter_query." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'";
159 159
 		}
160 160
 //		$spotter_array = Spotter->getDataFromDB($query.$limit_query);
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 		try {
164 164
 			$sth = $this->db->prepare($query);
165 165
 			$sth->execute();
166
-		} catch(PDOException $e) {
166
+		} catch (PDOException $e) {
167 167
 			echo $e->getMessage();
168 168
 			die;
169 169
 		}
@@ -183,12 +183,12 @@  discard block
 block discarded – undo
183 183
 		global $globalDBdriver, $globalLiveInterval;
184 184
 		date_default_timezone_set('UTC');
185 185
 
186
-		$filter_query = $this->getFilter($filter,true,true);
186
+		$filter_query = $this->getFilter($filter, true, true);
187 187
 
188 188
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
189 189
 		if ($globalDBdriver == 'mysql') {
190 190
 
191
-			$query  = 'SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
191
+			$query = 'SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
192 192
 			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' 
193 193
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
194 194
                 } else {
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 			FROM spotter_live WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date 
198 198
 			".$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao ORDER BY spotter_live.flightaware_id, spotter_live.date';
199 199
 */
200
-			$query  = "SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
200
+			$query = "SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
201 201
 			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' 
202 202
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
203 203
 //			echo $query;
@@ -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
 		}
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 	public function getLiveSpotterCount($filter = array())
224 224
 	{
225 225
 		global $globalDBdriver, $globalLiveInterval;
226
-		$filter_query = $this->getFilter($filter,true,true);
226
+		$filter_query = $this->getFilter($filter, true, true);
227 227
 
228 228
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
229 229
 		if ($globalDBdriver == 'mysql') {
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 		try {
237 237
 			$sth = $this->db->prepare($query);
238 238
 			$sth->execute();
239
-		} catch(PDOException $e) {
239
+		} catch (PDOException $e) {
240 240
 			echo $e->getMessage();
241 241
 			die;
242 242
 		}
@@ -259,10 +259,10 @@  discard block
 block discarded – undo
259 259
 		$filter_query = $this->getFilter($filter);
260 260
 
261 261
 		if (is_array($coord)) {
262
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
263
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
264
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
265
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
262
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
263
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
264
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
265
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
266 266
 		} else return array();
267 267
 		if ($globalDBdriver == 'mysql') {
268 268
 			//$query  = "SELECT spotter_output.* FROM spotter_output WHERE spotter_output.flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
                 if ($interval == '1m')
316 316
                 {
317 317
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
318
-                } else if ($interval == '15m'){
318
+                } else if ($interval == '15m') {
319 319
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
320 320
                 } 
321 321
             }
@@ -323,14 +323,14 @@  discard block
 block discarded – undo
323 323
          $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
324 324
         }
325 325
 
326
-                $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 
326
+                $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 
327 327
                    WHERE spotter_live.latitude <> '' 
328 328
                                    AND spotter_live.longitude <> '' 
329 329
                    ".$additional_query."
330 330
                    HAVING distance < :radius  
331 331
                                    ORDER BY distance";
332 332
 
333
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
333
+                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius));
334 334
 
335 335
                 return $spotter_array;
336 336
         }
@@ -348,9 +348,9 @@  discard block
 block discarded – undo
348 348
 		date_default_timezone_set('UTC');
349 349
 
350 350
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
351
-                $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';
351
+                $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';
352 352
 
353
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
353
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true);
354 354
 
355 355
 		return $spotter_array;
356 356
 	}
@@ -361,16 +361,16 @@  discard block
 block discarded – undo
361 361
 	* @return Array the spotter information
362 362
 	*
363 363
 	*/
364
-	public function getDateLiveSpotterDataByIdent($ident,$date)
364
+	public function getDateLiveSpotterDataByIdent($ident, $date)
365 365
 	{
366 366
 		$Spotter = new Spotter($this->db);
367 367
 		date_default_timezone_set('UTC');
368 368
 
369 369
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
370
-                $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';
370
+                $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';
371 371
 
372
-                $date = date('c',$date);
373
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
372
+                $date = date('c', $date);
373
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
374 374
 
375 375
 		return $spotter_array;
376 376
 	}
@@ -387,9 +387,9 @@  discard block
 block discarded – undo
387 387
 		date_default_timezone_set('UTC');
388 388
 
389 389
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
390
-                $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';
390
+                $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';
391 391
 
392
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true);
392
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true);
393 393
 
394 394
 		return $spotter_array;
395 395
 	}
@@ -400,15 +400,15 @@  discard block
 block discarded – undo
400 400
 	* @return Array the spotter information
401 401
 	*
402 402
 	*/
403
-	public function getDateLiveSpotterDataById($id,$date)
403
+	public function getDateLiveSpotterDataById($id, $date)
404 404
 	{
405 405
 		$Spotter = new Spotter($this->db);
406 406
 		date_default_timezone_set('UTC');
407 407
 
408 408
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
409
-                $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';
410
-                $date = date('c',$date);
411
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
409
+                $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';
410
+                $date = date('c', $date);
411
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true);
412 412
 
413 413
 		return $spotter_array;
414 414
 	}
@@ -425,13 +425,13 @@  discard block
 block discarded – undo
425 425
 		date_default_timezone_set('UTC');
426 426
 
427 427
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
428
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
428
+                $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
429 429
 
430 430
     		try {
431 431
 			
432 432
 			$sth = $this->db->prepare($query);
433 433
 			$sth->execute(array(':ident' => $ident));
434
-		} catch(PDOException $e) {
434
+		} catch (PDOException $e) {
435 435
 			echo $e->getMessage();
436 436
 			die;
437 437
 		}
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 	* @return Array the spotter information
447 447
 	*
448 448
 	*/
449
-	public function getAllLiveSpotterDataById($id,$liveinterval = false)
449
+	public function getAllLiveSpotterDataById($id, $liveinterval = false)
450 450
 	{
451 451
 		global $globalDBdriver, $globalLiveInterval;
452 452
 		date_default_timezone_set('UTC');
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 		try {
466 466
 			$sth = $this->db->prepare($query);
467 467
 			$sth->execute(array(':id' => $id));
468
-		} catch(PDOException $e) {
468
+		} catch (PDOException $e) {
469 469
 			echo $e->getMessage();
470 470
 			die;
471 471
 		}
@@ -483,12 +483,12 @@  discard block
 block discarded – undo
483 483
 	{
484 484
 		date_default_timezone_set('UTC');
485 485
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
486
-		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
486
+		$query = self::$global_query.' WHERE spotter_live.ident = :ident';
487 487
     		try {
488 488
 			
489 489
 			$sth = $this->db->prepare($query);
490 490
 			$sth->execute(array(':ident' => $ident));
491
-		} catch(PDOException $e) {
491
+		} catch (PDOException $e) {
492 492
 			echo $e->getMessage();
493 493
 			die;
494 494
 		}
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 			
519 519
 			$sth = $this->db->prepare($query);
520 520
 			$sth->execute();
521
-		} catch(PDOException $e) {
521
+		} catch (PDOException $e) {
522 522
 			return "error";
523 523
 		}
524 524
 
@@ -541,14 +541,14 @@  discard block
 block discarded – undo
541 541
 				
542 542
 				$sth = $this->db->prepare($query);
543 543
 				$sth->execute();
544
-			} catch(PDOException $e) {
544
+			} catch (PDOException $e) {
545 545
 				return "error";
546 546
 			}
547 547
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
548 548
                         $i = 0;
549
-                        $j =0;
549
+                        $j = 0;
550 550
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
551
-			foreach($all as $row)
551
+			foreach ($all as $row)
552 552
 			{
553 553
 				$i++;
554 554
 				$j++;
@@ -556,9 +556,9 @@  discard block
 block discarded – undo
556 556
 					if ($globalDebug) echo ".";
557 557
 				    	try {
558 558
 						
559
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
559
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
560 560
 						$sth->execute();
561
-					} catch(PDOException $e) {
561
+					} catch (PDOException $e) {
562 562
 						return "error";
563 563
 					}
564 564
                                 	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
@@ -569,9 +569,9 @@  discard block
 block discarded – undo
569 569
 			if ($i > 0) {
570 570
     				try {
571 571
 					
572
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
572
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
573 573
 					$sth->execute();
574
-				} catch(PDOException $e) {
574
+				} catch (PDOException $e) {
575 575
 					return "error";
576 576
 				}
577 577
 			}
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 				
585 585
 				$sth = $this->db->prepare($query);
586 586
 				$sth->execute();
587
-			} catch(PDOException $e) {
587
+			} catch (PDOException $e) {
588 588
 				return "error";
589 589
 			}
590 590
 /*			$query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN (";
@@ -632,13 +632,13 @@  discard block
 block discarded – undo
632 632
 	public function deleteLiveSpotterDataByIdent($ident)
633 633
 	{
634 634
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
635
-		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
635
+		$query = 'DELETE FROM spotter_live WHERE ident = :ident';
636 636
         
637 637
     		try {
638 638
 			
639 639
 			$sth = $this->db->prepare($query);
640 640
 			$sth->execute(array(':ident' => $ident));
641
-		} catch(PDOException $e) {
641
+		} catch (PDOException $e) {
642 642
 			return "error";
643 643
 		}
644 644
 
@@ -654,13 +654,13 @@  discard block
 block discarded – undo
654 654
 	public function deleteLiveSpotterDataById($id)
655 655
 	{
656 656
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
657
-		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
657
+		$query = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
658 658
         
659 659
     		try {
660 660
 			
661 661
 			$sth = $this->db->prepare($query);
662 662
 			$sth->execute(array(':id' => $id));
663
-		} catch(PDOException $e) {
663
+		} catch (PDOException $e) {
664 664
 			return "error";
665 665
 		}
666 666
 
@@ -678,13 +678,13 @@  discard block
 block discarded – undo
678 678
 	{
679 679
 		global $globalDBdriver, $globalTimezone;
680 680
 		if ($globalDBdriver == 'mysql') {
681
-			$query  = 'SELECT spotter_live.ident FROM spotter_live 
681
+			$query = 'SELECT spotter_live.ident FROM spotter_live 
682 682
 				WHERE spotter_live.ident = :ident 
683 683
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
684 684
 				AND spotter_live.date < UTC_TIMESTAMP()';
685 685
 			$query_data = array(':ident' => $ident);
686 686
 		} else {
687
-			$query  = "SELECT spotter_live.ident FROM spotter_live 
687
+			$query = "SELECT spotter_live.ident FROM spotter_live 
688 688
 				WHERE spotter_live.ident = :ident 
689 689
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
690 690
 				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -693,8 +693,8 @@  discard block
 block discarded – undo
693 693
 		
694 694
 		$sth = $this->db->prepare($query);
695 695
 		$sth->execute($query_data);
696
-		$ident_result='';
697
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
696
+		$ident_result = '';
697
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
698 698
 		{
699 699
 			$ident_result = $row['ident'];
700 700
 		}
@@ -711,13 +711,13 @@  discard block
 block discarded – undo
711 711
 	{
712 712
 		global $globalDBdriver, $globalTimezone;
713 713
 		if ($globalDBdriver == 'mysql') {
714
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
714
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
715 715
 				WHERE spotter_live.ident = :ident 
716 716
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
717 717
 //				AND spotter_live.date < UTC_TIMESTAMP()";
718 718
 			$query_data = array(':ident' => $ident);
719 719
 		} else {
720
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
720
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
721 721
 				WHERE spotter_live.ident = :ident 
722 722
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'";
723 723
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -726,8 +726,8 @@  discard block
 block discarded – undo
726 726
 		
727 727
 		$sth = $this->db->prepare($query);
728 728
 		$sth->execute($query_data);
729
-		$ident_result='';
730
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
729
+		$ident_result = '';
730
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
731 731
 		{
732 732
 			$ident_result = $row['flightaware_id'];
733 733
 		}
@@ -744,13 +744,13 @@  discard block
 block discarded – undo
744 744
 	{
745 745
 		global $globalDBdriver, $globalTimezone;
746 746
 		if ($globalDBdriver == 'mysql') {
747
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
747
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
748 748
 				WHERE spotter_live.flightaware_id = :id 
749 749
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
750 750
 //				AND spotter_live.date < UTC_TIMESTAMP()";
751 751
 			$query_data = array(':id' => $id);
752 752
 		} else {
753
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
753
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
754 754
 				WHERE spotter_live.flightaware_id = :id 
755 755
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
756 756
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -759,8 +759,8 @@  discard block
 block discarded – undo
759 759
 		
760 760
 		$sth = $this->db->prepare($query);
761 761
 		$sth->execute($query_data);
762
-		$ident_result='';
763
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
762
+		$ident_result = '';
763
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
764 764
 		{
765 765
 			$ident_result = $row['flightaware_id'];
766 766
 		}
@@ -777,13 +777,13 @@  discard block
 block discarded – undo
777 777
 	{
778 778
 		global $globalDBdriver, $globalTimezone;
779 779
 		if ($globalDBdriver == 'mysql') {
780
-			$query  = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
780
+			$query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
781 781
 				WHERE spotter_live.ModeS = :modes 
782 782
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
783 783
 //				AND spotter_live.date < UTC_TIMESTAMP()";
784 784
 			$query_data = array(':modes' => $modes);
785 785
 		} else {
786
-			$query  = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
786
+			$query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
787 787
 				WHERE spotter_live.ModeS = :modes 
788 788
 				AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '30 MINUTE'";
789 789
 //			//	AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
@@ -792,8 +792,8 @@  discard block
 block discarded – undo
792 792
 		
793 793
 		$sth = $this->db->prepare($query);
794 794
 		$sth->execute($query_data);
795
-		$ident_result='';
796
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
795
+		$ident_result = '';
796
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
797 797
 		{
798 798
 			//$ident_result = $row['spotter_live_id'];
799 799
 			$ident_result = $row['flightaware_id'];
@@ -812,7 +812,7 @@  discard block
 block discarded – undo
812 812
 	* @return String success or false
813 813
 	*
814 814
 	*/
815
-	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '')
815
+	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false, $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false, $format_source = '', $source_name = '', $over_country = '')
816 816
 	{
817 817
 		global $globalURL, $globalArchive, $globalDebug;
818 818
 		$Common = new Common();
@@ -906,26 +906,26 @@  discard block
 block discarded – undo
906 906
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
907 907
 
908 908
         
909
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
910
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
911
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
912
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
913
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
914
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
915
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
916
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
917
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
918
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
919
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
920
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
921
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
922
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
923
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
924
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
925
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
926
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
927
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
928
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
909
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
910
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
911
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
912
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
913
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
914
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
915
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
916
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
917
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
918
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
919
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
920
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
921
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
922
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
923
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
924
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
925
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
926
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
927
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
928
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
929 929
 
930 930
 		$airline_name = '';
931 931
 		$airline_icao = '';
@@ -947,26 +947,26 @@  discard block
 block discarded – undo
947 947
 		$arrival_airport_country = '';
948 948
 		
949 949
             	
950
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
951
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
952
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
953
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
950
+            	if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
951
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
952
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
953
+            	if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
954 954
             	
955
-		$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) 
955
+		$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) 
956 956
 		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)';
957 957
 
958
-		$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);
958
+		$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);
959 959
 		//$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_array[0]['name'],':airline_icao' => $airline_array[0]['icao'],':airline_country' => $airline_array[0]['country'],':airline_type' => $airline_array[0]['type'],':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_array[0]['type'],':aircraft_manufacturer' => $aircraft_array[0]['manufacturer'],':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date);
960 960
 		try {
961 961
 			
962 962
 			$sth = $this->db->prepare($query);
963 963
 			$sth->execute($query_values);
964
-                } catch(PDOException $e) {
964
+                } catch (PDOException $e) {
965 965
                 	return "error : ".$e->getMessage();
966 966
                 }
967 967
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
968 968
 		    if ($globalDebug) echo '(Add to SBS archive : ';
969
-		    $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);
969
+		    $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);
970 970
 		    if ($globalDebug) echo $result.')';
971 971
 		}
972 972
 		return "success";
@@ -975,7 +975,7 @@  discard block
 block discarded – undo
975 975
 
976 976
 	public function getOrderBy()
977 977
 	{
978
-		$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"));
978
+		$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"));
979 979
 		return $orderby;
980 980
 	}
981 981
 
Please login to merge, or discard this patch.
require/class.Spotter.php 4 patches
Doc Comments   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	/**
16 16
 	* Get SQL query part for filter used
17 17
 	* @param Array $filter the filter
18
-	* @return Array the SQL part
18
+	* @return string the SQL part
19 19
 	*/
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter;
@@ -8612,6 +8612,7 @@  discard block
 block discarded – undo
8612 8612
 	/**
8613 8613
 	* Counts all hours
8614 8614
 	*
8615
+	* @param string $orderby
8615 8616
 	* @return Array the hour list
8616 8617
 	*
8617 8618
 	*/
@@ -8677,6 +8678,7 @@  discard block
 block discarded – undo
8677 8678
 	/**
8678 8679
 	* Counts all hours
8679 8680
 	*
8681
+	* @param string $orderby
8680 8682
 	* @return Array the hour list
8681 8683
 	*
8682 8684
 	*/
@@ -9501,7 +9503,7 @@  discard block
 block discarded – undo
9501 9503
 	/**
9502 9504
 	* Parses the direction degrees to working
9503 9505
 	*
9504
-	* @param Float $direction the direction in degrees
9506
+	* @param integer $direction the direction in degrees
9505 9507
 	* @return Array the direction information
9506 9508
 	*
9507 9509
 	*/
Please login to merge, or discard this patch.
Indentation   +1275 added lines, -1275 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 	}
14 14
 
15 15
 	/**
16
-	* Get SQL query part for filter used
17
-	* @param Array $filter the filter
18
-	* @return Array the SQL part
19
-	*/
16
+	 * Get SQL query part for filter used
17
+	 * @param Array $filter the filter
18
+	 * @return Array the SQL part
19
+	 */
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
22 22
 		$filters = array();
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
 	}
85 85
 
86 86
 	/**
87
-	* Executes the SQL statements to get the spotter information
88
-	*
89
-	* @param String $query the SQL query
90
-	* @param Array $params parameter of the query
91
-	* @param String $limitQuery the limit query
92
-	* @return Array the spotter information
93
-	*
94
-	*/
87
+	 * Executes the SQL statements to get the spotter information
88
+	 *
89
+	 * @param String $query the SQL query
90
+	 * @param Array $params parameter of the query
91
+	 * @param String $limitQuery the limit query
92
+	 * @return Array the spotter information
93
+	 *
94
+	 */
95 95
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
96 96
 	{
97 97
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
@@ -255,11 +255,11 @@  discard block
 block discarded – undo
255 255
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
256 256
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
257 257
 					} else $temp_array['aircraft_shadow'] = 'default.png';
258
-                                } else {
259
-                            		$temp_array['aircraft_shadow'] = 'default.png';
258
+								} else {
259
+									$temp_array['aircraft_shadow'] = 'default.png';
260 260
 					$temp_array['aircraft_name'] = 'N/A';
261 261
 					$temp_array['aircraft_manufacturer'] = 'N/A';
262
-                            	}
262
+								}
263 263
 			}
264 264
 			$fromsource = NULL;
265 265
 			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
@@ -454,11 +454,11 @@  discard block
 block discarded – undo
454 454
 	
455 455
 	
456 456
 	/**
457
-	* Gets all the spotter information
458
-	*
459
-	* @return Array the spotter information
460
-	*
461
-	*/
457
+	 * Gets all the spotter information
458
+	 *
459
+	 * @return Array the spotter information
460
+	 *
461
+	 */
462 462
 	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
463 463
 	{
464 464
 		global $globalTimezone, $globalDBdriver;
@@ -805,11 +805,11 @@  discard block
 block discarded – undo
805 805
 	
806 806
 	
807 807
 	/**
808
-	* Gets all the spotter information based on the latest data entry
809
-	*
810
-	* @return Array the spotter information
811
-	*
812
-	*/
808
+	 * Gets all the spotter information based on the latest data entry
809
+	 *
810
+	 * @return Array the spotter information
811
+	 *
812
+	 */
813 813
 	public function getLatestSpotterData($limit = '', $sort = '', $filter = array())
814 814
 	{
815 815
 		global $global_query;
@@ -848,12 +848,12 @@  discard block
 block discarded – undo
848 848
 	}
849 849
     
850 850
     
851
-    /**
852
-	* Gets all the spotter information based on a user's latitude and longitude
853
-	*
854
-	* @return Array the spotter information
855
-	*
856
-	*/
851
+	/**
852
+	 * Gets all the spotter information based on a user's latitude and longitude
853
+	 *
854
+	 * @return Array the spotter information
855
+	 *
856
+	 */
857 857
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
858 858
 	{
859 859
 		date_default_timezone_set('UTC');
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
 				return false;
882 882
 			}
883 883
 		}
884
-    		$additional_query = '';
884
+			$additional_query = '';
885 885
 		if ($interval != "")
886 886
 		{
887 887
 			if (!is_string($interval))
@@ -921,12 +921,12 @@  discard block
 block discarded – undo
921 921
 	}
922 922
     
923 923
     
924
-    /**
925
-	* Gets all the spotter information sorted by the newest aircraft type
926
-	*
927
-	* @return Array the spotter information
928
-	*
929
-	*/
924
+	/**
925
+	 * Gets all the spotter information sorted by the newest aircraft type
926
+	 *
927
+	 * @return Array the spotter information
928
+	 *
929
+	 */
930 930
 	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
931 931
 	{
932 932
 		global $global_query;
@@ -967,11 +967,11 @@  discard block
 block discarded – undo
967 967
     
968 968
     
969 969
 	/**
970
-	* Gets all the spotter information sorted by the newest aircraft registration
971
-	*
972
-	* @return Array the spotter information
973
-	*
974
-	*/
970
+	 * Gets all the spotter information sorted by the newest aircraft registration
971
+	 *
972
+	 * @return Array the spotter information
973
+	 *
974
+	 */
975 975
 	public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array())
976 976
 	{
977 977
 		global $global_query;
@@ -1011,11 +1011,11 @@  discard block
 block discarded – undo
1011 1011
 
1012 1012
 
1013 1013
 	/**
1014
-	* Gets all the spotter information sorted by the newest airline
1015
-	*
1016
-	* @return Array the spotter information
1017
-	*
1018
-	*/
1014
+	 * Gets all the spotter information sorted by the newest airline
1015
+	 *
1016
+	 * @return Array the spotter information
1017
+	 *
1018
+	 */
1019 1019
 	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1020 1020
 	{
1021 1021
 		global $global_query;
@@ -1054,12 +1054,12 @@  discard block
 block discarded – undo
1054 1054
 	}
1055 1055
     
1056 1056
     
1057
-    /**
1058
-	* Gets all the spotter information sorted by the newest departure airport
1059
-	*
1060
-	* @return Array the spotter information
1061
-	*
1062
-	*/
1057
+	/**
1058
+	 * Gets all the spotter information sorted by the newest departure airport
1059
+	 *
1060
+	 * @return Array the spotter information
1061
+	 *
1062
+	 */
1063 1063
 	public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array())
1064 1064
 	{
1065 1065
 		global $global_query;
@@ -1101,11 +1101,11 @@  discard block
 block discarded – undo
1101 1101
 
1102 1102
 
1103 1103
 	/**
1104
-	* Gets all the spotter information sorted by the newest arrival airport
1105
-	*
1106
-	* @return Array the spotter information
1107
-	*
1108
-	*/
1104
+	 * Gets all the spotter information sorted by the newest arrival airport
1105
+	 *
1106
+	 * @return Array the spotter information
1107
+	 *
1108
+	 */
1109 1109
 	public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array())
1110 1110
 	{
1111 1111
 		global $global_query;
@@ -1144,11 +1144,11 @@  discard block
 block discarded – undo
1144 1144
 	
1145 1145
 
1146 1146
 	/**
1147
-	* Gets all the spotter information based on the spotter id
1148
-	*
1149
-	* @return Array the spotter information
1150
-	*
1151
-	*/
1147
+	 * Gets all the spotter information based on the spotter id
1148
+	 *
1149
+	 * @return Array the spotter information
1150
+	 *
1151
+	 */
1152 1152
 	public function getSpotterDataByID($id = '')
1153 1153
 	{
1154 1154
 		global $global_query;
@@ -1170,11 +1170,11 @@  discard block
 block discarded – undo
1170 1170
 	
1171 1171
 	
1172 1172
 	/**
1173
-	* Gets all the spotter information based on the callsign
1174
-	*
1175
-	* @return Array the spotter information
1176
-	*
1177
-	*/
1173
+	 * Gets all the spotter information based on the callsign
1174
+	 *
1175
+	 * @return Array the spotter information
1176
+	 *
1177
+	 */
1178 1178
 	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
1179 1179
 	{
1180 1180
 		global $global_query;
@@ -1227,11 +1227,11 @@  discard block
 block discarded – undo
1227 1227
 	
1228 1228
 	
1229 1229
 	/**
1230
-	* Gets all the spotter information based on the aircraft type
1231
-	*
1232
-	* @return Array the spotter information
1233
-	*
1234
-	*/
1230
+	 * Gets all the spotter information based on the aircraft type
1231
+	 *
1232
+	 * @return Array the spotter information
1233
+	 *
1234
+	 */
1235 1235
 	public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array())
1236 1236
 	{
1237 1237
 		global $global_query;
@@ -1285,11 +1285,11 @@  discard block
 block discarded – undo
1285 1285
 	
1286 1286
 	
1287 1287
 	/**
1288
-	* Gets all the spotter information based on the aircraft registration
1289
-	*
1290
-	* @return Array the spotter information
1291
-	*
1292
-	*/
1288
+	 * Gets all the spotter information based on the aircraft registration
1289
+	 *
1290
+	 * @return Array the spotter information
1291
+	 *
1292
+	 */
1293 1293
 	public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array())
1294 1294
 	{
1295 1295
 		global $global_query;
@@ -1346,11 +1346,11 @@  discard block
 block discarded – undo
1346 1346
 	
1347 1347
 	
1348 1348
 	/**
1349
-	* Gets all the spotter information based on the airline
1350
-	*
1351
-	* @return Array the spotter information
1352
-	*
1353
-	*/
1349
+	 * Gets all the spotter information based on the airline
1350
+	 *
1351
+	 * @return Array the spotter information
1352
+	 *
1353
+	 */
1354 1354
 	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1355 1355
 	{
1356 1356
 		global $global_query;
@@ -1403,11 +1403,11 @@  discard block
 block discarded – undo
1403 1403
 	
1404 1404
 	
1405 1405
 	/**
1406
-	* Gets all the spotter information based on the airport
1407
-	*
1408
-	* @return Array the spotter information
1409
-	*
1410
-	*/
1406
+	 * Gets all the spotter information based on the airport
1407
+	 *
1408
+	 * @return Array the spotter information
1409
+	 *
1410
+	 */
1411 1411
 	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1412 1412
 	{
1413 1413
 		global $global_query;
@@ -1461,11 +1461,11 @@  discard block
 block discarded – undo
1461 1461
 
1462 1462
 
1463 1463
 	/**
1464
-	* Gets all the spotter information based on the date
1465
-	*
1466
-	* @return Array the spotter information
1467
-	*
1468
-	*/
1464
+	 * Gets all the spotter information based on the date
1465
+	 *
1466
+	 * @return Array the spotter information
1467
+	 *
1468
+	 */
1469 1469
 	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1470 1470
 	{
1471 1471
 		global $global_query, $globalTimezone, $globalDBdriver;
@@ -1526,11 +1526,11 @@  discard block
 block discarded – undo
1526 1526
 
1527 1527
 
1528 1528
 	/**
1529
-	* Gets all the spotter information based on the country name
1530
-	*
1531
-	* @return Array the spotter information
1532
-	*
1533
-	*/
1529
+	 * Gets all the spotter information based on the country name
1530
+	 *
1531
+	 * @return Array the spotter information
1532
+	 *
1533
+	 */
1534 1534
 	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1535 1535
 	{
1536 1536
 		global $global_query;
@@ -1584,11 +1584,11 @@  discard block
 block discarded – undo
1584 1584
 	
1585 1585
 	
1586 1586
 	/**
1587
-	* Gets all the spotter information based on the manufacturer name
1588
-	*
1589
-	* @return Array the spotter information
1590
-	*
1591
-	*/
1587
+	 * Gets all the spotter information based on the manufacturer name
1588
+	 *
1589
+	 * @return Array the spotter information
1590
+	 *
1591
+	 */
1592 1592
 	public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array())
1593 1593
 	{
1594 1594
 		global $global_query;
@@ -1644,13 +1644,13 @@  discard block
 block discarded – undo
1644 1644
   
1645 1645
   
1646 1646
 	/**
1647
-	* Gets a list of all aircraft that take a route
1648
-	*
1649
-	* @param String $departure_airport_icao ICAO code of departure airport
1650
-	* @param String $arrival_airport_icao ICAO code of arrival airport
1651
-	* @return Array the spotter information
1652
-	*
1653
-	*/
1647
+	 * Gets a list of all aircraft that take a route
1648
+	 *
1649
+	 * @param String $departure_airport_icao ICAO code of departure airport
1650
+	 * @param String $arrival_airport_icao ICAO code of arrival airport
1651
+	 * @return Array the spotter information
1652
+	 *
1653
+	 */
1654 1654
 	public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array())
1655 1655
 	{
1656 1656
 		global $global_query;
@@ -1717,11 +1717,11 @@  discard block
 block discarded – undo
1717 1717
 	
1718 1718
 	
1719 1719
 	/**
1720
-	* Gets all the spotter information based on the special column in the table
1721
-	*
1722
-	* @return Array the spotter information
1723
-	*
1724
-	*/
1720
+	 * Gets all the spotter information based on the special column in the table
1721
+	 *
1722
+	 * @return Array the spotter information
1723
+	 *
1724
+	 */
1725 1725
 	public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array())
1726 1726
 	{
1727 1727
 		global $global_query;
@@ -1760,11 +1760,11 @@  discard block
 block discarded – undo
1760 1760
 	}
1761 1761
 
1762 1762
 	/**
1763
-	* Gets all the highlight based on a aircraft registration
1764
-	*
1765
-	* @return String the highlight text
1766
-	*
1767
-	*/
1763
+	 * Gets all the highlight based on a aircraft registration
1764
+	 *
1765
+	 * @return String the highlight text
1766
+	 *
1767
+	 */
1768 1768
 	public function getHighlightByRegistration($registration,$filter = array())
1769 1769
 	{
1770 1770
 		global $global_query;
@@ -1786,13 +1786,13 @@  discard block
 block discarded – undo
1786 1786
 
1787 1787
 	
1788 1788
 	/**
1789
-	* Gets the squawk usage from squawk code
1790
-	*
1791
-	* @param String $squawk squawk code
1792
-	* @param String $country country
1793
-	* @return String usage
1794
-	*
1795
-	*/
1789
+	 * Gets the squawk usage from squawk code
1790
+	 *
1791
+	 * @param String $squawk squawk code
1792
+	 * @param String $country country
1793
+	 * @return String usage
1794
+	 *
1795
+	 */
1796 1796
 	public function getSquawkUsage($squawk = '',$country = 'FR')
1797 1797
 	{
1798 1798
 		
@@ -1813,12 +1813,12 @@  discard block
 block discarded – undo
1813 1813
 	}
1814 1814
 
1815 1815
 	/**
1816
-	* Gets the airport icao from the iata
1817
-	*
1818
-	* @param String $airport_iata the iata code of the airport
1819
-	* @return String airport iata
1820
-	*
1821
-	*/
1816
+	 * Gets the airport icao from the iata
1817
+	 *
1818
+	 * @param String $airport_iata the iata code of the airport
1819
+	 * @return String airport iata
1820
+	 *
1821
+	 */
1822 1822
 	public function getAirportIcao($airport_iata = '')
1823 1823
 	{
1824 1824
 		
@@ -1838,14 +1838,14 @@  discard block
 block discarded – undo
1838 1838
 	}
1839 1839
 
1840 1840
 	/**
1841
-	* Gets the airport distance
1842
-	*
1843
-	* @param String $airport_icao the icao code of the airport
1844
-	* @param Float $latitude the latitude
1845
-	* @param Float $longitude the longitude
1846
-	* @return Float distance to the airport
1847
-	*
1848
-	*/
1841
+	 * Gets the airport distance
1842
+	 *
1843
+	 * @param String $airport_icao the icao code of the airport
1844
+	 * @param Float $latitude the latitude
1845
+	 * @param Float $longitude the longitude
1846
+	 * @return Float distance to the airport
1847
+	 *
1848
+	 */
1849 1849
 	public function getAirportDistance($airport_icao,$latitude,$longitude)
1850 1850
 	{
1851 1851
 		
@@ -1866,12 +1866,12 @@  discard block
 block discarded – undo
1866 1866
 	}
1867 1867
 	
1868 1868
 	/**
1869
-	* Gets the airport info based on the icao
1870
-	*
1871
-	* @param String $airport the icao code of the airport
1872
-	* @return Array airport information
1873
-	*
1874
-	*/
1869
+	 * Gets the airport info based on the icao
1870
+	 *
1871
+	 * @param String $airport the icao code of the airport
1872
+	 * @return Array airport information
1873
+	 *
1874
+	 */
1875 1875
 	public function getAllAirportInfo($airport = '')
1876 1876
 	{
1877 1877
 		
@@ -1917,12 +1917,12 @@  discard block
 block discarded – undo
1917 1917
 	}
1918 1918
 	
1919 1919
 	/**
1920
-	* Gets the airport info based on the country
1921
-	*
1922
-	* @param Array $countries Airports countries
1923
-	* @return Array airport information
1924
-	*
1925
-	*/
1920
+	 * Gets the airport info based on the country
1921
+	 *
1922
+	 * @param Array $countries Airports countries
1923
+	 * @return Array airport information
1924
+	 *
1925
+	 */
1926 1926
 	public function getAllAirportInfobyCountry($countries)
1927 1927
 	{
1928 1928
 		$lst_countries = '';
@@ -1960,12 +1960,12 @@  discard block
 block discarded – undo
1960 1960
 	}
1961 1961
 	
1962 1962
 	/**
1963
-	* Gets airports info based on the coord
1964
-	*
1965
-	* @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1966
-	* @return Array airport information
1967
-	*
1968
-	*/
1963
+	 * Gets airports info based on the coord
1964
+	 *
1965
+	 * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1966
+	 * @return Array airport information
1967
+	 *
1968
+	 */
1969 1969
 	public function getAllAirportInfobyCoord($coord)
1970 1970
 	{
1971 1971
 		global $globalDBdriver;
@@ -1996,12 +1996,12 @@  discard block
 block discarded – undo
1996 1996
 	}
1997 1997
 
1998 1998
 	/**
1999
-	* Gets waypoints info based on the coord
2000
-	*
2001
-	* @param Array $coord waypoints coord
2002
-	* @return Array airport information
2003
-	*
2004
-	*/
1999
+	 * Gets waypoints info based on the coord
2000
+	 *
2001
+	 * @param Array $coord waypoints coord
2002
+	 * @return Array airport information
2003
+	 *
2004
+	 */
2005 2005
 	public function getAllWaypointsInfobyCoord($coord)
2006 2006
 	{
2007 2007
 		if (is_array($coord)) {
@@ -2035,12 +2035,12 @@  discard block
 block discarded – undo
2035 2035
 	
2036 2036
 	
2037 2037
 	/**
2038
-	* Gets the airline info based on the icao code or iata code
2039
-	*
2040
-	* @param String $airline_icao the iata code of the airport
2041
-	* @return Array airport information
2042
-	*
2043
-	*/
2038
+	 * Gets the airline info based on the icao code or iata code
2039
+	 *
2040
+	 * @param String $airline_icao the iata code of the airport
2041
+	 * @return Array airport information
2042
+	 *
2043
+	 */
2044 2044
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2045 2045
 	{
2046 2046
 		global $globalUseRealAirlines;
@@ -2071,7 +2071,7 @@  discard block
 block discarded – undo
2071 2071
 			} else {
2072 2072
 				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2073 2073
 			}
2074
-                        /*
2074
+						/*
2075 2075
 			$airline_array = array();
2076 2076
 			$temp_array = array();
2077 2077
 		
@@ -2103,12 +2103,12 @@  discard block
 block discarded – undo
2103 2103
 	
2104 2104
 	
2105 2105
 	/**
2106
-	* Gets the aircraft info based on the aircraft type
2107
-	*
2108
-	* @param String $aircraft_type the aircraft type
2109
-	* @return Array aircraft information
2110
-	*
2111
-	*/
2106
+	 * Gets the aircraft info based on the aircraft type
2107
+	 *
2108
+	 * @param String $aircraft_type the aircraft type
2109
+	 * @return Array aircraft information
2110
+	 *
2111
+	 */
2112 2112
 	public function getAllAircraftInfo($aircraft_type)
2113 2113
 	{
2114 2114
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2140,12 +2140,12 @@  discard block
 block discarded – undo
2140 2140
 	}
2141 2141
 
2142 2142
 	/**
2143
-	* Gets the aircraft icao based on the aircraft name/type
2144
-	*
2145
-	* @param String $aircraft_type the aircraft type
2146
-	* @return String aircraft information
2147
-	*
2148
-	*/
2143
+	 * Gets the aircraft icao based on the aircraft name/type
2144
+	 *
2145
+	 * @param String $aircraft_type the aircraft type
2146
+	 * @return String aircraft information
2147
+	 *
2148
+	 */
2149 2149
 	public function getAircraftIcao($aircraft_type)
2150 2150
 	{
2151 2151
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2170,12 +2170,12 @@  discard block
 block discarded – undo
2170 2170
 	}
2171 2171
 	
2172 2172
 	/**
2173
-	* Gets the aircraft info based on the aircraft ident
2174
-	*
2175
-	* @param String $aircraft_modes the aircraft ident (hex)
2176
-	* @return String aircraft type
2177
-	*
2178
-	*/
2173
+	 * Gets the aircraft info based on the aircraft ident
2174
+	 *
2175
+	 * @param String $aircraft_modes the aircraft ident (hex)
2176
+	 * @return String aircraft type
2177
+	 *
2178
+	 */
2179 2179
 	public function getAllAircraftType($aircraft_modes)
2180 2180
 	{
2181 2181
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -2193,12 +2193,12 @@  discard block
 block discarded – undo
2193 2193
 	}
2194 2194
 
2195 2195
 	/**
2196
-	* Gets correct aircraft operator corde
2197
-	*
2198
-	* @param String $operator the aircraft operator code (callsign)
2199
-	* @return String aircraft operator code
2200
-	*
2201
-	*/
2196
+	 * Gets correct aircraft operator corde
2197
+	 *
2198
+	 * @param String $operator the aircraft operator code (callsign)
2199
+	 * @return String aircraft operator code
2200
+	 *
2201
+	 */
2202 2202
 	public function getOperator($operator)
2203 2203
 	{
2204 2204
 		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
@@ -2215,16 +2215,16 @@  discard block
 block discarded – undo
2215 2215
 	}
2216 2216
 
2217 2217
 	/**
2218
-	* Gets the aircraft route based on the aircraft callsign
2219
-	*
2220
-	* @param String $callsign the aircraft callsign
2221
-	* @return Array aircraft type
2222
-	*
2223
-	*/
2218
+	 * Gets the aircraft route based on the aircraft callsign
2219
+	 *
2220
+	 * @param String $callsign the aircraft callsign
2221
+	 * @return Array aircraft type
2222
+	 *
2223
+	 */
2224 2224
 	public function getRouteInfo($callsign)
2225 2225
 	{
2226 2226
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2227
-                if ($callsign == '') return array();
2227
+				if ($callsign == '') return array();
2228 2228
 		$query  = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2229 2229
 		
2230 2230
 		$sth = $this->db->prepare($query);
@@ -2238,12 +2238,12 @@  discard block
 block discarded – undo
2238 2238
 	}
2239 2239
 	
2240 2240
 	/**
2241
-	* Gets the aircraft info based on the aircraft registration
2242
-	*
2243
-	* @param String $registration the aircraft registration
2244
-	* @return Array aircraft information
2245
-	*
2246
-	*/
2241
+	 * Gets the aircraft info based on the aircraft registration
2242
+	 *
2243
+	 * @param String $registration the aircraft registration
2244
+	 * @return Array aircraft information
2245
+	 *
2246
+	 */
2247 2247
 	public function getAircraftInfoByRegistration($registration)
2248 2248
 	{
2249 2249
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2270,12 +2270,12 @@  discard block
 block discarded – undo
2270 2270
 	}
2271 2271
 	
2272 2272
 	/**
2273
-	* Gets the aircraft owner & base based on the aircraft registration
2274
-	*
2275
-	* @param String $registration the aircraft registration
2276
-	* @return Array aircraft information
2277
-	*
2278
-	*/
2273
+	 * Gets the aircraft owner & base based on the aircraft registration
2274
+	 *
2275
+	 * @param String $registration the aircraft registration
2276
+	 * @return Array aircraft information
2277
+	 *
2278
+	 */
2279 2279
 	public function getAircraftOwnerByRegistration($registration)
2280 2280
 	{
2281 2281
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2292,11 +2292,11 @@  discard block
 block discarded – undo
2292 2292
 	
2293 2293
   
2294 2294
   /**
2295
-	* Gets all flights (but with only little info)
2296
-	*
2297
-	* @return Array basic flight information
2298
-	*
2299
-	*/
2295
+   * Gets all flights (but with only little info)
2296
+   *
2297
+   * @return Array basic flight information
2298
+   *
2299
+   */
2300 2300
 	public function getAllFlightsforSitemap()
2301 2301
 	{
2302 2302
 		//$query  = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT ";
@@ -2304,7 +2304,7 @@  discard block
 block discarded – undo
2304 2304
 		
2305 2305
 		$sth = $this->db->prepare($query);
2306 2306
 		$sth->execute();
2307
-                  /*
2307
+				  /*
2308 2308
 		$flight_array = array();
2309 2309
 		$temp_array = array();
2310 2310
 		
@@ -2326,11 +2326,11 @@  discard block
 block discarded – undo
2326 2326
 	}
2327 2327
   
2328 2328
 	/**
2329
-	* Gets a list of all aircraft manufacturers
2330
-	*
2331
-	* @return Array list of aircraft types
2332
-	*
2333
-	*/
2329
+	 * Gets a list of all aircraft manufacturers
2330
+	 *
2331
+	 * @return Array list of aircraft types
2332
+	 *
2333
+	 */
2334 2334
 	public function getAllManufacturers()
2335 2335
 	{
2336 2336
 		/*
@@ -2359,11 +2359,11 @@  discard block
 block discarded – undo
2359 2359
   
2360 2360
   
2361 2361
   /**
2362
-	* Gets a list of all aircraft types
2363
-	*
2364
-	* @return Array list of aircraft types
2365
-	*
2366
-	*/
2362
+   * Gets a list of all aircraft types
2363
+   *
2364
+   * @return Array list of aircraft types
2365
+   *
2366
+   */
2367 2367
 	public function getAllAircraftTypes($filters = array())
2368 2368
 	{
2369 2369
 		/*
@@ -2396,11 +2396,11 @@  discard block
 block discarded – undo
2396 2396
 	
2397 2397
 	
2398 2398
 	/**
2399
-	* Gets a list of all aircraft registrations
2400
-	*
2401
-	* @return Array list of aircraft registrations
2402
-	*
2403
-	*/
2399
+	 * Gets a list of all aircraft registrations
2400
+	 *
2401
+	 * @return Array list of aircraft registrations
2402
+	 *
2403
+	 */
2404 2404
 	public function getAllAircraftRegistrations($filters = array())
2405 2405
 	{
2406 2406
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2425,12 +2425,12 @@  discard block
 block discarded – undo
2425 2425
 	}
2426 2426
 
2427 2427
 	/**
2428
-	* Gets all source name
2429
-	*
2430
-	* @param String type format of source
2431
-	* @return Array list of source name
2432
-	*
2433
-	*/
2428
+	 * Gets all source name
2429
+	 *
2430
+	 * @param String type format of source
2431
+	 * @return Array list of source name
2432
+	 *
2433
+	 */
2434 2434
 	public function getAllSourceName($type = '',$filters = array())
2435 2435
 	{
2436 2436
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2461,11 +2461,11 @@  discard block
 block discarded – undo
2461 2461
 
2462 2462
 
2463 2463
 	/**
2464
-	* Gets a list of all airline names
2465
-	*
2466
-	* @return Array list of airline names
2467
-	*
2468
-	*/
2464
+	 * Gets a list of all airline names
2465
+	 *
2466
+	 * @return Array list of airline names
2467
+	 *
2468
+	 */
2469 2469
 	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2470 2470
 	{
2471 2471
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2515,11 +2515,11 @@  discard block
 block discarded – undo
2515 2515
 	
2516 2516
 	
2517 2517
 	/**
2518
-	* Gets a list of all airline countries
2519
-	*
2520
-	* @return Array list of airline countries
2521
-	*
2522
-	*/
2518
+	 * Gets a list of all airline countries
2519
+	 *
2520
+	 * @return Array list of airline countries
2521
+	 *
2522
+	 */
2523 2523
 	public function getAllAirlineCountries($filters = array())
2524 2524
 	{
2525 2525
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2547,11 +2547,11 @@  discard block
 block discarded – undo
2547 2547
 	
2548 2548
 	
2549 2549
 	/**
2550
-	* Gets a list of all departure & arrival names
2551
-	*
2552
-	* @return Array list of airport names
2553
-	*
2554
-	*/
2550
+	 * Gets a list of all departure & arrival names
2551
+	 *
2552
+	 * @return Array list of airport names
2553
+	 *
2554
+	 */
2555 2555
 	public function getAllAirportNames($filters = array())
2556 2556
 	{
2557 2557
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2600,11 +2600,11 @@  discard block
 block discarded – undo
2600 2600
 	
2601 2601
 	
2602 2602
 	/**
2603
-	* Gets a list of all departure & arrival airport countries
2604
-	*
2605
-	* @return Array list of airport countries
2606
-	*
2607
-	*/
2603
+	 * Gets a list of all departure & arrival airport countries
2604
+	 *
2605
+	 * @return Array list of airport countries
2606
+	 *
2607
+	 */
2608 2608
 	public function getAllAirportCountries($filters = array())
2609 2609
 	{
2610 2610
 		$airport_array = array();
@@ -2652,11 +2652,11 @@  discard block
 block discarded – undo
2652 2652
 	
2653 2653
 	
2654 2654
 	/**
2655
-	* Gets a list of all countries (airline, departure airport & arrival airport)
2656
-	*
2657
-	* @return Array list of countries
2658
-	*
2659
-	*/
2655
+	 * Gets a list of all countries (airline, departure airport & arrival airport)
2656
+	 *
2657
+	 * @return Array list of countries
2658
+	 *
2659
+	 */
2660 2660
 	public function getAllCountries($filters = array())
2661 2661
 	{
2662 2662
 		$Connection= new Connection($this->db);
@@ -2733,11 +2733,11 @@  discard block
 block discarded – undo
2733 2733
 	
2734 2734
 	
2735 2735
 	/**
2736
-	* Gets a list of all idents/callsigns
2737
-	*
2738
-	* @return Array list of ident/callsign names
2739
-	*
2740
-	*/
2736
+	 * Gets a list of all idents/callsigns
2737
+	 *
2738
+	 * @return Array list of ident/callsign names
2739
+	 *
2740
+	 */
2741 2741
 	public function getAllIdents($filters = array())
2742 2742
 	{
2743 2743
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2761,9 +2761,9 @@  discard block
 block discarded – undo
2761 2761
 	}
2762 2762
 
2763 2763
 	/**
2764
-	* Get a list of flights from airport since 7 days
2765
-	* @return Array number, icao, name and city of airports
2766
-	*/
2764
+	 * Get a list of flights from airport since 7 days
2765
+	 * @return Array number, icao, name and city of airports
2766
+	 */
2767 2767
 
2768 2768
 	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
2769 2769
 		global $globalTimezone, $globalDBdriver;
@@ -2794,9 +2794,9 @@  discard block
 block discarded – undo
2794 2794
 	}
2795 2795
 
2796 2796
 	/**
2797
-	* Get a list of flights from airport since 7 days
2798
-	* @return Array number, icao, name and city of airports
2799
-	*/
2797
+	 * Get a list of flights from airport since 7 days
2798
+	 * @return Array number, icao, name and city of airports
2799
+	 */
2800 2800
 
2801 2801
 	public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') {
2802 2802
 		global $globalTimezone, $globalDBdriver;
@@ -2826,9 +2826,9 @@  discard block
 block discarded – undo
2826 2826
 	}
2827 2827
 
2828 2828
 	/**
2829
-	* Get a list of flights from detected airport since 7 days
2830
-	* @return Array number, icao, name and city of airports
2831
-	*/
2829
+	 * Get a list of flights from detected airport since 7 days
2830
+	 * @return Array number, icao, name and city of airports
2831
+	 */
2832 2832
 
2833 2833
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
2834 2834
 		global $globalTimezone, $globalDBdriver;
@@ -2866,9 +2866,9 @@  discard block
 block discarded – undo
2866 2866
 	}
2867 2867
 
2868 2868
 	/**
2869
-	* Get a list of flights from detected airport since 7 days
2870
-	* @return Array number, icao, name and city of airports
2871
-	*/
2869
+	 * Get a list of flights from detected airport since 7 days
2870
+	 * @return Array number, icao, name and city of airports
2871
+	 */
2872 2872
 
2873 2873
 	public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') {
2874 2874
 		global $globalTimezone, $globalDBdriver;
@@ -2910,9 +2910,9 @@  discard block
 block discarded – undo
2910 2910
 
2911 2911
 
2912 2912
 	/**
2913
-	* Get a list of flights to airport since 7 days
2914
-	* @return Array number, icao, name and city of airports
2915
-	*/
2913
+	 * Get a list of flights to airport since 7 days
2914
+	 * @return Array number, icao, name and city of airports
2915
+	 */
2916 2916
 
2917 2917
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
2918 2918
 		global $globalTimezone, $globalDBdriver;
@@ -2945,9 +2945,9 @@  discard block
 block discarded – undo
2945 2945
 
2946 2946
 
2947 2947
 	/**
2948
-	* Get a list of flights detected to airport since 7 days
2949
-	* @return Array number, icao, name and city of airports
2950
-	*/
2948
+	 * Get a list of flights detected to airport since 7 days
2949
+	 * @return Array number, icao, name and city of airports
2950
+	 */
2951 2951
 
2952 2952
 	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
2953 2953
 		global $globalTimezone, $globalDBdriver;
@@ -2988,9 +2988,9 @@  discard block
 block discarded – undo
2988 2988
 
2989 2989
 
2990 2990
 	/**
2991
-	* Get a list of flights to airport since 7 days
2992
-	* @return Array number, icao, name and city of airports
2993
-	*/
2991
+	 * Get a list of flights to airport since 7 days
2992
+	 * @return Array number, icao, name and city of airports
2993
+	 */
2994 2994
 
2995 2995
 	public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') {
2996 2996
 		global $globalTimezone, $globalDBdriver;
@@ -3022,9 +3022,9 @@  discard block
 block discarded – undo
3022 3022
 
3023 3023
 
3024 3024
 	/**
3025
-	* Get a list of flights detected to airport since 7 days
3026
-	* @return Array number, icao, name and city of airports
3027
-	*/
3025
+	 * Get a list of flights detected to airport since 7 days
3026
+	 * @return Array number, icao, name and city of airports
3027
+	 */
3028 3028
 
3029 3029
 	public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') {
3030 3030
 		global $globalTimezone, $globalDBdriver;
@@ -3068,11 +3068,11 @@  discard block
 block discarded – undo
3068 3068
 
3069 3069
 
3070 3070
 	/**
3071
-	* Gets a list of all dates
3072
-	*
3073
-	* @return Array list of date names
3074
-	*
3075
-	*/
3071
+	 * Gets a list of all dates
3072
+	 *
3073
+	 * @return Array list of date names
3074
+	 *
3075
+	 */
3076 3076
 	public function getAllDates()
3077 3077
 	{
3078 3078
 		global $globalTimezone, $globalDBdriver;
@@ -3113,11 +3113,11 @@  discard block
 block discarded – undo
3113 3113
 	
3114 3114
 	
3115 3115
 	/**
3116
-	* Gets all route combinations
3117
-	*
3118
-	* @return Array the route list
3119
-	*
3120
-	*/
3116
+	 * Gets all route combinations
3117
+	 *
3118
+	 * @return Array the route list
3119
+	 *
3120
+	 */
3121 3121
 	public function getAllRoutes()
3122 3122
 	{
3123 3123
 		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route,  spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao 
@@ -3143,13 +3143,13 @@  discard block
 block discarded – undo
3143 3143
 	}
3144 3144
 
3145 3145
 	/**
3146
-	* Update ident spotter data
3147
-	*
3148
-	* @param String $flightaware_id the ID from flightaware
3149
-	* @param String $ident the flight ident
3150
-	* @return String success or false
3151
-	*
3152
-	*/	
3146
+	 * Update ident spotter data
3147
+	 *
3148
+	 * @param String $flightaware_id the ID from flightaware
3149
+	 * @param String $ident the flight ident
3150
+	 * @return String success or false
3151
+	 *
3152
+	 */	
3153 3153
 	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3154 3154
 	{
3155 3155
 		if (!is_numeric(substr($ident, 0, 3)))
@@ -3170,14 +3170,14 @@  discard block
 block discarded – undo
3170 3170
 		} else {
3171 3171
 			$airline_array = $this->getAllAirlineInfo("NA");
3172 3172
 		}
3173
-                $airline_name = $airline_array[0]['name'];
3174
-                $airline_icao = $airline_array[0]['icao'];
3175
-                $airline_country = $airline_array[0]['country'];
3176
-                $airline_type = $airline_array[0]['type'];
3173
+				$airline_name = $airline_array[0]['name'];
3174
+				$airline_icao = $airline_array[0]['icao'];
3175
+				$airline_country = $airline_array[0]['country'];
3176
+				$airline_type = $airline_array[0]['type'];
3177 3177
 
3178 3178
 
3179 3179
 		$query = 'UPDATE spotter_output SET ident = :ident, airline_name = :airline_name, airline_icao = :airline_icao, airline_country = :airline_country, airline_type = :airline_type WHERE flightaware_id = :flightaware_id';
3180
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type);
3180
+				$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type);
3181 3181
 
3182 3182
 		try {
3183 3183
 			$sth = $this->db->prepare($query);
@@ -3190,19 +3190,19 @@  discard block
 block discarded – undo
3190 3190
 
3191 3191
 	}
3192 3192
 	/**
3193
-	* Update latest spotter data
3194
-	*
3195
-	* @param String $flightaware_id the ID from flightaware
3196
-	* @param String $ident the flight ident
3197
-	* @param String $arrival_airport_icao the arrival airport
3198
-	* @return String success or false
3199
-	*
3200
-	*/	
3193
+	 * Update latest spotter data
3194
+	 *
3195
+	 * @param String $flightaware_id the ID from flightaware
3196
+	 * @param String $ident the flight ident
3197
+	 * @param String $arrival_airport_icao the arrival airport
3198
+	 * @return String success or false
3199
+	 *
3200
+	 */	
3201 3201
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3202 3202
 	{
3203 3203
 		if ($groundspeed == '') $groundspeed = NULL;
3204 3204
 		$query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id';
3205
-                $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3205
+				$query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3206 3206
 
3207 3207
 		try {
3208 3208
 			$sth = $this->db->prepare($query);
@@ -3216,32 +3216,32 @@  discard block
 block discarded – undo
3216 3216
 	}
3217 3217
 
3218 3218
 	/**
3219
-	* Adds a new spotter data
3220
-	*
3221
-	* @param String $flightaware_id the ID from flightaware
3222
-	* @param String $ident the flight ident
3223
-	* @param String $aircraft_icao the aircraft type
3224
-	* @param String $departure_airport_icao the departure airport
3225
-	* @param String $arrival_airport_icao the arrival airport
3226
-	* @param String $latitude latitude of flight
3227
-	* @param String $longitude latitude of flight
3228
-	* @param String $waypoints waypoints of flight
3229
-	* @param String $altitude altitude of flight
3230
-	* @param String $heading heading of flight
3231
-	* @param String $groundspeed speed of flight
3232
-	* @param String $date date of flight
3233
-	* @param String $departure_airport_time departure time of flight
3234
-	* @param String $arrival_airport_time arrival time of flight
3235
-	* @param String $squawk squawk code of flight
3236
-	* @param String $route_stop route stop of flight
3237
-	* @param String $highlight highlight or not
3238
-	* @param String $ModeS ModesS code of flight
3239
-	* @param String $registration registration code of flight
3240
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
3241
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
3242
-	* @param String $verticalrate vertival rate of flight
3243
-	* @return String success or false
3244
-	*/
3219
+	 * Adds a new spotter data
3220
+	 *
3221
+	 * @param String $flightaware_id the ID from flightaware
3222
+	 * @param String $ident the flight ident
3223
+	 * @param String $aircraft_icao the aircraft type
3224
+	 * @param String $departure_airport_icao the departure airport
3225
+	 * @param String $arrival_airport_icao the arrival airport
3226
+	 * @param String $latitude latitude of flight
3227
+	 * @param String $longitude latitude of flight
3228
+	 * @param String $waypoints waypoints of flight
3229
+	 * @param String $altitude altitude of flight
3230
+	 * @param String $heading heading of flight
3231
+	 * @param String $groundspeed speed of flight
3232
+	 * @param String $date date of flight
3233
+	 * @param String $departure_airport_time departure time of flight
3234
+	 * @param String $arrival_airport_time arrival time of flight
3235
+	 * @param String $squawk squawk code of flight
3236
+	 * @param String $route_stop route stop of flight
3237
+	 * @param String $highlight highlight or not
3238
+	 * @param String $ModeS ModesS code of flight
3239
+	 * @param String $registration registration code of flight
3240
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
3241
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
3242
+	 * @param String $verticalrate vertival rate of flight
3243
+	 * @return String success or false
3244
+	 */
3245 3245
 	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '',$squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '')
3246 3246
 	{
3247 3247
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
@@ -3455,8 +3455,8 @@  discard block
 block discarded – undo
3455 3455
     
3456 3456
 		if ($globalIVAO && $aircraft_icao != '')
3457 3457
 		{
3458
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3459
-            		else $airline_icao = '';
3458
+					if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3459
+					else $airline_icao = '';
3460 3460
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3461 3461
 			if (!isset($image_array[0]['registration']))
3462 3462
 			{
@@ -3487,52 +3487,52 @@  discard block
 block discarded – undo
3487 3487
 	
3488 3488
 		if (count($airline_array) == 0) 
3489 3489
 		{
3490
-                        $airline_array = $this->getAllAirlineInfo('NA');
3491
-                }
3492
-                if (count($aircraft_array) == 0) 
3493
-                {
3494
-                        $aircraft_array = $this->getAllAircraftInfo('NA');
3495
-                }
3496
-                if (count($departure_airport_array) == 0) 
3497
-                {
3498
-                        $departure_airport_array = $this->getAllAirportInfo('NA');
3499
-                }
3500
-                if (count($arrival_airport_array) == 0) 
3501
-                {
3502
-                        $arrival_airport_array = $this->getAllAirportInfo('NA');
3503
-                }
3504
-                if ($registration == '') $registration = 'NA';
3505
-                if ($latitude == '' && $longitude == '') {
3506
-            		$latitude = 0;
3507
-            		$longitude = 0;
3508
-            	}
3509
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3510
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3511
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3512
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3513
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3514
-                $query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3490
+						$airline_array = $this->getAllAirlineInfo('NA');
3491
+				}
3492
+				if (count($aircraft_array) == 0) 
3493
+				{
3494
+						$aircraft_array = $this->getAllAircraftInfo('NA');
3495
+				}
3496
+				if (count($departure_airport_array) == 0) 
3497
+				{
3498
+						$departure_airport_array = $this->getAllAirportInfo('NA');
3499
+				}
3500
+				if (count($arrival_airport_array) == 0) 
3501
+				{
3502
+						$arrival_airport_array = $this->getAllAirportInfo('NA');
3503
+				}
3504
+				if ($registration == '') $registration = 'NA';
3505
+				if ($latitude == '' && $longitude == '') {
3506
+					$latitude = 0;
3507
+					$longitude = 0;
3508
+				}
3509
+				if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3510
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3511
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3512
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3513
+				if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3514
+				$query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3515 3515
                 VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)";
3516 3516
 
3517
-                $airline_name = $airline_array[0]['name'];
3518
-                $airline_icao = $airline_array[0]['icao'];
3519
-                $airline_country = $airline_array[0]['country'];
3520
-                $airline_type = $airline_array[0]['type'];
3517
+				$airline_name = $airline_array[0]['name'];
3518
+				$airline_icao = $airline_array[0]['icao'];
3519
+				$airline_country = $airline_array[0]['country'];
3520
+				$airline_type = $airline_array[0]['type'];
3521 3521
 		if ($airline_type == '') {
3522 3522
 			$timeelapsed = microtime(true);
3523 3523
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3524 3524
 			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3525 3525
 		}
3526 3526
 		if ($airline_type == null) $airline_type = '';
3527
-                $aircraft_type = $aircraft_array[0]['type'];
3528
-                $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3529
-                $departure_airport_name = $departure_airport_array[0]['name'];
3530
-                $departure_airport_city = $departure_airport_array[0]['city'];
3531
-                $departure_airport_country = $departure_airport_array[0]['country'];
3532
-                $arrival_airport_name = $arrival_airport_array[0]['name'];
3533
-                $arrival_airport_city = $arrival_airport_array[0]['city'];
3534
-                $arrival_airport_country = $arrival_airport_array[0]['country'];
3535
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3527
+				$aircraft_type = $aircraft_array[0]['type'];
3528
+				$aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3529
+				$departure_airport_name = $departure_airport_array[0]['name'];
3530
+				$departure_airport_city = $departure_airport_array[0]['city'];
3531
+				$departure_airport_country = $departure_airport_array[0]['country'];
3532
+				$arrival_airport_name = $arrival_airport_array[0]['name'];
3533
+				$arrival_airport_city = $arrival_airport_array[0]['city'];
3534
+				$arrival_airport_country = $arrival_airport_array[0]['country'];
3535
+				$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3536 3536
 
3537 3537
 		try {
3538 3538
 		        
@@ -3540,7 +3540,7 @@  discard block
 block discarded – undo
3540 3540
 			$sth->execute($query_values);
3541 3541
 			$this->db = null;
3542 3542
 		} catch (PDOException $e) {
3543
-		    return "error : ".$e->getMessage();
3543
+			return "error : ".$e->getMessage();
3544 3544
 		}
3545 3545
 		
3546 3546
 		return "success";
@@ -3549,11 +3549,11 @@  discard block
 block discarded – undo
3549 3549
 	
3550 3550
   
3551 3551
 	/**
3552
-	* Gets the aircraft ident within the last hour
3553
-	*
3554
-	* @return String the ident
3555
-	*
3556
-	*/
3552
+	 * Gets the aircraft ident within the last hour
3553
+	 *
3554
+	 * @return String the ident
3555
+	 *
3556
+	 */
3557 3557
 	public function getIdentFromLastHour($ident)
3558 3558
 	{
3559 3559
 		global $globalDBdriver, $globalTimezone;
@@ -3569,11 +3569,11 @@  discard block
 block discarded – undo
3569 3569
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3570 3570
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
3571 3571
 			$query_data = array(':ident' => $ident);
3572
-    		}
3572
+			}
3573 3573
 		
3574 3574
 		$sth = $this->db->prepare($query);
3575 3575
 		$sth->execute($query_data);
3576
-    		$ident_result='';
3576
+			$ident_result='';
3577 3577
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3578 3578
 		{
3579 3579
 			$ident_result = $row['ident'];
@@ -3584,11 +3584,11 @@  discard block
 block discarded – undo
3584 3584
 	
3585 3585
 	
3586 3586
 	/**
3587
-	* Gets the aircraft data from the last 20 seconds
3588
-	*
3589
-	* @return Array the spotter data
3590
-	*
3591
-	*/
3587
+	 * Gets the aircraft data from the last 20 seconds
3588
+	 *
3589
+	 * @return Array the spotter data
3590
+	 *
3591
+	 */
3592 3592
 	public function getRealTimeData($q = '')
3593 3593
 	{
3594 3594
 		global $globalDBdriver;
@@ -3632,11 +3632,11 @@  discard block
 block discarded – undo
3632 3632
 	
3633 3633
 	
3634 3634
 	 /**
3635
-	* Gets all airlines that have flown over
3636
-	*
3637
-	* @return Array the airline list
3638
-	*
3639
-	*/
3635
+	  * Gets all airlines that have flown over
3636
+	  *
3637
+	  * @return Array the airline list
3638
+	  *
3639
+	  */
3640 3640
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3641 3641
 	{
3642 3642
 		global $globalDBdriver;
@@ -3650,7 +3650,7 @@  discard block
 block discarded – undo
3650 3650
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3651 3651
 			}
3652 3652
 		}
3653
-                if ($sincedate != '') {
3653
+				if ($sincedate != '') {
3654 3654
 			if ($globalDBdriver == 'mysql') {
3655 3655
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3656 3656
 			} else {
@@ -3677,26 +3677,26 @@  discard block
 block discarded – undo
3677 3677
 	}
3678 3678
 
3679 3679
 	 /**
3680
-	* Gets all pilots that have flown over
3681
-	*
3682
-	* @return Array the pilots list
3683
-	*
3684
-	*/
3680
+	  * Gets all pilots that have flown over
3681
+	  *
3682
+	  * @return Array the pilots list
3683
+	  *
3684
+	  */
3685 3685
 	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3686 3686
 	{
3687 3687
 		global $globalDBdriver;
3688 3688
 		$filter_query = $this->getFilter($filters,true,true);
3689 3689
 		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3690 3690
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3691
-                if ($olderthanmonths > 0) {
3692
-            		if ($globalDBdriver == 'mysql') {
3691
+				if ($olderthanmonths > 0) {
3692
+					if ($globalDBdriver == 'mysql') {
3693 3693
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3694 3694
 			} else {
3695 3695
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3696 3696
 			}
3697 3697
 		}
3698
-                if ($sincedate != '') {
3699
-            		if ($globalDBdriver == 'mysql') {
3698
+				if ($sincedate != '') {
3699
+					if ($globalDBdriver == 'mysql') {
3700 3700
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3701 3701
 			} else {
3702 3702
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3724,25 +3724,25 @@  discard block
 block discarded – undo
3724 3724
 	}
3725 3725
 	
3726 3726
 		 /**
3727
-	* Gets all pilots that have flown over
3728
-	*
3729
-	* @return Array the pilots list
3730
-	*
3731
-	*/
3727
+		  * Gets all pilots that have flown over
3728
+		  *
3729
+		  * @return Array the pilots list
3730
+		  *
3731
+		  */
3732 3732
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3733 3733
 	{
3734 3734
 		global $globalDBdriver;
3735 3735
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3736 3736
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
3737
-                if ($olderthanmonths > 0) {
3738
-            		if ($globalDBdriver == 'mysql') {
3737
+				if ($olderthanmonths > 0) {
3738
+					if ($globalDBdriver == 'mysql') {
3739 3739
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3740 3740
 			} else {
3741 3741
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3742 3742
 			}
3743 3743
 		}
3744
-                if ($sincedate != '') {
3745
-            		if ($globalDBdriver == 'mysql') {
3744
+				if ($sincedate != '') {
3745
+					if ($globalDBdriver == 'mysql') {
3746 3746
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3747 3747
 			} else {
3748 3748
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3771,26 +3771,26 @@  discard block
 block discarded – undo
3771 3771
 	}
3772 3772
 	
3773 3773
 	 /**
3774
-	* Gets all owner that have flown over
3775
-	*
3776
-	* @return Array the pilots list
3777
-	*
3778
-	*/
3774
+	  * Gets all owner that have flown over
3775
+	  *
3776
+	  * @return Array the pilots list
3777
+	  *
3778
+	  */
3779 3779
 	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3780 3780
 	{
3781 3781
 		global $globalDBdriver;
3782 3782
 		$filter_query = $this->getFilter($filters,true,true);
3783 3783
 		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3784 3784
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3785
-                if ($olderthanmonths > 0) {
3786
-            		if ($globalDBdriver == 'mysql') {
3785
+				if ($olderthanmonths > 0) {
3786
+					if ($globalDBdriver == 'mysql') {
3787 3787
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3788 3788
 			} else {
3789 3789
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3790 3790
 			}
3791 3791
 		}
3792
-                if ($sincedate != '') {
3793
-            		if ($globalDBdriver == 'mysql') {
3792
+				if ($sincedate != '') {
3793
+					if ($globalDBdriver == 'mysql') {
3794 3794
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3795 3795
 			} else {
3796 3796
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3816,26 +3816,26 @@  discard block
 block discarded – undo
3816 3816
 	}
3817 3817
 	
3818 3818
 	 /**
3819
-	* Gets all owner that have flown over
3820
-	*
3821
-	* @return Array the pilots list
3822
-	*
3823
-	*/
3819
+	  * Gets all owner that have flown over
3820
+	  *
3821
+	  * @return Array the pilots list
3822
+	  *
3823
+	  */
3824 3824
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3825 3825
 	{
3826 3826
 		global $globalDBdriver;
3827 3827
 		$filter_query = $this->getFilter($filters,true,true);
3828 3828
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3829 3829
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3830
-                if ($olderthanmonths > 0) {
3831
-            		if ($globalDBdriver == 'mysql') {
3830
+				if ($olderthanmonths > 0) {
3831
+					if ($globalDBdriver == 'mysql') {
3832 3832
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3833 3833
 			} else {
3834 3834
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3835 3835
 			}
3836 3836
 		}
3837
-                if ($sincedate != '') {
3838
-            		if ($globalDBdriver == 'mysql') {
3837
+				if ($sincedate != '') {
3838
+					if ($globalDBdriver == 'mysql') {
3839 3839
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3840 3840
 			} else {
3841 3841
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3862,11 +3862,11 @@  discard block
 block discarded – undo
3862 3862
 	}
3863 3863
 
3864 3864
 	/**
3865
-	* Gets all airlines that have flown over by aircraft
3866
-	*
3867
-	* @return Array the airline list
3868
-	*
3869
-	*/
3865
+	 * Gets all airlines that have flown over by aircraft
3866
+	 *
3867
+	 * @return Array the airline list
3868
+	 *
3869
+	 */
3870 3870
 	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
3871 3871
 	{
3872 3872
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3898,11 +3898,11 @@  discard block
 block discarded – undo
3898 3898
 
3899 3899
 
3900 3900
 	/**
3901
-	* Gets all airline countries that have flown over by aircraft
3902
-	*
3903
-	* @return Array the airline country list
3904
-	*
3905
-	*/
3901
+	 * Gets all airline countries that have flown over by aircraft
3902
+	 *
3903
+	 * @return Array the airline country list
3904
+	 *
3905
+	 */
3906 3906
 	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
3907 3907
 	{
3908 3908
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3934,11 +3934,11 @@  discard block
 block discarded – undo
3934 3934
 	
3935 3935
 	
3936 3936
 	/**
3937
-	* Gets all airlines that have flown over by airport
3938
-	*
3939
-	* @return Array the airline list
3940
-	*
3941
-	*/
3937
+	 * Gets all airlines that have flown over by airport
3938
+	 *
3939
+	 * @return Array the airline list
3940
+	 *
3941
+	 */
3942 3942
 	public function countAllAirlinesByAirport($airport_icao,$filters = array())
3943 3943
 	{
3944 3944
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -3969,11 +3969,11 @@  discard block
 block discarded – undo
3969 3969
 
3970 3970
 
3971 3971
 	/**
3972
-	* Gets all airline countries that have flown over by airport icao
3973
-	*
3974
-	* @return Array the airline country list
3975
-	*
3976
-	*/
3972
+	 * Gets all airline countries that have flown over by airport icao
3973
+	 *
3974
+	 * @return Array the airline country list
3975
+	 *
3976
+	 */
3977 3977
 	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
3978 3978
 	{
3979 3979
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4003,11 +4003,11 @@  discard block
 block discarded – undo
4003 4003
 
4004 4004
 
4005 4005
 	/**
4006
-	* Gets all airlines that have flown over by aircraft manufacturer
4007
-	*
4008
-	* @return Array the airline list
4009
-	*
4010
-	*/
4006
+	 * Gets all airlines that have flown over by aircraft manufacturer
4007
+	 *
4008
+	 * @return Array the airline list
4009
+	 *
4010
+	 */
4011 4011
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4012 4012
 	{
4013 4013
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4038,11 +4038,11 @@  discard block
 block discarded – undo
4038 4038
 
4039 4039
 
4040 4040
 	/**
4041
-	* Gets all airline countries that have flown over by aircraft manufacturer
4042
-	*
4043
-	* @return Array the airline country list
4044
-	*
4045
-	*/
4041
+	 * Gets all airline countries that have flown over by aircraft manufacturer
4042
+	 *
4043
+	 * @return Array the airline country list
4044
+	 *
4045
+	 */
4046 4046
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4047 4047
 	{
4048 4048
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4071,11 +4071,11 @@  discard block
 block discarded – undo
4071 4071
 
4072 4072
 
4073 4073
 	/**
4074
-	* Gets all airlines that have flown over by date
4075
-	*
4076
-	* @return Array the airline list
4077
-	*
4078
-	*/
4074
+	 * Gets all airlines that have flown over by date
4075
+	 *
4076
+	 * @return Array the airline list
4077
+	 *
4078
+	 */
4079 4079
 	public function countAllAirlinesByDate($date,$filters = array())
4080 4080
 	{
4081 4081
 		global $globalTimezone, $globalDBdriver;
@@ -4119,11 +4119,11 @@  discard block
 block discarded – undo
4119 4119
 	
4120 4120
 	
4121 4121
 	/**
4122
-	* Gets all airline countries that have flown over by date
4123
-	*
4124
-	* @return Array the airline country list
4125
-	*
4126
-	*/
4122
+	 * Gets all airline countries that have flown over by date
4123
+	 *
4124
+	 * @return Array the airline country list
4125
+	 *
4126
+	 */
4127 4127
 	public function countAllAirlineCountriesByDate($date,$filters = array())
4128 4128
 	{
4129 4129
 		global $globalTimezone, $globalDBdriver;
@@ -4166,11 +4166,11 @@  discard block
 block discarded – undo
4166 4166
 
4167 4167
 
4168 4168
 	/**
4169
-	* Gets all airlines that have flown over by ident/callsign
4170
-	*
4171
-	* @return Array the airline list
4172
-	*
4173
-	*/
4169
+	 * Gets all airlines that have flown over by ident/callsign
4170
+	 *
4171
+	 * @return Array the airline list
4172
+	 *
4173
+	 */
4174 4174
 	public function countAllAirlinesByIdent($ident,$filters = array())
4175 4175
 	{
4176 4176
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4200,11 +4200,11 @@  discard block
 block discarded – undo
4200 4200
 	}
4201 4201
 
4202 4202
 	/**
4203
-	* Gets all airlines that have flown over by route
4204
-	*
4205
-	* @return Array the airline list
4206
-	*
4207
-	*/
4203
+	 * Gets all airlines that have flown over by route
4204
+	 *
4205
+	 * @return Array the airline list
4206
+	 *
4207
+	 */
4208 4208
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4209 4209
 	{
4210 4210
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4236,11 +4236,11 @@  discard block
 block discarded – undo
4236 4236
 	}
4237 4237
 
4238 4238
 	/**
4239
-	* Gets all airline countries that have flown over by route
4240
-	*
4241
-	* @return Array the airline country list
4242
-	*
4243
-	*/
4239
+	 * Gets all airline countries that have flown over by route
4240
+	 *
4241
+	 * @return Array the airline country list
4242
+	 *
4243
+	 */
4244 4244
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4245 4245
 	{
4246 4246
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4272,11 +4272,11 @@  discard block
 block discarded – undo
4272 4272
 
4273 4273
 
4274 4274
 	/**
4275
-	* Gets all airlines that have flown over by country
4276
-	*
4277
-	* @return Array the airline list
4278
-	*
4279
-	*/
4275
+	 * Gets all airlines that have flown over by country
4276
+	 *
4277
+	 * @return Array the airline list
4278
+	 *
4279
+	 */
4280 4280
 	public function countAllAirlinesByCountry($country,$filters = array())
4281 4281
 	{
4282 4282
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4306,11 +4306,11 @@  discard block
 block discarded – undo
4306 4306
 
4307 4307
 
4308 4308
 	/**
4309
-	* Gets all airline countries that have flown over by country
4310
-	*
4311
-	* @return Array the airline country list
4312
-	*
4313
-	*/
4309
+	 * Gets all airline countries that have flown over by country
4310
+	 *
4311
+	 * @return Array the airline country list
4312
+	 *
4313
+	 */
4314 4314
 	public function countAllAirlineCountriesByCountry($country,$filters = array())
4315 4315
 	{
4316 4316
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4339,11 +4339,11 @@  discard block
 block discarded – undo
4339 4339
 
4340 4340
 
4341 4341
 	/**
4342
-	* Gets all airlines countries
4343
-	*
4344
-	* @return Array the airline country list
4345
-	*
4346
-	*/
4342
+	 * Gets all airlines countries
4343
+	 *
4344
+	 * @return Array the airline country list
4345
+	 *
4346
+	 */
4347 4347
 	public function countAllAirlineCountries($limit = true, $filters = array())
4348 4348
 	{
4349 4349
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4369,11 +4369,11 @@  discard block
 block discarded – undo
4369 4369
 	}
4370 4370
 
4371 4371
 	/**
4372
-	* Gets all number of flight over countries
4373
-	*
4374
-	* @return Array the airline country list
4375
-	*
4376
-	*/
4372
+	 * Gets all number of flight over countries
4373
+	 *
4374
+	 * @return Array the airline country list
4375
+	 *
4376
+	 */
4377 4377
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
4378 4378
 	{
4379 4379
 		global $globalDBdriver;
@@ -4388,15 +4388,15 @@  discard block
 block discarded – undo
4388 4388
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
4389 4389
 					FROM countries c, spotter_live s
4390 4390
 					WHERE c.iso2 = s.over_country ";
4391
-                if ($olderthanmonths > 0) {
4391
+				if ($olderthanmonths > 0) {
4392 4392
 			if ($globalDBdriver == 'mysql') {
4393 4393
 				$query .= 'AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
4394 4394
 			} else {
4395 4395
 				$query .= "AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4396 4396
 			}
4397 4397
 		}
4398
-                if ($sincedate != '') {
4399
-            		if ($globalDBdriver == 'mysql') {
4398
+				if ($sincedate != '') {
4399
+					if ($globalDBdriver == 'mysql') {
4400 4400
 				$query .= "AND spotter_live.date > '".$sincedate."' ";
4401 4401
 			} else {
4402 4402
 				$query .= "AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4426,11 +4426,11 @@  discard block
 block discarded – undo
4426 4426
 	
4427 4427
 	
4428 4428
 	/**
4429
-	* Gets all aircraft types that have flown over
4430
-	*
4431
-	* @return Array the aircraft list
4432
-	*
4433
-	*/
4429
+	 * Gets all aircraft types that have flown over
4430
+	 *
4431
+	 * @return Array the aircraft list
4432
+	 *
4433
+	 */
4434 4434
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4435 4435
 	{
4436 4436
 		global $globalDBdriver;
@@ -4473,11 +4473,11 @@  discard block
 block discarded – undo
4473 4473
 	}
4474 4474
 
4475 4475
 	/**
4476
-	* Gets all aircraft types that have flown over by airline
4477
-	*
4478
-	* @return Array the aircraft list
4479
-	*
4480
-	*/
4476
+	 * Gets all aircraft types that have flown over by airline
4477
+	 *
4478
+	 * @return Array the aircraft list
4479
+	 *
4480
+	 */
4481 4481
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4482 4482
 	{
4483 4483
 		global $globalDBdriver;
@@ -4520,11 +4520,11 @@  discard block
 block discarded – undo
4520 4520
 	}
4521 4521
 
4522 4522
 	/**
4523
-	* Gets all aircraft types that have flown over by months
4524
-	*
4525
-	* @return Array the aircraft list
4526
-	*
4527
-	*/
4523
+	 * Gets all aircraft types that have flown over by months
4524
+	 *
4525
+	 * @return Array the aircraft list
4526
+	 *
4527
+	 */
4528 4528
 	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4529 4529
 	{
4530 4530
 		global $globalDBdriver;
@@ -4568,11 +4568,11 @@  discard block
 block discarded – undo
4568 4568
 
4569 4569
 
4570 4570
 	/**
4571
-	* Gets all aircraft registration that have flown over by aircaft icao
4572
-	*
4573
-	* @return Array the aircraft list
4574
-	*
4575
-	*/
4571
+	 * Gets all aircraft registration that have flown over by aircaft icao
4572
+	 *
4573
+	 * @return Array the aircraft list
4574
+	 *
4575
+	 */
4576 4576
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
4577 4577
 	{
4578 4578
 		$Image = new Image($this->db);
@@ -4611,11 +4611,11 @@  discard block
 block discarded – undo
4611 4611
 
4612 4612
 
4613 4613
 	/**
4614
-	* Gets all aircraft types that have flown over by airline icao
4615
-	*
4616
-	* @return Array the aircraft list
4617
-	*
4618
-	*/
4614
+	 * Gets all aircraft types that have flown over by airline icao
4615
+	 *
4616
+	 * @return Array the aircraft list
4617
+	 *
4618
+	 */
4619 4619
 	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
4620 4620
 	{
4621 4621
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4644,11 +4644,11 @@  discard block
 block discarded – undo
4644 4644
 
4645 4645
 
4646 4646
 	/**
4647
-	* Gets all aircraft registration that have flown over by airline icao
4648
-	*
4649
-	* @return Array the aircraft list
4650
-	*
4651
-	*/
4647
+	 * Gets all aircraft registration that have flown over by airline icao
4648
+	 *
4649
+	 * @return Array the aircraft list
4650
+	 *
4651
+	 */
4652 4652
 	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
4653 4653
 	{
4654 4654
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4686,11 +4686,11 @@  discard block
 block discarded – undo
4686 4686
 
4687 4687
 
4688 4688
 	/**
4689
-	* Gets all aircraft manufacturer that have flown over by airline icao
4690
-	*
4691
-	* @return Array the aircraft list
4692
-	*
4693
-	*/
4689
+	 * Gets all aircraft manufacturer that have flown over by airline icao
4690
+	 *
4691
+	 * @return Array the aircraft list
4692
+	 *
4693
+	 */
4694 4694
 	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
4695 4695
 	{
4696 4696
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4718,11 +4718,11 @@  discard block
 block discarded – undo
4718 4718
 
4719 4719
 
4720 4720
 	/**
4721
-	* Gets all aircraft types that have flown over by airline icao
4722
-	*
4723
-	* @return Array the aircraft list
4724
-	*
4725
-	*/
4721
+	 * Gets all aircraft types that have flown over by airline icao
4722
+	 *
4723
+	 * @return Array the aircraft list
4724
+	 *
4725
+	 */
4726 4726
 	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
4727 4727
 	{
4728 4728
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4751,11 +4751,11 @@  discard block
 block discarded – undo
4751 4751
 
4752 4752
 
4753 4753
 	/**
4754
-	* Gets all aircraft registration that have flown over by airport icao
4755
-	*
4756
-	* @return Array the aircraft list
4757
-	*
4758
-	*/
4754
+	 * Gets all aircraft registration that have flown over by airport icao
4755
+	 *
4756
+	 * @return Array the aircraft list
4757
+	 *
4758
+	 */
4759 4759
 	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
4760 4760
 	{
4761 4761
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4792,11 +4792,11 @@  discard block
 block discarded – undo
4792 4792
 	
4793 4793
 	
4794 4794
 	/**
4795
-	* Gets all aircraft manufacturer that have flown over by airport icao
4796
-	*
4797
-	* @return Array the aircraft list
4798
-	*
4799
-	*/
4795
+	 * Gets all aircraft manufacturer that have flown over by airport icao
4796
+	 *
4797
+	 * @return Array the aircraft list
4798
+	 *
4799
+	 */
4800 4800
 	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
4801 4801
 	{
4802 4802
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4822,11 +4822,11 @@  discard block
 block discarded – undo
4822 4822
 	}
4823 4823
 
4824 4824
 	/**
4825
-	* Gets all aircraft types that have flown over by aircraft manufacturer
4826
-	*
4827
-	* @return Array the aircraft list
4828
-	*
4829
-	*/
4825
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
4826
+	 *
4827
+	 * @return Array the aircraft list
4828
+	 *
4829
+	 */
4830 4830
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
4831 4831
 	{
4832 4832
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4853,11 +4853,11 @@  discard block
 block discarded – undo
4853 4853
 
4854 4854
 
4855 4855
 	/**
4856
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
4857
-	*
4858
-	* @return Array the aircraft list
4859
-	*
4860
-	*/
4856
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
4857
+	 *
4858
+	 * @return Array the aircraft list
4859
+	 *
4860
+	 */
4861 4861
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
4862 4862
 	{
4863 4863
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4893,11 +4893,11 @@  discard block
 block discarded – undo
4893 4893
 	}
4894 4894
 
4895 4895
 	/**
4896
-	* Gets all aircraft types that have flown over by date
4897
-	*
4898
-	* @return Array the aircraft list
4899
-	*
4900
-	*/
4896
+	 * Gets all aircraft types that have flown over by date
4897
+	 *
4898
+	 * @return Array the aircraft list
4899
+	 *
4900
+	 */
4901 4901
 	public function countAllAircraftTypesByDate($date,$filters = array())
4902 4902
 	{
4903 4903
 		global $globalTimezone, $globalDBdriver;
@@ -4939,11 +4939,11 @@  discard block
 block discarded – undo
4939 4939
 
4940 4940
 
4941 4941
 	/**
4942
-	* Gets all aircraft registration that have flown over by date
4943
-	*
4944
-	* @return Array the aircraft list
4945
-	*
4946
-	*/
4942
+	 * Gets all aircraft registration that have flown over by date
4943
+	 *
4944
+	 * @return Array the aircraft list
4945
+	 *
4946
+	 */
4947 4947
 	public function countAllAircraftRegistrationByDate($date,$filters = array())
4948 4948
 	{
4949 4949
 		global $globalTimezone, $globalDBdriver;
@@ -4994,11 +4994,11 @@  discard block
 block discarded – undo
4994 4994
 
4995 4995
 
4996 4996
 	/**
4997
-	* Gets all aircraft manufacturer that have flown over by date
4998
-	*
4999
-	* @return Array the aircraft manufacturer list
5000
-	*
5001
-	*/
4997
+	 * Gets all aircraft manufacturer that have flown over by date
4998
+	 *
4999
+	 * @return Array the aircraft manufacturer list
5000
+	 *
5001
+	 */
5002 5002
 	public function countAllAircraftManufacturerByDate($date,$filters = array())
5003 5003
 	{
5004 5004
 		global $globalTimezone, $globalDBdriver;
@@ -5040,11 +5040,11 @@  discard block
 block discarded – undo
5040 5040
 
5041 5041
 
5042 5042
 	/**
5043
-	* Gets all aircraft types that have flown over by ident/callsign
5044
-	*
5045
-	* @return Array the aircraft list
5046
-	*
5047
-	*/
5043
+	 * Gets all aircraft types that have flown over by ident/callsign
5044
+	 *
5045
+	 * @return Array the aircraft list
5046
+	 *
5047
+	 */
5048 5048
 	public function countAllAircraftTypesByIdent($ident,$filters = array())
5049 5049
 	{
5050 5050
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5073,11 +5073,11 @@  discard block
 block discarded – undo
5073 5073
 
5074 5074
 
5075 5075
 	/**
5076
-	* Gets all aircraft registration that have flown over by ident/callsign
5077
-	*
5078
-	* @return Array the aircraft list
5079
-	*
5080
-	*/
5076
+	 * Gets all aircraft registration that have flown over by ident/callsign
5077
+	 *
5078
+	 * @return Array the aircraft list
5079
+	 *
5080
+	 */
5081 5081
 	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5082 5082
 	{
5083 5083
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5117,11 +5117,11 @@  discard block
 block discarded – undo
5117 5117
 
5118 5118
 
5119 5119
 	/**
5120
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
5121
-	*
5122
-	* @return Array the aircraft manufacturer list
5123
-	*
5124
-	*/
5120
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
5121
+	 *
5122
+	 * @return Array the aircraft manufacturer list
5123
+	 *
5124
+	 */
5125 5125
 	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5126 5126
 	{
5127 5127
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5147,11 +5147,11 @@  discard block
 block discarded – undo
5147 5147
 
5148 5148
 
5149 5149
 	/**
5150
-	* Gets all aircraft types that have flown over by route
5151
-	*
5152
-	* @return Array the aircraft list
5153
-	*
5154
-	*/
5150
+	 * Gets all aircraft types that have flown over by route
5151
+	 *
5152
+	 * @return Array the aircraft list
5153
+	 *
5154
+	 */
5155 5155
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5156 5156
 	{
5157 5157
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5180,11 +5180,11 @@  discard block
 block discarded – undo
5180 5180
 	}
5181 5181
 
5182 5182
 	/**
5183
-	* Gets all aircraft registration that have flown over by route
5184
-	*
5185
-	* @return Array the aircraft list
5186
-	*
5187
-	*/
5183
+	 * Gets all aircraft registration that have flown over by route
5184
+	 *
5185
+	 * @return Array the aircraft list
5186
+	 *
5187
+	 */
5188 5188
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5189 5189
 	{
5190 5190
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5226,11 +5226,11 @@  discard block
 block discarded – undo
5226 5226
 	
5227 5227
 	
5228 5228
 	/**
5229
-	* Gets all aircraft manufacturer that have flown over by route
5230
-	*
5231
-	* @return Array the aircraft manufacturer list
5232
-	*
5233
-	*/
5229
+	 * Gets all aircraft manufacturer that have flown over by route
5230
+	 *
5231
+	 * @return Array the aircraft manufacturer list
5232
+	 *
5233
+	 */
5234 5234
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5235 5235
 	{
5236 5236
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5264,11 +5264,11 @@  discard block
 block discarded – undo
5264 5264
 	
5265 5265
 	
5266 5266
 	/**
5267
-	* Gets all aircraft types that have flown over by country
5268
-	*
5269
-	* @return Array the aircraft list
5270
-	*
5271
-	*/
5267
+	 * Gets all aircraft types that have flown over by country
5268
+	 *
5269
+	 * @return Array the aircraft list
5270
+	 *
5271
+	 */
5272 5272
 	public function countAllAircraftTypesByCountry($country,$filters = array())
5273 5273
 	{
5274 5274
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5299,11 +5299,11 @@  discard block
 block discarded – undo
5299 5299
 
5300 5300
 
5301 5301
 	/**
5302
-	* Gets all aircraft registration that have flown over by country
5303
-	*
5304
-	* @return Array the aircraft list
5305
-	*
5306
-	*/
5302
+	 * Gets all aircraft registration that have flown over by country
5303
+	 *
5304
+	 * @return Array the aircraft list
5305
+	 *
5306
+	 */
5307 5307
 	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5308 5308
 	{
5309 5309
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5343,11 +5343,11 @@  discard block
 block discarded – undo
5343 5343
 	
5344 5344
 	
5345 5345
 	/**
5346
-	* Gets all aircraft manufacturer that have flown over by country
5347
-	*
5348
-	* @return Array the aircraft manufacturer list
5349
-	*
5350
-	*/
5346
+	 * Gets all aircraft manufacturer that have flown over by country
5347
+	 *
5348
+	 * @return Array the aircraft manufacturer list
5349
+	 *
5350
+	 */
5351 5351
 	public function countAllAircraftManufacturerByCountry($country,$filters = array())
5352 5352
 	{
5353 5353
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5378,17 +5378,17 @@  discard block
 block discarded – undo
5378 5378
 	
5379 5379
 	
5380 5380
 	/**
5381
-	* Gets all aircraft manufacturers that have flown over
5382
-	*
5383
-	* @return Array the aircraft list
5384
-	*
5385
-	*/
5381
+	 * Gets all aircraft manufacturers that have flown over
5382
+	 *
5383
+	 * @return Array the aircraft list
5384
+	 *
5385
+	 */
5386 5386
 	public function countAllAircraftManufacturers($filters = array())
5387 5387
 	{
5388 5388
 		$filter_query = $this->getFilter($filters,true,true);
5389 5389
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5390 5390
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5391
-                $query .= " GROUP BY spotter_output.aircraft_manufacturer
5391
+				$query .= " GROUP BY spotter_output.aircraft_manufacturer
5392 5392
 					ORDER BY aircraft_manufacturer_count DESC
5393 5393
 					LIMIT 10";
5394 5394
       
@@ -5413,11 +5413,11 @@  discard block
 block discarded – undo
5413 5413
 	
5414 5414
 	
5415 5415
 	/**
5416
-	* Gets all aircraft registrations that have flown over
5417
-	*
5418
-	* @return Array the aircraft list
5419
-	*
5420
-	*/
5416
+	 * Gets all aircraft registrations that have flown over
5417
+	 *
5418
+	 * @return Array the aircraft list
5419
+	 *
5420
+	 */
5421 5421
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5422 5422
 	{
5423 5423
 		global $globalDBdriver;
@@ -5425,15 +5425,15 @@  discard block
 block discarded – undo
5425 5425
 		$filter_query = $this->getFilter($filters,true,true);
5426 5426
 		$query  = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
5427 5427
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5428
-                if ($olderthanmonths > 0) {
5429
-            		if ($globalDBdriver == 'mysql') {
5428
+				if ($olderthanmonths > 0) {
5429
+					if ($globalDBdriver == 'mysql') {
5430 5430
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5431 5431
 			} else {
5432 5432
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5433 5433
 			}
5434 5434
 		}
5435
-                if ($sincedate != '') {
5436
-            		if ($globalDBdriver == 'mysql') {
5435
+				if ($sincedate != '') {
5436
+					if ($globalDBdriver == 'mysql') {
5437 5437
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5438 5438
 			} else {
5439 5439
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5442,7 +5442,7 @@  discard block
 block discarded – undo
5442 5442
 
5443 5443
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5444 5444
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5445
-                $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5445
+				$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5446 5446
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5447 5447
 		
5448 5448
 		$sth = $this->db->prepare($query);
@@ -5473,11 +5473,11 @@  discard block
 block discarded – undo
5473 5473
 
5474 5474
 
5475 5475
 	/**
5476
-	* Gets all aircraft registrations that have flown over
5477
-	*
5478
-	* @return Array the aircraft list
5479
-	*
5480
-	*/
5476
+	 * Gets all aircraft registrations that have flown over
5477
+	 *
5478
+	 * @return Array the aircraft list
5479
+	 *
5480
+	 */
5481 5481
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5482 5482
 	{
5483 5483
 		global $globalDBdriver;
@@ -5485,15 +5485,15 @@  discard block
 block discarded – undo
5485 5485
 		$Image = new Image($this->db);
5486 5486
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
5487 5487
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5488
-                if ($olderthanmonths > 0) {
5489
-            		if ($globalDBdriver == 'mysql') {
5488
+				if ($olderthanmonths > 0) {
5489
+					if ($globalDBdriver == 'mysql') {
5490 5490
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5491 5491
 			} else {
5492 5492
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5493 5493
 			}
5494 5494
 		}
5495
-                if ($sincedate != '') {
5496
-            		if ($globalDBdriver == 'mysql') {
5495
+				if ($sincedate != '') {
5496
+					if ($globalDBdriver == 'mysql') {
5497 5497
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5498 5498
 			} else {
5499 5499
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5502,7 +5502,7 @@  discard block
 block discarded – undo
5502 5502
 
5503 5503
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5504 5504
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5505
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5505
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5506 5506
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5507 5507
 		
5508 5508
 		$sth = $this->db->prepare($query);
@@ -5534,35 +5534,35 @@  discard block
 block discarded – undo
5534 5534
 	
5535 5535
 	
5536 5536
 	/**
5537
-	* Gets all departure airports of the airplanes that have flown over
5538
-	*
5539
-	* @return Array the airport list
5540
-	*
5541
-	*/
5537
+	 * Gets all departure airports of the airplanes that have flown over
5538
+	 *
5539
+	 * @return Array the airport list
5540
+	 *
5541
+	 */
5542 5542
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5543 5543
 	{
5544 5544
 		global $globalDBdriver;
5545 5545
 		$filter_query = $this->getFilter($filters,true,true);
5546 5546
 		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5547 5547
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA'";
5548
-                if ($olderthanmonths > 0) {
5549
-            		if ($globalDBdriver == 'mysql') {
5548
+				if ($olderthanmonths > 0) {
5549
+					if ($globalDBdriver == 'mysql') {
5550 5550
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5551 5551
 			} else {
5552 5552
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5553 5553
 			}
5554
-                }
5555
-                if ($sincedate != '') {
5556
-            		if ($globalDBdriver == 'mysql') {
5554
+				}
5555
+				if ($sincedate != '') {
5556
+					if ($globalDBdriver == 'mysql') {
5557 5557
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5558 5558
 			} else {
5559 5559
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5560 5560
 			}
5561 5561
 		}
5562 5562
 
5563
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5564
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5565
-                $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5563
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5564
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5565
+				$query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5566 5566
 				ORDER BY airport_departure_icao_count DESC";
5567 5567
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5568 5568
       
@@ -5586,35 +5586,35 @@  discard block
 block discarded – undo
5586 5586
 	}
5587 5587
 
5588 5588
 	/**
5589
-	* Gets all departure airports of the airplanes that have flown over
5590
-	*
5591
-	* @return Array the airport list
5592
-	*
5593
-	*/
5589
+	 * Gets all departure airports of the airplanes that have flown over
5590
+	 *
5591
+	 * @return Array the airport list
5592
+	 *
5593
+	 */
5594 5594
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5595 5595
 	{
5596 5596
 		global $globalDBdriver;
5597 5597
 		$filter_query = $this->getFilter($filters,true,true);
5598 5598
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5599 5599
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' ";
5600
-                if ($olderthanmonths > 0) {
5601
-            		if ($globalDBdriver == 'mysql') {
5600
+				if ($olderthanmonths > 0) {
5601
+					if ($globalDBdriver == 'mysql') {
5602 5602
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5603 5603
 			} else {
5604 5604
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5605 5605
 			}
5606
-                }
5607
-                if ($sincedate != '') {
5608
-            		if ($globalDBdriver == 'mysql') {
5606
+				}
5607
+				if ($sincedate != '') {
5608
+					if ($globalDBdriver == 'mysql') {
5609 5609
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5610 5610
 			} else {
5611 5611
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5612 5612
 			}
5613 5613
 		}
5614 5614
 
5615
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5616
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5617
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5615
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5616
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5617
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5618 5618
 				ORDER BY airport_departure_icao_count DESC";
5619 5619
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5620 5620
       
@@ -5639,37 +5639,37 @@  discard block
 block discarded – undo
5639 5639
 	}
5640 5640
 
5641 5641
 	/**
5642
-	* Gets all detected departure airports of the airplanes that have flown over
5643
-	*
5644
-	* @return Array the airport list
5645
-	*
5646
-	*/
5642
+	 * Gets all detected departure airports of the airplanes that have flown over
5643
+	 *
5644
+	 * @return Array the airport list
5645
+	 *
5646
+	 */
5647 5647
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5648 5648
 	{
5649 5649
 		global $globalDBdriver;
5650 5650
 		$filter_query = $this->getFilter($filters,true,true);
5651 5651
 		$query  = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
5652 5652
 				FROM airport, spotter_output".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao";
5653
-                if ($olderthanmonths > 0) {
5654
-            		if ($globalDBdriver == 'mysql') {
5653
+				if ($olderthanmonths > 0) {
5654
+					if ($globalDBdriver == 'mysql') {
5655 5655
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5656 5656
 			} else {
5657 5657
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5658 5658
 			}
5659
-                }
5660
-                if ($sincedate != '') {
5661
-            		if ($globalDBdriver == 'mysql') {
5659
+				}
5660
+				if ($sincedate != '') {
5661
+					if ($globalDBdriver == 'mysql') {
5662 5662
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5663 5663
 			} else {
5664 5664
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5665 5665
 			}
5666 5666
 		}
5667
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5668
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5669
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5667
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5668
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5669
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5670 5670
 				ORDER BY airport_departure_icao_count DESC";
5671 5671
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5672
-    		//echo $query;
5672
+			//echo $query;
5673 5673
 		$sth = $this->db->prepare($query);
5674 5674
 		$sth->execute();
5675 5675
       
@@ -5690,35 +5690,35 @@  discard block
 block discarded – undo
5690 5690
 	}
5691 5691
 	
5692 5692
 	/**
5693
-	* Gets all detected departure airports of the airplanes that have flown over
5694
-	*
5695
-	* @return Array the airport list
5696
-	*
5697
-	*/
5693
+	 * Gets all detected departure airports of the airplanes that have flown over
5694
+	 *
5695
+	 * @return Array the airport list
5696
+	 *
5697
+	 */
5698 5698
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5699 5699
 	{
5700 5700
 		global $globalDBdriver;
5701 5701
 		$filter_query = $this->getFilter($filters,true,true);
5702 5702
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
5703 5703
 				FROM airport, spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao ";
5704
-                if ($olderthanmonths > 0) {
5705
-            		if ($globalDBdriver == 'mysql') {
5704
+				if ($olderthanmonths > 0) {
5705
+					if ($globalDBdriver == 'mysql') {
5706 5706
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5707 5707
 			} else {
5708 5708
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5709 5709
 			}
5710
-                }
5711
-                if ($sincedate != '') {
5712
-            		if ($globalDBdriver == 'mysql') {
5710
+				}
5711
+				if ($sincedate != '') {
5712
+					if ($globalDBdriver == 'mysql') {
5713 5713
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5714 5714
 			} else {
5715 5715
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
5716 5716
 			}
5717 5717
 		}
5718 5718
 
5719
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5720
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5721
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5719
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5720
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5721
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5722 5722
 				ORDER BY airport_departure_icao_count DESC";
5723 5723
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5724 5724
       
@@ -5743,11 +5743,11 @@  discard block
 block discarded – undo
5743 5743
 	}	
5744 5744
 	
5745 5745
 	/**
5746
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
5747
-	*
5748
-	* @return Array the airport list
5749
-	*
5750
-	*/
5746
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
5747
+	 *
5748
+	 * @return Array the airport list
5749
+	 *
5750
+	 */
5751 5751
 	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
5752 5752
 	{
5753 5753
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5781,11 +5781,11 @@  discard block
 block discarded – undo
5781 5781
 	
5782 5782
 	
5783 5783
 	/**
5784
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5785
-	*
5786
-	* @return Array the airport list
5787
-	*
5788
-	*/
5784
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5785
+	 *
5786
+	 * @return Array the airport list
5787
+	 *
5788
+	 */
5789 5789
 	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
5790 5790
 	{
5791 5791
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5816,11 +5816,11 @@  discard block
 block discarded – undo
5816 5816
 	
5817 5817
 	
5818 5818
 	/**
5819
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5820
-	*
5821
-	* @return Array the airport list
5822
-	*
5823
-	*/
5819
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5820
+	 *
5821
+	 * @return Array the airport list
5822
+	 *
5823
+	 */
5824 5824
 	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
5825 5825
 	{
5826 5826
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5853,11 +5853,11 @@  discard block
 block discarded – undo
5853 5853
 	
5854 5854
 	
5855 5855
 	/**
5856
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5857
-	*
5858
-	* @return Array the airport list
5859
-	*
5860
-	*/
5856
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5857
+	 *
5858
+	 * @return Array the airport list
5859
+	 *
5860
+	 */
5861 5861
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
5862 5862
 	{
5863 5863
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5887,11 +5887,11 @@  discard block
 block discarded – undo
5887 5887
 	
5888 5888
 	
5889 5889
 	/**
5890
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5891
-	*
5892
-	* @return Array the airport list
5893
-	*
5894
-	*/
5890
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5891
+	 *
5892
+	 * @return Array the airport list
5893
+	 *
5894
+	 */
5895 5895
 	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
5896 5896
 	{
5897 5897
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5924,11 +5924,11 @@  discard block
 block discarded – undo
5924 5924
 	
5925 5925
 	
5926 5926
 	/**
5927
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
5928
-	*
5929
-	* @return Array the airport list
5930
-	*
5931
-	*/
5927
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
5928
+	 *
5929
+	 * @return Array the airport list
5930
+	 *
5931
+	 */
5932 5932
 	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
5933 5933
 	{
5934 5934
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5958,11 +5958,11 @@  discard block
 block discarded – undo
5958 5958
 	
5959 5959
 	
5960 5960
 	/**
5961
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
5962
-	*
5963
-	* @return Array the airport list
5964
-	*
5965
-	*/
5961
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
5962
+	 *
5963
+	 * @return Array the airport list
5964
+	 *
5965
+	 */
5966 5966
 	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
5967 5967
 	{
5968 5968
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5995,11 +5995,11 @@  discard block
 block discarded – undo
5995 5995
 	
5996 5996
 	
5997 5997
 	/**
5998
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
5999
-	*
6000
-	* @return Array the airport list
6001
-	*
6002
-	*/
5998
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
5999
+	 *
6000
+	 * @return Array the airport list
6001
+	 *
6002
+	 */
6003 6003
 	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
6004 6004
 	{
6005 6005
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6030,11 +6030,11 @@  discard block
 block discarded – undo
6030 6030
 	
6031 6031
 	
6032 6032
 	/**
6033
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
6034
-	*
6035
-	* @return Array the airport list
6036
-	*
6037
-	*/
6033
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
6034
+	 *
6035
+	 * @return Array the airport list
6036
+	 *
6037
+	 */
6038 6038
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6039 6039
 	{
6040 6040
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6067,11 +6067,11 @@  discard block
 block discarded – undo
6067 6067
 	
6068 6068
 	
6069 6069
 	/**
6070
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
6071
-	*
6072
-	* @return Array the airport list
6073
-	*
6074
-	*/
6070
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
6071
+	 *
6072
+	 * @return Array the airport list
6073
+	 *
6074
+	 */
6075 6075
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6076 6076
 	{
6077 6077
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6101,11 +6101,11 @@  discard block
 block discarded – undo
6101 6101
 	
6102 6102
 	
6103 6103
 	/**
6104
-	* Gets all departure airports of the airplanes that have flown over based on a date
6105
-	*
6106
-	* @return Array the airport list
6107
-	*
6108
-	*/
6104
+	 * Gets all departure airports of the airplanes that have flown over based on a date
6105
+	 *
6106
+	 * @return Array the airport list
6107
+	 *
6108
+	 */
6109 6109
 	public function countAllDepartureAirportsByDate($date,$filters = array())
6110 6110
 	{
6111 6111
 		global $globalTimezone, $globalDBdriver;
@@ -6151,11 +6151,11 @@  discard block
 block discarded – undo
6151 6151
 	
6152 6152
 	
6153 6153
 	/**
6154
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
6155
-	*
6156
-	* @return Array the airport list
6157
-	*
6158
-	*/
6154
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
6155
+	 *
6156
+	 * @return Array the airport list
6157
+	 *
6158
+	 */
6159 6159
 	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6160 6160
 	{
6161 6161
 		global $globalTimezone, $globalDBdriver;
@@ -6198,11 +6198,11 @@  discard block
 block discarded – undo
6198 6198
 	
6199 6199
 	
6200 6200
 	/**
6201
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6202
-	*
6203
-	* @return Array the airport list
6204
-	*
6205
-	*/
6201
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6202
+	 *
6203
+	 * @return Array the airport list
6204
+	 *
6205
+	 */
6206 6206
 	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6207 6207
 	{
6208 6208
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6236,11 +6236,11 @@  discard block
 block discarded – undo
6236 6236
 	
6237 6237
 	
6238 6238
 	/**
6239
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6240
-	*
6241
-	* @return Array the airport list
6242
-	*
6243
-	*/
6239
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6240
+	 *
6241
+	 * @return Array the airport list
6242
+	 *
6243
+	 */
6244 6244
 	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
6245 6245
 	{
6246 6246
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6271,11 +6271,11 @@  discard block
 block discarded – undo
6271 6271
 	
6272 6272
 	
6273 6273
 	/**
6274
-	* Gets all departure airports of the airplanes that have flown over based on a country
6275
-	*
6276
-	* @return Array the airport list
6277
-	*
6278
-	*/
6274
+	 * Gets all departure airports of the airplanes that have flown over based on a country
6275
+	 *
6276
+	 * @return Array the airport list
6277
+	 *
6278
+	 */
6279 6279
 	public function countAllDepartureAirportsByCountry($country,$filters = array())
6280 6280
 	{
6281 6281
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6309,11 +6309,11 @@  discard block
 block discarded – undo
6309 6309
 
6310 6310
 
6311 6311
 	/**
6312
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6313
-	*
6314
-	* @return Array the airport list
6315
-	*
6316
-	*/
6312
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6313
+	 *
6314
+	 * @return Array the airport list
6315
+	 *
6316
+	 */
6317 6317
 	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
6318 6318
 	{
6319 6319
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6343,40 +6343,40 @@  discard block
 block discarded – undo
6343 6343
 	
6344 6344
 
6345 6345
 	/**
6346
-	* Gets all arrival airports of the airplanes that have flown over
6347
-	*
6348
-	* @return Array the airport list
6349
-	*
6350
-	*/
6346
+	 * Gets all arrival airports of the airplanes that have flown over
6347
+	 *
6348
+	 * @return Array the airport list
6349
+	 *
6350
+	 */
6351 6351
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6352 6352
 	{
6353 6353
 		global $globalDBdriver;
6354 6354
 		$filter_query = $this->getFilter($filters,true,true);
6355 6355
 		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6356 6356
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
6357
-                if ($olderthanmonths > 0) {
6358
-            		if ($globalDBdriver == 'mysql') {
6357
+				if ($olderthanmonths > 0) {
6358
+					if ($globalDBdriver == 'mysql') {
6359 6359
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6360 6360
 			} else {
6361 6361
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6362 6362
 			}
6363
-                if ($sincedate != '') {
6364
-            		if ($globalDBdriver == 'mysql') {
6363
+				if ($sincedate != '') {
6364
+					if ($globalDBdriver == 'mysql') {
6365 6365
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6366 6366
 			} else {
6367 6367
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6368 6368
 			}
6369 6369
 		}
6370
-            		if ($globalDBdriver == 'mysql') {
6370
+					if ($globalDBdriver == 'mysql') {
6371 6371
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6372 6372
 			} else {
6373 6373
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6374 6374
 			}
6375 6375
 		}
6376 6376
 
6377
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6378
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6379
-                $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6377
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6378
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6379
+				$query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6380 6380
 					ORDER BY airport_arrival_icao_count DESC";
6381 6381
 		if ($limit) $query .= " LIMIT 10";
6382 6382
       
@@ -6405,40 +6405,40 @@  discard block
 block discarded – undo
6405 6405
 	}
6406 6406
 
6407 6407
 	/**
6408
-	* Gets all arrival airports of the airplanes that have flown over
6409
-	*
6410
-	* @return Array the airport list
6411
-	*
6412
-	*/
6408
+	 * Gets all arrival airports of the airplanes that have flown over
6409
+	 *
6410
+	 * @return Array the airport list
6411
+	 *
6412
+	 */
6413 6413
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6414 6414
 	{
6415 6415
 		global $globalDBdriver;
6416 6416
 		$filter_query = $this->getFilter($filters,true,true);
6417 6417
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6418 6418
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' ";
6419
-                if ($olderthanmonths > 0) {
6420
-            		if ($globalDBdriver == 'mysql') {
6419
+				if ($olderthanmonths > 0) {
6420
+					if ($globalDBdriver == 'mysql') {
6421 6421
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6422 6422
 			} else {
6423 6423
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6424 6424
 			}
6425
-                if ($sincedate != '') {
6426
-            		if ($globalDBdriver == 'mysql') {
6425
+				if ($sincedate != '') {
6426
+					if ($globalDBdriver == 'mysql') {
6427 6427
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6428 6428
 			} else {
6429 6429
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6430 6430
 			}
6431 6431
 		}
6432
-            		if ($globalDBdriver == 'mysql') {
6432
+					if ($globalDBdriver == 'mysql') {
6433 6433
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6434 6434
 			} else {
6435 6435
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6436 6436
 			}
6437 6437
 		}
6438 6438
 
6439
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6440
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6441
-                $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6439
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6440
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6441
+				$query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6442 6442
 					ORDER BY airport_arrival_icao_count DESC";
6443 6443
 		if ($limit) $query .= " LIMIT 10";
6444 6444
       
@@ -6469,39 +6469,39 @@  discard block
 block discarded – undo
6469 6469
 
6470 6470
 
6471 6471
 	/**
6472
-	* Gets all detected arrival airports of the airplanes that have flown over
6473
-	*
6474
-	* @return Array the airport list
6475
-	*
6476
-	*/
6472
+	 * Gets all detected arrival airports of the airplanes that have flown over
6473
+	 *
6474
+	 * @return Array the airport list
6475
+	 *
6476
+	 */
6477 6477
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6478 6478
 	{
6479 6479
 		global $globalDBdriver;
6480 6480
 		$filter_query = $this->getFilter($filters,true,true);
6481 6481
 		$query  = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
6482 6482
 			FROM airport,spotter_output".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao";
6483
-                if ($olderthanmonths > 0) {
6484
-            		if ($globalDBdriver == 'mysql') {
6483
+				if ($olderthanmonths > 0) {
6484
+					if ($globalDBdriver == 'mysql') {
6485 6485
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6486 6486
 			} else {
6487 6487
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6488 6488
 			}
6489
-                if ($sincedate != '') {
6490
-            		if ($globalDBdriver == 'mysql') {
6489
+				if ($sincedate != '') {
6490
+					if ($globalDBdriver == 'mysql') {
6491 6491
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6492 6492
 			} else {
6493 6493
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6494 6494
 			}
6495 6495
 		}
6496
-            		if ($globalDBdriver == 'mysql') {
6496
+					if ($globalDBdriver == 'mysql') {
6497 6497
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6498 6498
 			} else {
6499 6499
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6500 6500
 			}
6501 6501
 		}
6502
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6503
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6504
-                $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6502
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6503
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6504
+				$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6505 6505
 					ORDER BY airport_arrival_icao_count DESC";
6506 6506
 		if ($limit) $query .= " LIMIT 10";
6507 6507
       
@@ -6530,40 +6530,40 @@  discard block
 block discarded – undo
6530 6530
 	}
6531 6531
 	
6532 6532
 	/**
6533
-	* Gets all detected arrival airports of the airplanes that have flown over
6534
-	*
6535
-	* @return Array the airport list
6536
-	*
6537
-	*/
6533
+	 * Gets all detected arrival airports of the airplanes that have flown over
6534
+	 *
6535
+	 * @return Array the airport list
6536
+	 *
6537
+	 */
6538 6538
 	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6539 6539
 	{
6540 6540
 		global $globalDBdriver;
6541 6541
 		$filter_query = $this->getFilter($filters,true,true);
6542 6542
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
6543 6543
 			FROM airport,spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao ";
6544
-                if ($olderthanmonths > 0) {
6545
-            		if ($globalDBdriver == 'mysql') {
6544
+				if ($olderthanmonths > 0) {
6545
+					if ($globalDBdriver == 'mysql') {
6546 6546
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6547 6547
 			} else {
6548 6548
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6549 6549
 			}
6550
-                if ($sincedate != '') {
6551
-            		if ($globalDBdriver == 'mysql') {
6550
+				if ($sincedate != '') {
6551
+					if ($globalDBdriver == 'mysql') {
6552 6552
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6553 6553
 			} else {
6554 6554
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6555 6555
 			}
6556 6556
 		}
6557
-            		if ($globalDBdriver == 'mysql') {
6557
+					if ($globalDBdriver == 'mysql') {
6558 6558
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6559 6559
 			} else {
6560 6560
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6561 6561
 			}
6562 6562
 		}
6563 6563
 
6564
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6565
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6566
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6564
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6565
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6566
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6567 6567
 					ORDER BY airport_arrival_icao_count DESC";
6568 6568
 		if ($limit) $query .= " LIMIT 10";
6569 6569
       
@@ -6593,11 +6593,11 @@  discard block
 block discarded – undo
6593 6593
 	}	
6594 6594
 	
6595 6595
 	/**
6596
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
6597
-	*
6598
-	* @return Array the airport list
6599
-	*
6600
-	*/
6596
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
6597
+	 *
6598
+	 * @return Array the airport list
6599
+	 *
6600
+	 */
6601 6601
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
6602 6602
 	{
6603 6603
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6629,11 +6629,11 @@  discard block
 block discarded – undo
6629 6629
 	
6630 6630
 	
6631 6631
 	/**
6632
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6633
-	*
6634
-	* @return Array the airport list
6635
-	*
6636
-	*/
6632
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6633
+	 *
6634
+	 * @return Array the airport list
6635
+	 *
6636
+	 */
6637 6637
 	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
6638 6638
 	{
6639 6639
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6664,11 +6664,11 @@  discard block
 block discarded – undo
6664 6664
 	
6665 6665
 	
6666 6666
 	/**
6667
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6668
-	*
6669
-	* @return Array the airport list
6670
-	*
6671
-	*/
6667
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6668
+	 *
6669
+	 * @return Array the airport list
6670
+	 *
6671
+	 */
6672 6672
 	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
6673 6673
 	{
6674 6674
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6702,11 +6702,11 @@  discard block
 block discarded – undo
6702 6702
 	
6703 6703
 	
6704 6704
 	/**
6705
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6706
-	*
6707
-	* @return Array the airport list
6708
-	*
6709
-	*/
6705
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6706
+	 *
6707
+	 * @return Array the airport list
6708
+	 *
6709
+	 */
6710 6710
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
6711 6711
 	{
6712 6712
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6736,11 +6736,11 @@  discard block
 block discarded – undo
6736 6736
 	
6737 6737
 	
6738 6738
 	/**
6739
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6740
-	*
6741
-	* @return Array the airport list
6742
-	*
6743
-	*/
6739
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6740
+	 *
6741
+	 * @return Array the airport list
6742
+	 *
6743
+	 */
6744 6744
 	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
6745 6745
 	{
6746 6746
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6774,11 +6774,11 @@  discard block
 block discarded – undo
6774 6774
 	
6775 6775
 	
6776 6776
 	/**
6777
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6778
-	*
6779
-	* @return Array the airport list
6780
-	*
6781
-	*/
6777
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6778
+	 *
6779
+	 * @return Array the airport list
6780
+	 *
6781
+	 */
6782 6782
 	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
6783 6783
 	{
6784 6784
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6809,11 +6809,11 @@  discard block
 block discarded – undo
6809 6809
 	
6810 6810
 	
6811 6811
 	/**
6812
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
6813
-	*
6814
-	* @return Array the airport list
6815
-	*
6816
-	*/
6812
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
6813
+	 *
6814
+	 * @return Array the airport list
6815
+	 *
6816
+	 */
6817 6817
 	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
6818 6818
 	{
6819 6819
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6846,11 +6846,11 @@  discard block
 block discarded – undo
6846 6846
 	
6847 6847
 	
6848 6848
 	/**
6849
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6850
-	*
6851
-	* @return Array the airport list
6852
-	*
6853
-	*/
6849
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6850
+	 *
6851
+	 * @return Array the airport list
6852
+	 *
6853
+	 */
6854 6854
 	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
6855 6855
 	{
6856 6856
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6880,11 +6880,11 @@  discard block
 block discarded – undo
6880 6880
 	
6881 6881
 	
6882 6882
 	/**
6883
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6884
-	*
6885
-	* @return Array the airport list
6886
-	*
6887
-	*/
6883
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6884
+	 *
6885
+	 * @return Array the airport list
6886
+	 *
6887
+	 */
6888 6888
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6889 6889
 	{
6890 6890
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6918,11 +6918,11 @@  discard block
 block discarded – undo
6918 6918
 	
6919 6919
 	
6920 6920
 	/**
6921
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
6922
-	*
6923
-	* @return Array the airport list
6924
-	*
6925
-	*/
6921
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
6922
+	 *
6923
+	 * @return Array the airport list
6924
+	 *
6925
+	 */
6926 6926
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6927 6927
 	{
6928 6928
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6953,11 +6953,11 @@  discard block
 block discarded – undo
6953 6953
 	
6954 6954
 	
6955 6955
 	/**
6956
-	* Gets all arrival airports of the airplanes that have flown over based on a date
6957
-	*
6958
-	* @return Array the airport list
6959
-	*
6960
-	*/
6956
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
6957
+	 *
6958
+	 * @return Array the airport list
6959
+	 *
6960
+	 */
6961 6961
 	public function countAllArrivalAirportsByDate($date,$filters = array())
6962 6962
 	{
6963 6963
 		global $globalTimezone, $globalDBdriver;
@@ -7003,11 +7003,11 @@  discard block
 block discarded – undo
7003 7003
 	
7004 7004
 	
7005 7005
 	/**
7006
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
7007
-	*
7008
-	* @return Array the airport list
7009
-	*
7010
-	*/
7006
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
7007
+	 *
7008
+	 * @return Array the airport list
7009
+	 *
7010
+	 */
7011 7011
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
7012 7012
 	{
7013 7013
 		global $globalTimezone, $globalDBdriver;
@@ -7050,11 +7050,11 @@  discard block
 block discarded – undo
7050 7050
 	
7051 7051
 	
7052 7052
 	/**
7053
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
7054
-	*
7055
-	* @return Array the airport list
7056
-	*
7057
-	*/
7053
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
7054
+	 *
7055
+	 * @return Array the airport list
7056
+	 *
7057
+	 */
7058 7058
 	public function countAllArrivalAirportsByIdent($ident,$filters = array())
7059 7059
 	{
7060 7060
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7087,11 +7087,11 @@  discard block
 block discarded – undo
7087 7087
 	
7088 7088
 	
7089 7089
 	/**
7090
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7091
-	*
7092
-	* @return Array the airport list
7093
-	*
7094
-	*/
7090
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7091
+	 *
7092
+	 * @return Array the airport list
7093
+	 *
7094
+	 */
7095 7095
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
7096 7096
 	{
7097 7097
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7122,11 +7122,11 @@  discard block
 block discarded – undo
7122 7122
 	
7123 7123
 	
7124 7124
 	/**
7125
-	* Gets all arrival airports of the airplanes that have flown over based on a country
7126
-	*
7127
-	* @return Array the airport list
7128
-	*
7129
-	*/
7125
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
7126
+	 *
7127
+	 * @return Array the airport list
7128
+	 *
7129
+	 */
7130 7130
 	public function countAllArrivalAirportsByCountry($country,$filters = array())
7131 7131
 	{
7132 7132
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7159,11 +7159,11 @@  discard block
 block discarded – undo
7159 7159
 	
7160 7160
 	
7161 7161
 	/**
7162
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
7163
-	*
7164
-	* @return Array the airport list
7165
-	*
7166
-	*/
7162
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
7163
+	 *
7164
+	 * @return Array the airport list
7165
+	 *
7166
+	 */
7167 7167
 	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
7168 7168
 	{
7169 7169
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7194,11 +7194,11 @@  discard block
 block discarded – undo
7194 7194
 
7195 7195
 
7196 7196
 	/**
7197
-	* Counts all airport departure countries
7198
-	*
7199
-	* @return Array the airport departure list
7200
-	*
7201
-	*/
7197
+	 * Counts all airport departure countries
7198
+	 *
7199
+	 * @return Array the airport departure list
7200
+	 *
7201
+	 */
7202 7202
 	public function countAllDepartureCountries($filters = array())
7203 7203
 	{
7204 7204
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7228,11 +7228,11 @@  discard block
 block discarded – undo
7228 7228
 	
7229 7229
 	
7230 7230
 	/**
7231
-	* Counts all airport arrival countries
7232
-	*
7233
-	* @return Array the airport arrival list
7234
-	*
7235
-	*/
7231
+	 * Counts all airport arrival countries
7232
+	 *
7233
+	 * @return Array the airport arrival list
7234
+	 *
7235
+	 */
7236 7236
 	public function countAllArrivalCountries($limit = true,$filters = array())
7237 7237
 	{
7238 7238
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7265,11 +7265,11 @@  discard block
 block discarded – undo
7265 7265
 
7266 7266
 
7267 7267
 	/**
7268
-	* Gets all route combinations
7269
-	*
7270
-	* @return Array the route list
7271
-	*
7272
-	*/
7268
+	 * Gets all route combinations
7269
+	 *
7270
+	 * @return Array the route list
7271
+	 *
7272
+	 */
7273 7273
 	public function countAllRoutes($filters = array())
7274 7274
 	{
7275 7275
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7308,11 +7308,11 @@  discard block
 block discarded – undo
7308 7308
 	
7309 7309
 	
7310 7310
 	/**
7311
-	* Gets all route combinations based on an aircraft
7312
-	*
7313
-	* @return Array the route list
7314
-	*
7315
-	*/
7311
+	 * Gets all route combinations based on an aircraft
7312
+	 *
7313
+	 * @return Array the route list
7314
+	 *
7315
+	 */
7316 7316
 	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
7317 7317
 	{
7318 7318
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7348,11 +7348,11 @@  discard block
 block discarded – undo
7348 7348
 	
7349 7349
 	
7350 7350
 	/**
7351
-	* Gets all route combinations based on an aircraft registration
7352
-	*
7353
-	* @return Array the route list
7354
-	*
7355
-	*/
7351
+	 * Gets all route combinations based on an aircraft registration
7352
+	 *
7353
+	 * @return Array the route list
7354
+	 *
7355
+	 */
7356 7356
 	public function countAllRoutesByRegistration($registration, $filters = array())
7357 7357
 	{
7358 7358
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7390,11 +7390,11 @@  discard block
 block discarded – undo
7390 7390
 	
7391 7391
 	
7392 7392
 	/**
7393
-	* Gets all route combinations based on an airline
7394
-	*
7395
-	* @return Array the route list
7396
-	*
7397
-	*/
7393
+	 * Gets all route combinations based on an airline
7394
+	 *
7395
+	 * @return Array the route list
7396
+	 *
7397
+	 */
7398 7398
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
7399 7399
 	{
7400 7400
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7432,11 +7432,11 @@  discard block
 block discarded – undo
7432 7432
 	
7433 7433
 	
7434 7434
 	/**
7435
-	* Gets all route combinations based on an airport
7436
-	*
7437
-	* @return Array the route list
7438
-	*
7439
-	*/
7435
+	 * Gets all route combinations based on an airport
7436
+	 *
7437
+	 * @return Array the route list
7438
+	 *
7439
+	 */
7440 7440
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
7441 7441
 	{
7442 7442
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7473,11 +7473,11 @@  discard block
 block discarded – undo
7473 7473
 	
7474 7474
 	
7475 7475
 	/**
7476
-	* Gets all route combinations based on an country
7477
-	*
7478
-	* @return Array the route list
7479
-	*
7480
-	*/
7476
+	 * Gets all route combinations based on an country
7477
+	 *
7478
+	 * @return Array the route list
7479
+	 *
7480
+	 */
7481 7481
 	public function countAllRoutesByCountry($country, $filters = array())
7482 7482
 	{
7483 7483
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7513,11 +7513,11 @@  discard block
 block discarded – undo
7513 7513
 
7514 7514
 
7515 7515
 	/**
7516
-	* Gets all route combinations based on an date
7517
-	*
7518
-	* @return Array the route list
7519
-	*
7520
-	*/
7516
+	 * Gets all route combinations based on an date
7517
+	 *
7518
+	 * @return Array the route list
7519
+	 *
7520
+	 */
7521 7521
 	public function countAllRoutesByDate($date, $filters = array())
7522 7522
 	{
7523 7523
 		global $globalTimezone, $globalDBdriver;
@@ -7567,11 +7567,11 @@  discard block
 block discarded – undo
7567 7567
 	
7568 7568
 	
7569 7569
 	/**
7570
-	* Gets all route combinations based on an ident/callsign
7571
-	*
7572
-	* @return Array the route list
7573
-	*
7574
-	*/
7570
+	 * Gets all route combinations based on an ident/callsign
7571
+	 *
7572
+	 * @return Array the route list
7573
+	 *
7574
+	 */
7575 7575
 	public function countAllRoutesByIdent($ident, $filters = array())
7576 7576
 	{
7577 7577
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7608,11 +7608,11 @@  discard block
 block discarded – undo
7608 7608
 	
7609 7609
 	
7610 7610
 	/**
7611
-	* Gets all route combinations based on an manufacturer
7612
-	*
7613
-	* @return Array the route list
7614
-	*
7615
-	*/
7611
+	 * Gets all route combinations based on an manufacturer
7612
+	 *
7613
+	 * @return Array the route list
7614
+	 *
7615
+	 */
7616 7616
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
7617 7617
 	{
7618 7618
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7650,11 +7650,11 @@  discard block
 block discarded – undo
7650 7650
 	
7651 7651
 	
7652 7652
 	/**
7653
-	* Gets all route combinations with waypoints
7654
-	*
7655
-	* @return Array the route list
7656
-	*
7657
-	*/
7653
+	 * Gets all route combinations with waypoints
7654
+	 *
7655
+	 * @return Array the route list
7656
+	 *
7657
+	 */
7658 7658
 	public function countAllRoutesWithWaypoints($filters = array())
7659 7659
 	{
7660 7660
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7691,11 +7691,11 @@  discard block
 block discarded – undo
7691 7691
 	}
7692 7692
 	
7693 7693
 	/**
7694
-	* Gets all callsigns that have flown over
7695
-	*
7696
-	* @return Array the callsign list
7697
-	*
7698
-	*/
7694
+	 * Gets all callsigns that have flown over
7695
+	 *
7696
+	 * @return Array the callsign list
7697
+	 *
7698
+	 */
7699 7699
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
7700 7700
 	{
7701 7701
 		global $globalDBdriver;
@@ -7733,11 +7733,11 @@  discard block
 block discarded – undo
7733 7733
 	}
7734 7734
 
7735 7735
 	/**
7736
-	* Gets all callsigns that have flown over
7737
-	*
7738
-	* @return Array the callsign list
7739
-	*
7740
-	*/
7736
+	 * Gets all callsigns that have flown over
7737
+	 *
7738
+	 * @return Array the callsign list
7739
+	 *
7740
+	 */
7741 7741
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7742 7742
 	{
7743 7743
 		global $globalDBdriver;
@@ -7778,11 +7778,11 @@  discard block
 block discarded – undo
7778 7778
 
7779 7779
 
7780 7780
 	/**
7781
-	* Counts all dates
7782
-	*
7783
-	* @return Array the date list
7784
-	*
7785
-	*/
7781
+	 * Counts all dates
7782
+	 *
7783
+	 * @return Array the date list
7784
+	 *
7785
+	 */
7786 7786
 	public function countAllDates($filters = array())
7787 7787
 	{
7788 7788
 		global $globalTimezone, $globalDBdriver;
@@ -7827,11 +7827,11 @@  discard block
 block discarded – undo
7827 7827
 	}
7828 7828
 	
7829 7829
 	/**
7830
-	* Counts all dates
7831
-	*
7832
-	* @return Array the date list
7833
-	*
7834
-	*/
7830
+	 * Counts all dates
7831
+	 *
7832
+	 * @return Array the date list
7833
+	 *
7834
+	 */
7835 7835
 	public function countAllDatesByAirlines($filters = array())
7836 7836
 	{
7837 7837
 		global $globalTimezone, $globalDBdriver;
@@ -7876,11 +7876,11 @@  discard block
 block discarded – undo
7876 7876
 	}	
7877 7877
 	
7878 7878
 	/**
7879
-	* Counts all dates during the last 7 days
7880
-	*
7881
-	* @return Array the date list
7882
-	*
7883
-	*/
7879
+	 * Counts all dates during the last 7 days
7880
+	 *
7881
+	 * @return Array the date list
7882
+	 *
7883
+	 */
7884 7884
 	public function countAllDatesLast7Days($filters = array())
7885 7885
 	{
7886 7886
 		global $globalTimezone, $globalDBdriver;
@@ -7902,7 +7902,7 @@  discard block
 block discarded – undo
7902 7902
 			$query .= " GROUP BY date_name 
7903 7903
 								ORDER BY date_name ASC";
7904 7904
 			$query_data = array(':offset' => $offset);
7905
-    		}
7905
+			}
7906 7906
 		
7907 7907
 		$sth = $this->db->prepare($query);
7908 7908
 		$sth->execute($query_data);
@@ -7922,11 +7922,11 @@  discard block
 block discarded – undo
7922 7922
 	}
7923 7923
 
7924 7924
 	/**
7925
-	* Counts all dates during the last month
7926
-	*
7927
-	* @return Array the date list
7928
-	*
7929
-	*/
7925
+	 * Counts all dates during the last month
7926
+	 *
7927
+	 * @return Array the date list
7928
+	 *
7929
+	 */
7930 7930
 	public function countAllDatesLastMonth($filters = array())
7931 7931
 	{
7932 7932
 		global $globalTimezone, $globalDBdriver;
@@ -7948,7 +7948,7 @@  discard block
 block discarded – undo
7948 7948
 			$query .= " GROUP BY date_name 
7949 7949
 								ORDER BY date_name ASC";
7950 7950
 			$query_data = array(':offset' => $offset);
7951
-    		}
7951
+			}
7952 7952
 		
7953 7953
 		$sth = $this->db->prepare($query);
7954 7954
 		$sth->execute($query_data);
@@ -7969,11 +7969,11 @@  discard block
 block discarded – undo
7969 7969
 
7970 7970
 
7971 7971
 	/**
7972
-	* Counts all dates during the last month
7973
-	*
7974
-	* @return Array the date list
7975
-	*
7976
-	*/
7972
+	 * Counts all dates during the last month
7973
+	 *
7974
+	 * @return Array the date list
7975
+	 *
7976
+	 */
7977 7977
 	public function countAllDatesLastMonthByAirlines($filters = array())
7978 7978
 	{
7979 7979
 		global $globalTimezone, $globalDBdriver;
@@ -7996,7 +7996,7 @@  discard block
 block discarded – undo
7996 7996
 								GROUP BY spotter_output.airline_icao, date_name 
7997 7997
 								ORDER BY date_name ASC";
7998 7998
 			$query_data = array(':offset' => $offset);
7999
-    		}
7999
+			}
8000 8000
 		
8001 8001
 		$sth = $this->db->prepare($query);
8002 8002
 		$sth->execute($query_data);
@@ -8018,11 +8018,11 @@  discard block
 block discarded – undo
8018 8018
 	
8019 8019
 
8020 8020
 	/**
8021
-	* Counts all month
8022
-	*
8023
-	* @return Array the month list
8024
-	*
8025
-	*/
8021
+	 * Counts all month
8022
+	 *
8023
+	 * @return Array the month list
8024
+	 *
8025
+	 */
8026 8026
 	public function countAllMonths($filters = array())
8027 8027
 	{
8028 8028
 		global $globalTimezone, $globalDBdriver;
@@ -8064,11 +8064,11 @@  discard block
 block discarded – undo
8064 8064
 	}
8065 8065
 
8066 8066
 	/**
8067
-	* Counts all month
8068
-	*
8069
-	* @return Array the month list
8070
-	*
8071
-	*/
8067
+	 * Counts all month
8068
+	 *
8069
+	 * @return Array the month list
8070
+	 *
8071
+	 */
8072 8072
 	public function countAllMonthsByAirlines($filters = array())
8073 8073
 	{
8074 8074
 		global $globalTimezone, $globalDBdriver;
@@ -8113,11 +8113,11 @@  discard block
 block discarded – undo
8113 8113
 	}
8114 8114
 
8115 8115
 	/**
8116
-	* Counts all military month
8117
-	*
8118
-	* @return Array the month list
8119
-	*
8120
-	*/
8116
+	 * Counts all military month
8117
+	 *
8118
+	 * @return Array the month list
8119
+	 *
8120
+	 */
8121 8121
 	public function countAllMilitaryMonths($filters = array())
8122 8122
 	{
8123 8123
 		global $globalTimezone, $globalDBdriver;
@@ -8158,11 +8158,11 @@  discard block
 block discarded – undo
8158 8158
 	}
8159 8159
 	
8160 8160
 	/**
8161
-	* Counts all month owners
8162
-	*
8163
-	* @return Array the month list
8164
-	*
8165
-	*/
8161
+	 * Counts all month owners
8162
+	 *
8163
+	 * @return Array the month list
8164
+	 *
8165
+	 */
8166 8166
 	public function countAllMonthsOwners($filters = array())
8167 8167
 	{
8168 8168
 		global $globalTimezone, $globalDBdriver;
@@ -8204,11 +8204,11 @@  discard block
 block discarded – undo
8204 8204
 	}
8205 8205
 	
8206 8206
 	/**
8207
-	* Counts all month owners
8208
-	*
8209
-	* @return Array the month list
8210
-	*
8211
-	*/
8207
+	 * Counts all month owners
8208
+	 *
8209
+	 * @return Array the month list
8210
+	 *
8211
+	 */
8212 8212
 	public function countAllMonthsOwnersByAirlines($filters = array())
8213 8213
 	{
8214 8214
 		global $globalTimezone, $globalDBdriver;
@@ -8251,11 +8251,11 @@  discard block
 block discarded – undo
8251 8251
 	}
8252 8252
 
8253 8253
 	/**
8254
-	* Counts all month pilot
8255
-	*
8256
-	* @return Array the month list
8257
-	*
8258
-	*/
8254
+	 * Counts all month pilot
8255
+	 *
8256
+	 * @return Array the month list
8257
+	 *
8258
+	 */
8259 8259
 	public function countAllMonthsPilots($filters = array())
8260 8260
 	{
8261 8261
 		global $globalTimezone, $globalDBdriver;
@@ -8297,11 +8297,11 @@  discard block
 block discarded – undo
8297 8297
 	}
8298 8298
 	
8299 8299
 	/**
8300
-	* Counts all month pilot
8301
-	*
8302
-	* @return Array the month list
8303
-	*
8304
-	*/
8300
+	 * Counts all month pilot
8301
+	 *
8302
+	 * @return Array the month list
8303
+	 *
8304
+	 */
8305 8305
 	public function countAllMonthsPilotsByAirlines($filters = array())
8306 8306
 	{
8307 8307
 		global $globalTimezone, $globalDBdriver;
@@ -8344,11 +8344,11 @@  discard block
 block discarded – undo
8344 8344
 	}
8345 8345
 
8346 8346
 	/**
8347
-	* Counts all month airline
8348
-	*
8349
-	* @return Array the month list
8350
-	*
8351
-	*/
8347
+	 * Counts all month airline
8348
+	 *
8349
+	 * @return Array the month list
8350
+	 *
8351
+	 */
8352 8352
 	public function countAllMonthsAirlines($filters = array())
8353 8353
 	{
8354 8354
 		global $globalTimezone, $globalDBdriver;
@@ -8390,11 +8390,11 @@  discard block
 block discarded – undo
8390 8390
 	}
8391 8391
 	
8392 8392
 	/**
8393
-	* Counts all month aircraft
8394
-	*
8395
-	* @return Array the month list
8396
-	*
8397
-	*/
8393
+	 * Counts all month aircraft
8394
+	 *
8395
+	 * @return Array the month list
8396
+	 *
8397
+	 */
8398 8398
 	public function countAllMonthsAircrafts($filters = array())
8399 8399
 	{
8400 8400
 		global $globalTimezone, $globalDBdriver;
@@ -8437,11 +8437,11 @@  discard block
 block discarded – undo
8437 8437
 	
8438 8438
 
8439 8439
 	/**
8440
-	* Counts all month aircraft
8441
-	*
8442
-	* @return Array the month list
8443
-	*
8444
-	*/
8440
+	 * Counts all month aircraft
8441
+	 *
8442
+	 * @return Array the month list
8443
+	 *
8444
+	 */
8445 8445
 	public function countAllMonthsAircraftsByAirlines($filters = array())
8446 8446
 	{
8447 8447
 		global $globalTimezone, $globalDBdriver;
@@ -8484,11 +8484,11 @@  discard block
 block discarded – undo
8484 8484
 	}
8485 8485
 
8486 8486
 	/**
8487
-	* Counts all month real arrival
8488
-	*
8489
-	* @return Array the month list
8490
-	*
8491
-	*/
8487
+	 * Counts all month real arrival
8488
+	 *
8489
+	 * @return Array the month list
8490
+	 *
8491
+	 */
8492 8492
 	public function countAllMonthsRealArrivals($filters = array())
8493 8493
 	{
8494 8494
 		global $globalTimezone, $globalDBdriver;
@@ -8531,11 +8531,11 @@  discard block
 block discarded – undo
8531 8531
 	
8532 8532
 
8533 8533
 	/**
8534
-	* Counts all month real arrival
8535
-	*
8536
-	* @return Array the month list
8537
-	*
8538
-	*/
8534
+	 * Counts all month real arrival
8535
+	 *
8536
+	 * @return Array the month list
8537
+	 *
8538
+	 */
8539 8539
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
8540 8540
 	{
8541 8541
 		global $globalTimezone, $globalDBdriver;
@@ -8579,11 +8579,11 @@  discard block
 block discarded – undo
8579 8579
 	
8580 8580
 
8581 8581
 	/**
8582
-	* Counts all dates during the last year
8583
-	*
8584
-	* @return Array the date list
8585
-	*
8586
-	*/
8582
+	 * Counts all dates during the last year
8583
+	 *
8584
+	 * @return Array the date list
8585
+	 *
8586
+	 */
8587 8587
 	public function countAllMonthsLastYear($filters)
8588 8588
 	{
8589 8589
 		global $globalTimezone, $globalDBdriver;
@@ -8605,7 +8605,7 @@  discard block
 block discarded – undo
8605 8605
 			$query .= " GROUP BY year_name, month_name
8606 8606
 								ORDER BY year_name, month_name ASC";
8607 8607
 			$query_data = array(':offset' => $offset);
8608
-    		}
8608
+			}
8609 8609
 		
8610 8610
 		$sth = $this->db->prepare($query);
8611 8611
 		$sth->execute($query_data);
@@ -8628,11 +8628,11 @@  discard block
 block discarded – undo
8628 8628
 	
8629 8629
 	
8630 8630
 	/**
8631
-	* Counts all hours
8632
-	*
8633
-	* @return Array the hour list
8634
-	*
8635
-	*/
8631
+	 * Counts all hours
8632
+	 *
8633
+	 * @return Array the hour list
8634
+	 *
8635
+	 */
8636 8636
 	public function countAllHours($orderby,$filters = array())
8637 8637
 	{
8638 8638
 		global $globalTimezone, $globalDBdriver;
@@ -8693,11 +8693,11 @@  discard block
 block discarded – undo
8693 8693
 	}
8694 8694
 	
8695 8695
 	/**
8696
-	* Counts all hours
8697
-	*
8698
-	* @return Array the hour list
8699
-	*
8700
-	*/
8696
+	 * Counts all hours
8697
+	 *
8698
+	 * @return Array the hour list
8699
+	 *
8700
+	 */
8701 8701
 	public function countAllHoursByAirlines($orderby, $filters = array())
8702 8702
 	{
8703 8703
 		global $globalTimezone, $globalDBdriver;
@@ -8760,11 +8760,11 @@  discard block
 block discarded – undo
8760 8760
 
8761 8761
 
8762 8762
 	/**
8763
-	* Counts all hours by airline
8764
-	*
8765
-	* @return Array the hour list
8766
-	*
8767
-	*/
8763
+	 * Counts all hours by airline
8764
+	 *
8765
+	 * @return Array the hour list
8766
+	 *
8767
+	 */
8768 8768
 	public function countAllHoursByAirline($airline_icao, $filters = array())
8769 8769
 	{
8770 8770
 		global $globalTimezone, $globalDBdriver;
@@ -8810,11 +8810,11 @@  discard block
 block discarded – undo
8810 8810
 	
8811 8811
 	
8812 8812
 	/**
8813
-	* Counts all hours by aircraft
8814
-	*
8815
-	* @return Array the hour list
8816
-	*
8817
-	*/
8813
+	 * Counts all hours by aircraft
8814
+	 *
8815
+	 * @return Array the hour list
8816
+	 *
8817
+	 */
8818 8818
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
8819 8819
 	{
8820 8820
 		global $globalTimezone, $globalDBdriver;
@@ -8857,11 +8857,11 @@  discard block
 block discarded – undo
8857 8857
 	
8858 8858
 	
8859 8859
 	/**
8860
-	* Counts all hours by aircraft registration
8861
-	*
8862
-	* @return Array the hour list
8863
-	*
8864
-	*/
8860
+	 * Counts all hours by aircraft registration
8861
+	 *
8862
+	 * @return Array the hour list
8863
+	 *
8864
+	 */
8865 8865
 	public function countAllHoursByRegistration($registration, $filters = array())
8866 8866
 	{
8867 8867
 		global $globalTimezone, $globalDBdriver;
@@ -8904,11 +8904,11 @@  discard block
 block discarded – undo
8904 8904
 	
8905 8905
 	
8906 8906
 	/**
8907
-	* Counts all hours by airport
8908
-	*
8909
-	* @return Array the hour list
8910
-	*
8911
-	*/
8907
+	 * Counts all hours by airport
8908
+	 *
8909
+	 * @return Array the hour list
8910
+	 *
8911
+	 */
8912 8912
 	public function countAllHoursByAirport($airport_icao, $filters = array())
8913 8913
 	{
8914 8914
 		global $globalTimezone, $globalDBdriver;
@@ -8952,11 +8952,11 @@  discard block
 block discarded – undo
8952 8952
 	
8953 8953
 	
8954 8954
 	/**
8955
-	* Counts all hours by manufacturer
8956
-	*
8957
-	* @return Array the hour list
8958
-	*
8959
-	*/
8955
+	 * Counts all hours by manufacturer
8956
+	 *
8957
+	 * @return Array the hour list
8958
+	 *
8959
+	 */
8960 8960
 	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
8961 8961
 	{
8962 8962
 		global $globalTimezone, $globalDBdriver;
@@ -9000,11 +9000,11 @@  discard block
 block discarded – undo
9000 9000
 	
9001 9001
 	
9002 9002
 	/**
9003
-	* Counts all hours by date
9004
-	*
9005
-	* @return Array the hour list
9006
-	*
9007
-	*/
9003
+	 * Counts all hours by date
9004
+	 *
9005
+	 * @return Array the hour list
9006
+	 *
9007
+	 */
9008 9008
 	public function countAllHoursByDate($date, $filters = array())
9009 9009
 	{
9010 9010
 		global $globalTimezone, $globalDBdriver;
@@ -9048,11 +9048,11 @@  discard block
 block discarded – undo
9048 9048
 	
9049 9049
 	
9050 9050
 	/**
9051
-	* Counts all hours by a ident/callsign
9052
-	*
9053
-	* @return Array the hour list
9054
-	*
9055
-	*/
9051
+	 * Counts all hours by a ident/callsign
9052
+	 *
9053
+	 * @return Array the hour list
9054
+	 *
9055
+	 */
9056 9056
 	public function countAllHoursByIdent($ident, $filters = array())
9057 9057
 	{
9058 9058
 		global $globalTimezone, $globalDBdriver;
@@ -9097,11 +9097,11 @@  discard block
 block discarded – undo
9097 9097
 	
9098 9098
 	
9099 9099
 	/**
9100
-	* Counts all hours by route
9101
-	*
9102
-	* @return Array the hour list
9103
-	*
9104
-	*/
9100
+	 * Counts all hours by route
9101
+	 *
9102
+	 * @return Array the hour list
9103
+	 *
9104
+	 */
9105 9105
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
9106 9106
 	{
9107 9107
 		global $globalTimezone, $globalDBdriver;
@@ -9145,11 +9145,11 @@  discard block
 block discarded – undo
9145 9145
 	
9146 9146
 	
9147 9147
 	/**
9148
-	* Counts all hours by country
9149
-	*
9150
-	* @return Array the hour list
9151
-	*
9152
-	*/
9148
+	 * Counts all hours by country
9149
+	 *
9150
+	 * @return Array the hour list
9151
+	 *
9152
+	 */
9153 9153
 	public function countAllHoursByCountry($country, $filters = array())
9154 9154
 	{
9155 9155
 		global $globalTimezone, $globalDBdriver;
@@ -9194,11 +9194,11 @@  discard block
 block discarded – undo
9194 9194
 
9195 9195
 
9196 9196
 	/**
9197
-	* Counts all aircraft that have flown over
9198
-	*
9199
-	* @return Integer the number of aircrafts
9200
-	*
9201
-	*/
9197
+	 * Counts all aircraft that have flown over
9198
+	 *
9199
+	 * @return Integer the number of aircrafts
9200
+	 *
9201
+	 */
9202 9202
 	public function countOverallAircrafts($filters = array())
9203 9203
 	{
9204 9204
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9210,11 +9210,11 @@  discard block
 block discarded – undo
9210 9210
 	}
9211 9211
 
9212 9212
 	/**
9213
-	* Counts all flight that really arrival
9214
-	*
9215
-	* @return Integer the number of aircrafts
9216
-	*
9217
-	*/
9213
+	 * Counts all flight that really arrival
9214
+	 *
9215
+	 * @return Integer the number of aircrafts
9216
+	 *
9217
+	 */
9218 9218
 	public function countOverallArrival($filters = array())
9219 9219
 	{
9220 9220
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9227,11 +9227,11 @@  discard block
 block discarded – undo
9227 9227
 	}
9228 9228
 
9229 9229
 	/**
9230
-	* Counts all pilots that have flown over
9231
-	*
9232
-	* @return Integer the number of pilots
9233
-	*
9234
-	*/
9230
+	 * Counts all pilots that have flown over
9231
+	 *
9232
+	 * @return Integer the number of pilots
9233
+	 *
9234
+	 */
9235 9235
 	public function countOverallPilots($filters = array())
9236 9236
 	{
9237 9237
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9243,11 +9243,11 @@  discard block
 block discarded – undo
9243 9243
 	}
9244 9244
 
9245 9245
 	/**
9246
-	* Counts all owners that have flown over
9247
-	*
9248
-	* @return Integer the number of owners
9249
-	*
9250
-	*/
9246
+	 * Counts all owners that have flown over
9247
+	 *
9248
+	 * @return Integer the number of owners
9249
+	 *
9250
+	 */
9251 9251
 	public function countOverallOwners($filters = array())
9252 9252
 	{
9253 9253
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9260,11 +9260,11 @@  discard block
 block discarded – undo
9260 9260
 	
9261 9261
 	
9262 9262
 	/**
9263
-	* Counts all flights that have flown over
9264
-	*
9265
-	* @return Integer the number of flights
9266
-	*
9267
-	*/
9263
+	 * Counts all flights that have flown over
9264
+	 *
9265
+	 * @return Integer the number of flights
9266
+	 *
9267
+	 */
9268 9268
 	public function countOverallFlights($filters = array())
9269 9269
 	{
9270 9270
 		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
@@ -9277,11 +9277,11 @@  discard block
 block discarded – undo
9277 9277
 	}
9278 9278
 	
9279 9279
 	/**
9280
-	* Counts all military flights that have flown over
9281
-	*
9282
-	* @return Integer the number of flights
9283
-	*
9284
-	*/
9280
+	 * Counts all military flights that have flown over
9281
+	 *
9282
+	 * @return Integer the number of flights
9283
+	 *
9284
+	 */
9285 9285
 	public function countOverallMilitaryFlights($filters = array())
9286 9286
 	{
9287 9287
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9296,11 +9296,11 @@  discard block
 block discarded – undo
9296 9296
 	
9297 9297
 	
9298 9298
 	/**
9299
-	* Counts all airlines that have flown over
9300
-	*
9301
-	* @return Integer the number of airlines
9302
-	*
9303
-	*/
9299
+	 * Counts all airlines that have flown over
9300
+	 *
9301
+	 * @return Integer the number of airlines
9302
+	 *
9303
+	 */
9304 9304
 	public function countOverallAirlines($filters = array())
9305 9305
 	{
9306 9306
 		$query  = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
@@ -9314,11 +9314,11 @@  discard block
 block discarded – undo
9314 9314
 
9315 9315
   
9316 9316
 	/**
9317
-	* Counts all hours of today
9318
-	*
9319
-	* @return Array the hour list
9320
-	*
9321
-	*/
9317
+	 * Counts all hours of today
9318
+	 *
9319
+	 * @return Array the hour list
9320
+	 *
9321
+	 */
9322 9322
 	public function countAllHoursFromToday($filters = array())
9323 9323
 	{
9324 9324
 		global $globalTimezone, $globalDBdriver;
@@ -9358,11 +9358,11 @@  discard block
 block discarded – undo
9358 9358
 	}
9359 9359
     
9360 9360
 	/**
9361
-	* Gets all the spotter information based on calculated upcoming flights
9362
-	*
9363
-	* @return Array the spotter information
9364
-	*
9365
-	*/
9361
+	 * Gets all the spotter information based on calculated upcoming flights
9362
+	 *
9363
+	 * @return Array the spotter information
9364
+	 *
9365
+	 */
9366 9366
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
9367 9367
 	{
9368 9368
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -9437,12 +9437,12 @@  discard block
 block discarded – undo
9437 9437
 	}
9438 9438
     
9439 9439
     
9440
-     /**
9441
-	* Gets the Barrie Spotter ID based on the FlightAware ID
9442
-	*
9443
-	* @return Integer the Barrie Spotter ID
9440
+	 /**
9441
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
9442
+	  *
9443
+	  * @return Integer the Barrie Spotter ID
9444 9444
 q	*
9445
-	*/
9445
+	  */
9446 9446
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
9447 9447
 	{
9448 9448
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -9463,13 +9463,13 @@  discard block
 block discarded – undo
9463 9463
   
9464 9464
  
9465 9465
 	/**
9466
-	* Parses a date string
9467
-	*
9468
-	* @param String $dateString the date string
9469
-	* @param String $timezone the timezone of a user
9470
-	* @return Array the time information
9471
-	*
9472
-	*/
9466
+	 * Parses a date string
9467
+	 *
9468
+	 * @param String $dateString the date string
9469
+	 * @param String $timezone the timezone of a user
9470
+	 * @return Array the time information
9471
+	 *
9472
+	 */
9473 9473
 	public function parseDateString($dateString, $timezone = '')
9474 9474
 	{
9475 9475
 		$time_array = array();
@@ -9505,12 +9505,12 @@  discard block
 block discarded – undo
9505 9505
 	
9506 9506
 	
9507 9507
 	/**
9508
-	* Parses the direction degrees to working
9509
-	*
9510
-	* @param Float $direction the direction in degrees
9511
-	* @return Array the direction information
9512
-	*
9513
-	*/
9508
+	 * Parses the direction degrees to working
9509
+	 *
9510
+	 * @param Float $direction the direction in degrees
9511
+	 * @return Array the direction information
9512
+	 *
9513
+	 */
9514 9514
 	public function parseDirection($direction = 0)
9515 9515
 	{
9516 9516
 		if ($direction == '') $direction = 0;
@@ -9589,12 +9589,12 @@  discard block
 block discarded – undo
9589 9589
 	
9590 9590
 	
9591 9591
 	/**
9592
-	* Gets the aircraft registration
9593
-	*
9594
-	* @param String $flightaware_id the flight aware id
9595
-	* @return String the aircraft registration
9596
-	*
9597
-	*/
9592
+	 * Gets the aircraft registration
9593
+	 *
9594
+	 * @param String $flightaware_id the flight aware id
9595
+	 * @return String the aircraft registration
9596
+	 *
9597
+	 */
9598 9598
 	
9599 9599
 	public function getAircraftRegistration($flightaware_id)
9600 9600
 	{
@@ -9623,12 +9623,12 @@  discard block
 block discarded – undo
9623 9623
 
9624 9624
 
9625 9625
 	/**
9626
-	* Gets the aircraft registration from ModeS
9627
-	*
9628
-	* @param String $aircraft_modes the flight ModeS in hex
9629
-	* @return String the aircraft registration
9630
-	*
9631
-	*/
9626
+	 * Gets the aircraft registration from ModeS
9627
+	 *
9628
+	 * @param String $aircraft_modes the flight ModeS in hex
9629
+	 * @return String the aircraft registration
9630
+	 *
9631
+	 */
9632 9632
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
9633 9633
 	{
9634 9634
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9641,19 +9641,19 @@  discard block
 block discarded – undo
9641 9641
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9642 9642
 		$sth->closeCursor();
9643 9643
 		if (count($row) > 0) {
9644
-		    //return $row['Registration'];
9645
-		    return $row['registration'];
9644
+			//return $row['Registration'];
9645
+			return $row['registration'];
9646 9646
 		} else return '';
9647 9647
 	
9648 9648
 	}
9649 9649
 
9650 9650
 	/**
9651
-	* Gets the aircraft type from ModeS
9652
-	*
9653
-	* @param String $aircraft_modes the flight ModeS in hex
9654
-	* @return String the aircraft type
9655
-	*
9656
-	*/
9651
+	 * Gets the aircraft type from ModeS
9652
+	 *
9653
+	 * @param String $aircraft_modes the flight ModeS in hex
9654
+	 * @return String the aircraft type
9655
+	 *
9656
+	 */
9657 9657
 	public function getAircraftTypeBymodeS($aircraft_modes)
9658 9658
 	{
9659 9659
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9666,19 +9666,19 @@  discard block
 block discarded – undo
9666 9666
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9667 9667
 		$sth->closeCursor();
9668 9668
 		if (count($row) > 0) {
9669
-		    if ($row['type_flight'] == null) return '';
9670
-		    else return $row['type_flight'];
9669
+			if ($row['type_flight'] == null) return '';
9670
+			else return $row['type_flight'];
9671 9671
 		} else return '';
9672 9672
 	
9673 9673
 	}
9674 9674
 
9675 9675
 	/**
9676
-	* Gets Countrie from latitude/longitude
9677
-	*
9678
-	* @param Float $latitude latitute of the flight
9679
-	* @param Float $longitude longitute of the flight
9680
-	* @return String the countrie
9681
-	*/
9676
+	 * Gets Countrie from latitude/longitude
9677
+	 *
9678
+	 * @param Float $latitude latitute of the flight
9679
+	 * @param Float $longitude longitute of the flight
9680
+	 * @return String the countrie
9681
+	 */
9682 9682
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
9683 9683
 	{
9684 9684
 		global $globalDBdriver, $globalDebug;
@@ -9715,12 +9715,12 @@  discard block
 block discarded – undo
9715 9715
 	}
9716 9716
 
9717 9717
 	/**
9718
-	* converts the registration code using the country prefix
9719
-	*
9720
-	* @param String $registration the aircraft registration
9721
-	* @return String the aircraft registration
9722
-	*
9723
-	*/
9718
+	 * converts the registration code using the country prefix
9719
+	 *
9720
+	 * @param String $registration the aircraft registration
9721
+	 * @return String the aircraft registration
9722
+	 *
9723
+	 */
9724 9724
 	public function convertAircraftRegistration($registration)
9725 9725
 	{
9726 9726
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9772,12 +9772,12 @@  discard block
 block discarded – undo
9772 9772
 	}
9773 9773
 
9774 9774
 	/**
9775
-	* Country from the registration code
9776
-	*
9777
-	* @param String $registration the aircraft registration
9778
-	* @return String the country
9779
-	*
9780
-	*/
9775
+	 * Country from the registration code
9776
+	 *
9777
+	 * @param String $registration the aircraft registration
9778
+	 * @return String the country
9779
+	 *
9780
+	 */
9781 9781
 	public function countryFromAircraftRegistration($registration)
9782 9782
 	{
9783 9783
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9796,8 +9796,8 @@  discard block
 block discarded – undo
9796 9796
 				$country = $row['country'];
9797 9797
 			}
9798 9798
 		} else {
9799
-    			$registration_1 = substr($registration, 0, 1);
9800
-		        $registration_2 = substr($registration, 0, 2);
9799
+				$registration_1 = substr($registration, 0, 1);
9800
+				$registration_2 = substr($registration, 0, 2);
9801 9801
 
9802 9802
 			$country = '';
9803 9803
 			//first get the prefix based on two characters
@@ -9833,11 +9833,11 @@  discard block
 block discarded – undo
9833 9833
 	}
9834 9834
 	
9835 9835
 	/**
9836
-	* Set a new highlight value for a flight
9837
-	*
9838
-	* @param String $flightaware_id flightaware_id from spotter_output table
9839
-	* @param String $highlight New highlight value
9840
-	*/
9836
+	 * Set a new highlight value for a flight
9837
+	 *
9838
+	 * @param String $flightaware_id flightaware_id from spotter_output table
9839
+	 * @param String $highlight New highlight value
9840
+	 */
9841 9841
 	public function setHighlightFlight($flightaware_id,$highlight) {
9842 9842
 		
9843 9843
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -9846,12 +9846,12 @@  discard block
 block discarded – undo
9846 9846
 	}
9847 9847
 	
9848 9848
 	/**
9849
-	* Gets the short url from bit.ly
9850
-	*
9851
-	* @param String $url the full url
9852
-	* @return String the bit.ly url
9853
-	*
9854
-	*/
9849
+	 * Gets the short url from bit.ly
9850
+	 *
9851
+	 * @param String $url the full url
9852
+	 * @return String the bit.ly url
9853
+	 *
9854
+	 */
9855 9855
 	public function getBitlyURL($url)
9856 9856
 	{
9857 9857
 		global $globalBitlyAccessToken;
@@ -10140,11 +10140,11 @@  discard block
 block discarded – undo
10140 10140
 			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
10141 10141
 	                      FROM airport WHERE longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
10142 10142
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
10143
-                } else {
10143
+				} else {
10144 10144
 			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance 
10145 10145
 	                      FROM airport WHERE CAST(longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
10146 10146
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
10147
-    		}
10147
+			}
10148 10148
 		$sth = $this->db->prepare($query);
10149 10149
 		$sth->execute();
10150 10150
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
Spacing   +1004 added lines, -1004 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 require_once(dirname(__FILE__).'/class.Image.php');
5 5
 $global_query = "SELECT spotter_output.* FROM spotter_output";
6 6
 
7
-class Spotter{
7
+class Spotter {
8 8
 	public $db;
9 9
 	
10 10
 	public function __construct($dbc = null) {
@@ -17,64 +17,64 @@  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;
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
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
30
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
31 31
 		$filter_query_join = '';
32 32
 		$filter_query_where = '';
33
-		foreach($filters as $flt) {
33
+		foreach ($filters as $flt) {
34 34
 			if (isset($flt['airlines']) && !empty($flt['airlines'])) {
35 35
 				if ($flt['airlines'][0] != '') {
36 36
 					if (isset($flt['source'])) {
37
-						$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'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
37
+						$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'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
38 38
 					} else {
39
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
39
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
40 40
 					}
41 41
 				}
42 42
 			}
43 43
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
44 44
 				if (isset($flt['source'])) {
45
-					$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'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
45
+					$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'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
46 46
 				} else {
47
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
47
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
48 48
 				}
49 49
 			}
50 50
 			if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']))) {
51 51
 				if (isset($flt['source'])) {
52
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
52
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
53 53
 				}
54 54
 			}
55 55
 		}
56 56
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
57 57
 			if ($filter['airlines'][0] != '') {
58
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
58
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
59 59
 			}
60 60
 		}
61 61
 		if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
62 62
 			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_output.flightaware_id ";
63 63
 		}
64 64
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
65
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
65
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
66 66
 			}
67 67
 		if (isset($filter['source']) && !empty($filter['source'])) {
68
-			$filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
68
+			$filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')";
69 69
 		}
70 70
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
71 71
 			$filter_query_where = " WHERE ident = '".$filter['ident']."'";
72 72
 		}
73 73
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
74 74
 			if ($filter_query_where == '') {
75
-				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
75
+				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
76 76
 			} else {
77
-				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
77
+				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
78 78
 			}
79 79
 		}
80 80
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	* @return Array the spotter information
93 93
 	*
94 94
 	*/
95
-	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
95
+	public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false)
96 96
 	{
97 97
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
98 98
 		$Image = new Image($this->db);
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 			$sth = $this->db->prepare($query.$limitQuery);
123 123
 			$sth->execute($params);
124 124
 		} catch (PDOException $e) {
125
-			printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery);
125
+			printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery);
126 126
 			exit();
127 127
 		}
128 128
 		
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 		$spotter_array = array();
133 133
 		
134 134
 
135
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
135
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
136 136
 		{
137 137
 			$num_rows++;
138 138
 			$temp_array = array();
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 			if (isset($row['route_stop'])) {
178 178
 				$temp_array['route_stop'] = $row['route_stop'];
179 179
 				if ($row['route_stop'] != '') {
180
-					$allroute = explode(' ',$row['route_stop']);
180
+					$allroute = explode(' ', $row['route_stop']);
181 181
 			
182 182
 					foreach ($allroute as $route) {
183 183
 						$route_airport_array = $this->getAllAirportInfo($route);
@@ -232,11 +232,11 @@  discard block
 block discarded – undo
232 232
 				{
233 233
 					$temp_array['date'] = "about ".$dateArray['hours']." hours ago";
234 234
 				} else {
235
-					$temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC"));
235
+					$temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC"));
236 236
 				}
237 237
 				$temp_array['date_minutes_past'] = $dateArray['minutes'];
238
-				$temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC"));
239
-				$temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC"));
238
+				$temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC"));
239
+				$temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC"));
240 240
 				$temp_array['date_unix'] = strtotime($row['date']." UTC");
241 241
 			}
242 242
 			
@@ -270,9 +270,9 @@  discard block
 block discarded – undo
270 270
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
271 271
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
272 272
 					if (is_numeric(substr($row['ident'], 2, 1))) {
273
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2),$fromsource);
273
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2), $fromsource);
274 274
 					} elseif (is_numeric(substr($row['ident'], 3, 1))) {
275
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
275
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
276 276
 					} else {
277 277
 						$airline_array = $this->getAllAirlineInfo('NA');
278 278
 					}
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 				}
310 310
 			}
311 311
 			if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') {
312
-				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'],3));
312
+				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'], 3));
313 313
 				//$acars_array = ACARS->getLiveAcarsData('BA40YL');
314 314
 				if (count($acars_array) > 0) {
315 315
 					$temp_array['acars'] = $acars_array;
@@ -326,11 +326,11 @@  discard block
 block discarded – undo
326 326
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
327 327
 			}
328 328
 
329
-			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
329
+			if ($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
330 330
 			{
331 331
 				if ($globalIVAO) {
332
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
333
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
332
+					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('', $temp_array['aircraft_type'], $temp_array['airline_icao']);
333
+					else $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type']);
334 334
 				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
335 335
 				if (count($image_array) > 0) {
336 336
 					$temp_array['image'] = $image_array[0]['image'];
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 			if (isset($row['arrival_airport_time']) && $row['arrival_airport_time'] != '') {
354 354
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
355 355
 			}
356
-			if ((!isset($globalIVAO) || ! $globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
356
+			if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
357 357
 				if ($schedules === true) {
358 358
 					$schedule_array = $Schedule->getSchedule($temp_array['ident']);
359 359
 					//print_r($schedule_array);
@@ -435,12 +435,12 @@  discard block
 block discarded – undo
435 435
 			if (isset($row['squawk'])) {
436 436
 				$temp_array['squawk'] = $row['squawk'];
437 437
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
438
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
439
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
438
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['country_iso2']);
439
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
440 440
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
441
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
442
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
443
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
441
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['over_country']);
442
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
443
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
444 444
 			}
445 445
     			
446 446
 			$temp_array['query_number_rows'] = $num_rows;
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 	* @return Array the spotter information
460 460
 	*
461 461
 	*/
462
-	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
462
+	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array())
463 463
 	{
464 464
 		global $globalTimezone, $globalDBdriver;
465 465
 		require_once(dirname(__FILE__).'/class.Translation.php');
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
 
470 470
 		$query_values = array();
471 471
 		$additional_query = '';
472
-		$filter_query = $this->getFilter($filters,true,true);
472
+		$filter_query = $this->getFilter($filters, true, true);
473 473
 		if ($q != "")
474 474
 		{
475 475
 			if (!is_string($q))
@@ -477,8 +477,8 @@  discard block
 block discarded – undo
477 477
 				return false;
478 478
 			} else {
479 479
 				$q_array = explode(" ", $q);
480
-				foreach ($q_array as $q_item){
481
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
480
+				foreach ($q_array as $q_item) {
481
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
482 482
 					$additional_query .= " AND (";
483 483
 					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
484 484
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
@@ -510,37 +510,37 @@  discard block
 block discarded – undo
510 510
 
511 511
 		if ($registration != "")
512 512
 		{
513
-			$registration = filter_var($registration,FILTER_SANITIZE_STRING);
513
+			$registration = filter_var($registration, FILTER_SANITIZE_STRING);
514 514
 			if (!is_string($registration))
515 515
 			{
516 516
 				return false;
517 517
 			} else {
518 518
 				$additional_query .= " AND spotter_output.registration = :registration";
519
-				$query_values = array_merge($query_values,array(':registration' => $registration));
519
+				$query_values = array_merge($query_values, array(':registration' => $registration));
520 520
 			}
521 521
 		}
522 522
 
523 523
 		if ($aircraft_icao != "")
524 524
 		{
525
-			$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
525
+			$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
526 526
 			if (!is_string($aircraft_icao))
527 527
 			{
528 528
 				return false;
529 529
 			} else {
530 530
 				$additional_query .= " AND spotter_output.aircraft_icao = :aircraft_icao";
531
-				$query_values = array_merge($query_values,array(':aircraft_icao' => $aircraft_icao));
531
+				$query_values = array_merge($query_values, array(':aircraft_icao' => $aircraft_icao));
532 532
 			}
533 533
 		}
534 534
 
535 535
 		if ($aircraft_manufacturer != "")
536 536
 		{
537
-			$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
537
+			$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
538 538
 			if (!is_string($aircraft_manufacturer))
539 539
 			{
540 540
 				return false;
541 541
 			} else {
542 542
 				$additional_query .= " AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer";
543
-				$query_values = array_merge($query_values,array(':aircraft_manufacturer' => $aircraft_manufacturer));
543
+				$query_values = array_merge($query_values, array(':aircraft_manufacturer' => $aircraft_manufacturer));
544 544
 			}
545 545
 		}
546 546
 
@@ -556,25 +556,25 @@  discard block
 block discarded – undo
556 556
 
557 557
 		if ($airline_icao != "")
558 558
 		{
559
-			$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
559
+			$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
560 560
 			if (!is_string($airline_icao))
561 561
 			{
562 562
 				return false;
563 563
 			} else {
564 564
 				$additional_query .= " AND spotter_output.airline_icao = :airline_icao";
565
-				$query_values = array_merge($query_values,array(':airline_icao' => $airline_icao));
565
+				$query_values = array_merge($query_values, array(':airline_icao' => $airline_icao));
566 566
 			}
567 567
 		}
568 568
 
569 569
 		if ($airline_country != "")
570 570
 		{
571
-			$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
571
+			$airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING);
572 572
 			if (!is_string($airline_country))
573 573
 			{
574 574
 				return false;
575 575
 			} else {
576 576
 				$additional_query .= " AND spotter_output.airline_country = :airline_country";
577
-				$query_values = array_merge($query_values,array(':airline_country' => $airline_country));
577
+				$query_values = array_merge($query_values, array(':airline_country' => $airline_country));
578 578
 			}
579 579
 		}
580 580
 
@@ -601,31 +601,31 @@  discard block
 block discarded – undo
601 601
 
602 602
 		if ($airport != "")
603 603
 		{
604
-			$airport = filter_var($airport,FILTER_SANITIZE_STRING);
604
+			$airport = filter_var($airport, FILTER_SANITIZE_STRING);
605 605
 			if (!is_string($airport))
606 606
 			{
607 607
 				return false;
608 608
 			} else {
609 609
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :airport OR spotter_output.arrival_airport_icao = :airport)";
610
-				$query_values = array_merge($query_values,array(':airport' => $airport));
610
+				$query_values = array_merge($query_values, array(':airport' => $airport));
611 611
 			}
612 612
 		}
613 613
 
614 614
 		if ($airport_country != "")
615 615
 		{
616
-			$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
616
+			$airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING);
617 617
 			if (!is_string($airport_country))
618 618
 			{
619 619
 				return false;
620 620
 			} else {
621 621
 				$additional_query .= " AND (spotter_output.departure_airport_country = :airport_country OR spotter_output.arrival_airport_country = :airport_country)";
622
-				$query_values = array_merge($query_values,array(':airport_country' => $airport_country));
622
+				$query_values = array_merge($query_values, array(':airport_country' => $airport_country));
623 623
 			}
624 624
 		}
625 625
     
626 626
 		if ($callsign != "")
627 627
 		{
628
-			$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
628
+			$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
629 629
 			if (!is_string($callsign))
630 630
 			{
631 631
 				return false;
@@ -633,79 +633,79 @@  discard block
 block discarded – undo
633 633
 				$translate = $Translation->ident2icao($callsign);
634 634
 				if ($translate != $callsign) {
635 635
 					$additional_query .= " AND (spotter_output.ident = :callsign OR spotter_output.ident = :translate)";
636
-					$query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate));
636
+					$query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate));
637 637
 				} else {
638 638
 					$additional_query .= " AND spotter_output.ident = :callsign";
639
-					$query_values = array_merge($query_values,array(':callsign' => $callsign));
639
+					$query_values = array_merge($query_values, array(':callsign' => $callsign));
640 640
 				}
641 641
 			}
642 642
 		}
643 643
 
644 644
 		if ($owner != "")
645 645
 		{
646
-			$owner = filter_var($owner,FILTER_SANITIZE_STRING);
646
+			$owner = filter_var($owner, FILTER_SANITIZE_STRING);
647 647
 			if (!is_string($owner))
648 648
 			{
649 649
 				return false;
650 650
 			} else {
651 651
 				$additional_query .= " AND spotter_output.owner_name = :owner";
652
-				$query_values = array_merge($query_values,array(':owner' => $owner));
652
+				$query_values = array_merge($query_values, array(':owner' => $owner));
653 653
 			}
654 654
 		}
655 655
 
656 656
 		if ($pilot_name != "")
657 657
 		{
658
-			$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
658
+			$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
659 659
 			if (!is_string($pilot_name))
660 660
 			{
661 661
 				return false;
662 662
 			} else {
663 663
 				$additional_query .= " AND spotter_output.pilot_name = :pilot_name";
664
-				$query_values = array_merge($query_values,array(':pilot_name' => $pilot_name));
664
+				$query_values = array_merge($query_values, array(':pilot_name' => $pilot_name));
665 665
 			}
666 666
 		}
667 667
 
668 668
 		if ($pilot_id != "")
669 669
 		{
670
-			$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
670
+			$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT);
671 671
 			if (!is_string($pilot_id))
672 672
 			{
673 673
 				return false;
674 674
 			} else {
675 675
 				$additional_query .= " AND spotter_output.pilot_id = :pilot_id";
676
-				$query_values = array_merge($query_values,array(':pilot_id' => $pilot_id));
676
+				$query_values = array_merge($query_values, array(':pilot_id' => $pilot_id));
677 677
 			}
678 678
 		}
679 679
 
680 680
 		if ($departure_airport_route != "")
681 681
 		{
682
-			$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
682
+			$departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING);
683 683
 			if (!is_string($departure_airport_route))
684 684
 			{
685 685
 				return false;
686 686
 			} else {
687 687
 				$additional_query .= " AND spotter_output.departure_airport_icao = :departure_airport_route";
688
-				$query_values = array_merge($query_values,array(':departure_airport_route' => $departure_airport_route));
688
+				$query_values = array_merge($query_values, array(':departure_airport_route' => $departure_airport_route));
689 689
 			}
690 690
 		}
691 691
 
692 692
 		if ($arrival_airport_route != "")
693 693
 		{
694
-			$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
694
+			$arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING);
695 695
 			if (!is_string($arrival_airport_route))
696 696
 			{
697 697
 				return false;
698 698
 			} else {
699 699
 				$additional_query .= " AND spotter_output.arrival_airport_icao = :arrival_airport_route";
700
-				$query_values = array_merge($query_values,array(':arrival_airport_route' => $arrival_airport_route));
700
+				$query_values = array_merge($query_values, array(':arrival_airport_route' => $arrival_airport_route));
701 701
 			}
702 702
 		}
703 703
 
704 704
 		if ($altitude != "")
705 705
 		{
706 706
 			$altitude_array = explode(",", $altitude);
707
-			$altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
708
-			$altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
707
+			$altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
708
+			$altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
709 709
 
710 710
 			if ($altitude_array[1] != "")
711 711
 			{                
@@ -721,8 +721,8 @@  discard block
 block discarded – undo
721 721
 		if ($date_posted != "")
722 722
 		{
723 723
 			$date_array = explode(",", $date_posted);
724
-			$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
725
-			$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
724
+			$date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
725
+			$date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
726 726
 
727 727
 			if ($globalTimezone != '') {
728 728
 				date_default_timezone_set($globalTimezone);
@@ -753,8 +753,8 @@  discard block
 block discarded – undo
753 753
 		{
754 754
 			$limit_array = explode(",", $limit);
755 755
 			
756
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
757
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
756
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
757
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
758 758
 			
759 759
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
760 760
 			{
@@ -783,23 +783,23 @@  discard block
 block discarded – undo
783 783
 
784 784
 
785 785
 		if ($origLat != "" && $origLon != "" && $dist != "") {
786
-			$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
786
+			$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
787 787
 
788 788
 			if ($globalDBdriver == 'mysql') {
789
-				$query="SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance 
789
+				$query = "SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance 
790 790
 						FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND spotter_archive.longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and spotter_archive.latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
791 791
 						AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2)))) < $dist".$orderby_query;
792 792
 			} else {
793
-				$query="SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
793
+				$query = "SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
794 794
 						FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
795 795
 						AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query.$orderby_query;
796 796
 			}
797 797
 		} else {		
798
-			$query  = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' 
798
+			$query = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' 
799 799
 					".$additional_query."
800 800
 					".$orderby_query;
801 801
 		}
802
-		$spotter_array = $this->getDataFromDB($query, $query_values,$limit_query);
802
+		$spotter_array = $this->getDataFromDB($query, $query_values, $limit_query);
803 803
 		return $spotter_array;
804 804
 	}
805 805
 	
@@ -822,8 +822,8 @@  discard block
 block discarded – undo
822 822
 		{
823 823
 			$limit_array = explode(",", $limit);
824 824
 			
825
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
826
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
825
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
826
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
827 827
 			
828 828
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
829 829
 			{
@@ -840,9 +840,9 @@  discard block
 block discarded – undo
840 840
 			$orderby_query = " ORDER BY spotter_output.date DESC";
841 841
 		}
842 842
 
843
-		$query  = $global_query.$filter_query." ".$orderby_query;
843
+		$query = $global_query.$filter_query." ".$orderby_query;
844 844
 
845
-		$spotter_array = $this->getDataFromDB($query, array(),$limit_query,true);
845
+		$spotter_array = $this->getDataFromDB($query, array(), $limit_query, true);
846 846
 
847 847
 		return $spotter_array;
848 848
 	}
@@ -888,34 +888,34 @@  discard block
 block discarded – undo
888 888
 			{
889 889
 				return false;
890 890
 			} else {
891
-				if ($interval == "30m"){
891
+				if ($interval == "30m") {
892 892
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) <= $this_output.date ';
893
-				} else if ($interval == "1h"){
893
+				} else if ($interval == "1h") {
894 894
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) <= $this_output.date ';
895
-				} else if ($interval == "3h"){
895
+				} else if ($interval == "3h") {
896 896
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 3 HOUR) <= $this_output.date ';
897
-				} else if ($interval == "6h"){
897
+				} else if ($interval == "6h") {
898 898
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 6 HOUR) <= $this_output.date ';
899
-				} else if ($interval == "12h"){
899
+				} else if ($interval == "12h") {
900 900
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 HOUR) <= $this_output.date ';
901
-				} else if ($interval == "24h"){
901
+				} else if ($interval == "24h") {
902 902
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 24 HOUR) <= $this_output.date ';
903
-				} else if ($interval == "7d"){
903
+				} else if ($interval == "7d") {
904 904
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) <= $this_output.date ';
905
-				} else if ($interval == "30d"){
905
+				} else if ($interval == "30d") {
906 906
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 DAY) <= $this_output.date ';
907 907
 				} 
908 908
 			}
909 909
 		}
910 910
 
911
-		$query  = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output 
911
+		$query = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output 
912 912
                    WHERE spotter_output.latitude <> '' 
913 913
 				   AND spotter_output.longitude <> '' 
914 914
                    ".$additional_query."
915 915
                    HAVING distance < :radius  
916 916
 				   ORDER BY distance";
917 917
 
918
-		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius),$limit_query);
918
+		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius), $limit_query);
919 919
 
920 920
 		return $spotter_array;
921 921
 	}
@@ -927,21 +927,21 @@  discard block
 block discarded – undo
927 927
 	* @return Array the spotter information
928 928
 	*
929 929
 	*/
930
-	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
930
+	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '', $filter = array())
931 931
 	{
932 932
 		global $global_query;
933 933
 		
934 934
 		date_default_timezone_set('UTC');
935 935
 
936
-		$filter_query = $this->getFilter($filter,true,true);
936
+		$filter_query = $this->getFilter($filter, true, true);
937 937
 
938 938
 		$limit_query = '';
939 939
 		if ($limit != "")
940 940
 		{
941 941
 			$limit_array = explode(",", $limit);
942 942
 			
943
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
944
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
943
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
944
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
945 945
 			
946 946
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
947 947
 			{
@@ -958,7 +958,7 @@  discard block
 block discarded – undo
958 958
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
959 959
 		}
960 960
 
961
-		$query  = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
961
+		$query = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
962 962
 
963 963
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
964 964
 
@@ -977,15 +977,15 @@  discard block
 block discarded – undo
977 977
 		global $global_query;
978 978
 		
979 979
 		date_default_timezone_set('UTC');
980
-		$filter_query = $this->getFilter($filter,true,true);
980
+		$filter_query = $this->getFilter($filter, true, true);
981 981
 
982 982
 		$limit_query = '';
983 983
 		if ($limit != "")
984 984
 		{
985 985
 			$limit_array = explode(",", $limit);
986 986
 			
987
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
988
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
987
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
988
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
989 989
 			
990 990
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
991 991
 			{
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1003 1003
 		}
1004 1004
 
1005
-		$query  = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1005
+		$query = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1006 1006
 
1007 1007
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1008 1008
 
@@ -1016,20 +1016,20 @@  discard block
 block discarded – undo
1016 1016
 	* @return Array the spotter information
1017 1017
 	*
1018 1018
 	*/
1019
-	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1019
+	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '', $filter = array())
1020 1020
 	{
1021 1021
 		global $global_query;
1022 1022
 		
1023 1023
 		date_default_timezone_set('UTC');
1024
-		$filter_query = $this->getFilter($filter,true,true);
1024
+		$filter_query = $this->getFilter($filter, true, true);
1025 1025
 		
1026 1026
 		$limit_query = '';
1027 1027
 		if ($limit != "")
1028 1028
 		{
1029 1029
 			$limit_array = explode(",", $limit);
1030 1030
 			
1031
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1032
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1031
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1032
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1033 1033
 			
1034 1034
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1035 1035
 			{
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1047 1047
 		}
1048 1048
 
1049
-		$query  = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1049
+		$query = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1050 1050
 
1051 1051
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1052 1052
 
@@ -1066,7 +1066,7 @@  discard block
 block discarded – undo
1066 1066
 		
1067 1067
 		date_default_timezone_set('UTC');
1068 1068
 		
1069
-		$filter_query = $this->getFilter($filter,true,true);
1069
+		$filter_query = $this->getFilter($filter, true, true);
1070 1070
 		
1071 1071
 		$limit_query = '';
1072 1072
 		
@@ -1074,8 +1074,8 @@  discard block
 block discarded – undo
1074 1074
 		{
1075 1075
 			$limit_array = explode(",", $limit);
1076 1076
 			
1077
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1078
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1077
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1078
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1079 1079
 			
1080 1080
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1081 1081
 			{
@@ -1092,7 +1092,7 @@  discard block
 block discarded – undo
1092 1092
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1093 1093
 		}
1094 1094
 
1095
-		$query  = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1095
+		$query = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1096 1096
 
1097 1097
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1098 1098
 
@@ -1111,14 +1111,14 @@  discard block
 block discarded – undo
1111 1111
 		global $global_query;
1112 1112
 		
1113 1113
 		date_default_timezone_set('UTC');
1114
-		$filter_query = $this->getFilter($filter,true,true);
1114
+		$filter_query = $this->getFilter($filter, true, true);
1115 1115
 		$limit_query = '';
1116 1116
 		if ($limit != "")
1117 1117
 		{
1118 1118
 			$limit_array = explode(",", $limit);
1119 1119
 			
1120
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1121
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1120
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1121
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1122 1122
 			
1123 1123
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1124 1124
 			{
@@ -1135,7 +1135,7 @@  discard block
 block discarded – undo
1135 1135
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1136 1136
 		}
1137 1137
 
1138
-		$query  = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1138
+		$query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1139 1139
 
1140 1140
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1141 1141
 
@@ -1159,9 +1159,9 @@  discard block
 block discarded – undo
1159 1159
 		$query_values = array(':id' => $id);
1160 1160
 
1161 1161
 		//$query  = $global_query." WHERE spotter_output.ident <> '' ".$additional_query." ";
1162
-		$query  = $global_query." WHERE ".$additional_query." ";
1162
+		$query = $global_query." WHERE ".$additional_query." ";
1163 1163
 
1164
-		$spotter_array = $this->getDataFromDB($query,$query_values);
1164
+		$spotter_array = $this->getDataFromDB($query, $query_values);
1165 1165
 
1166 1166
 		return $spotter_array;
1167 1167
 	}
@@ -1199,8 +1199,8 @@  discard block
 block discarded – undo
1199 1199
 		{
1200 1200
 			$limit_array = explode(",", $limit);
1201 1201
 			
1202
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1203
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1202
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1203
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1204 1204
 			
1205 1205
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1206 1206
 			{
@@ -1241,7 +1241,7 @@  discard block
 block discarded – undo
1241 1241
 		$query_values = array();
1242 1242
 		$limit_query = '';
1243 1243
 		$additional_query = '';
1244
-		$filter_query = $this->getFilter($filter,true,true);
1244
+		$filter_query = $this->getFilter($filter, true, true);
1245 1245
 		
1246 1246
 		if ($aircraft_type != "")
1247 1247
 		{
@@ -1258,8 +1258,8 @@  discard block
 block discarded – undo
1258 1258
 		{
1259 1259
 			$limit_array = explode(",", $limit);
1260 1260
 			
1261
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1262
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1261
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1262
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1263 1263
 			
1264 1264
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1265 1265
 			{
@@ -1315,8 +1315,8 @@  discard block
 block discarded – undo
1315 1315
 		{
1316 1316
 			$limit_array = explode(",", $limit);
1317 1317
 			
1318
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1319
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1318
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1319
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1320 1320
 			
1321 1321
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1322 1322
 			{
@@ -1332,7 +1332,7 @@  discard block
 block discarded – undo
1332 1332
 		} else {
1333 1333
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1334 1334
 		}
1335
-		$filter_query = $this->getFilter($filter,true,true);
1335
+		$filter_query = $this->getFilter($filter, true, true);
1336 1336
 
1337 1337
 		//$query = $global_query.$filter_query." spotter_output.ident <> '' ".$additional_query." ".$orderby_query;
1338 1338
 		$query = $global_query.$filter_query." ".$additional_query." ".$orderby_query;
@@ -1351,7 +1351,7 @@  discard block
 block discarded – undo
1351 1351
 	* @return Array the spotter information
1352 1352
 	*
1353 1353
 	*/
1354
-	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1354
+	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '', $filters = array())
1355 1355
 	{
1356 1356
 		global $global_query;
1357 1357
 		
@@ -1360,7 +1360,7 @@  discard block
 block discarded – undo
1360 1360
 		$query_values = array();
1361 1361
 		$limit_query = '';
1362 1362
 		$additional_query = '';
1363
-		$filter_query = $this->getFilter($filters,true,true);
1363
+		$filter_query = $this->getFilter($filters, true, true);
1364 1364
 		
1365 1365
 		if ($airline != "")
1366 1366
 		{
@@ -1377,8 +1377,8 @@  discard block
 block discarded – undo
1377 1377
 		{
1378 1378
 			$limit_array = explode(",", $limit);
1379 1379
 			
1380
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1381
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1380
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1381
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1382 1382
 			
1383 1383
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1384 1384
 			{
@@ -1408,7 +1408,7 @@  discard block
 block discarded – undo
1408 1408
 	* @return Array the spotter information
1409 1409
 	*
1410 1410
 	*/
1411
-	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1411
+	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array())
1412 1412
 	{
1413 1413
 		global $global_query;
1414 1414
 		
@@ -1416,7 +1416,7 @@  discard block
 block discarded – undo
1416 1416
 		$query_values = array();
1417 1417
 		$limit_query = '';
1418 1418
 		$additional_query = '';
1419
-		$filter_query = $this->getFilter($filters,true,true);
1419
+		$filter_query = $this->getFilter($filters, true, true);
1420 1420
 		
1421 1421
 		if ($airport != "")
1422 1422
 		{
@@ -1433,8 +1433,8 @@  discard block
 block discarded – undo
1433 1433
 		{
1434 1434
 			$limit_array = explode(",", $limit);
1435 1435
 			
1436
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1437
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1436
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1437
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1438 1438
 			
1439 1439
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1440 1440
 			{
@@ -1466,7 +1466,7 @@  discard block
 block discarded – undo
1466 1466
 	* @return Array the spotter information
1467 1467
 	*
1468 1468
 	*/
1469
-	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1469
+	public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array())
1470 1470
 	{
1471 1471
 		global $global_query, $globalTimezone, $globalDBdriver;
1472 1472
 		
@@ -1474,7 +1474,7 @@  discard block
 block discarded – undo
1474 1474
 		$limit_query = '';
1475 1475
 		$additional_query = '';
1476 1476
 
1477
-		$filter_query = $this->getFilter($filter,true,true);
1477
+		$filter_query = $this->getFilter($filter, true, true);
1478 1478
 		
1479 1479
 		if ($date != "")
1480 1480
 		{
@@ -1500,8 +1500,8 @@  discard block
 block discarded – undo
1500 1500
 		{
1501 1501
 			$limit_array = explode(",", $limit);
1502 1502
 			
1503
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1504
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1503
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1504
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1505 1505
 			
1506 1506
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1507 1507
 			{
@@ -1531,7 +1531,7 @@  discard block
 block discarded – undo
1531 1531
 	* @return Array the spotter information
1532 1532
 	*
1533 1533
 	*/
1534
-	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1534
+	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '', $filters = array())
1535 1535
 	{
1536 1536
 		global $global_query;
1537 1537
 		
@@ -1540,7 +1540,7 @@  discard block
 block discarded – undo
1540 1540
 		$query_values = array();
1541 1541
 		$limit_query = '';
1542 1542
 		$additional_query = '';
1543
-		$filter_query = $this->getFilter($filters,true,true);
1543
+		$filter_query = $this->getFilter($filters, true, true);
1544 1544
 		if ($country != "")
1545 1545
 		{
1546 1546
 			if (!is_string($country))
@@ -1557,8 +1557,8 @@  discard block
 block discarded – undo
1557 1557
 		{
1558 1558
 			$limit_array = explode(",", $limit);
1559 1559
 			
1560
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1561
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1560
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1561
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1562 1562
 			
1563 1563
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1564 1564
 			{
@@ -1598,7 +1598,7 @@  discard block
 block discarded – undo
1598 1598
 		$query_values = array();
1599 1599
 		$additional_query = '';
1600 1600
 		$limit_query = '';
1601
-		$filter_query = $this->getFilter($filters,true,true);
1601
+		$filter_query = $this->getFilter($filters, true, true);
1602 1602
 		
1603 1603
 		if ($aircraft_manufacturer != "")
1604 1604
 		{
@@ -1615,8 +1615,8 @@  discard block
 block discarded – undo
1615 1615
 		{
1616 1616
 			$limit_array = explode(",", $limit);
1617 1617
 			
1618
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1619
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1618
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1619
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1620 1620
 			
1621 1621
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1622 1622
 			{
@@ -1658,14 +1658,14 @@  discard block
 block discarded – undo
1658 1658
 		$query_values = array();
1659 1659
 		$additional_query = '';
1660 1660
 		$limit_query = '';
1661
-		$filter_query = $this->getFilter($filters,true,true);
1661
+		$filter_query = $this->getFilter($filters, true, true);
1662 1662
 		if ($departure_airport_icao != "")
1663 1663
 		{
1664 1664
 			if (!is_string($departure_airport_icao))
1665 1665
 			{
1666 1666
 				return false;
1667 1667
 			} else {
1668
-				$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1668
+				$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1669 1669
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)";
1670 1670
 				$query_values = array(':departure_airport_icao' => $departure_airport_icao);
1671 1671
 			}
@@ -1677,9 +1677,9 @@  discard block
 block discarded – undo
1677 1677
 			{
1678 1678
 				return false;
1679 1679
 			} else {
1680
-				$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1680
+				$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1681 1681
 				$additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)";
1682
-				$query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao));
1682
+				$query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao));
1683 1683
 			}
1684 1684
 		}
1685 1685
 		
@@ -1687,8 +1687,8 @@  discard block
 block discarded – undo
1687 1687
 		{
1688 1688
 			$limit_array = explode(",", $limit);
1689 1689
 			
1690
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1691
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1690
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1691
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1692 1692
 			
1693 1693
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1694 1694
 			{
@@ -1727,15 +1727,15 @@  discard block
 block discarded – undo
1727 1727
 		global $global_query;
1728 1728
 		
1729 1729
 		date_default_timezone_set('UTC');
1730
-		$filter_query = $this->getFilter($filter,true,true);
1730
+		$filter_query = $this->getFilter($filter, true, true);
1731 1731
 		$limit_query = '';
1732 1732
 		
1733 1733
 		if ($limit != "")
1734 1734
 		{
1735 1735
 			$limit_array = explode(",", $limit);
1736 1736
 			
1737
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1738
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1737
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1738
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1739 1739
 			
1740 1740
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1741 1741
 			{
@@ -1752,7 +1752,7 @@  discard block
 block discarded – undo
1752 1752
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1753 1753
 		}
1754 1754
 
1755
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1755
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1756 1756
 
1757 1757
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1758 1758
 
@@ -1765,19 +1765,19 @@  discard block
 block discarded – undo
1765 1765
 	* @return String the highlight text
1766 1766
 	*
1767 1767
 	*/
1768
-	public function getHighlightByRegistration($registration,$filter = array())
1768
+	public function getHighlightByRegistration($registration, $filter = array())
1769 1769
 	{
1770 1770
 		global $global_query;
1771 1771
 		
1772 1772
 		date_default_timezone_set('UTC');
1773
-		$filter_query = $this->getFilter($filter,true,true);
1774
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
1773
+		$filter_query = $this->getFilter($filter, true, true);
1774
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
1775 1775
 		
1776
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1776
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1777 1777
 		$sth = $this->db->prepare($query);
1778 1778
 		$sth->execute(array(':registration' => $registration));
1779 1779
 
1780
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1780
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1781 1781
 		{
1782 1782
 			$highlight = $row['highlight'];
1783 1783
 		}
@@ -1793,14 +1793,14 @@  discard block
 block discarded – undo
1793 1793
 	* @return String usage
1794 1794
 	*
1795 1795
 	*/
1796
-	public function getSquawkUsage($squawk = '',$country = 'FR')
1796
+	public function getSquawkUsage($squawk = '', $country = 'FR')
1797 1797
 	{
1798 1798
 		
1799
-		$squawk = filter_var($squawk,FILTER_SANITIZE_STRING);
1800
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
1799
+		$squawk = filter_var($squawk, FILTER_SANITIZE_STRING);
1800
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
1801 1801
 
1802 1802
 		$query  = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1";
1803
-		$query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country);
1803
+		$query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country);
1804 1804
 		
1805 1805
 		$sth = $this->db->prepare($query);
1806 1806
 		$sth->execute($query_values);
@@ -1822,9 +1822,9 @@  discard block
 block discarded – undo
1822 1822
 	public function getAirportIcao($airport_iata = '')
1823 1823
 	{
1824 1824
 		
1825
-		$airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING);
1825
+		$airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING);
1826 1826
 
1827
-		$query  = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1827
+		$query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1828 1828
 		$query_values = array(':airport' => $airport_iata);
1829 1829
 		
1830 1830
 		$sth = $this->db->prepare($query);
@@ -1846,12 +1846,12 @@  discard block
 block discarded – undo
1846 1846
 	* @return Float distance to the airport
1847 1847
 	*
1848 1848
 	*/
1849
-	public function getAirportDistance($airport_icao,$latitude,$longitude)
1849
+	public function getAirportDistance($airport_icao, $latitude, $longitude)
1850 1850
 	{
1851 1851
 		
1852
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
1852
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
1853 1853
 
1854
-		$query  = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
1854
+		$query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
1855 1855
 		$query_values = array(':airport' => $airport_icao);
1856 1856
 		$sth = $this->db->prepare($query);
1857 1857
 		$sth->execute($query_values);
@@ -1861,7 +1861,7 @@  discard block
 block discarded – undo
1861 1861
 			$airport_latitude = $row['latitude'];
1862 1862
 			$airport_longitude = $row['longitude'];
1863 1863
 			$Common = new Common();
1864
-			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
1864
+			return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude);
1865 1865
 		} else return '';
1866 1866
 	}
1867 1867
 	
@@ -1875,11 +1875,11 @@  discard block
 block discarded – undo
1875 1875
 	public function getAllAirportInfo($airport = '')
1876 1876
 	{
1877 1877
 		
1878
-		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
1878
+		$airport = filter_var($airport, FILTER_SANITIZE_STRING);
1879 1879
 
1880 1880
 		$query_values = array();
1881 1881
 		if ($airport == 'NA') {
1882
-			return array(array('name' => 'Not available','city' => 'N/A', 'country' => 'N/A','iata' => 'NA','icao' => 'NA','altitude' => NULL,'latitude' => 0,'longitude' => 0,'type' => 'NA','home_link' => '','wikipedia_link' => '','image_thumb' => '', 'image' => ''));
1882
+			return array(array('name' => 'Not available', 'city' => 'N/A', 'country' => 'N/A', 'iata' => 'NA', 'icao' => 'NA', 'altitude' => NULL, 'latitude' => 0, 'longitude' => 0, 'type' => 'NA', 'home_link' => '', 'wikipedia_link' => '', 'image_thumb' => '', 'image' => ''));
1883 1883
 		} elseif ($airport == '') {
1884 1884
 			$query  = "SELECT airport.name, airport.city, airport.country, airport.iata, airport.icao, airport.latitude, airport.longitude, airport.altitude, airport.type, airport.home_link, airport.wikipedia_link, airport.image_thumb, airport.image FROM airport";
1885 1885
 		} else {
@@ -1927,14 +1927,14 @@  discard block
 block discarded – undo
1927 1927
 	{
1928 1928
 		$lst_countries = '';
1929 1929
 		foreach ($countries as $country) {
1930
-			$country = filter_var($country,FILTER_SANITIZE_STRING);
1930
+			$country = filter_var($country, FILTER_SANITIZE_STRING);
1931 1931
 			if ($lst_countries == '') {
1932 1932
 				$lst_countries = "'".$country."'";
1933 1933
 			} else {
1934 1934
 				$lst_countries .= ",'".$country."'";
1935 1935
 			}
1936 1936
 		}
1937
-		$query  = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
1937
+		$query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
1938 1938
 		
1939 1939
 		$sth = $this->db->prepare($query);
1940 1940
 		$sth->execute();
@@ -1942,7 +1942,7 @@  discard block
 block discarded – undo
1942 1942
 		$airport_array = array();
1943 1943
 		$temp_array = array();
1944 1944
 		
1945
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1945
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1946 1946
 		{
1947 1947
 			$temp_array['name'] = $row['name'];
1948 1948
 			$temp_array['city'] = $row['city'];
@@ -1970,10 +1970,10 @@  discard block
 block discarded – undo
1970 1970
 	{
1971 1971
 		global $globalDBdriver;
1972 1972
 		if (is_array($coord)) {
1973
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1974
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1975
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1976
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1973
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1974
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1975
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1976
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1977 1977
 		} else return array();
1978 1978
 		if ($globalDBdriver == 'mysql') {
1979 1979
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
@@ -1985,7 +1985,7 @@  discard block
 block discarded – undo
1985 1985
     
1986 1986
 		$airport_array = array();
1987 1987
 		
1988
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1988
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1989 1989
 		{
1990 1990
 			$temp_array = $row;
1991 1991
 
@@ -2005,13 +2005,13 @@  discard block
 block discarded – undo
2005 2005
 	public function getAllWaypointsInfobyCoord($coord)
2006 2006
 	{
2007 2007
 		if (is_array($coord)) {
2008
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2009
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2010
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2011
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2008
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2009
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2010
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2011
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2012 2012
 		} else return array();
2013 2013
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2014
-		$query  = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")";
2014
+		$query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")";
2015 2015
 		//$query  = "SELECT waypoints.* FROM waypoints";
2016 2016
 		//$query  = "SELECT waypoints.* FROM waypoints INNER JOIN (SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") w ON w.name_end = waypoints.name_begin OR w.name_begin = waypoints.name_begin OR w.name_begin = waypoints.name_end OR w.name_end = waypoints.name_end";
2017 2017
 		//$query = "SELECT * FROM waypoints LEFT JOIN waypoints w ON waypoints.name_end = w.name_begin WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
@@ -2023,7 +2023,7 @@  discard block
 block discarded – undo
2023 2023
     
2024 2024
 		$waypoints_array = array();
2025 2025
 		
2026
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2026
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2027 2027
 		{
2028 2028
 			$temp_array = $row;
2029 2029
 
@@ -2045,10 +2045,10 @@  discard block
 block discarded – undo
2045 2045
 	{
2046 2046
 		global $globalUseRealAirlines;
2047 2047
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2048
-		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2048
+		$airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING));
2049 2049
 		if ($airline_icao == 'NA') {
2050 2050
 			$airline_array = array();
2051
-			$airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2051
+			$airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2052 2052
 			return $airline_array;
2053 2053
 		} else {
2054 2054
 			if (strlen($airline_icao) == 2) {
@@ -2069,7 +2069,7 @@  discard block
 block discarded – undo
2069 2069
 			if ($fromsource === NULL) {
2070 2070
 				$sth->execute(array(':airline_icao' => $airline_icao));
2071 2071
 			} else {
2072
-				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2072
+				$sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource));
2073 2073
 			}
2074 2074
                         /*
2075 2075
 			$airline_array = array();
@@ -2111,12 +2111,12 @@  discard block
 block discarded – undo
2111 2111
 	*/
2112 2112
 	public function getAllAircraftInfo($aircraft_type)
2113 2113
 	{
2114
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2114
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2115 2115
 
2116 2116
 		if ($aircraft_type == 'NA') {
2117
-			return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2117
+			return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2118 2118
 		}
2119
-		$query  = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow FROM aircraft WHERE aircraft.icao = :aircraft_type";
2119
+		$query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow FROM aircraft WHERE aircraft.icao = :aircraft_type";
2120 2120
 		
2121 2121
 		$sth = $this->db->prepare($query);
2122 2122
 		$sth->execute(array(':aircraft_type' => $aircraft_type));
@@ -2148,7 +2148,7 @@  discard block
 block discarded – undo
2148 2148
 	*/
2149 2149
 	public function getAircraftIcao($aircraft_type)
2150 2150
 	{
2151
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2151
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2152 2152
 		$all_aircraft = array('737-300' => 'B733',
2153 2153
 				'777-200' => 'B772',
2154 2154
 				'777-200ER' => 'B772',
@@ -2160,10 +2160,10 @@  discard block
 block discarded – undo
2160 2160
 				'A380' => 'A388');
2161 2161
 		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2162 2162
 
2163
-		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2163
+		$query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2164 2164
 		$aircraft_type = strtoupper($aircraft_type);
2165 2165
 		$sth = $this->db->prepare($query);
2166
-		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2166
+		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,));
2167 2167
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2168 2168
 		if (isset($result[0]['icao'])) return $result[0]['icao'];
2169 2169
 		else return '';
@@ -2178,9 +2178,9 @@  discard block
 block discarded – undo
2178 2178
 	*/
2179 2179
 	public function getAllAircraftType($aircraft_modes)
2180 2180
 	{
2181
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
2181
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
2182 2182
 
2183
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
2183
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
2184 2184
 		
2185 2185
 		$sth = $this->db->prepare($query);
2186 2186
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -2201,8 +2201,8 @@  discard block
 block discarded – undo
2201 2201
 	*/
2202 2202
 	public function getOperator($operator)
2203 2203
 	{
2204
-		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
2205
-		$query  = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2204
+		$operator = filter_var($operator, FILTER_SANITIZE_STRING);
2205
+		$query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2206 2206
 		
2207 2207
 		$sth = $this->db->prepare($query);
2208 2208
 		$sth->execute(array(':operator' => $operator));
@@ -2223,9 +2223,9 @@  discard block
 block discarded – undo
2223 2223
 	*/
2224 2224
 	public function getRouteInfo($callsign)
2225 2225
 	{
2226
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2226
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
2227 2227
                 if ($callsign == '') return array();
2228
-		$query  = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2228
+		$query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2229 2229
 		
2230 2230
 		$sth = $this->db->prepare($query);
2231 2231
 		$sth->execute(array(':callsign' => $callsign));
@@ -2246,9 +2246,9 @@  discard block
 block discarded – undo
2246 2246
 	*/
2247 2247
 	public function getAircraftInfoByRegistration($registration)
2248 2248
 	{
2249
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2249
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2250 2250
 
2251
-		$query  = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration";
2251
+		$query = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration";
2252 2252
 		
2253 2253
 		$sth = $this->db->prepare($query);
2254 2254
 		$sth->execute(array(':registration' => $registration));
@@ -2256,7 +2256,7 @@  discard block
 block discarded – undo
2256 2256
 		$aircraft_array = array();
2257 2257
 		$temp_array = array();
2258 2258
 		
2259
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2259
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2260 2260
 		{
2261 2261
 			$temp_array['airline_icao'] = $row['airline_icao'];
2262 2262
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -2278,7 +2278,7 @@  discard block
 block discarded – undo
2278 2278
 	*/
2279 2279
 	public function getAircraftOwnerByRegistration($registration)
2280 2280
 	{
2281
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2281
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2282 2282
 		$Connection = new Connection($this->db);
2283 2283
 		if ($Connection->tableExists('aircraft_owner')) {
2284 2284
 			$query  = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1";
@@ -2300,7 +2300,7 @@  discard block
 block discarded – undo
2300 2300
 	public function getAllFlightsforSitemap()
2301 2301
 	{
2302 2302
 		//$query  = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT ";
2303
-		$query  = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2303
+		$query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2304 2304
 		
2305 2305
 		$sth = $this->db->prepare($query);
2306 2306
 		$sth->execute();
@@ -2347,7 +2347,7 @@  discard block
 block discarded – undo
2347 2347
 		$manufacturer_array = array();
2348 2348
 		$temp_array = array();
2349 2349
 		
2350
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2350
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2351 2351
 		{
2352 2352
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
2353 2353
 
@@ -2373,7 +2373,7 @@  discard block
 block discarded – undo
2373 2373
 								ORDER BY spotter_output.aircraft_name ASC";
2374 2374
 								
2375 2375
 		*/
2376
-		$filter_query = $this->getFilter($filters,true,true);
2376
+		$filter_query = $this->getFilter($filters, true, true);
2377 2377
 		$query = "SELECT DISTINCT icao AS aircraft_icao, type AS aircraft_name, manufacturer AS aircraft_manufacturer FROM aircraft".$filter_query." icao <> '' ORDER BY aircraft_manufacturer ASC";
2378 2378
 		
2379 2379
 		$sth = $this->db->prepare($query);
@@ -2382,7 +2382,7 @@  discard block
 block discarded – undo
2382 2382
 		$aircraft_array = array();
2383 2383
 		$temp_array = array();
2384 2384
 		
2385
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2385
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2386 2386
 		{
2387 2387
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
2388 2388
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
@@ -2403,8 +2403,8 @@  discard block
 block discarded – undo
2403 2403
 	*/
2404 2404
 	public function getAllAircraftRegistrations($filters = array())
2405 2405
 	{
2406
-		$filter_query = $this->getFilter($filters,true,true);
2407
-		$query  = "SELECT DISTINCT spotter_output.registration 
2406
+		$filter_query = $this->getFilter($filters, true, true);
2407
+		$query = "SELECT DISTINCT spotter_output.registration 
2408 2408
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' 
2409 2409
 				ORDER BY spotter_output.registration ASC";
2410 2410
 
@@ -2414,7 +2414,7 @@  discard block
 block discarded – undo
2414 2414
 		$aircraft_array = array();
2415 2415
 		$temp_array = array();
2416 2416
 		
2417
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2417
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2418 2418
 		{
2419 2419
 			$temp_array['registration'] = $row['registration'];
2420 2420
 
@@ -2431,11 +2431,11 @@  discard block
 block discarded – undo
2431 2431
 	* @return Array list of source name
2432 2432
 	*
2433 2433
 	*/
2434
-	public function getAllSourceName($type = '',$filters = array())
2434
+	public function getAllSourceName($type = '', $filters = array())
2435 2435
 	{
2436
-		$filter_query = $this->getFilter($filters,true,true);
2436
+		$filter_query = $this->getFilter($filters, true, true);
2437 2437
 		$query_values = array();
2438
-		$query  = "SELECT DISTINCT spotter_output.source_name 
2438
+		$query = "SELECT DISTINCT spotter_output.source_name 
2439 2439
 				FROM spotter_output".$filter_query." spotter_output.source_name <> ''";
2440 2440
 		if ($type != '') {
2441 2441
 			$query_values = array(':type' => $type);
@@ -2450,7 +2450,7 @@  discard block
 block discarded – undo
2450 2450
 		$source_array = array();
2451 2451
 		$temp_array = array();
2452 2452
 		
2453
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2453
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2454 2454
 		{
2455 2455
 			$temp_array['source_name'] = $row['source_name'];
2456 2456
 			$source_array[] = $temp_array;
@@ -2466,11 +2466,11 @@  discard block
 block discarded – undo
2466 2466
 	* @return Array list of airline names
2467 2467
 	*
2468 2468
 	*/
2469
-	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2469
+	public function getAllAirlineNames($airline_type = '', $forsource = NULL, $filters = array())
2470 2470
 	{
2471
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2472
-		$filter_query = $this->getFilter($filters,true,true);
2473
-		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
2471
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2472
+		$filter_query = $this->getFilter($filters, true, true);
2473
+		$airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
2474 2474
 		if ($airline_type == '' || $airline_type == 'all') {
2475 2475
 			/*
2476 2476
 			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
@@ -2489,7 +2489,7 @@  discard block
 block discarded – undo
2489 2489
 				$query_data = array(':forsource' => $forsource);
2490 2490
 			}
2491 2491
 		} else {
2492
-			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2492
+			$query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2493 2493
 					FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
2494 2494
 					AND spotter_output.airline_type = :airline_type 
2495 2495
 					ORDER BY spotter_output.airline_icao ASC";
@@ -2502,7 +2502,7 @@  discard block
 block discarded – undo
2502 2502
 		$airline_array = array();
2503 2503
 		$temp_array = array();
2504 2504
 		
2505
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2505
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2506 2506
 		{
2507 2507
 			$temp_array['airline_icao'] = $row['airline_icao'];
2508 2508
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -2522,8 +2522,8 @@  discard block
 block discarded – undo
2522 2522
 	*/
2523 2523
 	public function getAllAirlineCountries($filters = array())
2524 2524
 	{
2525
-		$filter_query = $this->getFilter($filters,true,true);
2526
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2525
+		$filter_query = $this->getFilter($filters, true, true);
2526
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2527 2527
 				FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2528 2528
 				ORDER BY spotter_output.airline_country ASC";
2529 2529
 		
@@ -2534,7 +2534,7 @@  discard block
 block discarded – undo
2534 2534
 		$airline_array = array();
2535 2535
 		$temp_array = array();
2536 2536
 		
2537
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2537
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2538 2538
 		{
2539 2539
 			$temp_array['airline_country'] = $row['airline_country'];
2540 2540
 
@@ -2554,9 +2554,9 @@  discard block
 block discarded – undo
2554 2554
 	*/
2555 2555
 	public function getAllAirportNames($filters = array())
2556 2556
 	{
2557
-		$filter_query = $this->getFilter($filters,true,true);
2557
+		$filter_query = $this->getFilter($filters, true, true);
2558 2558
 		$airport_array = array();
2559
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country
2559
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country
2560 2560
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' 
2561 2561
 				ORDER BY spotter_output.departure_airport_city ASC";
2562 2562
 		
@@ -2565,7 +2565,7 @@  discard block
 block discarded – undo
2565 2565
 		$sth->execute();
2566 2566
 
2567 2567
 		$temp_array = array();
2568
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2568
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2569 2569
 		{
2570 2570
 			$temp_array['airport_icao'] = $row['airport_icao'];
2571 2571
 			$temp_array['airport_name'] = $row['airport_name'];
@@ -2575,14 +2575,14 @@  discard block
 block discarded – undo
2575 2575
 			$airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array;
2576 2576
 		}
2577 2577
 
2578
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country
2578
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country
2579 2579
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' 
2580 2580
 								ORDER BY spotter_output.arrival_airport_city ASC";
2581 2581
 					
2582 2582
 		$sth = $this->db->prepare($query);
2583 2583
 		$sth->execute();
2584 2584
 
2585
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2585
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2586 2586
 			{
2587 2587
 		//	if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao'])
2588 2588
 		//	{
@@ -2622,21 +2622,21 @@  discard block
 block discarded – undo
2622 2622
    
2623 2623
 		$temp_array = array();
2624 2624
 		
2625
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2625
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2626 2626
 		{
2627 2627
 			$temp_array['airport_country'] = $row['airport_country'];
2628 2628
 
2629 2629
 			$airport_array[$row['airport_country']] = $temp_array;
2630 2630
 		}
2631
-		$filter_query = $this->getFilter($filters,true,true);
2632
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2631
+		$filter_query = $this->getFilter($filters, true, true);
2632
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2633 2633
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2634 2634
 								ORDER BY spotter_output.arrival_airport_country ASC";
2635 2635
 					
2636 2636
 		$sth = $this->db->prepare($query);
2637 2637
 		$sth->execute();
2638 2638
 		
2639
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2639
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2640 2640
 		{
2641 2641
 			if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country'])
2642 2642
 			{
@@ -2659,9 +2659,9 @@  discard block
 block discarded – undo
2659 2659
 	*/
2660 2660
 	public function getAllCountries($filters = array())
2661 2661
 	{
2662
-		$Connection= new Connection($this->db);
2662
+		$Connection = new Connection($this->db);
2663 2663
 		if ($Connection->tableExists('countries')) {
2664
-			$query  = "SELECT countries.name AS airport_country
2664
+			$query = "SELECT countries.name AS airport_country
2665 2665
 				FROM countries
2666 2666
 				ORDER BY countries.name ASC";
2667 2667
 			$sth = $this->db->prepare($query);
@@ -2670,14 +2670,14 @@  discard block
 block discarded – undo
2670 2670
 			$temp_array = array();
2671 2671
 			$country_array = array();
2672 2672
 		
2673
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2673
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2674 2674
 			{
2675 2675
 				$temp_array['country'] = $row['airport_country'];
2676 2676
 				$country_array[$row['airport_country']] = $temp_array;
2677 2677
 			}
2678 2678
 		} else {
2679
-			$filter_query = $this->getFilter($filters,true,true);
2680
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2679
+			$filter_query = $this->getFilter($filters, true, true);
2680
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2681 2681
 								FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' 
2682 2682
 								ORDER BY spotter_output.departure_airport_country ASC";
2683 2683
 
@@ -2686,20 +2686,20 @@  discard block
 block discarded – undo
2686 2686
    
2687 2687
 			$temp_array = array();
2688 2688
 			$country_array = array();
2689
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2689
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2690 2690
 			{
2691 2691
 				$temp_array['country'] = $row['airport_country'];
2692 2692
 				$country_array[$row['airport_country']] = $temp_array;
2693 2693
 			}
2694 2694
 
2695
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2695
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2696 2696
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2697 2697
 								ORDER BY spotter_output.arrival_airport_country ASC";
2698 2698
 					
2699 2699
 		$sth = $this->db->prepare($query);
2700 2700
 		$sth->execute();
2701 2701
 		
2702
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2702
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2703 2703
 		{
2704 2704
 			if ($country_array[$row['airport_country']]['country'] != $row['airport_country'])
2705 2705
 			{
@@ -2709,14 +2709,14 @@  discard block
 block discarded – undo
2709 2709
 			}
2710 2710
 		}
2711 2711
 		
2712
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2712
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2713 2713
 								FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2714 2714
 								ORDER BY spotter_output.airline_country ASC";
2715 2715
 					
2716 2716
 		$sth = $this->db->prepare($query);
2717 2717
 		$sth->execute();
2718 2718
 		
2719
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2719
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2720 2720
 		{
2721 2721
 			if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country'])
2722 2722
 			{
@@ -2740,8 +2740,8 @@  discard block
 block discarded – undo
2740 2740
 	*/
2741 2741
 	public function getAllIdents($filters = array())
2742 2742
 	{
2743
-		$filter_query = $this->getFilter($filters,true,true);
2744
-		$query  = "SELECT DISTINCT spotter_output.ident
2743
+		$filter_query = $this->getFilter($filters, true, true);
2744
+		$query = "SELECT DISTINCT spotter_output.ident
2745 2745
 								FROM spotter_output".$filter_query." spotter_output.ident <> '' 
2746 2746
 								ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0";
2747 2747
 
@@ -2751,7 +2751,7 @@  discard block
 block discarded – undo
2751 2751
 		$ident_array = array();
2752 2752
 		$temp_array = array();
2753 2753
 		
2754
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2754
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2755 2755
 		{
2756 2756
 			$temp_array['ident'] = $row['ident'];
2757 2757
 			$ident_array[] = $temp_array;
@@ -2765,9 +2765,9 @@  discard block
 block discarded – undo
2765 2765
 	* @return Array number, icao, name and city of airports
2766 2766
 	*/
2767 2767
 
2768
-	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
2768
+	public function getLast7DaysAirportsDeparture($airport_icao = '', $filters = array()) {
2769 2769
 		global $globalTimezone, $globalDBdriver;
2770
-		$filter_query = $this->getFilter($filters,true,true);
2770
+		$filter_query = $this->getFilter($filters, true, true);
2771 2771
 		if ($globalTimezone != '') {
2772 2772
 			date_default_timezone_set($globalTimezone);
2773 2773
 			$datetime = new DateTime();
@@ -2832,7 +2832,7 @@  discard block
 block discarded – undo
2832 2832
 
2833 2833
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
2834 2834
 		global $globalTimezone, $globalDBdriver;
2835
-		$filter_query = $this->getFilter($filters,true,true);
2835
+		$filter_query = $this->getFilter($filters, true, true);
2836 2836
 		if ($globalTimezone != '') {
2837 2837
 			date_default_timezone_set($globalTimezone);
2838 2838
 			$datetime = new DateTime();
@@ -2916,7 +2916,7 @@  discard block
 block discarded – undo
2916 2916
 
2917 2917
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
2918 2918
 		global $globalTimezone, $globalDBdriver;
2919
-		$filter_query = $this->getFilter($filters,true,true);
2919
+		$filter_query = $this->getFilter($filters, true, true);
2920 2920
 		if ($globalTimezone != '') {
2921 2921
 			date_default_timezone_set($globalTimezone);
2922 2922
 			$datetime = new DateTime();
@@ -2949,9 +2949,9 @@  discard block
 block discarded – undo
2949 2949
 	* @return Array number, icao, name and city of airports
2950 2950
 	*/
2951 2951
 
2952
-	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
2952
+	public function getLast7DaysDetectedAirportsArrival($airport_icao = '', $filters = array()) {
2953 2953
 		global $globalTimezone, $globalDBdriver;
2954
-		$filter_query = $this->getFilter($filters,true,true);
2954
+		$filter_query = $this->getFilter($filters, true, true);
2955 2955
 		if ($globalTimezone != '') {
2956 2956
 			date_default_timezone_set($globalTimezone);
2957 2957
 			$datetime = new DateTime();
@@ -3083,12 +3083,12 @@  discard block
 block discarded – undo
3083 3083
 		} else $offset = '+00:00';
3084 3084
 
3085 3085
 		if ($globalDBdriver == 'mysql') {
3086
-			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3086
+			$query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3087 3087
 								FROM spotter_output
3088 3088
 								WHERE spotter_output.date <> '' 
3089 3089
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
3090 3090
 		} else {
3091
-			$query  = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3091
+			$query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3092 3092
 								FROM spotter_output
3093 3093
 								WHERE spotter_output.date <> '' 
3094 3094
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
@@ -3100,7 +3100,7 @@  discard block
 block discarded – undo
3100 3100
 		$date_array = array();
3101 3101
 		$temp_array = array();
3102 3102
 		
3103
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3103
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3104 3104
 		{
3105 3105
 			$temp_array['date'] = $row['date'];
3106 3106
 
@@ -3120,7 +3120,7 @@  discard block
 block discarded – undo
3120 3120
 	*/
3121 3121
 	public function getAllRoutes()
3122 3122
 	{
3123
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route,  spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao 
3123
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route,  spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao 
3124 3124
 				FROM spotter_output
3125 3125
 				WHERE spotter_output.ident <> '' 
3126 3126
 				GROUP BY route
@@ -3131,7 +3131,7 @@  discard block
 block discarded – undo
3131 3131
 
3132 3132
 		$routes_array = array();
3133 3133
 		$temp_array = array();
3134
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3134
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3135 3135
 		{
3136 3136
 			$temp_array['route'] = $row['route'];
3137 3137
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -3150,21 +3150,21 @@  discard block
 block discarded – undo
3150 3150
 	* @return String success or false
3151 3151
 	*
3152 3152
 	*/	
3153
-	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3153
+	public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL)
3154 3154
 	{
3155 3155
 		if (!is_numeric(substr($ident, 0, 3)))
3156 3156
 		{
3157 3157
 			if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3158
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3158
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3159 3159
 			} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3160
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3160
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3161 3161
 			} else {
3162 3162
 				$airline_array = $this->getAllAirlineInfo("NA");
3163 3163
 			}
3164 3164
 			if (count($airline_array) == 0) {
3165 3165
 				$airline_array = $this->getAllAirlineInfo("NA");
3166 3166
 			}
3167
-			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3167
+			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3168 3168
 				$airline_array = $this->getAllAirlineInfo("NA");
3169 3169
 			}
3170 3170
 		} else {
@@ -3177,7 +3177,7 @@  discard block
 block discarded – undo
3177 3177
 
3178 3178
 
3179 3179
 		$query = 'UPDATE spotter_output SET ident = :ident, airline_name = :airline_name, airline_icao = :airline_icao, airline_country = :airline_country, airline_type = :airline_type WHERE flightaware_id = :flightaware_id';
3180
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type);
3180
+                $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type);
3181 3181
 
3182 3182
 		try {
3183 3183
 			$sth = $this->db->prepare($query);
@@ -3198,11 +3198,11 @@  discard block
 block discarded – undo
3198 3198
 	* @return String success or false
3199 3199
 	*
3200 3200
 	*/	
3201
-	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3201
+	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '')
3202 3202
 	{
3203 3203
 		if ($groundspeed == '') $groundspeed = NULL;
3204 3204
 		$query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id';
3205
-                $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3205
+                $query_values = array(':flightaware_id' => $flightaware_id, ':real_arrival_airport_icao' => $arrival_airport_icao, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_altitude' => $altitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3206 3206
 
3207 3207
 		try {
3208 3208
 			$sth = $this->db->prepare($query);
@@ -3242,7 +3242,7 @@  discard block
 block discarded – undo
3242 3242
 	* @param String $verticalrate vertival rate of flight
3243 3243
 	* @return String success or false
3244 3244
 	*/
3245
-	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '',$squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '')
3245
+	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false, $format_source = '', $source_name = '')
3246 3246
 	{
3247 3247
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
3248 3248
 		
@@ -3266,13 +3266,13 @@  discard block
 block discarded – undo
3266 3266
 				if ($ModeS != '') {
3267 3267
 					$timeelapsed = microtime(true);
3268 3268
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3269
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3269
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3270 3270
 				} else {
3271
-					$myhex = explode('-',$flightaware_id);
3271
+					$myhex = explode('-', $flightaware_id);
3272 3272
 					if (count($myhex) > 0) {
3273 3273
 						$timeelapsed = microtime(true);
3274 3274
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3275
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3275
+						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3276 3276
 					}
3277 3277
 				}
3278 3278
 			}
@@ -3294,24 +3294,24 @@  discard block
 block discarded – undo
3294 3294
 				{
3295 3295
 					$timeelapsed = microtime(true);
3296 3296
 					if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3297
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3297
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3298 3298
 					} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3299
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3299
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3300 3300
 					} else {
3301 3301
 						$airline_array = $this->getAllAirlineInfo("NA");
3302 3302
 					}
3303 3303
 					if (count($airline_array) == 0) {
3304 3304
 						$airline_array = $this->getAllAirlineInfo("NA");
3305 3305
 					}
3306
-					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3306
+					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3307 3307
 						$airline_array = $this->getAllAirlineInfo("NA");
3308 3308
 					}
3309
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3309
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3310 3310
 
3311 3311
 				} else {
3312 3312
 					$timeelapsed = microtime(true);
3313 3313
 					$airline_array = $this->getAllAirlineInfo("NA");
3314
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3314
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3315 3315
 				}
3316 3316
 			}
3317 3317
 		} else $airline_array = array();
@@ -3328,27 +3328,27 @@  discard block
 block discarded – undo
3328 3328
 				{
3329 3329
 					$timeelapsed = microtime(true);
3330 3330
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3331
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3331
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3332 3332
 				} else {
3333 3333
 					$timeelapsed = microtime(true);
3334 3334
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3335
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3335
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3336 3336
 				}
3337 3337
 			}
3338 3338
 		} else {
3339 3339
 			if ($ModeS != '') {
3340 3340
 				$timeelapsed = microtime(true);
3341 3341
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3342
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3342
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3343 3343
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3344 3344
 				{
3345 3345
 					$timeelapsed = microtime(true);
3346 3346
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3347
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3347
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3348 3348
 				} else {
3349 3349
 					$timeelapsed = microtime(true);
3350 3350
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3351
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3351
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3352 3352
 				}
3353 3353
 			}
3354 3354
 		}
@@ -3363,7 +3363,7 @@  discard block
 block discarded – undo
3363 3363
 			} else {
3364 3364
 				$timeelapsed = microtime(true);
3365 3365
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3366
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3366
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3367 3367
 			}
3368 3368
 		}
3369 3369
 		
@@ -3377,7 +3377,7 @@  discard block
 block discarded – undo
3377 3377
 			} else {
3378 3378
 				$timeelapsed = microtime(true);
3379 3379
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3380
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3380
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3381 3381
 			}
3382 3382
 		}
3383 3383
 
@@ -3441,7 +3441,7 @@  discard block
 block discarded – undo
3441 3441
 		{
3442 3442
 			$timeelapsed = microtime(true);
3443 3443
 			$image_array = $Image->getSpotterImage($registration);
3444
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3444
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3445 3445
 			if (!isset($image_array[0]['registration']))
3446 3446
 			{
3447 3447
 				//echo "Add image !!!! \n";
@@ -3449,7 +3449,7 @@  discard block
 block discarded – undo
3449 3449
 			}
3450 3450
 			$timeelapsed = microtime(true);
3451 3451
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3452
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3452
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3453 3453
 			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3454 3454
 		}
3455 3455
     
@@ -3457,33 +3457,33 @@  discard block
 block discarded – undo
3457 3457
 		{
3458 3458
             		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3459 3459
             		else $airline_icao = '';
3460
-			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3460
+			$image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao);
3461 3461
 			if (!isset($image_array[0]['registration']))
3462 3462
 			{
3463 3463
 				//echo "Add image !!!! \n";
3464
-				$Image->addSpotterImage('',$aircraft_icao,$airline_icao);
3464
+				$Image->addSpotterImage('', $aircraft_icao, $airline_icao);
3465 3465
 			}
3466 3466
 		}
3467 3467
     
3468
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
3469
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
3470
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
3471
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3472
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
3473
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
3474
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3475
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3476
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
3477
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3478
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
3479
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3480
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
3481
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
3482
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
3483
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
3484
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
3485
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
3486
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
3468
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
3469
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
3470
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
3471
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3472
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
3473
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
3474
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3475
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3476
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
3477
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3478
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
3479
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3480
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
3481
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
3482
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
3483
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
3484
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
3485
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
3486
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
3487 3487
 	
3488 3488
 		if (count($airline_array) == 0) 
3489 3489
 		{
@@ -3511,7 +3511,7 @@  discard block
 block discarded – undo
3511 3511
                 if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3512 3512
                 if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3513 3513
                 if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3514
-                $query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3514
+                $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3515 3515
                 VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)";
3516 3516
 
3517 3517
                 $airline_name = $airline_array[0]['name'];
@@ -3521,7 +3521,7 @@  discard block
 block discarded – undo
3521 3521
 		if ($airline_type == '') {
3522 3522
 			$timeelapsed = microtime(true);
3523 3523
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3524
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3524
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3525 3525
 		}
3526 3526
 		if ($airline_type == null) $airline_type = '';
3527 3527
                 $aircraft_type = $aircraft_array[0]['type'];
@@ -3532,7 +3532,7 @@  discard block
 block discarded – undo
3532 3532
                 $arrival_airport_name = $arrival_airport_array[0]['name'];
3533 3533
                 $arrival_airport_city = $arrival_airport_array[0]['city'];
3534 3534
                 $arrival_airport_country = $arrival_airport_array[0]['country'];
3535
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3535
+                $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3536 3536
 
3537 3537
 		try {
3538 3538
 		        
@@ -3558,13 +3558,13 @@  discard block
 block discarded – undo
3558 3558
 	{
3559 3559
 		global $globalDBdriver, $globalTimezone;
3560 3560
 		if ($globalDBdriver == 'mysql') {
3561
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3561
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3562 3562
 								WHERE spotter_output.ident = :ident 
3563 3563
 								AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
3564 3564
 								AND spotter_output.date < UTC_TIMESTAMP()";
3565 3565
 			$query_data = array(':ident' => $ident);
3566 3566
 		} else {
3567
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3567
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3568 3568
 								WHERE spotter_output.ident = :ident 
3569 3569
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3570 3570
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
@@ -3573,8 +3573,8 @@  discard block
 block discarded – undo
3573 3573
 		
3574 3574
 		$sth = $this->db->prepare($query);
3575 3575
 		$sth->execute($query_data);
3576
-    		$ident_result='';
3577
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3576
+    		$ident_result = '';
3577
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3578 3578
 		{
3579 3579
 			$ident_result = $row['ident'];
3580 3580
 		}
@@ -3600,8 +3600,8 @@  discard block
 block discarded – undo
3600 3600
 				return false;
3601 3601
 			} else {
3602 3602
 				$q_array = explode(" ", $q);
3603
-				foreach ($q_array as $q_item){
3604
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
3603
+				foreach ($q_array as $q_item) {
3604
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
3605 3605
 					$additional_query .= " AND (";
3606 3606
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
3607 3607
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
@@ -3616,11 +3616,11 @@  discard block
 block discarded – undo
3616 3616
 			}
3617 3617
 		}
3618 3618
 		if ($globalDBdriver == 'mysql') {
3619
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3619
+			$query = "SELECT spotter_output.* FROM spotter_output 
3620 3620
 				WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
3621 3621
 				AND spotter_output.date < UTC_TIMESTAMP()";
3622 3622
 		} else {
3623
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3623
+			$query = "SELECT spotter_output.* FROM spotter_output 
3624 3624
 				WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
3625 3625
 				AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
3626 3626
 		}
@@ -3637,11 +3637,11 @@  discard block
 block discarded – undo
3637 3637
 	* @return Array the airline list
3638 3638
 	*
3639 3639
 	*/
3640
-	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3640
+	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3641 3641
 	{
3642 3642
 		global $globalDBdriver;
3643
-		$filter_query = $this->getFilter($filters,true,true);
3644
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3643
+		$filter_query = $this->getFilter($filters, true, true);
3644
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3645 3645
 		 			FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA' ";
3646 3646
 		if ($olderthanmonths > 0) {
3647 3647
 			if ($globalDBdriver == 'mysql') {
@@ -3665,7 +3665,7 @@  discard block
 block discarded – undo
3665 3665
  
3666 3666
 		$airline_array = array();
3667 3667
 		$temp_array = array();
3668
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3668
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3669 3669
 		{
3670 3670
 			$temp_array['airline_name'] = $row['airline_name'];
3671 3671
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3682,11 +3682,11 @@  discard block
 block discarded – undo
3682 3682
 	* @return Array the pilots list
3683 3683
 	*
3684 3684
 	*/
3685
-	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3685
+	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3686 3686
 	{
3687 3687
 		global $globalDBdriver;
3688
-		$filter_query = $this->getFilter($filters,true,true);
3689
-		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3688
+		$filter_query = $this->getFilter($filters, true, true);
3689
+		$query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3690 3690
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3691 3691
                 if ($olderthanmonths > 0) {
3692 3692
             		if ($globalDBdriver == 'mysql') {
@@ -3712,7 +3712,7 @@  discard block
 block discarded – undo
3712 3712
 		$airline_array = array();
3713 3713
 		$temp_array = array();
3714 3714
         
3715
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3715
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3716 3716
 		{
3717 3717
 			$temp_array['pilot_name'] = $row['pilot_name'];
3718 3718
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -3732,7 +3732,7 @@  discard block
 block discarded – undo
3732 3732
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3733 3733
 	{
3734 3734
 		global $globalDBdriver;
3735
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3735
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3736 3736
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
3737 3737
                 if ($olderthanmonths > 0) {
3738 3738
             		if ($globalDBdriver == 'mysql') {
@@ -3758,7 +3758,7 @@  discard block
 block discarded – undo
3758 3758
 		$airline_array = array();
3759 3759
 		$temp_array = array();
3760 3760
         
3761
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3761
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3762 3762
 		{
3763 3763
 			$temp_array['pilot_name'] = $row['pilot_name'];
3764 3764
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -3776,11 +3776,11 @@  discard block
 block discarded – undo
3776 3776
 	* @return Array the pilots list
3777 3777
 	*
3778 3778
 	*/
3779
-	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3779
+	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3780 3780
 	{
3781 3781
 		global $globalDBdriver;
3782
-		$filter_query = $this->getFilter($filters,true,true);
3783
-		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3782
+		$filter_query = $this->getFilter($filters, true, true);
3783
+		$query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3784 3784
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3785 3785
                 if ($olderthanmonths > 0) {
3786 3786
             		if ($globalDBdriver == 'mysql') {
@@ -3806,7 +3806,7 @@  discard block
 block discarded – undo
3806 3806
 		$airline_array = array();
3807 3807
 		$temp_array = array();
3808 3808
         
3809
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3809
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3810 3810
 		{
3811 3811
 			$temp_array['owner_name'] = $row['owner_name'];
3812 3812
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -3821,11 +3821,11 @@  discard block
 block discarded – undo
3821 3821
 	* @return Array the pilots list
3822 3822
 	*
3823 3823
 	*/
3824
-	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3824
+	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3825 3825
 	{
3826 3826
 		global $globalDBdriver;
3827
-		$filter_query = $this->getFilter($filters,true,true);
3828
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3827
+		$filter_query = $this->getFilter($filters, true, true);
3828
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3829 3829
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3830 3830
                 if ($olderthanmonths > 0) {
3831 3831
             		if ($globalDBdriver == 'mysql') {
@@ -3851,7 +3851,7 @@  discard block
 block discarded – undo
3851 3851
 		$airline_array = array();
3852 3852
 		$temp_array = array();
3853 3853
         
3854
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3854
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3855 3855
 		{
3856 3856
 			$temp_array['owner_name'] = $row['owner_name'];
3857 3857
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -3867,11 +3867,11 @@  discard block
 block discarded – undo
3867 3867
 	* @return Array the airline list
3868 3868
 	*
3869 3869
 	*/
3870
-	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
3870
+	public function countAllAirlinesByAircraft($aircraft_icao, $filters = array())
3871 3871
 	{
3872
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3873
-		$filter_query = $this->getFilter($filters,true,true);
3874
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3872
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3873
+		$filter_query = $this->getFilter($filters, true, true);
3874
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3875 3875
 		 	    FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
3876 3876
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
3877 3877
 			    ORDER BY airline_count DESC";
@@ -3883,7 +3883,7 @@  discard block
 block discarded – undo
3883 3883
 		$airline_array = array();
3884 3884
 		$temp_array = array();
3885 3885
         
3886
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3886
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3887 3887
 		{
3888 3888
 			$temp_array['airline_name'] = $row['airline_name'];
3889 3889
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3903,11 +3903,11 @@  discard block
 block discarded – undo
3903 3903
 	* @return Array the airline country list
3904 3904
 	*
3905 3905
 	*/
3906
-	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
3906
+	public function countAllAirlineCountriesByAircraft($aircraft_icao, $filters = array())
3907 3907
 	{
3908
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3909
-		$filter_query = $this->getFilter($filters,true,true);
3910
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3908
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3909
+		$filter_query = $this->getFilter($filters, true, true);
3910
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3911 3911
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
3912 3912
                     GROUP BY spotter_output.airline_country
3913 3913
 					ORDER BY airline_country_count DESC
@@ -3920,7 +3920,7 @@  discard block
 block discarded – undo
3920 3920
 		$airline_country_array = array();
3921 3921
 		$temp_array = array();
3922 3922
         
3923
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3923
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3924 3924
 		{
3925 3925
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
3926 3926
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -3939,11 +3939,11 @@  discard block
 block discarded – undo
3939 3939
 	* @return Array the airline list
3940 3940
 	*
3941 3941
 	*/
3942
-	public function countAllAirlinesByAirport($airport_icao,$filters = array())
3942
+	public function countAllAirlinesByAirport($airport_icao, $filters = array())
3943 3943
 	{
3944
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
3945
-		$filter_query = $this->getFilter($filters,true,true);
3946
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3944
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
3945
+		$filter_query = $this->getFilter($filters, true, true);
3946
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3947 3947
 		    FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao ) 
3948 3948
                     GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country
3949 3949
 		    ORDER BY airline_count DESC";
@@ -3955,7 +3955,7 @@  discard block
 block discarded – undo
3955 3955
 		$airline_array = array();
3956 3956
 		$temp_array = array();
3957 3957
         
3958
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3958
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3959 3959
 		{
3960 3960
 			$temp_array['airline_name'] = $row['airline_name'];
3961 3961
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3974,11 +3974,11 @@  discard block
 block discarded – undo
3974 3974
 	* @return Array the airline country list
3975 3975
 	*
3976 3976
 	*/
3977
-	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
3977
+	public function countAllAirlineCountriesByAirport($airport_icao, $filters = array())
3978 3978
 	{
3979
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
3980
-		$filter_query = $this->getFilter($filters,true,true);
3981
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3979
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
3980
+		$filter_query = $this->getFilter($filters, true, true);
3981
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3982 3982
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao )
3983 3983
 					GROUP BY spotter_output.airline_country
3984 3984
 					ORDER BY airline_country_count DESC
@@ -3991,7 +3991,7 @@  discard block
 block discarded – undo
3991 3991
 		$airline_country_array = array();
3992 3992
 		$temp_array = array();
3993 3993
         
3994
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3994
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3995 3995
 		{
3996 3996
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
3997 3997
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4008,11 +4008,11 @@  discard block
 block discarded – undo
4008 4008
 	* @return Array the airline list
4009 4009
 	*
4010 4010
 	*/
4011
-	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4011
+	public function countAllAirlinesByManufacturer($aircraft_manufacturer, $filters = array())
4012 4012
 	{
4013
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4014
-		$filter_query = $this->getFilter($filters,true,true);
4015
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4013
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4014
+		$filter_query = $this->getFilter($filters, true, true);
4015
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4016 4016
 		 			FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4017 4017
 					GROUP BY spotter_output.airline_name
4018 4018
 					ORDER BY airline_count DESC";
@@ -4023,7 +4023,7 @@  discard block
 block discarded – undo
4023 4023
 		$airline_array = array();
4024 4024
 		$temp_array = array();
4025 4025
         
4026
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4026
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4027 4027
 		{
4028 4028
 			$temp_array['airline_name'] = $row['airline_name'];
4029 4029
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4043,11 +4043,11 @@  discard block
 block discarded – undo
4043 4043
 	* @return Array the airline country list
4044 4044
 	*
4045 4045
 	*/
4046
-	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4046
+	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer, $filters = array())
4047 4047
 	{
4048
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4049
-		$filter_query = $this->getFilter($filters,true,true);
4050
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4048
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4049
+		$filter_query = $this->getFilter($filters, true, true);
4050
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4051 4051
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4052 4052
 					GROUP BY spotter_output.airline_country
4053 4053
 					ORDER BY airline_country_count DESC
@@ -4060,7 +4060,7 @@  discard block
 block discarded – undo
4060 4060
 		$airline_country_array = array();
4061 4061
 		$temp_array = array();
4062 4062
         
4063
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4063
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4064 4064
 		{
4065 4065
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4066 4066
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4076,11 +4076,11 @@  discard block
 block discarded – undo
4076 4076
 	* @return Array the airline list
4077 4077
 	*
4078 4078
 	*/
4079
-	public function countAllAirlinesByDate($date,$filters = array())
4079
+	public function countAllAirlinesByDate($date, $filters = array())
4080 4080
 	{
4081 4081
 		global $globalTimezone, $globalDBdriver;
4082
-		$filter_query = $this->getFilter($filters,true,true);
4083
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4082
+		$filter_query = $this->getFilter($filters, true, true);
4083
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4084 4084
 		if ($globalTimezone != '') {
4085 4085
 			date_default_timezone_set($globalTimezone);
4086 4086
 			$datetime = new DateTime($date);
@@ -4088,12 +4088,12 @@  discard block
 block discarded – undo
4088 4088
 		} else $offset = '+00:00';
4089 4089
 
4090 4090
 		if ($globalDBdriver == 'mysql') {
4091
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4091
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4092 4092
 		 			FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4093 4093
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country 
4094 4094
 					ORDER BY airline_count DESC";
4095 4095
 		} else {
4096
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4096
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4097 4097
 		 			FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4098 4098
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country
4099 4099
 					ORDER BY airline_count DESC";
@@ -4104,7 +4104,7 @@  discard block
 block discarded – undo
4104 4104
 
4105 4105
 		$airline_array = array();
4106 4106
 		$temp_array = array();
4107
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4107
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4108 4108
 		{
4109 4109
 			$temp_array['airline_name'] = $row['airline_name'];
4110 4110
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4124,11 +4124,11 @@  discard block
 block discarded – undo
4124 4124
 	* @return Array the airline country list
4125 4125
 	*
4126 4126
 	*/
4127
-	public function countAllAirlineCountriesByDate($date,$filters = array())
4127
+	public function countAllAirlineCountriesByDate($date, $filters = array())
4128 4128
 	{
4129 4129
 		global $globalTimezone, $globalDBdriver;
4130
-		$filter_query = $this->getFilter($filters,true,true);
4131
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4130
+		$filter_query = $this->getFilter($filters, true, true);
4131
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4132 4132
 		if ($globalTimezone != '') {
4133 4133
 			date_default_timezone_set($globalTimezone);
4134 4134
 			$datetime = new DateTime($date);
@@ -4136,13 +4136,13 @@  discard block
 block discarded – undo
4136 4136
 		} else $offset = '+00:00';
4137 4137
 		
4138 4138
 		if ($globalDBdriver == 'mysql') {
4139
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4139
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4140 4140
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4141 4141
 					GROUP BY spotter_output.airline_country
4142 4142
 					ORDER BY airline_country_count DESC
4143 4143
 					LIMIT 10 OFFSET 0";
4144 4144
 		} else {
4145
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4145
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4146 4146
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4147 4147
 					GROUP BY spotter_output.airline_country
4148 4148
 					ORDER BY airline_country_count DESC
@@ -4154,7 +4154,7 @@  discard block
 block discarded – undo
4154 4154
  
4155 4155
 		$airline_country_array = array();
4156 4156
 		$temp_array = array();
4157
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4157
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4158 4158
 		{
4159 4159
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4160 4160
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4171,11 +4171,11 @@  discard block
 block discarded – undo
4171 4171
 	* @return Array the airline list
4172 4172
 	*
4173 4173
 	*/
4174
-	public function countAllAirlinesByIdent($ident,$filters = array())
4174
+	public function countAllAirlinesByIdent($ident, $filters = array())
4175 4175
 	{
4176
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4177
-		$filter_query = $this->getFilter($filters,true,true);
4178
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4176
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4177
+		$filter_query = $this->getFilter($filters, true, true);
4178
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4179 4179
 		 		FROM spotter_output".$filter_query." spotter_output.ident = :ident  
4180 4180
 				GROUP BY spotter_output.airline_name
4181 4181
 				ORDER BY airline_count DESC";
@@ -4187,7 +4187,7 @@  discard block
 block discarded – undo
4187 4187
 		$airline_array = array();
4188 4188
 		$temp_array = array();
4189 4189
         
4190
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4190
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4191 4191
 		{
4192 4192
 			$temp_array['airline_name'] = $row['airline_name'];
4193 4193
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4205,25 +4205,25 @@  discard block
 block discarded – undo
4205 4205
 	* @return Array the airline list
4206 4206
 	*
4207 4207
 	*/
4208
-	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4208
+	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4209 4209
 	{
4210
-		$filter_query = $this->getFilter($filters,true,true);
4211
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4212
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4210
+		$filter_query = $this->getFilter($filters, true, true);
4211
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4212
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4213 4213
 
4214
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4214
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4215 4215
 		 			FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4216 4216
 					GROUP BY spotter_output.airline_name
4217 4217
 					ORDER BY airline_count DESC";
4218 4218
       
4219 4219
 		
4220 4220
 		$sth = $this->db->prepare($query);
4221
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4221
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4222 4222
       
4223 4223
 		$airline_array = array();
4224 4224
 		$temp_array = array();
4225 4225
         
4226
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4226
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4227 4227
 		{
4228 4228
 			$temp_array['airline_name'] = $row['airline_name'];
4229 4229
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4241,13 +4241,13 @@  discard block
 block discarded – undo
4241 4241
 	* @return Array the airline country list
4242 4242
 	*
4243 4243
 	*/
4244
-	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4244
+	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4245 4245
 	{
4246
-		$filter_query = $this->getFilter($filters,true,true);
4247
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4248
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4246
+		$filter_query = $this->getFilter($filters, true, true);
4247
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4248
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4249 4249
       
4250
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4250
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4251 4251
 		 		FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4252 4252
 				GROUP BY spotter_output.airline_country
4253 4253
 				ORDER BY airline_country_count DESC
@@ -4255,11 +4255,11 @@  discard block
 block discarded – undo
4255 4255
       
4256 4256
 		
4257 4257
 		$sth = $this->db->prepare($query);
4258
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4258
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4259 4259
       
4260 4260
 		$airline_country_array = array();
4261 4261
 		$temp_array = array();
4262
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4262
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4263 4263
 		{
4264 4264
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4265 4265
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4277,11 +4277,11 @@  discard block
 block discarded – undo
4277 4277
 	* @return Array the airline list
4278 4278
 	*
4279 4279
 	*/
4280
-	public function countAllAirlinesByCountry($country,$filters = array())
4280
+	public function countAllAirlinesByCountry($country, $filters = array())
4281 4281
 	{
4282
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4283
-		$filter_query = $this->getFilter($filters,true,true);
4284
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4282
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4283
+		$filter_query = $this->getFilter($filters, true, true);
4284
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4285 4285
 		 	    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
4286 4286
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4287 4287
 			    ORDER BY airline_count DESC";
@@ -4292,7 +4292,7 @@  discard block
 block discarded – undo
4292 4292
 
4293 4293
 		$airline_array = array();
4294 4294
 		$temp_array = array();
4295
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4295
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4296 4296
 		{
4297 4297
 			$temp_array['airline_name'] = $row['airline_name'];
4298 4298
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4311,11 +4311,11 @@  discard block
 block discarded – undo
4311 4311
 	* @return Array the airline country list
4312 4312
 	*
4313 4313
 	*/
4314
-	public function countAllAirlineCountriesByCountry($country,$filters = array())
4314
+	public function countAllAirlineCountriesByCountry($country, $filters = array())
4315 4315
 	{
4316
-		$filter_query = $this->getFilter($filters,true,true);
4317
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4318
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4316
+		$filter_query = $this->getFilter($filters, true, true);
4317
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4318
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4319 4319
 		 		FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
4320 4320
 				GROUP BY spotter_output.airline_country
4321 4321
 				ORDER BY airline_country_count DESC
@@ -4327,7 +4327,7 @@  discard block
 block discarded – undo
4327 4327
 
4328 4328
 		$airline_country_array = array();
4329 4329
 		$temp_array = array();
4330
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4330
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4331 4331
 		{
4332 4332
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4333 4333
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4346,8 +4346,8 @@  discard block
 block discarded – undo
4346 4346
 	*/
4347 4347
 	public function countAllAirlineCountries($limit = true, $filters = array())
4348 4348
 	{
4349
-		$filter_query = $this->getFilter($filters,true,true);
4350
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4349
+		$filter_query = $this->getFilter($filters, true, true);
4350
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4351 4351
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' 
4352 4352
 					GROUP BY spotter_output.airline_country
4353 4353
 					ORDER BY airline_country_count DESC";
@@ -4358,7 +4358,7 @@  discard block
 block discarded – undo
4358 4358
 
4359 4359
 		$airline_array = array();
4360 4360
 		$temp_array = array();
4361
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4361
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4362 4362
 		{
4363 4363
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4364 4364
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4374,11 +4374,11 @@  discard block
 block discarded – undo
4374 4374
 	* @return Array the airline country list
4375 4375
 	*
4376 4376
 	*/
4377
-	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
4377
+	public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '')
4378 4378
 	{
4379 4379
 		global $globalDBdriver;
4380 4380
 		//$filter_query = $this->getFilter($filters,true,true);
4381
-		$Connection= new Connection($this->db);
4381
+		$Connection = new Connection($this->db);
4382 4382
 		if (!$Connection->tableExists('countries')) return array();
4383 4383
 		/*
4384 4384
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -4413,7 +4413,7 @@  discard block
 block discarded – undo
4413 4413
 		$flight_array = array();
4414 4414
 		$temp_array = array();
4415 4415
         
4416
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4416
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4417 4417
 		{
4418 4418
 			$temp_array['flight_count'] = $row['nb'];
4419 4419
 			$temp_array['flight_country'] = $row['name'];
@@ -4431,12 +4431,12 @@  discard block
 block discarded – undo
4431 4431
 	* @return Array the aircraft list
4432 4432
 	*
4433 4433
 	*/
4434
-	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4434
+	public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4435 4435
 	{
4436 4436
 		global $globalDBdriver;
4437
-		$filter_query = $this->getFilter($filters,true,true);
4437
+		$filter_query = $this->getFilter($filters, true, true);
4438 4438
 
4439
-		$query  = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4439
+		$query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4440 4440
 		    FROM spotter_output ".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> ''";
4441 4441
 		if ($olderthanmonths > 0) {
4442 4442
 			if ($globalDBdriver == 'mysql') {
@@ -4461,7 +4461,7 @@  discard block
 block discarded – undo
4461 4461
 
4462 4462
 		$aircraft_array = array();
4463 4463
 		$temp_array = array();
4464
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4464
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4465 4465
 		{
4466 4466
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4467 4467
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4478,11 +4478,11 @@  discard block
 block discarded – undo
4478 4478
 	* @return Array the aircraft list
4479 4479
 	*
4480 4480
 	*/
4481
-	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4481
+	public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4482 4482
 	{
4483 4483
 		global $globalDBdriver;
4484
-		$filter_query = $this->getFilter($filters,true,true);
4485
-		$query  = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4484
+		$filter_query = $this->getFilter($filters, true, true);
4485
+		$query = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4486 4486
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA' ";
4487 4487
 		if ($olderthanmonths > 0) {
4488 4488
 			if ($globalDBdriver == 'mysql') {
@@ -4507,7 +4507,7 @@  discard block
 block discarded – undo
4507 4507
 
4508 4508
 		$aircraft_array = array();
4509 4509
 		$temp_array = array();
4510
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4510
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4511 4511
 		{
4512 4512
 			$temp_array['airline_icao'] = $row['airline_icao'];
4513 4513
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -4525,11 +4525,11 @@  discard block
 block discarded – undo
4525 4525
 	* @return Array the aircraft list
4526 4526
 	*
4527 4527
 	*/
4528
-	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4528
+	public function countAllAircraftTypesByMonths($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4529 4529
 	{
4530 4530
 		global $globalDBdriver;
4531
-		$filter_query = $this->getFilter($filters,true,true);
4532
-		$query  = "SELECT EXTRACT(month from spotter_output.date) as month, EXTRACT(year from spotter_output.date) as year,spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4531
+		$filter_query = $this->getFilter($filters, true, true);
4532
+		$query = "SELECT EXTRACT(month from spotter_output.date) as month, EXTRACT(year from spotter_output.date) as year,spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4533 4533
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA' ";
4534 4534
 		if ($olderthanmonths > 0) {
4535 4535
 			if ($globalDBdriver == 'mysql') {
@@ -4554,7 +4554,7 @@  discard block
 block discarded – undo
4554 4554
 
4555 4555
 		$aircraft_array = array();
4556 4556
 		$temp_array = array();
4557
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4557
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4558 4558
 		{
4559 4559
 			//$temp_array['airline_icao'] = $row['airline_icao'];
4560 4560
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -4573,13 +4573,13 @@  discard block
 block discarded – undo
4573 4573
 	* @return Array the aircraft list
4574 4574
 	*
4575 4575
 	*/
4576
-	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
4576
+	public function countAllAircraftRegistrationByAircraft($aircraft_icao, $filters = array())
4577 4577
 	{
4578 4578
 		$Image = new Image($this->db);
4579
-		$filter_query = $this->getFilter($filters,true,true);
4580
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4579
+		$filter_query = $this->getFilter($filters, true, true);
4580
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4581 4581
 
4582
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4582
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4583 4583
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao  
4584 4584
 				GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4585 4585
 				ORDER BY registration_count DESC";
@@ -4590,14 +4590,14 @@  discard block
 block discarded – undo
4590 4590
 		$aircraft_array = array();
4591 4591
 		$temp_array = array();
4592 4592
         
4593
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4593
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4594 4594
 		{
4595 4595
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4596 4596
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4597 4597
 			$temp_array['registration'] = $row['registration'];
4598 4598
 			$temp_array['airline_name'] = $row['airline_name'];
4599 4599
 			$temp_array['image_thumbnail'] = "";
4600
-			if($row['registration'] != "")
4600
+			if ($row['registration'] != "")
4601 4601
 			{
4602 4602
 				$image_array = $Image->getSpotterImage($row['registration']);
4603 4603
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4616,11 +4616,11 @@  discard block
 block discarded – undo
4616 4616
 	* @return Array the aircraft list
4617 4617
 	*
4618 4618
 	*/
4619
-	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
4619
+	public function countAllAircraftTypesByAirline($airline_icao, $filters = array())
4620 4620
 	{
4621
-		$filter_query = $this->getFilter($filters,true,true);
4622
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4623
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4621
+		$filter_query = $this->getFilter($filters, true, true);
4622
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4623
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4624 4624
 			    FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao 
4625 4625
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
4626 4626
 			    ORDER BY aircraft_icao_count DESC";
@@ -4631,7 +4631,7 @@  discard block
 block discarded – undo
4631 4631
 		$aircraft_array = array();
4632 4632
 		$temp_array = array();
4633 4633
 
4634
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4634
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4635 4635
 		{
4636 4636
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4637 4637
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4649,13 +4649,13 @@  discard block
 block discarded – undo
4649 4649
 	* @return Array the aircraft list
4650 4650
 	*
4651 4651
 	*/
4652
-	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
4652
+	public function countAllAircraftRegistrationByAirline($airline_icao, $filters = array())
4653 4653
 	{
4654
-		$filter_query = $this->getFilter($filters,true,true);
4654
+		$filter_query = $this->getFilter($filters, true, true);
4655 4655
 		$Image = new Image($this->db);
4656
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4656
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4657 4657
 
4658
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
4658
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
4659 4659
 			    FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao 
4660 4660
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
4661 4661
 			    ORDER BY registration_count DESC";
@@ -4665,14 +4665,14 @@  discard block
 block discarded – undo
4665 4665
 
4666 4666
 		$aircraft_array = array();
4667 4667
 		$temp_array = array();
4668
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4668
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4669 4669
 		{
4670 4670
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4671 4671
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4672 4672
 			$temp_array['registration'] = $row['registration'];
4673 4673
 			$temp_array['airline_name'] = $row['airline_name'];
4674 4674
 			$temp_array['image_thumbnail'] = "";
4675
-			if($row['registration'] != "")
4675
+			if ($row['registration'] != "")
4676 4676
 			{
4677 4677
 				$image_array = $Image->getSpotterImage($row['registration']);
4678 4678
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4691,11 +4691,11 @@  discard block
 block discarded – undo
4691 4691
 	* @return Array the aircraft list
4692 4692
 	*
4693 4693
 	*/
4694
-	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
4694
+	public function countAllAircraftManufacturerByAirline($airline_icao, $filters = array())
4695 4695
 	{
4696
-		$filter_query = $this->getFilter($filters,true,true);
4697
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4698
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4696
+		$filter_query = $this->getFilter($filters, true, true);
4697
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4698
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4699 4699
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao 
4700 4700
 				GROUP BY spotter_output.aircraft_manufacturer 
4701 4701
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -4706,7 +4706,7 @@  discard block
 block discarded – undo
4706 4706
 		$aircraft_array = array();
4707 4707
 		$temp_array = array();
4708 4708
 
4709
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4709
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4710 4710
 		{
4711 4711
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4712 4712
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4723,12 +4723,12 @@  discard block
 block discarded – undo
4723 4723
 	* @return Array the aircraft list
4724 4724
 	*
4725 4725
 	*/
4726
-	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
4726
+	public function countAllAircraftTypesByAirport($airport_icao, $filters = array())
4727 4727
 	{
4728
-		$filter_query = $this->getFilter($filters,true,true);
4729
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4728
+		$filter_query = $this->getFilter($filters, true, true);
4729
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4730 4730
 
4731
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4731
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4732 4732
 				FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) 
4733 4733
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
4734 4734
 				ORDER BY aircraft_icao_count DESC";
@@ -4738,7 +4738,7 @@  discard block
 block discarded – undo
4738 4738
 
4739 4739
 		$aircraft_array = array();
4740 4740
 		$temp_array = array();
4741
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4741
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4742 4742
 		{
4743 4743
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4744 4744
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4756,13 +4756,13 @@  discard block
 block discarded – undo
4756 4756
 	* @return Array the aircraft list
4757 4757
 	*
4758 4758
 	*/
4759
-	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
4759
+	public function countAllAircraftRegistrationByAirport($airport_icao, $filters = array())
4760 4760
 	{
4761
-		$filter_query = $this->getFilter($filters,true,true);
4761
+		$filter_query = $this->getFilter($filters, true, true);
4762 4762
 		$Image = new Image($this->db);
4763
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4763
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4764 4764
 
4765
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4765
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4766 4766
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)   
4767 4767
                     GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
4768 4768
 		    ORDER BY registration_count DESC";
@@ -4772,14 +4772,14 @@  discard block
 block discarded – undo
4772 4772
 
4773 4773
 		$aircraft_array = array();
4774 4774
 		$temp_array = array();
4775
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4775
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4776 4776
 		{
4777 4777
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4778 4778
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4779 4779
 			$temp_array['registration'] = $row['registration'];
4780 4780
 			$temp_array['airline_name'] = $row['airline_name'];
4781 4781
 			$temp_array['image_thumbnail'] = "";
4782
-			if($row['registration'] != "")
4782
+			if ($row['registration'] != "")
4783 4783
 			{
4784 4784
 				$image_array = $Image->getSpotterImage($row['registration']);
4785 4785
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4797,11 +4797,11 @@  discard block
 block discarded – undo
4797 4797
 	* @return Array the aircraft list
4798 4798
 	*
4799 4799
 	*/
4800
-	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
4800
+	public function countAllAircraftManufacturerByAirport($airport_icao, $filters = array())
4801 4801
 	{
4802
-		$filter_query = $this->getFilter($filters,true,true);
4803
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4804
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4802
+		$filter_query = $this->getFilter($filters, true, true);
4803
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4804
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4805 4805
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)  
4806 4806
                     GROUP BY spotter_output.aircraft_manufacturer 
4807 4807
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -4812,7 +4812,7 @@  discard block
 block discarded – undo
4812 4812
 
4813 4813
 		$aircraft_array = array();
4814 4814
 		$temp_array = array();
4815
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4815
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4816 4816
 		{
4817 4817
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4818 4818
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4827,12 +4827,12 @@  discard block
 block discarded – undo
4827 4827
 	* @return Array the aircraft list
4828 4828
 	*
4829 4829
 	*/
4830
-	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
4830
+	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer, $filters = array())
4831 4831
 	{
4832
-		$filter_query = $this->getFilter($filters,true,true);
4833
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4832
+		$filter_query = $this->getFilter($filters, true, true);
4833
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4834 4834
 
4835
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4835
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4836 4836
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
4837 4837
                     GROUP BY spotter_output.aircraft_name 
4838 4838
 					ORDER BY aircraft_icao_count DESC";
@@ -4841,7 +4841,7 @@  discard block
 block discarded – undo
4841 4841
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
4842 4842
 		$aircraft_array = array();
4843 4843
 		$temp_array = array();
4844
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4844
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4845 4845
 		{
4846 4846
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4847 4847
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4860,11 +4860,11 @@  discard block
 block discarded – undo
4860 4860
 	*/
4861 4861
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
4862 4862
 	{
4863
-		$filter_query = $this->getFilter($filters,true,true);
4863
+		$filter_query = $this->getFilter($filters, true, true);
4864 4864
 		$Image = new Image($this->db);
4865
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4865
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4866 4866
 
4867
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
4867
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
4868 4868
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
4869 4869
                     GROUP BY spotter_output.registration 
4870 4870
 					ORDER BY registration_count DESC";
@@ -4874,14 +4874,14 @@  discard block
 block discarded – undo
4874 4874
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
4875 4875
 		$aircraft_array = array();
4876 4876
 		$temp_array = array();
4877
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4877
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4878 4878
 		{
4879 4879
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4880 4880
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4881 4881
 			$temp_array['registration'] = $row['registration'];
4882 4882
 			$temp_array['airline_name'] = $row['airline_name'];
4883 4883
 			$temp_array['image_thumbnail'] = "";
4884
-			if($row['registration'] != "")
4884
+			if ($row['registration'] != "")
4885 4885
 			{
4886 4886
 				$image_array = $Image->getSpotterImage($row['registration']);
4887 4887
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4898,11 +4898,11 @@  discard block
 block discarded – undo
4898 4898
 	* @return Array the aircraft list
4899 4899
 	*
4900 4900
 	*/
4901
-	public function countAllAircraftTypesByDate($date,$filters = array())
4901
+	public function countAllAircraftTypesByDate($date, $filters = array())
4902 4902
 	{
4903 4903
 		global $globalTimezone, $globalDBdriver;
4904
-		$filter_query = $this->getFilter($filters,true,true);
4905
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4904
+		$filter_query = $this->getFilter($filters, true, true);
4905
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4906 4906
 		if ($globalTimezone != '') {
4907 4907
 			date_default_timezone_set($globalTimezone);
4908 4908
 			$datetime = new DateTime($date);
@@ -4910,12 +4910,12 @@  discard block
 block discarded – undo
4910 4910
 		} else $offset = '+00:00';
4911 4911
 
4912 4912
 		if ($globalDBdriver == 'mysql') {
4913
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4913
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4914 4914
 					FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
4915 4915
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
4916 4916
 					ORDER BY aircraft_icao_count DESC";
4917 4917
 		} else {
4918
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4918
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4919 4919
 					FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
4920 4920
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
4921 4921
 					ORDER BY aircraft_icao_count DESC";
@@ -4926,7 +4926,7 @@  discard block
 block discarded – undo
4926 4926
 
4927 4927
 		$aircraft_array = array();
4928 4928
 		$temp_array = array();
4929
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4929
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4930 4930
 		{
4931 4931
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4932 4932
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4944,12 +4944,12 @@  discard block
 block discarded – undo
4944 4944
 	* @return Array the aircraft list
4945 4945
 	*
4946 4946
 	*/
4947
-	public function countAllAircraftRegistrationByDate($date,$filters = array())
4947
+	public function countAllAircraftRegistrationByDate($date, $filters = array())
4948 4948
 	{
4949 4949
 		global $globalTimezone, $globalDBdriver;
4950
-		$filter_query = $this->getFilter($filters,true,true);
4950
+		$filter_query = $this->getFilter($filters, true, true);
4951 4951
 		$Image = new Image($this->db);
4952
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4952
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4953 4953
 		if ($globalTimezone != '') {
4954 4954
 			date_default_timezone_set($globalTimezone);
4955 4955
 			$datetime = new DateTime($date);
@@ -4957,12 +4957,12 @@  discard block
 block discarded – undo
4957 4957
 		} else $offset = '+00:00';
4958 4958
 
4959 4959
 		if ($globalDBdriver == 'mysql') {
4960
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
4960
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
4961 4961
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4962 4962
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
4963 4963
 					ORDER BY registration_count DESC";
4964 4964
 		} else {
4965
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name    
4965
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name    
4966 4966
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4967 4967
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
4968 4968
 					ORDER BY registration_count DESC";
@@ -4973,14 +4973,14 @@  discard block
 block discarded – undo
4973 4973
 
4974 4974
 		$aircraft_array = array();
4975 4975
 		$temp_array = array();
4976
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4976
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4977 4977
 		{
4978 4978
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4979 4979
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4980 4980
 			$temp_array['registration'] = $row['registration'];
4981 4981
 			$temp_array['airline_name'] = $row['airline_name'];
4982 4982
 			$temp_array['image_thumbnail'] = "";
4983
-			if($row['registration'] != "")
4983
+			if ($row['registration'] != "")
4984 4984
 			{
4985 4985
 				$image_array = $Image->getSpotterImage($row['registration']);
4986 4986
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4999,11 +4999,11 @@  discard block
 block discarded – undo
4999 4999
 	* @return Array the aircraft manufacturer list
5000 5000
 	*
5001 5001
 	*/
5002
-	public function countAllAircraftManufacturerByDate($date,$filters = array())
5002
+	public function countAllAircraftManufacturerByDate($date, $filters = array())
5003 5003
 	{
5004 5004
 		global $globalTimezone, $globalDBdriver;
5005
-		$filter_query = $this->getFilter($filters,true,true);
5006
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5005
+		$filter_query = $this->getFilter($filters, true, true);
5006
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5007 5007
 		if ($globalTimezone != '') {
5008 5008
 			date_default_timezone_set($globalTimezone);
5009 5009
 			$datetime = new DateTime($date);
@@ -5011,12 +5011,12 @@  discard block
 block discarded – undo
5011 5011
 		} else $offset = '+00:00';
5012 5012
 
5013 5013
 		if ($globalDBdriver == 'mysql') {
5014
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5014
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5015 5015
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
5016 5016
 				GROUP BY spotter_output.aircraft_manufacturer 
5017 5017
 				ORDER BY aircraft_manufacturer_count DESC";
5018 5018
 		} else {
5019
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5019
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5020 5020
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5021 5021
 				GROUP BY spotter_output.aircraft_manufacturer 
5022 5022
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -5028,7 +5028,7 @@  discard block
 block discarded – undo
5028 5028
 		$aircraft_array = array();
5029 5029
 		$temp_array = array();
5030 5030
 
5031
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5031
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5032 5032
 		{
5033 5033
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5034 5034
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5045,11 +5045,11 @@  discard block
 block discarded – undo
5045 5045
 	* @return Array the aircraft list
5046 5046
 	*
5047 5047
 	*/
5048
-	public function countAllAircraftTypesByIdent($ident,$filters = array())
5048
+	public function countAllAircraftTypesByIdent($ident, $filters = array())
5049 5049
 	{
5050
-		$filter_query = $this->getFilter($filters,true,true);
5051
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5052
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5050
+		$filter_query = $this->getFilter($filters, true, true);
5051
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5052
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5053 5053
 				FROM spotter_output".$filter_query." spotter_output.ident = :ident 
5054 5054
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
5055 5055
 				ORDER BY aircraft_icao_count DESC";
@@ -5060,7 +5060,7 @@  discard block
 block discarded – undo
5060 5060
 		$aircraft_array = array();
5061 5061
 		$temp_array = array();
5062 5062
 
5063
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5063
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5064 5064
 		{
5065 5065
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5066 5066
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5078,13 +5078,13 @@  discard block
 block discarded – undo
5078 5078
 	* @return Array the aircraft list
5079 5079
 	*
5080 5080
 	*/
5081
-	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5081
+	public function countAllAircraftRegistrationByIdent($ident, $filters = array())
5082 5082
 	{
5083
-		$filter_query = $this->getFilter($filters,true,true);
5083
+		$filter_query = $this->getFilter($filters, true, true);
5084 5084
 		$Image = new Image($this->db);
5085
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5085
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5086 5086
 
5087
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5087
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5088 5088
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.ident = :ident   
5089 5089
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
5090 5090
 		    ORDER BY registration_count DESC";
@@ -5096,14 +5096,14 @@  discard block
 block discarded – undo
5096 5096
 		$aircraft_array = array();
5097 5097
 		$temp_array = array();
5098 5098
         
5099
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5099
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5100 5100
 		{
5101 5101
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5102 5102
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5103 5103
 			$temp_array['registration'] = $row['registration'];
5104 5104
 			$temp_array['airline_name'] = $row['airline_name'];
5105 5105
 			$temp_array['image_thumbnail'] = "";
5106
-			if($row['registration'] != "")
5106
+			if ($row['registration'] != "")
5107 5107
 			{
5108 5108
 				$image_array = $Image->getSpotterImage($row['registration']);
5109 5109
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5122,11 +5122,11 @@  discard block
 block discarded – undo
5122 5122
 	* @return Array the aircraft manufacturer list
5123 5123
 	*
5124 5124
 	*/
5125
-	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5125
+	public function countAllAircraftManufacturerByIdent($ident, $filters = array())
5126 5126
 	{
5127
-		$filter_query = $this->getFilter($filters,true,true);
5128
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5129
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5127
+		$filter_query = $this->getFilter($filters, true, true);
5128
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5129
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5130 5130
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident  
5131 5131
                     GROUP BY spotter_output.aircraft_manufacturer 
5132 5132
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5136,7 +5136,7 @@  discard block
 block discarded – undo
5136 5136
 		$sth->execute(array(':ident' => $ident));
5137 5137
 		$aircraft_array = array();
5138 5138
 		$temp_array = array();
5139
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5139
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5140 5140
 		{
5141 5141
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5142 5142
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5152,24 +5152,24 @@  discard block
 block discarded – undo
5152 5152
 	* @return Array the aircraft list
5153 5153
 	*
5154 5154
 	*/
5155
-	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5155
+	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5156 5156
 	{
5157
-		$filter_query = $this->getFilter($filters,true,true);
5158
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5159
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5157
+		$filter_query = $this->getFilter($filters, true, true);
5158
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5159
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5160 5160
 		
5161 5161
 
5162
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5162
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5163 5163
                     FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
5164 5164
                     GROUP BY spotter_output.aircraft_name 
5165 5165
 					ORDER BY aircraft_icao_count DESC";
5166 5166
  
5167 5167
 		
5168 5168
 		$sth = $this->db->prepare($query);
5169
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5169
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5170 5170
 		$aircraft_array = array();
5171 5171
 		$temp_array = array();
5172
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5172
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5173 5173
 		{
5174 5174
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5175 5175
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5185,33 +5185,33 @@  discard block
 block discarded – undo
5185 5185
 	* @return Array the aircraft list
5186 5186
 	*
5187 5187
 	*/
5188
-	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5188
+	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5189 5189
 	{
5190
-		$filter_query = $this->getFilter($filters,true,true);
5190
+		$filter_query = $this->getFilter($filters, true, true);
5191 5191
 		$Image = new Image($this->db);
5192
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5193
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5192
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5193
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5194 5194
 
5195
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
5195
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
5196 5196
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)   
5197 5197
                     GROUP BY spotter_output.registration 
5198 5198
 					ORDER BY registration_count DESC";
5199 5199
 
5200 5200
 		
5201 5201
 		$sth = $this->db->prepare($query);
5202
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5202
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5203 5203
       
5204 5204
 		$aircraft_array = array();
5205 5205
 		$temp_array = array();
5206 5206
         
5207
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5207
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5208 5208
 		{
5209 5209
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5210 5210
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5211 5211
 			$temp_array['registration'] = $row['registration'];
5212 5212
 			$temp_array['airline_name'] = $row['airline_name'];
5213 5213
 			$temp_array['image_thumbnail'] = "";
5214
-			if($row['registration'] != "")
5214
+			if ($row['registration'] != "")
5215 5215
 			{
5216 5216
 				$image_array = $Image->getSpotterImage($row['registration']);
5217 5217
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5231,25 +5231,25 @@  discard block
 block discarded – undo
5231 5231
 	* @return Array the aircraft manufacturer list
5232 5232
 	*
5233 5233
 	*/
5234
-	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5234
+	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5235 5235
 	{
5236
-		$filter_query = $this->getFilter($filters,true,true);
5237
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5238
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5236
+		$filter_query = $this->getFilter($filters, true, true);
5237
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5238
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5239 5239
 
5240
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5240
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5241 5241
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
5242 5242
                     GROUP BY spotter_output.aircraft_manufacturer 
5243 5243
 					ORDER BY aircraft_manufacturer_count DESC";
5244 5244
 
5245 5245
 		
5246 5246
 		$sth = $this->db->prepare($query);
5247
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5247
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5248 5248
       
5249 5249
 		$aircraft_array = array();
5250 5250
 		$temp_array = array();
5251 5251
         
5252
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5252
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5253 5253
 		{
5254 5254
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5255 5255
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5269,11 +5269,11 @@  discard block
 block discarded – undo
5269 5269
 	* @return Array the aircraft list
5270 5270
 	*
5271 5271
 	*/
5272
-	public function countAllAircraftTypesByCountry($country,$filters = array())
5272
+	public function countAllAircraftTypesByCountry($country, $filters = array())
5273 5273
 	{
5274
-		$filter_query = $this->getFilter($filters,true,true);
5275
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5276
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5274
+		$filter_query = $this->getFilter($filters, true, true);
5275
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5276
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5277 5277
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
5278 5278
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5279 5279
 			    ORDER BY aircraft_icao_count DESC";
@@ -5285,7 +5285,7 @@  discard block
 block discarded – undo
5285 5285
 		$aircraft_array = array();
5286 5286
 		$temp_array = array();
5287 5287
         
5288
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5288
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5289 5289
 		{
5290 5290
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5291 5291
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5304,12 +5304,12 @@  discard block
 block discarded – undo
5304 5304
 	* @return Array the aircraft list
5305 5305
 	*
5306 5306
 	*/
5307
-	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5307
+	public function countAllAircraftRegistrationByCountry($country, $filters = array())
5308 5308
 	{
5309
-		$filter_query = $this->getFilter($filters,true,true);
5309
+		$filter_query = $this->getFilter($filters, true, true);
5310 5310
 		$Image = new Image($this->db);
5311
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5312
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
5311
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5312
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
5313 5313
 			    FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country)    
5314 5314
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5315 5315
 			    ORDER BY registration_count DESC";
@@ -5321,14 +5321,14 @@  discard block
 block discarded – undo
5321 5321
 		$aircraft_array = array();
5322 5322
 		$temp_array = array();
5323 5323
         
5324
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5324
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5325 5325
 		{
5326 5326
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5327 5327
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5328 5328
 			$temp_array['registration'] = $row['registration'];
5329 5329
 			$temp_array['airline_name'] = $row['airline_name'];
5330 5330
 			$temp_array['image_thumbnail'] = "";
5331
-			if($row['registration'] != "")
5331
+			if ($row['registration'] != "")
5332 5332
 			{
5333 5333
 				$image_array = $Image->getSpotterImage($row['registration']);
5334 5334
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5348,11 +5348,11 @@  discard block
 block discarded – undo
5348 5348
 	* @return Array the aircraft manufacturer list
5349 5349
 	*
5350 5350
 	*/
5351
-	public function countAllAircraftManufacturerByCountry($country,$filters = array())
5351
+	public function countAllAircraftManufacturerByCountry($country, $filters = array())
5352 5352
 	{
5353
-		$filter_query = $this->getFilter($filters,true,true);
5354
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5355
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5353
+		$filter_query = $this->getFilter($filters, true, true);
5354
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5355
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5356 5356
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country) 
5357 5357
                     GROUP BY spotter_output.aircraft_manufacturer 
5358 5358
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5364,7 +5364,7 @@  discard block
 block discarded – undo
5364 5364
 		$aircraft_array = array();
5365 5365
 		$temp_array = array();
5366 5366
         
5367
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5367
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5368 5368
 		{
5369 5369
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5370 5370
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5385,8 +5385,8 @@  discard block
 block discarded – undo
5385 5385
 	*/
5386 5386
 	public function countAllAircraftManufacturers($filters = array())
5387 5387
 	{
5388
-		$filter_query = $this->getFilter($filters,true,true);
5389
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5388
+		$filter_query = $this->getFilter($filters, true, true);
5389
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5390 5390
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5391 5391
                 $query .= " GROUP BY spotter_output.aircraft_manufacturer
5392 5392
 					ORDER BY aircraft_manufacturer_count DESC
@@ -5399,7 +5399,7 @@  discard block
 block discarded – undo
5399 5399
 		$manufacturer_array = array();
5400 5400
 		$temp_array = array();
5401 5401
         
5402
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5402
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5403 5403
 		{
5404 5404
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5405 5405
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5418,12 +5418,12 @@  discard block
 block discarded – undo
5418 5418
 	* @return Array the aircraft list
5419 5419
 	*
5420 5420
 	*/
5421
-	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5421
+	public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5422 5422
 	{
5423 5423
 		global $globalDBdriver;
5424 5424
 		$Image = new Image($this->db);
5425
-		$filter_query = $this->getFilter($filters,true,true);
5426
-		$query  = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
5425
+		$filter_query = $this->getFilter($filters, true, true);
5426
+		$query = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
5427 5427
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5428 5428
                 if ($olderthanmonths > 0) {
5429 5429
             		if ($globalDBdriver == 'mysql') {
@@ -5451,7 +5451,7 @@  discard block
 block discarded – undo
5451 5451
 		$aircraft_array = array();
5452 5452
 		$temp_array = array();
5453 5453
         
5454
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5454
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5455 5455
 		{
5456 5456
 			$temp_array['registration'] = $row['registration'];
5457 5457
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -5459,7 +5459,7 @@  discard block
 block discarded – undo
5459 5459
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5460 5460
 			$temp_array['airline_name'] = $row['airline_name'];
5461 5461
 			$temp_array['image_thumbnail'] = "";
5462
-			if($row['registration'] != "")
5462
+			if ($row['registration'] != "")
5463 5463
 			{
5464 5464
 				$image_array = $Image->getSpotterImage($row['registration']);
5465 5465
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5478,12 +5478,12 @@  discard block
 block discarded – undo
5478 5478
 	* @return Array the aircraft list
5479 5479
 	*
5480 5480
 	*/
5481
-	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5481
+	public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5482 5482
 	{
5483 5483
 		global $globalDBdriver;
5484
-		$filter_query = $this->getFilter($filters,true,true);
5484
+		$filter_query = $this->getFilter($filters, true, true);
5485 5485
 		$Image = new Image($this->db);
5486
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
5486
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
5487 5487
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5488 5488
                 if ($olderthanmonths > 0) {
5489 5489
             		if ($globalDBdriver == 'mysql') {
@@ -5511,7 +5511,7 @@  discard block
 block discarded – undo
5511 5511
 		$aircraft_array = array();
5512 5512
 		$temp_array = array();
5513 5513
         
5514
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5514
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5515 5515
 		{
5516 5516
 			$temp_array['registration'] = $row['registration'];
5517 5517
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -5520,7 +5520,7 @@  discard block
 block discarded – undo
5520 5520
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5521 5521
 			$temp_array['airline_name'] = $row['airline_name'];
5522 5522
 			$temp_array['image_thumbnail'] = "";
5523
-			if($row['registration'] != "")
5523
+			if ($row['registration'] != "")
5524 5524
 			{
5525 5525
 				$image_array = $Image->getSpotterImage($row['registration']);
5526 5526
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5539,11 +5539,11 @@  discard block
 block discarded – undo
5539 5539
 	* @return Array the airport list
5540 5540
 	*
5541 5541
 	*/
5542
-	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5542
+	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5543 5543
 	{
5544 5544
 		global $globalDBdriver;
5545
-		$filter_query = $this->getFilter($filters,true,true);
5546
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5545
+		$filter_query = $this->getFilter($filters, true, true);
5546
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5547 5547
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA'";
5548 5548
                 if ($olderthanmonths > 0) {
5549 5549
             		if ($globalDBdriver == 'mysql') {
@@ -5572,7 +5572,7 @@  discard block
 block discarded – undo
5572 5572
 		$airport_array = array();
5573 5573
 		$temp_array = array();
5574 5574
         
5575
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5575
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5576 5576
 		{
5577 5577
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5578 5578
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5591,11 +5591,11 @@  discard block
 block discarded – undo
5591 5591
 	* @return Array the airport list
5592 5592
 	*
5593 5593
 	*/
5594
-	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5594
+	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5595 5595
 	{
5596 5596
 		global $globalDBdriver;
5597
-		$filter_query = $this->getFilter($filters,true,true);
5598
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5597
+		$filter_query = $this->getFilter($filters, true, true);
5598
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5599 5599
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' ";
5600 5600
                 if ($olderthanmonths > 0) {
5601 5601
             		if ($globalDBdriver == 'mysql') {
@@ -5624,7 +5624,7 @@  discard block
 block discarded – undo
5624 5624
 		$airport_array = array();
5625 5625
 		$temp_array = array();
5626 5626
         
5627
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5627
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5628 5628
 		{
5629 5629
 			$temp_array['airline_icao'] = $row['airline_icao'];
5630 5630
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -5644,11 +5644,11 @@  discard block
 block discarded – undo
5644 5644
 	* @return Array the airport list
5645 5645
 	*
5646 5646
 	*/
5647
-	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5647
+	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5648 5648
 	{
5649 5649
 		global $globalDBdriver;
5650
-		$filter_query = $this->getFilter($filters,true,true);
5651
-		$query  = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
5650
+		$filter_query = $this->getFilter($filters, true, true);
5651
+		$query = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
5652 5652
 				FROM airport, spotter_output".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao";
5653 5653
                 if ($olderthanmonths > 0) {
5654 5654
             		if ($globalDBdriver == 'mysql') {
@@ -5676,7 +5676,7 @@  discard block
 block discarded – undo
5676 5676
 		$airport_array = array();
5677 5677
 		$temp_array = array();
5678 5678
         
5679
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5679
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5680 5680
 		{
5681 5681
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5682 5682
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5695,11 +5695,11 @@  discard block
 block discarded – undo
5695 5695
 	* @return Array the airport list
5696 5696
 	*
5697 5697
 	*/
5698
-	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5698
+	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5699 5699
 	{
5700 5700
 		global $globalDBdriver;
5701
-		$filter_query = $this->getFilter($filters,true,true);
5702
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
5701
+		$filter_query = $this->getFilter($filters, true, true);
5702
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
5703 5703
 				FROM airport, spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao ";
5704 5704
                 if ($olderthanmonths > 0) {
5705 5705
             		if ($globalDBdriver == 'mysql') {
@@ -5728,7 +5728,7 @@  discard block
 block discarded – undo
5728 5728
 		$airport_array = array();
5729 5729
 		$temp_array = array();
5730 5730
         
5731
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5731
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5732 5732
 		{
5733 5733
 			$temp_array['airline_icao'] = $row['airline_icao'];
5734 5734
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -5748,11 +5748,11 @@  discard block
 block discarded – undo
5748 5748
 	* @return Array the airport list
5749 5749
 	*
5750 5750
 	*/
5751
-	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
5751
+	public function countAllDepartureAirportsByAirline($airline_icao, $filters = array())
5752 5752
 	{
5753
-		$filter_query = $this->getFilter($filters,true,true);
5754
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5755
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5753
+		$filter_query = $this->getFilter($filters, true, true);
5754
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5755
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5756 5756
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao 
5757 5757
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5758 5758
 			    ORDER BY airport_departure_icao_count DESC";
@@ -5764,7 +5764,7 @@  discard block
 block discarded – undo
5764 5764
 		$airport_array = array();
5765 5765
 		$temp_array = array();
5766 5766
         
5767
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5767
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5768 5768
 		{
5769 5769
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5770 5770
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5786,11 +5786,11 @@  discard block
 block discarded – undo
5786 5786
 	* @return Array the airport list
5787 5787
 	*
5788 5788
 	*/
5789
-	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
5789
+	public function countAllDepartureAirportCountriesByAirline($airline_icao, $filters = array())
5790 5790
 	{
5791
-		$filter_query = $this->getFilter($filters,true,true);
5792
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5793
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5791
+		$filter_query = $this->getFilter($filters, true, true);
5792
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5793
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5794 5794
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
5795 5795
                     GROUP BY spotter_output.departure_airport_country
5796 5796
 					ORDER BY airport_departure_country_count DESC";
@@ -5802,7 +5802,7 @@  discard block
 block discarded – undo
5802 5802
 		$airport_array = array();
5803 5803
 		$temp_array = array();
5804 5804
         
5805
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5805
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5806 5806
 		{
5807 5807
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5808 5808
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5821,11 +5821,11 @@  discard block
 block discarded – undo
5821 5821
 	* @return Array the airport list
5822 5822
 	*
5823 5823
 	*/
5824
-	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
5824
+	public function countAllDepartureAirportsByAircraft($aircraft_icao, $filters = array())
5825 5825
 	{
5826
-		$filter_query = $this->getFilter($filters,true,true);
5827
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5828
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5826
+		$filter_query = $this->getFilter($filters, true, true);
5827
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5828
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5829 5829
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao 
5830 5830
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5831 5831
 			    ORDER BY airport_departure_icao_count DESC";
@@ -5837,7 +5837,7 @@  discard block
 block discarded – undo
5837 5837
 		$airport_array = array();
5838 5838
 		$temp_array = array();
5839 5839
         
5840
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5840
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5841 5841
 		{
5842 5842
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5843 5843
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5858,11 +5858,11 @@  discard block
 block discarded – undo
5858 5858
 	* @return Array the airport list
5859 5859
 	*
5860 5860
 	*/
5861
-	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
5861
+	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao, $filters = array())
5862 5862
 	{
5863
-		$filter_query = $this->getFilter($filters,true,true);
5864
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5865
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5863
+		$filter_query = $this->getFilter($filters, true, true);
5864
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5865
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5866 5866
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
5867 5867
                     GROUP BY spotter_output.departure_airport_country
5868 5868
 					ORDER BY airport_departure_country_count DESC";
@@ -5874,7 +5874,7 @@  discard block
 block discarded – undo
5874 5874
 		$airport_array = array();
5875 5875
 		$temp_array = array();
5876 5876
         
5877
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5877
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5878 5878
 		{
5879 5879
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5880 5880
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5892,11 +5892,11 @@  discard block
 block discarded – undo
5892 5892
 	* @return Array the airport list
5893 5893
 	*
5894 5894
 	*/
5895
-	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
5895
+	public function countAllDepartureAirportsByRegistration($registration, $filters = array())
5896 5896
 	{
5897
-		$filter_query = $this->getFilter($filters,true,true);
5898
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
5899
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5897
+		$filter_query = $this->getFilter($filters, true, true);
5898
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
5899
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5900 5900
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.registration = :registration 
5901 5901
                     GROUP BY spotter_output.departure_airport_icao
5902 5902
 					ORDER BY airport_departure_icao_count DESC";
@@ -5908,7 +5908,7 @@  discard block
 block discarded – undo
5908 5908
 		$airport_array = array();
5909 5909
 		$temp_array = array();
5910 5910
         
5911
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5911
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5912 5912
 		{
5913 5913
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5914 5914
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5929,11 +5929,11 @@  discard block
 block discarded – undo
5929 5929
 	* @return Array the airport list
5930 5930
 	*
5931 5931
 	*/
5932
-	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
5932
+	public function countAllDepartureAirportCountriesByRegistration($registration, $filters = array())
5933 5933
 	{
5934
-		$filter_query = $this->getFilter($filters,true,true);
5935
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
5936
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5934
+		$filter_query = $this->getFilter($filters, true, true);
5935
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
5936
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5937 5937
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration 
5938 5938
                     GROUP BY spotter_output.departure_airport_country
5939 5939
 					ORDER BY airport_departure_country_count DESC";
@@ -5945,7 +5945,7 @@  discard block
 block discarded – undo
5945 5945
 		$airport_array = array();
5946 5946
 		$temp_array = array();
5947 5947
         
5948
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5948
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5949 5949
 		{
5950 5950
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5951 5951
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5963,11 +5963,11 @@  discard block
 block discarded – undo
5963 5963
 	* @return Array the airport list
5964 5964
 	*
5965 5965
 	*/
5966
-	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
5966
+	public function countAllDepartureAirportsByAirport($airport_icao, $filters = array())
5967 5967
 	{
5968
-		$filter_query = $this->getFilter($filters,true,true);
5969
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5970
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5968
+		$filter_query = $this->getFilter($filters, true, true);
5969
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5970
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5971 5971
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao = :airport_icao 
5972 5972
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5973 5973
 			    ORDER BY airport_departure_icao_count DESC";
@@ -5979,7 +5979,7 @@  discard block
 block discarded – undo
5979 5979
 		$airport_array = array();
5980 5980
 		$temp_array = array();
5981 5981
         
5982
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5982
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5983 5983
 		{
5984 5984
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5985 5985
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6000,11 +6000,11 @@  discard block
 block discarded – undo
6000 6000
 	* @return Array the airport list
6001 6001
 	*
6002 6002
 	*/
6003
-	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
6003
+	public function countAllDepartureAirportCountriesByAirport($airport_icao, $filters = array())
6004 6004
 	{
6005
-		$filter_query = $this->getFilter($filters,true,true);
6006
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6007
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6005
+		$filter_query = $this->getFilter($filters, true, true);
6006
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6007
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6008 6008
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao 
6009 6009
                     GROUP BY spotter_output.departure_airport_country
6010 6010
 					ORDER BY airport_departure_country_count DESC";
@@ -6016,7 +6016,7 @@  discard block
 block discarded – undo
6016 6016
 		$airport_array = array();
6017 6017
 		$temp_array = array();
6018 6018
         
6019
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6019
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6020 6020
 		{
6021 6021
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6022 6022
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6035,11 +6035,11 @@  discard block
 block discarded – undo
6035 6035
 	* @return Array the airport list
6036 6036
 	*
6037 6037
 	*/
6038
-	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6038
+	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer, $filters = array())
6039 6039
 	{
6040
-		$filter_query = $this->getFilter($filters,true,true);
6041
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6042
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6040
+		$filter_query = $this->getFilter($filters, true, true);
6041
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6042
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6043 6043
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6044 6044
                     GROUP BY spotter_output.departure_airport_icao
6045 6045
 					ORDER BY airport_departure_icao_count DESC";
@@ -6051,7 +6051,7 @@  discard block
 block discarded – undo
6051 6051
 		$airport_array = array();
6052 6052
 		$temp_array = array();
6053 6053
         
6054
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6054
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6055 6055
 		{
6056 6056
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6057 6057
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6072,11 +6072,11 @@  discard block
 block discarded – undo
6072 6072
 	* @return Array the airport list
6073 6073
 	*
6074 6074
 	*/
6075
-	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6075
+	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
6076 6076
 	{
6077
-		$filter_query = $this->getFilter($filters,true,true);
6078
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6079
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6077
+		$filter_query = $this->getFilter($filters, true, true);
6078
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6079
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6080 6080
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6081 6081
                     GROUP BY spotter_output.departure_airport_country
6082 6082
 					ORDER BY airport_departure_country_count DESC";
@@ -6088,7 +6088,7 @@  discard block
 block discarded – undo
6088 6088
 		$airport_array = array();
6089 6089
 		$temp_array = array();
6090 6090
         
6091
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6091
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6092 6092
 		{
6093 6093
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6094 6094
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6106,11 +6106,11 @@  discard block
 block discarded – undo
6106 6106
 	* @return Array the airport list
6107 6107
 	*
6108 6108
 	*/
6109
-	public function countAllDepartureAirportsByDate($date,$filters = array())
6109
+	public function countAllDepartureAirportsByDate($date, $filters = array())
6110 6110
 	{
6111 6111
 		global $globalTimezone, $globalDBdriver;
6112
-		$filter_query = $this->getFilter($filters,true,true);
6113
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6112
+		$filter_query = $this->getFilter($filters, true, true);
6113
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6114 6114
 		if ($globalTimezone != '') {
6115 6115
 			date_default_timezone_set($globalTimezone);
6116 6116
 			$datetime = new DateTime($date);
@@ -6118,12 +6118,12 @@  discard block
 block discarded – undo
6118 6118
 		} else $offset = '+00:00';
6119 6119
 
6120 6120
 		if ($globalDBdriver == 'mysql') {
6121
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6121
+			$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6122 6122
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
6123 6123
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6124 6124
 					ORDER BY airport_departure_icao_count DESC";
6125 6125
 		} else {
6126
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6126
+			$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6127 6127
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
6128 6128
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6129 6129
 					ORDER BY airport_departure_icao_count DESC";
@@ -6135,7 +6135,7 @@  discard block
 block discarded – undo
6135 6135
 		$airport_array = array();
6136 6136
 		$temp_array = array();
6137 6137
         
6138
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6138
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6139 6139
 		{
6140 6140
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6141 6141
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6156,11 +6156,11 @@  discard block
 block discarded – undo
6156 6156
 	* @return Array the airport list
6157 6157
 	*
6158 6158
 	*/
6159
-	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6159
+	public function countAllDepartureAirportCountriesByDate($date, $filters = array())
6160 6160
 	{
6161 6161
 		global $globalTimezone, $globalDBdriver;
6162
-		$filter_query = $this->getFilter($filters,true,true);
6163
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6162
+		$filter_query = $this->getFilter($filters, true, true);
6163
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6164 6164
 		if ($globalTimezone != '') {
6165 6165
 			date_default_timezone_set($globalTimezone);
6166 6166
 			$datetime = new DateTime($date);
@@ -6168,12 +6168,12 @@  discard block
 block discarded – undo
6168 6168
 		} else $offset = '+00:00';
6169 6169
 
6170 6170
 		if ($globalDBdriver == 'mysql') {
6171
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6171
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6172 6172
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
6173 6173
 					GROUP BY spotter_output.departure_airport_country
6174 6174
 					ORDER BY airport_departure_country_count DESC";
6175 6175
 		} else {
6176
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6176
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6177 6177
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
6178 6178
 					GROUP BY spotter_output.departure_airport_country
6179 6179
 					ORDER BY airport_departure_country_count DESC";
@@ -6185,7 +6185,7 @@  discard block
 block discarded – undo
6185 6185
 		$airport_array = array();
6186 6186
 		$temp_array = array();
6187 6187
         
6188
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6188
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6189 6189
 		{
6190 6190
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6191 6191
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6203,11 +6203,11 @@  discard block
 block discarded – undo
6203 6203
 	* @return Array the airport list
6204 6204
 	*
6205 6205
 	*/
6206
-	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6206
+	public function countAllDepartureAirportsByIdent($ident, $filters = array())
6207 6207
 	{
6208
-		$filter_query = $this->getFilter($filters,true,true);
6209
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6210
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6208
+		$filter_query = $this->getFilter($filters, true, true);
6209
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6210
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6211 6211
 		    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.ident = :ident 
6212 6212
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6213 6213
 		    ORDER BY airport_departure_icao_count DESC";
@@ -6219,7 +6219,7 @@  discard block
 block discarded – undo
6219 6219
 		$airport_array = array();
6220 6220
 		$temp_array = array();
6221 6221
         
6222
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6222
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6223 6223
 		{
6224 6224
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6225 6225
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6241,11 +6241,11 @@  discard block
 block discarded – undo
6241 6241
 	* @return Array the airport list
6242 6242
 	*
6243 6243
 	*/
6244
-	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
6244
+	public function countAllDepartureAirportCountriesByIdent($ident, $filters = array())
6245 6245
 	{
6246
-		$filter_query = $this->getFilter($filters,true,true);
6247
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6248
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6246
+		$filter_query = $this->getFilter($filters, true, true);
6247
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6248
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6249 6249
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident 
6250 6250
                     GROUP BY spotter_output.departure_airport_country
6251 6251
 					ORDER BY airport_departure_country_count DESC";
@@ -6257,7 +6257,7 @@  discard block
 block discarded – undo
6257 6257
 		$airport_array = array();
6258 6258
 		$temp_array = array();
6259 6259
         
6260
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6260
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6261 6261
 		{
6262 6262
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6263 6263
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6276,12 +6276,12 @@  discard block
 block discarded – undo
6276 6276
 	* @return Array the airport list
6277 6277
 	*
6278 6278
 	*/
6279
-	public function countAllDepartureAirportsByCountry($country,$filters = array())
6279
+	public function countAllDepartureAirportsByCountry($country, $filters = array())
6280 6280
 	{
6281
-		$filter_query = $this->getFilter($filters,true,true);
6282
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6281
+		$filter_query = $this->getFilter($filters, true, true);
6282
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6283 6283
 
6284
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6284
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6285 6285
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
6286 6286
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6287 6287
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6293,7 +6293,7 @@  discard block
 block discarded – undo
6293 6293
 		$airport_array = array();
6294 6294
 		$temp_array = array();
6295 6295
         
6296
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6296
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6297 6297
 		{
6298 6298
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6299 6299
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6314,11 +6314,11 @@  discard block
 block discarded – undo
6314 6314
 	* @return Array the airport list
6315 6315
 	*
6316 6316
 	*/
6317
-	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
6317
+	public function countAllDepartureAirportCountriesByCountry($country, $filters = array())
6318 6318
 	{
6319
-		$filter_query = $this->getFilter($filters,true,true);
6320
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6321
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6319
+		$filter_query = $this->getFilter($filters, true, true);
6320
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6321
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6322 6322
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
6323 6323
                     GROUP BY spotter_output.departure_airport_country
6324 6324
 					ORDER BY airport_departure_country_count DESC";
@@ -6330,7 +6330,7 @@  discard block
 block discarded – undo
6330 6330
 		$airport_array = array();
6331 6331
 		$temp_array = array();
6332 6332
         
6333
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6333
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6334 6334
 		{
6335 6335
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6336 6336
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6348,11 +6348,11 @@  discard block
 block discarded – undo
6348 6348
 	* @return Array the airport list
6349 6349
 	*
6350 6350
 	*/
6351
-	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6351
+	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6352 6352
 	{
6353 6353
 		global $globalDBdriver;
6354
-		$filter_query = $this->getFilter($filters,true,true);
6355
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6354
+		$filter_query = $this->getFilter($filters, true, true);
6355
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6356 6356
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
6357 6357
                 if ($olderthanmonths > 0) {
6358 6358
             		if ($globalDBdriver == 'mysql') {
@@ -6387,7 +6387,7 @@  discard block
 block discarded – undo
6387 6387
 		$airport_array = array();
6388 6388
 		$temp_array = array();
6389 6389
         
6390
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6390
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6391 6391
 		{
6392 6392
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6393 6393
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6410,11 +6410,11 @@  discard block
 block discarded – undo
6410 6410
 	* @return Array the airport list
6411 6411
 	*
6412 6412
 	*/
6413
-	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6413
+	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6414 6414
 	{
6415 6415
 		global $globalDBdriver;
6416
-		$filter_query = $this->getFilter($filters,true,true);
6417
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6416
+		$filter_query = $this->getFilter($filters, true, true);
6417
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6418 6418
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' ";
6419 6419
                 if ($olderthanmonths > 0) {
6420 6420
             		if ($globalDBdriver == 'mysql') {
@@ -6449,7 +6449,7 @@  discard block
 block discarded – undo
6449 6449
 		$airport_array = array();
6450 6450
 		$temp_array = array();
6451 6451
         
6452
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6452
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6453 6453
 		{
6454 6454
 			$temp_array['airline_icao'] = $row['airline_icao'];
6455 6455
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
@@ -6474,11 +6474,11 @@  discard block
 block discarded – undo
6474 6474
 	* @return Array the airport list
6475 6475
 	*
6476 6476
 	*/
6477
-	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6477
+	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6478 6478
 	{
6479 6479
 		global $globalDBdriver;
6480
-		$filter_query = $this->getFilter($filters,true,true);
6481
-		$query  = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
6480
+		$filter_query = $this->getFilter($filters, true, true);
6481
+		$query = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
6482 6482
 			FROM airport,spotter_output".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao";
6483 6483
                 if ($olderthanmonths > 0) {
6484 6484
             		if ($globalDBdriver == 'mysql') {
@@ -6512,7 +6512,7 @@  discard block
 block discarded – undo
6512 6512
 		$airport_array = array();
6513 6513
 		$temp_array = array();
6514 6514
         
6515
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6515
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6516 6516
 		{
6517 6517
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6518 6518
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6535,11 +6535,11 @@  discard block
 block discarded – undo
6535 6535
 	* @return Array the airport list
6536 6536
 	*
6537 6537
 	*/
6538
-	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6538
+	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6539 6539
 	{
6540 6540
 		global $globalDBdriver;
6541
-		$filter_query = $this->getFilter($filters,true,true);
6542
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
6541
+		$filter_query = $this->getFilter($filters, true, true);
6542
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
6543 6543
 			FROM airport,spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao ";
6544 6544
                 if ($olderthanmonths > 0) {
6545 6545
             		if ($globalDBdriver == 'mysql') {
@@ -6574,7 +6574,7 @@  discard block
 block discarded – undo
6574 6574
 		$airport_array = array();
6575 6575
 		$temp_array = array();
6576 6576
         
6577
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6577
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6578 6578
 		{
6579 6579
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6580 6580
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6600,9 +6600,9 @@  discard block
 block discarded – undo
6600 6600
 	*/
6601 6601
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
6602 6602
 	{
6603
-		$filter_query = $this->getFilter($filters,true,true);
6604
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6605
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6603
+		$filter_query = $this->getFilter($filters, true, true);
6604
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6605
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6606 6606
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao 
6607 6607
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6608 6608
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -6613,7 +6613,7 @@  discard block
 block discarded – undo
6613 6613
 		$airport_array = array();
6614 6614
 		$temp_array = array();
6615 6615
         
6616
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6616
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6617 6617
 		{
6618 6618
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6619 6619
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6634,12 +6634,12 @@  discard block
 block discarded – undo
6634 6634
 	* @return Array the airport list
6635 6635
 	*
6636 6636
 	*/
6637
-	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
6637
+	public function countAllArrivalAirportCountriesByAirline($airline_icao, $filters = array())
6638 6638
 	{
6639
-		$filter_query = $this->getFilter($filters,true,true);
6640
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6639
+		$filter_query = $this->getFilter($filters, true, true);
6640
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6641 6641
 					
6642
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6642
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6643 6643
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
6644 6644
                     GROUP BY spotter_output.arrival_airport_country
6645 6645
 					ORDER BY airport_arrival_country_count DESC";
@@ -6651,7 +6651,7 @@  discard block
 block discarded – undo
6651 6651
 		$airport_array = array();
6652 6652
 		$temp_array = array();
6653 6653
         
6654
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6654
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6655 6655
 		{
6656 6656
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6657 6657
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6669,11 +6669,11 @@  discard block
 block discarded – undo
6669 6669
 	* @return Array the airport list
6670 6670
 	*
6671 6671
 	*/
6672
-	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
6672
+	public function countAllArrivalAirportsByAircraft($aircraft_icao, $filters = array())
6673 6673
 	{
6674
-		$filter_query = $this->getFilter($filters,true,true);
6675
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6676
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6674
+		$filter_query = $this->getFilter($filters, true, true);
6675
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6676
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6677 6677
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao 
6678 6678
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6679 6679
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -6685,7 +6685,7 @@  discard block
 block discarded – undo
6685 6685
 		$airport_array = array();
6686 6686
 		$temp_array = array();
6687 6687
         
6688
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6688
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6689 6689
 		{
6690 6690
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6691 6691
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6707,11 +6707,11 @@  discard block
 block discarded – undo
6707 6707
 	* @return Array the airport list
6708 6708
 	*
6709 6709
 	*/
6710
-	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
6710
+	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao, $filters = array())
6711 6711
 	{
6712
-		$filter_query = $this->getFilter($filters,true,true);
6713
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6714
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6712
+		$filter_query = $this->getFilter($filters, true, true);
6713
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6714
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6715 6715
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
6716 6716
                     GROUP BY spotter_output.arrival_airport_country
6717 6717
 					ORDER BY airport_arrival_country_count DESC";
@@ -6723,7 +6723,7 @@  discard block
 block discarded – undo
6723 6723
 		$airport_array = array();
6724 6724
 		$temp_array = array();
6725 6725
         
6726
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6726
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6727 6727
 		{
6728 6728
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6729 6729
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6741,12 +6741,12 @@  discard block
 block discarded – undo
6741 6741
 	* @return Array the airport list
6742 6742
 	*
6743 6743
 	*/
6744
-	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
6744
+	public function countAllArrivalAirportsByRegistration($registration, $filters = array())
6745 6745
 	{
6746
-		$filter_query = $this->getFilter($filters,true,true);
6747
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6746
+		$filter_query = $this->getFilter($filters, true, true);
6747
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6748 6748
 
6749
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6749
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6750 6750
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.registration = :registration 
6751 6751
                     GROUP BY spotter_output.arrival_airport_icao
6752 6752
 					ORDER BY airport_arrival_icao_count DESC";
@@ -6758,7 +6758,7 @@  discard block
 block discarded – undo
6758 6758
 		$airport_array = array();
6759 6759
 		$temp_array = array();
6760 6760
         
6761
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6761
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6762 6762
 		{
6763 6763
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6764 6764
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6779,11 +6779,11 @@  discard block
 block discarded – undo
6779 6779
 	* @return Array the airport list
6780 6780
 	*
6781 6781
 	*/
6782
-	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
6782
+	public function countAllArrivalAirportCountriesByRegistration($registration, $filters = array())
6783 6783
 	{
6784
-		$filter_query = $this->getFilter($filters,true,true);
6785
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6786
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6784
+		$filter_query = $this->getFilter($filters, true, true);
6785
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6786
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6787 6787
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration 
6788 6788
                     GROUP BY spotter_output.arrival_airport_country
6789 6789
 					ORDER BY airport_arrival_country_count DESC";
@@ -6795,7 +6795,7 @@  discard block
 block discarded – undo
6795 6795
 		$airport_array = array();
6796 6796
 		$temp_array = array();
6797 6797
         
6798
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6798
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6799 6799
 		{
6800 6800
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6801 6801
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6814,11 +6814,11 @@  discard block
 block discarded – undo
6814 6814
 	* @return Array the airport list
6815 6815
 	*
6816 6816
 	*/
6817
-	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
6817
+	public function countAllArrivalAirportsByAirport($airport_icao, $filters = array())
6818 6818
 	{
6819
-		$filter_query = $this->getFilter($filters,true,true);
6820
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6821
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6819
+		$filter_query = $this->getFilter($filters, true, true);
6820
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6821
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6822 6822
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.departure_airport_icao = :airport_icao 
6823 6823
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6824 6824
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -6830,7 +6830,7 @@  discard block
 block discarded – undo
6830 6830
 		$airport_array = array();
6831 6831
 		$temp_array = array();
6832 6832
         
6833
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6833
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6834 6834
 		{
6835 6835
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6836 6836
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6851,11 +6851,11 @@  discard block
 block discarded – undo
6851 6851
 	* @return Array the airport list
6852 6852
 	*
6853 6853
 	*/
6854
-	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
6854
+	public function countAllArrivalAirportCountriesByAirport($airport_icao, $filters = array())
6855 6855
 	{
6856
-		$filter_query = $this->getFilter($filters,true,true);
6857
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6858
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6856
+		$filter_query = $this->getFilter($filters, true, true);
6857
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6858
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6859 6859
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao 
6860 6860
                     GROUP BY spotter_output.arrival_airport_country
6861 6861
 					ORDER BY airport_arrival_country_count DESC";
@@ -6867,7 +6867,7 @@  discard block
 block discarded – undo
6867 6867
 		$airport_array = array();
6868 6868
 		$temp_array = array();
6869 6869
         
6870
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6870
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6871 6871
 		{
6872 6872
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6873 6873
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6885,11 +6885,11 @@  discard block
 block discarded – undo
6885 6885
 	* @return Array the airport list
6886 6886
 	*
6887 6887
 	*/
6888
-	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6888
+	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer, $filters = array())
6889 6889
 	{
6890
-		$filter_query = $this->getFilter($filters,true,true);
6891
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6892
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6890
+		$filter_query = $this->getFilter($filters, true, true);
6891
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6892
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6893 6893
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6894 6894
                     GROUP BY spotter_output.arrival_airport_icao
6895 6895
 					ORDER BY airport_arrival_icao_count DESC";
@@ -6901,7 +6901,7 @@  discard block
 block discarded – undo
6901 6901
 		$airport_array = array();
6902 6902
 		$temp_array = array();
6903 6903
         
6904
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6904
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6905 6905
 		{
6906 6906
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6907 6907
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6923,11 +6923,11 @@  discard block
 block discarded – undo
6923 6923
 	* @return Array the airport list
6924 6924
 	*
6925 6925
 	*/
6926
-	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6926
+	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
6927 6927
 	{
6928
-		$filter_query = $this->getFilter($filters,true,true);
6929
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6930
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6928
+		$filter_query = $this->getFilter($filters, true, true);
6929
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6930
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6931 6931
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6932 6932
                     GROUP BY spotter_output.arrival_airport_country
6933 6933
 					ORDER BY airport_arrival_country_count DESC";
@@ -6939,7 +6939,7 @@  discard block
 block discarded – undo
6939 6939
 		$airport_array = array();
6940 6940
 		$temp_array = array();
6941 6941
         
6942
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6942
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6943 6943
 		{
6944 6944
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6945 6945
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6958,11 +6958,11 @@  discard block
 block discarded – undo
6958 6958
 	* @return Array the airport list
6959 6959
 	*
6960 6960
 	*/
6961
-	public function countAllArrivalAirportsByDate($date,$filters = array())
6961
+	public function countAllArrivalAirportsByDate($date, $filters = array())
6962 6962
 	{
6963 6963
 		global $globalTimezone, $globalDBdriver;
6964
-		$filter_query = $this->getFilter($filters,true,true);
6965
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6964
+		$filter_query = $this->getFilter($filters, true, true);
6965
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6966 6966
 		if ($globalTimezone != '') {
6967 6967
 			date_default_timezone_set($globalTimezone);
6968 6968
 			$datetime = new DateTime($date);
@@ -6970,12 +6970,12 @@  discard block
 block discarded – undo
6970 6970
 		} else $offset = '+00:00';
6971 6971
 
6972 6972
 		if ($globalDBdriver == 'mysql') {
6973
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6973
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6974 6974
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
6975 6975
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6976 6976
 					ORDER BY airport_arrival_icao_count DESC";
6977 6977
 		} else {
6978
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6978
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6979 6979
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
6980 6980
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6981 6981
 					ORDER BY airport_arrival_icao_count DESC";
@@ -6987,7 +6987,7 @@  discard block
 block discarded – undo
6987 6987
 		$airport_array = array();
6988 6988
 		$temp_array = array();
6989 6989
         
6990
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6990
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6991 6991
 		{
6992 6992
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6993 6993
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7011,8 +7011,8 @@  discard block
 block discarded – undo
7011 7011
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
7012 7012
 	{
7013 7013
 		global $globalTimezone, $globalDBdriver;
7014
-		$filter_query = $this->getFilter($filters,true,true);
7015
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7014
+		$filter_query = $this->getFilter($filters, true, true);
7015
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7016 7016
 		if ($globalTimezone != '') {
7017 7017
 			date_default_timezone_set($globalTimezone);
7018 7018
 			$datetime = new DateTime($date);
@@ -7020,12 +7020,12 @@  discard block
 block discarded – undo
7020 7020
 		} else $offset = '+00:00';
7021 7021
 
7022 7022
 		if ($globalDBdriver == 'mysql') {
7023
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7023
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7024 7024
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
7025 7025
 					GROUP BY spotter_output.arrival_airport_country
7026 7026
 					ORDER BY airport_arrival_country_count DESC";
7027 7027
 		} else {
7028
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7028
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7029 7029
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
7030 7030
 					GROUP BY spotter_output.arrival_airport_country
7031 7031
 					ORDER BY airport_arrival_country_count DESC";
@@ -7037,7 +7037,7 @@  discard block
 block discarded – undo
7037 7037
 		$airport_array = array();
7038 7038
 		$temp_array = array();
7039 7039
         
7040
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7040
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7041 7041
 		{
7042 7042
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7043 7043
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7055,11 +7055,11 @@  discard block
 block discarded – undo
7055 7055
 	* @return Array the airport list
7056 7056
 	*
7057 7057
 	*/
7058
-	public function countAllArrivalAirportsByIdent($ident,$filters = array())
7058
+	public function countAllArrivalAirportsByIdent($ident, $filters = array())
7059 7059
 	{
7060
-		$filter_query = $this->getFilter($filters,true,true);
7061
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7062
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7060
+		$filter_query = $this->getFilter($filters, true, true);
7061
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7062
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7063 7063
 		    FROM spotter_output".$filter_query." WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.ident = :ident  
7064 7064
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7065 7065
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -7071,7 +7071,7 @@  discard block
 block discarded – undo
7071 7071
 		$airport_array = array();
7072 7072
 		$temp_array = array();
7073 7073
         
7074
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7074
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7075 7075
 		{
7076 7076
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7077 7077
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7094,9 +7094,9 @@  discard block
 block discarded – undo
7094 7094
 	*/
7095 7095
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
7096 7096
 	{
7097
-		$filter_query = $this->getFilter($filters,true,true);
7098
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7099
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7097
+		$filter_query = $this->getFilter($filters, true, true);
7098
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7099
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7100 7100
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident 
7101 7101
                     GROUP BY spotter_output.arrival_airport_country
7102 7102
 					ORDER BY airport_arrival_country_count DESC";
@@ -7108,7 +7108,7 @@  discard block
 block discarded – undo
7108 7108
 		$airport_array = array();
7109 7109
 		$temp_array = array();
7110 7110
         
7111
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7111
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7112 7112
 		{
7113 7113
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7114 7114
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7127,11 +7127,11 @@  discard block
 block discarded – undo
7127 7127
 	* @return Array the airport list
7128 7128
 	*
7129 7129
 	*/
7130
-	public function countAllArrivalAirportsByCountry($country,$filters = array())
7130
+	public function countAllArrivalAirportsByCountry($country, $filters = array())
7131 7131
 	{
7132
-		$filter_query = $this->getFilter($filters,true,true);
7133
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7134
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7132
+		$filter_query = $this->getFilter($filters, true, true);
7133
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7134
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7135 7135
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
7136 7136
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7137 7137
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7143,7 +7143,7 @@  discard block
 block discarded – undo
7143 7143
 		$airport_array = array();
7144 7144
 		$temp_array = array();
7145 7145
         
7146
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7146
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7147 7147
 		{
7148 7148
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7149 7149
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7164,11 +7164,11 @@  discard block
 block discarded – undo
7164 7164
 	* @return Array the airport list
7165 7165
 	*
7166 7166
 	*/
7167
-	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
7167
+	public function countAllArrivalAirportCountriesByCountry($country, $filters = array())
7168 7168
 	{
7169
-		$filter_query = $this->getFilter($filters,true,true);
7170
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7171
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7169
+		$filter_query = $this->getFilter($filters, true, true);
7170
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7171
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7172 7172
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
7173 7173
                     GROUP BY spotter_output.arrival_airport_country
7174 7174
 					ORDER BY airport_arrival_country_count DESC";
@@ -7180,7 +7180,7 @@  discard block
 block discarded – undo
7180 7180
 		$airport_array = array();
7181 7181
 		$temp_array = array();
7182 7182
         
7183
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7183
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7184 7184
 		{
7185 7185
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7186 7186
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7201,7 +7201,7 @@  discard block
 block discarded – undo
7201 7201
 	*/
7202 7202
 	public function countAllDepartureCountries($filters = array())
7203 7203
 	{
7204
-		$filter_query = $this->getFilter($filters,true,true);
7204
+		$filter_query = $this->getFilter($filters, true, true);
7205 7205
 		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7206 7206
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA'";
7207 7207
 		$query .= " GROUP BY spotter_output.departure_airport_country
@@ -7215,7 +7215,7 @@  discard block
 block discarded – undo
7215 7215
 		$airport_array = array();
7216 7216
 		$temp_array = array();
7217 7217
         
7218
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7218
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7219 7219
 		{
7220 7220
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
7221 7221
 			$temp_array['airport_departure_country'] = $row['departure_airport_country'];
@@ -7233,9 +7233,9 @@  discard block
 block discarded – undo
7233 7233
 	* @return Array the airport arrival list
7234 7234
 	*
7235 7235
 	*/
7236
-	public function countAllArrivalCountries($limit = true,$filters = array())
7236
+	public function countAllArrivalCountries($limit = true, $filters = array())
7237 7237
 	{
7238
-		$filter_query = $this->getFilter($filters,true,true);
7238
+		$filter_query = $this->getFilter($filters, true, true);
7239 7239
 		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7240 7240
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
7241 7241
 		$query .= " GROUP BY spotter_output.arrival_airport_country
@@ -7249,7 +7249,7 @@  discard block
 block discarded – undo
7249 7249
 		$airport_array = array();
7250 7250
 		$temp_array = array();
7251 7251
         
7252
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7252
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7253 7253
 		{
7254 7254
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
7255 7255
 			$temp_array['airport_arrival_country'] = $row['arrival_airport_country'];
@@ -7272,8 +7272,8 @@  discard block
 block discarded – undo
7272 7272
 	*/
7273 7273
 	public function countAllRoutes($filters = array())
7274 7274
 	{
7275
-		$filter_query = $this->getFilter($filters,true,true);
7276
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7275
+		$filter_query = $this->getFilter($filters, true, true);
7276
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7277 7277
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> 'NA'
7278 7278
                     GROUP BY route,spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7279 7279
                     ORDER BY route_count DESC
@@ -7286,7 +7286,7 @@  discard block
 block discarded – undo
7286 7286
 		$routes_array = array();
7287 7287
 		$temp_array = array();
7288 7288
         
7289
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7289
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7290 7290
 		{
7291 7291
 			$temp_array['route_count'] = $row['route_count'];
7292 7292
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7313,11 +7313,11 @@  discard block
 block discarded – undo
7313 7313
 	* @return Array the route list
7314 7314
 	*
7315 7315
 	*/
7316
-	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
7316
+	public function countAllRoutesByAircraft($aircraft_icao, $filters = array())
7317 7317
 	{
7318
-		$filter_query = $this->getFilter($filters,true,true);
7319
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7320
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7318
+		$filter_query = $this->getFilter($filters, true, true);
7319
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7320
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7321 7321
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
7322 7322
 			    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7323 7323
 			    ORDER BY route_count DESC";
@@ -7328,7 +7328,7 @@  discard block
 block discarded – undo
7328 7328
 		$routes_array = array();
7329 7329
 		$temp_array = array();
7330 7330
         
7331
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7331
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7332 7332
 		{
7333 7333
 			$temp_array['route_count'] = $row['route_count'];
7334 7334
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7355,9 +7355,9 @@  discard block
 block discarded – undo
7355 7355
 	*/
7356 7356
 	public function countAllRoutesByRegistration($registration, $filters = array())
7357 7357
 	{
7358
-		$filter_query = $this->getFilter($filters,true,true);
7358
+		$filter_query = $this->getFilter($filters, true, true);
7359 7359
 		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7360
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7360
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7361 7361
 			FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.registration = :registration 
7362 7362
                     GROUP BY route
7363 7363
                     ORDER BY route_count DESC";
@@ -7369,7 +7369,7 @@  discard block
 block discarded – undo
7369 7369
 		$routes_array = array();
7370 7370
 		$temp_array = array();
7371 7371
         
7372
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7372
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7373 7373
 		{
7374 7374
 			$temp_array['route_count'] = $row['route_count'];
7375 7375
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7397,9 +7397,9 @@  discard block
 block discarded – undo
7397 7397
 	*/
7398 7398
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
7399 7399
 	{
7400
-		$filter_query = $this->getFilter($filters,true,true);
7401
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7402
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7400
+		$filter_query = $this->getFilter($filters, true, true);
7401
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7402
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7403 7403
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao 
7404 7404
 			    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7405 7405
 			    ORDER BY route_count DESC";
@@ -7411,7 +7411,7 @@  discard block
 block discarded – undo
7411 7411
 		$routes_array = array();
7412 7412
 		$temp_array = array();
7413 7413
         
7414
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7414
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7415 7415
 		{
7416 7416
 			$temp_array['route_count'] = $row['route_count'];
7417 7417
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7439,9 +7439,9 @@  discard block
 block discarded – undo
7439 7439
 	*/
7440 7440
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
7441 7441
 	{
7442
-		$filter_query = $this->getFilter($filters,true,true);
7443
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7444
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7442
+		$filter_query = $this->getFilter($filters, true, true);
7443
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7444
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7445 7445
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
7446 7446
 			    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7447 7447
 			    ORDER BY route_count DESC";
@@ -7452,7 +7452,7 @@  discard block
 block discarded – undo
7452 7452
 		$routes_array = array();
7453 7453
 		$temp_array = array();
7454 7454
         
7455
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7455
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7456 7456
 		{
7457 7457
 			$temp_array['route_count'] = $row['route_count'];
7458 7458
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7480,9 +7480,9 @@  discard block
 block discarded – undo
7480 7480
 	*/
7481 7481
 	public function countAllRoutesByCountry($country, $filters = array())
7482 7482
 	{
7483
-		$filter_query = $this->getFilter($filters,true,true);
7484
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7485
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7483
+		$filter_query = $this->getFilter($filters, true, true);
7484
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7485
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7486 7486
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
7487 7487
 			    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7488 7488
 			    ORDER BY route_count DESC";
@@ -7493,7 +7493,7 @@  discard block
 block discarded – undo
7493 7493
 		$routes_array = array();
7494 7494
 		$temp_array = array();
7495 7495
         
7496
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7496
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7497 7497
 		{
7498 7498
 			$temp_array['route_count'] = $row['route_count'];
7499 7499
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7521,8 +7521,8 @@  discard block
 block discarded – undo
7521 7521
 	public function countAllRoutesByDate($date, $filters = array())
7522 7522
 	{
7523 7523
 		global $globalTimezone, $globalDBdriver;
7524
-		$filter_query = $this->getFilter($filters,true,true);
7525
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7524
+		$filter_query = $this->getFilter($filters, true, true);
7525
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7526 7526
 		if ($globalTimezone != '') {
7527 7527
 			date_default_timezone_set($globalTimezone);
7528 7528
 			$datetime = new DateTime($date);
@@ -7530,12 +7530,12 @@  discard block
 block discarded – undo
7530 7530
 		} else $offset = '+00:00';
7531 7531
 		
7532 7532
 		if ($globalDBdriver == 'mysql') {
7533
-			$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7533
+			$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7534 7534
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
7535 7535
 				    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7536 7536
 				    ORDER BY route_count DESC";
7537 7537
 		} else {
7538
-			$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7538
+			$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7539 7539
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
7540 7540
 				    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7541 7541
 				    ORDER BY route_count DESC";
@@ -7547,7 +7547,7 @@  discard block
 block discarded – undo
7547 7547
 		$routes_array = array();
7548 7548
 		$temp_array = array();
7549 7549
         
7550
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7550
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7551 7551
 		{
7552 7552
 			$temp_array['route_count'] = $row['route_count'];
7553 7553
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7574,9 +7574,9 @@  discard block
 block discarded – undo
7574 7574
 	*/
7575 7575
 	public function countAllRoutesByIdent($ident, $filters = array())
7576 7576
 	{
7577
-		$filter_query = $this->getFilter($filters,true,true);
7578
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7579
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7577
+		$filter_query = $this->getFilter($filters, true, true);
7578
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7579
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7580 7580
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.ident = :ident   
7581 7581
                     GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7582 7582
                     ORDER BY route_count DESC";
@@ -7588,7 +7588,7 @@  discard block
 block discarded – undo
7588 7588
 		$routes_array = array();
7589 7589
 		$temp_array = array();
7590 7590
         
7591
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7591
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7592 7592
 		{
7593 7593
 			$temp_array['route_count'] = $row['route_count'];
7594 7594
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7615,9 +7615,9 @@  discard block
 block discarded – undo
7615 7615
 	*/
7616 7616
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
7617 7617
 	{
7618
-		$filter_query = $this->getFilter($filters,true,true);
7619
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7620
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7618
+		$filter_query = $this->getFilter($filters, true, true);
7619
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7620
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7621 7621
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
7622 7622
                     GROUP BY route
7623 7623
                     ORDER BY route_count DESC";
@@ -7629,7 +7629,7 @@  discard block
 block discarded – undo
7629 7629
 		$routes_array = array();
7630 7630
 		$temp_array = array();
7631 7631
         
7632
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7632
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7633 7633
 		{
7634 7634
 			$temp_array['route_count'] = $row['route_count'];
7635 7635
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7657,8 +7657,8 @@  discard block
 block discarded – undo
7657 7657
 	*/
7658 7658
 	public function countAllRoutesWithWaypoints($filters = array())
7659 7659
 	{
7660
-		$filter_query = $this->getFilter($filters,true,true);
7661
-		$query  = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7660
+		$filter_query = $this->getFilter($filters, true, true);
7661
+		$query = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7662 7662
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.waypoints <> '' 
7663 7663
                     GROUP BY route, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7664 7664
                     ORDER BY route_count DESC
@@ -7671,7 +7671,7 @@  discard block
 block discarded – undo
7671 7671
 		$routes_array = array();
7672 7672
 		$temp_array = array();
7673 7673
         
7674
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7674
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7675 7675
 		{
7676 7676
 			$temp_array['spotter_id'] = $row['spotter_id'];
7677 7677
 			$temp_array['route_count'] = $row['route_count'];
@@ -7696,11 +7696,11 @@  discard block
 block discarded – undo
7696 7696
 	* @return Array the callsign list
7697 7697
 	*
7698 7698
 	*/
7699
-	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
7699
+	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7700 7700
 	{
7701 7701
 		global $globalDBdriver;
7702
-		$filter_query = $this->getFilter($filters,true,true);
7703
-		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7702
+		$filter_query = $this->getFilter($filters, true, true);
7703
+		$query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7704 7704
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
7705 7705
 		 if ($olderthanmonths > 0) {
7706 7706
 			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
@@ -7719,7 +7719,7 @@  discard block
 block discarded – undo
7719 7719
 		$callsign_array = array();
7720 7720
 		$temp_array = array();
7721 7721
         
7722
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7722
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7723 7723
 		{
7724 7724
 			$temp_array['callsign_icao'] = $row['ident'];
7725 7725
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -7741,8 +7741,8 @@  discard block
 block discarded – undo
7741 7741
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7742 7742
 	{
7743 7743
 		global $globalDBdriver;
7744
-		$filter_query = $this->getFilter($filters,true,true);
7745
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7744
+		$filter_query = $this->getFilter($filters, true, true);
7745
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7746 7746
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
7747 7747
 		 if ($olderthanmonths > 0) {
7748 7748
 			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
@@ -7761,7 +7761,7 @@  discard block
 block discarded – undo
7761 7761
 		$callsign_array = array();
7762 7762
 		$temp_array = array();
7763 7763
         
7764
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7764
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7765 7765
 		{
7766 7766
 			$temp_array['callsign_icao'] = $row['ident'];
7767 7767
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -7815,7 +7815,7 @@  discard block
 block discarded – undo
7815 7815
 		$date_array = array();
7816 7816
 		$temp_array = array();
7817 7817
         
7818
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7818
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7819 7819
 		{
7820 7820
 			$temp_array['date_name'] = $row['date_name'];
7821 7821
 			$temp_array['date_count'] = $row['date_count'];
@@ -7840,15 +7840,15 @@  discard block
 block discarded – undo
7840 7840
 			$datetime = new DateTime();
7841 7841
 			$offset = $datetime->format('P');
7842 7842
 		} else $offset = '+00:00';
7843
-		$filter_query = $this->getFilter($filters,true,true);
7843
+		$filter_query = $this->getFilter($filters, true, true);
7844 7844
 		if ($globalDBdriver == 'mysql') {
7845
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7845
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7846 7846
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
7847 7847
 								GROUP BY spotter_output.airline_icao, date_name 
7848 7848
 								ORDER BY date_count DESC
7849 7849
 								LIMIT 10 OFFSET 0";
7850 7850
 		} else {
7851
-			$query  = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
7851
+			$query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
7852 7852
 								FROM spotter_output 
7853 7853
 								WHERE spotter_output.airline_icao <> '' 
7854 7854
 								GROUP BY spotter_output.airline_icao, date_name 
@@ -7863,7 +7863,7 @@  discard block
 block discarded – undo
7863 7863
 		$date_array = array();
7864 7864
 		$temp_array = array();
7865 7865
         
7866
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7866
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7867 7867
 		{
7868 7868
 			$temp_array['date_name'] = $row['date_name'];
7869 7869
 			$temp_array['date_count'] = $row['date_count'];
@@ -7889,7 +7889,7 @@  discard block
 block discarded – undo
7889 7889
 			$datetime = new DateTime();
7890 7890
 			$offset = $datetime->format('P');
7891 7891
 		} else $offset = '+00:00';
7892
-		$filter_query = $this->getFilter($filters,true,true);
7892
+		$filter_query = $this->getFilter($filters, true, true);
7893 7893
 		if ($globalDBdriver == 'mysql') {
7894 7894
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7895 7895
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -7910,7 +7910,7 @@  discard block
 block discarded – undo
7910 7910
 		$date_array = array();
7911 7911
 		$temp_array = array();
7912 7912
         
7913
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7913
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7914 7914
 		{
7915 7915
 			$temp_array['date_name'] = $row['date_name'];
7916 7916
 			$temp_array['date_count'] = $row['date_count'];
@@ -7935,7 +7935,7 @@  discard block
 block discarded – undo
7935 7935
 			$datetime = new DateTime();
7936 7936
 			$offset = $datetime->format('P');
7937 7937
 		} else $offset = '+00:00';
7938
-		$filter_query = $this->getFilter($filters,true,true);
7938
+		$filter_query = $this->getFilter($filters, true, true);
7939 7939
 		if ($globalDBdriver == 'mysql') {
7940 7940
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7941 7941
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)";
@@ -7956,7 +7956,7 @@  discard block
 block discarded – undo
7956 7956
 		$date_array = array();
7957 7957
 		$temp_array = array();
7958 7958
         
7959
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7959
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7960 7960
 		{
7961 7961
 			$temp_array['date_name'] = $row['date_name'];
7962 7962
 			$temp_array['date_count'] = $row['date_count'];
@@ -7977,7 +7977,7 @@  discard block
 block discarded – undo
7977 7977
 	public function countAllDatesLastMonthByAirlines($filters = array())
7978 7978
 	{
7979 7979
 		global $globalTimezone, $globalDBdriver;
7980
-		$filter_query = $this->getFilter($filters,true,true);
7980
+		$filter_query = $this->getFilter($filters, true, true);
7981 7981
 		if ($globalTimezone != '') {
7982 7982
 			date_default_timezone_set($globalTimezone);
7983 7983
 			$datetime = new DateTime();
@@ -7985,13 +7985,13 @@  discard block
 block discarded – undo
7985 7985
 		} else $offset = '+00:00';
7986 7986
 		
7987 7987
 		if ($globalDBdriver == 'mysql') {
7988
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7988
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7989 7989
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)
7990 7990
 								GROUP BY spotter_output.airline_icao, date_name 
7991 7991
 								ORDER BY spotter_output.date ASC";
7992 7992
 			$query_data = array(':offset' => $offset);
7993 7993
 		} else {
7994
-			$query  = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
7994
+			$query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
7995 7995
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS'
7996 7996
 								GROUP BY spotter_output.airline_icao, date_name 
7997 7997
 								ORDER BY date_name ASC";
@@ -8004,7 +8004,7 @@  discard block
 block discarded – undo
8004 8004
 		$date_array = array();
8005 8005
 		$temp_array = array();
8006 8006
         
8007
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8007
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8008 8008
 		{
8009 8009
 			$temp_array['date_name'] = $row['date_name'];
8010 8010
 			$temp_array['date_count'] = $row['date_count'];
@@ -8051,7 +8051,7 @@  discard block
 block discarded – undo
8051 8051
 		$date_array = array();
8052 8052
 		$temp_array = array();
8053 8053
         
8054
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8054
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8055 8055
 		{
8056 8056
 			$temp_array['month_name'] = $row['month_name'];
8057 8057
 			$temp_array['year_name'] = $row['year_name'];
@@ -8072,7 +8072,7 @@  discard block
 block discarded – undo
8072 8072
 	public function countAllMonthsByAirlines($filters = array())
8073 8073
 	{
8074 8074
 		global $globalTimezone, $globalDBdriver;
8075
-		$filter_query = $this->getFilter($filters,true,true);
8075
+		$filter_query = $this->getFilter($filters, true, true);
8076 8076
 		if ($globalTimezone != '') {
8077 8077
 			date_default_timezone_set($globalTimezone);
8078 8078
 			$datetime = new DateTime();
@@ -8080,12 +8080,12 @@  discard block
 block discarded – undo
8080 8080
 		} else $offset = '+00:00';
8081 8081
 
8082 8082
 		if ($globalDBdriver == 'mysql') {
8083
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
8083
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
8084 8084
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8085 8085
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
8086 8086
 								ORDER BY date_count DESC";
8087 8087
 		} else {
8088
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
8088
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
8089 8089
 								FROM spotter_output 
8090 8090
 								WHERE spotter_output.airline_icao <> '' 
8091 8091
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
@@ -8099,7 +8099,7 @@  discard block
 block discarded – undo
8099 8099
 		$date_array = array();
8100 8100
 		$temp_array = array();
8101 8101
         
8102
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8102
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8103 8103
 		{
8104 8104
 			$temp_array['month_name'] = $row['month_name'];
8105 8105
 			$temp_array['year_name'] = $row['year_name'];
@@ -8126,14 +8126,14 @@  discard block
 block discarded – undo
8126 8126
 			$datetime = new DateTime();
8127 8127
 			$offset = $datetime->format('P');
8128 8128
 		} else $offset = '+00:00';
8129
-		$filter_query = $this->getFilter($filters,true,true);
8129
+		$filter_query = $this->getFilter($filters, true, true);
8130 8130
 		if ($globalDBdriver == 'mysql') {
8131
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
8131
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
8132 8132
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
8133 8133
 								GROUP BY year_name, month_name 
8134 8134
 								ORDER BY date_count DESC";
8135 8135
 		} else {
8136
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
8136
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
8137 8137
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
8138 8138
 								GROUP BY year_name, month_name 
8139 8139
 								ORDER BY date_count DESC";
@@ -8145,7 +8145,7 @@  discard block
 block discarded – undo
8145 8145
 		$date_array = array();
8146 8146
 		$temp_array = array();
8147 8147
         
8148
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8148
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8149 8149
 		{
8150 8150
 			$temp_array['month_name'] = $row['month_name'];
8151 8151
 			$temp_array['year_name'] = $row['year_name'];
@@ -8171,15 +8171,15 @@  discard block
 block discarded – undo
8171 8171
 			$datetime = new DateTime();
8172 8172
 			$offset = $datetime->format('P');
8173 8173
 		} else $offset = '+00:00';
8174
-		$filter_query = $this->getFilter($filters,true,true);
8174
+		$filter_query = $this->getFilter($filters, true, true);
8175 8175
 
8176 8176
 		if ($globalDBdriver == 'mysql') {
8177
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
8177
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
8178 8178
 								FROM spotter_output".$filter_query." owner_name <> ''
8179 8179
 								GROUP BY year_name, month_name
8180 8180
 								ORDER BY date_count DESC";
8181 8181
 		} else {
8182
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
8182
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
8183 8183
 								FROM spotter_output".$filter_query." owner_name <> ''
8184 8184
 								GROUP BY year_name, month_name
8185 8185
 								ORDER BY date_count DESC";
@@ -8191,7 +8191,7 @@  discard block
 block discarded – undo
8191 8191
 		$date_array = array();
8192 8192
 		$temp_array = array();
8193 8193
         
8194
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8194
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8195 8195
 		{
8196 8196
 			$temp_array['month_name'] = $row['month_name'];
8197 8197
 			$temp_array['year_name'] = $row['year_name'];
@@ -8212,7 +8212,7 @@  discard block
 block discarded – undo
8212 8212
 	public function countAllMonthsOwnersByAirlines($filters = array())
8213 8213
 	{
8214 8214
 		global $globalTimezone, $globalDBdriver;
8215
-		$filter_query = $this->getFilter($filters,true,true);
8215
+		$filter_query = $this->getFilter($filters, true, true);
8216 8216
 		if ($globalTimezone != '') {
8217 8217
 			date_default_timezone_set($globalTimezone);
8218 8218
 			$datetime = new DateTime();
@@ -8220,12 +8220,12 @@  discard block
 block discarded – undo
8220 8220
 		} else $offset = '+00:00';
8221 8221
 
8222 8222
 		if ($globalDBdriver == 'mysql') {
8223
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
8223
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
8224 8224
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
8225 8225
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8226 8226
 								ORDER BY date_count DESC";
8227 8227
 		} else {
8228
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
8228
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
8229 8229
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
8230 8230
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8231 8231
 								ORDER BY date_count DESC";
@@ -8237,7 +8237,7 @@  discard block
 block discarded – undo
8237 8237
 		$date_array = array();
8238 8238
 		$temp_array = array();
8239 8239
         
8240
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8240
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8241 8241
 		{
8242 8242
 			$temp_array['month_name'] = $row['month_name'];
8243 8243
 			$temp_array['year_name'] = $row['year_name'];
@@ -8264,15 +8264,15 @@  discard block
 block discarded – undo
8264 8264
 			$datetime = new DateTime();
8265 8265
 			$offset = $datetime->format('P');
8266 8266
 		} else $offset = '+00:00';
8267
-		$filter_query = $this->getFilter($filters,true,true);
8267
+		$filter_query = $this->getFilter($filters, true, true);
8268 8268
 
8269 8269
 		if ($globalDBdriver == 'mysql') {
8270
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
8270
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
8271 8271
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
8272 8272
 								GROUP BY year_name, month_name
8273 8273
 								ORDER BY date_count DESC";
8274 8274
 		} else {
8275
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
8275
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
8276 8276
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
8277 8277
 								GROUP BY year_name, month_name
8278 8278
 								ORDER BY date_count DESC";
@@ -8284,7 +8284,7 @@  discard block
 block discarded – undo
8284 8284
 		$date_array = array();
8285 8285
 		$temp_array = array();
8286 8286
         
8287
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8287
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8288 8288
 		{
8289 8289
 			$temp_array['month_name'] = $row['month_name'];
8290 8290
 			$temp_array['year_name'] = $row['year_name'];
@@ -8305,7 +8305,7 @@  discard block
 block discarded – undo
8305 8305
 	public function countAllMonthsPilotsByAirlines($filters = array())
8306 8306
 	{
8307 8307
 		global $globalTimezone, $globalDBdriver;
8308
-		$filter_query = $this->getFilter($filters,true,true);
8308
+		$filter_query = $this->getFilter($filters, true, true);
8309 8309
 		if ($globalTimezone != '') {
8310 8310
 			date_default_timezone_set($globalTimezone);
8311 8311
 			$datetime = new DateTime();
@@ -8313,12 +8313,12 @@  discard block
 block discarded – undo
8313 8313
 		} else $offset = '+00:00';
8314 8314
 
8315 8315
 		if ($globalDBdriver == 'mysql') {
8316
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
8316
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
8317 8317
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
8318 8318
 								GROUP BY spotter_output.airline_icao,year_name, month_name
8319 8319
 								ORDER BY date_count DESC";
8320 8320
 		} else {
8321
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
8321
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
8322 8322
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
8323 8323
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8324 8324
 								ORDER BY date_count DESC";
@@ -8330,7 +8330,7 @@  discard block
 block discarded – undo
8330 8330
 		$date_array = array();
8331 8331
 		$temp_array = array();
8332 8332
         
8333
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8333
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8334 8334
 		{
8335 8335
 			$temp_array['month_name'] = $row['month_name'];
8336 8336
 			$temp_array['year_name'] = $row['year_name'];
@@ -8352,7 +8352,7 @@  discard block
 block discarded – undo
8352 8352
 	public function countAllMonthsAirlines($filters = array())
8353 8353
 	{
8354 8354
 		global $globalTimezone, $globalDBdriver;
8355
-		$filter_query = $this->getFilter($filters,true,true);
8355
+		$filter_query = $this->getFilter($filters, true, true);
8356 8356
 		if ($globalTimezone != '') {
8357 8357
 			date_default_timezone_set($globalTimezone);
8358 8358
 			$datetime = new DateTime();
@@ -8360,12 +8360,12 @@  discard block
 block discarded – undo
8360 8360
 		} else $offset = '+00:00';
8361 8361
 
8362 8362
 		if ($globalDBdriver == 'mysql') {
8363
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count
8363
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count
8364 8364
 								FROM spotter_output".$filter_query." airline_icao <> '' 
8365 8365
 								GROUP BY year_name, month_name
8366 8366
 								ORDER BY date_count DESC";
8367 8367
 		} else {
8368
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count
8368
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count
8369 8369
 								FROM spotter_output".$filter_query." airline_icao <> '' 
8370 8370
 								GROUP BY year_name, month_name
8371 8371
 								ORDER BY date_count DESC";
@@ -8377,7 +8377,7 @@  discard block
 block discarded – undo
8377 8377
 		$date_array = array();
8378 8378
 		$temp_array = array();
8379 8379
         
8380
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8380
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8381 8381
 		{
8382 8382
 			$temp_array['month_name'] = $row['month_name'];
8383 8383
 			$temp_array['year_name'] = $row['year_name'];
@@ -8403,15 +8403,15 @@  discard block
 block discarded – undo
8403 8403
 			$datetime = new DateTime();
8404 8404
 			$offset = $datetime->format('P');
8405 8405
 		} else $offset = '+00:00';
8406
-		$filter_query = $this->getFilter($filters,true,true);
8406
+		$filter_query = $this->getFilter($filters, true, true);
8407 8407
 
8408 8408
 		if ($globalDBdriver == 'mysql') {
8409
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
8409
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
8410 8410
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
8411 8411
 								GROUP BY year_name, month_name
8412 8412
 								ORDER BY date_count DESC";
8413 8413
 		} else {
8414
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
8414
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
8415 8415
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
8416 8416
 								GROUP BY year_name, month_name
8417 8417
 								ORDER BY date_count DESC";
@@ -8423,7 +8423,7 @@  discard block
 block discarded – undo
8423 8423
 		$date_array = array();
8424 8424
 		$temp_array = array();
8425 8425
         
8426
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8426
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8427 8427
 		{
8428 8428
 			$temp_array['month_name'] = $row['month_name'];
8429 8429
 			$temp_array['year_name'] = $row['year_name'];
@@ -8445,7 +8445,7 @@  discard block
 block discarded – undo
8445 8445
 	public function countAllMonthsAircraftsByAirlines($filters = array())
8446 8446
 	{
8447 8447
 		global $globalTimezone, $globalDBdriver;
8448
-		$filter_query = $this->getFilter($filters,true,true);
8448
+		$filter_query = $this->getFilter($filters, true, true);
8449 8449
 		if ($globalTimezone != '') {
8450 8450
 			date_default_timezone_set($globalTimezone);
8451 8451
 			$datetime = new DateTime();
@@ -8453,12 +8453,12 @@  discard block
 block discarded – undo
8453 8453
 		} else $offset = '+00:00';
8454 8454
 
8455 8455
 		if ($globalDBdriver == 'mysql') {
8456
-			$query  = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
8456
+			$query = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
8457 8457
 								FROM spotter_output".$filter_query." aircraft_icao <> ''  AND spotter_output.airline_icao <> '' 
8458 8458
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8459 8459
 								ORDER BY date_count DESC";
8460 8460
 		} else {
8461
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
8461
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
8462 8462
 								FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' 
8463 8463
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8464 8464
 								ORDER BY date_count DESC";
@@ -8470,7 +8470,7 @@  discard block
 block discarded – undo
8470 8470
 		$date_array = array();
8471 8471
 		$temp_array = array();
8472 8472
         
8473
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8473
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8474 8474
 		{
8475 8475
 			$temp_array['month_name'] = $row['month_name'];
8476 8476
 			$temp_array['year_name'] = $row['year_name'];
@@ -8497,15 +8497,15 @@  discard block
 block discarded – undo
8497 8497
 			$datetime = new DateTime();
8498 8498
 			$offset = $datetime->format('P');
8499 8499
 		} else $offset = '+00:00';
8500
-		$filter_query = $this->getFilter($filters,true,true);
8500
+		$filter_query = $this->getFilter($filters, true, true);
8501 8501
 
8502 8502
 		if ($globalDBdriver == 'mysql') {
8503
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
8503
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
8504 8504
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
8505 8505
 								GROUP BY year_name, month_name
8506 8506
 								ORDER BY date_count DESC";
8507 8507
 		} else {
8508
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
8508
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
8509 8509
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
8510 8510
 								GROUP BY year_name, month_name
8511 8511
 								ORDER BY date_count DESC";
@@ -8517,7 +8517,7 @@  discard block
 block discarded – undo
8517 8517
 		$date_array = array();
8518 8518
 		$temp_array = array();
8519 8519
         
8520
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8520
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8521 8521
 		{
8522 8522
 			$temp_array['month_name'] = $row['month_name'];
8523 8523
 			$temp_array['year_name'] = $row['year_name'];
@@ -8539,7 +8539,7 @@  discard block
 block discarded – undo
8539 8539
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
8540 8540
 	{
8541 8541
 		global $globalTimezone, $globalDBdriver;
8542
-		$filter_query = $this->getFilter($filters,true,true);
8542
+		$filter_query = $this->getFilter($filters, true, true);
8543 8543
 		if ($globalTimezone != '') {
8544 8544
 			date_default_timezone_set($globalTimezone);
8545 8545
 			$datetime = new DateTime();
@@ -8547,12 +8547,12 @@  discard block
 block discarded – undo
8547 8547
 		} else $offset = '+00:00';
8548 8548
 
8549 8549
 		if ($globalDBdriver == 'mysql') {
8550
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
8550
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
8551 8551
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
8552 8552
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8553 8553
 								ORDER BY date_count DESC";
8554 8554
 		} else {
8555
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
8555
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
8556 8556
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
8557 8557
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8558 8558
 								ORDER BY date_count DESC";
@@ -8564,7 +8564,7 @@  discard block
 block discarded – undo
8564 8564
 		$date_array = array();
8565 8565
 		$temp_array = array();
8566 8566
         
8567
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8567
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8568 8568
 		{
8569 8569
 			$temp_array['month_name'] = $row['month_name'];
8570 8570
 			$temp_array['year_name'] = $row['year_name'];
@@ -8592,7 +8592,7 @@  discard block
 block discarded – undo
8592 8592
 			$datetime = new DateTime();
8593 8593
 			$offset = $datetime->format('P');
8594 8594
 		} else $offset = '+00:00';
8595
-		$filter_query = $this->getFilter($filters,true,true);
8595
+		$filter_query = $this->getFilter($filters, true, true);
8596 8596
 		if ($globalDBdriver == 'mysql') {
8597 8597
 			$query  = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count
8598 8598
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
@@ -8613,7 +8613,7 @@  discard block
 block discarded – undo
8613 8613
 		$date_array = array();
8614 8614
 		$temp_array = array();
8615 8615
         
8616
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8616
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8617 8617
 		{
8618 8618
 			$temp_array['year_name'] = $row['year_name'];
8619 8619
 			$temp_array['month_name'] = $row['month_name'];
@@ -8633,7 +8633,7 @@  discard block
 block discarded – undo
8633 8633
 	* @return Array the hour list
8634 8634
 	*
8635 8635
 	*/
8636
-	public function countAllHours($orderby,$filters = array())
8636
+	public function countAllHours($orderby, $filters = array())
8637 8637
 	{
8638 8638
 		global $globalTimezone, $globalDBdriver;
8639 8639
 		if ($globalTimezone != '') {
@@ -8681,7 +8681,7 @@  discard block
 block discarded – undo
8681 8681
 		$hour_array = array();
8682 8682
 		$temp_array = array();
8683 8683
         
8684
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8684
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8685 8685
 		{
8686 8686
 			$temp_array['hour_name'] = $row['hour_name'];
8687 8687
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8701,7 +8701,7 @@  discard block
 block discarded – undo
8701 8701
 	public function countAllHoursByAirlines($orderby, $filters = array())
8702 8702
 	{
8703 8703
 		global $globalTimezone, $globalDBdriver;
8704
-		$filter_query = $this->getFilter($filters,true,true);
8704
+		$filter_query = $this->getFilter($filters, true, true);
8705 8705
 		if ($globalTimezone != '') {
8706 8706
 			date_default_timezone_set($globalTimezone);
8707 8707
 			$datetime = new DateTime();
@@ -8719,7 +8719,7 @@  discard block
 block discarded – undo
8719 8719
 		}
8720 8720
 		
8721 8721
 		if ($globalDBdriver == 'mysql') {
8722
-			$query  = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8722
+			$query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8723 8723
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8724 8724
 								GROUP BY spotter_output.airline_icao, hour_name 
8725 8725
 								".$orderby_sql;
@@ -8732,7 +8732,7 @@  discard block
 block discarded – undo
8732 8732
   */    
8733 8733
 		$query_data = array(':offset' => $offset);
8734 8734
 		} else {
8735
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8735
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8736 8736
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8737 8737
 								GROUP BY spotter_output.airline_icao, hour_name 
8738 8738
 								".$orderby_sql;
@@ -8745,7 +8745,7 @@  discard block
 block discarded – undo
8745 8745
 		$hour_array = array();
8746 8746
 		$temp_array = array();
8747 8747
         
8748
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8748
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8749 8749
 		{
8750 8750
 			$temp_array['hour_name'] = $row['hour_name'];
8751 8751
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8768,34 +8768,34 @@  discard block
 block discarded – undo
8768 8768
 	public function countAllHoursByAirline($airline_icao, $filters = array())
8769 8769
 	{
8770 8770
 		global $globalTimezone, $globalDBdriver;
8771
-		$filter_query = $this->getFilter($filters,true,true);
8771
+		$filter_query = $this->getFilter($filters, true, true);
8772 8772
 		if ($globalTimezone != '') {
8773 8773
 			date_default_timezone_set($globalTimezone);
8774 8774
 			$datetime = new DateTime();
8775 8775
 			$offset = $datetime->format('P');
8776 8776
 		} else $offset = '+00:00';
8777 8777
 
8778
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8778
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
8779 8779
 
8780 8780
 		if ($globalDBdriver == 'mysql') {
8781
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8781
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8782 8782
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
8783 8783
 								GROUP BY hour_name 
8784 8784
 								ORDER BY hour_name ASC";
8785 8785
 		} else {
8786
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8786
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8787 8787
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
8788 8788
 								GROUP BY hour_name 
8789 8789
 								ORDER BY hour_name ASC";
8790 8790
 		}
8791 8791
 		
8792 8792
 		$sth = $this->db->prepare($query);
8793
-		$sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset));
8793
+		$sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset));
8794 8794
       
8795 8795
 		$hour_array = array();
8796 8796
 		$temp_array = array();
8797 8797
         
8798
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8798
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8799 8799
 		{
8800 8800
 			$temp_array['hour_name'] = $row['hour_name'];
8801 8801
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8818,8 +8818,8 @@  discard block
 block discarded – undo
8818 8818
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
8819 8819
 	{
8820 8820
 		global $globalTimezone, $globalDBdriver;
8821
-		$filter_query = $this->getFilter($filters,true,true);
8822
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
8821
+		$filter_query = $this->getFilter($filters, true, true);
8822
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
8823 8823
 		if ($globalTimezone != '') {
8824 8824
 			date_default_timezone_set($globalTimezone);
8825 8825
 			$datetime = new DateTime();
@@ -8827,24 +8827,24 @@  discard block
 block discarded – undo
8827 8827
 		} else $offset = '+00:00';
8828 8828
 
8829 8829
 		if ($globalDBdriver == 'mysql') {
8830
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8830
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8831 8831
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
8832 8832
 								GROUP BY hour_name 
8833 8833
 								ORDER BY hour_name ASC";
8834 8834
 		} else {
8835
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8835
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8836 8836
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
8837 8837
 								GROUP BY hour_name 
8838 8838
 								ORDER BY hour_name ASC";
8839 8839
 		}
8840 8840
 		
8841 8841
 		$sth = $this->db->prepare($query);
8842
-		$sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset));
8842
+		$sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset));
8843 8843
       
8844 8844
 		$hour_array = array();
8845 8845
 		$temp_array = array();
8846 8846
         
8847
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8847
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8848 8848
 		{
8849 8849
 			$temp_array['hour_name'] = $row['hour_name'];
8850 8850
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8865,8 +8865,8 @@  discard block
 block discarded – undo
8865 8865
 	public function countAllHoursByRegistration($registration, $filters = array())
8866 8866
 	{
8867 8867
 		global $globalTimezone, $globalDBdriver;
8868
-		$filter_query = $this->getFilter($filters,true,true);
8869
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
8868
+		$filter_query = $this->getFilter($filters, true, true);
8869
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8870 8870
 		if ($globalTimezone != '') {
8871 8871
 			date_default_timezone_set($globalTimezone);
8872 8872
 			$datetime = new DateTime();
@@ -8874,24 +8874,24 @@  discard block
 block discarded – undo
8874 8874
 		} else $offset = '+00:00';
8875 8875
 
8876 8876
 		if ($globalDBdriver == 'mysql') {
8877
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8877
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8878 8878
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
8879 8879
 								GROUP BY hour_name 
8880 8880
 								ORDER BY hour_name ASC";
8881 8881
 		} else {
8882
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8882
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8883 8883
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
8884 8884
 								GROUP BY hour_name 
8885 8885
 								ORDER BY hour_name ASC";
8886 8886
 		}
8887 8887
 		
8888 8888
 		$sth = $this->db->prepare($query);
8889
-		$sth->execute(array(':registration' => $registration,':offset' => $offset));
8889
+		$sth->execute(array(':registration' => $registration, ':offset' => $offset));
8890 8890
       
8891 8891
 		$hour_array = array();
8892 8892
 		$temp_array = array();
8893 8893
         
8894
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8894
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8895 8895
 		{
8896 8896
 			$temp_array['hour_name'] = $row['hour_name'];
8897 8897
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8912,8 +8912,8 @@  discard block
 block discarded – undo
8912 8912
 	public function countAllHoursByAirport($airport_icao, $filters = array())
8913 8913
 	{
8914 8914
 		global $globalTimezone, $globalDBdriver;
8915
-		$filter_query = $this->getFilter($filters,true,true);
8916
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8915
+		$filter_query = $this->getFilter($filters, true, true);
8916
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8917 8917
 		if ($globalTimezone != '') {
8918 8918
 			date_default_timezone_set($globalTimezone);
8919 8919
 			$datetime = new DateTime();
@@ -8921,24 +8921,24 @@  discard block
 block discarded – undo
8921 8921
 		} else $offset = '+00:00';
8922 8922
 
8923 8923
 		if ($globalDBdriver == 'mysql') {
8924
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8924
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8925 8925
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
8926 8926
 								GROUP BY hour_name 
8927 8927
 								ORDER BY hour_name ASC";
8928 8928
 		} else {
8929
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8929
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8930 8930
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
8931 8931
 								GROUP BY hour_name 
8932 8932
 								ORDER BY hour_name ASC";
8933 8933
 		}
8934 8934
 		
8935 8935
 		$sth = $this->db->prepare($query);
8936
-		$sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset));
8936
+		$sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset));
8937 8937
       
8938 8938
 		$hour_array = array();
8939 8939
 		$temp_array = array();
8940 8940
         
8941
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8941
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8942 8942
 		{
8943 8943
 			$temp_array['hour_name'] = $row['hour_name'];
8944 8944
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8957,11 +8957,11 @@  discard block
 block discarded – undo
8957 8957
 	* @return Array the hour list
8958 8958
 	*
8959 8959
 	*/
8960
-	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
8960
+	public function countAllHoursByManufacturer($aircraft_manufacturer, $filters = array())
8961 8961
 	{
8962 8962
 		global $globalTimezone, $globalDBdriver;
8963
-		$filter_query = $this->getFilter($filters,true,true);
8964
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
8963
+		$filter_query = $this->getFilter($filters, true, true);
8964
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
8965 8965
 		if ($globalTimezone != '') {
8966 8966
 			date_default_timezone_set($globalTimezone);
8967 8967
 			$datetime = new DateTime();
@@ -8969,24 +8969,24 @@  discard block
 block discarded – undo
8969 8969
 		} else $offset = '+00:00';
8970 8970
 
8971 8971
 		if ($globalDBdriver == 'mysql') {
8972
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8972
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8973 8973
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
8974 8974
 								GROUP BY hour_name 
8975 8975
 								ORDER BY hour_name ASC";
8976 8976
 		} else {
8977
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8977
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8978 8978
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
8979 8979
 								GROUP BY hour_name 
8980 8980
 								ORDER BY hour_name ASC";
8981 8981
 		}
8982 8982
 		
8983 8983
 		$sth = $this->db->prepare($query);
8984
-		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset));
8984
+		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset));
8985 8985
       
8986 8986
 		$hour_array = array();
8987 8987
 		$temp_array = array();
8988 8988
         
8989
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8989
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8990 8990
 		{
8991 8991
 			$temp_array['hour_name'] = $row['hour_name'];
8992 8992
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9008,8 +9008,8 @@  discard block
 block discarded – undo
9008 9008
 	public function countAllHoursByDate($date, $filters = array())
9009 9009
 	{
9010 9010
 		global $globalTimezone, $globalDBdriver;
9011
-		$filter_query = $this->getFilter($filters,true,true);
9012
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
9011
+		$filter_query = $this->getFilter($filters, true, true);
9012
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
9013 9013
 		if ($globalTimezone != '') {
9014 9014
 			date_default_timezone_set($globalTimezone);
9015 9015
 			$datetime = new DateTime($date);
@@ -9017,12 +9017,12 @@  discard block
 block discarded – undo
9017 9017
 		} else $offset = '+00:00';
9018 9018
 
9019 9019
 		if ($globalDBdriver == 'mysql') {
9020
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9020
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9021 9021
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
9022 9022
 								GROUP BY hour_name 
9023 9023
 								ORDER BY hour_name ASC";
9024 9024
 		} else {
9025
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9025
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9026 9026
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date
9027 9027
 								GROUP BY hour_name 
9028 9028
 								ORDER BY hour_name ASC";
@@ -9034,7 +9034,7 @@  discard block
 block discarded – undo
9034 9034
 		$hour_array = array();
9035 9035
 		$temp_array = array();
9036 9036
         
9037
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9037
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9038 9038
 		{
9039 9039
 			$temp_array['hour_name'] = $row['hour_name'];
9040 9040
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9056,8 +9056,8 @@  discard block
 block discarded – undo
9056 9056
 	public function countAllHoursByIdent($ident, $filters = array())
9057 9057
 	{
9058 9058
 		global $globalTimezone, $globalDBdriver;
9059
-		$filter_query = $this->getFilter($filters,true,true);
9060
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
9059
+		$filter_query = $this->getFilter($filters, true, true);
9060
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
9061 9061
 		if ($globalTimezone != '') {
9062 9062
 			date_default_timezone_set($globalTimezone);
9063 9063
 			$datetime = new DateTime();
@@ -9065,12 +9065,12 @@  discard block
 block discarded – undo
9065 9065
 		} else $offset = '+00:00';
9066 9066
 
9067 9067
 		if ($globalDBdriver == 'mysql') {
9068
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9068
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9069 9069
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
9070 9070
 								GROUP BY hour_name 
9071 9071
 								ORDER BY hour_name ASC";
9072 9072
 		} else {
9073
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9073
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9074 9074
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
9075 9075
 								GROUP BY hour_name 
9076 9076
 								ORDER BY hour_name ASC";
@@ -9078,12 +9078,12 @@  discard block
 block discarded – undo
9078 9078
       
9079 9079
 		
9080 9080
 		$sth = $this->db->prepare($query);
9081
-		$sth->execute(array(':ident' => $ident,':offset' => $offset));
9081
+		$sth->execute(array(':ident' => $ident, ':offset' => $offset));
9082 9082
       
9083 9083
 		$hour_array = array();
9084 9084
 		$temp_array = array();
9085 9085
         
9086
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9086
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9087 9087
 		{
9088 9088
 			$temp_array['hour_name'] = $row['hour_name'];
9089 9089
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9102,12 +9102,12 @@  discard block
 block discarded – undo
9102 9102
 	* @return Array the hour list
9103 9103
 	*
9104 9104
 	*/
9105
-	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
9105
+	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
9106 9106
 	{
9107 9107
 		global $globalTimezone, $globalDBdriver;
9108
-		$filter_query = $this->getFilter($filters,true,true);
9109
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
9110
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
9108
+		$filter_query = $this->getFilter($filters, true, true);
9109
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
9110
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
9111 9111
 		if ($globalTimezone != '') {
9112 9112
 			date_default_timezone_set($globalTimezone);
9113 9113
 			$datetime = new DateTime();
@@ -9115,24 +9115,24 @@  discard block
 block discarded – undo
9115 9115
 		} else $offset = '+00:00';
9116 9116
 
9117 9117
 		if ($globalDBdriver == 'mysql') {
9118
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9118
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9119 9119
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
9120 9120
 								GROUP BY hour_name 
9121 9121
 								ORDER BY hour_name ASC";
9122 9122
 		} else {
9123
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9123
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9124 9124
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
9125 9125
 								GROUP BY hour_name 
9126 9126
 								ORDER BY hour_name ASC";
9127 9127
 		}
9128 9128
 		
9129 9129
 		$sth = $this->db->prepare($query);
9130
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset));
9130
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset));
9131 9131
       
9132 9132
 		$hour_array = array();
9133 9133
 		$temp_array = array();
9134 9134
         
9135
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9135
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9136 9136
 		{
9137 9137
 			$temp_array['hour_name'] = $row['hour_name'];
9138 9138
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9153,8 +9153,8 @@  discard block
 block discarded – undo
9153 9153
 	public function countAllHoursByCountry($country, $filters = array())
9154 9154
 	{
9155 9155
 		global $globalTimezone, $globalDBdriver;
9156
-		$filter_query = $this->getFilter($filters,true,true);
9157
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
9156
+		$filter_query = $this->getFilter($filters, true, true);
9157
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
9158 9158
 		if ($globalTimezone != '') {
9159 9159
 			date_default_timezone_set($globalTimezone);
9160 9160
 			$datetime = new DateTime();
@@ -9162,24 +9162,24 @@  discard block
 block discarded – undo
9162 9162
 		} else $offset = '+00:00';
9163 9163
 
9164 9164
 		if ($globalDBdriver == 'mysql') {
9165
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9165
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9166 9166
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
9167 9167
 								GROUP BY hour_name 
9168 9168
 								ORDER BY hour_name ASC";
9169 9169
 		} else {
9170
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9170
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9171 9171
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
9172 9172
 								GROUP BY hour_name 
9173 9173
 								ORDER BY hour_name ASC";
9174 9174
 		}
9175 9175
 		
9176 9176
 		$sth = $this->db->prepare($query);
9177
-		$sth->execute(array(':country' => $country,':offset' => $offset));
9177
+		$sth->execute(array(':country' => $country, ':offset' => $offset));
9178 9178
       
9179 9179
 		$hour_array = array();
9180 9180
 		$temp_array = array();
9181 9181
         
9182
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9182
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9183 9183
 		{
9184 9184
 			$temp_array['hour_name'] = $row['hour_name'];
9185 9185
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9201,8 +9201,8 @@  discard block
 block discarded – undo
9201 9201
 	*/
9202 9202
 	public function countOverallAircrafts($filters = array())
9203 9203
 	{
9204
-		$filter_query = $this->getFilter($filters,true,true);
9205
-		$query  = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
9204
+		$filter_query = $this->getFilter($filters, true, true);
9205
+		$query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
9206 9206
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
9207 9207
 		$sth = $this->db->prepare($query);
9208 9208
 		$sth->execute();
@@ -9217,8 +9217,8 @@  discard block
 block discarded – undo
9217 9217
 	*/
9218 9218
 	public function countOverallArrival($filters = array())
9219 9219
 	{
9220
-		$filter_query = $this->getFilter($filters,true,true);
9221
-		$query  = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
9220
+		$filter_query = $this->getFilter($filters, true, true);
9221
+		$query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
9222 9222
                     FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''";
9223 9223
 		
9224 9224
 		$sth = $this->db->prepare($query);
@@ -9234,8 +9234,8 @@  discard block
 block discarded – undo
9234 9234
 	*/
9235 9235
 	public function countOverallPilots($filters = array())
9236 9236
 	{
9237
-		$filter_query = $this->getFilter($filters,true,true);
9238
-		$query  = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
9237
+		$filter_query = $this->getFilter($filters, true, true);
9238
+		$query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
9239 9239
                     FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''";
9240 9240
 		$sth = $this->db->prepare($query);
9241 9241
 		$sth->execute();
@@ -9250,8 +9250,8 @@  discard block
 block discarded – undo
9250 9250
 	*/
9251 9251
 	public function countOverallOwners($filters = array())
9252 9252
 	{
9253
-		$filter_query = $this->getFilter($filters,true,true);
9254
-		$query  = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
9253
+		$filter_query = $this->getFilter($filters, true, true);
9254
+		$query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
9255 9255
                     FROM spotter_output".$filter_query." spotter_output.owner_name <> ''";
9256 9256
 		$sth = $this->db->prepare($query);
9257 9257
 		$sth->execute();
@@ -9284,8 +9284,8 @@  discard block
 block discarded – undo
9284 9284
 	*/
9285 9285
 	public function countOverallMilitaryFlights($filters = array())
9286 9286
 	{
9287
-		$filter_query = $this->getFilter($filters,true,true);
9288
-		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
9287
+		$filter_query = $this->getFilter($filters, true, true);
9288
+		$query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
9289 9289
                     FROM airlines,spotter_output".$filter_query." spotter_output.airline_icao = airlines.icao AND airlines.type = 'military'";
9290 9290
       
9291 9291
 		$sth = $this->db->prepare($query);
@@ -9322,7 +9322,7 @@  discard block
 block discarded – undo
9322 9322
 	public function countAllHoursFromToday($filters = array())
9323 9323
 	{
9324 9324
 		global $globalTimezone, $globalDBdriver;
9325
-		$filter_query = $this->getFilter($filters,true,true);
9325
+		$filter_query = $this->getFilter($filters, true, true);
9326 9326
 		if ($globalTimezone != '') {
9327 9327
 			date_default_timezone_set($globalTimezone);
9328 9328
 			$datetime = new DateTime();
@@ -9330,12 +9330,12 @@  discard block
 block discarded – undo
9330 9330
 		} else $offset = '+00:00';
9331 9331
 
9332 9332
 		if ($globalDBdriver == 'mysql') {
9333
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9333
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9334 9334
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE()
9335 9335
 								GROUP BY hour_name 
9336 9336
 								ORDER BY hour_name ASC";
9337 9337
 		} else {
9338
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9338
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9339 9339
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date)
9340 9340
 								GROUP BY hour_name 
9341 9341
 								ORDER BY hour_name ASC";
@@ -9347,7 +9347,7 @@  discard block
 block discarded – undo
9347 9347
 		$hour_array = array();
9348 9348
 		$temp_array = array();
9349 9349
         
9350
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9350
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9351 9351
 		{
9352 9352
 			$temp_array['hour_name'] = $row['hour_name'];
9353 9353
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9366,14 +9366,14 @@  discard block
 block discarded – undo
9366 9366
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
9367 9367
 	{
9368 9368
 		global $global_query, $globalDBdriver, $globalTimezone;
9369
-		$filter_query = $this->getFilter($filters,true,true);
9369
+		$filter_query = $this->getFilter($filters, true, true);
9370 9370
 		date_default_timezone_set('UTC');
9371 9371
 		$limit_query = '';
9372 9372
 		if ($limit != "")
9373 9373
 		{
9374 9374
 			$limit_array = explode(",", $limit);
9375
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
9376
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
9375
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
9376
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
9377 9377
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
9378 9378
 			{
9379 9379
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
@@ -9426,7 +9426,7 @@  discard block
 block discarded – undo
9426 9426
 			    GROUP BY spotter_output.ident,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time, to_char(spotter_output.date,'HH')
9427 9427
 			    HAVING count(spotter_output.ident) > 5$orderby_query";
9428 9428
 			//echo $query;
9429
-			$spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone));
9429
+			$spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone));
9430 9430
 			/*
9431 9431
 			$sth = $this->db->prepare($query);
9432 9432
 			$sth->execute(array(':timezone' => $globalTimezone));
@@ -9445,9 +9445,9 @@  discard block
 block discarded – undo
9445 9445
 	*/
9446 9446
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
9447 9447
 	{
9448
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
9448
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
9449 9449
 
9450
-		$query  = "SELECT spotter_output.spotter_id
9450
+		$query = "SELECT spotter_output.spotter_id
9451 9451
 								FROM spotter_output 
9452 9452
 								WHERE spotter_output.flightaware_id = '".$flightaware_id."'";
9453 9453
         
@@ -9455,7 +9455,7 @@  discard block
 block discarded – undo
9455 9455
 		$sth = $this->db->prepare($query);
9456 9456
 		$sth->execute();
9457 9457
 
9458
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9458
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9459 9459
 		{
9460 9460
 			return $row['spotter_id'];
9461 9461
 		}
@@ -9480,23 +9480,23 @@  discard block
 block discarded – undo
9480 9480
 		}
9481 9481
 		
9482 9482
 		$current_date = date("Y-m-d H:i:s");
9483
-		$date = date("Y-m-d H:i:s",strtotime($dateString." UTC"));
9483
+		$date = date("Y-m-d H:i:s", strtotime($dateString." UTC"));
9484 9484
 		
9485 9485
 		$diff = abs(strtotime($current_date) - strtotime($date));
9486 9486
 
9487
-		$time_array['years'] = floor($diff / (365*60*60*24)); 
9487
+		$time_array['years'] = floor($diff/(365*60*60*24)); 
9488 9488
 		$years = $time_array['years'];
9489 9489
 		
9490
-		$time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
9490
+		$time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24));
9491 9491
 		$months = $time_array['months'];
9492 9492
 		
9493
-		$time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
9493
+		$time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24));
9494 9494
 		$days = $time_array['days'];
9495
-		$time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60));
9495
+		$time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60));
9496 9496
 		$hours = $time_array['hours'];
9497
-		$time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60);
9497
+		$time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60);
9498 9498
 		$minutes = $time_array['minutes'];
9499
-		$time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
9499
+		$time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
9500 9500
 		
9501 9501
 		return $time_array;	
9502 9502
 	}	
@@ -9522,63 +9522,63 @@  discard block
 block discarded – undo
9522 9522
 			$temp_array['direction_degree'] = $direction;
9523 9523
 			$temp_array['direction_shortname'] = "N";
9524 9524
 			$temp_array['direction_fullname'] = "North";
9525
-		} elseif ($direction >= 22.5 && $direction < 45){
9525
+		} elseif ($direction >= 22.5 && $direction < 45) {
9526 9526
 			$temp_array['direction_degree'] = $direction;
9527 9527
 			$temp_array['direction_shortname'] = "NNE";
9528 9528
 			$temp_array['direction_fullname'] = "North-Northeast";
9529
-		} elseif ($direction >= 45 && $direction < 67.5){
9529
+		} elseif ($direction >= 45 && $direction < 67.5) {
9530 9530
 			$temp_array['direction_degree'] = $direction;
9531 9531
 			$temp_array['direction_shortname'] = "NE";
9532 9532
 			$temp_array['direction_fullname'] = "Northeast";
9533
-		} elseif ($direction >= 67.5 && $direction < 90){
9533
+		} elseif ($direction >= 67.5 && $direction < 90) {
9534 9534
 			$temp_array['direction_degree'] = $direction;
9535 9535
 			$temp_array['direction_shortname'] = "ENE";
9536 9536
 			$temp_array['direction_fullname'] = "East-Northeast";
9537
-		} elseif ($direction >= 90 && $direction < 112.5){
9537
+		} elseif ($direction >= 90 && $direction < 112.5) {
9538 9538
 			$temp_array['direction_degree'] = $direction;
9539 9539
 			$temp_array['direction_shortname'] = "E";
9540 9540
 			$temp_array['direction_fullname'] = "East";
9541
-		} elseif ($direction >= 112.5 && $direction < 135){
9541
+		} elseif ($direction >= 112.5 && $direction < 135) {
9542 9542
 			$temp_array['direction_degree'] = $direction;
9543 9543
 			$temp_array['direction_shortname'] = "ESE";
9544 9544
 			$temp_array['direction_fullname'] = "East-Southeast";
9545
-		} elseif ($direction >= 135 && $direction < 157.5){
9545
+		} elseif ($direction >= 135 && $direction < 157.5) {
9546 9546
 			$temp_array['direction_degree'] = $direction;
9547 9547
 			$temp_array['direction_shortname'] = "SE";
9548 9548
 			$temp_array['direction_fullname'] = "Southeast";
9549
-		} elseif ($direction >= 157.5 && $direction < 180){
9549
+		} elseif ($direction >= 157.5 && $direction < 180) {
9550 9550
 			$temp_array['direction_degree'] = $direction;
9551 9551
 			$temp_array['direction_shortname'] = "SSE";
9552 9552
 			$temp_array['direction_fullname'] = "South-Southeast";
9553
-		} elseif ($direction >= 180 && $direction < 202.5){
9553
+		} elseif ($direction >= 180 && $direction < 202.5) {
9554 9554
 			$temp_array['direction_degree'] = $direction;
9555 9555
 			$temp_array['direction_shortname'] = "S";
9556 9556
 			$temp_array['direction_fullname'] = "South";
9557
-		} elseif ($direction >= 202.5 && $direction < 225){
9557
+		} elseif ($direction >= 202.5 && $direction < 225) {
9558 9558
 			$temp_array['direction_degree'] = $direction;
9559 9559
 			$temp_array['direction_shortname'] = "SSW";
9560 9560
 			$temp_array['direction_fullname'] = "South-Southwest";
9561
-		} elseif ($direction >= 225 && $direction < 247.5){
9561
+		} elseif ($direction >= 225 && $direction < 247.5) {
9562 9562
 			$temp_array['direction_degree'] = $direction;
9563 9563
 			$temp_array['direction_shortname'] = "SW";
9564 9564
 			$temp_array['direction_fullname'] = "Southwest";
9565
-		} elseif ($direction >= 247.5 && $direction < 270){
9565
+		} elseif ($direction >= 247.5 && $direction < 270) {
9566 9566
 			$temp_array['direction_degree'] = $direction;
9567 9567
 			$temp_array['direction_shortname'] = "WSW";
9568 9568
 			$temp_array['direction_fullname'] = "West-Southwest";
9569
-		} elseif ($direction >= 270 && $direction < 292.5){
9569
+		} elseif ($direction >= 270 && $direction < 292.5) {
9570 9570
 			$temp_array['direction_degree'] = $direction;
9571 9571
 			$temp_array['direction_shortname'] = "W";
9572 9572
 			$temp_array['direction_fullname'] = "West";
9573
-		} elseif ($direction >= 292.5 && $direction < 315){
9573
+		} elseif ($direction >= 292.5 && $direction < 315) {
9574 9574
 			$temp_array['direction_degree'] = $direction;
9575 9575
 			$temp_array['direction_shortname'] = "WNW";
9576 9576
 			$temp_array['direction_fullname'] = "West-Northwest";
9577
-		} elseif ($direction >= 315 && $direction < 337.5){
9577
+		} elseif ($direction >= 315 && $direction < 337.5) {
9578 9578
 			$temp_array['direction_degree'] = $direction;
9579 9579
 			$temp_array['direction_shortname'] = "NW";
9580 9580
 			$temp_array['direction_fullname'] = "Northwest";
9581
-		} elseif ($direction >= 337.5 && $direction < 360){
9581
+		} elseif ($direction >= 337.5 && $direction < 360) {
9582 9582
 			$temp_array['direction_degree'] = $direction;
9583 9583
 			$temp_array['direction_shortname'] = "NNW";
9584 9584
 			$temp_array['direction_fullname'] = "North-Northwest";
@@ -9631,9 +9631,9 @@  discard block
 block discarded – undo
9631 9631
 	*/
9632 9632
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
9633 9633
 	{
9634
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
9634
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
9635 9635
 	
9636
-		$query  = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9636
+		$query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9637 9637
 		
9638 9638
 		$sth = $this->db->prepare($query);
9639 9639
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -9656,9 +9656,9 @@  discard block
 block discarded – undo
9656 9656
 	*/
9657 9657
 	public function getAircraftTypeBymodeS($aircraft_modes)
9658 9658
 	{
9659
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
9659
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
9660 9660
 	
9661
-		$query  = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9661
+		$query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9662 9662
 		
9663 9663
 		$sth = $this->db->prepare($query);
9664 9664
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -9679,11 +9679,11 @@  discard block
 block discarded – undo
9679 9679
 	* @param Float $longitude longitute of the flight
9680 9680
 	* @return String the countrie
9681 9681
 	*/
9682
-	public function getCountryFromLatitudeLongitude($latitude,$longitude)
9682
+	public function getCountryFromLatitudeLongitude($latitude, $longitude)
9683 9683
 	{
9684 9684
 		global $globalDBdriver, $globalDebug;
9685
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9686
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9685
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
9686
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
9687 9687
 	
9688 9688
 		$Connection = new Connection($this->db);
9689 9689
 		if (!$Connection->tableExists('countries')) return '';
@@ -9723,19 +9723,19 @@  discard block
 block discarded – undo
9723 9723
 	*/
9724 9724
 	public function convertAircraftRegistration($registration)
9725 9725
 	{
9726
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9726
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9727 9727
 		$registration_prefix = '';
9728 9728
 		$registration_1 = substr($registration, 0, 1);
9729 9729
 		$registration_2 = substr($registration, 0, 2);
9730 9730
 
9731 9731
 		//first get the prefix based on two characters
9732
-		$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
9732
+		$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
9733 9733
       
9734 9734
 		
9735 9735
 		$sth = $this->db->prepare($query);
9736 9736
 		$sth->execute(array(':registration_2' => $registration_2));
9737 9737
         
9738
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9738
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9739 9739
 		{
9740 9740
 			$registration_prefix = $row['registration_prefix'];
9741 9741
 		}
@@ -9743,11 +9743,11 @@  discard block
 block discarded – undo
9743 9743
 		//if we didn't find a two chracter prefix lets just search the one with one character
9744 9744
 		if ($registration_prefix == '')
9745 9745
 		{
9746
-			$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
9746
+			$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
9747 9747
 			$sth = $this->db->prepare($query);
9748 9748
 			$sth->execute(array(':registration_1' => $registration_1));
9749 9749
 	        
9750
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9750
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9751 9751
 			{
9752 9752
 				$registration_prefix = $row['registration_prefix'];
9753 9753
 			}
@@ -9761,7 +9761,7 @@  discard block
 block discarded – undo
9761 9761
 			} else {
9762 9762
 				$registration = preg_replace("/^(.{1})/", "$1-", $registration);
9763 9763
 			}
9764
-		} else if(strlen($registration_prefix) == 2){
9764
+		} else if (strlen($registration_prefix) == 2) {
9765 9765
 			if (0 === strpos($registration, 'N')) {
9766 9766
 				$registration = preg_replace("/^(.{2})/", "$1", $registration);
9767 9767
 			} else {
@@ -9780,17 +9780,17 @@  discard block
 block discarded – undo
9780 9780
 	*/
9781 9781
 	public function countryFromAircraftRegistration($registration)
9782 9782
 	{
9783
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9783
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9784 9784
 		
9785 9785
 		$registration_prefix = '';
9786
-		$registration_test = explode('-',$registration);
9786
+		$registration_test = explode('-', $registration);
9787 9787
 		$country = '';
9788 9788
 		if ($registration_test[0] != $registration) {
9789 9789
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9790 9790
 	      
9791 9791
 			$sth = $this->db->prepare($query);
9792 9792
 			$sth->execute(array(':registration_1' => $registration_test[0]));
9793
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9793
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9794 9794
 			{
9795 9795
 				//$registration_prefix = $row['registration_prefix'];
9796 9796
 				$country = $row['country'];
@@ -9801,13 +9801,13 @@  discard block
 block discarded – undo
9801 9801
 
9802 9802
 			$country = '';
9803 9803
 			//first get the prefix based on two characters
9804
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
9804
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
9805 9805
       
9806 9806
 			
9807 9807
 			$sth = $this->db->prepare($query);
9808 9808
 			$sth->execute(array(':registration_2' => $registration_2));
9809 9809
         
9810
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9810
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9811 9811
 			{
9812 9812
 				$registration_prefix = $row['registration_prefix'];
9813 9813
 				$country = $row['country'];
@@ -9816,12 +9816,12 @@  discard block
 block discarded – undo
9816 9816
 			//if we didn't find a two chracter prefix lets just search the one with one character
9817 9817
 			if ($registration_prefix == "")
9818 9818
 			{
9819
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9819
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9820 9820
 	      
9821 9821
 				$sth = $this->db->prepare($query);
9822 9822
 				$sth->execute(array(':registration_1' => $registration_1));
9823 9823
 	        
9824
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
9824
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9825 9825
 				{
9826 9826
 					//$registration_prefix = $row['registration_prefix'];
9827 9827
 					$country = $row['country'];
@@ -9838,9 +9838,9 @@  discard block
 block discarded – undo
9838 9838
 	* @param String $flightaware_id flightaware_id from spotter_output table
9839 9839
 	* @param String $highlight New highlight value
9840 9840
 	*/
9841
-	public function setHighlightFlight($flightaware_id,$highlight) {
9841
+	public function setHighlightFlight($flightaware_id, $highlight) {
9842 9842
 		
9843
-		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
9843
+		$query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
9844 9844
 		$sth = $this->db->prepare($query);
9845 9845
 		$sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight));
9846 9846
 	}
@@ -9869,7 +9869,7 @@  discard block
 block discarded – undo
9869 9869
 		
9870 9870
 		$bitly_data = json_decode($bitly_data);
9871 9871
 		$bitly_url = '';
9872
-		if ($bitly_data->status_txt = "OK"){
9872
+		if ($bitly_data->status_txt = "OK") {
9873 9873
 			$bitly_url = $bitly_data->data->url;
9874 9874
 		}
9875 9875
 
@@ -9879,7 +9879,7 @@  discard block
 block discarded – undo
9879 9879
 
9880 9880
 	public function getOrderBy()
9881 9881
 	{
9882
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC"));
9882
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC"));
9883 9883
 		
9884 9884
 		return $orderby;
9885 9885
 		
@@ -10013,14 +10013,14 @@  discard block
 block discarded – undo
10013 10013
 		}
10014 10014
 		$sth = $this->db->prepare($query);
10015 10015
 		$sth->execute();
10016
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10016
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10017 10017
 		{
10018 10018
 			$departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']);
10019 10019
 			$arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']);
10020 10020
 			if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) {
10021
-				$update_query="UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id";
10021
+				$update_query = "UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id";
10022 10022
 				$sthu = $this->db->prepare($update_query);
10023
-				$sthu->execute(array(':fromicao' => $row['fromairport_icao'],':toicao' => $row['toairport_icao'],':spotter_id' => $row['spotter_id'],':departure_airport_name' => $departure_airport_array[0]['name'],':departure_airport_city' => $departure_airport_array[0]['city'],':departure_airport_country' => $departure_airport_array[0]['country'],':arrival_airport_name' => $arrival_airport_array[0]['name'],':arrival_airport_city' => $arrival_airport_array[0]['city'],':arrival_airport_country' => $arrival_airport_array[0]['country']));
10023
+				$sthu->execute(array(':fromicao' => $row['fromairport_icao'], ':toicao' => $row['toairport_icao'], ':spotter_id' => $row['spotter_id'], ':departure_airport_name' => $departure_airport_array[0]['name'], ':departure_airport_city' => $departure_airport_array[0]['city'], ':departure_airport_country' => $departure_airport_array[0]['country'], ':arrival_airport_name' => $arrival_airport_array[0]['name'], ':arrival_airport_city' => $arrival_airport_array[0]['city'], ':arrival_airport_country' => $arrival_airport_array[0]['country']));
10024 10024
 			}
10025 10025
 		}
10026 10026
 		
@@ -10033,7 +10033,7 @@  discard block
 block discarded – undo
10033 10033
 		}
10034 10034
 		$sth = $this->db->prepare($query);
10035 10035
 		$sth->execute();
10036
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10036
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10037 10037
 		{
10038 10038
 			if (is_numeric(substr($row['ident'], -1, 1)))
10039 10039
 			{
@@ -10042,11 +10042,11 @@  discard block
 block discarded – undo
10042 10042
 				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
10043 10043
 				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
10044 10044
 				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
10045
-				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
10045
+				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
10046 10046
 				if (isset($airline_array[0]['name'])) {
10047
-					$update_query  = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id";
10047
+					$update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id";
10048 10048
 					$sthu = $this->db->prepare($update_query);
10049
-					$sthu->execute(array(':airline_name' => $airline_array[0]['name'],':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id']));
10049
+					$sthu->execute(array(':airline_name' => $airline_array[0]['name'], ':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id']));
10050 10050
 				}
10051 10051
 			}
10052 10052
 		}
@@ -10066,18 +10066,18 @@  discard block
 block discarded – undo
10066 10066
 		}
10067 10067
 		$sth = $this->db->prepare($query);
10068 10068
 		$sth->execute();
10069
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10069
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10070 10070
 		{
10071 10071
 			if ($row['aircraft_icao'] != '') {
10072 10072
 				$aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']);
10073
-				if ($row['registration'] != ""){
10073
+				if ($row['registration'] != "") {
10074 10074
 					$image_array = $Image->getSpotterImage($row['registration']);
10075 10075
 					if (!isset($image_array[0]['registration'])) {
10076 10076
 						$Image->addSpotterImage($row['registration']);
10077 10077
 					}
10078 10078
 				}
10079 10079
 				if (count($aircraft_name) > 0) {
10080
-					$update_query  = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id";
10080
+					$update_query = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id";
10081 10081
 					$sthu = $this->db->prepare($update_query);
10082 10082
 					$sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id']));
10083 10083
 				}
@@ -10092,10 +10092,10 @@  discard block
 block discarded – undo
10092 10092
 		$query = "SELECT spotter_output.spotter_id, spotter_output.last_latitude, spotter_output.last_longitude, spotter_output.last_altitude, spotter_output.arrival_airport_icao, spotter_output.real_arrival_airport_icao FROM spotter_output";
10093 10093
 		$sth = $this->db->prepare($query);
10094 10094
 		$sth->execute();
10095
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10095
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10096 10096
 		{
10097 10097
 			if ($row['last_latitude'] != '' && $row['last_longitude'] != '') {
10098
-				$closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist);
10098
+				$closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist);
10099 10099
 				$airport_icao = '';
10100 10100
 				 if (isset($closestAirports[0])) {
10101 10101
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
@@ -10109,7 +10109,7 @@  discard block
 block discarded – undo
10109 10109
 								break;
10110 10110
 							}
10111 10111
 						}
10112
-					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
10112
+					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) {
10113 10113
 						$airport_icao = $closestAirports[0]['icao'];
10114 10114
 						if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." !  Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10115 10115
 					} else {
@@ -10120,28 +10120,28 @@  discard block
 block discarded – undo
10120 10120
 				}
10121 10121
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
10122 10122
 					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
10123
-					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10123
+					$update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10124 10124
 					$sthu = $this->db->prepare($update_query);
10125
-					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
10125
+					$sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id']));
10126 10126
 				}
10127 10127
 			}
10128 10128
 		}
10129 10129
 	}
10130 10130
 	
10131
-	public function closestAirports($origLat,$origLon,$dist = 10) {
10131
+	public function closestAirports($origLat, $origLon, $dist = 10) {
10132 10132
 		global $globalDBdriver;
10133
-		$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
10133
+		$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
10134 10134
 /*
10135 10135
 		$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - abs(latitude))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(abs(latitude)*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
10136 10136
                       FROM airport WHERE longitude between ($origLon-$dist/abs(cos(radians($origLat))*69)) and ($origLon+$dist/abs(cos(radians($origLat))*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
10137 10137
                       having distance < $dist ORDER BY distance limit 100;";
10138 10138
 */
10139 10139
 		if ($globalDBdriver == 'mysql') {
10140
-			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
10140
+			$query = "SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
10141 10141
 	                      FROM airport WHERE longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
10142 10142
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
10143 10143
                 } else {
10144
-			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance 
10144
+			$query = "SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance 
10145 10145
 	                      FROM airport WHERE CAST(longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
10146 10146
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
10147 10147
     		}
Please login to merge, or discard this patch.
Braces   +667 added lines, -231 removed lines patch added patch discarded remove patch
@@ -27,7 +27,9 @@  discard block
 block discarded – undo
27 27
 				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
28 28
 			}
29 29
 		}
30
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
30
+		if (is_array($globalFilter)) {
31
+			$filter = array_merge($filter,$globalFilter);
32
+		}
31 33
 		$filter_query_join = '';
32 34
 		$filter_query_where = '';
33 35
 		foreach($filters as $flt) {
@@ -77,8 +79,11 @@  discard block
 block discarded – undo
77 79
 				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
78 80
 			}
79 81
 		}
80
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
81
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
82
+		if ($filter_query_where == '' && $where) {
83
+			$filter_query_where = ' WHERE';
84
+		} elseif ($filter_query_where != '' && $and) {
85
+			$filter_query_where .= ' AND';
86
+		}
82 87
 		$filter_query = $filter_query_join.$filter_query_where;
83 88
 		return $filter_query;
84 89
 	}
@@ -98,10 +103,18 @@  discard block
 block discarded – undo
98 103
 		$Image = new Image($this->db);
99 104
 		$Schedule = new Schedule($this->db);
100 105
 		$ACARS = new ACARS($this->db);
101
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
102
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
103
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
104
-		if (!isset($globalVAM)) $globalVAM = FALSE;
106
+		if (!isset($globalIVAO)) {
107
+			$globalIVAO = FALSE;
108
+		}
109
+		if (!isset($globalVATSIM)) {
110
+			$globalVATSIM = FALSE;
111
+		}
112
+		if (!isset($globalphpVMS)) {
113
+			$globalphpVMS = FALSE;
114
+		}
115
+		if (!isset($globalVAM)) {
116
+			$globalVAM = FALSE;
117
+		}
105 118
 		date_default_timezone_set('UTC');
106 119
 		
107 120
 		if (!is_string($query))
@@ -148,21 +161,35 @@  discard block
 block discarded – undo
148 161
 			} else {
149 162
 				$temp_array['spotter_id'] = '';
150 163
 			}
151
-			if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id'];
152
-			if (isset($row['modes'])) $temp_array['modes'] = $row['modes'];
164
+			if (isset($row['flightaware_id'])) {
165
+				$temp_array['flightaware_id'] = $row['flightaware_id'];
166
+			}
167
+			if (isset($row['modes'])) {
168
+				$temp_array['modes'] = $row['modes'];
169
+			}
153 170
 			$temp_array['ident'] = $row['ident'];
154 171
 			if (isset($row['registration']) && $row['registration'] != '') {
155 172
 				$temp_array['registration'] = $row['registration'];
156 173
 			} elseif (isset($temp_array['modes'])) {
157 174
 				$temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']);
158
-			} else $temp_array['registration'] = '';
159
-			if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao'];
175
+			} else {
176
+				$temp_array['registration'] = '';
177
+			}
178
+			if (isset($row['aircraft_icao'])) {
179
+				$temp_array['aircraft_type'] = $row['aircraft_icao'];
180
+			}
160 181
 			
161 182
 			$temp_array['departure_airport'] = $row['departure_airport_icao'];
162 183
 			$temp_array['arrival_airport'] = $row['arrival_airport_icao'];
163
-			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
164
-			if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude'];
165
-			if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude'];
184
+			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) {
185
+				$temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
186
+			}
187
+			if (isset($row['latitude'])) {
188
+				$temp_array['latitude'] = $row['latitude'];
189
+			}
190
+			if (isset($row['longitude'])) {
191
+				$temp_array['longitude'] = $row['longitude'];
192
+			}
166 193
 			/*
167 194
 			if (Connection->tableExists('countries')) {
168 195
 				$country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']);
@@ -172,8 +199,12 @@  discard block
 block discarded – undo
172 199
 				}
173 200
 			}
174 201
 			*/
175
-			if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints'];
176
-			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
202
+			if (isset($row['waypoints'])) {
203
+				$temp_array['waypoints'] = $row['waypoints'];
204
+			}
205
+			if (isset($row['format_source'])) {
206
+				$temp_array['format_source'] = $row['format_source'];
207
+			}
177 208
 			if (isset($row['route_stop'])) {
178 209
 				$temp_array['route_stop'] = $row['route_stop'];
179 210
 				if ($row['route_stop'] != '') {
@@ -192,13 +223,19 @@  discard block
 block discarded – undo
192 223
 					}
193 224
 				}
194 225
 			}
195
-			if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude'];
226
+			if (isset($row['altitude'])) {
227
+				$temp_array['altitude'] = $row['altitude'];
228
+			}
196 229
 			if (isset($row['heading'])) {
197 230
 				$temp_array['heading'] = $row['heading'];
198 231
 				$heading_direction = $this->parseDirection($row['heading']);
199
-				if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
232
+				if (isset($heading_direction[0]['direction_fullname'])) {
233
+					$temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
234
+				}
235
+			}
236
+			if (isset($row['ground_speed'])) {
237
+				$temp_array['ground_speed'] = $row['ground_speed'];
200 238
 			}
201
-			if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed'];
202 239
 			$temp_array['image'] = "";
203 240
 			$temp_array['image_thumbnail'] = "";
204 241
 			$temp_array['image_source'] = "";
@@ -206,7 +243,9 @@  discard block
 block discarded – undo
206 243
  
207 244
 			if (isset($row['highlight'])) {
208 245
 				$temp_array['highlight'] = $row['highlight'];
209
-			} else $temp_array['highlight'] = '';
246
+			} else {
247
+				$temp_array['highlight'] = '';
248
+			}
210 249
 			
211 250
 			if (isset($row['date'])) {
212 251
 				$dateArray = $this->parseDateString($row['date']);
@@ -254,7 +293,9 @@  discard block
 block discarded – undo
254 293
 				
255 294
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
256 295
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
257
-					} else $temp_array['aircraft_shadow'] = 'default.png';
296
+					} else {
297
+						$temp_array['aircraft_shadow'] = 'default.png';
298
+					}
258 299
                                 } else {
259 300
                             		$temp_array['aircraft_shadow'] = 'default.png';
260 301
 					$temp_array['aircraft_name'] = 'N/A';
@@ -262,11 +303,17 @@  discard block
 block discarded – undo
262 303
                             	}
263 304
 			}
264 305
 			$fromsource = NULL;
265
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
266
-			elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
267
-			elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
268
-			elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
269
-			elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
306
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
307
+				$fromsource = $globalAirlinesSource;
308
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
309
+				$fromsource = 'vatsim';
310
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
311
+				$fromsource = 'ivao';
312
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
313
+				$fromsource = 'vatsim';
314
+			} elseif (isset($globalIVAO) && $globalIVAO) {
315
+				$fromsource = 'ivao';
316
+			}
270 317
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
271 318
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
272 319
 					if (is_numeric(substr($row['ident'], 2, 1))) {
@@ -289,12 +336,18 @@  discard block
 block discarded – undo
289 336
 				}
290 337
 			} else {
291 338
 				$temp_array['airline_icao'] = $row['airline_icao'];
292
-				if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata'];
293
-				else $temp_array['airline_iata'] = 'N/A';
339
+				if (isset($row['airline_iata'])) {
340
+					$temp_array['airline_iata'] = $row['airline_iata'];
341
+				} else {
342
+					$temp_array['airline_iata'] = 'N/A';
343
+				}
294 344
 				$temp_array['airline_name'] = $row['airline_name'];
295 345
 				$temp_array['airline_country'] = $row['airline_country'];
296
-				if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign'];
297
-				else $temp_array['airline_callsign'] = 'N/A';
346
+				if (isset($row['airline_callsign'])) {
347
+					$temp_array['airline_callsign'] = $row['airline_callsign'];
348
+				} else {
349
+					$temp_array['airline_callsign'] = 'N/A';
350
+				}
298 351
 				$temp_array['airline_type'] = $row['airline_type'];
299 352
 				if ($temp_array['airline_icao'] != '' && $temp_array['airline_iata'] == 'N/A') {
300 353
 					$airline_array = $this->getAllAirlineInfo($temp_array['airline_icao']);
@@ -321,7 +374,9 @@  discard block
 block discarded – undo
321 374
 			}
322 375
 			if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) {
323 376
 				$owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']);
324
-				if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
377
+				if ($owner_info['owner'] != '') {
378
+					$temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
379
+				}
325 380
 				$temp_array['aircraft_base'] = $owner_info['base'];
326 381
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
327 382
 			}
@@ -329,9 +384,14 @@  discard block
 block discarded – undo
329 384
 			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
330 385
 			{
331 386
 				if ($globalIVAO) {
332
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
333
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
334
-				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
387
+					if (isset($temp_array['airline_icao'])) {
388
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
389
+					} else {
390
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
391
+					}
392
+				} else {
393
+					$image_array = $Image->getSpotterImage($temp_array['registration']);
394
+				}
335 395
 				if (count($image_array) > 0) {
336 396
 					$temp_array['image'] = $image_array[0]['image'];
337 397
 					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -382,7 +442,9 @@  discard block
 block discarded – undo
382 442
 			//if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') {
383 443
 			if ($row['departure_airport_icao'] != '') {
384 444
 				$departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']);
385
-				if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA');
445
+				if (!isset($departure_airport_array[0]['name'])) {
446
+					$departure_airport_array = $this->getAllAirportInfo('NA');
447
+				}
386 448
 			/*
387 449
 			} elseif ($row['departure_airport_name'] != '') {
388 450
 				$temp_array['departure_airport_name'] = $row['departure_airport_name'];
@@ -390,7 +452,9 @@  discard block
 block discarded – undo
390 452
 				$temp_array['departure_airport_country'] = $row['departure_airport_country'];
391 453
 				$temp_array['departure_airport_icao'] = $row['departure_airport_icao'];
392 454
 			*/
393
-			} else $departure_airport_array = $this->getAllAirportInfo('NA');
455
+			} else {
456
+				$departure_airport_array = $this->getAllAirportInfo('NA');
457
+			}
394 458
 			if (isset($departure_airport_array[0]['name'])) {
395 459
 				$temp_array['departure_airport_name'] = $departure_airport_array[0]['name'];
396 460
 				$temp_array['departure_airport_city'] = $departure_airport_array[0]['city'];
@@ -410,8 +474,12 @@  discard block
 block discarded – undo
410 474
 			
411 475
 			if ($row['arrival_airport_icao'] != '') {
412 476
 				$arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']);
413
-				if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA');
414
-			} else $arrival_airport_array = $this->getAllAirportInfo('NA');
477
+				if (count($arrival_airport_array) == 0) {
478
+					$arrival_airport_array = $this->getAllAirportInfo('NA');
479
+				}
480
+			} else {
481
+				$arrival_airport_array = $this->getAllAirportInfo('NA');
482
+			}
415 483
 			if (isset($arrival_airport_array[0]['name'])) {
416 484
 				$temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name'];
417 485
 				$temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city'];
@@ -427,27 +495,45 @@  discard block
 block discarded – undo
427 495
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
428 496
 			}
429 497
 			*/
430
-			if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id'];
431
-			if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name'];
432
-			if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name'];
433
-			if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country'];
434
-			if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance'];
498
+			if (isset($row['pilot_id']) && $row['pilot_id'] != '') {
499
+				$temp_array['pilot_id'] = $row['pilot_id'];
500
+			}
501
+			if (isset($row['pilot_name']) && $row['pilot_name'] != '') {
502
+				$temp_array['pilot_name'] = $row['pilot_name'];
503
+			}
504
+			if (isset($row['source_name']) && $row['source_name'] != '') {
505
+				$temp_array['source_name'] = $row['source_name'];
506
+			}
507
+			if (isset($row['over_country']) && $row['over_country'] != '') {
508
+				$temp_array['over_country'] = $row['over_country'];
509
+			}
510
+			if (isset($row['distance']) && $row['distance'] != '') {
511
+				$temp_array['distance'] = $row['distance'];
512
+			}
435 513
 			if (isset($row['squawk'])) {
436 514
 				$temp_array['squawk'] = $row['squawk'];
437 515
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
438 516
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
439
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
517
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
518
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
519
+					}
440 520
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
441 521
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
442
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
443
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
522
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
523
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
524
+					}
525
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) {
526
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
527
+				}
444 528
 			}
445 529
     			
446 530
 			$temp_array['query_number_rows'] = $num_rows;
447 531
 			
448 532
 			$spotter_array[] = $temp_array;
449 533
 		}
450
-		if ($num_rows == 0) return array();
534
+		if ($num_rows == 0) {
535
+			return array();
536
+		}
451 537
 		$spotter_array[0]['query_number_rows'] = $num_rows;
452 538
 		return $spotter_array;
453 539
 	}	
@@ -480,7 +566,9 @@  discard block
 block discarded – undo
480 566
 				foreach ($q_array as $q_item){
481 567
 					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
482 568
 					$additional_query .= " AND (";
483
-					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
569
+					if (is_int($q_item)) {
570
+						$additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
571
+					}
484 572
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
485 573
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
486 574
 					$additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR ";
@@ -501,7 +589,9 @@  discard block
 block discarded – undo
501 589
 					$additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR ";
502 590
 					$additional_query .= "(spotter_output.ident like '%".$q_item."%') OR ";
503 591
 					$translate = $Translation->ident2icao($q_item);
504
-					if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
592
+					if ($translate != $q_item) {
593
+						$additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
594
+					}
505 595
 					$additional_query .= "(spotter_output.highlight like '%".$q_item."%')";
506 596
 					$additional_query .= ")";
507 597
 				}
@@ -728,7 +818,9 @@  discard block
 block discarded – undo
728 818
 				date_default_timezone_set($globalTimezone);
729 819
 				$datetime = new DateTime();
730 820
 				$offset = $datetime->format('P');
731
-			} else $offset = '+00:00';
821
+			} else {
822
+				$offset = '+00:00';
823
+			}
732 824
 
733 825
 			if ($date_array[1] != "")
734 826
 			{
@@ -760,8 +852,12 @@  discard block
 block discarded – undo
760 852
 			{
761 853
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
762 854
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
763
-			} else $limit_query = "";
764
-		} else $limit_query = "";
855
+			} else {
856
+				$limit_query = "";
857
+			}
858
+		} else {
859
+			$limit_query = "";
860
+		}
765 861
 
766 862
 
767 863
 		if ($sort != "")
@@ -829,8 +925,12 @@  discard block
 block discarded – undo
829 925
 			{
830 926
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
831 927
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
832
-			} else $limit_query = "";
833
-		} else $limit_query = "";
928
+			} else {
929
+				$limit_query = "";
930
+			}
931
+		} else {
932
+			$limit_query = "";
933
+		}
834 934
 		
835 935
 		if ($sort != "")
836 936
 		{
@@ -1154,7 +1254,9 @@  discard block
 block discarded – undo
1154 1254
 		global $global_query;
1155 1255
 		
1156 1256
 		date_default_timezone_set('UTC');
1157
-		if ($id == '') return array();
1257
+		if ($id == '') {
1258
+			return array();
1259
+		}
1158 1260
 		$additional_query = "spotter_output.spotter_id = :id";
1159 1261
 		$query_values = array(':id' => $id);
1160 1262
 
@@ -1781,7 +1883,9 @@  discard block
 block discarded – undo
1781 1883
 		{
1782 1884
 			$highlight = $row['highlight'];
1783 1885
 		}
1784
-		if (isset($highlight)) return $highlight;
1886
+		if (isset($highlight)) {
1887
+			return $highlight;
1888
+		}
1785 1889
 	}
1786 1890
 
1787 1891
 	
@@ -1809,7 +1913,9 @@  discard block
 block discarded – undo
1809 1913
 		$sth->closeCursor();
1810 1914
 		if (count($row) > 0) {
1811 1915
 			return $row['usage'];
1812
-		} else return '';
1916
+		} else {
1917
+			return '';
1918
+		}
1813 1919
 	}
1814 1920
 
1815 1921
 	/**
@@ -1834,7 +1940,9 @@  discard block
 block discarded – undo
1834 1940
 		$sth->closeCursor();
1835 1941
 		if (count($row) > 0) {
1836 1942
 			return $row['icao'];
1837
-		} else return '';
1943
+		} else {
1944
+			return '';
1945
+		}
1838 1946
 	}
1839 1947
 
1840 1948
 	/**
@@ -1862,7 +1970,9 @@  discard block
 block discarded – undo
1862 1970
 			$airport_longitude = $row['longitude'];
1863 1971
 			$Common = new Common();
1864 1972
 			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
1865
-		} else return '';
1973
+		} else {
1974
+			return '';
1975
+		}
1866 1976
 	}
1867 1977
 	
1868 1978
 	/**
@@ -1974,7 +2084,9 @@  discard block
 block discarded – undo
1974 2084
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1975 2085
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1976 2086
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1977
-		} else return array();
2087
+		} else {
2088
+			return array();
2089
+		}
1978 2090
 		if ($globalDBdriver == 'mysql') {
1979 2091
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
1980 2092
 		} else {
@@ -2009,7 +2121,9 @@  discard block
 block discarded – undo
2009 2121
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2010 2122
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2011 2123
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2012
-		} else return array();
2124
+		} else {
2125
+			return array();
2126
+		}
2013 2127
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2014 2128
 		$query  = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")";
2015 2129
 		//$query  = "SELECT waypoints.* FROM waypoints";
@@ -2044,7 +2158,9 @@  discard block
 block discarded – undo
2044 2158
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2045 2159
 	{
2046 2160
 		global $globalUseRealAirlines;
2047
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2161
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2162
+			$fromsource = NULL;
2163
+		}
2048 2164
 		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2049 2165
 		if ($airline_icao == 'NA') {
2050 2166
 			$airline_array = array();
@@ -2094,7 +2210,9 @@  discard block
 block discarded – undo
2094 2210
 				$sth->execute(array(':fromsource' => $fromsource));
2095 2211
 				$row = $sth->fetch(PDO::FETCH_ASSOC);
2096 2212
 				$sth->closeCursor();
2097
-				if ($row['nb'] == 0) $result = $this->getAllAirlineInfo($airline_icao);
2213
+				if ($row['nb'] == 0) {
2214
+					$result = $this->getAllAirlineInfo($airline_icao);
2215
+				}
2098 2216
 			}
2099 2217
 			return $result;
2100 2218
 		}
@@ -2158,15 +2276,20 @@  discard block
 block discarded – undo
2158 2276
 				'A320-211' => 'A320',
2159 2277
 				'747-8i' => 'B748',
2160 2278
 				'A380' => 'A388');
2161
-		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2279
+		if (isset($all_aircraft[$aircraft_type])) {
2280
+			return $all_aircraft[$aircraft_type];
2281
+		}
2162 2282
 
2163 2283
 		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2164 2284
 		$aircraft_type = strtoupper($aircraft_type);
2165 2285
 		$sth = $this->db->prepare($query);
2166 2286
 		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2167 2287
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2168
-		if (isset($result[0]['icao'])) return $result[0]['icao'];
2169
-		else return '';
2288
+		if (isset($result[0]['icao'])) {
2289
+			return $result[0]['icao'];
2290
+		} else {
2291
+			return '';
2292
+		}
2170 2293
 	}
2171 2294
 	
2172 2295
 	/**
@@ -2189,7 +2312,9 @@  discard block
 block discarded – undo
2189 2312
 		$sth->closeCursor();
2190 2313
 		if (isset($row['icaotypecode'])) {
2191 2314
 			return $row['icaotypecode'];
2192
-		} else return '';
2315
+		} else {
2316
+			return '';
2317
+		}
2193 2318
 	}
2194 2319
 
2195 2320
 	/**
@@ -2211,7 +2336,9 @@  discard block
 block discarded – undo
2211 2336
 		$sth->closeCursor();
2212 2337
 		if (isset($row['operator_correct'])) {
2213 2338
 			return $row['operator_correct'];
2214
-		} else return $operator;
2339
+		} else {
2340
+			return $operator;
2341
+		}
2215 2342
 	}
2216 2343
 
2217 2344
 	/**
@@ -2224,7 +2351,9 @@  discard block
 block discarded – undo
2224 2351
 	public function getRouteInfo($callsign)
2225 2352
 	{
2226 2353
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2227
-                if ($callsign == '') return array();
2354
+                if ($callsign == '') {
2355
+                	return array();
2356
+                }
2228 2357
 		$query  = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2229 2358
 		
2230 2359
 		$sth = $this->db->prepare($query);
@@ -2234,7 +2363,9 @@  discard block
 block discarded – undo
2234 2363
 		$sth->closeCursor();
2235 2364
 		if (count($row) > 0) {
2236 2365
 			return $row;
2237
-		} else return array();
2366
+		} else {
2367
+			return array();
2368
+		}
2238 2369
 	}
2239 2370
 	
2240 2371
 	/**
@@ -2287,7 +2418,9 @@  discard block
 block discarded – undo
2287 2418
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
2288 2419
 			$sth->closeCursor();
2289 2420
 			return $result;
2290
-		} else return array();
2421
+		} else {
2422
+			return array();
2423
+		}
2291 2424
 	}
2292 2425
 	
2293 2426
   
@@ -2444,8 +2577,11 @@  discard block
 block discarded – undo
2444 2577
 		$query .= " ORDER BY spotter_output.source_name ASC";
2445 2578
 
2446 2579
 		$sth = $this->db->prepare($query);
2447
-		if (!empty($query_values)) $sth->execute($query_values);
2448
-		else $sth->execute();
2580
+		if (!empty($query_values)) {
2581
+			$sth->execute($query_values);
2582
+		} else {
2583
+			$sth->execute();
2584
+		}
2449 2585
 
2450 2586
 		$source_array = array();
2451 2587
 		$temp_array = array();
@@ -2478,9 +2614,13 @@  discard block
 block discarded – undo
2478 2614
 								WHERE spotter_output.airline_icao <> '' 
2479 2615
 								ORDER BY spotter_output.airline_name ASC";
2480 2616
 			*/
2481
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2482
-			elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2483
-			elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2617
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2618
+				$forsource = $globalAirlinesSource;
2619
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
2620
+				$forsource = 'vatsim';
2621
+			} elseif (isset($globalIVAO) && $globalIVAO) {
2622
+				$forsource = 'ivao';
2623
+			}
2484 2624
 			if ($forsource === NULL) {
2485 2625
 				$query = "SELECT DISTINCT icao AS airline_icao, name AS airline_name, type AS airline_type FROM airlines WHERE forsource IS NULL ORDER BY name ASC";
2486 2626
 				$query_data = array();
@@ -2772,7 +2912,9 @@  discard block
 block discarded – undo
2772 2912
 			date_default_timezone_set($globalTimezone);
2773 2913
 			$datetime = new DateTime();
2774 2914
 			$offset = $datetime->format('P');
2775
-		} else $offset = '+00:00';
2915
+		} else {
2916
+			$offset = '+00:00';
2917
+		}
2776 2918
 		if ($airport_icao == '') {
2777 2919
 			if ($globalDBdriver == 'mysql') {
2778 2920
 				$query = "SELECT COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' GROUP BY departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -2804,7 +2946,9 @@  discard block
 block discarded – undo
2804 2946
 			date_default_timezone_set($globalTimezone);
2805 2947
 			$datetime = new DateTime();
2806 2948
 			$offset = $datetime->format('P');
2807
-		} else $offset = '+00:00';
2949
+		} else {
2950
+			$offset = '+00:00';
2951
+		}
2808 2952
 		if ($airport_icao == '') {
2809 2953
 			if ($globalDBdriver == 'mysql') {
2810 2954
 				$query = "SELECT spotter_output.airline_icao, COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -2837,7 +2981,9 @@  discard block
 block discarded – undo
2837 2981
 			date_default_timezone_set($globalTimezone);
2838 2982
 			$datetime = new DateTime();
2839 2983
 			$offset = $datetime->format('P');
2840
-		} else $offset = '+00:00';
2984
+		} else {
2985
+			$offset = '+00:00';
2986
+		}
2841 2987
 		if ($airport_icao == '') {
2842 2988
 			if ($globalDBdriver == 'mysql') {
2843 2989
 				$query = "SELECT COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -2876,7 +3022,9 @@  discard block
 block discarded – undo
2876 3022
 			date_default_timezone_set($globalTimezone);
2877 3023
 			$datetime = new DateTime();
2878 3024
 			$offset = $datetime->format('P');
2879
-		} else $offset = '+00:00';
3025
+		} else {
3026
+			$offset = '+00:00';
3027
+		}
2880 3028
 		if ($airport_icao == '') {
2881 3029
 			if ($globalDBdriver == 'mysql') {
2882 3030
 				$query = "SELECT spotter_output.airline_icao, COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -2921,7 +3069,9 @@  discard block
 block discarded – undo
2921 3069
 			date_default_timezone_set($globalTimezone);
2922 3070
 			$datetime = new DateTime();
2923 3071
 			$offset = $datetime->format('P');
2924
-		} else $offset = '+00:00';
3072
+		} else {
3073
+			$offset = '+00:00';
3074
+		}
2925 3075
 		if ($airport_icao == '') {
2926 3076
 			if ($globalDBdriver == 'mysql') {
2927 3077
 				$query = "SELECT COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' GROUP BY arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -2956,7 +3106,9 @@  discard block
 block discarded – undo
2956 3106
 			date_default_timezone_set($globalTimezone);
2957 3107
 			$datetime = new DateTime();
2958 3108
 			$offset = $datetime->format('P');
2959
-		} else $offset = '+00:00';
3109
+		} else {
3110
+			$offset = '+00:00';
3111
+		}
2960 3112
 		if ($airport_icao == '') {
2961 3113
 			if ($globalDBdriver == 'mysql') {
2962 3114
 				$query = "SELECT COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -2998,7 +3150,9 @@  discard block
 block discarded – undo
2998 3150
 			date_default_timezone_set($globalTimezone);
2999 3151
 			$datetime = new DateTime();
3000 3152
 			$offset = $datetime->format('P');
3001
-		} else $offset = '+00:00';
3153
+		} else {
3154
+			$offset = '+00:00';
3155
+		}
3002 3156
 		if ($airport_icao == '') {
3003 3157
 			if ($globalDBdriver == 'mysql') {
3004 3158
 				$query = "SELECT spotter_output.airline_icao, COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -3032,7 +3186,9 @@  discard block
 block discarded – undo
3032 3186
 			date_default_timezone_set($globalTimezone);
3033 3187
 			$datetime = new DateTime();
3034 3188
 			$offset = $datetime->format('P');
3035
-		} else $offset = '+00:00';
3189
+		} else {
3190
+			$offset = '+00:00';
3191
+		}
3036 3192
 		if ($airport_icao == '') {
3037 3193
 			if ($globalDBdriver == 'mysql') {
3038 3194
 				$query = "SELECT spotter_output.airline_icao, COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -3080,7 +3236,9 @@  discard block
 block discarded – undo
3080 3236
 			date_default_timezone_set($globalTimezone);
3081 3237
 			$datetime = new DateTime();
3082 3238
 			$offset = $datetime->format('P');
3083
-		} else $offset = '+00:00';
3239
+		} else {
3240
+			$offset = '+00:00';
3241
+		}
3084 3242
 
3085 3243
 		if ($globalDBdriver == 'mysql') {
3086 3244
 			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
@@ -3200,7 +3358,9 @@  discard block
 block discarded – undo
3200 3358
 	*/	
3201 3359
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3202 3360
 	{
3203
-		if ($groundspeed == '') $groundspeed = NULL;
3361
+		if ($groundspeed == '') {
3362
+			$groundspeed = NULL;
3363
+		}
3204 3364
 		$query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id';
3205 3365
                 $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3206 3366
 
@@ -3250,10 +3410,18 @@  discard block
 block discarded – undo
3250 3410
 		$Image = new Image($this->db);
3251 3411
 		$Common = new Common();
3252 3412
 		
3253
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
3254
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
3255
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
3256
-		if (!isset($globalVAM)) $globalVAM = FALSE;
3413
+		if (!isset($globalIVAO)) {
3414
+			$globalIVAO = FALSE;
3415
+		}
3416
+		if (!isset($globalVATSIM)) {
3417
+			$globalVATSIM = FALSE;
3418
+		}
3419
+		if (!isset($globalphpVMS)) {
3420
+			$globalphpVMS = FALSE;
3421
+		}
3422
+		if (!isset($globalVAM)) {
3423
+			$globalVAM = FALSE;
3424
+		}
3257 3425
 		date_default_timezone_set('UTC');
3258 3426
 		
3259 3427
 		//getting the registration
@@ -3266,23 +3434,33 @@  discard block
 block discarded – undo
3266 3434
 				if ($ModeS != '') {
3267 3435
 					$timeelapsed = microtime(true);
3268 3436
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3269
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3437
+					if ($globalDebugTimeElapsed) {
3438
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3439
+					}
3270 3440
 				} else {
3271 3441
 					$myhex = explode('-',$flightaware_id);
3272 3442
 					if (count($myhex) > 0) {
3273 3443
 						$timeelapsed = microtime(true);
3274 3444
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3275
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3445
+						if ($globalDebugTimeElapsed) {
3446
+							echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3447
+						}
3276 3448
 					}
3277 3449
 				}
3278 3450
 			}
3279 3451
 		}
3280 3452
 		$fromsource = NULL;
3281
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
3282
-		elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim';
3283
-		elseif ($format_source == 'whazzup') $fromsource = 'ivao';
3284
-		elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
3285
-		elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
3453
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
3454
+			$fromsource = $globalAirlinesSource;
3455
+		} elseif ($format_source == 'vatsimtxt') {
3456
+			$fromsource = 'vatsim';
3457
+		} elseif ($format_source == 'whazzup') {
3458
+			$fromsource = 'ivao';
3459
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
3460
+			$fromsource = 'vatsim';
3461
+		} elseif (isset($globalIVAO) && $globalIVAO) {
3462
+			$fromsource = 'ivao';
3463
+		}
3286 3464
 		//getting the airline information
3287 3465
 		if ($ident != "")
3288 3466
 		{
@@ -3306,15 +3484,21 @@  discard block
 block discarded – undo
3306 3484
 					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3307 3485
 						$airline_array = $this->getAllAirlineInfo("NA");
3308 3486
 					}
3309
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3487
+					if ($globalDebugTimeElapsed) {
3488
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3489
+					}
3310 3490
 
3311 3491
 				} else {
3312 3492
 					$timeelapsed = microtime(true);
3313 3493
 					$airline_array = $this->getAllAirlineInfo("NA");
3314
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3494
+					if ($globalDebugTimeElapsed) {
3495
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3496
+					}
3315 3497
 				}
3316 3498
 			}
3317
-		} else $airline_array = array();
3499
+		} else {
3500
+			$airline_array = array();
3501
+		}
3318 3502
 		
3319 3503
 		//getting the aircraft information
3320 3504
 		$aircraft_array = array();
@@ -3328,27 +3512,37 @@  discard block
 block discarded – undo
3328 3512
 				{
3329 3513
 					$timeelapsed = microtime(true);
3330 3514
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3331
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3515
+					if ($globalDebugTimeElapsed) {
3516
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3517
+					}
3332 3518
 				} else {
3333 3519
 					$timeelapsed = microtime(true);
3334 3520
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3335
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3521
+					if ($globalDebugTimeElapsed) {
3522
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3523
+					}
3336 3524
 				}
3337 3525
 			}
3338 3526
 		} else {
3339 3527
 			if ($ModeS != '') {
3340 3528
 				$timeelapsed = microtime(true);
3341 3529
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3342
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3530
+				if ($globalDebugTimeElapsed) {
3531
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3532
+				}
3343 3533
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3344 3534
 				{
3345 3535
 					$timeelapsed = microtime(true);
3346 3536
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3347
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3537
+					if ($globalDebugTimeElapsed) {
3538
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3539
+					}
3348 3540
 				} else {
3349 3541
 					$timeelapsed = microtime(true);
3350 3542
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3351
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3543
+					if ($globalDebugTimeElapsed) {
3544
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3545
+					}
3352 3546
 				}
3353 3547
 			}
3354 3548
 		}
@@ -3363,7 +3557,9 @@  discard block
 block discarded – undo
3363 3557
 			} else {
3364 3558
 				$timeelapsed = microtime(true);
3365 3559
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3366
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3560
+				if ($globalDebugTimeElapsed) {
3561
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3562
+				}
3367 3563
 			}
3368 3564
 		}
3369 3565
 		
@@ -3377,7 +3573,9 @@  discard block
 block discarded – undo
3377 3573
 			} else {
3378 3574
 				$timeelapsed = microtime(true);
3379 3575
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3380
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3576
+				if ($globalDebugTimeElapsed) {
3577
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3578
+				}
3381 3579
 			}
3382 3580
 		}
3383 3581
 
@@ -3412,7 +3610,9 @@  discard block
 block discarded – undo
3412 3610
 			{
3413 3611
 				return false;
3414 3612
 			}
3415
-		} else $altitude = 0;
3613
+		} else {
3614
+			$altitude = 0;
3615
+		}
3416 3616
 		
3417 3617
 		if ($heading != "")
3418 3618
 		{
@@ -3441,7 +3641,9 @@  discard block
 block discarded – undo
3441 3641
 		{
3442 3642
 			$timeelapsed = microtime(true);
3443 3643
 			$image_array = $Image->getSpotterImage($registration);
3444
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3644
+			if ($globalDebugTimeElapsed) {
3645
+				echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3646
+			}
3445 3647
 			if (!isset($image_array[0]['registration']))
3446 3648
 			{
3447 3649
 				//echo "Add image !!!! \n";
@@ -3449,14 +3651,21 @@  discard block
 block discarded – undo
3449 3651
 			}
3450 3652
 			$timeelapsed = microtime(true);
3451 3653
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3452
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3453
-			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3654
+			if ($globalDebugTimeElapsed) {
3655
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3656
+			}
3657
+			if ($owner_info['owner'] != '') {
3658
+				$aircraft_owner = ucwords(strtolower($owner_info['owner']));
3659
+			}
3454 3660
 		}
3455 3661
     
3456 3662
 		if ($globalIVAO && $aircraft_icao != '')
3457 3663
 		{
3458
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3459
-            		else $airline_icao = '';
3664
+            		if (isset($airline_array[0]['icao'])) {
3665
+            			$airline_icao = $airline_array[0]['icao'];
3666
+            		} else {
3667
+            			$airline_icao = '';
3668
+            		}
3460 3669
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3461 3670
 			if (!isset($image_array[0]['registration']))
3462 3671
 			{
@@ -3501,16 +3710,28 @@  discard block
 block discarded – undo
3501 3710
                 {
3502 3711
                         $arrival_airport_array = $this->getAllAirportInfo('NA');
3503 3712
                 }
3504
-                if ($registration == '') $registration = 'NA';
3713
+                if ($registration == '') {
3714
+                	$registration = 'NA';
3715
+                }
3505 3716
                 if ($latitude == '' && $longitude == '') {
3506 3717
             		$latitude = 0;
3507 3718
             		$longitude = 0;
3508 3719
             	}
3509
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3510
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3511
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3512
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3513
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3720
+                if ($squawk == '' || $Common->isInteger($squawk) === false) {
3721
+                	$squawk = NULL;
3722
+                }
3723
+                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) {
3724
+                	$verticalrate = NULL;
3725
+                }
3726
+                if ($heading == '' || $Common->isInteger($heading) === false) {
3727
+                	$heading = 0;
3728
+                }
3729
+                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) {
3730
+                	$groundspeed = 0;
3731
+                }
3732
+                if (!isset($aircraft_owner)) {
3733
+                	$aircraft_owner = NULL;
3734
+                }
3514 3735
                 $query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3515 3736
                 VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)";
3516 3737
 
@@ -3521,9 +3742,13 @@  discard block
 block discarded – undo
3521 3742
 		if ($airline_type == '') {
3522 3743
 			$timeelapsed = microtime(true);
3523 3744
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3524
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3745
+			if ($globalDebugTimeElapsed) {
3746
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3747
+			}
3748
+		}
3749
+		if ($airline_type == null) {
3750
+			$airline_type = '';
3525 3751
 		}
3526
-		if ($airline_type == null) $airline_type = '';
3527 3752
                 $aircraft_type = $aircraft_array[0]['type'];
3528 3753
                 $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3529 3754
                 $departure_airport_name = $departure_airport_array[0]['name'];
@@ -3658,7 +3883,9 @@  discard block
 block discarded – undo
3658 3883
 			}
3659 3884
 		}
3660 3885
 		$query .= "GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
3661
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3886
+		if ($limit) {
3887
+			$query .= " LIMIT 10 OFFSET 0";
3888
+		}
3662 3889
 		
3663 3890
 		$sth = $this->db->prepare($query);
3664 3891
 		$sth->execute();
@@ -3703,7 +3930,9 @@  discard block
 block discarded – undo
3703 3930
 			}
3704 3931
 		}
3705 3932
 		$query .= "GROUP BY spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC";
3706
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3933
+		if ($limit) {
3934
+			$query .= " LIMIT 10 OFFSET 0";
3935
+		}
3707 3936
       
3708 3937
 		
3709 3938
 		$sth = $this->db->prepare($query);
@@ -3749,7 +3978,9 @@  discard block
 block discarded – undo
3749 3978
 			}
3750 3979
 		}
3751 3980
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC";
3752
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3981
+		if ($limit) {
3982
+			$query .= " LIMIT 10 OFFSET 0";
3983
+		}
3753 3984
       
3754 3985
 		
3755 3986
 		$sth = $this->db->prepare($query);
@@ -3797,7 +4028,9 @@  discard block
 block discarded – undo
3797 4028
 			}
3798 4029
 		}
3799 4030
 		$query .= "GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
3800
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4031
+		if ($limit) {
4032
+			$query .= " LIMIT 10 OFFSET 0";
4033
+		}
3801 4034
       
3802 4035
 		
3803 4036
 		$sth = $this->db->prepare($query);
@@ -3842,7 +4075,9 @@  discard block
 block discarded – undo
3842 4075
 			}
3843 4076
 		}
3844 4077
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC";
3845
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4078
+		if ($limit) {
4079
+			$query .= " LIMIT 10 OFFSET 0";
4080
+		}
3846 4081
       
3847 4082
 		
3848 4083
 		$sth = $this->db->prepare($query);
@@ -4085,7 +4320,9 @@  discard block
 block discarded – undo
4085 4320
 			date_default_timezone_set($globalTimezone);
4086 4321
 			$datetime = new DateTime($date);
4087 4322
 			$offset = $datetime->format('P');
4088
-		} else $offset = '+00:00';
4323
+		} else {
4324
+			$offset = '+00:00';
4325
+		}
4089 4326
 
4090 4327
 		if ($globalDBdriver == 'mysql') {
4091 4328
 			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
@@ -4133,7 +4370,9 @@  discard block
 block discarded – undo
4133 4370
 			date_default_timezone_set($globalTimezone);
4134 4371
 			$datetime = new DateTime($date);
4135 4372
 			$offset = $datetime->format('P');
4136
-		} else $offset = '+00:00';
4373
+		} else {
4374
+			$offset = '+00:00';
4375
+		}
4137 4376
 		
4138 4377
 		if ($globalDBdriver == 'mysql') {
4139 4378
 			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
@@ -4351,7 +4590,9 @@  discard block
 block discarded – undo
4351 4590
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' 
4352 4591
 					GROUP BY spotter_output.airline_country
4353 4592
 					ORDER BY airline_country_count DESC";
4354
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4593
+		if ($limit) {
4594
+			$query .= " LIMIT 10 OFFSET 0";
4595
+		}
4355 4596
       
4356 4597
 		$sth = $this->db->prepare($query);
4357 4598
 		$sth->execute();
@@ -4379,7 +4620,9 @@  discard block
 block discarded – undo
4379 4620
 		global $globalDBdriver;
4380 4621
 		//$filter_query = $this->getFilter($filters,true,true);
4381 4622
 		$Connection= new Connection($this->db);
4382
-		if (!$Connection->tableExists('countries')) return array();
4623
+		if (!$Connection->tableExists('countries')) {
4624
+			return array();
4625
+		}
4383 4626
 		/*
4384 4627
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
4385 4628
 					FROM countries c, spotter_output s
@@ -4404,7 +4647,9 @@  discard block
 block discarded – undo
4404 4647
 		}
4405 4648
 
4406 4649
 		$query .= "GROUP BY c.name ORDER BY nb DESC";
4407
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4650
+		if ($limit) {
4651
+			$query .= " LIMIT 10 OFFSET 0";
4652
+		}
4408 4653
       
4409 4654
 		
4410 4655
 		$sth = $this->db->prepare($query);
@@ -4454,7 +4699,9 @@  discard block
 block discarded – undo
4454 4699
 		}
4455 4700
 
4456 4701
 		$query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
4457
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4702
+		if ($limit) {
4703
+			$query .= " LIMIT 10 OFFSET 0";
4704
+		}
4458 4705
  
4459 4706
 		$sth = $this->db->prepare($query);
4460 4707
 		$sth->execute();
@@ -4500,7 +4747,9 @@  discard block
 block discarded – undo
4500 4747
 		}
4501 4748
 
4502 4749
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
4503
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4750
+		if ($limit) {
4751
+			$query .= " LIMIT 10 OFFSET 0";
4752
+		}
4504 4753
  
4505 4754
 		$sth = $this->db->prepare($query);
4506 4755
 		$sth->execute();
@@ -4547,7 +4796,9 @@  discard block
 block discarded – undo
4547 4796
 		}
4548 4797
 
4549 4798
 		$query .= "GROUP BY EXTRACT(month from spotter_output.date), EXTRACT(year from spotter_output.date), spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
4550
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4799
+		if ($limit) {
4800
+			$query .= " LIMIT 10 OFFSET 0";
4801
+		}
4551 4802
  
4552 4803
 		$sth = $this->db->prepare($query);
4553 4804
 		$sth->execute();
@@ -4600,7 +4851,9 @@  discard block
 block discarded – undo
4600 4851
 			if($row['registration'] != "")
4601 4852
 			{
4602 4853
 				$image_array = $Image->getSpotterImage($row['registration']);
4603
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4854
+				if (isset($image_array[0]['image_thumbnail'])) {
4855
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4856
+				}
4604 4857
 			}
4605 4858
 			$temp_array['registration_count'] = $row['registration_count'];
4606 4859
 
@@ -4675,7 +4928,9 @@  discard block
 block discarded – undo
4675 4928
 			if($row['registration'] != "")
4676 4929
 			{
4677 4930
 				$image_array = $Image->getSpotterImage($row['registration']);
4678
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4931
+				if (isset($image_array[0]['image_thumbnail'])) {
4932
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4933
+				}
4679 4934
 			}
4680 4935
 			$temp_array['registration_count'] = $row['registration_count'];
4681 4936
 
@@ -4782,7 +5037,9 @@  discard block
 block discarded – undo
4782 5037
 			if($row['registration'] != "")
4783 5038
 			{
4784 5039
 				$image_array = $Image->getSpotterImage($row['registration']);
4785
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5040
+				if (isset($image_array[0]['image_thumbnail'])) {
5041
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5042
+				}
4786 5043
 			}
4787 5044
 			$temp_array['registration_count'] = $row['registration_count'];
4788 5045
 			$aircraft_array[] = $temp_array;
@@ -4907,7 +5164,9 @@  discard block
 block discarded – undo
4907 5164
 			date_default_timezone_set($globalTimezone);
4908 5165
 			$datetime = new DateTime($date);
4909 5166
 			$offset = $datetime->format('P');
4910
-		} else $offset = '+00:00';
5167
+		} else {
5168
+			$offset = '+00:00';
5169
+		}
4911 5170
 
4912 5171
 		if ($globalDBdriver == 'mysql') {
4913 5172
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
@@ -4954,7 +5213,9 @@  discard block
 block discarded – undo
4954 5213
 			date_default_timezone_set($globalTimezone);
4955 5214
 			$datetime = new DateTime($date);
4956 5215
 			$offset = $datetime->format('P');
4957
-		} else $offset = '+00:00';
5216
+		} else {
5217
+			$offset = '+00:00';
5218
+		}
4958 5219
 
4959 5220
 		if ($globalDBdriver == 'mysql') {
4960 5221
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
@@ -4983,7 +5244,9 @@  discard block
 block discarded – undo
4983 5244
 			if($row['registration'] != "")
4984 5245
 			{
4985 5246
 				$image_array = $Image->getSpotterImage($row['registration']);
4986
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5247
+				if (isset($image_array[0]['image_thumbnail'])) {
5248
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5249
+				}
4987 5250
 			}
4988 5251
 			$temp_array['registration_count'] = $row['registration_count'];
4989 5252
  
@@ -5008,7 +5271,9 @@  discard block
 block discarded – undo
5008 5271
 			date_default_timezone_set($globalTimezone);
5009 5272
 			$datetime = new DateTime($date);
5010 5273
 			$offset = $datetime->format('P');
5011
-		} else $offset = '+00:00';
5274
+		} else {
5275
+			$offset = '+00:00';
5276
+		}
5012 5277
 
5013 5278
 		if ($globalDBdriver == 'mysql') {
5014 5279
 			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
@@ -5106,8 +5371,11 @@  discard block
 block discarded – undo
5106 5371
 			if($row['registration'] != "")
5107 5372
 			{
5108 5373
 				$image_array = $Image->getSpotterImage($row['registration']);
5109
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5110
-				else $temp_array['image_thumbnail'] = '';
5374
+				if (isset($image_array[0]['image_thumbnail'])) {
5375
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5376
+				} else {
5377
+					$temp_array['image_thumbnail'] = '';
5378
+				}
5111 5379
 			}
5112 5380
 			$temp_array['registration_count'] = $row['registration_count'];
5113 5381
 			$aircraft_array[] = $temp_array;
@@ -5214,7 +5482,9 @@  discard block
 block discarded – undo
5214 5482
 			if($row['registration'] != "")
5215 5483
 			{
5216 5484
 				$image_array = $Image->getSpotterImage($row['registration']);
5217
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5485
+				if (isset($image_array[0]['image_thumbnail'])) {
5486
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5487
+				}
5218 5488
 			}
5219 5489
 			$temp_array['registration_count'] = $row['registration_count'];
5220 5490
           
@@ -5331,7 +5601,9 @@  discard block
 block discarded – undo
5331 5601
 			if($row['registration'] != "")
5332 5602
 			{
5333 5603
 				$image_array = $Image->getSpotterImage($row['registration']);
5334
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5604
+				if (isset($image_array[0]['image_thumbnail'])) {
5605
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5606
+				}
5335 5607
 			}
5336 5608
 			$temp_array['registration_count'] = $row['registration_count'];
5337 5609
           
@@ -5443,7 +5715,9 @@  discard block
 block discarded – undo
5443 5715
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5444 5716
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5445 5717
                 $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5446
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5718
+		if ($limit) {
5719
+			$query .= " LIMIT 10 OFFSET 0";
5720
+		}
5447 5721
 		
5448 5722
 		$sth = $this->db->prepare($query);
5449 5723
 		$sth->execute();
@@ -5462,7 +5736,9 @@  discard block
 block discarded – undo
5462 5736
 			if($row['registration'] != "")
5463 5737
 			{
5464 5738
 				$image_array = $Image->getSpotterImage($row['registration']);
5465
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5739
+				if (isset($image_array[0]['image_thumbnail'])) {
5740
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5741
+				}
5466 5742
 			}
5467 5743
           
5468 5744
 			$aircraft_array[] = $temp_array;
@@ -5503,7 +5779,9 @@  discard block
 block discarded – undo
5503 5779
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5504 5780
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5505 5781
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5506
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5782
+		if ($limit) {
5783
+			$query .= " LIMIT 10 OFFSET 0";
5784
+		}
5507 5785
 		
5508 5786
 		$sth = $this->db->prepare($query);
5509 5787
 		$sth->execute();
@@ -5523,7 +5801,9 @@  discard block
 block discarded – undo
5523 5801
 			if($row['registration'] != "")
5524 5802
 			{
5525 5803
 				$image_array = $Image->getSpotterImage($row['registration']);
5526
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5804
+				if (isset($image_array[0]['image_thumbnail'])) {
5805
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5806
+				}
5527 5807
 			}
5528 5808
           
5529 5809
 			$aircraft_array[] = $temp_array;
@@ -5564,7 +5844,9 @@  discard block
 block discarded – undo
5564 5844
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5565 5845
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5566 5846
 				ORDER BY airport_departure_icao_count DESC";
5567
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5847
+		if ($limit) {
5848
+			$query .= " LIMIT 10 OFFSET 0";
5849
+		}
5568 5850
       
5569 5851
 		$sth = $this->db->prepare($query);
5570 5852
 		$sth->execute();
@@ -5616,7 +5898,9 @@  discard block
 block discarded – undo
5616 5898
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5617 5899
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5618 5900
 				ORDER BY airport_departure_icao_count DESC";
5619
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5901
+		if ($limit) {
5902
+			$query .= " LIMIT 10 OFFSET 0";
5903
+		}
5620 5904
       
5621 5905
 		$sth = $this->db->prepare($query);
5622 5906
 		$sth->execute();
@@ -5668,7 +5952,9 @@  discard block
 block discarded – undo
5668 5952
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5669 5953
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5670 5954
 				ORDER BY airport_departure_icao_count DESC";
5671
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5955
+		if ($limit) {
5956
+			$query .= " LIMIT 10 OFFSET 0";
5957
+		}
5672 5958
     		//echo $query;
5673 5959
 		$sth = $this->db->prepare($query);
5674 5960
 		$sth->execute();
@@ -5720,7 +6006,9 @@  discard block
 block discarded – undo
5720 6006
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5721 6007
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5722 6008
 				ORDER BY airport_departure_icao_count DESC";
5723
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6009
+		if ($limit) {
6010
+			$query .= " LIMIT 10 OFFSET 0";
6011
+		}
5724 6012
       
5725 6013
 		$sth = $this->db->prepare($query);
5726 6014
 		$sth->execute();
@@ -6115,7 +6403,9 @@  discard block
 block discarded – undo
6115 6403
 			date_default_timezone_set($globalTimezone);
6116 6404
 			$datetime = new DateTime($date);
6117 6405
 			$offset = $datetime->format('P');
6118
-		} else $offset = '+00:00';
6406
+		} else {
6407
+			$offset = '+00:00';
6408
+		}
6119 6409
 
6120 6410
 		if ($globalDBdriver == 'mysql') {
6121 6411
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
@@ -6165,7 +6455,9 @@  discard block
 block discarded – undo
6165 6455
 			date_default_timezone_set($globalTimezone);
6166 6456
 			$datetime = new DateTime($date);
6167 6457
 			$offset = $datetime->format('P');
6168
-		} else $offset = '+00:00';
6458
+		} else {
6459
+			$offset = '+00:00';
6460
+		}
6169 6461
 
6170 6462
 		if ($globalDBdriver == 'mysql') {
6171 6463
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
@@ -6378,7 +6670,9 @@  discard block
 block discarded – undo
6378 6670
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6379 6671
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6380 6672
 					ORDER BY airport_arrival_icao_count DESC";
6381
-		if ($limit) $query .= " LIMIT 10";
6673
+		if ($limit) {
6674
+			$query .= " LIMIT 10";
6675
+		}
6382 6676
       
6383 6677
 		
6384 6678
 		$sth = $this->db->prepare($query);
@@ -6398,7 +6692,9 @@  discard block
 block discarded – undo
6398 6692
 			if ($icaoaskey) {
6399 6693
 				$icao = $row['arrival_airport_icao'];
6400 6694
 				$airport_array[$icao] = $temp_array;
6401
-			} else $airport_array[] = $temp_array;
6695
+			} else {
6696
+				$airport_array[] = $temp_array;
6697
+			}
6402 6698
 		}
6403 6699
 
6404 6700
 		return $airport_array;
@@ -6440,7 +6736,9 @@  discard block
 block discarded – undo
6440 6736
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6441 6737
                 $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6442 6738
 					ORDER BY airport_arrival_icao_count DESC";
6443
-		if ($limit) $query .= " LIMIT 10";
6739
+		if ($limit) {
6740
+			$query .= " LIMIT 10";
6741
+		}
6444 6742
       
6445 6743
 		
6446 6744
 		$sth = $this->db->prepare($query);
@@ -6461,7 +6759,9 @@  discard block
 block discarded – undo
6461 6759
 			if ($icaoaskey) {
6462 6760
 				$icao = $row['arrival_airport_icao'];
6463 6761
 				$airport_array[$icao] = $temp_array;
6464
-			} else $airport_array[] = $temp_array;
6762
+			} else {
6763
+				$airport_array[] = $temp_array;
6764
+			}
6465 6765
 		}
6466 6766
 
6467 6767
 		return $airport_array;
@@ -6503,7 +6803,9 @@  discard block
 block discarded – undo
6503 6803
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6504 6804
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6505 6805
 					ORDER BY airport_arrival_icao_count DESC";
6506
-		if ($limit) $query .= " LIMIT 10";
6806
+		if ($limit) {
6807
+			$query .= " LIMIT 10";
6808
+		}
6507 6809
       
6508 6810
 		
6509 6811
 		$sth = $this->db->prepare($query);
@@ -6523,7 +6825,9 @@  discard block
 block discarded – undo
6523 6825
 			if ($icaoaskey) {
6524 6826
 				$icao = $row['arrival_airport_icao'];
6525 6827
 				$airport_array[$icao] = $temp_array;
6526
-			} else $airport_array[] = $temp_array;
6828
+			} else {
6829
+				$airport_array[] = $temp_array;
6830
+			}
6527 6831
 		}
6528 6832
 
6529 6833
 		return $airport_array;
@@ -6565,7 +6869,9 @@  discard block
 block discarded – undo
6565 6869
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6566 6870
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6567 6871
 					ORDER BY airport_arrival_icao_count DESC";
6568
-		if ($limit) $query .= " LIMIT 10";
6872
+		if ($limit) {
6873
+			$query .= " LIMIT 10";
6874
+		}
6569 6875
       
6570 6876
 		
6571 6877
 		$sth = $this->db->prepare($query);
@@ -6586,7 +6892,9 @@  discard block
 block discarded – undo
6586 6892
 			if ($icaoaskey) {
6587 6893
 				$icao = $row['arrival_airport_icao'];
6588 6894
 				$airport_array[$icao] = $temp_array;
6589
-			} else $airport_array[] = $temp_array;
6895
+			} else {
6896
+				$airport_array[] = $temp_array;
6897
+			}
6590 6898
 		}
6591 6899
 
6592 6900
 		return $airport_array;
@@ -6967,7 +7275,9 @@  discard block
 block discarded – undo
6967 7275
 			date_default_timezone_set($globalTimezone);
6968 7276
 			$datetime = new DateTime($date);
6969 7277
 			$offset = $datetime->format('P');
6970
-		} else $offset = '+00:00';
7278
+		} else {
7279
+			$offset = '+00:00';
7280
+		}
6971 7281
 
6972 7282
 		if ($globalDBdriver == 'mysql') {
6973 7283
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
@@ -7017,7 +7327,9 @@  discard block
 block discarded – undo
7017 7327
 			date_default_timezone_set($globalTimezone);
7018 7328
 			$datetime = new DateTime($date);
7019 7329
 			$offset = $datetime->format('P');
7020
-		} else $offset = '+00:00';
7330
+		} else {
7331
+			$offset = '+00:00';
7332
+		}
7021 7333
 
7022 7334
 		if ($globalDBdriver == 'mysql') {
7023 7335
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
@@ -7240,7 +7552,9 @@  discard block
 block discarded – undo
7240 7552
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
7241 7553
 		$query .= " GROUP BY spotter_output.arrival_airport_country
7242 7554
 					ORDER BY airport_arrival_country_count DESC";
7243
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7555
+		if ($limit) {
7556
+			$query .= " LIMIT 10 OFFSET 0";
7557
+		}
7244 7558
       
7245 7559
 		
7246 7560
 		$sth = $this->db->prepare($query);
@@ -7527,7 +7841,9 @@  discard block
 block discarded – undo
7527 7841
 			date_default_timezone_set($globalTimezone);
7528 7842
 			$datetime = new DateTime($date);
7529 7843
 			$offset = $datetime->format('P');
7530
-		} else $offset = '+00:00';
7844
+		} else {
7845
+			$offset = '+00:00';
7846
+		}
7531 7847
 		
7532 7848
 		if ($globalDBdriver == 'mysql') {
7533 7849
 			$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
@@ -7703,15 +8019,23 @@  discard block
 block discarded – undo
7703 8019
 		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7704 8020
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
7705 8021
 		 if ($olderthanmonths > 0) {
7706
-			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
7707
-			else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
8022
+			if ($globalDBdriver == 'mysql') {
8023
+				$query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
8024
+			} else {
8025
+				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
8026
+			}
7708 8027
 		}
7709 8028
 		if ($sincedate != '') {
7710
-			if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'";
7711
-			else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
8029
+			if ($globalDBdriver == 'mysql') {
8030
+				$query .= " AND spotter_output.date > '".$sincedate."'";
8031
+			} else {
8032
+				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
8033
+			}
7712 8034
 		}
7713 8035
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
7714
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
8036
+		if ($limit) {
8037
+			$query .= " LIMIT 10 OFFSET 0";
8038
+		}
7715 8039
       		
7716 8040
 		$sth = $this->db->prepare($query);
7717 8041
 		$sth->execute();
@@ -7745,15 +8069,23 @@  discard block
 block discarded – undo
7745 8069
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7746 8070
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
7747 8071
 		 if ($olderthanmonths > 0) {
7748
-			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7749
-			else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
8072
+			if ($globalDBdriver == 'mysql') {
8073
+				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
8074
+			} else {
8075
+				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
8076
+			}
7750 8077
 		}
7751 8078
 		if ($sincedate != '') {
7752
-			if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' ";
7753
-			else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
8079
+			if ($globalDBdriver == 'mysql') {
8080
+				$query .= "AND spotter_output.date > '".$sincedate."' ";
8081
+			} else {
8082
+				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
8083
+			}
7754 8084
 		}
7755 8085
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
7756
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
8086
+		if ($limit) {
8087
+			$query .= " LIMIT 10 OFFSET 0";
8088
+		}
7757 8089
       		
7758 8090
 		$sth = $this->db->prepare($query);
7759 8091
 		$sth->execute();
@@ -7790,7 +8122,9 @@  discard block
 block discarded – undo
7790 8122
 			date_default_timezone_set($globalTimezone);
7791 8123
 			$datetime = new DateTime();
7792 8124
 			$offset = $datetime->format('P');
7793
-		} else $offset = '+00:00';
8125
+		} else {
8126
+			$offset = '+00:00';
8127
+		}
7794 8128
 
7795 8129
 		if ($globalDBdriver == 'mysql') {
7796 8130
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7839,7 +8173,9 @@  discard block
 block discarded – undo
7839 8173
 			date_default_timezone_set($globalTimezone);
7840 8174
 			$datetime = new DateTime();
7841 8175
 			$offset = $datetime->format('P');
7842
-		} else $offset = '+00:00';
8176
+		} else {
8177
+			$offset = '+00:00';
8178
+		}
7843 8179
 		$filter_query = $this->getFilter($filters,true,true);
7844 8180
 		if ($globalDBdriver == 'mysql') {
7845 8181
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7888,7 +8224,9 @@  discard block
 block discarded – undo
7888 8224
 			date_default_timezone_set($globalTimezone);
7889 8225
 			$datetime = new DateTime();
7890 8226
 			$offset = $datetime->format('P');
7891
-		} else $offset = '+00:00';
8227
+		} else {
8228
+			$offset = '+00:00';
8229
+		}
7892 8230
 		$filter_query = $this->getFilter($filters,true,true);
7893 8231
 		if ($globalDBdriver == 'mysql') {
7894 8232
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7934,7 +8272,9 @@  discard block
 block discarded – undo
7934 8272
 			date_default_timezone_set($globalTimezone);
7935 8273
 			$datetime = new DateTime();
7936 8274
 			$offset = $datetime->format('P');
7937
-		} else $offset = '+00:00';
8275
+		} else {
8276
+			$offset = '+00:00';
8277
+		}
7938 8278
 		$filter_query = $this->getFilter($filters,true,true);
7939 8279
 		if ($globalDBdriver == 'mysql') {
7940 8280
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7982,7 +8322,9 @@  discard block
 block discarded – undo
7982 8322
 			date_default_timezone_set($globalTimezone);
7983 8323
 			$datetime = new DateTime();
7984 8324
 			$offset = $datetime->format('P');
7985
-		} else $offset = '+00:00';
8325
+		} else {
8326
+			$offset = '+00:00';
8327
+		}
7986 8328
 		
7987 8329
 		if ($globalDBdriver == 'mysql') {
7988 8330
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -8030,7 +8372,9 @@  discard block
 block discarded – undo
8030 8372
 			date_default_timezone_set($globalTimezone);
8031 8373
 			$datetime = new DateTime();
8032 8374
 			$offset = $datetime->format('P');
8033
-		} else $offset = '+00:00';
8375
+		} else {
8376
+			$offset = '+00:00';
8377
+		}
8034 8378
 
8035 8379
 		if ($globalDBdriver == 'mysql') {
8036 8380
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -8077,7 +8421,9 @@  discard block
 block discarded – undo
8077 8421
 			date_default_timezone_set($globalTimezone);
8078 8422
 			$datetime = new DateTime();
8079 8423
 			$offset = $datetime->format('P');
8080
-		} else $offset = '+00:00';
8424
+		} else {
8425
+			$offset = '+00:00';
8426
+		}
8081 8427
 
8082 8428
 		if ($globalDBdriver == 'mysql') {
8083 8429
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -8125,7 +8471,9 @@  discard block
 block discarded – undo
8125 8471
 			date_default_timezone_set($globalTimezone);
8126 8472
 			$datetime = new DateTime();
8127 8473
 			$offset = $datetime->format('P');
8128
-		} else $offset = '+00:00';
8474
+		} else {
8475
+			$offset = '+00:00';
8476
+		}
8129 8477
 		$filter_query = $this->getFilter($filters,true,true);
8130 8478
 		if ($globalDBdriver == 'mysql') {
8131 8479
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -8170,7 +8518,9 @@  discard block
 block discarded – undo
8170 8518
 			date_default_timezone_set($globalTimezone);
8171 8519
 			$datetime = new DateTime();
8172 8520
 			$offset = $datetime->format('P');
8173
-		} else $offset = '+00:00';
8521
+		} else {
8522
+			$offset = '+00:00';
8523
+		}
8174 8524
 		$filter_query = $this->getFilter($filters,true,true);
8175 8525
 
8176 8526
 		if ($globalDBdriver == 'mysql') {
@@ -8217,7 +8567,9 @@  discard block
 block discarded – undo
8217 8567
 			date_default_timezone_set($globalTimezone);
8218 8568
 			$datetime = new DateTime();
8219 8569
 			$offset = $datetime->format('P');
8220
-		} else $offset = '+00:00';
8570
+		} else {
8571
+			$offset = '+00:00';
8572
+		}
8221 8573
 
8222 8574
 		if ($globalDBdriver == 'mysql') {
8223 8575
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
@@ -8263,7 +8615,9 @@  discard block
 block discarded – undo
8263 8615
 			date_default_timezone_set($globalTimezone);
8264 8616
 			$datetime = new DateTime();
8265 8617
 			$offset = $datetime->format('P');
8266
-		} else $offset = '+00:00';
8618
+		} else {
8619
+			$offset = '+00:00';
8620
+		}
8267 8621
 		$filter_query = $this->getFilter($filters,true,true);
8268 8622
 
8269 8623
 		if ($globalDBdriver == 'mysql') {
@@ -8310,7 +8664,9 @@  discard block
 block discarded – undo
8310 8664
 			date_default_timezone_set($globalTimezone);
8311 8665
 			$datetime = new DateTime();
8312 8666
 			$offset = $datetime->format('P');
8313
-		} else $offset = '+00:00';
8667
+		} else {
8668
+			$offset = '+00:00';
8669
+		}
8314 8670
 
8315 8671
 		if ($globalDBdriver == 'mysql') {
8316 8672
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
@@ -8357,7 +8713,9 @@  discard block
 block discarded – undo
8357 8713
 			date_default_timezone_set($globalTimezone);
8358 8714
 			$datetime = new DateTime();
8359 8715
 			$offset = $datetime->format('P');
8360
-		} else $offset = '+00:00';
8716
+		} else {
8717
+			$offset = '+00:00';
8718
+		}
8361 8719
 
8362 8720
 		if ($globalDBdriver == 'mysql') {
8363 8721
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count
@@ -8402,7 +8760,9 @@  discard block
 block discarded – undo
8402 8760
 			date_default_timezone_set($globalTimezone);
8403 8761
 			$datetime = new DateTime();
8404 8762
 			$offset = $datetime->format('P');
8405
-		} else $offset = '+00:00';
8763
+		} else {
8764
+			$offset = '+00:00';
8765
+		}
8406 8766
 		$filter_query = $this->getFilter($filters,true,true);
8407 8767
 
8408 8768
 		if ($globalDBdriver == 'mysql') {
@@ -8450,7 +8810,9 @@  discard block
 block discarded – undo
8450 8810
 			date_default_timezone_set($globalTimezone);
8451 8811
 			$datetime = new DateTime();
8452 8812
 			$offset = $datetime->format('P');
8453
-		} else $offset = '+00:00';
8813
+		} else {
8814
+			$offset = '+00:00';
8815
+		}
8454 8816
 
8455 8817
 		if ($globalDBdriver == 'mysql') {
8456 8818
 			$query  = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
@@ -8496,7 +8858,9 @@  discard block
 block discarded – undo
8496 8858
 			date_default_timezone_set($globalTimezone);
8497 8859
 			$datetime = new DateTime();
8498 8860
 			$offset = $datetime->format('P');
8499
-		} else $offset = '+00:00';
8861
+		} else {
8862
+			$offset = '+00:00';
8863
+		}
8500 8864
 		$filter_query = $this->getFilter($filters,true,true);
8501 8865
 
8502 8866
 		if ($globalDBdriver == 'mysql') {
@@ -8544,7 +8908,9 @@  discard block
 block discarded – undo
8544 8908
 			date_default_timezone_set($globalTimezone);
8545 8909
 			$datetime = new DateTime();
8546 8910
 			$offset = $datetime->format('P');
8547
-		} else $offset = '+00:00';
8911
+		} else {
8912
+			$offset = '+00:00';
8913
+		}
8548 8914
 
8549 8915
 		if ($globalDBdriver == 'mysql') {
8550 8916
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
@@ -8591,7 +8957,9 @@  discard block
 block discarded – undo
8591 8957
 			date_default_timezone_set($globalTimezone);
8592 8958
 			$datetime = new DateTime();
8593 8959
 			$offset = $datetime->format('P');
8594
-		} else $offset = '+00:00';
8960
+		} else {
8961
+			$offset = '+00:00';
8962
+		}
8595 8963
 		$filter_query = $this->getFilter($filters,true,true);
8596 8964
 		if ($globalDBdriver == 'mysql') {
8597 8965
 			$query  = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count
@@ -8640,7 +9008,9 @@  discard block
 block discarded – undo
8640 9008
 			date_default_timezone_set($globalTimezone);
8641 9009
 			$datetime = new DateTime();
8642 9010
 			$offset = $datetime->format('P');
8643
-		} else $offset = '+00:00';
9011
+		} else {
9012
+			$offset = '+00:00';
9013
+		}
8644 9014
 
8645 9015
 		$orderby_sql = '';
8646 9016
 		if ($orderby == "hour")
@@ -8706,7 +9076,9 @@  discard block
 block discarded – undo
8706 9076
 			date_default_timezone_set($globalTimezone);
8707 9077
 			$datetime = new DateTime();
8708 9078
 			$offset = $datetime->format('P');
8709
-		} else $offset = '+00:00';
9079
+		} else {
9080
+			$offset = '+00:00';
9081
+		}
8710 9082
 
8711 9083
 		$orderby_sql = '';
8712 9084
 		if ($orderby == "hour")
@@ -8773,7 +9145,9 @@  discard block
 block discarded – undo
8773 9145
 			date_default_timezone_set($globalTimezone);
8774 9146
 			$datetime = new DateTime();
8775 9147
 			$offset = $datetime->format('P');
8776
-		} else $offset = '+00:00';
9148
+		} else {
9149
+			$offset = '+00:00';
9150
+		}
8777 9151
 
8778 9152
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8779 9153
 
@@ -8824,7 +9198,9 @@  discard block
 block discarded – undo
8824 9198
 			date_default_timezone_set($globalTimezone);
8825 9199
 			$datetime = new DateTime();
8826 9200
 			$offset = $datetime->format('P');
8827
-		} else $offset = '+00:00';
9201
+		} else {
9202
+			$offset = '+00:00';
9203
+		}
8828 9204
 
8829 9205
 		if ($globalDBdriver == 'mysql') {
8830 9206
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8871,7 +9247,9 @@  discard block
 block discarded – undo
8871 9247
 			date_default_timezone_set($globalTimezone);
8872 9248
 			$datetime = new DateTime();
8873 9249
 			$offset = $datetime->format('P');
8874
-		} else $offset = '+00:00';
9250
+		} else {
9251
+			$offset = '+00:00';
9252
+		}
8875 9253
 
8876 9254
 		if ($globalDBdriver == 'mysql') {
8877 9255
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8918,7 +9296,9 @@  discard block
 block discarded – undo
8918 9296
 			date_default_timezone_set($globalTimezone);
8919 9297
 			$datetime = new DateTime();
8920 9298
 			$offset = $datetime->format('P');
8921
-		} else $offset = '+00:00';
9299
+		} else {
9300
+			$offset = '+00:00';
9301
+		}
8922 9302
 
8923 9303
 		if ($globalDBdriver == 'mysql') {
8924 9304
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8966,7 +9346,9 @@  discard block
 block discarded – undo
8966 9346
 			date_default_timezone_set($globalTimezone);
8967 9347
 			$datetime = new DateTime();
8968 9348
 			$offset = $datetime->format('P');
8969
-		} else $offset = '+00:00';
9349
+		} else {
9350
+			$offset = '+00:00';
9351
+		}
8970 9352
 
8971 9353
 		if ($globalDBdriver == 'mysql') {
8972 9354
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9014,7 +9396,9 @@  discard block
 block discarded – undo
9014 9396
 			date_default_timezone_set($globalTimezone);
9015 9397
 			$datetime = new DateTime($date);
9016 9398
 			$offset = $datetime->format('P');
9017
-		} else $offset = '+00:00';
9399
+		} else {
9400
+			$offset = '+00:00';
9401
+		}
9018 9402
 
9019 9403
 		if ($globalDBdriver == 'mysql') {
9020 9404
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9062,7 +9446,9 @@  discard block
 block discarded – undo
9062 9446
 			date_default_timezone_set($globalTimezone);
9063 9447
 			$datetime = new DateTime();
9064 9448
 			$offset = $datetime->format('P');
9065
-		} else $offset = '+00:00';
9449
+		} else {
9450
+			$offset = '+00:00';
9451
+		}
9066 9452
 
9067 9453
 		if ($globalDBdriver == 'mysql') {
9068 9454
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9112,7 +9498,9 @@  discard block
 block discarded – undo
9112 9498
 			date_default_timezone_set($globalTimezone);
9113 9499
 			$datetime = new DateTime();
9114 9500
 			$offset = $datetime->format('P');
9115
-		} else $offset = '+00:00';
9501
+		} else {
9502
+			$offset = '+00:00';
9503
+		}
9116 9504
 
9117 9505
 		if ($globalDBdriver == 'mysql') {
9118 9506
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9159,7 +9547,9 @@  discard block
 block discarded – undo
9159 9547
 			date_default_timezone_set($globalTimezone);
9160 9548
 			$datetime = new DateTime();
9161 9549
 			$offset = $datetime->format('P');
9162
-		} else $offset = '+00:00';
9550
+		} else {
9551
+			$offset = '+00:00';
9552
+		}
9163 9553
 
9164 9554
 		if ($globalDBdriver == 'mysql') {
9165 9555
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9327,7 +9717,9 @@  discard block
 block discarded – undo
9327 9717
 			date_default_timezone_set($globalTimezone);
9328 9718
 			$datetime = new DateTime();
9329 9719
 			$offset = $datetime->format('P');
9330
-		} else $offset = '+00:00';
9720
+		} else {
9721
+			$offset = '+00:00';
9722
+		}
9331 9723
 
9332 9724
 		if ($globalDBdriver == 'mysql') {
9333 9725
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9513,7 +9905,9 @@  discard block
 block discarded – undo
9513 9905
 	*/
9514 9906
 	public function parseDirection($direction = 0)
9515 9907
 	{
9516
-		if ($direction == '') $direction = 0;
9908
+		if ($direction == '') {
9909
+			$direction = 0;
9910
+		}
9517 9911
 		$direction_array = array();
9518 9912
 		$temp_array = array();
9519 9913
 
@@ -9614,7 +10008,9 @@  discard block
 block discarded – undo
9614 10008
 		if (isset($result->AirlineFlightInfoResult))
9615 10009
 		{
9616 10010
 			$registration = $result->AirlineFlightInfoResult->tailnumber;
9617
-		} else return '';
10011
+		} else {
10012
+			return '';
10013
+		}
9618 10014
 		
9619 10015
 		$registration = $this->convertAircraftRegistration($registration);
9620 10016
 		
@@ -9643,7 +10039,9 @@  discard block
 block discarded – undo
9643 10039
 		if (count($row) > 0) {
9644 10040
 		    //return $row['Registration'];
9645 10041
 		    return $row['registration'];
9646
-		} else return '';
10042
+		} else {
10043
+			return '';
10044
+		}
9647 10045
 	
9648 10046
 	}
9649 10047
 
@@ -9666,9 +10064,14 @@  discard block
 block discarded – undo
9666 10064
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9667 10065
 		$sth->closeCursor();
9668 10066
 		if (count($row) > 0) {
9669
-		    if ($row['type_flight'] == null) return '';
9670
-		    else return $row['type_flight'];
9671
-		} else return '';
10067
+		    if ($row['type_flight'] == null) {
10068
+		    	return '';
10069
+		    } else {
10070
+		    	return $row['type_flight'];
10071
+		    }
10072
+		} else {
10073
+			return '';
10074
+		}
9672 10075
 	
9673 10076
 	}
9674 10077
 
@@ -9686,7 +10089,9 @@  discard block
 block discarded – undo
9686 10089
 		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9687 10090
 	
9688 10091
 		$Connection = new Connection($this->db);
9689
-		if (!$Connection->tableExists('countries')) return '';
10092
+		if (!$Connection->tableExists('countries')) {
10093
+			return '';
10094
+		}
9690 10095
 	
9691 10096
 		try {
9692 10097
 			/*
@@ -9706,9 +10111,13 @@  discard block
 block discarded – undo
9706 10111
 			$sth->closeCursor();
9707 10112
 			if (count($row) > 0) {
9708 10113
 				return $row;
9709
-			} else return '';
10114
+			} else {
10115
+				return '';
10116
+			}
9710 10117
 		} catch (PDOException $e) {
9711
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
10118
+			if (isset($globalDebug) && $globalDebug) {
10119
+				echo 'Error : '.$e->getMessage()."\n";
10120
+			}
9712 10121
 			return '';
9713 10122
 		}
9714 10123
 	
@@ -9856,7 +10265,9 @@  discard block
 block discarded – undo
9856 10265
 	{
9857 10266
 		global $globalBitlyAccessToken;
9858 10267
 		
9859
-		if ($globalBitlyAccessToken == '') return $url;
10268
+		if ($globalBitlyAccessToken == '') {
10269
+			return $url;
10270
+		}
9860 10271
         
9861 10272
 		$google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url;
9862 10273
 		
@@ -10005,7 +10416,9 @@  discard block
 block discarded – undo
10005 10416
 		
10006 10417
 
10007 10418
 		// routes
10008
-		if ($globalDebug) print "Routes...\n";
10419
+		if ($globalDebug) {
10420
+			print "Routes...\n";
10421
+		}
10009 10422
 		if ($globalDBdriver == 'mysql') {
10010 10423
 			$query = "SELECT spotter_output.spotter_id, routes.FromAirport_ICAO, routes.ToAirport_ICAO FROM spotter_output, routes WHERE spotter_output.ident = routes.CallSign AND ( spotter_output.departure_airport_icao != routes.FromAirport_ICAO OR spotter_output.arrival_airport_icao != routes.ToAirport_ICAO) AND routes.FromAirport_ICAO != '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)";
10011 10424
 		} else {
@@ -10024,7 +10437,9 @@  discard block
 block discarded – undo
10024 10437
 			}
10025 10438
 		}
10026 10439
 		
10027
-		if ($globalDebug) print "Airlines...\n";
10440
+		if ($globalDebug) {
10441
+			print "Airlines...\n";
10442
+		}
10028 10443
 		//airlines
10029 10444
 		if ($globalDBdriver == 'mysql') {
10030 10445
 			$query  = "SELECT spotter_output.spotter_id, spotter_output.ident FROM spotter_output WHERE (spotter_output.airline_name = '' OR spotter_output.airline_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)";
@@ -10038,10 +10453,15 @@  discard block
 block discarded – undo
10038 10453
 			if (is_numeric(substr($row['ident'], -1, 1)))
10039 10454
 			{
10040 10455
 				$fromsource = NULL;
10041
-				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
10042
-				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
10043
-				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
10044
-				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
10456
+				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
10457
+					$fromsource = 'vatsim';
10458
+				} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
10459
+					$fromsource = 'ivao';
10460
+				} elseif (isset($globalVATSIM) && $globalVATSIM) {
10461
+					$fromsource = 'vatsim';
10462
+				} elseif (isset($globalIVAO) && $globalIVAO) {
10463
+					$fromsource = 'ivao';
10464
+				}
10045 10465
 				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
10046 10466
 				if (isset($airline_array[0]['name'])) {
10047 10467
 					$update_query  = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id";
@@ -10051,13 +10471,17 @@  discard block
 block discarded – undo
10051 10471
 			}
10052 10472
 		}
10053 10473
 
10054
-		if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n";
10474
+		if ($globalDebug) {
10475
+			print "Remove Duplicate in aircraft_modes...\n";
10476
+		}
10055 10477
 		//duplicate modes
10056 10478
 		$query = "DELETE aircraft_modes FROM aircraft_modes LEFT OUTER JOIN (SELECT max(`AircraftID`) as `AircraftID`,`ModeS` FROM `aircraft_modes` group by ModeS) as KeepRows ON aircraft_modes.AircraftID = KeepRows.AircraftID WHERE KeepRows.AircraftID IS NULL";
10057 10479
 		$sth = $this->db->prepare($query);
10058 10480
 		$sth->execute();
10059 10481
 		
10060
-		if ($globalDebug) print "Aircraft...\n";
10482
+		if ($globalDebug) {
10483
+			print "Aircraft...\n";
10484
+		}
10061 10485
 		//aircraft
10062 10486
 		if ($globalDBdriver == 'mysql') {
10063 10487
 			$query  = "SELECT spotter_output.spotter_id, spotter_output.aircraft_icao, spotter_output.registration FROM spotter_output WHERE (spotter_output.aircraft_name = '' OR spotter_output.aircraft_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -10100,26 +10524,38 @@  discard block
 block discarded – undo
10100 10524
 				 if (isset($closestAirports[0])) {
10101 10525
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
10102 10526
 						$airport_icao = $closestAirports[0]['icao'];
10103
-						if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10527
+						if ($globalDebug) {
10528
+							echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10529
+						}
10104 10530
 					} elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') {
10105 10531
 						foreach ($closestAirports as $airport) {
10106 10532
 							if ($row['arrival_airport_icao'] == $airport['icao']) {
10107 10533
 								$airport_icao = $airport['icao'];
10108
-								if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10534
+								if ($globalDebug) {
10535
+									echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10536
+								}
10109 10537
 								break;
10110 10538
 							}
10111 10539
 						}
10112 10540
 					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
10113 10541
 						$airport_icao = $closestAirports[0]['icao'];
10114
-						if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." !  Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10542
+						if ($globalDebug) {
10543
+							echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." !  Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10544
+						}
10115 10545
 					} else {
10116
-						if ($globalDebug) echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10546
+						if ($globalDebug) {
10547
+							echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10548
+						}
10117 10549
 					}
10118 10550
 				} else {
10119
-					if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
10551
+					if ($globalDebug) {
10552
+						echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
10553
+					}
10120 10554
 				}
10121 10555
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
10122
-					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
10556
+					if ($globalDebug) {
10557
+						echo "Updating airport to ".$airport_icao."...\n";
10558
+					}
10123 10559
 					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10124 10560
 					$sthu = $this->db->prepare($update_query);
10125 10561
 					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
Please login to merge, or discard this patch.
statistics-sub-menu.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 					} else {
14 14
 						print '<option value="">All</option>';
15 15
 					}
16
-					foreach($airlines as $airline) {
16
+					foreach ($airlines as $airline) {
17 17
 						if (isset($airline_icao) && $airline_icao == $airline['airline_icao']) {
18 18
 							print '<option value="'.$airline['airline_icao'].'" selected>'.$airline['airline_name'].'</option>';
19 19
 						} else {
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 <div class="sub-menu sub-menu-container">
29 29
 	<ul class="nav">
30 30
 		<li class="dropdown">
31
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#" >
31
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#" >
32 32
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
33 33
 		    </a>
34 34
 		    <ul class="dropdown-menu">
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 		    </ul>
40 40
 		</li>
41 41
 		<li class="dropdown">
42
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
42
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign") { print 'active'; } ?>" data-toggle="dropdown" href="#">
43 43
 		      <?php echo _("Airline"); ?> <span class="caret"></span>
44 44
 		    </a>
45 45
 		    <ul class="dropdown-menu" role="menu">
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 		    </ul>
50 50
 		</li>
51 51
 		<li class="dropdown">
52
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
52
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country") { print 'active'; } ?>" data-toggle="dropdown" href="#">
53 53
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
54 54
 		    </a>
55 55
 		    <ul class="dropdown-menu" role="menu">
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 		    </ul>
61 61
 		</li>
62 62
 		<li class="dropdown">
63
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
63
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint") { print 'active'; } ?>" data-toggle="dropdown" href="#">
64 64
 		      <?php echo _("Route"); ?> <span class="caret"></span>
65 65
 		    </a>
66 66
 		    <ul class="dropdown-menu" role="menu">
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 		    </ul>
70 70
 		</li>
71 71
 		<li class="dropdown">
72
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
72
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#">
73 73
 		      <?php echo _("Date &amp; Time"); ?> <span class="caret"></span>
74 74
 		    </a>
75 75
 		    <ul class="dropdown-menu" role="menu">
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,9 @@
 block discarded – undo
7 7
 				<?php
8 8
 					require_once('require/class.Stats.php');
9 9
 					$Stats = new Stats();
10
-					if (!isset($filter_name)) $filter_name = '';
10
+					if (!isset($filter_name)) {
11
+						$filter_name = '';
12
+					}
11 13
 					$airlines = $Stats->getAllAirlineNames($filter_name);
12 14
 					if (isset($airline_icao) && ($airline_icao == '' || $airline_icao == 'all')) {
13 15
 						print '<option value="all" selected>All</option>';
Please login to merge, or discard this patch.
notam-data.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 <button type="button" class="close">&times;</button>
8 8
 <?php
9 9
 
10
-$notamref = filter_input(INPUT_GET,'notam',FILTER_SANITIZE_STRING);
10
+$notamref = filter_input(INPUT_GET, 'notam', FILTER_SANITIZE_STRING);
11 11
 $notamref = urldecode($notamref);
12 12
 $NOTAM = new NOTAM();
13 13
 $notam = $NOTAM->getNOTAMbyRef($notamref);
Please login to merge, or discard this patch.
require/class.NOTAM.php 4 patches
Indentation   +942 added lines, -942 removed lines patch added patch discarded remove patch
@@ -7,964 +7,964 @@
 block discarded – undo
7 7
 class NOTAM {
8 8
 	public $db;
9 9
 	private $abbr = array(
10
-	                    'A/A' => 'Air-to-air',
11
-	                    'A/G' => 'Air-to-ground',
12
-	                    'AAL' => 'Above Aerodrome Level',
13
-	                    'ABM' => 'Abeam',
14
-	                    'ABN' => 'Aerodrome Beacon',
15
-	                    'ABT' => 'About',
16
-	                    'ABV' => 'Above',
17
-	                    'ACC' => 'Area Control',
18
-	                    'ACFT' => 'Aircraft',
19
-	                    'ACK' => 'Acknowledge',
20
-	                    'ACL' => 'Altimeter Check Location',
21
-	                    'ACN' => 'Aircraft Classification Number',
22
-	                    'ACPT' => 'Accepted',
23
-	                    'ACT' => 'Active',
24
-	                    'AD' => 'Aerodrome',
25
-	                    'ADA' => 'Advisory Area',
26
-	                    'ADC' => 'Aerodrome Chart',
27
-	                    'ADDN' => 'Additional',
28
-	                    'ADIZ' => 'Air defense identification zone',
29
-	                    'ADJ' => 'Adjacent',
30
-	                    'ADR' => 'Advisory Route',
31
-	                    'ADS' => 'Automatic Dependent Surveillance',
32
-	                    'ADVS' => 'Advisory Service',
33
-	                    'ADZ' => 'Advised',
34
-	                    'AFIL' => 'Flight Plan Filed In The Air',
35
-	                    'AFIS' => 'Airport flight information service',
36
-	                    'AFM' => 'Affirm',
37
-	                    'AFT' => 'After',
38
-	                    'AGA' => 'Aerodromes, Air Routes and Ground Aids',
39
-	                    'AGN' => 'Again',
40
-	                    'AIS' => 'Aeronautical information service',
41
-	                    'ALERFA' => 'Alert Phase',
42
-	                    'ALRS' => 'Alerting Service',
43
-	                    'ALS' => 'Approach Lighting System',
44
-	                    'ALT' => 'Altitude',
45
-	                    'ALTN' => 'Alternate',
46
-	                    'AMA' => 'Area Minimum Altitude',
47
-	                    'ANC' => 'Aeronautical Chart',
48
-	                    'ANCS' => 'Aeronautical Navigation Chart',
49
-	                    'ANS' => 'Answer',
50
-	                    'AOC' => 'Aerodrome Obstacle Chart',
51
-	                    'AP' => 'Airport',
52
-	                    'APCH' => 'Approach',
53
-	                    'APDC' => 'Aircraft Parking/docking Chart',
54
-	                    'APN' => 'Apron',
55
-	                    'APNS' => 'Aprons',
56
-	                    'APP' => 'Approach Control',
57
-	                    'APR' => 'April',
58
-	                    'APRX' => 'Approximately',
59
-	                    'APSG' => 'After Passing',
60
-	                    'APV' => 'Approved',
61
-	                    'ARC' => 'Area Chart',
62
-	                    'ARNG' => 'Arrange',
63
-	                    'ARO' => 'Air Traffic Services Reporting Office',
64
-	                    'ARP' => 'Aerodrome Reference Point',
65
-	                    'ARR' => 'Arriving',
66
-	                    'ARST' => 'Arresting',
67
-	                    'ASC' => 'Ascend To',
68
-	                    'ASDA' => 'Accelerate-Stop Distance Available',
69
-	                    'ASPEEDG' => 'Airspeed Gain',
70
-	                    'ASPEEDL' => 'Airspeed Loss',
71
-	                    'ASPH' => 'Asphalt',
72
-	                    'ATA' => 'Actual Time of Arrival',
73
-	                    'ATD' => 'Actual Time of Departure',
74
-	                    'ATFM' => 'Air Traffic Flow Management',
75
-	                    'ATIS' => 'Automatic terminal information service',
76
-	                    'ATM' => 'Air Traffic Management',
77
-	                    'ATP' => 'At',
78
-	                    'ATTN' => 'Attention',
79
-	                    'ATZ' => 'Aerodrome Traffic Zone',
80
-	                    'AUG' => 'August',
81
-	                    'AUTH' => 'Authorization',
82
-	                    'AUW' => 'All Up Weight',
83
-	                    'AUX' => 'Auxiliary',
84
-	                    'AVBL' => 'Available',
85
-	                    'AVG' => 'Average',
86
-	                    'AVGAS' => 'Aviation Gasoline',
87
-	                    'AWTA' => 'Advise At What Time Able',
88
-	                    'AWY' => 'Airway',
89
-	                    'AWYS' => 'Airways',
90
-	                    'AZM' => 'Azimuth',
91
-	                    'BA' => 'Braking Action',
92
-	                    'BCN' => 'Beacon',
93
-	                    'BCST' => 'Broadcast',
94
-	                    'BDRY' => 'Boundary',
95
-	                    'BFR' => 'Before',
96
-	                    'BLDG' => 'Building',
97
-	                    'BLO' => 'Below Clouds',
98
-	                    'BLW' => 'Below',
99
-	                    'BRF' => 'Short',
100
-	                    'BRG' => 'Bearing',
101
-	                    'BRKG' => 'Breaking',
102
-	                    'BTL' => 'Between Layers',
103
-	                    'BTN' => 'Between',
104
-	                    'CD' => 'Candela',
105
-	                    'CDN' => 'Coordination',
106
-	                    'CF' => 'Change Frequency To',
107
-	                    'CFM' => 'Confirm',
108
-	                    'CGL' => 'Circling Guidance Light(s)',
109
-	                    'CH' => 'Channel',
110
-	                    'CHG' => 'Changed',
111
-	                    'CIT' => 'Near or Over Large Towns',
112
-	                    'CIV' => 'Civil',
113
-	                    'CK' => 'Check',
114
-	                    'CL' => 'Centre Line',
115
-	                    'CLBR' => 'Calibration',
116
-	                    'CLD' => 'Cloud',
117
-	                    'CLG' => 'Calling',
118
-	                    'CLIMB-OUT' => 'Climb-out Area',
119
-	                    'CLR' => 'Clearance',
120
-	                    'CLRD' => 'Cleared',
121
-	                    'CLSD' => 'Closed',
122
-	                    'CMB' => 'Climb',
123
-	                    'CMPL' => 'Complete',
124
-	                    'CNL' => 'Cancel',
125
-	                    'CNS' => 'Communications, Navigation And Surveillance',
126
-	                    'COM' => 'Communications',
127
-	                    'CONC' => 'Concrete',
128
-	                    'COND' => 'Condition',
129
-	                    'CONS' => 'Continuous',
130
-	                    'CONST' => 'Construction',
131
-	                    'CONT' => 'Continued',
132
-	                    'COOR' => 'Coordination',
133
-	                    'COORD' => 'Coordinates',
134
-	                    'COP' => 'Change-over Point',
135
-	                    'COR' => 'Correction',
136
-	                    'COT' => 'At The Coast',
137
-	                    'COV' => 'Covered',
138
-	                    'CPDLC' => 'Controller-pilot Data Link Communications',
139
-	                    'CPL' => 'Current Flight Plan',
140
-	                    'CRC' => 'Cyclic Redundancy Check',
141
-	                    'CRZ' => 'Cruise',
142
-	                    'CTA' => 'Control area',
143
-	                    'CTAM' => 'Climb To And Maintain',
144
-	                    'CTC' => 'Contact',
145
-	                    'CTL' => 'Control',
146
-	                    'CTN' => 'Caution',
147
-	                    'CTR' => 'Control Zone',
148
-	                    'CVR' => 'Cockpit Voice Recorder',
149
-	                    'CW' => 'Continuous Wave',
150
-	                    'CWY' => 'Clearway',
151
-	                    'DA' => 'Decision Altitude',
152
-	                    'DCKG' => 'Docking',
153
-	                    'DCP' => 'Datum Crossing Point',
154
-	                    'DCPC' => 'Direct Controller-pilot Communications',
155
-	                    'DCT' => 'Direct',
156
-	                    'DEC' => 'December',
157
-	                    'DEG' => 'Degrees',
158
-	                    'DEP' => 'Departing',
159
-	                    'DES' => 'Descend',
160
-	                    'DEST' => 'Destination',
161
-	                    'DETRESFA' => 'Distress Phase',
162
-	                    'DEV' => 'Deviating',
163
-	                    'DFDR' => 'Digital Flight Data Recorder',
164
-	                    'DFTI' => 'Distance From Touchdown Indicator',
165
-	                    'DH' => 'Decision Height',
166
-	                    'DIP' => 'Diffuse',
167
-	                    'DIST' => 'Distance',
168
-	                    'DIV' => 'Divert',
169
-	                    'DLA' => 'Delay',
170
-	                    'DLY' => 'Daily',
171
-	                    'DME' => 'Distance measuring equipment',
172
-	                    'DNG' => 'Dangerous',
173
-	                    'DOM' => 'Domestic',
174
-	                    'DPT' => 'Depth',
175
-	                    'DR' => 'Dead Reckoning',
176
-	                    'DRG' => 'During',
177
-	                    'DTAM' => 'Descend To And Maintain',
178
-	                    'DTG' => 'Date-time Group',
179
-	                    'DTHR' => 'Displaced Runway Threshold',
180
-	                    'DTRT' => 'Deteriorating',
181
-	                    'DTW' => 'Dual Tandem Wheels',
182
-	                    'DUPE' => 'This Is A Duplicate Message',
183
-	                    'DUR' => 'Duration',
184
-	                    'DVOR' => 'Doppler VOR',
185
-	                    'DW' => 'Dual Wheels',
186
-	                    'EAT' => 'Expected Approach Time',
187
-	                    'EB' => 'Eastbound',
188
-	                    'EDA' => 'Elevation Differential Area',
189
-	                    'EET' => 'Estimated Elapsed Time',
190
-	                    'EFC' => 'Expect Further Clearance',
191
-	                    'ELBA' => 'Emergency Location Beacon',
192
-	                    'ELEV' => 'Elevation',
193
-	                    'ELR' => 'Extra Long Range',
194
-	                    'EM' => 'Emission',
195
-	                    'EMERG' => 'Emergency',
196
-	                    'END' => 'Stop-end',
197
-	                    'ENE' => 'East-north-east',
198
-	                    'ENG' => 'Engine',
199
-	                    'ENR' => 'En-route',
200
-	                    'ENRC' => 'En-route Chart',
201
-	                    'EOBT' => 'Estimated Off-block Time',
202
-	                    'EQPT' => 'Equipment',
203
-	                    'ER' => 'Here',
204
-	                    'ESE' => 'East-south-east',
205
-	                    'EST' => 'Estimate',
206
-	                    'ETA' => 'Estimated Time Of Arrival',
207
-	                    'ETD' => 'Estimated Time Of Departure',
208
-	                    'ETO' => 'Estimated Time Over Significant Point',
209
-	                    'EV' => 'Every',
210
-	                    'EXC' => 'Except',
211
-	                    'EXER' => 'Exercise',
212
-	                    'EXP' => 'Expect',
213
-	                    'EXTD' => 'Extend',
214
-	                    'FAC' => 'Facilities',
215
-	                    'FAF' => 'Final Approach Fix',
216
-	                    'FAL' => 'Facilitation of International Airtransport',
217
-	                    'FAP' => 'Final Approach Point',
218
-	                    'FATO' => 'Final Approach And Take-off Area',
219
-	                    'FAX' => 'Fax',
220
-	                    'FBL' => 'Light',
221
-	                    'FCST' => 'Forecast',
222
-	                    'FCT' => 'Friction Coefficient',
223
-	                    'FDPS' => 'Flight Data Processing System',
224
-	                    'FEB' => 'February',
225
-	                    'FIR' => 'Flight information region',
226
-	                    'FIS' => 'Flight information service',
227
-	                    'FLD' => 'Field',
228
-	                    'FLG' => 'Flashing',
229
-	                    'FLR' => 'Flares',
230
-	                    'FLT' => 'Flight',
231
-	                    'FLTS' => 'Flights',
232
-	                    'FLTCK' => 'Flight Check',
233
-	                    'FLUC' => 'Fluctuating',
234
-	                    'FLW' => 'Follow(s)',
235
-	                    'FLY' => 'Fly',
236
-	                    'FM' => 'From',
237
-	                    'FMS' => 'Flight Management System',
238
-	                    'FMU' => 'Flow Management Unit',
239
-	                    'FNA' => 'Final Approach',
240
-	                    'FPAP' => 'Flight Path Alignment Point',
241
-	                    'FPL' => 'Flight Plan',
242
-	                    'FPLS' => 'Flight Plans',
243
-	                    'FPM' => 'Feet Per Minute',
244
-	                    'FPR' => 'Flight Plan Route',
245
-	                    'FR' => 'Fuel Remaining',
246
-	                    'FREQ' => 'Frequency',
247
-	                    'FRI' => 'Friday',
248
-	                    'FRMG' => 'Missile, gun or rocket firing',
249
-	                    'FRNG' => 'Firing',
250
-	                    'FRONT' => 'Front',
251
-	                    'FRQ' => 'Frequent',
252
-	                    'FSL' => 'Full Stop Landing',
253
-	                    'FSS' => 'Flight Service Station',
254
-	                    'FST' => 'First',
255
-	                    'FTP' => 'Fictitious Threshold Point',
256
-	                    'G/A' => 'Ground-to-air',
257
-	                    'G/A/G' => 'Ground-to-air and Air-to-ground',
258
-	                    'GARP' => 'GBAS Azimuth Reference Point',
259
-	                    'GBAS' => 'Ground-based Augmentation System',
260
-	                    'GCAJ' => 'Ground Controlled Approach',
261
-	                    'GCA' => 'Ground Controlled Approach System',
262
-	                    'GEN' => 'General',
263
-	                    'GEO' => 'Geographic or True',
264
-	                    'GES' => 'Ground Earth Station',
265
-	                    'GLD' => 'Glider',
266
-	                    'GMC' => 'Ground Movement Chart',
267
-	                    'GND' => 'Ground',
268
-	                    'GNDCK' => 'Ground Check',
269
-	                    'GP' => 'Glide Path',
270
-	                    'GRASS' => 'Grass landing area',
271
-	                    'GRVL' => 'Gravel',
272
-	                    'GUND' => 'Geoid Undulation',
273
-	                    'H24' => '24 Hours',
274
-	                    'HAPI' => 'Helicopter Approach Path Indicator',
275
-	                    'HBN' => 'Hazard Beacon',
276
-	                    'HDG' => 'Heading',
277
-	                    'HEL' => 'Helicopter',
278
-	                    'HGT' => 'Height',
279
-	                    'HJ' => 'Sunrise to Sunset',
280
-	                    'HLDG' => 'Holding',
281
-	                    'HN' => 'Sunset to Sunrise',
282
-	                    'HO' => 'Service Available To Meet Operational Requirements',
283
-	                    'HOL' => 'Holiday',
284
-	                    'HOSP' => 'Hospital Aircraft',
285
-	                    'HOT' => 'Height',
286
-	                    'HPA' => 'Hectopascal',
287
-	                    'HR' => 'Hours',
288
-	                    'HRS' => 'Hours',
289
-	                    'HS' => 'Service Available During Hours Of Scheduled Operations',
290
-	                    'HURCN' => 'Hurricane',
291
-	                    'HVY' => 'Heavy',
292
-	                    'HX' => 'No Specific Working Hours',
293
-	                    'HYR' => 'Higher',
294
-	                    'IAC' => 'Instrument Approach Chart',
295
-	                    'IAF' => 'Initial Approach Fix',
296
-	                    'IAO' => 'In And Out Of Clouds',
297
-	                    'IAP' => 'Instrument Approach Procedure',
298
-	                    'IAR' => 'Intersection Of Air Routes',
299
-	                    'IBN' => 'Identification Beacon',
300
-	                    'ID' => 'Identifier',
301
-	                    'IDENT' => 'Identification',
302
-	                    'IFF' => 'Identification Friend/Foe',
303
-	                    'IGA' => 'International General Aviation',
304
-	                    'IM' => 'Inner Marker',
305
-	                    'IMPR' => 'Improving',
306
-	                    'IMT' => 'Immediately',
307
-	                    'INA' => 'Initial Approach',
308
-	                    'INBD' => 'Inbound',
309
-	                    'INCERFA' => 'Uncertainty Phase',
310
-	                    'INFO' => 'Information',
311
-	                    'INOP' => 'Inoperative',
312
-	                    'INP' => 'If Not Possible',
313
-	                    'INPR' => 'In Progress',
314
-	                    'INSTL' => 'Installation',
315
-	                    'INSTR' => 'Instrument',
316
-	                    'INT' => 'Intersection',
317
-	                    'INTS' => 'Intersections',
318
-	                    'INTL' => 'International',
319
-	                    'INTRG' => 'Interrogator',
320
-	                    'INTRP' => 'Interruption',
321
-	                    'INTSF' => 'Intensifying',
322
-	                    'INTST' => 'Intensity',
323
-	                    'ISA' => 'International Standard Atmosphere',
324
-	                    'JAN' => 'January',
325
-	                    'JTST' => 'Jet stream',
326
-	                    'JUL' => 'July',
327
-	                    'JUN' => 'June',
328
-	                    'KMH' => 'Kilometres Per Hour',
329
-	                    'KPA' => 'Kilopascal',
330
-	                    'KT' => 'Knots',
331
-	                    'KW' => 'Kilowatts',
332
-	                    'LAN' => 'Inland',
333
-	                    'LAT' => 'Latitude',
334
-	                    'LDA' => 'Landing Distance Available',
335
-	                    'LDAH' => 'Landing Distance Available, Helicopter',
336
-	                    'LDG' => 'Landing',
337
-	                    'LDI' => 'Landing Direction Indicator',
338
-	                    'LEN' => 'Length',
339
-	                    'LGT' => 'Lighting',
340
-	                    'LGTD' => 'Lighted',
341
-	                    'LIH' => 'Light Intensity High',
342
-	                    'LIL' => 'Light Intensity Low',
343
-	                    'LIM' => 'Light Intensity Medium',
344
-	                    'LLZ' => 'Localizer',
345
-	                    'LM' => 'Locator, Middle',
346
-	                    'LMT' => 'Local Mean Time',
347
-	                    'LNG' => 'Long',
348
-	                    'LO' => 'Locator, Outer',
349
-	                    'LOG' => 'Located',
350
-	                    'LONG' => 'Longitude',
351
-	                    'LRG' => 'Long Range',
352
-	                    'LTD' => 'Limited',
353
-	                    'LTP' => 'Landing Threshold Point',
354
-	                    'LVE' => 'Leaving',
355
-	                    'LVL' => 'Level',
356
-	                    'LYR' => 'Layer',
357
-	                    'MAA' => 'Maximum Authorized Altitude',
358
-	                    'MAG' => 'Magnetic',
359
-	                    'MAINT' => 'Maintenance',
360
-	                    'MAP' => 'Aeronautical Maps and Charts',
361
-	                    'MAPT' => 'Missed Approach Point',
362
-	                    'MAR' => 'March',
363
-	                    'MAX' => 'Maximum',
364
-	                    'MAY' => 'May',
365
-	                    'MBST' => 'Microburst',
366
-	                    'MCA' => 'Minimum Crossing Altitude',
367
-	                    'MCW' => 'Modulated Continuous Wave',
368
-	                    'MDA' => 'Minimum Descent Altitude',
369
-	                    'MDH' => 'Minimum Descent Height',
370
-	                    'MEA' => 'Minimum En-route Altitude',
371
-	                    'MEHT' => 'Minimum Eye Height Over Threshold',
372
-	                    'MET' => 'Meteorological',
373
-	                    'MID' => 'Mid-point',
374
-	                    'MIL' => 'Military',
375
-	                    'MIN' => 'Minutes',
376
-	                    'MKR' => 'Marker Radio Beacon',
377
-	                    'MLS' => 'Microwave Landing System',
378
-	                    'MM' => 'Middle Marker',
379
-	                    'MNM' => 'Minimum',
380
-	                    'MNPS' => 'Minimum Navigation Performance Specifications',
381
-	                    'MNT' => 'Monitor',
382
-	                    'MNTN' => 'Maintain',
383
-	                    'MOA' => 'Military Operating Area',
384
-	                    'MOC' => 'Minimum Obstacle Clearance',
385
-	                    'MOD' => 'Moderate',
386
-	                    'MON' => 'Monday',
387
-	                    'MOPS' => 'Minimum Operational Performance Standards',
388
-	                    'MOV' => 'Movement',
389
-	                    'MRA' => 'Minimum Reception Altitude',
390
-	                    'MRG' => 'Medium Range',
391
-	                    'MRP' => 'ATS/MET Reporting Point',
392
-	                    'MS' => 'Minus',
393
-	                    'MSA' => 'Minimum Sector Altitude',
394
-	                    'MSAW' => 'Minimum Safe Altitude Warning',
395
-	                    'MSG' => 'Message',
396
-	                    'MSSR' => 'Monopulse Secondary Surveillance Radar',
397
-	                    'MT' => 'Mountain',
398
-	                    'MTU' => 'Metric Units',
399
-	                    'MTW' => 'Mountain Waves',
400
-	                    'NASC' => 'National AIS System Centre',
401
-	                    'NAT' => 'North Atlantic',
402
-	                    'NAV' => 'Navigation',
403
-	                    'NB' => 'Northbound',
404
-	                    'NBFR' => 'Not Before',
405
-	                    'NE' => 'North-east',
406
-	                    'NEB' => 'North-eastbound',
407
-	                    'NEG' => 'Negative',
408
-	                    'NGT' => 'Night',
409
-	                    'NIL' => 'None',
410
-	                    'NML' => 'Normal',
411
-	                    'NNE' => 'North-north-east',
412
-	                    'NNW' => 'North-north-west',
413
-	                    'NOF' => 'International NOTAM Office',
414
-	                    'NOV' => 'November',
415
-	                    'NOZ' => 'Normal Operating Zone',
416
-	                    'NR' => 'Number',
417
-	                    'NRH' => 'No Reply Heard',
418
-	                    'NTL' => 'National',
419
-	                    'NTZ' => 'No Transgression Zone',
420
-	                    'NW' => 'North-west',
421
-	                    'NWB' => 'North-westbound',
422
-	                    'NXT' => 'Next',
423
-	                    'O/R' => 'On Request',
424
-	                    'OAC' => 'Oceanic Area Control Centre',
425
-	                    'OAS' => 'Obstacle Assessment Surface',
426
-	                    'OBS' => 'Observe',
427
-	                    'OBST' => 'Obstacle',
428
-	                    'OBSTS' => 'Obstacles',
429
-	                    'OCA' => 'Oceanic Control Area',
430
-	                    'OCH' => 'Obstacle Clearance Height',
431
-	                    'OCL' => 'Obstacle Clearance Limit',
432
-	                    'OCS' => 'Obstacle Clearance Surface',
433
-	                    'OCT' => 'October',
434
-	                    'OFZ' => 'Obstacle Free Zone',
435
-	                    'OGN' => 'Originate',
436
-	                    'OHD' => 'Overhead',
437
-	                    'OM' => 'Outer Marker',
438
-	                    'OPC' => 'Control Indicated Is Operational Control',
439
-	                    'OPMET' => 'Operational Meteorological',
440
-	                    'OPN' => 'Open',
441
-	                    'OPR' => 'Operate',
442
-	                    'OPS' => 'Operations',
443
-	                    'ORD' => 'Order',
444
-	                    'OSV' => 'Ocean Station Vessel',
445
-	                    'OTLK' => 'Outlook',
446
-	                    'OTP' => 'On Top',
447
-	                    'OTS' => 'Organized Track System',
448
-	                    'OUBD' => 'Outbound',
449
-	                    'PA' => 'Precision Approach',
450
-	                    'PALS' => 'Precision Approach Lighting System',
451
-	                    'PANS' => 'Procedures for Air Navigation Services',
452
-	                    'PAR' => 'Precision Approach Radar',
453
-	                    'PARL' => 'Parallel',
454
-	                    'PATC' => 'Precision Approach Terrain Chart',
455
-	                    'PAX' => 'Passenger(s)',
456
-	                    'PCD' => 'Proceed',
457
-	                    'PCL' => 'Pilot-controlled Lighting',
458
-	                    'PCN' => 'Pavement Classification Number',
459
-	                    'PDC' => 'Pre-departure Clearance',
460
-	                    'PDG' => 'Procedure Design Gradient',
461
-	                    'PER' => 'Performance',
462
-	                    'PERM' => 'Permanent',
463
-	                    'PIB' => 'Pre-flight Information Bulletin',
464
-	                    'PJE' => 'Parachute Jumping Exercise',
465
-	                    'PLA' => 'Practice Low Approach',
466
-	                    'PLN' => 'Flight Plan',
467
-	                    'PLVL' => 'Present Level',
468
-	                    'PN' => 'Prior Notice Required',
469
-	                    'PNR' => 'Point Of No Return',
470
-	                    'POB' => 'Persons On Board',
471
-	                    'POSS' => 'Possible',
472
-	                    'PPI' => 'Plan Position Indicator',
473
-	                    'PPR' => 'Prior Permission Required',
474
-	                    'PPSN' => 'Present Position',
475
-	                    'PRI' => 'Primary',
476
-	                    'PRKG' => 'Parking',
477
-	                    'PROB' => 'Probability',
478
-	                    'PROC' => 'Procedure',
479
-	                    'PROV' => 'Provisional',
480
-	                    'PS' => 'Plus',
481
-	                    'PSG' => 'Passing',
482
-	                    'PSN' => 'Position',
483
-	                    'PSNS' => 'Positions',
484
-	                    'PSR' => 'Primary Surveillance Radar',
485
-	                    'PSYS' => 'Pressure System(s)',
486
-	                    'PTN' => 'Procedure Turn',
487
-	                    'PTS' => 'Polar Track Structure',
488
-	                    'PWR' => 'Power',
489
-	                    'QUAD' => 'Quadrant',
490
-	                    'RAC' => 'Rules of The Air and Air Traffic Services',
491
-	                    'RAG' => 'Runway Arresting Gear',
492
-	                    'RAI' => 'Runway Alignment Indicator',
493
-	                    'RASC' => 'Regional AIS System Centre',
494
-	                    'RASS' => 'Remote Altimeter Setting Source',
495
-	                    'RB' => 'Rescue Boat',
496
-	                    'RCA' => 'Reach Cruising Altitude',
497
-	                    'RCC' => 'Rescue Coordination Centre',
498
-	                    'RCF' => 'Radiocommunication Failure',
499
-	                    'RCH' => 'Reaching',
500
-	                    'RCL' => 'Runway Centre Line',
501
-	                    'RCLL' => 'Runway Centre Line Light(s)',
502
-	                    'RCLR' => 'Recleared',
503
-	                    'RDH' => 'Reference Datum Height',
504
-	                    'RDL' => 'Radial',
505
-	                    'RDO' => 'Radio',
506
-	                    'RE' => 'Recent',
507
-	                    'REC' => 'Receiver',
508
-	                    'REDL' => 'Runway Edge Light(s)',
509
-	                    'REF' => 'Refer To',
510
-	                    'REG' => 'Registration',
511
-	                    'RENL' => 'Runway End Light(s)',
512
-	                    'REP' => 'Report',
513
-	                    'REQ' => 'Requested',
514
-	                    'RERTE' => 'Re-route',
515
-	                    'RESA' => 'Runway End Safety Area',
516
-	                    'RG' => 'Range (lights)',
517
-	                    'RHC' => 'Right-hand Circuit',
518
-	                    'RIF' => 'Reclearance In Flight',
519
-	                    'RITE' => 'Right',
520
-	                    'RL' => 'Report Leaving',
521
-	                    'RLA' => 'Relay To',
522
-	                    'RLCE' => 'Request Level Change En Route',
523
-	                    'RLLS' => 'Runway Lead-in Lighting System',
524
-	                    'RLNA' => 'Request Level Not Available',
525
-	                    'RMAC' => 'Radar Minimum Altitude Chart',
526
-	                    'RMK' => 'Remark',
527
-	                    'RNG' => 'Radio Range',
528
-	                    'RNP' => 'Required Navigation Performance',
529
-	                    'ROC' => 'Rate Of Climb',
530
-	                    'ROD' => 'Rate Of Descent',
531
-	                    'ROFOR' => 'Route Forecast',
532
-	                    'RON' => 'Receiving Only',
533
-	                    'RPI' => 'Radar Position Indicator',
534
-	                    'RPL' => 'Repetitive Flight Plan',
535
-	                    'RPLC' => 'Replaced',
536
-	                    'RPS' => 'Radar Position Symbol',
537
-	                    'RQMNTS' => 'Requirements',
538
-	                    'RQP' => 'Request Flight Plan',
539
-	                    'RQS' => 'Request Supplementary Flight Plan',
540
-	                    'RR' => 'Report Reaching',
541
-	                    'RSC' => 'Rescue Sub-centre',
542
-	                    'RSCD' => 'Runway Surface Condition',
543
-	                    'RSP' => 'Responder Beacon',
544
-	                    'RSR' => 'En-route Surveillance Radar',
545
-	                    'RTE' => 'Route',
546
-	                    'RTES' => 'Routes',
547
-	                    'RTF' => 'Radiotelephone',
548
-	                    'RTG' => 'Radiotelegraph',
549
-	                    'RTHL' => 'Runway Threshold Light(s)',
550
-	                    'RTN' => 'Return',
551
-	                    'RTODAH' => 'Rejected Take-off Distance Available, Helicopter',
552
-	                    'RTS' => 'Return To Service',
553
-	                    'RTT' => 'Radioteletypewriter',
554
-	                    'RTZL' => 'Runway Touchdown Zone Light(s)',
555
-	                    'RUT' => 'Standard Regional Route Transmitting Frequencies',
556
-	                    'RV' => 'Rescue Vessel',
557
-	                    'RVSM' => 'Reduced Vertical Separation Minimum',
558
-	                    'RWY' => 'Runway',
559
-	                    'RWYS' => 'Runways',
560
-	                    'SALS' => 'Simple Approach Lighting System',
561
-	                    'SAN' => 'Sanitary',
562
-	                    'SAP' => 'As Soon As Possible',
563
-	                    'SAR' => 'Search and Rescue',
564
-	                    'SARPS' => 'Standards and Recommended Practices',
565
-	                    'SAT' => 'Saturday',
566
-	                    'SATCOM' => 'Satellite Communication',
567
-	                    'SB' => 'Southbound',
568
-	                    'SBAS' => 'Satellite-based Augmentation System',
569
-	                    'SDBY' => 'Stand by',
570
-	                    'SE' => 'South-east',
571
-	                    'SEA' => 'Sea',
572
-	                    'SEB' => 'South-eastbound',
573
-	                    'SEC' => 'Seconds',
574
-	                    'SECN' => 'Section',
575
-	                    'SECT' => 'Sector',
576
-	                    'SELCAL' => 'Selective calling system',
577
-	                    'SEP' => 'September',
578
-	                    'SER' => 'Service',
579
-	                    'SEV' => 'Severe',
580
-	                    'SFC' => 'Surface',
581
-	                    'SGL' => 'Signal',
582
-	                    'SID' => 'Standard Instrument Departure',
583
-	                    'SIF' => 'Selective Identification Feature',
584
-	                    'SIG' => 'Significant',
585
-	                    'SIMUL' => 'Simultaneous',
586
-	                    'SKED' => 'Schedule',
587
-	                    'SLP' => 'Speed Limiting Point',
588
-	                    'SLW' => 'Slow',
589
-	                    'SMC' => 'Surface Movement Control',
590
-	                    'SMR' => 'Surface Movement Radar',
591
-	                    'SPL' => 'Supplementary Flight Plan',
592
-	                    'SPOC' => 'SAR Point Of Contact',
593
-	                    'SPOT' => 'Spot Wind',
594
-	                    'SR' => 'Sunrise',
595
-	                    'SRA' => 'Surveillance Radar Approach',
596
-	                    'SRE' => 'Surveillance Radar Element Of Precision Approach Radar System',
597
-	                    'SRG' => 'Short Range',
598
-	                    'SRR' => 'Search and Rescue Region',
599
-	                    'SRY' => 'Secondary',
600
-	                    'SS' => 'Sunset',
601
-	                    'SSE' => 'South-south-east',
602
-	                    'SSR' => 'Secondary Surveillance Radar',
603
-	                    'SST' => 'Supersonic Transport',
604
-	                    'SSW' => 'South-south-west',
605
-	                    'STA' => 'Straight-in Approach',
606
-	                    'STAR' => 'Standard Instrument Arrival',
607
-	                    'STD' => 'Standard',
608
-	                    'STN' => 'Station',
609
-	                    'STNR' => 'Stationary',
610
-	                    'STOL' => 'Short Take-off and Landing',
611
-	                    'STS' => 'Status',
612
-	                    'STWL' => 'Stopway Light(s)',
613
-	                    'SUBJ' => 'Subject To',
614
-	                    'SUN' => 'Sunday',
615
-	                    'SUP' => 'Supplement',
616
-	                    'SUPPS' => 'Regional Supplementary Procedures Service Message',
617
-	                    'SVCBL' => 'Serviceable',
618
-	                    'SW' => 'South-west',
619
-	                    'SWB' => 'South-westbound',
620
-	                    'SWY' => 'Stopway',
621
-	                    'TA' => 'Transition Altitude',
622
-	                    'TAA' => 'Terminal Arrival Altitude',
623
-	                    'TAF' => 'Aerodrome Forecast',
624
-	                    'TAIL' => 'Tail Wind',
625
-	                    'TAR' => 'Terminal Area Surveillance Radar',
626
-	                    'TAX' => 'Taxi',
627
-	                    'TCAC' => 'Tropical Cyclone Advisory Centre',
628
-	                    'TDO' => 'Tornado',
629
-	                    'TDZ' => 'Touchdown Zone',
630
-	                    'TECR' => 'Technical Reason',
631
-	                    'TEMPO' => 'Temporarily',
632
-	                    'TFC' => 'Traffic',
633
-	                    'TGL' => 'Touch-and-go',
634
-	                    'TGS' => 'Taxiing Guidance System',
635
-	                    'THR' => 'Threshold',
636
-	                    'THRU' => 'Through',
637
-	                    'THU' => 'Thursday',
638
-	                    'TIBA' => 'Traffic Information Broadcast By Aircraft',
639
-	                    'TIL' => 'Until',
640
-	                    'TIP' => 'Until Past',
641
-	                    'TKOF' => 'Take-off',
642
-	                    'TL' => 'Till',
643
-	                    'TLOF' => 'Touchdown And Lift-off Area',
644
-	                    'TMA' => 'Terminal Control Area',
645
-	                    'TNA' => 'Turn Altitude',
646
-	                    'TNH' => 'Turn Height',
647
-	                    'TOC' => 'Top of Climb',
648
-	                    'TODA' => 'Take-off Distance Available',
649
-	                    'TODAH' => 'Take-off Distance Available, Helicopter',
650
-	                    'TORA' => 'Take-off Run Available',
651
-	                    'TP' => 'Turning Point',
652
-	                    'TR' => 'Track',
653
-	                    'TRA' => 'Temporary Reserved Airspace',
654
-	                    'TRANS' => 'Transmitter',
655
-	                    'TRL' => 'Transition Level',
656
-	                    'TUE' => 'Tuesday',
657
-	                    'TURB' => 'Turbulence',
658
-	                    'TVOR' => 'Terminal VOR',
659
-	                    'TWR' => 'Tower',
660
-	                    'TWY' => 'Taxiway',
661
-	                    'TWYL' => 'Taxiway-link',
662
-	                    'TXT' => 'Text',
663
-	                    'TYP' => 'Type of Aircraft',
664
-	                    'U/S' => 'Unserviceable',
665
-	                    'UAB' => 'Until Advised By',
666
-	                    'UAC' => 'Upper Area Control Centre',
667
-	                    'UAR' => 'Upper Air Route',
668
-	                    'UDA' => 'Upper advisory area',
669
-	                    'UFN' => 'Until Further Notice',
670
-	                    'UHDT' => 'Unable Higher Due Traffic',
671
-	                    'UIC' => 'Upper Information Centre',
672
-	                    'UIR' => 'Upper Flight Information Region',
673
-	                    'ULR' => 'Ultra Long Range',
674
-	                    'UNA' => 'Unable',
675
-	                    'UNAP' => 'Unable To Approve',
676
-	                    'UNL' => 'Unlimited',
677
-	                    'UNREL' => 'Unreliable',
678
-	                    'UTA' => 'Upper Control Area',
679
-	                    'VAAC' => 'Volcanic Ash Advisory Centre',
680
-	                    'VAC' => 'Visual Approach Chart',
681
-	                    'VAL' => 'In Valleys',
682
-	                    'VAN' => 'Runway Control Van',
683
-	                    'VAR' => 'Visual-aural Radio Range',
684
-	                    'VC' => 'Vicinity',
685
-	                    'VCY' => 'Vicinity',
686
-	                    'VER' => 'Vertical',
687
-	                    'VIS' => 'Visibility',
688
-	                    'VLR' => 'Very Long Range',
689
-	                    'VPA' => 'Vertical Path Angle',
690
-	                    'VRB' => 'Variable',
691
-	                    'VSA' => 'By Visual Reference To The Ground',
692
-	                    'VSP' => 'Vertical Speed',
693
-	                    'VTOL' => 'Vertical Take-off And Landing',
694
-	                    'WAC' => 'World Aeronautical Chart',
695
-	                    'WAFC' => 'World Area Forecast Centre',
696
-	                    'WB' => 'Westbound',
697
-	                    'WBAR' => 'Wing Bar Lights',
698
-	                    'WDI' => 'Wind Direction Indicator',
699
-	                    'WDSPR' => 'Widespread',
700
-	                    'WED' => 'Wednesday',
701
-	                    'WEF' => 'Effective From',
702
-	                    'WI' => 'Within',
703
-	                    'WID' => 'Width',
704
-	                    'WIE' => 'Effective Immediately',
705
-	                    'WILCO' => 'Will Comply',
706
-	                    'WIND' => 'Wind',
707
-	                    'WINTEM' => 'Forecast Upper Wind And Temperature For Aviation',
708
-	                    'WIP' => 'Work In Progress',
709
-	                    'WKN' => 'Weaken',
710
-	                    'WNW' => 'West-north-west',
711
-	                    'WO' => 'Without',
712
-	                    'WPT' => 'Way-point',
713
-	                    'WRNG' => 'Warning',
714
-	                    'WSW' => 'West-south-west',
715
-	                    'WT' => 'Weight',
716
-	                    'WWW' => 'Worldwide Web',
717
-	                    'WX' => 'Weather',
718
-	                    'XBAR' => 'Crossbar',
719
-	                    'XNG' => 'Crossing',
720
-	                    'XS' => 'Atmospherics',
721
-	                    'YCZ' => 'Yellow Caution Zone',
722
-	                    'YR' => 'Your');
10
+						'A/A' => 'Air-to-air',
11
+						'A/G' => 'Air-to-ground',
12
+						'AAL' => 'Above Aerodrome Level',
13
+						'ABM' => 'Abeam',
14
+						'ABN' => 'Aerodrome Beacon',
15
+						'ABT' => 'About',
16
+						'ABV' => 'Above',
17
+						'ACC' => 'Area Control',
18
+						'ACFT' => 'Aircraft',
19
+						'ACK' => 'Acknowledge',
20
+						'ACL' => 'Altimeter Check Location',
21
+						'ACN' => 'Aircraft Classification Number',
22
+						'ACPT' => 'Accepted',
23
+						'ACT' => 'Active',
24
+						'AD' => 'Aerodrome',
25
+						'ADA' => 'Advisory Area',
26
+						'ADC' => 'Aerodrome Chart',
27
+						'ADDN' => 'Additional',
28
+						'ADIZ' => 'Air defense identification zone',
29
+						'ADJ' => 'Adjacent',
30
+						'ADR' => 'Advisory Route',
31
+						'ADS' => 'Automatic Dependent Surveillance',
32
+						'ADVS' => 'Advisory Service',
33
+						'ADZ' => 'Advised',
34
+						'AFIL' => 'Flight Plan Filed In The Air',
35
+						'AFIS' => 'Airport flight information service',
36
+						'AFM' => 'Affirm',
37
+						'AFT' => 'After',
38
+						'AGA' => 'Aerodromes, Air Routes and Ground Aids',
39
+						'AGN' => 'Again',
40
+						'AIS' => 'Aeronautical information service',
41
+						'ALERFA' => 'Alert Phase',
42
+						'ALRS' => 'Alerting Service',
43
+						'ALS' => 'Approach Lighting System',
44
+						'ALT' => 'Altitude',
45
+						'ALTN' => 'Alternate',
46
+						'AMA' => 'Area Minimum Altitude',
47
+						'ANC' => 'Aeronautical Chart',
48
+						'ANCS' => 'Aeronautical Navigation Chart',
49
+						'ANS' => 'Answer',
50
+						'AOC' => 'Aerodrome Obstacle Chart',
51
+						'AP' => 'Airport',
52
+						'APCH' => 'Approach',
53
+						'APDC' => 'Aircraft Parking/docking Chart',
54
+						'APN' => 'Apron',
55
+						'APNS' => 'Aprons',
56
+						'APP' => 'Approach Control',
57
+						'APR' => 'April',
58
+						'APRX' => 'Approximately',
59
+						'APSG' => 'After Passing',
60
+						'APV' => 'Approved',
61
+						'ARC' => 'Area Chart',
62
+						'ARNG' => 'Arrange',
63
+						'ARO' => 'Air Traffic Services Reporting Office',
64
+						'ARP' => 'Aerodrome Reference Point',
65
+						'ARR' => 'Arriving',
66
+						'ARST' => 'Arresting',
67
+						'ASC' => 'Ascend To',
68
+						'ASDA' => 'Accelerate-Stop Distance Available',
69
+						'ASPEEDG' => 'Airspeed Gain',
70
+						'ASPEEDL' => 'Airspeed Loss',
71
+						'ASPH' => 'Asphalt',
72
+						'ATA' => 'Actual Time of Arrival',
73
+						'ATD' => 'Actual Time of Departure',
74
+						'ATFM' => 'Air Traffic Flow Management',
75
+						'ATIS' => 'Automatic terminal information service',
76
+						'ATM' => 'Air Traffic Management',
77
+						'ATP' => 'At',
78
+						'ATTN' => 'Attention',
79
+						'ATZ' => 'Aerodrome Traffic Zone',
80
+						'AUG' => 'August',
81
+						'AUTH' => 'Authorization',
82
+						'AUW' => 'All Up Weight',
83
+						'AUX' => 'Auxiliary',
84
+						'AVBL' => 'Available',
85
+						'AVG' => 'Average',
86
+						'AVGAS' => 'Aviation Gasoline',
87
+						'AWTA' => 'Advise At What Time Able',
88
+						'AWY' => 'Airway',
89
+						'AWYS' => 'Airways',
90
+						'AZM' => 'Azimuth',
91
+						'BA' => 'Braking Action',
92
+						'BCN' => 'Beacon',
93
+						'BCST' => 'Broadcast',
94
+						'BDRY' => 'Boundary',
95
+						'BFR' => 'Before',
96
+						'BLDG' => 'Building',
97
+						'BLO' => 'Below Clouds',
98
+						'BLW' => 'Below',
99
+						'BRF' => 'Short',
100
+						'BRG' => 'Bearing',
101
+						'BRKG' => 'Breaking',
102
+						'BTL' => 'Between Layers',
103
+						'BTN' => 'Between',
104
+						'CD' => 'Candela',
105
+						'CDN' => 'Coordination',
106
+						'CF' => 'Change Frequency To',
107
+						'CFM' => 'Confirm',
108
+						'CGL' => 'Circling Guidance Light(s)',
109
+						'CH' => 'Channel',
110
+						'CHG' => 'Changed',
111
+						'CIT' => 'Near or Over Large Towns',
112
+						'CIV' => 'Civil',
113
+						'CK' => 'Check',
114
+						'CL' => 'Centre Line',
115
+						'CLBR' => 'Calibration',
116
+						'CLD' => 'Cloud',
117
+						'CLG' => 'Calling',
118
+						'CLIMB-OUT' => 'Climb-out Area',
119
+						'CLR' => 'Clearance',
120
+						'CLRD' => 'Cleared',
121
+						'CLSD' => 'Closed',
122
+						'CMB' => 'Climb',
123
+						'CMPL' => 'Complete',
124
+						'CNL' => 'Cancel',
125
+						'CNS' => 'Communications, Navigation And Surveillance',
126
+						'COM' => 'Communications',
127
+						'CONC' => 'Concrete',
128
+						'COND' => 'Condition',
129
+						'CONS' => 'Continuous',
130
+						'CONST' => 'Construction',
131
+						'CONT' => 'Continued',
132
+						'COOR' => 'Coordination',
133
+						'COORD' => 'Coordinates',
134
+						'COP' => 'Change-over Point',
135
+						'COR' => 'Correction',
136
+						'COT' => 'At The Coast',
137
+						'COV' => 'Covered',
138
+						'CPDLC' => 'Controller-pilot Data Link Communications',
139
+						'CPL' => 'Current Flight Plan',
140
+						'CRC' => 'Cyclic Redundancy Check',
141
+						'CRZ' => 'Cruise',
142
+						'CTA' => 'Control area',
143
+						'CTAM' => 'Climb To And Maintain',
144
+						'CTC' => 'Contact',
145
+						'CTL' => 'Control',
146
+						'CTN' => 'Caution',
147
+						'CTR' => 'Control Zone',
148
+						'CVR' => 'Cockpit Voice Recorder',
149
+						'CW' => 'Continuous Wave',
150
+						'CWY' => 'Clearway',
151
+						'DA' => 'Decision Altitude',
152
+						'DCKG' => 'Docking',
153
+						'DCP' => 'Datum Crossing Point',
154
+						'DCPC' => 'Direct Controller-pilot Communications',
155
+						'DCT' => 'Direct',
156
+						'DEC' => 'December',
157
+						'DEG' => 'Degrees',
158
+						'DEP' => 'Departing',
159
+						'DES' => 'Descend',
160
+						'DEST' => 'Destination',
161
+						'DETRESFA' => 'Distress Phase',
162
+						'DEV' => 'Deviating',
163
+						'DFDR' => 'Digital Flight Data Recorder',
164
+						'DFTI' => 'Distance From Touchdown Indicator',
165
+						'DH' => 'Decision Height',
166
+						'DIP' => 'Diffuse',
167
+						'DIST' => 'Distance',
168
+						'DIV' => 'Divert',
169
+						'DLA' => 'Delay',
170
+						'DLY' => 'Daily',
171
+						'DME' => 'Distance measuring equipment',
172
+						'DNG' => 'Dangerous',
173
+						'DOM' => 'Domestic',
174
+						'DPT' => 'Depth',
175
+						'DR' => 'Dead Reckoning',
176
+						'DRG' => 'During',
177
+						'DTAM' => 'Descend To And Maintain',
178
+						'DTG' => 'Date-time Group',
179
+						'DTHR' => 'Displaced Runway Threshold',
180
+						'DTRT' => 'Deteriorating',
181
+						'DTW' => 'Dual Tandem Wheels',
182
+						'DUPE' => 'This Is A Duplicate Message',
183
+						'DUR' => 'Duration',
184
+						'DVOR' => 'Doppler VOR',
185
+						'DW' => 'Dual Wheels',
186
+						'EAT' => 'Expected Approach Time',
187
+						'EB' => 'Eastbound',
188
+						'EDA' => 'Elevation Differential Area',
189
+						'EET' => 'Estimated Elapsed Time',
190
+						'EFC' => 'Expect Further Clearance',
191
+						'ELBA' => 'Emergency Location Beacon',
192
+						'ELEV' => 'Elevation',
193
+						'ELR' => 'Extra Long Range',
194
+						'EM' => 'Emission',
195
+						'EMERG' => 'Emergency',
196
+						'END' => 'Stop-end',
197
+						'ENE' => 'East-north-east',
198
+						'ENG' => 'Engine',
199
+						'ENR' => 'En-route',
200
+						'ENRC' => 'En-route Chart',
201
+						'EOBT' => 'Estimated Off-block Time',
202
+						'EQPT' => 'Equipment',
203
+						'ER' => 'Here',
204
+						'ESE' => 'East-south-east',
205
+						'EST' => 'Estimate',
206
+						'ETA' => 'Estimated Time Of Arrival',
207
+						'ETD' => 'Estimated Time Of Departure',
208
+						'ETO' => 'Estimated Time Over Significant Point',
209
+						'EV' => 'Every',
210
+						'EXC' => 'Except',
211
+						'EXER' => 'Exercise',
212
+						'EXP' => 'Expect',
213
+						'EXTD' => 'Extend',
214
+						'FAC' => 'Facilities',
215
+						'FAF' => 'Final Approach Fix',
216
+						'FAL' => 'Facilitation of International Airtransport',
217
+						'FAP' => 'Final Approach Point',
218
+						'FATO' => 'Final Approach And Take-off Area',
219
+						'FAX' => 'Fax',
220
+						'FBL' => 'Light',
221
+						'FCST' => 'Forecast',
222
+						'FCT' => 'Friction Coefficient',
223
+						'FDPS' => 'Flight Data Processing System',
224
+						'FEB' => 'February',
225
+						'FIR' => 'Flight information region',
226
+						'FIS' => 'Flight information service',
227
+						'FLD' => 'Field',
228
+						'FLG' => 'Flashing',
229
+						'FLR' => 'Flares',
230
+						'FLT' => 'Flight',
231
+						'FLTS' => 'Flights',
232
+						'FLTCK' => 'Flight Check',
233
+						'FLUC' => 'Fluctuating',
234
+						'FLW' => 'Follow(s)',
235
+						'FLY' => 'Fly',
236
+						'FM' => 'From',
237
+						'FMS' => 'Flight Management System',
238
+						'FMU' => 'Flow Management Unit',
239
+						'FNA' => 'Final Approach',
240
+						'FPAP' => 'Flight Path Alignment Point',
241
+						'FPL' => 'Flight Plan',
242
+						'FPLS' => 'Flight Plans',
243
+						'FPM' => 'Feet Per Minute',
244
+						'FPR' => 'Flight Plan Route',
245
+						'FR' => 'Fuel Remaining',
246
+						'FREQ' => 'Frequency',
247
+						'FRI' => 'Friday',
248
+						'FRMG' => 'Missile, gun or rocket firing',
249
+						'FRNG' => 'Firing',
250
+						'FRONT' => 'Front',
251
+						'FRQ' => 'Frequent',
252
+						'FSL' => 'Full Stop Landing',
253
+						'FSS' => 'Flight Service Station',
254
+						'FST' => 'First',
255
+						'FTP' => 'Fictitious Threshold Point',
256
+						'G/A' => 'Ground-to-air',
257
+						'G/A/G' => 'Ground-to-air and Air-to-ground',
258
+						'GARP' => 'GBAS Azimuth Reference Point',
259
+						'GBAS' => 'Ground-based Augmentation System',
260
+						'GCAJ' => 'Ground Controlled Approach',
261
+						'GCA' => 'Ground Controlled Approach System',
262
+						'GEN' => 'General',
263
+						'GEO' => 'Geographic or True',
264
+						'GES' => 'Ground Earth Station',
265
+						'GLD' => 'Glider',
266
+						'GMC' => 'Ground Movement Chart',
267
+						'GND' => 'Ground',
268
+						'GNDCK' => 'Ground Check',
269
+						'GP' => 'Glide Path',
270
+						'GRASS' => 'Grass landing area',
271
+						'GRVL' => 'Gravel',
272
+						'GUND' => 'Geoid Undulation',
273
+						'H24' => '24 Hours',
274
+						'HAPI' => 'Helicopter Approach Path Indicator',
275
+						'HBN' => 'Hazard Beacon',
276
+						'HDG' => 'Heading',
277
+						'HEL' => 'Helicopter',
278
+						'HGT' => 'Height',
279
+						'HJ' => 'Sunrise to Sunset',
280
+						'HLDG' => 'Holding',
281
+						'HN' => 'Sunset to Sunrise',
282
+						'HO' => 'Service Available To Meet Operational Requirements',
283
+						'HOL' => 'Holiday',
284
+						'HOSP' => 'Hospital Aircraft',
285
+						'HOT' => 'Height',
286
+						'HPA' => 'Hectopascal',
287
+						'HR' => 'Hours',
288
+						'HRS' => 'Hours',
289
+						'HS' => 'Service Available During Hours Of Scheduled Operations',
290
+						'HURCN' => 'Hurricane',
291
+						'HVY' => 'Heavy',
292
+						'HX' => 'No Specific Working Hours',
293
+						'HYR' => 'Higher',
294
+						'IAC' => 'Instrument Approach Chart',
295
+						'IAF' => 'Initial Approach Fix',
296
+						'IAO' => 'In And Out Of Clouds',
297
+						'IAP' => 'Instrument Approach Procedure',
298
+						'IAR' => 'Intersection Of Air Routes',
299
+						'IBN' => 'Identification Beacon',
300
+						'ID' => 'Identifier',
301
+						'IDENT' => 'Identification',
302
+						'IFF' => 'Identification Friend/Foe',
303
+						'IGA' => 'International General Aviation',
304
+						'IM' => 'Inner Marker',
305
+						'IMPR' => 'Improving',
306
+						'IMT' => 'Immediately',
307
+						'INA' => 'Initial Approach',
308
+						'INBD' => 'Inbound',
309
+						'INCERFA' => 'Uncertainty Phase',
310
+						'INFO' => 'Information',
311
+						'INOP' => 'Inoperative',
312
+						'INP' => 'If Not Possible',
313
+						'INPR' => 'In Progress',
314
+						'INSTL' => 'Installation',
315
+						'INSTR' => 'Instrument',
316
+						'INT' => 'Intersection',
317
+						'INTS' => 'Intersections',
318
+						'INTL' => 'International',
319
+						'INTRG' => 'Interrogator',
320
+						'INTRP' => 'Interruption',
321
+						'INTSF' => 'Intensifying',
322
+						'INTST' => 'Intensity',
323
+						'ISA' => 'International Standard Atmosphere',
324
+						'JAN' => 'January',
325
+						'JTST' => 'Jet stream',
326
+						'JUL' => 'July',
327
+						'JUN' => 'June',
328
+						'KMH' => 'Kilometres Per Hour',
329
+						'KPA' => 'Kilopascal',
330
+						'KT' => 'Knots',
331
+						'KW' => 'Kilowatts',
332
+						'LAN' => 'Inland',
333
+						'LAT' => 'Latitude',
334
+						'LDA' => 'Landing Distance Available',
335
+						'LDAH' => 'Landing Distance Available, Helicopter',
336
+						'LDG' => 'Landing',
337
+						'LDI' => 'Landing Direction Indicator',
338
+						'LEN' => 'Length',
339
+						'LGT' => 'Lighting',
340
+						'LGTD' => 'Lighted',
341
+						'LIH' => 'Light Intensity High',
342
+						'LIL' => 'Light Intensity Low',
343
+						'LIM' => 'Light Intensity Medium',
344
+						'LLZ' => 'Localizer',
345
+						'LM' => 'Locator, Middle',
346
+						'LMT' => 'Local Mean Time',
347
+						'LNG' => 'Long',
348
+						'LO' => 'Locator, Outer',
349
+						'LOG' => 'Located',
350
+						'LONG' => 'Longitude',
351
+						'LRG' => 'Long Range',
352
+						'LTD' => 'Limited',
353
+						'LTP' => 'Landing Threshold Point',
354
+						'LVE' => 'Leaving',
355
+						'LVL' => 'Level',
356
+						'LYR' => 'Layer',
357
+						'MAA' => 'Maximum Authorized Altitude',
358
+						'MAG' => 'Magnetic',
359
+						'MAINT' => 'Maintenance',
360
+						'MAP' => 'Aeronautical Maps and Charts',
361
+						'MAPT' => 'Missed Approach Point',
362
+						'MAR' => 'March',
363
+						'MAX' => 'Maximum',
364
+						'MAY' => 'May',
365
+						'MBST' => 'Microburst',
366
+						'MCA' => 'Minimum Crossing Altitude',
367
+						'MCW' => 'Modulated Continuous Wave',
368
+						'MDA' => 'Minimum Descent Altitude',
369
+						'MDH' => 'Minimum Descent Height',
370
+						'MEA' => 'Minimum En-route Altitude',
371
+						'MEHT' => 'Minimum Eye Height Over Threshold',
372
+						'MET' => 'Meteorological',
373
+						'MID' => 'Mid-point',
374
+						'MIL' => 'Military',
375
+						'MIN' => 'Minutes',
376
+						'MKR' => 'Marker Radio Beacon',
377
+						'MLS' => 'Microwave Landing System',
378
+						'MM' => 'Middle Marker',
379
+						'MNM' => 'Minimum',
380
+						'MNPS' => 'Minimum Navigation Performance Specifications',
381
+						'MNT' => 'Monitor',
382
+						'MNTN' => 'Maintain',
383
+						'MOA' => 'Military Operating Area',
384
+						'MOC' => 'Minimum Obstacle Clearance',
385
+						'MOD' => 'Moderate',
386
+						'MON' => 'Monday',
387
+						'MOPS' => 'Minimum Operational Performance Standards',
388
+						'MOV' => 'Movement',
389
+						'MRA' => 'Minimum Reception Altitude',
390
+						'MRG' => 'Medium Range',
391
+						'MRP' => 'ATS/MET Reporting Point',
392
+						'MS' => 'Minus',
393
+						'MSA' => 'Minimum Sector Altitude',
394
+						'MSAW' => 'Minimum Safe Altitude Warning',
395
+						'MSG' => 'Message',
396
+						'MSSR' => 'Monopulse Secondary Surveillance Radar',
397
+						'MT' => 'Mountain',
398
+						'MTU' => 'Metric Units',
399
+						'MTW' => 'Mountain Waves',
400
+						'NASC' => 'National AIS System Centre',
401
+						'NAT' => 'North Atlantic',
402
+						'NAV' => 'Navigation',
403
+						'NB' => 'Northbound',
404
+						'NBFR' => 'Not Before',
405
+						'NE' => 'North-east',
406
+						'NEB' => 'North-eastbound',
407
+						'NEG' => 'Negative',
408
+						'NGT' => 'Night',
409
+						'NIL' => 'None',
410
+						'NML' => 'Normal',
411
+						'NNE' => 'North-north-east',
412
+						'NNW' => 'North-north-west',
413
+						'NOF' => 'International NOTAM Office',
414
+						'NOV' => 'November',
415
+						'NOZ' => 'Normal Operating Zone',
416
+						'NR' => 'Number',
417
+						'NRH' => 'No Reply Heard',
418
+						'NTL' => 'National',
419
+						'NTZ' => 'No Transgression Zone',
420
+						'NW' => 'North-west',
421
+						'NWB' => 'North-westbound',
422
+						'NXT' => 'Next',
423
+						'O/R' => 'On Request',
424
+						'OAC' => 'Oceanic Area Control Centre',
425
+						'OAS' => 'Obstacle Assessment Surface',
426
+						'OBS' => 'Observe',
427
+						'OBST' => 'Obstacle',
428
+						'OBSTS' => 'Obstacles',
429
+						'OCA' => 'Oceanic Control Area',
430
+						'OCH' => 'Obstacle Clearance Height',
431
+						'OCL' => 'Obstacle Clearance Limit',
432
+						'OCS' => 'Obstacle Clearance Surface',
433
+						'OCT' => 'October',
434
+						'OFZ' => 'Obstacle Free Zone',
435
+						'OGN' => 'Originate',
436
+						'OHD' => 'Overhead',
437
+						'OM' => 'Outer Marker',
438
+						'OPC' => 'Control Indicated Is Operational Control',
439
+						'OPMET' => 'Operational Meteorological',
440
+						'OPN' => 'Open',
441
+						'OPR' => 'Operate',
442
+						'OPS' => 'Operations',
443
+						'ORD' => 'Order',
444
+						'OSV' => 'Ocean Station Vessel',
445
+						'OTLK' => 'Outlook',
446
+						'OTP' => 'On Top',
447
+						'OTS' => 'Organized Track System',
448
+						'OUBD' => 'Outbound',
449
+						'PA' => 'Precision Approach',
450
+						'PALS' => 'Precision Approach Lighting System',
451
+						'PANS' => 'Procedures for Air Navigation Services',
452
+						'PAR' => 'Precision Approach Radar',
453
+						'PARL' => 'Parallel',
454
+						'PATC' => 'Precision Approach Terrain Chart',
455
+						'PAX' => 'Passenger(s)',
456
+						'PCD' => 'Proceed',
457
+						'PCL' => 'Pilot-controlled Lighting',
458
+						'PCN' => 'Pavement Classification Number',
459
+						'PDC' => 'Pre-departure Clearance',
460
+						'PDG' => 'Procedure Design Gradient',
461
+						'PER' => 'Performance',
462
+						'PERM' => 'Permanent',
463
+						'PIB' => 'Pre-flight Information Bulletin',
464
+						'PJE' => 'Parachute Jumping Exercise',
465
+						'PLA' => 'Practice Low Approach',
466
+						'PLN' => 'Flight Plan',
467
+						'PLVL' => 'Present Level',
468
+						'PN' => 'Prior Notice Required',
469
+						'PNR' => 'Point Of No Return',
470
+						'POB' => 'Persons On Board',
471
+						'POSS' => 'Possible',
472
+						'PPI' => 'Plan Position Indicator',
473
+						'PPR' => 'Prior Permission Required',
474
+						'PPSN' => 'Present Position',
475
+						'PRI' => 'Primary',
476
+						'PRKG' => 'Parking',
477
+						'PROB' => 'Probability',
478
+						'PROC' => 'Procedure',
479
+						'PROV' => 'Provisional',
480
+						'PS' => 'Plus',
481
+						'PSG' => 'Passing',
482
+						'PSN' => 'Position',
483
+						'PSNS' => 'Positions',
484
+						'PSR' => 'Primary Surveillance Radar',
485
+						'PSYS' => 'Pressure System(s)',
486
+						'PTN' => 'Procedure Turn',
487
+						'PTS' => 'Polar Track Structure',
488
+						'PWR' => 'Power',
489
+						'QUAD' => 'Quadrant',
490
+						'RAC' => 'Rules of The Air and Air Traffic Services',
491
+						'RAG' => 'Runway Arresting Gear',
492
+						'RAI' => 'Runway Alignment Indicator',
493
+						'RASC' => 'Regional AIS System Centre',
494
+						'RASS' => 'Remote Altimeter Setting Source',
495
+						'RB' => 'Rescue Boat',
496
+						'RCA' => 'Reach Cruising Altitude',
497
+						'RCC' => 'Rescue Coordination Centre',
498
+						'RCF' => 'Radiocommunication Failure',
499
+						'RCH' => 'Reaching',
500
+						'RCL' => 'Runway Centre Line',
501
+						'RCLL' => 'Runway Centre Line Light(s)',
502
+						'RCLR' => 'Recleared',
503
+						'RDH' => 'Reference Datum Height',
504
+						'RDL' => 'Radial',
505
+						'RDO' => 'Radio',
506
+						'RE' => 'Recent',
507
+						'REC' => 'Receiver',
508
+						'REDL' => 'Runway Edge Light(s)',
509
+						'REF' => 'Refer To',
510
+						'REG' => 'Registration',
511
+						'RENL' => 'Runway End Light(s)',
512
+						'REP' => 'Report',
513
+						'REQ' => 'Requested',
514
+						'RERTE' => 'Re-route',
515
+						'RESA' => 'Runway End Safety Area',
516
+						'RG' => 'Range (lights)',
517
+						'RHC' => 'Right-hand Circuit',
518
+						'RIF' => 'Reclearance In Flight',
519
+						'RITE' => 'Right',
520
+						'RL' => 'Report Leaving',
521
+						'RLA' => 'Relay To',
522
+						'RLCE' => 'Request Level Change En Route',
523
+						'RLLS' => 'Runway Lead-in Lighting System',
524
+						'RLNA' => 'Request Level Not Available',
525
+						'RMAC' => 'Radar Minimum Altitude Chart',
526
+						'RMK' => 'Remark',
527
+						'RNG' => 'Radio Range',
528
+						'RNP' => 'Required Navigation Performance',
529
+						'ROC' => 'Rate Of Climb',
530
+						'ROD' => 'Rate Of Descent',
531
+						'ROFOR' => 'Route Forecast',
532
+						'RON' => 'Receiving Only',
533
+						'RPI' => 'Radar Position Indicator',
534
+						'RPL' => 'Repetitive Flight Plan',
535
+						'RPLC' => 'Replaced',
536
+						'RPS' => 'Radar Position Symbol',
537
+						'RQMNTS' => 'Requirements',
538
+						'RQP' => 'Request Flight Plan',
539
+						'RQS' => 'Request Supplementary Flight Plan',
540
+						'RR' => 'Report Reaching',
541
+						'RSC' => 'Rescue Sub-centre',
542
+						'RSCD' => 'Runway Surface Condition',
543
+						'RSP' => 'Responder Beacon',
544
+						'RSR' => 'En-route Surveillance Radar',
545
+						'RTE' => 'Route',
546
+						'RTES' => 'Routes',
547
+						'RTF' => 'Radiotelephone',
548
+						'RTG' => 'Radiotelegraph',
549
+						'RTHL' => 'Runway Threshold Light(s)',
550
+						'RTN' => 'Return',
551
+						'RTODAH' => 'Rejected Take-off Distance Available, Helicopter',
552
+						'RTS' => 'Return To Service',
553
+						'RTT' => 'Radioteletypewriter',
554
+						'RTZL' => 'Runway Touchdown Zone Light(s)',
555
+						'RUT' => 'Standard Regional Route Transmitting Frequencies',
556
+						'RV' => 'Rescue Vessel',
557
+						'RVSM' => 'Reduced Vertical Separation Minimum',
558
+						'RWY' => 'Runway',
559
+						'RWYS' => 'Runways',
560
+						'SALS' => 'Simple Approach Lighting System',
561
+						'SAN' => 'Sanitary',
562
+						'SAP' => 'As Soon As Possible',
563
+						'SAR' => 'Search and Rescue',
564
+						'SARPS' => 'Standards and Recommended Practices',
565
+						'SAT' => 'Saturday',
566
+						'SATCOM' => 'Satellite Communication',
567
+						'SB' => 'Southbound',
568
+						'SBAS' => 'Satellite-based Augmentation System',
569
+						'SDBY' => 'Stand by',
570
+						'SE' => 'South-east',
571
+						'SEA' => 'Sea',
572
+						'SEB' => 'South-eastbound',
573
+						'SEC' => 'Seconds',
574
+						'SECN' => 'Section',
575
+						'SECT' => 'Sector',
576
+						'SELCAL' => 'Selective calling system',
577
+						'SEP' => 'September',
578
+						'SER' => 'Service',
579
+						'SEV' => 'Severe',
580
+						'SFC' => 'Surface',
581
+						'SGL' => 'Signal',
582
+						'SID' => 'Standard Instrument Departure',
583
+						'SIF' => 'Selective Identification Feature',
584
+						'SIG' => 'Significant',
585
+						'SIMUL' => 'Simultaneous',
586
+						'SKED' => 'Schedule',
587
+						'SLP' => 'Speed Limiting Point',
588
+						'SLW' => 'Slow',
589
+						'SMC' => 'Surface Movement Control',
590
+						'SMR' => 'Surface Movement Radar',
591
+						'SPL' => 'Supplementary Flight Plan',
592
+						'SPOC' => 'SAR Point Of Contact',
593
+						'SPOT' => 'Spot Wind',
594
+						'SR' => 'Sunrise',
595
+						'SRA' => 'Surveillance Radar Approach',
596
+						'SRE' => 'Surveillance Radar Element Of Precision Approach Radar System',
597
+						'SRG' => 'Short Range',
598
+						'SRR' => 'Search and Rescue Region',
599
+						'SRY' => 'Secondary',
600
+						'SS' => 'Sunset',
601
+						'SSE' => 'South-south-east',
602
+						'SSR' => 'Secondary Surveillance Radar',
603
+						'SST' => 'Supersonic Transport',
604
+						'SSW' => 'South-south-west',
605
+						'STA' => 'Straight-in Approach',
606
+						'STAR' => 'Standard Instrument Arrival',
607
+						'STD' => 'Standard',
608
+						'STN' => 'Station',
609
+						'STNR' => 'Stationary',
610
+						'STOL' => 'Short Take-off and Landing',
611
+						'STS' => 'Status',
612
+						'STWL' => 'Stopway Light(s)',
613
+						'SUBJ' => 'Subject To',
614
+						'SUN' => 'Sunday',
615
+						'SUP' => 'Supplement',
616
+						'SUPPS' => 'Regional Supplementary Procedures Service Message',
617
+						'SVCBL' => 'Serviceable',
618
+						'SW' => 'South-west',
619
+						'SWB' => 'South-westbound',
620
+						'SWY' => 'Stopway',
621
+						'TA' => 'Transition Altitude',
622
+						'TAA' => 'Terminal Arrival Altitude',
623
+						'TAF' => 'Aerodrome Forecast',
624
+						'TAIL' => 'Tail Wind',
625
+						'TAR' => 'Terminal Area Surveillance Radar',
626
+						'TAX' => 'Taxi',
627
+						'TCAC' => 'Tropical Cyclone Advisory Centre',
628
+						'TDO' => 'Tornado',
629
+						'TDZ' => 'Touchdown Zone',
630
+						'TECR' => 'Technical Reason',
631
+						'TEMPO' => 'Temporarily',
632
+						'TFC' => 'Traffic',
633
+						'TGL' => 'Touch-and-go',
634
+						'TGS' => 'Taxiing Guidance System',
635
+						'THR' => 'Threshold',
636
+						'THRU' => 'Through',
637
+						'THU' => 'Thursday',
638
+						'TIBA' => 'Traffic Information Broadcast By Aircraft',
639
+						'TIL' => 'Until',
640
+						'TIP' => 'Until Past',
641
+						'TKOF' => 'Take-off',
642
+						'TL' => 'Till',
643
+						'TLOF' => 'Touchdown And Lift-off Area',
644
+						'TMA' => 'Terminal Control Area',
645
+						'TNA' => 'Turn Altitude',
646
+						'TNH' => 'Turn Height',
647
+						'TOC' => 'Top of Climb',
648
+						'TODA' => 'Take-off Distance Available',
649
+						'TODAH' => 'Take-off Distance Available, Helicopter',
650
+						'TORA' => 'Take-off Run Available',
651
+						'TP' => 'Turning Point',
652
+						'TR' => 'Track',
653
+						'TRA' => 'Temporary Reserved Airspace',
654
+						'TRANS' => 'Transmitter',
655
+						'TRL' => 'Transition Level',
656
+						'TUE' => 'Tuesday',
657
+						'TURB' => 'Turbulence',
658
+						'TVOR' => 'Terminal VOR',
659
+						'TWR' => 'Tower',
660
+						'TWY' => 'Taxiway',
661
+						'TWYL' => 'Taxiway-link',
662
+						'TXT' => 'Text',
663
+						'TYP' => 'Type of Aircraft',
664
+						'U/S' => 'Unserviceable',
665
+						'UAB' => 'Until Advised By',
666
+						'UAC' => 'Upper Area Control Centre',
667
+						'UAR' => 'Upper Air Route',
668
+						'UDA' => 'Upper advisory area',
669
+						'UFN' => 'Until Further Notice',
670
+						'UHDT' => 'Unable Higher Due Traffic',
671
+						'UIC' => 'Upper Information Centre',
672
+						'UIR' => 'Upper Flight Information Region',
673
+						'ULR' => 'Ultra Long Range',
674
+						'UNA' => 'Unable',
675
+						'UNAP' => 'Unable To Approve',
676
+						'UNL' => 'Unlimited',
677
+						'UNREL' => 'Unreliable',
678
+						'UTA' => 'Upper Control Area',
679
+						'VAAC' => 'Volcanic Ash Advisory Centre',
680
+						'VAC' => 'Visual Approach Chart',
681
+						'VAL' => 'In Valleys',
682
+						'VAN' => 'Runway Control Van',
683
+						'VAR' => 'Visual-aural Radio Range',
684
+						'VC' => 'Vicinity',
685
+						'VCY' => 'Vicinity',
686
+						'VER' => 'Vertical',
687
+						'VIS' => 'Visibility',
688
+						'VLR' => 'Very Long Range',
689
+						'VPA' => 'Vertical Path Angle',
690
+						'VRB' => 'Variable',
691
+						'VSA' => 'By Visual Reference To The Ground',
692
+						'VSP' => 'Vertical Speed',
693
+						'VTOL' => 'Vertical Take-off And Landing',
694
+						'WAC' => 'World Aeronautical Chart',
695
+						'WAFC' => 'World Area Forecast Centre',
696
+						'WB' => 'Westbound',
697
+						'WBAR' => 'Wing Bar Lights',
698
+						'WDI' => 'Wind Direction Indicator',
699
+						'WDSPR' => 'Widespread',
700
+						'WED' => 'Wednesday',
701
+						'WEF' => 'Effective From',
702
+						'WI' => 'Within',
703
+						'WID' => 'Width',
704
+						'WIE' => 'Effective Immediately',
705
+						'WILCO' => 'Will Comply',
706
+						'WIND' => 'Wind',
707
+						'WINTEM' => 'Forecast Upper Wind And Temperature For Aviation',
708
+						'WIP' => 'Work In Progress',
709
+						'WKN' => 'Weaken',
710
+						'WNW' => 'West-north-west',
711
+						'WO' => 'Without',
712
+						'WPT' => 'Way-point',
713
+						'WRNG' => 'Warning',
714
+						'WSW' => 'West-south-west',
715
+						'WT' => 'Weight',
716
+						'WWW' => 'Worldwide Web',
717
+						'WX' => 'Weather',
718
+						'XBAR' => 'Crossbar',
719
+						'XNG' => 'Crossing',
720
+						'XS' => 'Atmospherics',
721
+						'YCZ' => 'Yellow Caution Zone',
722
+						'YR' => 'Your');
723 723
 	public $code_airspace = array(
724
-			    'AA' => 'Minimum altitude',
725
-			    'AC' => 'Class B, C, D, or E Surface Area',
726
-			    'AD' => 'Air defense identification zone',
727
-			    'AE' => 'Control area',
728
-			    'AF' => 'Flight information region',
729
-			    'AH' => 'Upper control area',
730
-			    'AL' => 'Minimum usable flight level',
731
-			    'AN' => 'Area navigation route',
732
-			    'AO' => 'Oceanic control area',
733
-			    'AP' => 'Reporting point',
734
-			    'AR' => 'ATS route',
735
-			    'AT' => 'Class B Airspace',
736
-			    'AU' => 'Upper flight information region',
737
-			    'AV' => 'Upper advisory area',
738
-			    'AX' => 'Intersection',
739
-			    'AZ' => 'Aerodrome traffic zone');
724
+				'AA' => 'Minimum altitude',
725
+				'AC' => 'Class B, C, D, or E Surface Area',
726
+				'AD' => 'Air defense identification zone',
727
+				'AE' => 'Control area',
728
+				'AF' => 'Flight information region',
729
+				'AH' => 'Upper control area',
730
+				'AL' => 'Minimum usable flight level',
731
+				'AN' => 'Area navigation route',
732
+				'AO' => 'Oceanic control area',
733
+				'AP' => 'Reporting point',
734
+				'AR' => 'ATS route',
735
+				'AT' => 'Class B Airspace',
736
+				'AU' => 'Upper flight information region',
737
+				'AV' => 'Upper advisory area',
738
+				'AX' => 'Intersection',
739
+				'AZ' => 'Aerodrome traffic zone');
740 740
 	public $code_comradar = array(
741
-			    'CA' => 'Air/ground',
742
-			    'CE' => 'En route surveillance radar',
743
-			    'CG' => 'Ground controlled approach system',
744
-			    'CL' => 'Selective calling system',
745
-			    'CM' => 'Surface movement radar',
746
-			    'CP' => 'Precision approach radar',
747
-			    'CR' => 'Surveillance radar element of precision approach radar system',
748
-			    'CS' => 'Secondary surveillance radar',
749
-			    'CT' => 'Terminal area surveillance radar');
741
+				'CA' => 'Air/ground',
742
+				'CE' => 'En route surveillance radar',
743
+				'CG' => 'Ground controlled approach system',
744
+				'CL' => 'Selective calling system',
745
+				'CM' => 'Surface movement radar',
746
+				'CP' => 'Precision approach radar',
747
+				'CR' => 'Surveillance radar element of precision approach radar system',
748
+				'CS' => 'Secondary surveillance radar',
749
+				'CT' => 'Terminal area surveillance radar');
750 750
 	public $code_facilities = array(
751
-			    'FA' => 'airport',
752
-			    'FB' => 'Braking action measurement equipment',
753
-			    'FC' => 'Ceiling measurement equipment',
754
-			    'FD' => 'Docking system',
755
-			    'FF' => 'Fire fighting and rescue',
756
-			    'FG' => 'Ground movement control',
757
-			    'FH' => 'Helicopter alighting area/platform',
758
-			    'FL' => 'Landing direction indicator',
759
-			    'FM' => 'Meteorological service',
760
-			    'FO' => 'Fog dispersal system',
761
-			    'FP' => 'Heliport',
762
-			    'FS' => 'Snow removal equipment',
763
-			    'FT' => 'Transmissometer',
764
-			    'FU' => 'Fuel availability',
765
-			    'FW' => 'Wind direction indicator',
766
-			    'FZ' => 'Customs');
751
+				'FA' => 'airport',
752
+				'FB' => 'Braking action measurement equipment',
753
+				'FC' => 'Ceiling measurement equipment',
754
+				'FD' => 'Docking system',
755
+				'FF' => 'Fire fighting and rescue',
756
+				'FG' => 'Ground movement control',
757
+				'FH' => 'Helicopter alighting area/platform',
758
+				'FL' => 'Landing direction indicator',
759
+				'FM' => 'Meteorological service',
760
+				'FO' => 'Fog dispersal system',
761
+				'FP' => 'Heliport',
762
+				'FS' => 'Snow removal equipment',
763
+				'FT' => 'Transmissometer',
764
+				'FU' => 'Fuel availability',
765
+				'FW' => 'Wind direction indicator',
766
+				'FZ' => 'Customs');
767 767
 	public $code_instrumentlanding = array(
768
-			    'ID' => 'DME associated with ILS',
769
-			    'IG' => 'Glide path',
770
-			    'II' => 'Inner marker',
771
-			    'IL' => 'Localizer',
772
-			    'IM' => 'Middle marker',
773
-			    'IO' => 'Outer marker',
774
-			    'IS' => 'ILS Category I',
775
-			    'IT' => 'ILS Category II',
776
-			    'IU' => 'ILS Category III',
777
-			    'IW' => 'Microwave landing system',
778
-			    'IX' => 'Locator, outer',
779
-			    'IY' => 'Locator, middle');
768
+				'ID' => 'DME associated with ILS',
769
+				'IG' => 'Glide path',
770
+				'II' => 'Inner marker',
771
+				'IL' => 'Localizer',
772
+				'IM' => 'Middle marker',
773
+				'IO' => 'Outer marker',
774
+				'IS' => 'ILS Category I',
775
+				'IT' => 'ILS Category II',
776
+				'IU' => 'ILS Category III',
777
+				'IW' => 'Microwave landing system',
778
+				'IX' => 'Locator, outer',
779
+				'IY' => 'Locator, middle');
780 780
 	public $code_lightingfacilities = array(
781
-			    'LA' => 'Approach lighting system',
782
-			    'LB' => 'Airport beacon',
783
-			    'LC' => 'Runway center line lights',
784
-			    'LD' => 'Landing direction indicator lights',
785
-			    'LE' => 'Runway edge lights',
786
-			    'LF' => 'Sequenced flashing lights',
787
-			    'LH' => 'High intensity runway lights',
788
-			    'LI' => 'Runway end identifier lights',
789
-			    'LK' => 'Category II components of approach lighting system',
790
-			    'LL' => 'Low intensity runway lights',
791
-			    'LM' => 'Medium intensity runway lights',
792
-			    'LP' => 'Precision approach path indicator',
793
-			    'LR' => 'All landing area lighting facilities',
794
-			    'LS' => 'Stopway lights',
795
-			    'LT' => 'Threshold lights',
796
-			    'LV' => 'Visual approach slope indicator system',
797
-			    'LW' => 'Heliport lighting',
798
-			    'LX' => 'Taxiway center line lights',
799
-			    'LY' => 'Taxiway edge lights',
800
-			    'LZ' => 'Runway touchdown zone lights');
781
+				'LA' => 'Approach lighting system',
782
+				'LB' => 'Airport beacon',
783
+				'LC' => 'Runway center line lights',
784
+				'LD' => 'Landing direction indicator lights',
785
+				'LE' => 'Runway edge lights',
786
+				'LF' => 'Sequenced flashing lights',
787
+				'LH' => 'High intensity runway lights',
788
+				'LI' => 'Runway end identifier lights',
789
+				'LK' => 'Category II components of approach lighting system',
790
+				'LL' => 'Low intensity runway lights',
791
+				'LM' => 'Medium intensity runway lights',
792
+				'LP' => 'Precision approach path indicator',
793
+				'LR' => 'All landing area lighting facilities',
794
+				'LS' => 'Stopway lights',
795
+				'LT' => 'Threshold lights',
796
+				'LV' => 'Visual approach slope indicator system',
797
+				'LW' => 'Heliport lighting',
798
+				'LX' => 'Taxiway center line lights',
799
+				'LY' => 'Taxiway edge lights',
800
+				'LZ' => 'Runway touchdown zone lights');
801 801
 	public $code_movementareas = array(
802
-			    'MA' => 'Movement area',
803
-			    'MB' => 'Bearing strength',
804
-			    'MC' => 'Clearway',
805
-			    'MD' => 'Declared distances',
806
-			    'MG' => 'Taxiing guidance system',
807
-			    'MH' => 'Runway arresting gear',
808
-			    'MK' => 'Parking area',
809
-			    'MM' => 'Daylight markings',
810
-			    'MN' => 'Apron',
811
-			    'MP' => 'Aircraft stands',
812
-			    'MR' => 'Runway',
813
-			    'MS' => 'Stopway',
814
-			    'MT' => 'Threshold',
815
-			    'MU' => 'Runway turning bay',
816
-			    'MW' => 'Strip',
817
-			    'MX' => 'Taxiway');
802
+				'MA' => 'Movement area',
803
+				'MB' => 'Bearing strength',
804
+				'MC' => 'Clearway',
805
+				'MD' => 'Declared distances',
806
+				'MG' => 'Taxiing guidance system',
807
+				'MH' => 'Runway arresting gear',
808
+				'MK' => 'Parking area',
809
+				'MM' => 'Daylight markings',
810
+				'MN' => 'Apron',
811
+				'MP' => 'Aircraft stands',
812
+				'MR' => 'Runway',
813
+				'MS' => 'Stopway',
814
+				'MT' => 'Threshold',
815
+				'MU' => 'Runway turning bay',
816
+				'MW' => 'Strip',
817
+				'MX' => 'Taxiway');
818 818
 	public $code_terminalfacilities = array(
819
-			    'NA' => 'All radio navigation facilities',
820
-			    'NB' => 'Non directional beacon',
821
-			    'NC' => 'DECCA',
822
-			    'ND' => 'Distance measuring equipment',
823
-			    'NF' => 'Fan marker',
824
-			    'NL' => 'Locator',
825
-			    'NM' => 'VOR/DME',
826
-			    'NN' => 'TACAN',
827
-			    'NO' => 'OMEGA',
828
-			    'NT' => 'VORTAC',
829
-			    'NV' => 'VOR',
830
-			    'NX' => 'Direction finding station');
819
+				'NA' => 'All radio navigation facilities',
820
+				'NB' => 'Non directional beacon',
821
+				'NC' => 'DECCA',
822
+				'ND' => 'Distance measuring equipment',
823
+				'NF' => 'Fan marker',
824
+				'NL' => 'Locator',
825
+				'NM' => 'VOR/DME',
826
+				'NN' => 'TACAN',
827
+				'NO' => 'OMEGA',
828
+				'NT' => 'VORTAC',
829
+				'NV' => 'VOR',
830
+				'NX' => 'Direction finding station');
831 831
 	public $code_information = array(
832
-			    'OA' => 'Aeronautical information service',
833
-			    'OB' => 'Obstacle',
834
-			    'OE' => 'Aircraft entry requirements',
835
-			    'OL' => 'Obstacle lights on',
836
-			    'OR' => 'Rescue coordination centre');
832
+				'OA' => 'Aeronautical information service',
833
+				'OB' => 'Obstacle',
834
+				'OE' => 'Aircraft entry requirements',
835
+				'OL' => 'Obstacle lights on',
836
+				'OR' => 'Rescue coordination centre');
837 837
 	public $code_airtraffic = array(
838
-			    'PA' => 'Standard instrument arrival',
839
-			    'PD' => 'Standard instrument departure',
840
-			    'PF' => 'Flow control procedure',
841
-			    'PH' => 'Holding procedure',
842
-			    'PI' => 'Instrument approach procedure',
843
-			    'PL' => 'Obstacle clearance limit',
844
-			    'PM' => 'Aerodrome operating minima',
845
-			    'PO' => 'Obstacle clearance altitude',
846
-			    'PP' => 'Obstacle clearance height',
847
-			    'PR' => 'Radio failure procedure',
848
-			    'PT' => 'Transition altitude',
849
-			    'PU' => 'Missed approach procedure',
850
-			    'PX' => 'Minimum holding altitude',
851
-			    'PZ' => 'ADIZ procedure');
838
+				'PA' => 'Standard instrument arrival',
839
+				'PD' => 'Standard instrument departure',
840
+				'PF' => 'Flow control procedure',
841
+				'PH' => 'Holding procedure',
842
+				'PI' => 'Instrument approach procedure',
843
+				'PL' => 'Obstacle clearance limit',
844
+				'PM' => 'Aerodrome operating minima',
845
+				'PO' => 'Obstacle clearance altitude',
846
+				'PP' => 'Obstacle clearance height',
847
+				'PR' => 'Radio failure procedure',
848
+				'PT' => 'Transition altitude',
849
+				'PU' => 'Missed approach procedure',
850
+				'PX' => 'Minimum holding altitude',
851
+				'PZ' => 'ADIZ procedure');
852 852
 	public $code_navigationw = array(
853
-			    'RA' => 'Airspace reservation',
854
-			    'RD' => 'Danger area',
855
-			    'RO' => 'Overflying of',
856
-			    'RP' => 'Prohibited area',
857
-			    'RR' => 'Restricted area',
858
-			    'RT' => 'Temporary restricted area');
853
+				'RA' => 'Airspace reservation',
854
+				'RD' => 'Danger area',
855
+				'RO' => 'Overflying of',
856
+				'RP' => 'Prohibited area',
857
+				'RR' => 'Restricted area',
858
+				'RT' => 'Temporary restricted area');
859 859
 	public $code_volmet = array(
860
-			    'SA' => 'Automatic terminal information service',
861
-			    'SB' => 'ATS reporting office',
862
-			    'SC' => 'Area control center',
863
-			    'SE' => 'Flight information service',
864
-			    'SF' => 'Airport flight information service',
865
-			    'SL' => 'Flow control centre',
866
-			    'SO' => 'Oceanic area control centre',
867
-			    'SP' => 'Approach control service',
868
-			    'SS' => 'Flight service station',
869
-			    'ST' => 'Airport control tower',
870
-			    'SU' => 'Upper area control centre',
871
-			    'SV' => 'VOLMET broadcast',
872
-			    'SY' => 'Upper advisory service');
860
+				'SA' => 'Automatic terminal information service',
861
+				'SB' => 'ATS reporting office',
862
+				'SC' => 'Area control center',
863
+				'SE' => 'Flight information service',
864
+				'SF' => 'Airport flight information service',
865
+				'SL' => 'Flow control centre',
866
+				'SO' => 'Oceanic area control centre',
867
+				'SP' => 'Approach control service',
868
+				'SS' => 'Flight service station',
869
+				'ST' => 'Airport control tower',
870
+				'SU' => 'Upper area control centre',
871
+				'SV' => 'VOLMET broadcast',
872
+				'SY' => 'Upper advisory service');
873 873
 	public $code_warnings = array(
874
-			    'WA' => 'Air display',
875
-			    'WB' => 'Aerobatics',
876
-			    'WC' => 'Captive balloon or kite',
877
-			    'WD' => 'Demolition of explosives',
878
-			    'WE' => 'Exercises',
879
-			    'WF' => 'Air refueling',
880
-			    'WG' => 'Glider flying',
881
-			    'WJ' => 'Banner/target towing',
882
-			    'WL' => 'Ascent of free balloon',
883
-			    'WM' => 'Missile, gun or rocket firing',
884
-			    'WP' => 'Parachute jumping exercise',
885
-			    'WS' => 'Burning or blowing gas',
886
-			    'WT' => 'Mass movement of aircraft',
887
-			    'WV' => 'Formation flight',
888
-			    'WZ' => 'model flying');
874
+				'WA' => 'Air display',
875
+				'WB' => 'Aerobatics',
876
+				'WC' => 'Captive balloon or kite',
877
+				'WD' => 'Demolition of explosives',
878
+				'WE' => 'Exercises',
879
+				'WF' => 'Air refueling',
880
+				'WG' => 'Glider flying',
881
+				'WJ' => 'Banner/target towing',
882
+				'WL' => 'Ascent of free balloon',
883
+				'WM' => 'Missile, gun or rocket firing',
884
+				'WP' => 'Parachute jumping exercise',
885
+				'WS' => 'Burning or blowing gas',
886
+				'WT' => 'Mass movement of aircraft',
887
+				'WV' => 'Formation flight',
888
+				'WZ' => 'model flying');
889 889
 	public $code_sp_availabity = array(
890
-			    'AC' => 'Withdrawn for maintenance',
891
-			    'AD' => 'Available for daylight operation',
892
-			    'AF' => 'Flight checked and found reliable',
893
-			    'AG' => 'Operating but ground checked only, awaiting flight check',
894
-			    'AH' => 'Hours of service are now',
895
-			    'AK' => 'Resumed normal operations',
896
-			    'AM' => 'Military operations only',
897
-			    'AN' => 'Available for night operation',
898
-			    'AO' => 'Operational',
899
-			    'AP' => 'Available, prior permission required',
900
-			    'AR' => 'Available on request',
901
-			    'AS' => 'Unserviceable',
902
-			    'AU' => 'Not available',
903
-			    'AW' => 'Completely withdrawn',
904
-			    'AX' => 'Previously promulgated shutdown has been cancelled');
890
+				'AC' => 'Withdrawn for maintenance',
891
+				'AD' => 'Available for daylight operation',
892
+				'AF' => 'Flight checked and found reliable',
893
+				'AG' => 'Operating but ground checked only, awaiting flight check',
894
+				'AH' => 'Hours of service are now',
895
+				'AK' => 'Resumed normal operations',
896
+				'AM' => 'Military operations only',
897
+				'AN' => 'Available for night operation',
898
+				'AO' => 'Operational',
899
+				'AP' => 'Available, prior permission required',
900
+				'AR' => 'Available on request',
901
+				'AS' => 'Unserviceable',
902
+				'AU' => 'Not available',
903
+				'AW' => 'Completely withdrawn',
904
+				'AX' => 'Previously promulgated shutdown has been cancelled');
905 905
 	public $code_sp_changes = array(
906
-			    'CA' => 'Activated',
907
-			    'CC' => 'Completed',
908
-			    'CD' => 'Deactivated',
909
-			    'CE' => 'Erected',
910
-			    'CF' => 'Operating frequency(ies) changed to',
911
-			    'CG' => 'Downgraded to',
912
-			    'CH' => 'Changed',
913
-			    'CI' => 'dentification or radio call sign changed to',
914
-			    'CL' => 'Realigned',
915
-			    'CM' => 'Displaced',
916
-			    'CO' => 'Operating',
917
-			    'CP' => 'Operating on reduced power',
918
-			    'CR' => 'Temporarily replaced by',
919
-			    'CS' => 'Installed',
920
-			    'CT' => 'On test, do not use');
906
+				'CA' => 'Activated',
907
+				'CC' => 'Completed',
908
+				'CD' => 'Deactivated',
909
+				'CE' => 'Erected',
910
+				'CF' => 'Operating frequency(ies) changed to',
911
+				'CG' => 'Downgraded to',
912
+				'CH' => 'Changed',
913
+				'CI' => 'dentification or radio call sign changed to',
914
+				'CL' => 'Realigned',
915
+				'CM' => 'Displaced',
916
+				'CO' => 'Operating',
917
+				'CP' => 'Operating on reduced power',
918
+				'CR' => 'Temporarily replaced by',
919
+				'CS' => 'Installed',
920
+				'CT' => 'On test, do not use');
921 921
 	public $code_sp_hazardous = array(
922
-			    'HA' => 'Braking action is',
923
-			    'HB' => 'Braking coefficient is',
924
-			    'HC' => 'Covered by compacted snow to depth of x Ft',
925
-			    'HD' => 'Covered by dry snow to a depth of x Ft',
926
-			    'HE' => 'Covered by water to a depth of x Ft',
927
-			    'HF' => 'Totally free of snow and ice',
928
-			    'HG' => 'Grass cutting in progress',
929
-			    'HH' => 'Hazard due to',
930
-			    'HI' => 'Covered by ice',
931
-			    'HJ' => 'Launch planned',
932
-			    'HK' => 'Migration in progress',
933
-			    'HL' => 'Snow clearance completed',
934
-			    'HM' => 'Marked by',
935
-			    'HN' => 'Covered by wet snow or slush to a depth of x Ft',
936
-			    'HO' => 'Obscured by snow',
937
-			    'HP' => 'Snow clearance in progress',
938
-			    'HQ' => 'Operation cancelled',
939
-			    'HR' => 'Standing water',
940
-			    'HS' => 'Sanding in progress',
941
-			    'HT' => 'Approach according to signal area only',
942
-			    'HU' => 'Launch in progress',
943
-			    'HV' => 'Work completed',
944
-			    'HW' => 'Work in progress',
945
-			    'HX' => 'Concentration of birds',
946
-			    'HY' => 'Snow banks exist',
947
-			    'HZ' => 'Covered by frozen ruts and ridges');
922
+				'HA' => 'Braking action is',
923
+				'HB' => 'Braking coefficient is',
924
+				'HC' => 'Covered by compacted snow to depth of x Ft',
925
+				'HD' => 'Covered by dry snow to a depth of x Ft',
926
+				'HE' => 'Covered by water to a depth of x Ft',
927
+				'HF' => 'Totally free of snow and ice',
928
+				'HG' => 'Grass cutting in progress',
929
+				'HH' => 'Hazard due to',
930
+				'HI' => 'Covered by ice',
931
+				'HJ' => 'Launch planned',
932
+				'HK' => 'Migration in progress',
933
+				'HL' => 'Snow clearance completed',
934
+				'HM' => 'Marked by',
935
+				'HN' => 'Covered by wet snow or slush to a depth of x Ft',
936
+				'HO' => 'Obscured by snow',
937
+				'HP' => 'Snow clearance in progress',
938
+				'HQ' => 'Operation cancelled',
939
+				'HR' => 'Standing water',
940
+				'HS' => 'Sanding in progress',
941
+				'HT' => 'Approach according to signal area only',
942
+				'HU' => 'Launch in progress',
943
+				'HV' => 'Work completed',
944
+				'HW' => 'Work in progress',
945
+				'HX' => 'Concentration of birds',
946
+				'HY' => 'Snow banks exist',
947
+				'HZ' => 'Covered by frozen ruts and ridges');
948 948
 	public $code_sp_limitations = array(
949
-			    'LA' => 'Operating on Auxiliary Power Supply',
950
-			    'LB' => 'Reserved for aircraft based therein',
951
-			    'LC' => 'Closed',
952
-			    'LD' => 'Unsafe',
953
-			    'LE' => 'Operated without auxiliary power supply',
954
-			    'LF' => 'Interference from',
955
-			    'LG' => 'Operating without identification',
956
-			    'LH' => 'Unserviceable for aircraft heavier than',
957
-			    'LI' => 'Close to IFR operations',
958
-			    'LK' => 'Operating as a fixed light',
959
-			    'LL' => 'Usable for lenght of... and width of...',
960
-			    'LN' => 'Close to all night operations',
961
-			    'LP' => 'Prohibited to',
962
-			    'LR' => 'Aircraft restricted to runways and taxiways',
963
-			    'LS' => 'Subject to interruption',
964
-			    'LT' => 'Limited to',
965
-			    'LV' => 'Close to VFR operations',
966
-			    'LW' => 'Will take place',
967
-			    'LX' => 'Operating but caution advised to'); 
949
+				'LA' => 'Operating on Auxiliary Power Supply',
950
+				'LB' => 'Reserved for aircraft based therein',
951
+				'LC' => 'Closed',
952
+				'LD' => 'Unsafe',
953
+				'LE' => 'Operated without auxiliary power supply',
954
+				'LF' => 'Interference from',
955
+				'LG' => 'Operating without identification',
956
+				'LH' => 'Unserviceable for aircraft heavier than',
957
+				'LI' => 'Close to IFR operations',
958
+				'LK' => 'Operating as a fixed light',
959
+				'LL' => 'Usable for lenght of... and width of...',
960
+				'LN' => 'Close to all night operations',
961
+				'LP' => 'Prohibited to',
962
+				'LR' => 'Aircraft restricted to runways and taxiways',
963
+				'LS' => 'Subject to interruption',
964
+				'LT' => 'Limited to',
965
+				'LV' => 'Close to VFR operations',
966
+				'LW' => 'Will take place',
967
+				'LX' => 'Operating but caution advised to'); 
968 968
 
969 969
 	public function __construct($dbc = null) {
970 970
 		$Connection = new Connection($dbc);
Please login to merge, or discard this patch.
Doc Comments   +14 added lines patch added patch discarded remove patch
@@ -1098,6 +1098,10 @@  discard block
 block discarded – undo
1098 1098
 		else return array();
1099 1099
 	}
1100 1100
 
1101
+	/**
1102
+	 * @param string $type
1103
+	 * @param string $rules
1104
+	 */
1101 1105
 	public function addNOTAM($ref,$title,$type,$fir,$code,$rules,$scope,$lower_limit,$upper_limit,$center_latitude,$center_longitude,$radius,$date_begin,$date_end,$permanent,$text,$full_notam) {
1102 1106
 		$query = "INSERT INTO notam (ref,title,notam_type,fir,code,rules,scope,lower_limit,upper_limit,center_latitude,center_longitude,radius,date_begin,date_end,permanent,notam_text,full_notam) VALUES (:ref,:title,:type,:fir,:code,:rules,:scope,:lower_limit,:upper_limit,:center_latitude,:center_longitude,:radius,:date_begin,:date_end,:permanent,:text,:full_notam)";
1103 1107
 		$query_values = array(':ref' => $ref,':title' => $title,':type' => $type,':fir' => $fir,':code' => $code,':rules' => $rules,':scope' => $scope,':lower_limit' => $lower_limit,':upper_limit' => $upper_limit,':center_latitude' => $center_latitude,':center_longitude' => $center_longitude,':radius' => $radius,':date_begin' => $date_begin,':date_end' => $date_end,':permanent' => $permanent,':text' => $text,':full_notam' => $full_notam);
@@ -1179,6 +1183,10 @@  discard block
 block discarded – undo
1179 1183
 			}
1180 1184
 		}
1181 1185
 	}
1186
+
1187
+	/**
1188
+	 * @param string $filename
1189
+	 */
1182 1190
 	public function updateNOTAMfromTextFile($filename) {
1183 1191
 		$alldata = $this->parseNOTAMtextFile($filename);
1184 1192
 		if (count($alldata) > 0) {
@@ -1223,6 +1231,9 @@  discard block
 block discarded – undo
1223 1231
 		}
1224 1232
 	}
1225 1233
 
1234
+	/**
1235
+	 * @param string $icao
1236
+	 */
1226 1237
 	public function downloadNOTAM($icao) {
1227 1238
 		date_default_timezone_set("UTC");
1228 1239
 		$Common = new Common();
@@ -1359,6 +1370,9 @@  discard block
 block discarded – undo
1359 1370
 		return $result;
1360 1371
 	}
1361 1372
 	
1373
+	/**
1374
+	 * @param string $code
1375
+	 */
1362 1376
 	public function parse_code($code) {
1363 1377
 		$code = str_split($code);
1364 1378
 		$code_fp = $code[1].$code[2];
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -982,19 +982,19 @@  discard block
 block discarded – undo
982 982
 		try {
983 983
 			$sth = $this->db->prepare($query);
984 984
 			$sth->execute($query_values);
985
-		} catch(PDOException $e) {
985
+		} catch (PDOException $e) {
986 986
 			echo "error : ".$e->getMessage();
987 987
 		}
988 988
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
989 989
 		return $all;
990 990
 	}
991 991
 	public function getAllNOTAMtext() {
992
-		$query  = 'SELECT full_notam FROM notam';
992
+		$query = 'SELECT full_notam FROM notam';
993 993
 		$query_values = array();
994 994
 		try {
995 995
 			$sth = $this->db->prepare($query);
996 996
 			$sth->execute($query_values);
997
-		} catch(PDOException $e) {
997
+		} catch (PDOException $e) {
998 998
 			echo "error : ".$e->getMessage();
999 999
 		}
1000 1000
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1003,13 +1003,13 @@  discard block
 block discarded – undo
1003 1003
 	public function createNOTAMtextFile($filename) {
1004 1004
 		$allnotam_result = $this->getAllNOTAMtext();
1005 1005
 		$notamtext = '';
1006
-		foreach($allnotam_result as $notam) {
1006
+		foreach ($allnotam_result as $notam) {
1007 1007
 			$notamtext .= '%%'."\n";
1008 1008
 			$notamtext .= $notam['full_notam'];
1009 1009
 			$notamtext .= "\n".'%%'."\n";
1010 1010
 		}
1011 1011
 		//$allnotam = implode('\n%%%%\n',$allnotam_result);
1012
-		file_put_contents($filename,$notamtext);
1012
+		file_put_contents($filename, $notamtext);
1013 1013
 	}
1014 1014
 	public function parseNOTAMtextFile($filename) {
1015 1015
 		$data = file_get_contents($filename);
@@ -1030,7 +1030,7 @@  discard block
 block discarded – undo
1030 1030
 		try {
1031 1031
 			$sth = $this->db->prepare($query);
1032 1032
 			$sth->execute($query_values);
1033
-		} catch(PDOException $e) {
1033
+		} catch (PDOException $e) {
1034 1034
 			echo "error : ".$e->getMessage();
1035 1035
 		}
1036 1036
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1039,10 +1039,10 @@  discard block
 block discarded – undo
1039 1039
 	public function getAllNOTAMbyCoord($coord) {
1040 1040
 		global $globalDBdriver;
1041 1041
 		if (is_array($coord)) {
1042
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1043
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1044
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1045
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1042
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1043
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1044
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1045
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1046 1046
 		} else return array();
1047 1047
 		if ($globalDBdriver == 'mysql') {
1048 1048
 			$query  = 'SELECT * FROM notam WHERE center_latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND center_longitude BETWEEN '.$minlong.' AND '.$maxlong.' AND radius > 0 AND date_end > UTC_TIMESTAMP() AND date_begin < UTC_TIMESTAMP()';
@@ -1054,19 +1054,19 @@  discard block
 block discarded – undo
1054 1054
 		try {
1055 1055
 			$sth = $this->db->prepare($query);
1056 1056
 			$sth->execute($query_values);
1057
-		} catch(PDOException $e) {
1057
+		} catch (PDOException $e) {
1058 1058
 			echo "error : ".$e->getMessage();
1059 1059
 		}
1060 1060
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1061 1061
 		return $all;
1062 1062
 	}
1063
-	public function getAllNOTAMbyCoordScope($coord,$scope) {
1063
+	public function getAllNOTAMbyCoordScope($coord, $scope) {
1064 1064
 		global $globalDBdriver;
1065 1065
 		if (is_array($coord)) {
1066
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1067
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1068
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1069
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1066
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1067
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1068
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1069
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1070 1070
 		} else return array();
1071 1071
 		if ($globalDBdriver == 'mysql') {
1072 1072
 			$query  = 'SELECT * FROM notam WHERE center_latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND center_longitude BETWEEN '.$minlong.' AND '.$maxlong.' AND radius > 0 AND date_end > UTC_TIMESTAMP() AND date_begin < UTC_TIMESTAMP() AND scope = :scope';
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
 		try {
1079 1079
 			$sth = $this->db->prepare($query);
1080 1080
 			$sth->execute($query_values);
1081
-		} catch(PDOException $e) {
1081
+		} catch (PDOException $e) {
1082 1082
 			echo "error : ".$e->getMessage();
1083 1083
 		}
1084 1084
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
 		try {
1091 1091
 			$sth = $this->db->prepare($query);
1092 1092
 			$sth->execute($query_values);
1093
-		} catch(PDOException $e) {
1093
+		} catch (PDOException $e) {
1094 1094
 			return "error : ".$e->getMessage();
1095 1095
 		}
1096 1096
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1098,13 +1098,13 @@  discard block
 block discarded – undo
1098 1098
 		else return array();
1099 1099
 	}
1100 1100
 
1101
-	public function addNOTAM($ref,$title,$type,$fir,$code,$rules,$scope,$lower_limit,$upper_limit,$center_latitude,$center_longitude,$radius,$date_begin,$date_end,$permanent,$text,$full_notam) {
1101
+	public function addNOTAM($ref, $title, $type, $fir, $code, $rules, $scope, $lower_limit, $upper_limit, $center_latitude, $center_longitude, $radius, $date_begin, $date_end, $permanent, $text, $full_notam) {
1102 1102
 		$query = "INSERT INTO notam (ref,title,notam_type,fir,code,rules,scope,lower_limit,upper_limit,center_latitude,center_longitude,radius,date_begin,date_end,permanent,notam_text,full_notam) VALUES (:ref,:title,:type,:fir,:code,:rules,:scope,:lower_limit,:upper_limit,:center_latitude,:center_longitude,:radius,:date_begin,:date_end,:permanent,:text,:full_notam)";
1103
-		$query_values = array(':ref' => $ref,':title' => $title,':type' => $type,':fir' => $fir,':code' => $code,':rules' => $rules,':scope' => $scope,':lower_limit' => $lower_limit,':upper_limit' => $upper_limit,':center_latitude' => $center_latitude,':center_longitude' => $center_longitude,':radius' => $radius,':date_begin' => $date_begin,':date_end' => $date_end,':permanent' => $permanent,':text' => $text,':full_notam' => $full_notam);
1103
+		$query_values = array(':ref' => $ref, ':title' => $title, ':type' => $type, ':fir' => $fir, ':code' => $code, ':rules' => $rules, ':scope' => $scope, ':lower_limit' => $lower_limit, ':upper_limit' => $upper_limit, ':center_latitude' => $center_latitude, ':center_longitude' => $center_longitude, ':radius' => $radius, ':date_begin' => $date_begin, ':date_end' => $date_end, ':permanent' => $permanent, ':text' => $text, ':full_notam' => $full_notam);
1104 1104
 		try {
1105 1105
 			$sth = $this->db->prepare($query);
1106 1106
 			$sth->execute($query_values);
1107
-		} catch(PDOException $e) {
1107
+		} catch (PDOException $e) {
1108 1108
 			return "error : ".$e->getMessage();
1109 1109
 		}
1110 1110
 	}
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
 		try {
1116 1116
 			$sth = $this->db->prepare($query);
1117 1117
 			$sth->execute($query_values);
1118
-		} catch(PDOException $e) {
1118
+		} catch (PDOException $e) {
1119 1119
 			return "error : ".$e->getMessage();
1120 1120
 		}
1121 1121
 	}
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
 		try {
1131 1131
 			$sth = $this->db->prepare($query);
1132 1132
 			$sth->execute($query_values);
1133
-		} catch(PDOException $e) {
1133
+		} catch (PDOException $e) {
1134 1134
 			return "error : ".$e->getMessage();
1135 1135
 		}
1136 1136
 	}
@@ -1140,7 +1140,7 @@  discard block
 block discarded – undo
1140 1140
 		try {
1141 1141
 			$sth = $this->db->prepare($query);
1142 1142
 			$sth->execute($query_values);
1143
-		} catch(PDOException $e) {
1143
+		} catch (PDOException $e) {
1144 1144
 			return "error : ".$e->getMessage();
1145 1145
 		}
1146 1146
 	}
@@ -1149,7 +1149,7 @@  discard block
 block discarded – undo
1149 1149
 		try {
1150 1150
 			$sth = $this->db->prepare($query);
1151 1151
 			$sth->execute();
1152
-		} catch(PDOException $e) {
1152
+		} catch (PDOException $e) {
1153 1153
 			return "error : ".$e->getMessage();
1154 1154
 		}
1155 1155
 	}
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
 		try {
1159 1159
 			$sth = $this->db->prepare($query);
1160 1160
 			$sth->execute();
1161
-		} catch(PDOException $e) {
1161
+		} catch (PDOException $e) {
1162 1162
 			return "error : ".$e->getMessage();
1163 1163
 		}
1164 1164
 	}
@@ -1166,14 +1166,14 @@  discard block
 block discarded – undo
1166 1166
 	public function updateNOTAM() {
1167 1167
 		global $globalNOTAMAirports;
1168 1168
 		if (isset($globalNOTAMAirports) && is_array($globalNOTAMAirports) && count($globalNOTAMAirports) > 0) {
1169
-			foreach (array_chunk($globalNOTAMAirports,10) as $airport) {
1170
-				$airport_icao = implode(',',$airport);
1169
+			foreach (array_chunk($globalNOTAMAirports, 10) as $airport) {
1170
+				$airport_icao = implode(',', $airport);
1171 1171
 				$alldata = $this->downloadNOTAM($airport_icao);
1172 1172
 				if (count($alldata) > 0) {
1173 1173
 					foreach ($alldata as $initial_data) {
1174 1174
 						$data = $this->parse($initial_data);
1175 1175
 						$notamref = $this->getNOTAMbyRef($data['ref']);
1176
-						if (count($notamref) == 0) $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1176
+						if (count($notamref) == 0) $this->addNOTAM($data['ref'], $data['title'], '', $data['fir'], $data['code'], '', $data['scope'], $data['lower_limit'], $data['upper_limit'], $data['latitude'], $data['longitude'], $data['radius'], $data['date_begin'], $data['date_end'], $data['permanent'], $data['text'], $data['full_notam']);
1177 1177
 					}
1178 1178
 				}
1179 1179
 			}
@@ -1186,7 +1186,7 @@  discard block
 block discarded – undo
1186 1186
 			foreach ($alldata as $initial_data) {
1187 1187
 				$data = $this->parse($initial_data);
1188 1188
 				$notamref = $this->getNOTAMbyRef($data['ref']);
1189
-				if (!isset($notamref['notam_id'])) $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1189
+				if (!isset($notamref['notam_id'])) $this->addNOTAM($data['ref'], $data['title'], '', $data['fir'], $data['code'], '', $data['scope'], $data['lower_limit'], $data['upper_limit'], $data['latitude'], $data['longitude'], $data['radius'], $data['date_begin'], $data['date_end'], $data['permanent'], $data['text'], $data['full_notam']);
1190 1190
 			}
1191 1191
 		}
1192 1192
 	}
@@ -1195,12 +1195,12 @@  discard block
 block discarded – undo
1195 1195
 		global $globalTransaction;
1196 1196
 		$Spotter = new Spotter();
1197 1197
 		$allairports = $Spotter->getAllAirportInfo();
1198
-		foreach (array_chunk($allairports,20) as $airport) {
1198
+		foreach (array_chunk($allairports, 20) as $airport) {
1199 1199
 			$airports_icao = array();
1200
-			foreach($airport as $icao) {
1200
+			foreach ($airport as $icao) {
1201 1201
 				if (isset($icao['icao'])) $airports_icao[] = $icao['icao'];
1202 1202
 			}
1203
-			$airport_icao = implode(',',$airports_icao);
1203
+			$airport_icao = implode(',', $airports_icao);
1204 1204
 			$alldata = $this->downloadNOTAM($airport_icao);
1205 1205
 			if ($globalTransaction) $this->db->beginTransaction();
1206 1206
 			if (count($alldata) > 0) {
@@ -1213,7 +1213,7 @@  discard block
 block discarded – undo
1213 1213
 						if (count($notamref) == 0) {
1214 1214
 							if (isset($data['ref_replaced'])) $this->deleteNOTAMbyRef($data['ref_replaced']);
1215 1215
 							if (isset($data['ref_cancelled'])) $this->deleteNOTAMbyRef($data['ref_cancelled']);
1216
-							elseif (isset($data['latitude']) && isset($data['scope']) && isset($data['text']) && isset($data['permanent'])) echo $this->addNOTAM($data['ref'],'','',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1216
+							elseif (isset($data['latitude']) && isset($data['scope']) && isset($data['text']) && isset($data['permanent'])) echo $this->addNOTAM($data['ref'], '', '', $data['fir'], $data['code'], '', $data['scope'], $data['lower_limit'], $data['upper_limit'], $data['latitude'], $data['longitude'], $data['radius'], $data['date_begin'], $data['date_end'], $data['permanent'], $data['text'], $data['full_notam']);
1217 1217
 						}
1218 1218
 					}
1219 1219
 				}
@@ -1227,7 +1227,7 @@  discard block
 block discarded – undo
1227 1227
 		date_default_timezone_set("UTC");
1228 1228
 		$Common = new Common();
1229 1229
 		//$url = str_replace('{icao}',$icao,'https://pilotweb.nas.faa.gov/PilotWeb/notamRetrievalByICAOAction.do?method=displayByICAOs&reportType=RAW&formatType=DOMESTIC&retrieveLocId={icao}&actionType=notamRetrievalByICAOs');
1230
-		$url = str_replace('{icao}',$icao,'https://pilotweb.nas.faa.gov/PilotWeb/notamRetrievalByICAOAction.do?method=displayByICAOs&reportType=RAW&formatType=ICAO&retrieveLocId={icao}&actionType=notamRetrievalByICAOs');
1230
+		$url = str_replace('{icao}', $icao, 'https://pilotweb.nas.faa.gov/PilotWeb/notamRetrievalByICAOAction.do?method=displayByICAOs&reportType=RAW&formatType=ICAO&retrieveLocId={icao}&actionType=notamRetrievalByICAOs');
1231 1231
 		$data = $Common->getData($url);
1232 1232
 		preg_match_all("/<pre>(.+?)<\/pre>/is", $data, $matches);
1233 1233
 		//print_r($matches);
@@ -1239,14 +1239,14 @@  discard block
 block discarded – undo
1239 1239
 		$Common = new Common();
1240 1240
 		$result = array();
1241 1241
 		$result['full_notam'] = $data;
1242
-		$data = str_ireplace(array("\r","\n",'\r','\n'),' ',$data);
1243
-		$data = preg_split('#(?=([A-Z]\)\s))#',$data);
1242
+		$data = str_ireplace(array("\r", "\n", '\r', '\n'), ' ', $data);
1243
+		$data = preg_split('#(?=([A-Z]\)\s))#', $data);
1244 1244
 		//print_r($data);
1245 1245
 		foreach ($data as $line) {
1246 1246
 			$line = trim($line);
1247
-			if (preg_match('#Q\) (.*)#',$line,$matches)) {
1248
-				$line = str_replace(' ','',$line);
1249
-				if (preg_match('#Q\)([A-Z]{4})\/([A-Z]{5})\/(IV|I|V)\/([A-Z]{1,3})\/([A-Z]{1,2})\/([0-9]{3})\/([0-9]{3})\/([0-9]{4})(N|S)([0-9]{5})(E|W)([0-9]{3})#',$line,$matches)) {
1247
+			if (preg_match('#Q\) (.*)#', $line, $matches)) {
1248
+				$line = str_replace(' ', '', $line);
1249
+				if (preg_match('#Q\)([A-Z]{4})\/([A-Z]{5})\/(IV|I|V)\/([A-Z]{1,3})\/([A-Z]{1,2})\/([0-9]{3})\/([0-9]{3})\/([0-9]{4})(N|S)([0-9]{5})(E|W)([0-9]{3})#', $line, $matches)) {
1250 1250
 				//if (preg_match('#Q\)([A-Z]{4})\/([A-Z]{5})\/(IV|I|V)\/([A-Z]{1,3})\/([A-Z]{1,2})\/([0-9]{3})\/([0-9]{3})\/([0-9]{4})(N|S)([0-9]{5})(E|W)([0-9]{3})#',$line,$matches)) {
1251 1251
 					//print_r($matches);
1252 1252
 					$result['fir'] = $matches[1];
@@ -1292,30 +1292,30 @@  discard block
 block discarded – undo
1292 1292
 					elseif ($matches[5] == 'AW') $result['scope'] = 'Airport/Navigation warning';
1293 1293
 					$result['lower_limit'] = $matches[6];
1294 1294
 					$result['upper_limit'] = $matches[7];
1295
-					$latitude = $Common->convertDec($matches[8],'latitude');
1295
+					$latitude = $Common->convertDec($matches[8], 'latitude');
1296 1296
 					if ($matches[9] == 'S') $latitude = -$latitude;
1297
-					$longitude = $Common->convertDec($matches[10],'longitude');
1297
+					$longitude = $Common->convertDec($matches[10], 'longitude');
1298 1298
 					if ($matches[11] == 'W') $longitude = -$longitude;
1299 1299
 					$result['latitude'] = $latitude;
1300 1300
 					$result['longitude'] = $longitude;
1301 1301
 					$result['radius'] = intval($matches[12]);
1302 1302
 				} else echo 'ERROR : '.$line."\n";
1303 1303
 			}
1304
-			elseif (preg_match('#A\) (.*)#',$line,$matches)) {
1304
+			elseif (preg_match('#A\) (.*)#', $line, $matches)) {
1305 1305
 				$result['icao'] = $matches[1];
1306 1306
 			}
1307
-			elseif (preg_match('#B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#',$line,$matches)) {
1307
+			elseif (preg_match('#B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#', $line, $matches)) {
1308 1308
 				if ($matches[1] > 50) $year = '19'.$matches[1];
1309 1309
 				else $year = '20'.$matches[1];
1310 1310
 				$result['date_begin'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
1311 1311
 			}
1312
-			elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#',$line,$matches)) {
1312
+			elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#', $line, $matches)) {
1313 1313
 				if ($matches[1] > 50) $year = '19'.$matches[1];
1314 1314
 				else $year = '20'.$matches[1];
1315 1315
 				$result['date_end'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
1316 1316
 				$result['permanent'] = 0;
1317 1317
 			}
1318
-			elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#',$line,$matches)) {
1318
+			elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#', $line, $matches)) {
1319 1319
 				if ($matches[1] > 50) $year = '19'.$matches[1];
1320 1320
 				else $year = '20'.$matches[1];
1321 1321
 				$result['date_end'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
@@ -1324,26 +1324,26 @@  discard block
 block discarded – undo
1324 1324
 				if ($matches[6] == 'PERM') $result['permanent'] = 1;
1325 1325
 				else $result['permanent'] = 0;
1326 1326
 			}
1327
-			elseif (preg_match('#C\) (EST|PERM)$#',$line,$matches)) {
1327
+			elseif (preg_match('#C\) (EST|PERM)$#', $line, $matches)) {
1328 1328
 				$result['date_end'] = '2030/12/20 12:00';
1329 1329
 				if ($matches[1] == 'EST') $result['estimated'] = 1;
1330 1330
 				else $result['estimated'] = 0;
1331 1331
 				if ($matches[1] == 'PERM') $result['permanent'] = 1;
1332 1332
 				else $result['permanent'] = 0;
1333 1333
 			}
1334
-			elseif (preg_match('#E\) (.*)#',$line,$matches)) {
1334
+			elseif (preg_match('#E\) (.*)#', $line, $matches)) {
1335 1335
 				$rtext = array();
1336
-				$text = explode(' ',$matches[1]);
1336
+				$text = explode(' ', $matches[1]);
1337 1337
 				foreach ($text as $word) {
1338 1338
 					if (isset($this->abbr[$word])) $rtext[] = strtoupper($this->abbr[$word]);
1339
-					elseif (ctype_digit(strval(substr($word,3))) && isset($this->abbr[substr($word,0,3)])) $rtext[] = strtoupper($this->abbr[substr($word,0,3)]).' '.substr($word,3);
1339
+					elseif (ctype_digit(strval(substr($word, 3))) && isset($this->abbr[substr($word, 0, 3)])) $rtext[] = strtoupper($this->abbr[substr($word, 0, 3)]).' '.substr($word, 3);
1340 1340
 					else $rtext[] = $word;
1341 1341
 				}
1342
-				$result['text'] = implode(' ',$rtext);
1342
+				$result['text'] = implode(' ', $rtext);
1343 1343
 			//} elseif (preg_match('#F\) (.*)#',$line,$matches)) {
1344 1344
 			//} elseif (preg_match('#G\) (.*)#',$line,$matches)) {
1345
-			} elseif (preg_match('#(NOTAMN|NOTAMR|NOTAMC)#',$line,$matches)) {
1346
-				$text = explode(' ',$line);
1345
+			} elseif (preg_match('#(NOTAMN|NOTAMR|NOTAMC)#', $line, $matches)) {
1346
+				$text = explode(' ', $line);
1347 1347
 				$result['ref'] = $text[0];
1348 1348
 				if ($matches[1] == 'NOTAMN') $result['type'] = 'new';
1349 1349
 				if ($matches[1] == 'NOTAMC') {
Please login to merge, or discard this patch.
Braces   +208 added lines, -88 removed lines patch added patch discarded remove patch
@@ -1015,8 +1015,11 @@  discard block
 block discarded – undo
1015 1015
 		$data = file_get_contents($filename);
1016 1016
 		preg_match_all("/%%(.+?)%%/is", $data, $matches);
1017 1017
 		//print_r($matches);
1018
-		if (isset($matches[1])) return $matches[1];
1019
-		else return array();
1018
+		if (isset($matches[1])) {
1019
+			return $matches[1];
1020
+		} else {
1021
+			return array();
1022
+		}
1020 1023
 	}
1021 1024
 	public function getAllNOTAMbyScope($scope) {
1022 1025
 		global $globalDBdriver;
@@ -1043,7 +1046,9 @@  discard block
 block discarded – undo
1043 1046
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1044 1047
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1045 1048
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1046
-		} else return array();
1049
+		} else {
1050
+			return array();
1051
+		}
1047 1052
 		if ($globalDBdriver == 'mysql') {
1048 1053
 			$query  = 'SELECT * FROM notam WHERE center_latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND center_longitude BETWEEN '.$minlong.' AND '.$maxlong.' AND radius > 0 AND date_end > UTC_TIMESTAMP() AND date_begin < UTC_TIMESTAMP()';
1049 1054
 		} else {
@@ -1067,7 +1072,9 @@  discard block
 block discarded – undo
1067 1072
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1068 1073
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1069 1074
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1070
-		} else return array();
1075
+		} else {
1076
+			return array();
1077
+		}
1071 1078
 		if ($globalDBdriver == 'mysql') {
1072 1079
 			$query  = 'SELECT * FROM notam WHERE center_latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND center_longitude BETWEEN '.$minlong.' AND '.$maxlong.' AND radius > 0 AND date_end > UTC_TIMESTAMP() AND date_begin < UTC_TIMESTAMP() AND scope = :scope';
1073 1080
 		} else {
@@ -1094,8 +1101,11 @@  discard block
 block discarded – undo
1094 1101
 			return "error : ".$e->getMessage();
1095 1102
 		}
1096 1103
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1097
-		if (isset($all[0])) return $all[0];
1098
-		else return array();
1104
+		if (isset($all[0])) {
1105
+			return $all[0];
1106
+		} else {
1107
+			return array();
1108
+		}
1099 1109
 	}
1100 1110
 
1101 1111
 	public function addNOTAM($ref,$title,$type,$fir,$code,$rules,$scope,$lower_limit,$upper_limit,$center_latitude,$center_longitude,$radius,$date_begin,$date_end,$permanent,$text,$full_notam) {
@@ -1173,7 +1183,9 @@  discard block
 block discarded – undo
1173 1183
 					foreach ($alldata as $initial_data) {
1174 1184
 						$data = $this->parse($initial_data);
1175 1185
 						$notamref = $this->getNOTAMbyRef($data['ref']);
1176
-						if (count($notamref) == 0) $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1186
+						if (count($notamref) == 0) {
1187
+							$this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1188
+						}
1177 1189
 					}
1178 1190
 				}
1179 1191
 			}
@@ -1186,7 +1198,9 @@  discard block
 block discarded – undo
1186 1198
 			foreach ($alldata as $initial_data) {
1187 1199
 				$data = $this->parse($initial_data);
1188 1200
 				$notamref = $this->getNOTAMbyRef($data['ref']);
1189
-				if (!isset($notamref['notam_id'])) $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1201
+				if (!isset($notamref['notam_id'])) {
1202
+					$this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1203
+				}
1190 1204
 			}
1191 1205
 		}
1192 1206
 	}
@@ -1198,11 +1212,15 @@  discard block
 block discarded – undo
1198 1212
 		foreach (array_chunk($allairports,20) as $airport) {
1199 1213
 			$airports_icao = array();
1200 1214
 			foreach($airport as $icao) {
1201
-				if (isset($icao['icao'])) $airports_icao[] = $icao['icao'];
1215
+				if (isset($icao['icao'])) {
1216
+					$airports_icao[] = $icao['icao'];
1217
+				}
1202 1218
 			}
1203 1219
 			$airport_icao = implode(',',$airports_icao);
1204 1220
 			$alldata = $this->downloadNOTAM($airport_icao);
1205
-			if ($globalTransaction) $this->db->beginTransaction();
1221
+			if ($globalTransaction) {
1222
+				$this->db->beginTransaction();
1223
+			}
1206 1224
 			if (count($alldata) > 0) {
1207 1225
 				foreach ($alldata as $initial_data) {
1208 1226
 					//print_r($initial_data);
@@ -1211,14 +1229,23 @@  discard block
 block discarded – undo
1211 1229
 					if (isset($data['ref'])) {
1212 1230
 						$notamref = $this->getNOTAMbyRef($data['ref']);
1213 1231
 						if (count($notamref) == 0) {
1214
-							if (isset($data['ref_replaced'])) $this->deleteNOTAMbyRef($data['ref_replaced']);
1215
-							if (isset($data['ref_cancelled'])) $this->deleteNOTAMbyRef($data['ref_cancelled']);
1216
-							elseif (isset($data['latitude']) && isset($data['scope']) && isset($data['text']) && isset($data['permanent'])) echo $this->addNOTAM($data['ref'],'','',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1232
+							if (isset($data['ref_replaced'])) {
1233
+								$this->deleteNOTAMbyRef($data['ref_replaced']);
1234
+							}
1235
+							if (isset($data['ref_cancelled'])) {
1236
+								$this->deleteNOTAMbyRef($data['ref_cancelled']);
1237
+							} elseif (isset($data['latitude']) && isset($data['scope']) && isset($data['text']) && isset($data['permanent'])) {
1238
+								echo $this->addNOTAM($data['ref'],'','',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1239
+							}
1217 1240
 						}
1218 1241
 					}
1219 1242
 				}
1220
-			} else echo 'Error on download. Nothing matches for '.$airport_icao."\n";
1221
-			if ($globalTransaction) $this->db->commit();
1243
+			} else {
1244
+				echo 'Error on download. Nothing matches for '.$airport_icao."\n";
1245
+			}
1246
+			if ($globalTransaction) {
1247
+				$this->db->commit();
1248
+			}
1222 1249
 			sleep(5);
1223 1250
 		}
1224 1251
 	}
@@ -1231,8 +1258,11 @@  discard block
 block discarded – undo
1231 1258
 		$data = $Common->getData($url);
1232 1259
 		preg_match_all("/<pre>(.+?)<\/pre>/is", $data, $matches);
1233 1260
 		//print_r($matches);
1234
-		if (isset($matches[1])) return $matches[1];
1235
-		else return array();
1261
+		if (isset($matches[1])) {
1262
+			return $matches[1];
1263
+		} else {
1264
+			return array();
1265
+		}
1236 1266
 	}
1237 1267
 
1238 1268
 	public function parse($data) {
@@ -1255,89 +1285,145 @@  discard block
 block discarded – undo
1255 1285
 					$rules = str_split($matches[3]);
1256 1286
 					foreach ($rules as $rule) {
1257 1287
 						if ($rule == 'I') {
1258
-							if (isset($result['rules'])) $result['rules'] = $result['rules'].'/IFR';
1259
-							else $result['rules'] = 'IFR';
1288
+							if (isset($result['rules'])) {
1289
+								$result['rules'] = $result['rules'].'/IFR';
1290
+							} else {
1291
+								$result['rules'] = 'IFR';
1292
+							}
1260 1293
 						} elseif ($rule == 'V') {
1261
-							if (isset($result['rules'])) $result['rules'] = $result['rules'].'/VFR';
1262
-							else $result['rules'] = 'VFR';
1294
+							if (isset($result['rules'])) {
1295
+								$result['rules'] = $result['rules'].'/VFR';
1296
+							} else {
1297
+								$result['rules'] = 'VFR';
1298
+							}
1263 1299
 						} elseif ($rule == 'K') {
1264
-							if (isset($result['rules'])) $result['rules'] = $result['rules'].'/Checklist';
1265
-							else $result['rules'] = 'Checklist';
1300
+							if (isset($result['rules'])) {
1301
+								$result['rules'] = $result['rules'].'/Checklist';
1302
+							} else {
1303
+								$result['rules'] = 'Checklist';
1304
+							}
1266 1305
 						}
1267 1306
 					}
1268 1307
 					$attentions = str_split($matches[4]);
1269 1308
 					foreach ($attentions as $attention) {
1270 1309
 						if ($attention == 'N') {
1271
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Immediate attention';
1272
-							else $result['rules'] = 'Immediate attention';
1310
+							if (isset($result['attention'])) {
1311
+								$result['attention'] = $result['attention'].' / Immediate attention';
1312
+							} else {
1313
+								$result['rules'] = 'Immediate attention';
1314
+							}
1273 1315
 						} elseif ($attention == 'B') {
1274
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Operational significance';
1275
-							else $result['rules'] = 'Operational significance';
1316
+							if (isset($result['attention'])) {
1317
+								$result['attention'] = $result['attention'].' / Operational significance';
1318
+							} else {
1319
+								$result['rules'] = 'Operational significance';
1320
+							}
1276 1321
 						} elseif ($attention == 'O') {
1277
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Flight operations';
1278
-							else $result['rules'] = 'Flight operations';
1322
+							if (isset($result['attention'])) {
1323
+								$result['attention'] = $result['attention'].' / Flight operations';
1324
+							} else {
1325
+								$result['rules'] = 'Flight operations';
1326
+							}
1279 1327
 						} elseif ($attention == 'M') {
1280
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Misc';
1281
-							else $result['rules'] = 'Misc';
1328
+							if (isset($result['attention'])) {
1329
+								$result['attention'] = $result['attention'].' / Misc';
1330
+							} else {
1331
+								$result['rules'] = 'Misc';
1332
+							}
1282 1333
 						} elseif ($attention == 'K') {
1283
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Checklist';
1284
-							else $result['rules'] = 'Checklist';
1334
+							if (isset($result['attention'])) {
1335
+								$result['attention'] = $result['attention'].' / Checklist';
1336
+							} else {
1337
+								$result['rules'] = 'Checklist';
1338
+							}
1285 1339
 						}
1286 1340
 					}
1287
-					if ($matches[5] == 'A') $result['scope'] = 'Airport warning';
1288
-					elseif ($matches[5] == 'E') $result['scope'] = 'Enroute warning';
1289
-					elseif ($matches[5] == 'W') $result['scope'] = 'Navigation warning';
1290
-					elseif ($matches[5] == 'K') $result['scope'] = 'Checklist';
1291
-					elseif ($matches[5] == 'AE') $result['scope'] = 'Airport/Enroute warning';
1292
-					elseif ($matches[5] == 'AW') $result['scope'] = 'Airport/Navigation warning';
1341
+					if ($matches[5] == 'A') {
1342
+						$result['scope'] = 'Airport warning';
1343
+					} elseif ($matches[5] == 'E') {
1344
+						$result['scope'] = 'Enroute warning';
1345
+					} elseif ($matches[5] == 'W') {
1346
+						$result['scope'] = 'Navigation warning';
1347
+					} elseif ($matches[5] == 'K') {
1348
+						$result['scope'] = 'Checklist';
1349
+					} elseif ($matches[5] == 'AE') {
1350
+						$result['scope'] = 'Airport/Enroute warning';
1351
+					} elseif ($matches[5] == 'AW') {
1352
+						$result['scope'] = 'Airport/Navigation warning';
1353
+					}
1293 1354
 					$result['lower_limit'] = $matches[6];
1294 1355
 					$result['upper_limit'] = $matches[7];
1295 1356
 					$latitude = $Common->convertDec($matches[8],'latitude');
1296
-					if ($matches[9] == 'S') $latitude = -$latitude;
1357
+					if ($matches[9] == 'S') {
1358
+						$latitude = -$latitude;
1359
+					}
1297 1360
 					$longitude = $Common->convertDec($matches[10],'longitude');
1298
-					if ($matches[11] == 'W') $longitude = -$longitude;
1361
+					if ($matches[11] == 'W') {
1362
+						$longitude = -$longitude;
1363
+					}
1299 1364
 					$result['latitude'] = $latitude;
1300 1365
 					$result['longitude'] = $longitude;
1301 1366
 					$result['radius'] = intval($matches[12]);
1302
-				} else echo 'ERROR : '.$line."\n";
1303
-			}
1304
-			elseif (preg_match('#A\) (.*)#',$line,$matches)) {
1367
+				} else {
1368
+					echo 'ERROR : '.$line."\n";
1369
+				}
1370
+			} elseif (preg_match('#A\) (.*)#',$line,$matches)) {
1305 1371
 				$result['icao'] = $matches[1];
1306
-			}
1307
-			elseif (preg_match('#B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#',$line,$matches)) {
1308
-				if ($matches[1] > 50) $year = '19'.$matches[1];
1309
-				else $year = '20'.$matches[1];
1372
+			} elseif (preg_match('#B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#',$line,$matches)) {
1373
+				if ($matches[1] > 50) {
1374
+					$year = '19'.$matches[1];
1375
+				} else {
1376
+					$year = '20'.$matches[1];
1377
+				}
1310 1378
 				$result['date_begin'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
1311
-			}
1312
-			elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#',$line,$matches)) {
1313
-				if ($matches[1] > 50) $year = '19'.$matches[1];
1314
-				else $year = '20'.$matches[1];
1379
+			} elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#',$line,$matches)) {
1380
+				if ($matches[1] > 50) {
1381
+					$year = '19'.$matches[1];
1382
+				} else {
1383
+					$year = '20'.$matches[1];
1384
+				}
1315 1385
 				$result['date_end'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
1316 1386
 				$result['permanent'] = 0;
1317
-			}
1318
-			elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#',$line,$matches)) {
1319
-				if ($matches[1] > 50) $year = '19'.$matches[1];
1320
-				else $year = '20'.$matches[1];
1387
+			} elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#',$line,$matches)) {
1388
+				if ($matches[1] > 50) {
1389
+					$year = '19'.$matches[1];
1390
+				} else {
1391
+					$year = '20'.$matches[1];
1392
+				}
1321 1393
 				$result['date_end'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
1322
-				if ($matches[6] == 'EST') $result['estimated'] = 1;
1323
-				else $result['estimated'] = 0;
1324
-				if ($matches[6] == 'PERM') $result['permanent'] = 1;
1325
-				else $result['permanent'] = 0;
1326
-			}
1327
-			elseif (preg_match('#C\) (EST|PERM)$#',$line,$matches)) {
1394
+				if ($matches[6] == 'EST') {
1395
+					$result['estimated'] = 1;
1396
+				} else {
1397
+					$result['estimated'] = 0;
1398
+				}
1399
+				if ($matches[6] == 'PERM') {
1400
+					$result['permanent'] = 1;
1401
+				} else {
1402
+					$result['permanent'] = 0;
1403
+				}
1404
+			} elseif (preg_match('#C\) (EST|PERM)$#',$line,$matches)) {
1328 1405
 				$result['date_end'] = '2030/12/20 12:00';
1329
-				if ($matches[1] == 'EST') $result['estimated'] = 1;
1330
-				else $result['estimated'] = 0;
1331
-				if ($matches[1] == 'PERM') $result['permanent'] = 1;
1332
-				else $result['permanent'] = 0;
1333
-			}
1334
-			elseif (preg_match('#E\) (.*)#',$line,$matches)) {
1406
+				if ($matches[1] == 'EST') {
1407
+					$result['estimated'] = 1;
1408
+				} else {
1409
+					$result['estimated'] = 0;
1410
+				}
1411
+				if ($matches[1] == 'PERM') {
1412
+					$result['permanent'] = 1;
1413
+				} else {
1414
+					$result['permanent'] = 0;
1415
+				}
1416
+			} elseif (preg_match('#E\) (.*)#',$line,$matches)) {
1335 1417
 				$rtext = array();
1336 1418
 				$text = explode(' ',$matches[1]);
1337 1419
 				foreach ($text as $word) {
1338
-					if (isset($this->abbr[$word])) $rtext[] = strtoupper($this->abbr[$word]);
1339
-					elseif (ctype_digit(strval(substr($word,3))) && isset($this->abbr[substr($word,0,3)])) $rtext[] = strtoupper($this->abbr[substr($word,0,3)]).' '.substr($word,3);
1340
-					else $rtext[] = $word;
1420
+					if (isset($this->abbr[$word])) {
1421
+						$rtext[] = strtoupper($this->abbr[$word]);
1422
+					} elseif (ctype_digit(strval(substr($word,3))) && isset($this->abbr[substr($word,0,3)])) {
1423
+						$rtext[] = strtoupper($this->abbr[substr($word,0,3)]).' '.substr($word,3);
1424
+					} else {
1425
+						$rtext[] = $word;
1426
+					}
1341 1427
 				}
1342 1428
 				$result['text'] = implode(' ',$rtext);
1343 1429
 			//} elseif (preg_match('#F\) (.*)#',$line,$matches)) {
@@ -1345,7 +1431,9 @@  discard block
 block discarded – undo
1345 1431
 			} elseif (preg_match('#(NOTAMN|NOTAMR|NOTAMC)#',$line,$matches)) {
1346 1432
 				$text = explode(' ',$line);
1347 1433
 				$result['ref'] = $text[0];
1348
-				if ($matches[1] == 'NOTAMN') $result['type'] = 'new';
1434
+				if ($matches[1] == 'NOTAMN') {
1435
+					$result['type'] = 'new';
1436
+				}
1349 1437
 				if ($matches[1] == 'NOTAMC') {
1350 1438
 					$result['type'] = 'cancel';
1351 1439
 					$result['ref_cancelled'] = $text[2];
@@ -1367,69 +1455,101 @@  discard block
 block discarded – undo
1367 1455
 		switch ($code[1]) {
1368 1456
 			case 'A':
1369 1457
 				$result = 'Airspace organization ';
1370
-				if (isset($this->code_airspace[$code_fp])) $result .= $this->code_airspace[$code_fp];
1458
+				if (isset($this->code_airspace[$code_fp])) {
1459
+					$result .= $this->code_airspace[$code_fp];
1460
+				}
1371 1461
 				break;
1372 1462
 			case 'C':
1373 1463
 				$result = 'Communications and radar facilities ';
1374
-				if (isset($this->code_comradar[$code_fp])) $result .= $this->code_comradar[$code_fp];
1464
+				if (isset($this->code_comradar[$code_fp])) {
1465
+					$result .= $this->code_comradar[$code_fp];
1466
+				}
1375 1467
 				break;
1376 1468
 			case 'F':
1377 1469
 				$result = 'Facilities and services ';
1378
-				if (isset($this->code_facilities[$code_fp])) $result .= $this->code_facilities[$code_fp];
1470
+				if (isset($this->code_facilities[$code_fp])) {
1471
+					$result .= $this->code_facilities[$code_fp];
1472
+				}
1379 1473
 				break;
1380 1474
 			case 'I':
1381 1475
 				$result = 'Instrument and Microwave Landing System ';
1382
-				if (isset($this->code_instrumentlanding[$code_fp])) $result .= $this->code_instrumentlanding[$code_fp];
1476
+				if (isset($this->code_instrumentlanding[$code_fp])) {
1477
+					$result .= $this->code_instrumentlanding[$code_fp];
1478
+				}
1383 1479
 				break;
1384 1480
 			case 'L':
1385 1481
 				$result = 'Lighting facilities ';
1386
-				if (isset($this->code_lightingfacilities[$code_fp])) $result .= $this->code_lightingfacilities[$code_fp];
1482
+				if (isset($this->code_lightingfacilities[$code_fp])) {
1483
+					$result .= $this->code_lightingfacilities[$code_fp];
1484
+				}
1387 1485
 				break;
1388 1486
 			case 'M':
1389 1487
 				$result = 'Movement and landing areas ';
1390
-				if (isset($this->code_movementareas[$code_fp])) $result .= $this->code_movementareas[$code_fp];
1488
+				if (isset($this->code_movementareas[$code_fp])) {
1489
+					$result .= $this->code_movementareas[$code_fp];
1490
+				}
1391 1491
 				break;
1392 1492
 			case 'N':
1393 1493
 				$result = 'Terminal and En Route Navigation Facilities ';
1394
-				if (isset($this->code_terminalfacilities[$code_fp])) $result .= $this->code_terminalfacilities[$code_fp];
1494
+				if (isset($this->code_terminalfacilities[$code_fp])) {
1495
+					$result .= $this->code_terminalfacilities[$code_fp];
1496
+				}
1395 1497
 				break;
1396 1498
 			case 'O':
1397 1499
 				$result = 'Other information ';
1398
-				if (isset($this->code_information[$code_fp])) $result .= $this->code_information[$code_fp];
1500
+				if (isset($this->code_information[$code_fp])) {
1501
+					$result .= $this->code_information[$code_fp];
1502
+				}
1399 1503
 				break;
1400 1504
 			case 'P':
1401 1505
 				$result = 'Air Traffic procedures ';
1402
-				if (isset($this->code_airtraffic[$code_fp])) $result .= $this->code_airtraffic[$code_fp];
1506
+				if (isset($this->code_airtraffic[$code_fp])) {
1507
+					$result .= $this->code_airtraffic[$code_fp];
1508
+				}
1403 1509
 				break;
1404 1510
 			case 'R':
1405 1511
 				$result = 'Navigation Warnings: Airspace Restrictions ';
1406
-				if (isset($this->code_navigationw[$code_fp])) $result .= $this->code_navigationw[$code_fp];
1512
+				if (isset($this->code_navigationw[$code_fp])) {
1513
+					$result .= $this->code_navigationw[$code_fp];
1514
+				}
1407 1515
 				break;
1408 1516
 			case 'S':
1409 1517
 				$result = 'Air Traffic and VOLMET Services ';
1410
-				if (isset($this->code_volmet[$code_fp])) $result .= $this->code_volmet[$code_fp];
1518
+				if (isset($this->code_volmet[$code_fp])) {
1519
+					$result .= $this->code_volmet[$code_fp];
1520
+				}
1411 1521
 				break;
1412 1522
 			case 'W':
1413 1523
 				$result = 'Navigation Warnings: Warnings ';
1414
-				if (isset($this->code_warnings[$code_fp])) $result .= $this->code_warnings[$code_fp];
1524
+				if (isset($this->code_warnings[$code_fp])) {
1525
+					$result .= $this->code_warnings[$code_fp];
1526
+				}
1415 1527
 				break;
1416 1528
 		}
1417 1529
 		switch ($code[3]) {
1418 1530
 			case 'A':
1419 1531
 				// Availability
1420
-				if (isset($this->code_sp_availabity[$code_sp])) $result .= ' '.$this->code_sp_availabity[$code_sp];
1532
+				if (isset($this->code_sp_availabity[$code_sp])) {
1533
+					$result .= ' '.$this->code_sp_availabity[$code_sp];
1534
+				}
1421 1535
 				break;
1422 1536
 			case 'C':
1423 1537
 				// Changes
1424
-				if (isset($this->code_sp_changes[$code_sp])) $result .= ' '.$this->code_sp_changes[$code_sp];
1538
+				if (isset($this->code_sp_changes[$code_sp])) {
1539
+					$result .= ' '.$this->code_sp_changes[$code_sp];
1540
+				}
1425 1541
 				break;
1426 1542
 			case 'H':
1427 1543
 				// Hazardous conditions
1428
-				if (isset($this->code_sp_hazardous[$code_sp])) $result .= ' '.$this->code_sp_hazardous[$code_sp];
1544
+				if (isset($this->code_sp_hazardous[$code_sp])) {
1545
+					$result .= ' '.$this->code_sp_hazardous[$code_sp];
1546
+				}
1429 1547
 				break;
1430 1548
 			case 'L':
1431 1549
 				// Limitations
1432
-				if (isset($this->code_sp_limitations[$code_sp])) $result .= ' '.$this->code_sp_limitations[$code_sp];
1550
+				if (isset($this->code_sp_limitations[$code_sp])) {
1551
+					$result .= ' '.$this->code_sp_limitations[$code_sp];
1552
+				}
1433 1553
 				break;
1434 1554
 			case 'X':
1435 1555
 				// Other Information
Please login to merge, or discard this patch.
waypoints-geojson.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 		date_default_timezone_set('UTC');
27 27
 		//waypoint plotting
28 28
 		$output .= '{"type": "Feature",';
29
-		    $output .= '"properties": {';
29
+			$output .= '"properties": {';
30 30
 			$output .= '"segment_name": "'.$spotter_item['segment_name'].'",';
31 31
 			$output .= '"base": "'.$spotter_item['base'].'",';
32 32
 			$output .= '"top": "'.$spotter_item['top'].'",';
@@ -49,15 +49,15 @@  discard block
 block discarded – undo
49 49
 				$output .= '"stroke": "#f0f0f0",';
50 50
 				$output .= '"stroke-width": 2';
51 51
 //			}
52
-		    $output .= '},';
53
-		    $output .= '"geometry": {';
52
+			$output .= '},';
53
+			$output .= '"geometry": {';
54 54
 			$output .= '"type": "LineString",';
55 55
 			$output .= '"coordinates": [';
56
-			    //$output .= '['.$spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].'], ['.$spotter_item['longitude_end'].', '.$spotter_item['latitude_end'].'], ['.$spotter_item['longitude_end_seg2'].', '.$spotter_item['latitude_end_seg2'].']';
57
-			    $output .= '['.$spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].','.round($spotter_item['base']*100*0.3048).'], ['.$spotter_item['longitude_end'].', '.$spotter_item['latitude_end'].','.round($spotter_item['base']*100*0.3048).']';
56
+				//$output .= '['.$spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].'], ['.$spotter_item['longitude_end'].', '.$spotter_item['latitude_end'].'], ['.$spotter_item['longitude_end_seg2'].', '.$spotter_item['latitude_end_seg2'].']';
57
+				$output .= '['.$spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].','.round($spotter_item['base']*100*0.3048).'], ['.$spotter_item['longitude_end'].', '.$spotter_item['latitude_end'].','.round($spotter_item['base']*100*0.3048).']';
58 58
 			//    $output .= '['.$spotter_item['latitude_begin'].', '.$spotter_item['longitude_begin'].'], ['.$spotter_item['latitude_end'].', '.$spotter_item['longitude_end'].']';
59 59
 			$output .= ']';
60
-		    $output .= '}';
60
+			$output .= '}';
61 61
 /*		    $output .= '"geometry": {';
62 62
 			$output .= '"type": "Point",';
63 63
 			$output .= '"coordinates": [';
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 		$output .= '},';
69 69
 		//waypoint plotting
70 70
 		$output .= '{"type": "Feature",';
71
-		    $output .= '"properties": {';
71
+			$output .= '"properties": {';
72 72
 			$output .= '"ident": "'.$spotter_item['name_begin'].'",';
73 73
 			$output .= '"high": "'.$spotter_item['high'].'",';
74 74
 			$output .= '"alt": "'.$spotter_item['base'].'",';
@@ -98,17 +98,17 @@  discard block
 block discarded – undo
98 98
 				$output .= '"marker-size": "small",';
99 99
 				$output .= '"marker-color": "#0000ff"';
100 100
 			}
101
-		    $output .= '},';
102
-		    $output .= '"geometry": {';
101
+			$output .= '},';
102
+			$output .= '"geometry": {';
103 103
 			$output .= '"type": "Point",';
104 104
 			$output .= '"coordinates": [';
105
-			    $output .= $spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].', '.round($spotter_item['base']*100*0.3048);;
105
+				$output .= $spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].', '.round($spotter_item['base']*100*0.3048);;
106 106
 			$output .= ']';
107
-		    $output .= '}';
107
+			$output .= '}';
108 108
 
109 109
 		$output .= '},';
110 110
 		$output .= '{"type": "Feature",';
111
-		    $output .= '"properties": {';
111
+			$output .= '"properties": {';
112 112
 			$output .= '"ident": "'.$spotter_item['name_end'].'",';
113 113
 			$output .= '"high": "'.$spotter_item['high'].'",';
114 114
 			$output .= '"alt": "'.$spotter_item['top'].'",';
@@ -145,13 +145,13 @@  discard block
 block discarded – undo
145 145
 				$output .= '"marker-size": "small",';
146 146
 				$output .= '"marker-color": "#0000ff"';
147 147
 			}
148
-		    $output .= '},';
149
-		    $output .= '"geometry": {';
148
+			$output .= '},';
149
+			$output .= '"geometry": {';
150 150
 			$output .= '"type": "Point",';
151 151
 			$output .= '"coordinates": [';
152
-			    $output .= $spotter_item['longitude_end'].', '.$spotter_item['latitude_end'].', '.round($spotter_item['base']*100*0.3048);
152
+				$output .= $spotter_item['longitude_end'].', '.$spotter_item['latitude_end'].', '.round($spotter_item['base']*100*0.3048);
153 153
 			$output .= ']';
154
-		    $output .= '}';
154
+			$output .= '}';
155 155
 
156 156
 		$output .= '},';
157 157
 	}
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 
11 11
 if (isset($_GET['coord'])) 
12 12
 {
13
-	$coords = explode(',',$_GET['coord']);
13
+	$coords = explode(',', $_GET['coord']);
14 14
 	$spotter_array = $Spotter->getAllWaypointsInfobyCoord($coords);
15 15
 } else {
16 16
 	die;
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 if (!empty($spotter_array))
22 22
 {	  
23 23
 //	print_r($spotter_array);
24
-	foreach($spotter_array as $spotter_item)
24
+	foreach ($spotter_array as $spotter_item)
25 25
 	{
26 26
 		date_default_timezone_set('UTC');
27 27
 		//waypoint plotting
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 		    $output .= '"geometry": {';
103 103
 			$output .= '"type": "Point",';
104 104
 			$output .= '"coordinates": [';
105
-			    $output .= $spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].', '.round($spotter_item['base']*100*0.3048);;
105
+			    $output .= $spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].', '.round($spotter_item['base']*100*0.3048); ;
106 106
 			$output .= ']';
107 107
 		    $output .= '}';
108 108
 
Please login to merge, or discard this patch.
airspace-data.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 <button type="button" class="close">&times;</button>
8 8
 <?php
9 9
 
10
-$airspaceid = filter_input(INPUT_GET,'airspace',FILTER_SANITIZE_NUMBER_INT);
10
+$airspaceid = filter_input(INPUT_GET, 'airspace', FILTER_SANITIZE_NUMBER_INT);
11 11
 //$notamref = urldecode($notamref);
12 12
 if ($globalDBdriver == 'mysql') {
13 13
 	$query = "SELECT * FROM airspace WHERE ogr_fid = :id";
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 try {
19 19
 	$sth = $Connection->db->prepare($query);
20 20
 	$sth->execute(array(':id' => $airspaceid));
21
-} catch(PDOException $e) {
21
+} catch (PDOException $e) {
22 22
 	echo "error";
23 23
 }
24
-$result=$sth->fetchAll(PDO::FETCH_ASSOC);
24
+$result = $sth->fetchAll(PDO::FETCH_ASSOC);
25 25
 $airspace = $result[0];
26 26
 date_default_timezone_set('UTC');
27 27
 print '<div class="top">';
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,7 +25,9 @@  discard block
 block discarded – undo
25 25
 $airspace = $result[0];
26 26
 date_default_timezone_set('UTC');
27 27
 print '<div class="top">';
28
-if (isset($airspace['name'])) $airspace['title'] = $airspace['name']; 
28
+if (isset($airspace['name'])) {
29
+	$airspace['title'] = $airspace['name'];
30
+}
29 31
 print '<div class="right"><div class="callsign-details"><div class="callsign">'.$airspace['title'].'</a></div>';
30 32
 print '</div>';
31 33
 print '<div class="details">';
@@ -44,13 +46,17 @@  discard block
 block discarded – undo
44 46
 	print '</div>';
45 47
 }
46 48
 
47
-if (isset($airspace['ceiling'])) $airspace['tops'] = $airspace['ceiling'];
49
+if (isset($airspace['ceiling'])) {
50
+	$airspace['tops'] = $airspace['ceiling'];
51
+}
48 52
 print '<div>';
49 53
 print '<span>'._("Tops").'</span>';
50 54
 print $airspace['tops'];
51 55
 print '</div>';
52 56
 
53
-if (isset($airspace['floor'])) $airspace['base'] = $airspace['floor'];
57
+if (isset($airspace['floor'])) {
58
+	$airspace['base'] = $airspace['floor'];
59
+}
54 60
 print '<div>';
55 61
 print '<span>'._("Base").'</span>';
56 62
 print $airspace['base'];
Please login to merge, or discard this patch.
scripts/update_db.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
10 10
 	exec("ps ux", $output, $result);
11 11
 	$j = 0;
12
-	foreach ($output as $line) if(strpos($line, "update_db.php") && !strpos($line, "sh ")) $j++;
12
+	foreach ($output as $line) if (strpos($line, "update_db.php") && !strpos($line, "sh ")) $j++;
13 13
 	if ($j > 1) {
14 14
 		echo "Script is already runnning...";
15 15
 		die();
Please login to merge, or discard this patch.
Braces   +19 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,7 +9,9 @@  discard block
 block discarded – undo
9 9
 if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
10 10
 	exec("ps ux", $output, $result);
11 11
 	$j = 0;
12
-	foreach ($output as $line) if(strpos($line, "update_db.php") && !strpos($line, "sh ")) $j++;
12
+	foreach ($output as $line) {
13
+		if(strpos($line, "update_db.php") && !strpos($line, "sh ")) $j++;
14
+	}
13 15
 	if ($j > 1) {
14 16
 		echo "Script is already runnning...";
15 17
 		die();
@@ -29,14 +31,18 @@  discard block
 block discarded – undo
29 31
 			$update_db->update_notam();
30 32
 		}
31 33
 		$update_db->insert_last_notam_update();
32
-	} elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) echo "NOTAM are only updated once a day.\n";
34
+	} elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) {
35
+		echo "NOTAM are only updated once a day.\n";
36
+	}
33 37
 	if ($update_db->check_last_update() && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
34 38
 		$update_db->update_all();
35 39
 	//	require_once(dirname(__FILE__).'/../require/class.Spotter.php');
36 40
 	//	$Spotter = new Spotter();
37 41
 	//	$Spotter->updateFieldsFromOtherTables();
38 42
 		$update_db->insert_last_update();
39
-	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM)) echo "DB are populated with external data only every 15 days ! Files are not updated more often.\n";
43
+	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM)) {
44
+		echo "DB are populated with external data only every 15 days ! Files are not updated more often.\n";
45
+	}
40 46
 	if (isset($globalWaypoints) && $globalWaypoints && $update_db->check_last_airspace_update()) {
41 47
 		echo "Check if new airspace version exist...";
42 48
 		echo $update_db->update_airspace_fam();
@@ -52,22 +58,28 @@  discard block
 block discarded – undo
52 58
 	if ($METAR->check_last_update()) {
53 59
 		$METAR->addMETARCycle();
54 60
 		$METAR->insert_last_update();
55
-	} else echo "METAR are only updated every 30 minutes.\n";
56
-}
61
+	} else {
62
+		echo "METAR are only updated every 30 minutes.\n";
63
+	}
64
+	}
57 65
 
58 66
 
59 67
 if (isset($globalOwner) && $globalOwner && $update_db->check_last_owner_update() && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
60 68
 	echo "Updating private aircraft's owners...\n";
61 69
 	$update_db->update_owner();
62 70
 	$update_db->insert_last_owner_update();
63
-} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Owner are only updated every 15 days.\n";
71
+} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
72
+	echo "Owner are only updated every 15 days.\n";
73
+}
64 74
 
65 75
 if (isset($globalSchedules) && $globalSchedules && $update_db->check_last_schedules_update() && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
66 76
 	echo "Updating schedules...";
67 77
 	//$update_db->update_oneworld();
68 78
 	$update_db->update_skyteam();
69 79
 	$update_db->insert_last_schedules_update();
70
-} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Schedules are only updated every 15 days.\n";
80
+} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
81
+	echo "Schedules are only updated every 15 days.\n";
82
+}
71 83
 
72 84
 if (isset($globalArchiveMonths) && $globalArchiveMonths > 0) {
73 85
 	echo "Updating statistics and archive old data...";
Please login to merge, or discard this patch.
install/VAM/VAM-json.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -11,27 +11,27 @@
 block discarded – undo
11 11
 	die();
12 12
 }
13 13
 $query = 'select * from vam_live_flights rc, gvausers gu where gu.gvauser_id = rc.gvauser_id';  
14
-$json_data=array();  
14
+$json_data = array();  
15 15
 $result = $db->query($query);
16 16
 while ($rec = $result->fetch_assoc())
17 17
 {  
18
-	$json_array['gvauser_id']=$rec['gvauser_id']; // users "pilot unique ID" "40"
19
-	$json_array['flight_id']=$rec['flight_id']; // flight_id
20
-	$json_array['pilot_id']=$rec['callsign']; // users pilot_id "VAM500"
21
-	$json_array['callsign']=substr($rec['flight_id'],-7);  // substr icao Flight "AFR524"
22
-	$json_array['pilot_name']=$rec['name'] .' '.$rec['surname'] ;  // Users "name + surname"
23
-	$json_array['plane_type']=$rec['plane_type'];  // type Plane "B739"
24
-	$json_array['departure']=$rec['departure'];  // departure ICAO
25
-	$json_array['arrival']=$rec['arrival'];     // arrival Ident
26
-	$json_array['latitude']=$rec['latitude'];  // return 55.7328860921521
27
-	$json_array['longitude']=$rec['longitude'];  // return 8.87433614409404
28
-	$json_array['altitude']=$rec['altitude'];  // return "147"
29
-	$json_array['heading']=$rec['heading'];  // return "307"
30
-	$json_array['ias']=$rec['ias'];  // return speed "IAS"
31
-	$json_array['gs']=$rec['gs'];  // return speed "GS"
18
+	$json_array['gvauser_id'] = $rec['gvauser_id']; // users "pilot unique ID" "40"
19
+	$json_array['flight_id'] = $rec['flight_id']; // flight_id
20
+	$json_array['pilot_id'] = $rec['callsign']; // users pilot_id "VAM500"
21
+	$json_array['callsign'] = substr($rec['flight_id'], -7); // substr icao Flight "AFR524"
22
+	$json_array['pilot_name'] = $rec['name'].' '.$rec['surname']; // Users "name + surname"
23
+	$json_array['plane_type'] = $rec['plane_type']; // type Plane "B739"
24
+	$json_array['departure'] = $rec['departure']; // departure ICAO
25
+	$json_array['arrival'] = $rec['arrival']; // arrival Ident
26
+	$json_array['latitude'] = $rec['latitude']; // return 55.7328860921521
27
+	$json_array['longitude'] = $rec['longitude']; // return 8.87433614409404
28
+	$json_array['altitude'] = $rec['altitude']; // return "147"
29
+	$json_array['heading'] = $rec['heading']; // return "307"
30
+	$json_array['ias'] = $rec['ias']; // return speed "IAS"
31
+	$json_array['gs'] = $rec['gs']; // return speed "GS"
32 32
 	// $json_array['routes']=$rec['routes'];  // (unusable)
33
-	$json_array['flight_status']=$rec['flight_status'];  // "return Status"
34
-	$json_array['last_update']=$rec['last_update'];  // return "DateTime"
33
+	$json_array['flight_status'] = $rec['flight_status']; // "return Status"
34
+	$json_array['last_update'] = $rec['last_update']; // return "DateTime"
35 35
 	$json_data[] = $json_array;
36 36
  }  
37 37
 echo json_encode($json_data);
Please login to merge, or discard this patch.