Completed
Push — master ( 7fab65...347b49 )
by Yannick
05:33
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.
Spacing   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -16,14 +16,14 @@  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;
21
-		if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter);
21
+		if (is_array($globalFilter)) $filter = array_merge($globalFilter, $filter);
22 22
 		$filter_query_join = '';
23 23
 		$filter_query_where = '';
24 24
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
25 25
 			if ($filter['airlines'][0] != '') {
26
-				$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";
26
+				$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";
27 27
 			}
28 28
 		}
29 29
 		
@@ -31,16 +31,16 @@  discard block
 block discarded – undo
31 31
 			$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 ";
32 32
 		}
33 33
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
34
-			$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";
34
+			$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";
35 35
 		}
36 36
 		if (isset($filter['source']) && !empty($filter['source'])) {
37
-			$filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
37
+			$filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')";
38 38
 		}
39 39
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
40 40
 			if ($filter_query_where == '') {
41
-				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
41
+				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
42 42
 			} else {
43
-				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
43
+				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
44 44
 			}
45 45
 		}
46 46
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
 		if ($limit != '')
67 67
 		{
68 68
 			$limit_array = explode(',', $limit);
69
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
70
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
69
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
70
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
71 71
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
72 72
 			{
73 73
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 //			$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';
112 112
 //			$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;
113 113
 
114
-			$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 
114
+			$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 
115 115
 			FROM spotter_live 
116 116
 			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.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao';
117 117
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 			//$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";
123 123
 			//$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";
124 124
 			//$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';
125
-			$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 
125
+			$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 
126 126
 			FROM spotter_live
127 127
 			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.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao';
128 128
 		}
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 		try {
133 133
 			$sth = $this->db->prepare($query);
134 134
 			$sth->execute();
135
-		} catch(PDOException $e) {
135
+		} catch (PDOException $e) {
136 136
 			echo $e->getMessage();
137 137
 			die;
138 138
 		}
@@ -152,12 +152,12 @@  discard block
 block discarded – undo
152 152
 		global $globalDBdriver, $globalLiveInterval;
153 153
 		date_default_timezone_set('UTC');
154 154
 
155
-		$filter_query = $this->getFilter($filter,true,true);
155
+		$filter_query = $this->getFilter($filter, true, true);
156 156
 
157 157
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
158 158
 		if ($globalDBdriver == 'mysql') {
159 159
 
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 
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 163
                 } else {
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 			FROM spotter_live WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date 
167 167
 			".$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';
168 168
 */
169
-			$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 
169
+			$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 
170 170
 			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 
171 171
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
172 172
 //			echo $query;
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
     		try {
176 176
 			$sth = $this->db->prepare($query);
177 177
 			$sth->execute();
178
-		} catch(PDOException $e) {
178
+		} catch (PDOException $e) {
179 179
 			echo $e->getMessage();
180 180
 			die;
181 181
 		}
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 		try {
206 206
 			$sth = $this->db->prepare($query);
207 207
 			$sth->execute();
208
-		} catch(PDOException $e) {
208
+		} catch (PDOException $e) {
209 209
 			echo $e->getMessage();
210 210
 			die;
211 211
 		}
@@ -227,10 +227,10 @@  discard block
 block discarded – undo
227 227
 		$filter_query = $this->getFilter($filter);
228 228
 
229 229
 		if (is_array($coord)) {
230
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
231
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
232
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
233
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
230
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
231
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
232
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
233
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
234 234
 		} else return array();
235 235
 		if ($globalDBdriver == 'mysql') {
236 236
 			//$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.")";
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
                 if ($interval == '1m')
284 284
                 {
285 285
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
286
-                } else if ($interval == '15m'){
286
+                } else if ($interval == '15m') {
287 287
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
288 288
                 } 
289 289
             }
@@ -291,14 +291,14 @@  discard block
 block discarded – undo
291 291
          $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
292 292
         }
293 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 
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 303
                 return $spotter_array;
304 304
         }
@@ -316,9 +316,9 @@  discard block
 block discarded – undo
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
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident));
321
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident));
322 322
 
323 323
 		return $spotter_array;
324 324
 	}
@@ -329,16 +329,16 @@  discard block
 block discarded – undo
329 329
 	* @return Array the spotter information
330 330
 	*
331 331
 	*/
332
-	public function getDateLiveSpotterDataByIdent($ident,$date)
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);
341
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
340
+                $date = date('c', $date);
341
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
342 342
 
343 343
 		return $spotter_array;
344 344
 	}
@@ -355,9 +355,9 @@  discard block
 block discarded – undo
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
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id));
360
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id));
361 361
 
362 362
 		return $spotter_array;
363 363
 	}
@@ -368,15 +368,15 @@  discard block
 block discarded – undo
368 368
 	* @return Array the spotter information
369 369
 	*
370 370
 	*/
371
-	public function getDateLiveSpotterDataById($id,$date)
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);
379
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $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
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date));
380 380
 
381 381
 		return $spotter_array;
382 382
 	}
@@ -393,13 +393,13 @@  discard block
 block discarded – undo
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 398
     		try {
399 399
 			
400 400
 			$sth = $this->db->prepare($query);
401 401
 			$sth->execute(array(':ident' => $ident));
402
-		} catch(PDOException $e) {
402
+		} catch (PDOException $e) {
403 403
 			echo $e->getMessage();
404 404
 			die;
405 405
 		}
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 	* @return Array the spotter information
415 415
 	*
416 416
 	*/
417
-	public function getAllLiveSpotterDataById($id,$liveinterval = false)
417
+	public function getAllLiveSpotterDataById($id, $liveinterval = false)
418 418
 	{
419 419
 		global $globalDBdriver, $globalLiveInterval;
420 420
 		date_default_timezone_set('UTC');
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 		try {
434 434
 			$sth = $this->db->prepare($query);
435 435
 			$sth->execute(array(':id' => $id));
436
-		} catch(PDOException $e) {
436
+		} catch (PDOException $e) {
437 437
 			echo $e->getMessage();
438 438
 			die;
439 439
 		}
@@ -451,12 +451,12 @@  discard block
 block discarded – undo
451 451
 	{
452 452
 		date_default_timezone_set('UTC');
453 453
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
454
-		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
454
+		$query = self::$global_query.' WHERE spotter_live.ident = :ident';
455 455
     		try {
456 456
 			
457 457
 			$sth = $this->db->prepare($query);
458 458
 			$sth->execute(array(':ident' => $ident));
459
-		} catch(PDOException $e) {
459
+		} catch (PDOException $e) {
460 460
 			echo $e->getMessage();
461 461
 			die;
462 462
 		}
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
 			
487 487
 			$sth = $this->db->prepare($query);
488 488
 			$sth->execute();
489
-		} catch(PDOException $e) {
489
+		} catch (PDOException $e) {
490 490
 			return "error";
491 491
 		}
492 492
 
@@ -509,14 +509,14 @@  discard block
 block discarded – undo
509 509
 				
510 510
 				$sth = $this->db->prepare($query);
511 511
 				$sth->execute();
512
-			} catch(PDOException $e) {
512
+			} catch (PDOException $e) {
513 513
 				return "error";
514 514
 			}
515 515
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
516 516
                         $i = 0;
517
-                        $j =0;
517
+                        $j = 0;
518 518
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
519
-			foreach($all as $row)
519
+			foreach ($all as $row)
520 520
 			{
521 521
 				$i++;
522 522
 				$j++;
@@ -524,9 +524,9 @@  discard block
 block discarded – undo
524 524
 					if ($globalDebug) echo ".";
525 525
 				    	try {
526 526
 						
527
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
527
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
528 528
 						$sth->execute();
529
-					} catch(PDOException $e) {
529
+					} catch (PDOException $e) {
530 530
 						return "error";
531 531
 					}
532 532
                                 	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
@@ -537,9 +537,9 @@  discard block
 block discarded – undo
537 537
 			if ($i > 0) {
538 538
     				try {
539 539
 					
540
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
540
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
541 541
 					$sth->execute();
542
-				} catch(PDOException $e) {
542
+				} catch (PDOException $e) {
543 543
 					return "error";
544 544
 				}
545 545
 			}
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 				
553 553
 				$sth = $this->db->prepare($query);
554 554
 				$sth->execute();
555
-			} catch(PDOException $e) {
555
+			} catch (PDOException $e) {
556 556
 				return "error";
557 557
 			}
558 558
 /*			$query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN (";
@@ -600,13 +600,13 @@  discard block
 block discarded – undo
600 600
 	public function deleteLiveSpotterDataByIdent($ident)
601 601
 	{
602 602
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
603
-		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
603
+		$query = 'DELETE FROM spotter_live WHERE ident = :ident';
604 604
         
605 605
     		try {
606 606
 			
607 607
 			$sth = $this->db->prepare($query);
608 608
 			$sth->execute(array(':ident' => $ident));
609
-		} catch(PDOException $e) {
609
+		} catch (PDOException $e) {
610 610
 			return "error";
611 611
 		}
612 612
 
@@ -622,13 +622,13 @@  discard block
 block discarded – undo
622 622
 	public function deleteLiveSpotterDataById($id)
623 623
 	{
624 624
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
625
-		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
625
+		$query = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
626 626
         
627 627
     		try {
628 628
 			
629 629
 			$sth = $this->db->prepare($query);
630 630
 			$sth->execute(array(':id' => $id));
631
-		} catch(PDOException $e) {
631
+		} catch (PDOException $e) {
632 632
 			return "error";
633 633
 		}
634 634
 
@@ -646,13 +646,13 @@  discard block
 block discarded – undo
646 646
 	{
647 647
 		global $globalDBdriver, $globalTimezone;
648 648
 		if ($globalDBdriver == 'mysql') {
649
-			$query  = 'SELECT spotter_live.ident FROM spotter_live 
649
+			$query = 'SELECT spotter_live.ident FROM spotter_live 
650 650
 				WHERE spotter_live.ident = :ident 
651 651
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
652 652
 				AND spotter_live.date < UTC_TIMESTAMP()';
653 653
 			$query_data = array(':ident' => $ident);
654 654
 		} else {
655
-			$query  = "SELECT spotter_live.ident FROM spotter_live 
655
+			$query = "SELECT spotter_live.ident FROM spotter_live 
656 656
 				WHERE spotter_live.ident = :ident 
657 657
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
658 658
 				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -661,8 +661,8 @@  discard block
 block discarded – undo
661 661
 		
662 662
 		$sth = $this->db->prepare($query);
663 663
 		$sth->execute($query_data);
664
-		$ident_result='';
665
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
664
+		$ident_result = '';
665
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
666 666
 		{
667 667
 			$ident_result = $row['ident'];
668 668
 		}
@@ -679,13 +679,13 @@  discard block
 block discarded – undo
679 679
 	{
680 680
 		global $globalDBdriver, $globalTimezone;
681 681
 		if ($globalDBdriver == 'mysql') {
682
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
682
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
683 683
 				WHERE spotter_live.ident = :ident 
684 684
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
685 685
 //				AND spotter_live.date < UTC_TIMESTAMP()";
686 686
 			$query_data = array(':ident' => $ident);
687 687
 		} else {
688
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
688
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
689 689
 				WHERE spotter_live.ident = :ident 
690 690
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'";
691 691
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -694,8 +694,8 @@  discard block
 block discarded – undo
694 694
 		
695 695
 		$sth = $this->db->prepare($query);
696 696
 		$sth->execute($query_data);
697
-		$ident_result='';
698
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
697
+		$ident_result = '';
698
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
699 699
 		{
700 700
 			$ident_result = $row['flightaware_id'];
701 701
 		}
@@ -712,13 +712,13 @@  discard block
 block discarded – undo
712 712
 	{
713 713
 		global $globalDBdriver, $globalTimezone;
714 714
 		if ($globalDBdriver == 'mysql') {
715
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
715
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
716 716
 				WHERE spotter_live.flightaware_id = :id 
717 717
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
718 718
 //				AND spotter_live.date < UTC_TIMESTAMP()";
719 719
 			$query_data = array(':id' => $id);
720 720
 		} else {
721
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
721
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
722 722
 				WHERE spotter_live.flightaware_id = :id 
723 723
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
724 724
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -727,8 +727,8 @@  discard block
 block discarded – undo
727 727
 		
728 728
 		$sth = $this->db->prepare($query);
729 729
 		$sth->execute($query_data);
730
-		$ident_result='';
731
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
730
+		$ident_result = '';
731
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
732 732
 		{
733 733
 			$ident_result = $row['flightaware_id'];
734 734
 		}
@@ -745,13 +745,13 @@  discard block
 block discarded – undo
745 745
 	{
746 746
 		global $globalDBdriver, $globalTimezone;
747 747
 		if ($globalDBdriver == 'mysql') {
748
-			$query  = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
748
+			$query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
749 749
 				WHERE spotter_live.ModeS = :modes 
750 750
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
751 751
 //				AND spotter_live.date < UTC_TIMESTAMP()";
752 752
 			$query_data = array(':modes' => $modes);
753 753
 		} else {
754
-			$query  = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
754
+			$query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
755 755
 				WHERE spotter_live.ModeS = :modes 
756 756
 				AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '30 MINUTE'";
757 757
 //			//	AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
@@ -760,8 +760,8 @@  discard block
 block discarded – undo
760 760
 		
761 761
 		$sth = $this->db->prepare($query);
762 762
 		$sth->execute($query_data);
763
-		$ident_result='';
764
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
763
+		$ident_result = '';
764
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
765 765
 		{
766 766
 			//$ident_result = $row['spotter_live_id'];
767 767
 			$ident_result = $row['flightaware_id'];
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
 	* @return String success or false
781 781
 	*
782 782
 	*/
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 = '')
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;
786 786
 		$Common = new Common();
@@ -874,26 +874,26 @@  discard block
 block discarded – undo
874 874
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
875 875
 
876 876
         
877
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
878
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
879
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
880
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
881
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
882
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
883
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
884
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
885
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
886
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
887
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
888
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
889
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
890
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
891
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
892
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
893
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
894
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
895
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
896
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
877
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
878
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
879
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
880
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
881
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
882
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
883
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
884
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
885
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
886
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
887
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
888
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
889
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
890
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
891
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
892
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
893
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
894
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
895
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
896
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
897 897
 
898 898
 		$airline_name = '';
899 899
 		$airline_icao = '';
@@ -915,26 +915,26 @@  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
-		$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) 
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)';
925 925
 
926
-		$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);
926
+		$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);
927 927
 		//$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);
928 928
 		try {
929 929
 			
930 930
 			$sth = $this->db->prepare($query);
931 931
 			$sth->execute($query_values);
932
-                } catch(PDOException $e) {
932
+                } catch (PDOException $e) {
933 933
                 	return "error : ".$e->getMessage();
934 934
                 }
935 935
 		if (isset($globalArchive) && $globalArchive && $putinarchive && !$noarchive) {
936 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);
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 938
 		    if ($globalDebug) echo $result.')';
939 939
 		}
940 940
 		return "success";
@@ -943,7 +943,7 @@  discard block
 block discarded – undo
943 943
 
944 944
 	public function getOrderBy()
945 945
 	{
946
-		$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"));
946
+		$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"));
947 947
 		return $orderby;
948 948
 	}
949 949
 
Please login to merge, or discard this patch.
Braces   +65 added lines, -22 removed lines patch added patch discarded remove patch
@@ -18,7 +18,9 @@  discard block
 block discarded – undo
18 18
 	*/
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter;
21
-		if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter);
21
+		if (is_array($globalFilter)) {
22
+			$filter = array_merge($globalFilter,$filter);
23
+		}
22 24
 		$filter_query_join = '';
23 25
 		$filter_query_where = '';
24 26
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
@@ -43,8 +45,11 @@  discard block
 block discarded – undo
43 45
 				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
44 46
 			}
45 47
 		}
46
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
47
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
48
+		if ($filter_query_where == '' && $where) {
49
+			$filter_query_where = ' WHERE';
50
+		} elseif ($filter_query_where != '' && $and) {
51
+			$filter_query_where .= ' AND';
52
+		}
48 53
 		$filter_query = $filter_query_join.$filter_query_where;
49 54
 		return $filter_query;
50 55
 	}
@@ -80,7 +85,9 @@  discard block
 block discarded – undo
80 85
 			$orderby_query = ' '.$search_orderby_array[$sort]['sql'];
81 86
 		}
82 87
 
83
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
88
+		if (!isset($globalLiveInterval)) {
89
+			$globalLiveInterval = '200';
90
+		}
84 91
 		if ($globalDBdriver == 'mysql') {
85 92
 			//$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";
86 93
 			$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;
@@ -105,7 +112,9 @@  discard block
 block discarded – undo
105 112
 
106 113
 		$filter_query = $this->getFilter($filter);
107 114
 
108
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
115
+		if (!isset($globalLiveInterval)) {
116
+			$globalLiveInterval = '200';
117
+		}
109 118
 		if ($globalDBdriver == 'mysql') {
110 119
 //			$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";
111 120
 //			$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';
@@ -154,7 +163,9 @@  discard block
 block discarded – undo
154 163
 
155 164
 		$filter_query = $this->getFilter($filter,true,true);
156 165
 
157
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
166
+		if (!isset($globalLiveInterval)) {
167
+			$globalLiveInterval = '200';
168
+		}
158 169
 		if ($globalDBdriver == 'mysql') {
159 170
 
160 171
 			$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 
@@ -194,7 +205,9 @@  discard block
 block discarded – undo
194 205
 		global $globalDBdriver, $globalLiveInterval;
195 206
 		$filter_query = $this->getFilter($filter);
196 207
 
197
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
208
+		if (!isset($globalLiveInterval)) {
209
+			$globalLiveInterval = '200';
210
+		}
198 211
 		if ($globalDBdriver == 'mysql') {
199 212
 			//$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;
200 213
 			$query = 'SELECT COUNT(DISTINCT flightaware_id) as nb FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'.$filter_query;
@@ -223,7 +236,9 @@  discard block
 block discarded – undo
223 236
 	{
224 237
 		global $globalDBdriver, $globalLiveInterval;
225 238
 		$Spotter = new Spotter($this->db);
226
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
239
+		if (!isset($globalLiveInterval)) {
240
+			$globalLiveInterval = '200';
241
+		}
227 242
 		$filter_query = $this->getFilter($filter);
228 243
 
229 244
 		if (is_array($coord)) {
@@ -231,7 +246,9 @@  discard block
 block discarded – undo
231 246
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
232 247
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
233 248
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
234
-		} else return array();
249
+		} else {
250
+			return array();
251
+		}
235 252
 		if ($globalDBdriver == 'mysql') {
236 253
 			//$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.")";
237 254
 			$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;
@@ -422,11 +439,15 @@  discard block
 block discarded – undo
422 439
 		//$query  = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date';
423 440
 		if ($globalDBdriver == 'mysql') {
424 441
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
425
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
442
+			if ($liveinterval) {
443
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
444
+			}
426 445
 			$query .= ' ORDER BY date';
427 446
 		} else {
428 447
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
429
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
448
+			if ($liveinterval) {
449
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
450
+			}
430 451
 			$query .= ' ORDER BY date';
431 452
 		}
432 453
 
@@ -521,7 +542,9 @@  discard block
 block discarded – undo
521 542
 				$i++;
522 543
 				$j++;
523 544
 				if ($j == 30) {
524
-					if ($globalDebug) echo ".";
545
+					if ($globalDebug) {
546
+						echo ".";
547
+					}
525 548
 				    	try {
526 549
 						
527 550
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -853,7 +876,9 @@  discard block
 block discarded – undo
853 876
 			{
854 877
 				return false;
855 878
 			}
856
-		} else $altitude = 0;
879
+		} else {
880
+			$altitude = 0;
881
+		}
857 882
 
858 883
 		if ($heading != '')
859 884
 		{
@@ -861,7 +886,9 @@  discard block
 block discarded – undo
861 886
 			{
862 887
 				return false;
863 888
 			}
864
-		} else $heading = 0;
889
+		} else {
890
+			$heading = 0;
891
+		}
865 892
 
866 893
 		if ($groundspeed != '')
867 894
 		{
@@ -869,9 +896,13 @@  discard block
 block discarded – undo
869 896
 			{
870 897
 				return false;
871 898
 			}
872
-		} else $groundspeed = 0;
899
+		} else {
900
+			$groundspeed = 0;
901
+		}
873 902
 		date_default_timezone_set('UTC');
874
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
903
+		if ($date == '') {
904
+			$date = date("Y-m-d H:i:s", time());
905
+		}
875 906
 
876 907
         
877 908
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -915,10 +946,18 @@  discard block
 block discarded – undo
915 946
 		$arrival_airport_country = '';
916 947
 		
917 948
             	
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;
949
+            	if ($squawk == '' || $Common->isInteger($squawk) === false ) {
950
+            		$squawk = NULL;
951
+            	}
952
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) {
953
+            		$verticalrate = NULL;
954
+            	}
955
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
956
+            		$groundspeed = 0;
957
+            	}
958
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
959
+            		$heading = 0;
960
+            	}
922 961
             	
923 962
 		$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 963
 		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)';
@@ -933,9 +972,13 @@  discard block
 block discarded – undo
933 972
                 	return "error : ".$e->getMessage();
934 973
                 }
935 974
 		if (isset($globalArchive) && $globalArchive && $putinarchive && !$noarchive) {
936
-		    if ($globalDebug) echo '(Add to SBS archive : ';
975
+		    if ($globalDebug) {
976
+		    	echo '(Add to SBS archive : ';
977
+		    }
937 978
 		    $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.')';
979
+		    if ($globalDebug) {
980
+		    	echo $result.')';
981
+		    }
939 982
 		}
940 983
 		return "success";
941 984
 
Please login to merge, or discard this patch.
statistics.php 3 patches
Braces   +50 added lines, -29 removed lines patch added patch discarded remove patch
@@ -9,8 +9,10 @@  discard block
 block discarded – undo
9 9
 
10 10
 $airline_icao = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
11 11
 if ($airline_icao == '' && isset($globalFilter)) {
12
-	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13
-}
12
+	if (isset($globalFilter['airline'])) {
13
+		$airline_icao = $globalFilter['airline'][0];
14
+	}
15
+	}
14 16
 
15 17
 ?>
16 18
 <script type="text/javascript" src="https://www.google.com/jsapi"></script>
@@ -28,7 +30,9 @@  discard block
 block discarded – undo
28 30
 	if (isset($last_update[0]['value'])) {
29 31
 		date_default_timezone_set('UTC');
30 32
 		$lastupdate = strtotime($last_update[0]['value']);
31
-		if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
33
+		if (isset($globalTimezone) && $globalTimezone != '') {
34
+			date_default_timezone_set($globalTimezone);
35
+		}
32 36
 		print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
33 37
 	}
34 38
     ?>
@@ -81,8 +85,9 @@  discard block
 block discarded – undo
81 85
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
82 86
                  <?php
83 87
                   $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao);
84
-		    if (count($aircraft_array) == 0) print _("No data available");
85
-		    else {
88
+		    if (count($aircraft_array) == 0) {
89
+		    	print _("No data available");
90
+		    } else {
86 91
 
87 92
                     print '<div id="chart1" class="chart" width="100%"></div>
88 93
                     <script> 
@@ -127,8 +132,9 @@  discard block
 block discarded – undo
127 132
                 <h2><?php echo _("Top 10 Most Common Airline"); ?></h2>
128 133
                  <?php
129 134
                   $airline_array = $Stats->countAllAirlines();
130
-		    if (count($airline_array) == 0) print _("No data available");
131
-		    else {
135
+		    if (count($airline_array) == 0) {
136
+		    	print _("No data available");
137
+		    } else {
132 138
 
133 139
                   print '<div id="chart2" class="chart" width="100%"></div>
134 140
                     <script> 
@@ -189,8 +195,9 @@  discard block
 block discarded – undo
189 195
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
190 196
                  <?php
191 197
                   $pilot_array = $Stats->countAllPilots(true,$airline_icao);
192
-		    if (count($pilot_array) == 0) print _("No data available");
193
-		    else {
198
+		    if (count($pilot_array) == 0) {
199
+		    	print _("No data available");
200
+		    } else {
194 201
 
195 202
                   print '<div id="chart7" class="chart" width="100%"></div>
196 203
                     <script> 
@@ -236,8 +243,9 @@  discard block
 block discarded – undo
236 243
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
237 244
                  <?php
238 245
                   $owner_array = $Stats->countAllOwners(true,$airline_icao);
239
-		    if (count($owner_array) == 0) print _("No data available");
240
-		    else {
246
+		    if (count($owner_array) == 0) {
247
+		    	print _("No data available");
248
+		    } else {
241 249
 
242 250
                   print '<div id="chart7" class="chart" width="100%"></div>
243 251
                     <script> 
@@ -286,8 +294,9 @@  discard block
 block discarded – undo
286 294
                 <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2>
287 295
                  <?php
288 296
                   //$flightover_array = $Stats->countAllFlightOverCountries();
289
-		    if (count($flightover_array) == 0) print _("No data available");
290
-		    else {
297
+		    if (count($flightover_array) == 0) {
298
+		    	print _("No data available");
299
+		    } else {
291 300
 
292 301
                   print '<div id="chart10" class="chart" width="100%"></div>
293 302
                     <script> 
@@ -339,8 +348,9 @@  discard block
 block discarded – undo
339 348
                 <h2><?php echo _("Top 10 Most Common Departure Airports"); ?></h2>
340 349
                 <?php
341 350
                 $airport_airport_array = $Stats->countAllDepartureAirports($airline_icao);
342
-		    if (count($airport_airport_array) == 0) print _("No data available");
343
-		    else {
351
+		    if (count($airport_airport_array) == 0) {
352
+		    	print _("No data available");
353
+		    } else {
344 354
 
345 355
                  print '<div id="chart3" class="chart" width="100%"></div>
346 356
                 <script>
@@ -389,8 +399,9 @@  discard block
 block discarded – undo
389 399
                 <h2><?php echo _("Top 10 Most Common Arrival Airports"); ?></h2>
390 400
                 <?php
391 401
                 $airport_airport_array2 = $Stats->countAllArrivalAirports($airline_icao);
392
-		    if (count($airport_airport_array2) == 0) print _("No data available");
393
-		    else {
402
+		    if (count($airport_airport_array2) == 0) {
403
+		    	print _("No data available");
404
+		    } else {
394 405
 
395 406
                 print '<div id="chart4" class="chart" width="100%"></div>
396 407
                 <script>
@@ -441,8 +452,9 @@  discard block
 block discarded – undo
441 452
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
442 453
                 <?php
443 454
                   $year_array = $Stats->countAllMonthsLastYear($airline_icao);
444
-		    if (count($year_array) == 0) print _("No data available");
445
-		    else {
455
+		    if (count($year_array) == 0) {
456
+		    	print _("No data available");
457
+		    } else {
446 458
                   print '<div id="chart8" class="chart" width="100%"></div>
447 459
                     <script> 
448 460
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -487,8 +499,9 @@  discard block
 block discarded – undo
487 499
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
488 500
                 <?php
489 501
                   $month_array = $Stats->countAllDatesLastMonth($airline_icao);
490
-		    if (count($month_array) == 0) print _("No data available");
491
-		    else {
502
+		    if (count($month_array) == 0) {
503
+		    	print _("No data available");
504
+		    } else {
492 505
                   print '<div id="chart9" class="chart" width="100%"></div>
493 506
                     <script> 
494 507
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -533,8 +546,9 @@  discard block
 block discarded – undo
533 546
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
534 547
                 <?php
535 548
                     $date_array = $Stats->countAllDatesLast7Days($airline_icao);
536
-		    if (empty($date_array)) print _("No data available");
537
-		    else {
549
+		    if (empty($date_array)) {
550
+		    	print _("No data available");
551
+		    } else {
538 552
                   print '<div id="chart5" class="chart" width="100%"></div>
539 553
                     <script> 
540 554
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -580,8 +594,9 @@  discard block
 block discarded – undo
580 594
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
581 595
                 <?php
582 596
                   $hour_array = $Stats->countAllHours('hour',$airline_icao);
583
-		    if (empty($hour_array)) print _("No data available");
584
-		    else {
597
+		    if (empty($hour_array)) {
598
+		    	print _("No data available");
599
+		    } else {
585 600
 
586 601
                   print '<div id="chart6" class="chart" width="100%"></div>
587 602
                     <script> 
@@ -649,8 +664,11 @@  discard block
 block discarded – undo
649 664
 					$distance = $distance;
650 665
 					$unit = 'km';
651 666
 				}
652
-        			if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
653
-        	    		else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
667
+        			if (!isset($polar_data)) {
668
+        				$polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
669
+        			} else {
670
+        	    			$polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
671
+        	    		}
654 672
         		    }
655 673
         	?>
656 674
             <div class="col-md-6">
@@ -697,8 +715,11 @@  discard block
 block discarded – undo
697 715
         		foreach ($msg as $eachmsg) {
698 716
         		    //$eachmsg = $msg[0];
699 717
         		    $data = $eachmsg['source_data'];
700
-        		    if ($data > 500) $max = (round(($data+100)/100))*100;
701
-        		    else $max = 500;
718
+        		    if ($data > 500) {
719
+        		    	$max = (round(($data+100)/100))*100;
720
+        		    } else {
721
+        		    	$max = 500;
722
+        		    }
702 723
         	?>
703 724
         	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
704 725
         	<script>
Please login to merge, or discard this patch.
Indentation   +224 added lines, -224 removed lines patch added patch discarded remove patch
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 		if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
32 32
 		print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
33 33
 	}
34
-    ?>
34
+	?>
35 35
     </div>
36 36
     <?php    
37 37
 	// print_r($Stats->getAllAirlineNames()); 
38
-    ?>
38
+	?>
39 39
     <?php include('statistics-sub-menu.php'); ?>
40 40
     <div class="row global-stats">
41 41
         <div class="col-md-2"><span class="type"><?php echo _("Flights"); ?></span><span><?php print number_format($Stats->countOverallFlights($airline_icao)); ?></span></div> 
@@ -43,23 +43,23 @@  discard block
 block discarded – undo
43 43
         <div class="col-md-2"><span class="type"><?php echo _("Arrivals seen"); ?></span><span><?php print number_format($Stats->countOverallArrival($airline_icao)); ?></span></div> 
44 44
         <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
45 45
 	<?php
46
-	    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
46
+		if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
47 47
 	?>
48 48
     	    <div class="col-md-2"><span class="type"><?php echo _("Pilots"); ?></span><span><?php print number_format($Stats->countOverallPilots($airline_icao)); ?></span></div> 
49 49
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
50 50
         <?php
51
-    	    } else {
52
-    	?>
51
+			} else {
52
+		?>
53 53
     	    <div class="col-md-2"><span class="type"><?php echo _("Owners"); ?></span><span><?php print number_format($Stats->countOverallOwners($airline_icao)); ?></span></div> 
54 54
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
55 55
     	<?php
56
-    	    }
57
-    	?>
56
+			}
57
+		?>
58 58
         <div class="col-md-2"><span class="type"><?php echo _("Aircrafts"); ?></span><span><?php print number_format($Stats->countOverallAircrafts($airline_icao)); ?></span></div> 
59 59
         <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
60 60
         <?php
61
-    		if ($airline_icao == '') {
62
-    	?>
61
+			if ($airline_icao == '') {
62
+		?>
63 63
         <div class="col-md-2"><span class="type"><?php echo _("Airlines"); ?></span><span><?php print number_format($Stats->countOverallAirlines()); ?></span></div>
64 64
 	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
65 65
 	<?php
@@ -80,25 +80,25 @@  discard block
 block discarded – undo
80 80
             <div class="col-md-6">
81 81
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
82 82
                  <?php
83
-                  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao);
84
-		    if (count($aircraft_array) == 0) print _("No data available");
85
-		    else {
83
+				  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao);
84
+			if (count($aircraft_array) == 0) print _("No data available");
85
+			else {
86 86
 
87
-                    print '<div id="chart1" class="chart" width="100%"></div>
87
+					print '<div id="chart1" class="chart" width="100%"></div>
88 88
                     <script> 
89 89
                         google.load("visualization", "1", {packages:["corechart"]});
90 90
                       google.setOnLoadCallback(drawChart1);
91 91
                       function drawChart1() {
92 92
                         var data = google.visualization.arrayToDataTable([
93 93
                             ["'._("Aircraft").'", "'._("# of times").'"], ';
94
-                            $aircraft_data = '';
95
-                          foreach($aircraft_array as $aircraft_item)
96
-                                    {
97
-                                            $aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
98
-                                    }
99
-                                    $aircraft_data = substr($aircraft_data, 0, -1);
100
-                                    print $aircraft_data;
101
-                        print ']);
94
+							$aircraft_data = '';
95
+						  foreach($aircraft_array as $aircraft_item)
96
+									{
97
+											$aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
98
+									}
99
+									$aircraft_data = substr($aircraft_data, 0, -1);
100
+									print $aircraft_data;
101
+						print ']);
102 102
 
103 103
                         var options = {
104 104
                             chartArea: {"width": "80%", "height": "60%"},
@@ -113,38 +113,38 @@  discard block
 block discarded – undo
113 113
                               drawChart1();
114 114
                             });
115 115
                   </script>';
116
-                  }
117
-                  ?>
116
+				  }
117
+				  ?>
118 118
                 <div class="more">
119 119
                     <a href="<?php print $globalURL; ?>/statistics/aircraft" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
120 120
                 </div>
121 121
             </div>
122 122
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
123 123
 <?php
124
-    if ($airline_icao == '') {
124
+	if ($airline_icao == '') {
125 125
 ?>
126 126
             <div class="col-md-6">
127 127
                 <h2><?php echo _("Top 10 Most Common Airline"); ?></h2>
128 128
                  <?php
129
-                  $airline_array = $Stats->countAllAirlines();
130
-		    if (count($airline_array) == 0) print _("No data available");
131
-		    else {
129
+				  $airline_array = $Stats->countAllAirlines();
130
+			if (count($airline_array) == 0) print _("No data available");
131
+			else {
132 132
 
133
-                  print '<div id="chart2" class="chart" width="100%"></div>
133
+				  print '<div id="chart2" class="chart" width="100%"></div>
134 134
                     <script> 
135 135
                         google.load("visualization", "1", {packages:["corechart"]});
136 136
                       google.setOnLoadCallback(drawChart2);
137 137
                       function drawChart2() {
138 138
                         var data = google.visualization.arrayToDataTable([
139 139
                             ["'._("Airline").'", "'._("# of times").'"], ';
140
-                            $airline_data = '';
141
-                          foreach($airline_array as $airline_item)
142
-                                    {
143
-                                            $airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
144
-                                    }
145
-                                    $airline_data = substr($airline_data, 0, -1);
146
-                                    print $airline_data;
147
-                        print ']);
140
+							$airline_data = '';
141
+						  foreach($airline_array as $airline_item)
142
+									{
143
+											$airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
144
+									}
145
+									$airline_data = substr($airline_data, 0, -1);
146
+									print $airline_data;
147
+						print ']);
148 148
 
149 149
                         var options = {
150 150
                             chartArea: {"width": "80%", "height": "60%"},
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
                               drawChart2();
160 160
                             });
161 161
                   </script>';
162
-                  }
163
-                  ?>
162
+				  }
163
+				  ?>
164 164
                 <div class="more">
165 165
                     <a href="<?php print $globalURL; ?>/statistics/airline" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
166 166
                 </div>
@@ -168,44 +168,44 @@  discard block
 block discarded – undo
168 168
         </div>
169 169
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
170 170
 <?php
171
-    }
171
+	}
172 172
 ?>
173 173
         <div class="row column">
174 174
 
175 175
 	    <?php
176
-                 $flightover_array = $Stats->countAllFlightOverCountries($airline_icao);
176
+				 $flightover_array = $Stats->countAllFlightOverCountries($airline_icao);
177 177
 		if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
178
-		    if (empty($flightover_array)) {
179
-	    ?>
178
+			if (empty($flightover_array)) {
179
+		?>
180 180
             <div class="col-md-12">
181 181
             <?php
182
-        	    } else {
183
-            ?>
182
+				} else {
183
+			?>
184 184
             <div class="col-md-6">
185 185
             <?php
186
-            	    }
187
-            ?>
186
+					}
187
+			?>
188 188
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
189 189
                  <?php
190
-                  $pilot_array = $Stats->countAllPilots(true,$airline_icao);
191
-		    if (count($pilot_array) == 0) print _("No data available");
192
-		    else {
190
+				  $pilot_array = $Stats->countAllPilots(true,$airline_icao);
191
+			if (count($pilot_array) == 0) print _("No data available");
192
+			else {
193 193
 
194
-                  print '<div id="chart7" class="chart" width="100%"></div>
194
+				  print '<div id="chart7" class="chart" width="100%"></div>
195 195
                     <script> 
196 196
                         google.load("visualization", "1", {packages:["corechart"]});
197 197
                       google.setOnLoadCallback(drawChart7);
198 198
                       function drawChart7() {
199 199
                         var data = google.visualization.arrayToDataTable([
200 200
                             ["'._("Pilots").'", "'._("# of times").'"], ';
201
-                            $pilot_data = '';
202
-                          foreach($pilot_array as $pilot_item)
203
-                                    {
204
-                                            $pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
205
-                                    }
206
-                                    $pilot_data = substr($pilot_data, 0, -1);
207
-                                    print $pilot_data;
208
-                        print ']);
201
+							$pilot_data = '';
202
+						  foreach($pilot_array as $pilot_item)
203
+									{
204
+											$pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
205
+									}
206
+									$pilot_data = substr($pilot_data, 0, -1);
207
+									print $pilot_data;
208
+						print ']);
209 209
 
210 210
                         var options = {
211 211
                             chartArea: {"width": "80%", "height": "60%"},
@@ -220,8 +220,8 @@  discard block
 block discarded – undo
220 220
                               drawChart7();
221 221
                             });
222 222
                   </script>';
223
-                  }
224
-                  ?>
223
+				  }
224
+				  ?>
225 225
                 <div class="more">
226 226
                     <a href="<?php print $globalURL; ?>/statistics/pilot" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
227 227
                 </div>
@@ -229,30 +229,30 @@  discard block
 block discarded – undo
229 229
         
230 230
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
231 231
         <?php
232
-    	    } else {
233
-    	?>
232
+			} else {
233
+		?>
234 234
             <div class="col-md-6">
235 235
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
236 236
                  <?php
237
-                  $owner_array = $Stats->countAllOwners(true,$airline_icao);
238
-		    if (count($owner_array) == 0) print _("No data available");
239
-		    else {
237
+				  $owner_array = $Stats->countAllOwners(true,$airline_icao);
238
+			if (count($owner_array) == 0) print _("No data available");
239
+			else {
240 240
 
241
-                  print '<div id="chart7" class="chart" width="100%"></div>
241
+				  print '<div id="chart7" class="chart" width="100%"></div>
242 242
                     <script> 
243 243
                         google.load("visualization", "1", {packages:["corechart"]});
244 244
                       google.setOnLoadCallback(drawChart7);
245 245
                       function drawChart7() {
246 246
                         var data = google.visualization.arrayToDataTable([
247 247
                             ["'._("Owner").'", "'._("# of times").'"], ';
248
-                            $owner_data = '';
249
-                          foreach($owner_array as $owner_item)
250
-                                    {
251
-                                            $owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
252
-                                    }
253
-                                    $owner_data = substr($owner_data, 0, -1);
254
-                                    print $owner_data;
255
-                        print ']);
248
+							$owner_data = '';
249
+						  foreach($owner_array as $owner_item)
250
+									{
251
+											$owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
252
+									}
253
+									$owner_data = substr($owner_data, 0, -1);
254
+									print $owner_data;
255
+						print ']);
256 256
 
257 257
                         var options = {
258 258
                             chartArea: {"width": "80%", "height": "60%"},
@@ -267,8 +267,8 @@  discard block
 block discarded – undo
267 267
                               drawChart7();
268 268
                             });
269 269
                   </script>';
270
-                  }
271
-                  ?>
270
+				  }
271
+				  ?>
272 272
                 <div class="more">
273 273
                     <a href="<?php print $globalURL; ?>/statistics/owner" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
274 274
                 </div>
@@ -276,32 +276,32 @@  discard block
 block discarded – undo
276 276
         
277 277
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
278 278
         <?php
279
-    	    }
280
-    	    if (!empty($flightover_array)) {
281
-    	?>
279
+			}
280
+			if (!empty($flightover_array)) {
281
+		?>
282 282
     	
283 283
             <div class="col-md-6">
284 284
                 <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2>
285 285
                  <?php
286
-                  //$flightover_array = $Stats->countAllFlightOverCountries();
287
-		    if (count($flightover_array) == 0) print _("No data available");
288
-		    else {
286
+				  //$flightover_array = $Stats->countAllFlightOverCountries();
287
+			if (count($flightover_array) == 0) print _("No data available");
288
+			else {
289 289
 
290
-                  print '<div id="chart10" class="chart" width="100%"></div>
290
+				  print '<div id="chart10" class="chart" width="100%"></div>
291 291
                     <script> 
292 292
                         google.load("visualization", "1", {packages:["corechart"]});
293 293
                       google.setOnLoadCallback(drawChart10);
294 294
                       function drawChart10() {
295 295
                         var data = google.visualization.arrayToDataTable([
296 296
                             ["'._("Country").'", "'._("# of times").'"], ';
297
-                            $flightover_data = '';
298
-                          foreach($flightover_array as $flightover_item)
299
-                                    {
300
-                                            $flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],';
301
-                                    }
302
-                                    $flightover_data = substr($flightover_data, 0, -1);
303
-                                    print $flightover_data;
304
-                        print ']);
297
+							$flightover_data = '';
298
+						  foreach($flightover_array as $flightover_item)
299
+									{
300
+											$flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],';
301
+									}
302
+									$flightover_data = substr($flightover_data, 0, -1);
303
+									print $flightover_data;
304
+						print ']);
305 305
 
306 306
                         var options = {
307 307
                             chartArea: {"width": "80%", "height": "60%"},
@@ -318,15 +318,15 @@  discard block
 block discarded – undo
318 318
                               drawChart10();
319 319
                             });
320 320
                   </script>';
321
-                  }
322
-                  ?>
321
+				  }
322
+				  ?>
323 323
                 <div class="more">
324 324
                     <a href="<?php print $globalURL; ?>/statistics/country" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
325 325
                 </div>
326 326
             </div>
327 327
         <?php
328
-            }
329
-        ?>
328
+			}
329
+		?>
330 330
         </div>
331 331
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
332 332
 
@@ -336,11 +336,11 @@  discard block
 block discarded – undo
336 336
             <div class="col-md-6">
337 337
                 <h2><?php echo _("Top 10 Most Common Departure Airports"); ?></h2>
338 338
                 <?php
339
-                $airport_airport_array = $Stats->countAllDepartureAirports($airline_icao);
340
-		    if (count($airport_airport_array) == 0) print _("No data available");
341
-		    else {
339
+				$airport_airport_array = $Stats->countAllDepartureAirports($airline_icao);
340
+			if (count($airport_airport_array) == 0) print _("No data available");
341
+			else {
342 342
 
343
-                 print '<div id="chart3" class="chart" width="100%"></div>
343
+				 print '<div id="chart3" class="chart" width="100%"></div>
344 344
                 <script>
345 345
                 google.load("visualization", "1", {packages:["geochart"]});
346 346
                 google.setOnLoadCallback(drawCharts3);
@@ -351,17 +351,17 @@  discard block
 block discarded – undo
351 351
 
352 352
                 var data = google.visualization.arrayToDataTable([ 
353 353
                     ["'._("Airport").'", "'._("# of times").'"],';
354
-                    $airport_data = '';
355
-                  foreach($airport_airport_array as $airport_item)
356
-                        {
357
-                            $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
358
-                            $name = str_replace("'", "", $name);
359
-                            $name = str_replace('"', "", $name);
360
-                            $airport_data .= '[ "'.$name.'",'.$airport_item['airport_departure_icao_count'].'],';
361
-                        }
362
-                        $airport_data = substr($airport_data, 0, -1);
363
-                        print $airport_data;
364
-                print ']);
354
+					$airport_data = '';
355
+				  foreach($airport_airport_array as $airport_item)
356
+						{
357
+							$name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
358
+							$name = str_replace("'", "", $name);
359
+							$name = str_replace('"', "", $name);
360
+							$airport_data .= '[ "'.$name.'",'.$airport_item['airport_departure_icao_count'].'],';
361
+						}
362
+						$airport_data = substr($airport_data, 0, -1);
363
+						print $airport_data;
364
+				print ']);
365 365
 
366 366
                 var options = {
367 367
                     legend: {position: "none"},
@@ -375,8 +375,8 @@  discard block
 block discarded – undo
375 375
                 chart.draw(data, options);
376 376
               }
377 377
                 </script>';
378
-                }
379
-              ?>
378
+				}
379
+			  ?>
380 380
               <div class="more">
381 381
                 <a href="<?php print $globalURL; ?>/statistics/airport-departure" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
382 382
               </div>
@@ -386,11 +386,11 @@  discard block
 block discarded – undo
386 386
             <div class="col-md-6">
387 387
                 <h2><?php echo _("Top 10 Most Common Arrival Airports"); ?></h2>
388 388
                 <?php
389
-                $airport_airport_array2 = $Stats->countAllArrivalAirports($airline_icao);
390
-		    if (count($airport_airport_array2) == 0) print _("No data available");
391
-		    else {
389
+				$airport_airport_array2 = $Stats->countAllArrivalAirports($airline_icao);
390
+			if (count($airport_airport_array2) == 0) print _("No data available");
391
+			else {
392 392
 
393
-                print '<div id="chart4" class="chart" width="100%"></div>
393
+				print '<div id="chart4" class="chart" width="100%"></div>
394 394
                 <script>
395 395
                 google.load("visualization", "1", {packages:["geochart"]});
396 396
                 google.setOnLoadCallback(drawCharts4);
@@ -401,17 +401,17 @@  discard block
 block discarded – undo
401 401
 
402 402
                 var data = google.visualization.arrayToDataTable([ 
403 403
                     ["'._("Airport").'", "'._("# of times").'"],';
404
-                    $airport_data2 = '';
405
-                  foreach($airport_airport_array2 as $airport_item2)
406
-                        {
407
-                            $name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')';
408
-                            $name2 = str_replace("'", "", $name2);
409
-                            $name2 = str_replace('"', "", $name2);
410
-                            $airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],';
411
-                        }
412
-                        $airport_data2 = substr($airport_data2, 0, -1);
413
-                        print $airport_data2;
414
-                print ']);
404
+					$airport_data2 = '';
405
+				  foreach($airport_airport_array2 as $airport_item2)
406
+						{
407
+							$name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')';
408
+							$name2 = str_replace("'", "", $name2);
409
+							$name2 = str_replace('"', "", $name2);
410
+							$airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],';
411
+						}
412
+						$airport_data2 = substr($airport_data2, 0, -1);
413
+						print $airport_data2;
414
+				print ']);
415 415
 
416 416
                 var options = {
417 417
                     legend: {position: "none"},
@@ -425,8 +425,8 @@  discard block
 block discarded – undo
425 425
                 chart.draw(data, options);
426 426
               }
427 427
                 </script>';
428
-                }
429
-              ?>
428
+				}
429
+			  ?>
430 430
               <div class="more">
431 431
                 <a href="<?php print $globalURL; ?>/statistics/airport-arrival" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
432 432
               </div>
@@ -438,24 +438,24 @@  discard block
 block discarded – undo
438 438
             <div class="col-md-6">
439 439
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
440 440
                 <?php
441
-                  $year_array = $Stats->countAllMonthsLastYear($airline_icao);
442
-		    if (count($year_array) == 0) print _("No data available");
443
-		    else {
444
-                  print '<div id="chart8" class="chart" width="100%"></div>
441
+				  $year_array = $Stats->countAllMonthsLastYear($airline_icao);
442
+			if (count($year_array) == 0) print _("No data available");
443
+			else {
444
+				  print '<div id="chart8" class="chart" width="100%"></div>
445 445
                     <script> 
446 446
                         google.load("visualization", "1", {packages:["corechart"]});
447 447
                       google.setOnLoadCallback(drawChart8);
448 448
                       function drawChart8() {
449 449
                         var data = google.visualization.arrayToDataTable([
450 450
                             ["'._("Month").'", "'._("# of Flights").'"], ';
451
-                            $year_data = '';
452
-                          foreach($year_array as $year_item)
453
-                                    {
454
-                                        $year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
455
-                                    }
456
-                                    $year_data = substr($year_data, 0, -1);
457
-                                    print $year_data;
458
-                        print ']);
451
+							$year_data = '';
452
+						  foreach($year_array as $year_item)
453
+									{
454
+										$year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
455
+									}
456
+									$year_data = substr($year_data, 0, -1);
457
+									print $year_data;
458
+						print ']);
459 459
 
460 460
                         var options = {
461 461
                             legend: {position: "none"},
@@ -473,8 +473,8 @@  discard block
 block discarded – undo
473 473
                               drawChart8();
474 474
                             });
475 475
                   </script>';
476
-                  }
477
-                  ?>
476
+				  }
477
+				  ?>
478 478
                 <div class="more">
479 479
                     <a href="<?php print $globalURL; ?>/statistics/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
480 480
                 </div>
@@ -484,24 +484,24 @@  discard block
 block discarded – undo
484 484
             <div class="col-md-6">
485 485
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
486 486
                 <?php
487
-                  $month_array = $Stats->countAllDatesLastMonth($airline_icao);
488
-		    if (count($month_array) == 0) print _("No data available");
489
-		    else {
490
-                  print '<div id="chart9" class="chart" width="100%"></div>
487
+				  $month_array = $Stats->countAllDatesLastMonth($airline_icao);
488
+			if (count($month_array) == 0) print _("No data available");
489
+			else {
490
+				  print '<div id="chart9" class="chart" width="100%"></div>
491 491
                     <script> 
492 492
                         google.load("visualization", "1", {packages:["corechart"]});
493 493
                       google.setOnLoadCallback(drawChart9);
494 494
                       function drawChart9() {
495 495
                         var data = google.visualization.arrayToDataTable([
496 496
                             ["'._("Day").'", "'._("# of Flights").'"], ';
497
-                            $month_data = '';
498
-                          foreach($month_array as $month_item)
499
-                                    {
500
-                                        $month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
501
-                                    }
502
-                                    $month_data = substr($month_data, 0, -1);
503
-                                    print $month_data;
504
-                        print ']);
497
+							$month_data = '';
498
+						  foreach($month_array as $month_item)
499
+									{
500
+										$month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
501
+									}
502
+									$month_data = substr($month_data, 0, -1);
503
+									print $month_data;
504
+						print ']);
505 505
 
506 506
                         var options = {
507 507
                             legend: {position: "none"},
@@ -519,8 +519,8 @@  discard block
 block discarded – undo
519 519
                               drawChart9();
520 520
                             });
521 521
                   </script>';
522
-                  }
523
-                  ?>
522
+				  }
523
+				  ?>
524 524
                 <div class="more">
525 525
                     <a href="<?php print $globalURL; ?>/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
526 526
                 </div>
@@ -530,25 +530,25 @@  discard block
 block discarded – undo
530 530
             <div class="col-md-6">
531 531
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
532 532
                 <?php
533
-                    $date_array = $Stats->countAllDatesLast7Days($airline_icao);
534
-		    if (empty($date_array)) print _("No data available");
535
-		    else {
536
-                  print '<div id="chart5" class="chart" width="100%"></div>
533
+					$date_array = $Stats->countAllDatesLast7Days($airline_icao);
534
+			if (empty($date_array)) print _("No data available");
535
+			else {
536
+				  print '<div id="chart5" class="chart" width="100%"></div>
537 537
                     <script> 
538 538
                         google.load("visualization", "1", {packages:["corechart"]});
539 539
                       google.setOnLoadCallback(drawChart5);
540 540
                       function drawChart5() {
541 541
                         var data = google.visualization.arrayToDataTable([
542 542
                             ["'._("Date").'", "'._("# of Flights").'"], ';
543
-                            $date_data = '';
543
+							$date_data = '';
544 544
                         
545
-                          foreach($date_array as $date_item)
546
-                                    {
547
-                                        $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
548
-                                    }
549
-                                    $date_data = substr($date_data, 0, -1);
550
-                                    print $date_data;
551
-                        print ']);
545
+						  foreach($date_array as $date_item)
546
+									{
547
+										$date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
548
+									}
549
+									$date_data = substr($date_data, 0, -1);
550
+									print $date_data;
551
+						print ']);
552 552
 
553 553
                         var options = {
554 554
                             legend: {position: "none"},
@@ -566,8 +566,8 @@  discard block
 block discarded – undo
566 566
                               drawChart5();
567 567
                             });
568 568
                   </script>';
569
-                  }
570
-                  ?>
569
+				  }
570
+				  ?>
571 571
                 <div class="more">
572 572
                     <a href="<?php print $globalURL; ?>/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
573 573
                 </div>
@@ -577,25 +577,25 @@  discard block
 block discarded – undo
577 577
             <div class="col-md-6">
578 578
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
579 579
                 <?php
580
-                  $hour_array = $Stats->countAllHours('hour',$airline_icao);
581
-		    if (empty($hour_array)) print _("No data available");
582
-		    else {
580
+				  $hour_array = $Stats->countAllHours('hour',$airline_icao);
581
+			if (empty($hour_array)) print _("No data available");
582
+			else {
583 583
 
584
-                  print '<div id="chart6" class="chart" width="100%"></div>
584
+				  print '<div id="chart6" class="chart" width="100%"></div>
585 585
                     <script> 
586 586
                         google.load("visualization", "1", {packages:["corechart"]});
587 587
                       google.setOnLoadCallback(drawChart6);
588 588
                       function drawChart6() {
589 589
                         var data = google.visualization.arrayToDataTable([
590 590
                             ["'._("Hour").'", "'._("# of Flights").'"], ';
591
-                            $hour_data = '';
592
-                          foreach($hour_array as $hour_item)
593
-                                    {
594
-                                        $hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],';
595
-                                    }
596
-                                    $hour_data = substr($hour_data, 0, -1);
597
-                                    print $hour_data;
598
-                        print ']);
591
+							$hour_data = '';
592
+						  foreach($hour_array as $hour_item)
593
+									{
594
+										$hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],';
595
+									}
596
+									$hour_data = substr($hour_data, 0, -1);
597
+									print $hour_data;
598
+						print ']);
599 599
 
600 600
                         var options = {
601 601
                             legend: {position: "none"},
@@ -613,8 +613,8 @@  discard block
 block discarded – undo
613 613
                               drawChart6();
614 614
                             });
615 615
                   </script>';
616
-                  }
617
-                ?>
616
+				  }
617
+				?>
618 618
                 <div class="more">
619 619
                     <a href="<?php print $globalURL; ?>/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
620 620
                 </div>
@@ -622,21 +622,21 @@  discard block
 block discarded – undo
622 622
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
623 623
         </div>
624 624
 <?php
625
-    if ($airline_icao == '') {
625
+	if ($airline_icao == '') {
626 626
 ?>
627 627
         <div class="row column">
628 628
         	<?php
629
-        	    $polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
630
-        	    if (!empty($polar)) {
631
-            		print '<h2>'._("Coverage pattern").'</h2>';
632
-        		foreach ($polar as $eachpolar) {
633
-        		    unset($polar_data);
634
-	        	    $Spotter = new Spotter();
635
-        		    $data = json_decode($eachpolar['source_data']);
636
-        		    foreach($data as $value => $key) {
637
-        			$direction = $Spotter->parseDirection(($value*22.5));
638
-        			$distance = $key;
639
-        			$unit = 'km';
629
+				$polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
630
+				if (!empty($polar)) {
631
+					print '<h2>'._("Coverage pattern").'</h2>';
632
+				foreach ($polar as $eachpolar) {
633
+					unset($polar_data);
634
+					$Spotter = new Spotter();
635
+					$data = json_decode($eachpolar['source_data']);
636
+					foreach($data as $value => $key) {
637
+					$direction = $Spotter->parseDirection(($value*22.5));
638
+					$distance = $key;
639
+					$unit = 'km';
640 640
 				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
641 641
 					$distance = round($distance*0.539957);
642 642
 					$unit = 'nm';
@@ -647,10 +647,10 @@  discard block
 block discarded – undo
647 647
 					$distance = $distance;
648 648
 					$unit = 'km';
649 649
 				}
650
-        			if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
651
-        	    		else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
652
-        		    }
653
-        	?>
650
+					if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
651
+						else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
652
+					}
653
+			?>
654 654
             <div class="col-md-6">
655 655
                 <h4><?php print $eachpolar['source_name']; ?></h4>
656 656
         	<div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
@@ -682,22 +682,22 @@  discard block
 block discarded – undo
682 682
 		</script>
683 683
             </div>
684 684
             <?php
685
-        	    }
686
-        	}
687
-            ?>
685
+				}
686
+			}
687
+			?>
688 688
         </div>
689 689
         <div class="row column">
690 690
             <div class="col-md-6">
691 691
         	<?php
692
-        	    $msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
693
-        	    if (!empty($msg)) {
694
-            		print '<h2>'._("Messages received").'</h2>';
695
-        		foreach ($msg as $eachmsg) {
696
-        		    //$eachmsg = $msg[0];
697
-        		    $data = $eachmsg['source_data'];
698
-        		    if ($data > 500) $max = (round(($data+100)/100))*100;
699
-        		    else $max = 500;
700
-        	?>
692
+				$msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
693
+				if (!empty($msg)) {
694
+					print '<h2>'._("Messages received").'</h2>';
695
+				foreach ($msg as $eachmsg) {
696
+					//$eachmsg = $msg[0];
697
+					$data = $eachmsg['source_data'];
698
+					if ($data > 500) $max = (round(($data+100)/100))*100;
699
+					else $max = 500;
700
+			?>
701 701
         	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
702 702
         	<script>
703 703
 		      var g = new JustGage({
@@ -713,9 +713,9 @@  discard block
 block discarded – undo
713 713
 			  });
714 714
 		</script>
715 715
             <?php
716
-        	   }
717
-        	}
718
-            ?>
716
+			   }
717
+			}
718
+			?>
719 719
             </div>
720 720
         </div>
721 721
         <div class="row column">
@@ -742,19 +742,19 @@  discard block
 block discarded – undo
742 742
 				$hist_data .= '[ "'.$distance.'",'.$nb.'],';
743 743
 			}
744 744
 			$hist_data = substr($hist_data, 0, -1);
745
-            ?>
745
+			?>
746 746
             <div class="col-md-6">
747 747
                 <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2>
748 748
                 <?php
749
-                  print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div>
749
+				  print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div>
750 750
                     <script> 
751 751
                         google.load("visualization", "1", {packages:["corechart"]});
752 752
                       google.setOnLoadCallback(drawCharthist_'.str_replace(' ','_',strtolower($source)).');
753 753
                       function drawCharthist_'.str_replace(' ','_',strtolower($source)).'() {
754 754
                         var data = google.visualization.arrayToDataTable([
755 755
                             ["'._("Distance").'", "'._("# of Flights").'"], ';
756
-                            print $hist_data;
757
-                        print ']);
756
+							print $hist_data;
757
+						print ']);
758 758
 
759 759
                         var options = {
760 760
                             legend: {position: "none"},
@@ -772,15 +772,15 @@  discard block
 block discarded – undo
772 772
                               drawCharthist_'.str_replace(' ','_',strtolower($source)).'();
773 773
                             });
774 774
                   </script>';
775
-        	?>
775
+			?>
776 776
     	    </div>
777 777
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
778 778
         	<?php
779
-                  }
780
-                ?>
779
+				  }
780
+				?>
781 781
         </div>
782 782
 <?php
783
-    }
783
+	}
784 784
 ?>
785 785
     </div>
786 786
 </div>  
Please login to merge, or discard this patch.
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -6,13 +6,13 @@  discard block
 block discarded – undo
6 6
 $Stats = new Stats();
7 7
 $title = _("Statistics");
8 8
 
9
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
9
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
10 10
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
11 11
 	$airline_icao = $_COOKIE['stats_airline_icao'];
12 12
 } elseif ($airline_icao == '' && isset($globalFilter)) {
13 13
 	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
14 14
 }
15
-setcookie('stats_airline_icao',$airline_icao);
15
+setcookie('stats_airline_icao', $airline_icao);
16 16
 require_once('header.php');
17 17
 
18 18
 ?>
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 		date_default_timezone_set('UTC');
33 33
 		$lastupdate = strtotime($last_update[0]['value']);
34 34
 		if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
35
-		print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
35
+		print '<i>Last update: '.date('Y-m-d G:i:s', $lastupdate).'</i>';
36 36
 	}
37 37
     ?>
38 38
     </div>
@@ -42,29 +42,29 @@  discard block
 block discarded – undo
42 42
     <?php include('statistics-sub-menu.php'); ?>
43 43
     <div class="row global-stats">
44 44
         <div class="col-md-2"><span class="type"><?php echo _("Flights"); ?></span><span><?php print number_format($Stats->countOverallFlights($airline_icao)); ?></span></div> 
45
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
45
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
46 46
         <div class="col-md-2"><span class="type"><?php echo _("Arrivals seen"); ?></span><span><?php print number_format($Stats->countOverallArrival($airline_icao)); ?></span></div> 
47
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
47
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
48 48
 	<?php
49 49
 	    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
50 50
 	?>
51 51
     	    <div class="col-md-2"><span class="type"><?php echo _("Pilots"); ?></span><span><?php print number_format($Stats->countOverallPilots($airline_icao)); ?></span></div> 
52
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
52
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
53 53
         <?php
54 54
     	    } else {
55 55
     	?>
56 56
     	    <div class="col-md-2"><span class="type"><?php echo _("Owners"); ?></span><span><?php print number_format($Stats->countOverallOwners($airline_icao)); ?></span></div> 
57
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
57
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
58 58
     	<?php
59 59
     	    }
60 60
     	?>
61 61
         <div class="col-md-2"><span class="type"><?php echo _("Aircrafts"); ?></span><span><?php print number_format($Stats->countOverallAircrafts($airline_icao)); ?></span></div> 
62
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
62
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
63 63
         <?php
64 64
     		if ($airline_icao == '') {
65 65
     	?>
66 66
         <div class="col-md-2"><span class="type"><?php echo _("Airlines"); ?></span><span><?php print number_format($Stats->countOverallAirlines()); ?></span></div>
67
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
67
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
68 68
 	<?php
69 69
 		}
70 70
 	?>
@@ -72,18 +72,18 @@  discard block
 block discarded – undo
72 72
 		if (!(isset($globalIVAO) && $globalIVAO) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalphpVMS) && $globalphpVMS)) {
73 73
 	?>
74 74
         <div class="col-md-2"><span class="type"><?php echo _("Military"); ?></span><span><?php print number_format($Stats->countOverallMilitaryFlights()); ?></span></div> 
75
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
75
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
76 76
 	<?php
77 77
 		}
78 78
 	?>
79 79
     </div>
80
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
80
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
81 81
     <div class="specific-stats">
82 82
         <div class="row column">
83 83
             <div class="col-md-6">
84 84
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
85 85
                  <?php
86
-                  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao);
86
+                  $aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao);
87 87
 		    if (count($aircraft_array) == 0) print _("No data available");
88 88
 		    else {
89 89
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
                         var data = google.visualization.arrayToDataTable([
96 96
                             ["'._("Aircraft").'", "'._("# of times").'"], ';
97 97
                             $aircraft_data = '';
98
-                          foreach($aircraft_array as $aircraft_item)
98
+                          foreach ($aircraft_array as $aircraft_item)
99 99
                                     {
100 100
                                             $aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
101 101
                                     }
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
                     <a href="<?php print $globalURL; ?>/statistics/aircraft" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
123 123
                 </div>
124 124
             </div>
125
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
125
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
126 126
 <?php
127 127
     if ($airline_icao == '') {
128 128
 ?>
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
                         var data = google.visualization.arrayToDataTable([
142 142
                             ["'._("Airline").'", "'._("# of times").'"], ';
143 143
                             $airline_data = '';
144
-                          foreach($airline_array as $airline_item)
144
+                          foreach ($airline_array as $airline_item)
145 145
                                     {
146 146
                                             $airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
147 147
                                     }
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
                 </div>
170 170
             </div>
171 171
         </div>
172
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
172
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
173 173
 <?php
174 174
     }
175 175
 ?>
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
             ?>
191 191
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
192 192
                  <?php
193
-                  $pilot_array = $Stats->countAllPilots(true,$airline_icao);
193
+                  $pilot_array = $Stats->countAllPilots(true, $airline_icao);
194 194
 		    if (count($pilot_array) == 0) print _("No data available");
195 195
 		    else {
196 196
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
                         var data = google.visualization.arrayToDataTable([
203 203
                             ["'._("Pilots").'", "'._("# of times").'"], ';
204 204
                             $pilot_data = '';
205
-                          foreach($pilot_array as $pilot_item)
205
+                          foreach ($pilot_array as $pilot_item)
206 206
                                     {
207 207
                                             $pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
208 208
                                     }
@@ -230,14 +230,14 @@  discard block
 block discarded – undo
230 230
                 </div>
231 231
             </div>
232 232
         
233
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
233
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
234 234
         <?php
235 235
     	    } else {
236 236
     	?>
237 237
             <div class="col-md-6">
238 238
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
239 239
                  <?php
240
-                  $owner_array = $Stats->countAllOwners(true,$airline_icao);
240
+                  $owner_array = $Stats->countAllOwners(true, $airline_icao);
241 241
 		    if (count($owner_array) == 0) print _("No data available");
242 242
 		    else {
243 243
 
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
                         var data = google.visualization.arrayToDataTable([
250 250
                             ["'._("Owner").'", "'._("# of times").'"], ';
251 251
                             $owner_data = '';
252
-                          foreach($owner_array as $owner_item)
252
+                          foreach ($owner_array as $owner_item)
253 253
                                     {
254 254
                                             $owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
255 255
                                     }
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
                 </div>
278 278
             </div>
279 279
         
280
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
280
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
281 281
         <?php
282 282
     	    }
283 283
     	    if (!empty($flightover_array)) {
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
                         var data = google.visualization.arrayToDataTable([
299 299
                             ["'._("Country").'", "'._("# of times").'"], ';
300 300
                             $flightover_data = '';
301
-                          foreach($flightover_array as $flightover_item)
301
+                          foreach ($flightover_array as $flightover_item)
302 302
                                     {
303 303
                                             $flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],';
304 304
                                     }
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
             }
332 332
         ?>
333 333
         </div>
334
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
334
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
335 335
 
336 336
     	
337 337
         </div>
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
                 var data = google.visualization.arrayToDataTable([ 
356 356
                     ["'._("Airport").'", "'._("# of times").'"],';
357 357
                     $airport_data = '';
358
-                  foreach($airport_airport_array as $airport_item)
358
+                  foreach ($airport_airport_array as $airport_item)
359 359
                         {
360 360
                             $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
361 361
                             $name = str_replace("'", "", $name);
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
                 <a href="<?php print $globalURL; ?>/statistics/airport-departure" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
385 385
               </div>
386 386
             </div>
387
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
387
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
388 388
 
389 389
             <div class="col-md-6">
390 390
                 <h2><?php echo _("Top 10 Most Common Arrival Airports"); ?></h2>
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
                 var data = google.visualization.arrayToDataTable([ 
406 406
                     ["'._("Airport").'", "'._("# of times").'"],';
407 407
                     $airport_data2 = '';
408
-                  foreach($airport_airport_array2 as $airport_item2)
408
+                  foreach ($airport_airport_array2 as $airport_item2)
409 409
                         {
410 410
                             $name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')';
411 411
                             $name2 = str_replace("'", "", $name2);
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
               </div>
436 436
             </div>
437 437
         </div>
438
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
438
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
439 439
 
440 440
         <div class="row column">
441 441
             <div class="col-md-6">
@@ -452,9 +452,9 @@  discard block
 block discarded – undo
452 452
                         var data = google.visualization.arrayToDataTable([
453 453
                             ["'._("Month").'", "'._("# of Flights").'"], ';
454 454
                             $year_data = '';
455
-                          foreach($year_array as $year_item)
455
+                          foreach ($year_array as $year_item)
456 456
                                     {
457
-                                        $year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
457
+                                        $year_data .= '[ "'.date('F, Y', strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
458 458
                                     }
459 459
                                     $year_data = substr($year_data, 0, -1);
460 460
                                     print $year_data;
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
                     <a href="<?php print $globalURL; ?>/statistics/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
483 483
                 </div>
484 484
             </div>
485
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
485
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
486 486
 
487 487
             <div class="col-md-6">
488 488
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
@@ -498,9 +498,9 @@  discard block
 block discarded – undo
498 498
                         var data = google.visualization.arrayToDataTable([
499 499
                             ["'._("Day").'", "'._("# of Flights").'"], ';
500 500
                             $month_data = '';
501
-                          foreach($month_array as $month_item)
501
+                          foreach ($month_array as $month_item)
502 502
                                     {
503
-                                        $month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
503
+                                        $month_data .= '[ "'.date('F j, Y', strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
504 504
                                     }
505 505
                                     $month_data = substr($month_data, 0, -1);
506 506
                                     print $month_data;
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
                     <a href="<?php print $globalURL; ?>/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
529 529
                 </div>
530 530
             </div>
531
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
531
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
532 532
 
533 533
             <div class="col-md-6">
534 534
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
                             ["'._("Date").'", "'._("# of Flights").'"], ';
546 546
                             $date_data = '';
547 547
                         
548
-                          foreach($date_array as $date_item)
548
+                          foreach ($date_array as $date_item)
549 549
                                     {
550 550
                                         $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
551 551
                                     }
@@ -575,12 +575,12 @@  discard block
 block discarded – undo
575 575
                     <a href="<?php print $globalURL; ?>/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
576 576
                 </div>
577 577
             </div>
578
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
578
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
579 579
 
580 580
             <div class="col-md-6">
581 581
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
582 582
                 <?php
583
-                  $hour_array = $Stats->countAllHours('hour',$airline_icao);
583
+                  $hour_array = $Stats->countAllHours('hour', $airline_icao);
584 584
 		    if (empty($hour_array)) print _("No data available");
585 585
 		    else {
586 586
 
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
                         var data = google.visualization.arrayToDataTable([
593 593
                             ["'._("Hour").'", "'._("# of Flights").'"], ';
594 594
                             $hour_data = '';
595
-                          foreach($hour_array as $hour_item)
595
+                          foreach ($hour_array as $hour_item)
596 596
                                     {
597 597
                                         $hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],';
598 598
                                     }
@@ -622,21 +622,21 @@  discard block
 block discarded – undo
622 622
                     <a href="<?php print $globalURL; ?>/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
623 623
                 </div>
624 624
             </div>
625
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
625
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
626 626
         </div>
627 627
 <?php
628 628
     if ($airline_icao == '') {
629 629
 ?>
630 630
         <div class="row column">
631 631
         	<?php
632
-        	    $polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
632
+        	    $polar = $Stats->getStatsSource(date('Y-m-d'), 'polar');
633 633
         	    if (!empty($polar)) {
634 634
             		print '<h2>'._("Coverage pattern").'</h2>';
635 635
         		foreach ($polar as $eachpolar) {
636 636
         		    unset($polar_data);
637 637
 	        	    $Spotter = new Spotter();
638 638
         		    $data = json_decode($eachpolar['source_data']);
639
-        		    foreach($data as $value => $key) {
639
+        		    foreach ($data as $value => $key) {
640 640
         			$direction = $Spotter->parseDirection(($value*22.5));
641 641
         			$distance = $key;
642 642
         			$unit = 'km';
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
         	?>
657 657
             <div class="col-md-6">
658 658
                 <h4><?php print $eachpolar['source_name']; ?></h4>
659
-        	<div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
659
+        	<div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
660 660
         	<script>
661 661
         	    (function() {
662 662
         	    var margin = {top: 100, right: 100, bottom: 100, left: 100},
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
 		      color: color,
681 681
 		      unit: '<?php echo $unit; ?>'
682 682
 		    };
683
-		    RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
683
+		    RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
684 684
 		    })();
685 685
 		</script>
686 686
             </div>
@@ -692,19 +692,19 @@  discard block
 block discarded – undo
692 692
         <div class="row column">
693 693
             <div class="col-md-6">
694 694
         	<?php
695
-        	    $msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
695
+        	    $msg = $Stats->getStatsSource(date('Y-m-d'), 'msg');
696 696
         	    if (!empty($msg)) {
697 697
             		print '<h2>'._("Messages received").'</h2>';
698 698
         		foreach ($msg as $eachmsg) {
699 699
         		    //$eachmsg = $msg[0];
700 700
         		    $data = $eachmsg['source_data'];
701
-        		    if ($data > 500) $max = (round(($data+100)/100))*100;
701
+        		    if ($data > 500) $max = (round(($data + 100)/100))*100;
702 702
         		    else $max = 500;
703 703
         	?>
704
-        	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
704
+        	<div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
705 705
         	<script>
706 706
 		      var g = new JustGage({
707
-			    id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>",
707
+			    id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>",
708 708
 			    value: <?php echo $data; ?>,
709 709
 			    min: 0,
710 710
 			    max: <?php print $max; ?>,
@@ -724,12 +724,12 @@  discard block
 block discarded – undo
724 724
         <div class="row column">
725 725
 
726 726
             <?php
727
-		$hist = $Stats->getStatsSource(date('Y-m-d'),'hist');
727
+		$hist = $Stats->getStatsSource(date('Y-m-d'), 'hist');
728 728
 		foreach ($hist as $hists) {
729 729
 			$hist_data = '';
730 730
 			$source = $hists['source_name'];
731 731
 			$hist_array = json_decode($hists['source_data']);
732
-			foreach($hist_array as $distance => $nb)
732
+			foreach ($hist_array as $distance => $nb)
733 733
 			{
734 734
 				$unit = 'km';
735 735
 				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
@@ -747,13 +747,13 @@  discard block
 block discarded – undo
747 747
 			$hist_data = substr($hist_data, 0, -1);
748 748
             ?>
749 749
             <div class="col-md-6">
750
-                <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2>
750
+                <h2><?php echo sprintf(_("Flights Distance for %s"), $source); ?></h2>
751 751
                 <?php
752
-                  print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div>
752
+                  print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div>
753 753
                     <script> 
754 754
                         google.load("visualization", "1", {packages:["corechart"]});
755
-                      google.setOnLoadCallback(drawCharthist_'.str_replace(' ','_',strtolower($source)).');
756
-                      function drawCharthist_'.str_replace(' ','_',strtolower($source)).'() {
755
+                      google.setOnLoadCallback(drawCharthist_'.str_replace(' ', '_', strtolower($source)).');
756
+                      function drawCharthist_'.str_replace(' ', '_', strtolower($source)).'() {
757 757
                         var data = google.visualization.arrayToDataTable([
758 758
                             ["'._("Distance").'", "'._("# of Flights").'"], ';
759 759
                             print $hist_data;
@@ -768,16 +768,16 @@  discard block
 block discarded – undo
768 768
                             colors: ["#1a3151"]
769 769
                         };
770 770
 
771
-                        var chart = new google.visualization.AreaChart(document.getElementById("charthist-'.str_replace(' ','_',strtolower($source)).'"));
771
+                        var chart = new google.visualization.AreaChart(document.getElementById("charthist-'.str_replace(' ', '_', strtolower($source)).'"));
772 772
                         chart.draw(data, options);
773 773
                       }
774 774
                       $(window).resize(function(){
775
-                              drawCharthist_'.str_replace(' ','_',strtolower($source)).'();
775
+                              drawCharthist_'.str_replace(' ', '_', strtolower($source)).'();
776 776
                             });
777 777
                   </script>';
778 778
         	?>
779 779
     	    </div>
780
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
780
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
781 781
         	<?php
782 782
                   }
783 783
                 ?>
Please login to merge, or discard this patch.
install/class.update_schema.php 3 patches
Indentation   +558 added lines, -558 removed lines patch added patch discarded remove patch
@@ -8,18 +8,18 @@  discard block
 block discarded – undo
8 8
 class update_schema {
9 9
 
10 10
 	public static function update_schedule() {
11
-	    $Connection = new Connection();
12
-	    $Schedule = new Schedule();
13
-	    $query = "SELECT * FROM schedule";
14
-            try {
15
-            	$sth = $Connection->db->prepare($query);
11
+		$Connection = new Connection();
12
+		$Schedule = new Schedule();
13
+		$query = "SELECT * FROM schedule";
14
+			try {
15
+				$sth = $Connection->db->prepare($query);
16 16
 		$sth->execute();
17
-    	    } catch(PDOException $e) {
17
+			} catch(PDOException $e) {
18 18
 		return "error : ".$e->getMessage()."\n";
19
-    	    }
20
-    	    while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
21
-    		$Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']);
22
-    	    }
19
+			}
20
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
21
+			$Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']);
22
+			}
23 23
 	
24 24
 	}
25 25
 /*
@@ -43,198 +43,198 @@  discard block
 block discarded – undo
43 43
     	}
44 44
 */	
45 45
 	private static function update_from_1() {
46
-    		$Connection = new Connection();
47
-    		// Add new column to routes table
48
-    		//$query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10),`ToAirport_Time` VARCHAR(10),`Source` VARCHAR(255),`date_added` DATETIME DEFAULT CURRENT TIMESTAMP,`date_modified` DATETIME,`date_lastseen` DATETIME";
46
+			$Connection = new Connection();
47
+			// Add new column to routes table
48
+			//$query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10),`ToAirport_Time` VARCHAR(10),`Source` VARCHAR(255),`date_added` DATETIME DEFAULT CURRENT TIMESTAMP,`date_modified` DATETIME,`date_lastseen` DATETIME";
49 49
 		$query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10) NULL , ADD `ToAirport_Time` VARCHAR(10) NULL , ADD `Source` VARCHAR(255) NULL, ADD `date_added` timestamp DEFAULT CURRENT_TIMESTAMP, ADD `date_modified` timestamp NULL, ADD `date_lastseen` timestamp NULL";
50
-        	try {
51
-            	    $sth = $Connection->db->prepare($query);
52
-		    $sth->execute();
53
-    		} catch(PDOException $e) {
54
-		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
55
-    		}
56
-    		// Copy schedules data to routes table
57
-    		self::update_schedule();
58
-    		// Delete schedule table
50
+			try {
51
+					$sth = $Connection->db->prepare($query);
52
+			$sth->execute();
53
+			} catch(PDOException $e) {
54
+			return "error (add new columns to routes table) : ".$e->getMessage()."\n";
55
+			}
56
+			// Copy schedules data to routes table
57
+			self::update_schedule();
58
+			// Delete schedule table
59 59
 		$query = "DROP TABLE `schedule`";
60
-        	try {
61
-            	    $sth = $Connection->db->prepare($query);
62
-		    $sth->execute();
63
-    		} catch(PDOException $e) {
64
-		    return "error (delete schedule table) : ".$e->getMessage()."\n";
65
-    		}
66
-    		// Add source column
67
-    		$query = "ALTER TABLE `aircraft_modes` ADD `Source` VARCHAR(255) NULL";
68
-    		try {
69
-            	    $sth = $Connection->db->prepare($query);
70
-		    $sth->execute();
71
-    		} catch(PDOException $e) {
72
-		    return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n";
73
-    		}
60
+			try {
61
+					$sth = $Connection->db->prepare($query);
62
+			$sth->execute();
63
+			} catch(PDOException $e) {
64
+			return "error (delete schedule table) : ".$e->getMessage()."\n";
65
+			}
66
+			// Add source column
67
+			$query = "ALTER TABLE `aircraft_modes` ADD `Source` VARCHAR(255) NULL";
68
+			try {
69
+					$sth = $Connection->db->prepare($query);
70
+			$sth->execute();
71
+			} catch(PDOException $e) {
72
+			return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n";
73
+			}
74 74
 		// Delete unused column
75 75
 		$query = "ALTER TABLE `aircraft_modes`  DROP `SerialNo`,  DROP `OperatorFlagCode`,  DROP `Manufacturer`,  DROP `Type`,  DROP `FirstRegDate`,  DROP `CurrentRegDate`,  DROP `Country`,  DROP `PreviousID`,  DROP `DeRegDate`,  DROP `Status`,  DROP `PopularName`,  DROP `GenericName`,  DROP `AircraftClass`,  DROP `Engines`,  DROP `OwnershipStatus`,  DROP `RegisteredOwners`,  DROP `MTOW`,  DROP `TotalHours`,  DROP `YearBuilt`,  DROP `CofACategory`,  DROP `CofAExpiry`,  DROP `UserNotes`,  DROP `Interested`,  DROP `UserTag`,  DROP `InfoUrl`,  DROP `PictureUrl1`,  DROP `PictureUrl2`,  DROP `PictureUrl3`,  DROP `UserBool1`,  DROP `UserBool2`,  DROP `UserBool3`,  DROP `UserBool4`,  DROP `UserBool5`,  DROP `UserString1`,  DROP `UserString2`,  DROP `UserString3`,  DROP `UserString4`,  DROP `UserString5`,  DROP `UserInt1`,  DROP `UserInt2`,  DROP `UserInt3`,  DROP `UserInt4`,  DROP `UserInt5`";
76
-    		try {
77
-            	    $sth = $Connection->db->prepare($query);
78
-		    $sth->execute();
79
-    		} catch(PDOException $e) {
80
-		    return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n";
81
-    		}
76
+			try {
77
+					$sth = $Connection->db->prepare($query);
78
+			$sth->execute();
79
+			} catch(PDOException $e) {
80
+			return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n";
81
+			}
82 82
 		// Add ModeS column
83 83
 		$query = "ALTER TABLE `spotter_output`  ADD `ModeS` VARCHAR(255) NULL";
84
-    		try {
85
-            	    $sth = $Connection->db->prepare($query);
86
-		    $sth->execute();
87
-    		} catch(PDOException $e) {
88
-		    return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n";
89
-    		}
84
+			try {
85
+					$sth = $Connection->db->prepare($query);
86
+			$sth->execute();
87
+			} catch(PDOException $e) {
88
+			return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n";
89
+			}
90 90
 		$query = "ALTER TABLE `spotter_live`  ADD `ModeS` VARCHAR(255)";
91
-    		try {
92
-            	    $sth = $Connection->db->prepare($query);
93
-		    $sth->execute();
94
-    		} catch(PDOException $e) {
95
-		    return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n";
96
-    		}
97
-    		// Add auto_increment for aircraft_modes
98
-    		$query = "ALTER TABLE `aircraft_modes` CHANGE `AircraftID` `AircraftID` INT(11) NOT NULL AUTO_INCREMENT";
99
-    		try {
100
-            	    $sth = $Connection->db->prepare($query);
101
-		    $sth->execute();
102
-    		} catch(PDOException $e) {
103
-		    return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n";
104
-    		}
105
-    		$error = '';
91
+			try {
92
+					$sth = $Connection->db->prepare($query);
93
+			$sth->execute();
94
+			} catch(PDOException $e) {
95
+			return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n";
96
+			}
97
+			// Add auto_increment for aircraft_modes
98
+			$query = "ALTER TABLE `aircraft_modes` CHANGE `AircraftID` `AircraftID` INT(11) NOT NULL AUTO_INCREMENT";
99
+			try {
100
+					$sth = $Connection->db->prepare($query);
101
+			$sth->execute();
102
+			} catch(PDOException $e) {
103
+			return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n";
104
+			}
105
+			$error = '';
106 106
 		$error .= create_db::import_file('../db/acars_live.sql');
107 107
 		$error .= create_db::import_file('../db/config.sql');
108 108
 		// Update schema_version to 2
109 109
 		$query = "UPDATE `config` SET `value` = '2' WHERE `name` = 'schema_version'";
110
-        	try {
111
-            	    $sth = $Connection->db->prepare($query);
112
-		    $sth->execute();
113
-    		} catch(PDOException $e) {
114
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
115
-    		}
110
+			try {
111
+					$sth = $Connection->db->prepare($query);
112
+			$sth->execute();
113
+			} catch(PDOException $e) {
114
+			return "error (update schema_version) : ".$e->getMessage()."\n";
115
+			}
116 116
 		return $error;
117
-        }
117
+		}
118 118
 
119 119
 	private static function update_from_2() {
120
-    		$Connection = new Connection();
121
-    		// Add new column decode to acars_live table
120
+			$Connection = new Connection();
121
+			// Add new column decode to acars_live table
122 122
 		$query = "ALTER TABLE `acars_live` ADD `decode` TEXT";
123
-        	try {
124
-            	    $sth = $Connection->db->prepare($query);
125
-		    $sth->execute();
126
-    		} catch(PDOException $e) {
127
-		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
128
-    		}
129
-    		$error = '';
130
-    		// Create table acars_archive
123
+			try {
124
+					$sth = $Connection->db->prepare($query);
125
+			$sth->execute();
126
+			} catch(PDOException $e) {
127
+			return "error (add new columns to routes table) : ".$e->getMessage()."\n";
128
+			}
129
+			$error = '';
130
+			// Create table acars_archive
131 131
 		$error .= create_db::import_file('../db/acars_archive.sql');
132 132
 		// Update schema_version to 3
133 133
 		$query = "UPDATE `config` SET `value` = '3' WHERE `name` = 'schema_version'";
134
-        	try {
135
-            	    $sth = $Connection->db->prepare($query);
136
-		    $sth->execute();
137
-    		} catch(PDOException $e) {
138
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
139
-    		}
134
+			try {
135
+					$sth = $Connection->db->prepare($query);
136
+			$sth->execute();
137
+			} catch(PDOException $e) {
138
+			return "error (update schema_version) : ".$e->getMessage()."\n";
139
+			}
140 140
 		return $error;
141 141
 	}
142 142
 
143 143
 	private static function update_from_3() {
144
-    		$Connection = new Connection();
145
-    		// Add default CURRENT_TIMESTAMP to aircraft_modes column FirstCreated
144
+			$Connection = new Connection();
145
+			// Add default CURRENT_TIMESTAMP to aircraft_modes column FirstCreated
146 146
 		$query = "ALTER TABLE `aircraft_modes` CHANGE `FirstCreated` `FirstCreated` timestamp DEFAULT CURRENT_TIMESTAMP";
147
-        	try {
148
-            	    $sth = $Connection->db->prepare($query);
149
-		    $sth->execute();
150
-    		} catch(PDOException $e) {
151
-		    return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n";
152
-    		}
153
-    		// Add image_source_website column to spotter_image
147
+			try {
148
+					$sth = $Connection->db->prepare($query);
149
+			$sth->execute();
150
+			} catch(PDOException $e) {
151
+			return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n";
152
+			}
153
+			// Add image_source_website column to spotter_image
154 154
 		$query = "ALTER TABLE `spotter_image` ADD `image_source_website` VARCHAR(999) NULL";
155
-        	try {
156
-            	    $sth = $Connection->db->prepare($query);
157
-		    $sth->execute();
158
-    		} catch(PDOException $e) {
159
-		    return "error (add new columns to spotter_image) : ".$e->getMessage()."\n";
160
-    		}
161
-    		$error = '';
155
+			try {
156
+					$sth = $Connection->db->prepare($query);
157
+			$sth->execute();
158
+			} catch(PDOException $e) {
159
+			return "error (add new columns to spotter_image) : ".$e->getMessage()."\n";
160
+			}
161
+			$error = '';
162 162
 		// Update schema_version to 4
163 163
 		$query = "UPDATE `config` SET `value` = '4' WHERE `name` = 'schema_version'";
164
-        	try {
165
-            	    $sth = $Connection->db->prepare($query);
166
-		    $sth->execute();
167
-    		} catch(PDOException $e) {
168
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
169
-    		}
164
+			try {
165
+					$sth = $Connection->db->prepare($query);
166
+			$sth->execute();
167
+			} catch(PDOException $e) {
168
+			return "error (update schema_version) : ".$e->getMessage()."\n";
169
+			}
170 170
 		return $error;
171 171
 	}
172 172
 	
173 173
 	private static function update_from_4() {
174
-    		$Connection = new Connection();
174
+			$Connection = new Connection();
175 175
 	
176
-    		$error = '';
177
-    		// Create table acars_label
176
+			$error = '';
177
+			// Create table acars_label
178 178
 		$error .= create_db::import_file('../db/acars_label.sql');
179 179
 		if ($error == '') {
180
-		    // Update schema_version to 5
181
-		    $query = "UPDATE `config` SET `value` = '5' WHERE `name` = 'schema_version'";
182
-        	    try {
183
-            		$sth = $Connection->db->prepare($query);
180
+			// Update schema_version to 5
181
+			$query = "UPDATE `config` SET `value` = '5' WHERE `name` = 'schema_version'";
182
+				try {
183
+					$sth = $Connection->db->prepare($query);
184 184
 			$sth->execute();
185
-    		    } catch(PDOException $e) {
185
+				} catch(PDOException $e) {
186 186
 			return "error (update schema_version) : ".$e->getMessage()."\n";
187
-    		    }
188
-    		}
187
+				}
188
+			}
189 189
 		return $error;
190 190
 	}
191 191
 
192 192
 	private static function update_from_5() {
193
-    		$Connection = new Connection();
194
-    		// Add columns to translation
193
+			$Connection = new Connection();
194
+			// Add columns to translation
195 195
 		$query = "ALTER TABLE `translation` ADD `Source` VARCHAR(255) NULL, ADD `date_added` timestamp DEFAULT CURRENT_TIMESTAMP , ADD `date_modified` timestamp DEFAULT CURRENT_TIMESTAMP ;";
196
-        	try {
197
-            	    $sth = $Connection->db->prepare($query);
198
-		    $sth->execute();
199
-    		} catch(PDOException $e) {
200
-		    return "error (add new columns to translation) : ".$e->getMessage()."\n";
201
-    		}
202
-    		// Add aircraft_shadow column to aircraft
203
-    		$query = "ALTER TABLE `aircraft` ADD `aircraft_shadow` VARCHAR(255) NULL";
204
-        	try {
205
-            	    $sth = $Connection->db->prepare($query);
206
-		    $sth->execute();
207
-    		} catch(PDOException $e) {
208
-		    return "error (add new column to aircraft) : ".$e->getMessage()."\n";
209
-    		}
210
-    		// Add aircraft_shadow column to spotter_live
211
-    		$query = "ALTER TABLE `spotter_live` ADD `aircraft_shadow` VARCHAR(255) NULL";
212
-        	try {
213
-            	    $sth = $Connection->db->prepare($query);
214
-		    $sth->execute();
215
-    		} catch(PDOException $e) {
216
-		    return "error (add new column to spotter_live) : ".$e->getMessage()."\n";
217
-    		}
218
-    		$error = '';
219
-    		// Update table aircraft
196
+			try {
197
+					$sth = $Connection->db->prepare($query);
198
+			$sth->execute();
199
+			} catch(PDOException $e) {
200
+			return "error (add new columns to translation) : ".$e->getMessage()."\n";
201
+			}
202
+			// Add aircraft_shadow column to aircraft
203
+			$query = "ALTER TABLE `aircraft` ADD `aircraft_shadow` VARCHAR(255) NULL";
204
+			try {
205
+					$sth = $Connection->db->prepare($query);
206
+			$sth->execute();
207
+			} catch(PDOException $e) {
208
+			return "error (add new column to aircraft) : ".$e->getMessage()."\n";
209
+			}
210
+			// Add aircraft_shadow column to spotter_live
211
+			$query = "ALTER TABLE `spotter_live` ADD `aircraft_shadow` VARCHAR(255) NULL";
212
+			try {
213
+					$sth = $Connection->db->prepare($query);
214
+			$sth->execute();
215
+			} catch(PDOException $e) {
216
+			return "error (add new column to spotter_live) : ".$e->getMessage()."\n";
217
+			}
218
+			$error = '';
219
+			// Update table aircraft
220 220
 		$error .= create_db::import_file('../db/aircraft.sql');
221 221
 		$error .= create_db::import_file('../db/spotter_archive.sql');
222 222
 
223 223
 		// Update schema_version to 6
224 224
 		$query = "UPDATE `config` SET `value` = '6' WHERE `name` = 'schema_version'";
225
-        	try {
226
-            	    $sth = $Connection->db->prepare($query);
227
-		    $sth->execute();
228
-    		} catch(PDOException $e) {
229
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
230
-    		}
225
+			try {
226
+					$sth = $Connection->db->prepare($query);
227
+			$sth->execute();
228
+			} catch(PDOException $e) {
229
+			return "error (update schema_version) : ".$e->getMessage()."\n";
230
+			}
231 231
 		return $error;
232 232
 	}
233 233
 
234 234
 	private static function update_from_6() {
235
-    		$Connection = new Connection();
236
-    		if (!$Connection->indexExists('spotter_output','flightaware_id')) {
237
-    		    $query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id);
235
+			$Connection = new Connection();
236
+			if (!$Connection->indexExists('spotter_output','flightaware_id')) {
237
+				$query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id);
238 238
 			ALTER TABLE spotter_output ADD INDEX(date);
239 239
 			ALTER TABLE spotter_output ADD INDEX(ident);
240 240
 			ALTER TABLE spotter_live ADD INDEX(flightaware_id);
@@ -247,147 +247,147 @@  discard block
 block discarded – undo
247 247
 			ALTER TABLE aircraft ADD INDEX(icao);
248 248
 			ALTER TABLE airport ADD INDEX(icao);
249 249
 			ALTER TABLE translation ADD INDEX(Operator);";
250
-        	    try {
251
-            		$sth = $Connection->db->prepare($query);
250
+				try {
251
+					$sth = $Connection->db->prepare($query);
252 252
 			$sth->execute();
253
-    		    } catch(PDOException $e) {
253
+				} catch(PDOException $e) {
254 254
 			return "error (add some indexes) : ".$e->getMessage()."\n";
255
-    		    }
256
-    		}
257
-    		$error = '';
258
-    		// Update table countries
259
-    		if ($Connection->tableExists('airspace')) {
260
-    		    $error .= update_db::update_countries();
261
-		    if ($error != '') return $error;
255
+				}
256
+			}
257
+			$error = '';
258
+			// Update table countries
259
+			if ($Connection->tableExists('airspace')) {
260
+				$error .= update_db::update_countries();
261
+			if ($error != '') return $error;
262 262
 		}
263 263
 		// Update schema_version to 7
264 264
 		$query = "UPDATE `config` SET `value` = '7' WHERE `name` = 'schema_version'";
265
-        	try {
266
-            	    $sth = $Connection->db->prepare($query);
267
-		    $sth->execute();
268
-    		} catch(PDOException $e) {
269
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
270
-    		}
265
+			try {
266
+					$sth = $Connection->db->prepare($query);
267
+			$sth->execute();
268
+			} catch(PDOException $e) {
269
+			return "error (update schema_version) : ".$e->getMessage()."\n";
270
+			}
271 271
 		return $error;
272
-    	}
272
+		}
273 273
 
274 274
 	private static function update_from_7() {
275 275
 		global $globalDBname, $globalDBdriver;
276
-    		$Connection = new Connection();
277
-    		$query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
276
+			$Connection = new Connection();
277
+			$query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
278 278
     			ALTER TABLE spotter_output ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;";
279
-        	try {
280
-            	    $sth = $Connection->db->prepare($query);
281
-		    $sth->execute();
282
-    		} catch(PDOException $e) {
283
-		    return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
284
-    		}
285
-    		if ($globalDBdriver == 'mysql') {
286
-    		    $query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
287
-		    try {
288
-            		$sth = $Connection->db->prepare($query);
279
+			try {
280
+					$sth = $Connection->db->prepare($query);
289 281
 			$sth->execute();
290
-    		    } catch(PDOException $e) {
282
+			} catch(PDOException $e) {
283
+			return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
284
+			}
285
+			if ($globalDBdriver == 'mysql') {
286
+				$query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
287
+			try {
288
+					$sth = $Connection->db->prepare($query);
289
+			$sth->execute();
290
+				} catch(PDOException $e) {
291 291
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
292
-    		    }
293
-    		    $row = $sth->fetch(PDO::FETCH_ASSOC);
294
-    		    if ($row['engine'] == 'ARCHIVE') {
292
+				}
293
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
294
+				if ($row['engine'] == 'ARCHIVE') {
295 295
 			$query = "CREATE TABLE copy LIKE spotter_archive; 
296 296
 				ALTER TABLE copy ENGINE=ARCHIVE;
297 297
 				ALTER TABLE copy ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
298 298
 				INSERT INTO copy SELECT *, '' as pilot_name, '' as pilot_id FROM spotter_archive ORDER BY `spotter_archive_id`;
299 299
 				DROP TABLE spotter_archive;
300 300
 				RENAME TABLE copy TO spotter_archive;";
301
-            	    } else {
302
-    			$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
303
-            	    }
304
-                } else {
305
-    		    $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
306
-                }
307
-        	try {
308
-            	    $sth = $Connection->db->prepare($query);
309
-		    $sth->execute();
310
-    		} catch(PDOException $e) {
311
-		    return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n";
312
-    		}
301
+					} else {
302
+				$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
303
+					}
304
+				} else {
305
+				$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
306
+				}
307
+			try {
308
+					$sth = $Connection->db->prepare($query);
309
+			$sth->execute();
310
+			} catch(PDOException $e) {
311
+			return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n";
312
+			}
313 313
 
314
-    		$error = '';
315
-    		// Update table aircraft
314
+			$error = '';
315
+			// Update table aircraft
316 316
 		$error .= create_db::import_file('../db/source_location.sql');
317 317
 		if ($error != '') return $error;
318 318
 		// Update schema_version to 6
319 319
 		$query = "UPDATE `config` SET `value` = '8' WHERE `name` = 'schema_version'";
320
-        	try {
321
-            	    $sth = $Connection->db->prepare($query);
322
-		    $sth->execute();
323
-    		} catch(PDOException $e) {
324
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
325
-    		}
320
+			try {
321
+					$sth = $Connection->db->prepare($query);
322
+			$sth->execute();
323
+			} catch(PDOException $e) {
324
+			return "error (update schema_version) : ".$e->getMessage()."\n";
325
+			}
326 326
 		return $error;
327 327
 	}
328 328
 
329 329
 	private static function update_from_8() {
330
-    		$Connection = new Connection();
331
-    		$error = '';
332
-    		// Update table aircraft
330
+			$Connection = new Connection();
331
+			$error = '';
332
+			// Update table aircraft
333 333
 		$error .= create_db::import_file('../db/notam.sql');
334 334
 		if ($error != '') return $error;
335 335
 		$query = "DELETE FROM config WHERE name = 'last_update_db';
336 336
                         INSERT INTO config (name,value) VALUES ('last_update_db',NOW());
337 337
                         DELETE FROM config WHERE name = 'last_update_notam_db';
338 338
                         INSERT INTO config (name,value) VALUES ('last_update_notam_db',NOW());";
339
-        	try {
340
-            	    $sth = $Connection->db->prepare($query);
341
-		    $sth->execute();
342
-    		} catch(PDOException $e) {
343
-		    return "error (insert last_update values) : ".$e->getMessage()."\n";
344
-    		}
339
+			try {
340
+					$sth = $Connection->db->prepare($query);
341
+			$sth->execute();
342
+			} catch(PDOException $e) {
343
+			return "error (insert last_update values) : ".$e->getMessage()."\n";
344
+			}
345 345
 		$query = "UPDATE `config` SET `value` = '9' WHERE `name` = 'schema_version'";
346
-        	try {
347
-            	    $sth = $Connection->db->prepare($query);
348
-		    $sth->execute();
349
-    		} catch(PDOException $e) {
350
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
351
-    		}
346
+			try {
347
+					$sth = $Connection->db->prepare($query);
348
+			$sth->execute();
349
+			} catch(PDOException $e) {
350
+			return "error (update schema_version) : ".$e->getMessage()."\n";
351
+			}
352 352
 		return $error;
353 353
 	}
354 354
 
355 355
 	private static function update_from_9() {
356
-    		$Connection = new Connection();
357
-    		$query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
356
+			$Connection = new Connection();
357
+			$query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
358 358
     			ALTER TABLE spotter_output ADD verticalrate INT(11) NULL;";
359
-        	try {
360
-            	    $sth = $Connection->db->prepare($query);
361
-		    $sth->execute();
362
-    		} catch(PDOException $e) {
363
-		    return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
364
-    		}
359
+			try {
360
+					$sth = $Connection->db->prepare($query);
361
+			$sth->execute();
362
+			} catch(PDOException $e) {
363
+			return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
364
+			}
365 365
 		$error = '';
366
-    		// Update table atc
366
+			// Update table atc
367 367
 		$error .= create_db::import_file('../db/atc.sql');
368 368
 		if ($error != '') return $error;
369 369
 		
370 370
 		$query = "UPDATE `config` SET `value` = '10' WHERE `name` = 'schema_version'";
371
-        	try {
372
-            	    $sth = $Connection->db->prepare($query);
373
-		    $sth->execute();
374
-    		} catch(PDOException $e) {
375
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
376
-    		}
371
+			try {
372
+					$sth = $Connection->db->prepare($query);
373
+			$sth->execute();
374
+			} catch(PDOException $e) {
375
+			return "error (update schema_version) : ".$e->getMessage()."\n";
376
+			}
377 377
 		return $error;
378 378
 	}
379 379
 
380 380
 	private static function update_from_10() {
381
-    		$Connection = new Connection();
382
-    		$query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
383
-        	try {
384
-            	    $sth = $Connection->db->prepare($query);
385
-		    $sth->execute();
386
-    		} catch(PDOException $e) {
387
-		    return "error (add new enum to ATC table) : ".$e->getMessage()."\n";
388
-    		}
381
+			$Connection = new Connection();
382
+			$query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
383
+			try {
384
+					$sth = $Connection->db->prepare($query);
385
+			$sth->execute();
386
+			} catch(PDOException $e) {
387
+			return "error (add new enum to ATC table) : ".$e->getMessage()."\n";
388
+			}
389 389
 		$error = '';
390
-    		// Add tables
390
+			// Add tables
391 391
 		$error .= create_db::import_file('../db/aircraft_owner.sql');
392 392
 		if ($error != '') return $error;
393 393
 		$error .= create_db::import_file('../db/metar.sql');
@@ -398,76 +398,76 @@  discard block
 block discarded – undo
398 398
 		if ($error != '') return $error;
399 399
 		
400 400
 		$query = "UPDATE `config` SET `value` = '11' WHERE `name` = 'schema_version'";
401
-        	try {
402
-            	    $sth = $Connection->db->prepare($query);
403
-		    $sth->execute();
404
-    		} catch(PDOException $e) {
405
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
406
-    		}
401
+			try {
402
+					$sth = $Connection->db->prepare($query);
403
+			$sth->execute();
404
+			} catch(PDOException $e) {
405
+			return "error (update schema_version) : ".$e->getMessage()."\n";
406
+			}
407 407
 		return $error;
408 408
 	}
409 409
 
410 410
 	private static function update_from_11() {
411 411
 		global $globalDBdriver, $globalDBname;
412
-    		$Connection = new Connection();
413
-    		$query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
414
-        	try {
415
-            	    $sth = $Connection->db->prepare($query);
416
-		    $sth->execute();
417
-    		} catch(PDOException $e) {
418
-		    return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n";
419
-    		}
420
-    		$query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
421
-        	try {
422
-            	    $sth = $Connection->db->prepare($query);
423
-		    $sth->execute();
424
-    		} catch(PDOException $e) {
425
-		    return "error (format_source column to spotter_live) : ".$e->getMessage()."\n";
426
-    		}
427
-    		if ($globalDBdriver == 'mysql') {
428
-    		    $query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
429
-		    try {
430
-            		$sth = $Connection->db->prepare($query);
412
+			$Connection = new Connection();
413
+			$query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
414
+			try {
415
+					$sth = $Connection->db->prepare($query);
416
+			$sth->execute();
417
+			} catch(PDOException $e) {
418
+			return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n";
419
+			}
420
+			$query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
421
+			try {
422
+					$sth = $Connection->db->prepare($query);
431 423
 			$sth->execute();
432
-    		    } catch(PDOException $e) {
424
+			} catch(PDOException $e) {
425
+			return "error (format_source column to spotter_live) : ".$e->getMessage()."\n";
426
+			}
427
+			if ($globalDBdriver == 'mysql') {
428
+				$query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
429
+			try {
430
+					$sth = $Connection->db->prepare($query);
431
+			$sth->execute();
432
+				} catch(PDOException $e) {
433 433
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
434
-    		    }
435
-    		    $row = $sth->fetch(PDO::FETCH_ASSOC);
436
-    		    if ($row['engine'] == 'ARCHIVE') {
434
+				}
435
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
436
+				if ($row['engine'] == 'ARCHIVE') {
437 437
 			$query = "CREATE TABLE copy LIKE spotter_archive; 
438 438
 				ALTER TABLE copy ENGINE=ARCHIVE;
439 439
 				ALTER TABLE copy ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE;
440 440
 				INSERT INTO copy SELECT *, '' as verticalrate, '' as format_source, '0' as ground FROM spotter_archive ORDER BY `spotter_archive_id`;
441 441
 				DROP TABLE spotter_archive;
442 442
 				RENAME TABLE copy TO spotter_archive;";
443
-            	    } else {
444
-    			$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
445
-            	    }
446
-                } else {
447
-    		    $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
448
-                }
449
-        	try {
450
-            	    $sth = $Connection->db->prepare($query);
451
-		    $sth->execute();
452
-    		} catch(PDOException $e) {
453
-		    return "error (add columns to spotter_archive) : ".$e->getMessage()."\n";
454
-    		}
443
+					} else {
444
+				$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
445
+					}
446
+				} else {
447
+				$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
448
+				}
449
+			try {
450
+					$sth = $Connection->db->prepare($query);
451
+			$sth->execute();
452
+			} catch(PDOException $e) {
453
+			return "error (add columns to spotter_archive) : ".$e->getMessage()."\n";
454
+			}
455 455
 
456 456
 		$error = '';
457 457
 		
458 458
 		$query = "UPDATE `config` SET `value` = '12' WHERE `name` = 'schema_version'";
459
-        	try {
460
-            	    $sth = $Connection->db->prepare($query);
461
-		    $sth->execute();
462
-    		} catch(PDOException $e) {
463
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
464
-    		}
459
+			try {
460
+					$sth = $Connection->db->prepare($query);
461
+			$sth->execute();
462
+			} catch(PDOException $e) {
463
+			return "error (update schema_version) : ".$e->getMessage()."\n";
464
+			}
465 465
 		return $error;
466 466
 	}
467 467
 	private static function update_from_12() {
468
-    		$Connection = new Connection();
468
+			$Connection = new Connection();
469 469
 		$error = '';
470
-    		// Add tables
470
+			// Add tables
471 471
 		$error .= create_db::import_file('../db/stats.sql');
472 472
 		if ($error != '') return $error;
473 473
 		$error .= create_db::import_file('../db/stats_aircraft.sql');
@@ -484,166 +484,166 @@  discard block
 block discarded – undo
484 484
 		if ($error != '') return $error;
485 485
 		
486 486
 		$query = "UPDATE `config` SET `value` = '13' WHERE `name` = 'schema_version'";
487
-        	try {
488
-            	    $sth = $Connection->db->prepare($query);
489
-		    $sth->execute();
490
-    		} catch(PDOException $e) {
491
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
492
-    		}
487
+			try {
488
+					$sth = $Connection->db->prepare($query);
489
+			$sth->execute();
490
+			} catch(PDOException $e) {
491
+			return "error (update schema_version) : ".$e->getMessage()."\n";
492
+			}
493 493
 		return $error;
494 494
 	}
495 495
 
496 496
 	private static function update_from_13() {
497
-    		$Connection = new Connection();
498
-    		if (!$Connection->checkColumnName('spotter_archive_output','real_departure_airport_icao')) {
499
-    			$query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
497
+			$Connection = new Connection();
498
+			if (!$Connection->checkColumnName('spotter_archive_output','real_departure_airport_icao')) {
499
+				$query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
500 500
 			try {
501 501
 				$sth = $Connection->db->prepare($query);
502 502
 				$sth->execute();
503
-	    		} catch(PDOException $e) {
503
+				} catch(PDOException $e) {
504 504
 				return "error (update spotter_archive_output) : ".$e->getMessage()."\n";
505
-    			}
505
+				}
506 506
 		}
507
-    		$error = '';
507
+			$error = '';
508 508
 		$query = "UPDATE `config` SET `value` = '14' WHERE `name` = 'schema_version'";
509
-        	try {
510
-            	    $sth = $Connection->db->prepare($query);
511
-		    $sth->execute();
512
-    		} catch(PDOException $e) {
513
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
514
-    		}
509
+			try {
510
+					$sth = $Connection->db->prepare($query);
511
+			$sth->execute();
512
+			} catch(PDOException $e) {
513
+			return "error (update schema_version) : ".$e->getMessage()."\n";
514
+			}
515 515
 		return $error;
516 516
 	}
517 517
 
518 518
 	private static function update_from_14() {
519
-    		$Connection = new Connection();
519
+			$Connection = new Connection();
520 520
 		$error = '';
521
-    		// Add tables
522
-    		if (!$Connection->tableExists('stats_flight')) {
521
+			// Add tables
522
+			if (!$Connection->tableExists('stats_flight')) {
523 523
 			$error .= create_db::import_file('../db/stats_flight.sql');
524 524
 			if ($error != '') return $error;
525 525
 		}
526 526
 		$query = "UPDATE `config` SET `value` = '15' WHERE `name` = 'schema_version'";
527
-        	try {
528
-            	    $sth = $Connection->db->prepare($query);
529
-		    $sth->execute();
530
-    		} catch(PDOException $e) {
531
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
532
-    		}
527
+			try {
528
+					$sth = $Connection->db->prepare($query);
529
+			$sth->execute();
530
+			} catch(PDOException $e) {
531
+			return "error (update schema_version) : ".$e->getMessage()."\n";
532
+			}
533 533
 		return $error;
534 534
 	}
535 535
 
536 536
 
537 537
 	private static function update_from_15() {
538
-    		$Connection = new Connection();
538
+			$Connection = new Connection();
539 539
 		$error = '';
540
-    		// Add tables
541
-    		$query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
542
-        	try {
543
-            	    $sth = $Connection->db->prepare($query);
544
-		    $sth->execute();
545
-    		} catch(PDOException $e) {
546
-		    return "error (update stats) : ".$e->getMessage()."\n";
547
-    		}
540
+			// Add tables
541
+			$query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
542
+			try {
543
+					$sth = $Connection->db->prepare($query);
544
+			$sth->execute();
545
+			} catch(PDOException $e) {
546
+			return "error (update stats) : ".$e->getMessage()."\n";
547
+			}
548 548
 		if ($error != '') return $error;
549 549
 		$query = "UPDATE `config` SET `value` = '16' WHERE `name` = 'schema_version'";
550
-        	try {
551
-            	    $sth = $Connection->db->prepare($query);
552
-		    $sth->execute();
553
-    		} catch(PDOException $e) {
554
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
555
-    		}
550
+			try {
551
+					$sth = $Connection->db->prepare($query);
552
+			$sth->execute();
553
+			} catch(PDOException $e) {
554
+			return "error (update schema_version) : ".$e->getMessage()."\n";
555
+			}
556 556
 		return $error;
557 557
 	}
558 558
 
559 559
 	private static function update_from_16() {
560
-    		$Connection = new Connection();
560
+			$Connection = new Connection();
561 561
 		$error = '';
562
-    		// Add tables
563
-    		if (!$Connection->tableExists('stats_registration')) {
562
+			// Add tables
563
+			if (!$Connection->tableExists('stats_registration')) {
564 564
 			$error .= create_db::import_file('../db/stats_registration.sql');
565 565
 		}
566
-    		if (!$Connection->tableExists('stats_callsign')) {
566
+			if (!$Connection->tableExists('stats_callsign')) {
567 567
 			$error .= create_db::import_file('../db/stats_callsign.sql');
568 568
 		}
569 569
 		if ($error != '') return $error;
570 570
 		$query = "UPDATE `config` SET `value` = '17' WHERE `name` = 'schema_version'";
571
-        	try {
572
-            	    $sth = $Connection->db->prepare($query);
573
-		    $sth->execute();
574
-    		} catch(PDOException $e) {
575
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
576
-    		}
571
+			try {
572
+					$sth = $Connection->db->prepare($query);
573
+			$sth->execute();
574
+			} catch(PDOException $e) {
575
+			return "error (update schema_version) : ".$e->getMessage()."\n";
576
+			}
577 577
 		return $error;
578 578
 	}
579 579
 
580 580
 	private static function update_from_17() {
581
-    		$Connection = new Connection();
581
+			$Connection = new Connection();
582 582
 		$error = '';
583
-    		// Add tables
584
-    		if (!$Connection->tableExists('stats_country')) {
583
+			// Add tables
584
+			if (!$Connection->tableExists('stats_country')) {
585 585
 			$error .= create_db::import_file('../db/stats_country.sql');
586 586
 		}
587 587
 		if ($error != '') return $error;
588 588
 		$query = "UPDATE `config` SET `value` = '18' WHERE `name` = 'schema_version'";
589
-        	try {
590
-            	    $sth = $Connection->db->prepare($query);
591
-		    $sth->execute();
592
-    		} catch(PDOException $e) {
593
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
594
-    		}
589
+			try {
590
+					$sth = $Connection->db->prepare($query);
591
+			$sth->execute();
592
+			} catch(PDOException $e) {
593
+			return "error (update schema_version) : ".$e->getMessage()."\n";
594
+			}
595 595
 		return $error;
596 596
 	}
597 597
 	private static function update_from_18() {
598
-    		$Connection = new Connection();
598
+			$Connection = new Connection();
599 599
 		$error = '';
600
-    		// Modify stats_airport table
601
-    		if (!$Connection->checkColumnName('stats_airport','airport_name')) {
602
-    			$query = "ALTER TABLE `stats_airport` ADD `stats_type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)";
603
-    	        	try {
604
-	            	    $sth = $Connection->db->prepare($query);
605
-			    $sth->execute();
606
-    			} catch(PDOException $e) {
607
-			    return "error (update stats) : ".$e->getMessage()."\n";
608
-    			}
609
-    		}
600
+			// Modify stats_airport table
601
+			if (!$Connection->checkColumnName('stats_airport','airport_name')) {
602
+				$query = "ALTER TABLE `stats_airport` ADD `stats_type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)";
603
+					try {
604
+						$sth = $Connection->db->prepare($query);
605
+				$sth->execute();
606
+				} catch(PDOException $e) {
607
+				return "error (update stats) : ".$e->getMessage()."\n";
608
+				}
609
+			}
610 610
 		if ($error != '') return $error;
611 611
 		$query = "UPDATE `config` SET `value` = '19' WHERE `name` = 'schema_version'";
612
-        	try {
613
-            	    $sth = $Connection->db->prepare($query);
614
-		    $sth->execute();
615
-    		} catch(PDOException $e) {
616
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
617
-    		}
612
+			try {
613
+					$sth = $Connection->db->prepare($query);
614
+			$sth->execute();
615
+			} catch(PDOException $e) {
616
+			return "error (update schema_version) : ".$e->getMessage()."\n";
617
+			}
618 618
 		return $error;
619 619
 	}
620 620
 
621 621
 	private static function update_from_19() {
622
-    		$Connection = new Connection();
622
+			$Connection = new Connection();
623 623
 		$error = '';
624
-    		// Update airport table
624
+			// Update airport table
625 625
 		$error .= create_db::import_file('../db/airport.sql');
626 626
 		if ($error != '') return 'Import airport.sql : '.$error;
627 627
 		// Remove primary key on Spotter_Archive
628 628
 		$query = "alter table spotter_archive drop spotter_archive_id";
629
-        	try {
630
-            	    $sth = $Connection->db->prepare($query);
631
-		    $sth->execute();
632
-    		} catch(PDOException $e) {
633
-		    return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n";
634
-    		}
629
+			try {
630
+					$sth = $Connection->db->prepare($query);
631
+			$sth->execute();
632
+			} catch(PDOException $e) {
633
+			return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n";
634
+			}
635 635
 		$query = "alter table spotter_archive add spotter_archive_id INT(11)";
636
-        	try {
637
-            	    $sth = $Connection->db->prepare($query);
638
-		    $sth->execute();
639
-    		} catch(PDOException $e) {
640
-		    return "error (add id again on spotter_archive) : ".$e->getMessage()."\n";
641
-    		}
636
+			try {
637
+					$sth = $Connection->db->prepare($query);
638
+			$sth->execute();
639
+			} catch(PDOException $e) {
640
+			return "error (add id again on spotter_archive) : ".$e->getMessage()."\n";
641
+			}
642 642
 		if (!$Connection->checkColumnName('spotter_archive','over_country')) {
643 643
 			// Add column over_country
644
-    			$query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
644
+				$query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
645 645
 			try {
646
-            			$sth = $Connection->db->prepare($query);
646
+						$sth = $Connection->db->prepare($query);
647 647
 				$sth->execute();
648 648
 			} catch(PDOException $e) {
649 649
 				return "error (add over_country) : ".$e->getMessage()."\n";
@@ -651,9 +651,9 @@  discard block
 block discarded – undo
651 651
 		}
652 652
 		if (!$Connection->checkColumnName('spotter_live','over_country')) {
653 653
 			// Add column over_country
654
-    			$query = "ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
654
+				$query = "ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
655 655
 			try {
656
-            			$sth = $Connection->db->prepare($query);
656
+						$sth = $Connection->db->prepare($query);
657 657
 				$sth->execute();
658 658
 			} catch(PDOException $e) {
659 659
 				return "error (add over_country) : ".$e->getMessage()."\n";
@@ -661,74 +661,74 @@  discard block
 block discarded – undo
661 661
 		}
662 662
 		if (!$Connection->checkColumnName('spotter_output','source_name')) {
663 663
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
664
-    			$query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
664
+				$query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
665 665
 			try {
666 666
 				$sth = $Connection->db->prepare($query);
667 667
 				$sth->execute();
668 668
 			} catch(PDOException $e) {
669 669
 				return "error (add source_name column) : ".$e->getMessage()."\n";
670
-    			}
671
-    		}
670
+				}
671
+			}
672 672
 		if (!$Connection->checkColumnName('spotter_live','source_name')) {
673 673
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
674
-    			$query = "ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
674
+				$query = "ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
675 675
 			try {
676 676
 				$sth = $Connection->db->prepare($query);
677 677
 				$sth->execute();
678 678
 			} catch(PDOException $e) {
679 679
 				return "error (add source_name column) : ".$e->getMessage()."\n";
680
-    			}
681
-    		}
680
+				}
681
+			}
682 682
 		if (!$Connection->checkColumnName('spotter_archive_output','source_name')) {
683 683
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
684
-    			$query = "ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
684
+				$query = "ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
685 685
 			try {
686 686
 				$sth = $Connection->db->prepare($query);
687 687
 				$sth->execute();
688 688
 			} catch(PDOException $e) {
689 689
 				return "error (add source_name column) : ".$e->getMessage()."\n";
690
-    			}
691
-    		}
690
+				}
691
+			}
692 692
 		if (!$Connection->checkColumnName('spotter_archive','source_name')) {
693 693
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
694
-    			$query = "ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;";
694
+				$query = "ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;";
695 695
 			try {
696 696
 				$sth = $Connection->db->prepare($query);
697 697
 				$sth->execute();
698 698
 			} catch(PDOException $e) {
699 699
 				return "error (add source_name column) : ".$e->getMessage()."\n";
700
-    			}
701
-    		}
700
+				}
701
+			}
702 702
 		if ($error != '') return $error;
703 703
 		$query = "UPDATE `config` SET `value` = '20' WHERE `name` = 'schema_version'";
704
-        	try {
705
-            	    $sth = $Connection->db->prepare($query);
706
-		    $sth->execute();
707
-    		} catch(PDOException $e) {
708
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
709
-    		}
704
+			try {
705
+					$sth = $Connection->db->prepare($query);
706
+			$sth->execute();
707
+			} catch(PDOException $e) {
708
+			return "error (update schema_version) : ".$e->getMessage()."\n";
709
+			}
710 710
 		return $error;
711 711
 	}
712 712
 
713 713
 	private static function update_from_20() {
714 714
 		global $globalIVAO, $globalVATSIM, $globalphpVMS;
715
-    		$Connection = new Connection();
715
+			$Connection = new Connection();
716 716
 		$error = '';
717
-    		// Update airline table
718
-    		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
717
+			// Update airline table
718
+			if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
719 719
 			$error .= create_db::import_file('../db/airlines.sql');
720 720
 			if ($error != '') return 'Import airlines.sql : '.$error;
721 721
 		}
722 722
 		if (!$Connection->checkColumnName('aircraft_modes','type_flight')) {
723 723
 			// Add column over_country
724
-    			$query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;";
725
-        		try {
724
+				$query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;";
725
+				try {
726 726
 				$sth = $Connection->db->prepare($query);
727 727
 				$sth->execute();
728 728
 			} catch(PDOException $e) {
729 729
 				return "error (add over_country) : ".$e->getMessage()."\n";
730
-    			}
731
-    		}
730
+				}
731
+			}
732 732
 		if ($error != '') return $error;
733 733
 		/*
734 734
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
@@ -738,12 +738,12 @@  discard block
 block discarded – undo
738 738
 		}
739 739
 		*/
740 740
 		$query = "UPDATE `config` SET `value` = '21' WHERE `name` = 'schema_version'";
741
-        	try {
742
-            	    $sth = $Connection->db->prepare($query);
743
-		    $sth->execute();
744
-    		} catch(PDOException $e) {
745
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
746
-    		}
741
+			try {
742
+					$sth = $Connection->db->prepare($query);
743
+			$sth->execute();
744
+			} catch(PDOException $e) {
745
+			return "error (update schema_version) : ".$e->getMessage()."\n";
746
+			}
747 747
 		return $error;
748 748
 	}
749 749
 
@@ -762,35 +762,35 @@  discard block
 block discarded – undo
762 762
 			if ($error != '') return $error;
763 763
 		}
764 764
 		$query = "UPDATE `config` SET `value` = '22' WHERE `name` = 'schema_version'";
765
-        	try {
766
-            	    $sth = $Connection->db->prepare($query);
767
-		    $sth->execute();
768
-    		} catch(PDOException $e) {
769
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
770
-    		}
765
+			try {
766
+					$sth = $Connection->db->prepare($query);
767
+			$sth->execute();
768
+			} catch(PDOException $e) {
769
+			return "error (update schema_version) : ".$e->getMessage()."\n";
770
+			}
771 771
 		return $error;
772 772
 	}
773 773
 
774 774
 	private static function update_from_22() {
775 775
 		global $globalDBdriver;
776
-    		$Connection = new Connection();
776
+			$Connection = new Connection();
777 777
 		$error = '';
778 778
 		// Add table stats polar
779
-    		if (!$Connection->tableExists('stats_source')) {
779
+			if (!$Connection->tableExists('stats_source')) {
780 780
 			if ($globalDBdriver == 'mysql') {
781
-    				$error .= create_db::import_file('../db/stats_source.sql');
781
+					$error .= create_db::import_file('../db/stats_source.sql');
782 782
 			} else {
783 783
 				$error .= create_db::import_file('../db/pgsql/stats_source.sql');
784 784
 			}
785 785
 			if ($error != '') return $error;
786 786
 		}
787 787
 		$query = "UPDATE config SET value = '23' WHERE name = 'schema_version'";
788
-        	try {
789
-            	    $sth = $Connection->db->prepare($query);
790
-		    $sth->execute();
791
-    		} catch(PDOException $e) {
792
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
793
-    		}
788
+			try {
789
+					$sth = $Connection->db->prepare($query);
790
+			$sth->execute();
791
+			} catch(PDOException $e) {
792
+			return "error (update schema_version) : ".$e->getMessage()."\n";
793
+			}
794 794
 		return $error;
795 795
 	}
796 796
 
@@ -821,14 +821,14 @@  discard block
 block discarded – undo
821 821
 		}
822 822
 		if (!$Connection->checkColumnName('stats_aircraft','aircraft_manufacturer')) {
823 823
 			// Add aircraft_manufacturer to stats_aircraft
824
-    			$query = "ALTER TABLE stats_aircraft ADD aircraft_manufacturer VARCHAR(255) NULL";
824
+				$query = "ALTER TABLE stats_aircraft ADD aircraft_manufacturer VARCHAR(255) NULL";
825 825
 			try {
826 826
 				$sth = $Connection->db->prepare($query);
827 827
 				$sth->execute();
828 828
 			} catch(PDOException $e) {
829 829
 				return "error (add aircraft_manufacturer column) : ".$e->getMessage()."\n";
830
-    			}
831
-    		}
830
+				}
831
+			}
832 832
 		
833 833
 		$query = "UPDATE config SET value = '24' WHERE name = 'schema_version'";
834 834
 		try {
@@ -1095,129 +1095,129 @@  discard block
 block discarded – undo
1095 1095
 
1096 1096
 
1097 1097
 
1098
-    	public static function check_version($update = false) {
1099
-    	    global $globalDBname;
1100
-    	    $version = 0;
1101
-    	    $Connection = new Connection();
1102
-    	    if ($Connection->tableExists('aircraft')) {
1103
-    		if (!$Connection->tableExists('config')) {
1104
-    		    $version = '1';
1105
-    		    if ($update) return self::update_from_1();
1106
-    		    else return $version;
1098
+		public static function check_version($update = false) {
1099
+			global $globalDBname;
1100
+			$version = 0;
1101
+			$Connection = new Connection();
1102
+			if ($Connection->tableExists('aircraft')) {
1103
+			if (!$Connection->tableExists('config')) {
1104
+				$version = '1';
1105
+				if ($update) return self::update_from_1();
1106
+				else return $version;
1107 1107
 		} else {
1108
-    		    $Connection = new Connection();
1109
-		    $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
1110
-		    try {
1111
-            		$sth = $Connection->db->prepare($query);
1112
-		        $sth->execute();
1113
-		    } catch(PDOException $e) {
1108
+				$Connection = new Connection();
1109
+			$query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
1110
+			try {
1111
+					$sth = $Connection->db->prepare($query);
1112
+				$sth->execute();
1113
+			} catch(PDOException $e) {
1114 1114
 			return "error : ".$e->getMessage()."\n";
1115
-    		    }
1116
-    		    $result = $sth->fetch(PDO::FETCH_ASSOC);
1117
-    		    if ($update) {
1118
-    			if ($result['value'] == '2') {
1119
-    			    $error = self::update_from_2();
1120
-    			    if ($error != '') return $error;
1121
-    			    else return self::check_version(true);
1122
-    			} elseif ($result['value'] == '3') {
1123
-    			    $error = self::update_from_3();
1124
-    			    if ($error != '') return $error;
1125
-    			    else return self::check_version(true);
1126
-    			} elseif ($result['value'] == '4') {
1127
-    			    $error = self::update_from_4();
1128
-    			    if ($error != '') return $error;
1129
-    			    else return self::check_version(true);
1130
-    			} elseif ($result['value'] == '5') {
1131
-    			    $error = self::update_from_5();
1132
-    			    if ($error != '') return $error;
1133
-    			    else return self::check_version(true);
1134
-    			} elseif ($result['value'] == '6') {
1135
-    			    $error = self::update_from_6();
1136
-    			    if ($error != '') return $error;
1137
-    			    else return self::check_version(true);
1138
-    			} elseif ($result['value'] == '7') {
1139
-    			    $error = self::update_from_7();
1140
-    			    if ($error != '') return $error;
1141
-    			    else return self::check_version(true);
1142
-    			} elseif ($result['value'] == '8') {
1143
-    			    $error = self::update_from_8();
1144
-    			    if ($error != '') return $error;
1145
-    			    else return self::check_version(true);
1146
-    			} elseif ($result['value'] == '9') {
1147
-    			    $error = self::update_from_9();
1148
-    			    if ($error != '') return $error;
1149
-    			    else return self::check_version(true);
1150
-    			} elseif ($result['value'] == '10') {
1151
-    			    $error = self::update_from_10();
1152
-    			    if ($error != '') return $error;
1153
-    			    else return self::check_version(true);
1154
-    			} elseif ($result['value'] == '11') {
1155
-    			    $error = self::update_from_11();
1156
-    			    if ($error != '') return $error;
1157
-    			    else return self::check_version(true);
1158
-    			} elseif ($result['value'] == '12') {
1159
-    			    $error = self::update_from_12();
1160
-    			    if ($error != '') return $error;
1161
-    			    else return self::check_version(true);
1162
-    			} elseif ($result['value'] == '13') {
1163
-    			    $error = self::update_from_13();
1164
-    			    if ($error != '') return $error;
1165
-    			    else return self::check_version(true);
1166
-    			} elseif ($result['value'] == '14') {
1167
-    			    $error = self::update_from_14();
1168
-    			    if ($error != '') return $error;
1169
-    			    else return self::check_version(true);
1170
-    			} elseif ($result['value'] == '15') {
1171
-    			    $error = self::update_from_15();
1172
-    			    if ($error != '') return $error;
1173
-    			    else return self::check_version(true);
1174
-    			} elseif ($result['value'] == '16') {
1175
-    			    $error = self::update_from_16();
1176
-    			    if ($error != '') return $error;
1177
-    			    else return self::check_version(true);
1178
-    			} elseif ($result['value'] == '17') {
1179
-    			    $error = self::update_from_17();
1180
-    			    if ($error != '') return $error;
1181
-    			    else return self::check_version(true);
1182
-    			} elseif ($result['value'] == '18') {
1183
-    			    $error = self::update_from_18();
1184
-    			    if ($error != '') return $error;
1185
-    			    else return self::check_version(true);
1186
-    			} elseif ($result['value'] == '19') {
1187
-    			    $error = self::update_from_19();
1188
-    			    if ($error != '') return $error;
1189
-    			    else return self::check_version(true);
1190
-    			} elseif ($result['value'] == '20') {
1191
-    			    $error = self::update_from_20();
1192
-    			    if ($error != '') return $error;
1193
-    			    else return self::check_version(true);
1194
-    			} elseif ($result['value'] == '21') {
1195
-    			    $error = self::update_from_21();
1196
-    			    if ($error != '') return $error;
1197
-    			    else return self::check_version(true);
1198
-    			} elseif ($result['value'] == '22') {
1199
-    			    $error = self::update_from_22();
1200
-    			    if ($error != '') return $error;
1201
-    			    else return self::check_version(true);
1202
-    			} elseif ($result['value'] == '23') {
1203
-    			    $error = self::update_from_23();
1204
-    			    if ($error != '') return $error;
1205
-    			    else return self::check_version(true);
1206
-    			} elseif ($result['value'] == '24') {
1207
-    			    $error = self::update_from_24();
1208
-    			    if ($error != '') return $error;
1209
-    			    else return self::check_version(true);
1210
-    			} elseif ($result['value'] == '25') {
1211
-    			    $error = self::update_from_25();
1212
-    			    if ($error != '') return $error;
1213
-    			    else return self::check_version(true);
1214
-    			} else return '';
1215
-    		    }
1216
-    		    else return $result['value'];
1115
+				}
1116
+				$result = $sth->fetch(PDO::FETCH_ASSOC);
1117
+				if ($update) {
1118
+				if ($result['value'] == '2') {
1119
+					$error = self::update_from_2();
1120
+					if ($error != '') return $error;
1121
+					else return self::check_version(true);
1122
+				} elseif ($result['value'] == '3') {
1123
+					$error = self::update_from_3();
1124
+					if ($error != '') return $error;
1125
+					else return self::check_version(true);
1126
+				} elseif ($result['value'] == '4') {
1127
+					$error = self::update_from_4();
1128
+					if ($error != '') return $error;
1129
+					else return self::check_version(true);
1130
+				} elseif ($result['value'] == '5') {
1131
+					$error = self::update_from_5();
1132
+					if ($error != '') return $error;
1133
+					else return self::check_version(true);
1134
+				} elseif ($result['value'] == '6') {
1135
+					$error = self::update_from_6();
1136
+					if ($error != '') return $error;
1137
+					else return self::check_version(true);
1138
+				} elseif ($result['value'] == '7') {
1139
+					$error = self::update_from_7();
1140
+					if ($error != '') return $error;
1141
+					else return self::check_version(true);
1142
+				} elseif ($result['value'] == '8') {
1143
+					$error = self::update_from_8();
1144
+					if ($error != '') return $error;
1145
+					else return self::check_version(true);
1146
+				} elseif ($result['value'] == '9') {
1147
+					$error = self::update_from_9();
1148
+					if ($error != '') return $error;
1149
+					else return self::check_version(true);
1150
+				} elseif ($result['value'] == '10') {
1151
+					$error = self::update_from_10();
1152
+					if ($error != '') return $error;
1153
+					else return self::check_version(true);
1154
+				} elseif ($result['value'] == '11') {
1155
+					$error = self::update_from_11();
1156
+					if ($error != '') return $error;
1157
+					else return self::check_version(true);
1158
+				} elseif ($result['value'] == '12') {
1159
+					$error = self::update_from_12();
1160
+					if ($error != '') return $error;
1161
+					else return self::check_version(true);
1162
+				} elseif ($result['value'] == '13') {
1163
+					$error = self::update_from_13();
1164
+					if ($error != '') return $error;
1165
+					else return self::check_version(true);
1166
+				} elseif ($result['value'] == '14') {
1167
+					$error = self::update_from_14();
1168
+					if ($error != '') return $error;
1169
+					else return self::check_version(true);
1170
+				} elseif ($result['value'] == '15') {
1171
+					$error = self::update_from_15();
1172
+					if ($error != '') return $error;
1173
+					else return self::check_version(true);
1174
+				} elseif ($result['value'] == '16') {
1175
+					$error = self::update_from_16();
1176
+					if ($error != '') return $error;
1177
+					else return self::check_version(true);
1178
+				} elseif ($result['value'] == '17') {
1179
+					$error = self::update_from_17();
1180
+					if ($error != '') return $error;
1181
+					else return self::check_version(true);
1182
+				} elseif ($result['value'] == '18') {
1183
+					$error = self::update_from_18();
1184
+					if ($error != '') return $error;
1185
+					else return self::check_version(true);
1186
+				} elseif ($result['value'] == '19') {
1187
+					$error = self::update_from_19();
1188
+					if ($error != '') return $error;
1189
+					else return self::check_version(true);
1190
+				} elseif ($result['value'] == '20') {
1191
+					$error = self::update_from_20();
1192
+					if ($error != '') return $error;
1193
+					else return self::check_version(true);
1194
+				} elseif ($result['value'] == '21') {
1195
+					$error = self::update_from_21();
1196
+					if ($error != '') return $error;
1197
+					else return self::check_version(true);
1198
+				} elseif ($result['value'] == '22') {
1199
+					$error = self::update_from_22();
1200
+					if ($error != '') return $error;
1201
+					else return self::check_version(true);
1202
+				} elseif ($result['value'] == '23') {
1203
+					$error = self::update_from_23();
1204
+					if ($error != '') return $error;
1205
+					else return self::check_version(true);
1206
+				} elseif ($result['value'] == '24') {
1207
+					$error = self::update_from_24();
1208
+					if ($error != '') return $error;
1209
+					else return self::check_version(true);
1210
+				} elseif ($result['value'] == '25') {
1211
+					$error = self::update_from_25();
1212
+					if ($error != '') return $error;
1213
+					else return self::check_version(true);
1214
+				} else return '';
1215
+				}
1216
+				else return $result['value'];
1217 1217
 		}
1218 1218
 		
1219
-	    } else return $version;
1220
-    	}
1219
+		} else return $version;
1220
+		}
1221 1221
     	
1222 1222
 }
1223 1223
 //echo update_schema::check_version();
Please login to merge, or discard this patch.
Braces   +220 added lines, -82 removed lines patch added patch discarded remove patch
@@ -258,7 +258,9 @@  discard block
 block discarded – undo
258 258
     		// Update table countries
259 259
     		if ($Connection->tableExists('airspace')) {
260 260
     		    $error .= update_db::update_countries();
261
-		    if ($error != '') return $error;
261
+		    if ($error != '') {
262
+		    	return $error;
263
+		    }
262 264
 		}
263 265
 		// Update schema_version to 7
264 266
 		$query = "UPDATE `config` SET `value` = '7' WHERE `name` = 'schema_version'";
@@ -314,7 +316,9 @@  discard block
 block discarded – undo
314 316
     		$error = '';
315 317
     		// Update table aircraft
316 318
 		$error .= create_db::import_file('../db/source_location.sql');
317
-		if ($error != '') return $error;
319
+		if ($error != '') {
320
+			return $error;
321
+		}
318 322
 		// Update schema_version to 6
319 323
 		$query = "UPDATE `config` SET `value` = '8' WHERE `name` = 'schema_version'";
320 324
         	try {
@@ -331,7 +335,9 @@  discard block
 block discarded – undo
331 335
     		$error = '';
332 336
     		// Update table aircraft
333 337
 		$error .= create_db::import_file('../db/notam.sql');
334
-		if ($error != '') return $error;
338
+		if ($error != '') {
339
+			return $error;
340
+		}
335 341
 		$query = "DELETE FROM config WHERE name = 'last_update_db';
336 342
                         INSERT INTO config (name,value) VALUES ('last_update_db',NOW());
337 343
                         DELETE FROM config WHERE name = 'last_update_notam_db';
@@ -365,7 +371,9 @@  discard block
 block discarded – undo
365 371
 		$error = '';
366 372
     		// Update table atc
367 373
 		$error .= create_db::import_file('../db/atc.sql');
368
-		if ($error != '') return $error;
374
+		if ($error != '') {
375
+			return $error;
376
+		}
369 377
 		
370 378
 		$query = "UPDATE `config` SET `value` = '10' WHERE `name` = 'schema_version'";
371 379
         	try {
@@ -389,13 +397,21 @@  discard block
 block discarded – undo
389 397
 		$error = '';
390 398
     		// Add tables
391 399
 		$error .= create_db::import_file('../db/aircraft_owner.sql');
392
-		if ($error != '') return $error;
400
+		if ($error != '') {
401
+			return $error;
402
+		}
393 403
 		$error .= create_db::import_file('../db/metar.sql');
394
-		if ($error != '') return $error;
404
+		if ($error != '') {
405
+			return $error;
406
+		}
395 407
 		$error .= create_db::import_file('../db/taf.sql');
396
-		if ($error != '') return $error;
408
+		if ($error != '') {
409
+			return $error;
410
+		}
397 411
 		$error .= create_db::import_file('../db/airport.sql');
398
-		if ($error != '') return $error;
412
+		if ($error != '') {
413
+			return $error;
414
+		}
399 415
 		
400 416
 		$query = "UPDATE `config` SET `value` = '11' WHERE `name` = 'schema_version'";
401 417
         	try {
@@ -469,19 +485,33 @@  discard block
 block discarded – undo
469 485
 		$error = '';
470 486
     		// Add tables
471 487
 		$error .= create_db::import_file('../db/stats.sql');
472
-		if ($error != '') return $error;
488
+		if ($error != '') {
489
+			return $error;
490
+		}
473 491
 		$error .= create_db::import_file('../db/stats_aircraft.sql');
474
-		if ($error != '') return $error;
492
+		if ($error != '') {
493
+			return $error;
494
+		}
475 495
 		$error .= create_db::import_file('../db/stats_airline.sql');
476
-		if ($error != '') return $error;
496
+		if ($error != '') {
497
+			return $error;
498
+		}
477 499
 		$error .= create_db::import_file('../db/stats_airport.sql');
478
-		if ($error != '') return $error;
500
+		if ($error != '') {
501
+			return $error;
502
+		}
479 503
 		$error .= create_db::import_file('../db/stats_owner.sql');
480
-		if ($error != '') return $error;
504
+		if ($error != '') {
505
+			return $error;
506
+		}
481 507
 		$error .= create_db::import_file('../db/stats_pilot.sql');
482
-		if ($error != '') return $error;
508
+		if ($error != '') {
509
+			return $error;
510
+		}
483 511
 		$error .= create_db::import_file('../db/spotter_archive_output.sql');
484
-		if ($error != '') return $error;
512
+		if ($error != '') {
513
+			return $error;
514
+		}
485 515
 		
486 516
 		$query = "UPDATE `config` SET `value` = '13' WHERE `name` = 'schema_version'";
487 517
         	try {
@@ -521,7 +551,9 @@  discard block
 block discarded – undo
521 551
     		// Add tables
522 552
     		if (!$Connection->tableExists('stats_flight')) {
523 553
 			$error .= create_db::import_file('../db/stats_flight.sql');
524
-			if ($error != '') return $error;
554
+			if ($error != '') {
555
+				return $error;
556
+			}
525 557
 		}
526 558
 		$query = "UPDATE `config` SET `value` = '15' WHERE `name` = 'schema_version'";
527 559
         	try {
@@ -545,7 +577,9 @@  discard block
 block discarded – undo
545 577
     		} catch(PDOException $e) {
546 578
 		    return "error (update stats) : ".$e->getMessage()."\n";
547 579
     		}
548
-		if ($error != '') return $error;
580
+		if ($error != '') {
581
+			return $error;
582
+		}
549 583
 		$query = "UPDATE `config` SET `value` = '16' WHERE `name` = 'schema_version'";
550 584
         	try {
551 585
             	    $sth = $Connection->db->prepare($query);
@@ -566,7 +600,9 @@  discard block
 block discarded – undo
566 600
     		if (!$Connection->tableExists('stats_callsign')) {
567 601
 			$error .= create_db::import_file('../db/stats_callsign.sql');
568 602
 		}
569
-		if ($error != '') return $error;
603
+		if ($error != '') {
604
+			return $error;
605
+		}
570 606
 		$query = "UPDATE `config` SET `value` = '17' WHERE `name` = 'schema_version'";
571 607
         	try {
572 608
             	    $sth = $Connection->db->prepare($query);
@@ -584,7 +620,9 @@  discard block
 block discarded – undo
584 620
     		if (!$Connection->tableExists('stats_country')) {
585 621
 			$error .= create_db::import_file('../db/stats_country.sql');
586 622
 		}
587
-		if ($error != '') return $error;
623
+		if ($error != '') {
624
+			return $error;
625
+		}
588 626
 		$query = "UPDATE `config` SET `value` = '18' WHERE `name` = 'schema_version'";
589 627
         	try {
590 628
             	    $sth = $Connection->db->prepare($query);
@@ -607,7 +645,9 @@  discard block
 block discarded – undo
607 645
 			    return "error (update stats) : ".$e->getMessage()."\n";
608 646
     			}
609 647
     		}
610
-		if ($error != '') return $error;
648
+		if ($error != '') {
649
+			return $error;
650
+		}
611 651
 		$query = "UPDATE `config` SET `value` = '19' WHERE `name` = 'schema_version'";
612 652
         	try {
613 653
             	    $sth = $Connection->db->prepare($query);
@@ -623,7 +663,9 @@  discard block
 block discarded – undo
623 663
 		$error = '';
624 664
     		// Update airport table
625 665
 		$error .= create_db::import_file('../db/airport.sql');
626
-		if ($error != '') return 'Import airport.sql : '.$error;
666
+		if ($error != '') {
667
+			return 'Import airport.sql : '.$error;
668
+		}
627 669
 		// Remove primary key on Spotter_Archive
628 670
 		$query = "alter table spotter_archive drop spotter_archive_id";
629 671
         	try {
@@ -699,7 +741,9 @@  discard block
 block discarded – undo
699 741
 				return "error (add source_name column) : ".$e->getMessage()."\n";
700 742
     			}
701 743
     		}
702
-		if ($error != '') return $error;
744
+		if ($error != '') {
745
+			return $error;
746
+		}
703 747
 		$query = "UPDATE `config` SET `value` = '20' WHERE `name` = 'schema_version'";
704 748
         	try {
705 749
             	    $sth = $Connection->db->prepare($query);
@@ -717,7 +761,9 @@  discard block
 block discarded – undo
717 761
     		// Update airline table
718 762
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
719 763
 			$error .= create_db::import_file('../db/airlines.sql');
720
-			if ($error != '') return 'Import airlines.sql : '.$error;
764
+			if ($error != '') {
765
+				return 'Import airlines.sql : '.$error;
766
+			}
721 767
 		}
722 768
 		if (!$Connection->checkColumnName('aircraft_modes','type_flight')) {
723 769
 			// Add column over_country
@@ -729,7 +775,9 @@  discard block
 block discarded – undo
729 775
 				return "error (add over_country) : ".$e->getMessage()."\n";
730 776
     			}
731 777
     		}
732
-		if ($error != '') return $error;
778
+		if ($error != '') {
779
+			return $error;
780
+		}
733 781
 		/*
734 782
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
735 783
 			// Force update ModeS (this will put type_flight data
@@ -759,7 +807,9 @@  discard block
 block discarded – undo
759 807
 			} catch(PDOException $e) {
760 808
 				return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n";
761 809
 			}
762
-			if ($error != '') return $error;
810
+			if ($error != '') {
811
+				return $error;
812
+			}
763 813
 		}
764 814
 		$query = "UPDATE `config` SET `value` = '22' WHERE `name` = 'schema_version'";
765 815
         	try {
@@ -782,7 +832,9 @@  discard block
 block discarded – undo
782 832
 			} else {
783 833
 				$error .= create_db::import_file('../db/pgsql/stats_source.sql');
784 834
 			}
785
-			if ($error != '') return $error;
835
+			if ($error != '') {
836
+				return $error;
837
+			}
786 838
 		}
787 839
 		$query = "UPDATE config SET value = '23' WHERE name = 'schema_version'";
788 840
         	try {
@@ -804,12 +856,16 @@  discard block
 block discarded – undo
804 856
 		if ($globalDBdriver == 'mysql') {
805 857
 			if (!$Connection->tableExists('tle')) {
806 858
 				$error .= create_db::import_file('../db/tle.sql');
807
-				if ($error != '') return $error;
859
+				if ($error != '') {
860
+					return $error;
861
+				}
808 862
 			}
809 863
 		} else {
810 864
 			if (!$Connection->tableExists('tle')) {
811 865
 				$error .= create_db::import_file('../db/pgsql/tle.sql');
812
-				if ($error != '') return $error;
866
+				if ($error != '') {
867
+					return $error;
868
+				}
813 869
 			}
814 870
 			$query = "create index flightaware_id_idx ON spotter_archive USING btree(flightaware_id)";
815 871
 			try {
@@ -849,7 +905,9 @@  discard block
 block discarded – undo
849 905
 		} else {
850 906
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
851 907
 		}
852
-		if ($error != '') return 'Import airlines.sql : '.$error;
908
+		if ($error != '') {
909
+			return 'Import airlines.sql : '.$error;
910
+		}
853 911
 		if (!$Connection->checkColumnName('airlines','forsource')) {
854 912
 			// Add forsource to airlines
855 913
 			$query = "ALTER TABLE airlines ADD forsource VARCHAR(255) NULL DEFAULT NULL";
@@ -1102,8 +1160,11 @@  discard block
 block discarded – undo
1102 1160
     	    if ($Connection->tableExists('aircraft')) {
1103 1161
     		if (!$Connection->tableExists('config')) {
1104 1162
     		    $version = '1';
1105
-    		    if ($update) return self::update_from_1();
1106
-    		    else return $version;
1163
+    		    if ($update) {
1164
+    		    	return self::update_from_1();
1165
+    		    } else {
1166
+    		    	return $version;
1167
+    		    }
1107 1168
 		} else {
1108 1169
     		    $Connection = new Connection();
1109 1170
 		    $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
@@ -1117,106 +1178,183 @@  discard block
 block discarded – undo
1117 1178
     		    if ($update) {
1118 1179
     			if ($result['value'] == '2') {
1119 1180
     			    $error = self::update_from_2();
1120
-    			    if ($error != '') return $error;
1121
-    			    else return self::check_version(true);
1181
+    			    if ($error != '') {
1182
+    			    	return $error;
1183
+    			    } else {
1184
+    			    	return self::check_version(true);
1185
+    			    }
1122 1186
     			} elseif ($result['value'] == '3') {
1123 1187
     			    $error = self::update_from_3();
1124
-    			    if ($error != '') return $error;
1125
-    			    else return self::check_version(true);
1188
+    			    if ($error != '') {
1189
+    			    	return $error;
1190
+    			    } else {
1191
+    			    	return self::check_version(true);
1192
+    			    }
1126 1193
     			} elseif ($result['value'] == '4') {
1127 1194
     			    $error = self::update_from_4();
1128
-    			    if ($error != '') return $error;
1129
-    			    else return self::check_version(true);
1195
+    			    if ($error != '') {
1196
+    			    	return $error;
1197
+    			    } else {
1198
+    			    	return self::check_version(true);
1199
+    			    }
1130 1200
     			} elseif ($result['value'] == '5') {
1131 1201
     			    $error = self::update_from_5();
1132
-    			    if ($error != '') return $error;
1133
-    			    else return self::check_version(true);
1202
+    			    if ($error != '') {
1203
+    			    	return $error;
1204
+    			    } else {
1205
+    			    	return self::check_version(true);
1206
+    			    }
1134 1207
     			} elseif ($result['value'] == '6') {
1135 1208
     			    $error = self::update_from_6();
1136
-    			    if ($error != '') return $error;
1137
-    			    else return self::check_version(true);
1209
+    			    if ($error != '') {
1210
+    			    	return $error;
1211
+    			    } else {
1212
+    			    	return self::check_version(true);
1213
+    			    }
1138 1214
     			} elseif ($result['value'] == '7') {
1139 1215
     			    $error = self::update_from_7();
1140
-    			    if ($error != '') return $error;
1141
-    			    else return self::check_version(true);
1216
+    			    if ($error != '') {
1217
+    			    	return $error;
1218
+    			    } else {
1219
+    			    	return self::check_version(true);
1220
+    			    }
1142 1221
     			} elseif ($result['value'] == '8') {
1143 1222
     			    $error = self::update_from_8();
1144
-    			    if ($error != '') return $error;
1145
-    			    else return self::check_version(true);
1223
+    			    if ($error != '') {
1224
+    			    	return $error;
1225
+    			    } else {
1226
+    			    	return self::check_version(true);
1227
+    			    }
1146 1228
     			} elseif ($result['value'] == '9') {
1147 1229
     			    $error = self::update_from_9();
1148
-    			    if ($error != '') return $error;
1149
-    			    else return self::check_version(true);
1230
+    			    if ($error != '') {
1231
+    			    	return $error;
1232
+    			    } else {
1233
+    			    	return self::check_version(true);
1234
+    			    }
1150 1235
     			} elseif ($result['value'] == '10') {
1151 1236
     			    $error = self::update_from_10();
1152
-    			    if ($error != '') return $error;
1153
-    			    else return self::check_version(true);
1237
+    			    if ($error != '') {
1238
+    			    	return $error;
1239
+    			    } else {
1240
+    			    	return self::check_version(true);
1241
+    			    }
1154 1242
     			} elseif ($result['value'] == '11') {
1155 1243
     			    $error = self::update_from_11();
1156
-    			    if ($error != '') return $error;
1157
-    			    else return self::check_version(true);
1244
+    			    if ($error != '') {
1245
+    			    	return $error;
1246
+    			    } else {
1247
+    			    	return self::check_version(true);
1248
+    			    }
1158 1249
     			} elseif ($result['value'] == '12') {
1159 1250
     			    $error = self::update_from_12();
1160
-    			    if ($error != '') return $error;
1161
-    			    else return self::check_version(true);
1251
+    			    if ($error != '') {
1252
+    			    	return $error;
1253
+    			    } else {
1254
+    			    	return self::check_version(true);
1255
+    			    }
1162 1256
     			} elseif ($result['value'] == '13') {
1163 1257
     			    $error = self::update_from_13();
1164
-    			    if ($error != '') return $error;
1165
-    			    else return self::check_version(true);
1258
+    			    if ($error != '') {
1259
+    			    	return $error;
1260
+    			    } else {
1261
+    			    	return self::check_version(true);
1262
+    			    }
1166 1263
     			} elseif ($result['value'] == '14') {
1167 1264
     			    $error = self::update_from_14();
1168
-    			    if ($error != '') return $error;
1169
-    			    else return self::check_version(true);
1265
+    			    if ($error != '') {
1266
+    			    	return $error;
1267
+    			    } else {
1268
+    			    	return self::check_version(true);
1269
+    			    }
1170 1270
     			} elseif ($result['value'] == '15') {
1171 1271
     			    $error = self::update_from_15();
1172
-    			    if ($error != '') return $error;
1173
-    			    else return self::check_version(true);
1272
+    			    if ($error != '') {
1273
+    			    	return $error;
1274
+    			    } else {
1275
+    			    	return self::check_version(true);
1276
+    			    }
1174 1277
     			} elseif ($result['value'] == '16') {
1175 1278
     			    $error = self::update_from_16();
1176
-    			    if ($error != '') return $error;
1177
-    			    else return self::check_version(true);
1279
+    			    if ($error != '') {
1280
+    			    	return $error;
1281
+    			    } else {
1282
+    			    	return self::check_version(true);
1283
+    			    }
1178 1284
     			} elseif ($result['value'] == '17') {
1179 1285
     			    $error = self::update_from_17();
1180
-    			    if ($error != '') return $error;
1181
-    			    else return self::check_version(true);
1286
+    			    if ($error != '') {
1287
+    			    	return $error;
1288
+    			    } else {
1289
+    			    	return self::check_version(true);
1290
+    			    }
1182 1291
     			} elseif ($result['value'] == '18') {
1183 1292
     			    $error = self::update_from_18();
1184
-    			    if ($error != '') return $error;
1185
-    			    else return self::check_version(true);
1293
+    			    if ($error != '') {
1294
+    			    	return $error;
1295
+    			    } else {
1296
+    			    	return self::check_version(true);
1297
+    			    }
1186 1298
     			} elseif ($result['value'] == '19') {
1187 1299
     			    $error = self::update_from_19();
1188
-    			    if ($error != '') return $error;
1189
-    			    else return self::check_version(true);
1300
+    			    if ($error != '') {
1301
+    			    	return $error;
1302
+    			    } else {
1303
+    			    	return self::check_version(true);
1304
+    			    }
1190 1305
     			} elseif ($result['value'] == '20') {
1191 1306
     			    $error = self::update_from_20();
1192
-    			    if ($error != '') return $error;
1193
-    			    else return self::check_version(true);
1307
+    			    if ($error != '') {
1308
+    			    	return $error;
1309
+    			    } else {
1310
+    			    	return self::check_version(true);
1311
+    			    }
1194 1312
     			} elseif ($result['value'] == '21') {
1195 1313
     			    $error = self::update_from_21();
1196
-    			    if ($error != '') return $error;
1197
-    			    else return self::check_version(true);
1314
+    			    if ($error != '') {
1315
+    			    	return $error;
1316
+    			    } else {
1317
+    			    	return self::check_version(true);
1318
+    			    }
1198 1319
     			} elseif ($result['value'] == '22') {
1199 1320
     			    $error = self::update_from_22();
1200
-    			    if ($error != '') return $error;
1201
-    			    else return self::check_version(true);
1321
+    			    if ($error != '') {
1322
+    			    	return $error;
1323
+    			    } else {
1324
+    			    	return self::check_version(true);
1325
+    			    }
1202 1326
     			} elseif ($result['value'] == '23') {
1203 1327
     			    $error = self::update_from_23();
1204
-    			    if ($error != '') return $error;
1205
-    			    else return self::check_version(true);
1328
+    			    if ($error != '') {
1329
+    			    	return $error;
1330
+    			    } else {
1331
+    			    	return self::check_version(true);
1332
+    			    }
1206 1333
     			} elseif ($result['value'] == '24') {
1207 1334
     			    $error = self::update_from_24();
1208
-    			    if ($error != '') return $error;
1209
-    			    else return self::check_version(true);
1335
+    			    if ($error != '') {
1336
+    			    	return $error;
1337
+    			    } else {
1338
+    			    	return self::check_version(true);
1339
+    			    }
1210 1340
     			} elseif ($result['value'] == '25') {
1211 1341
     			    $error = self::update_from_25();
1212
-    			    if ($error != '') return $error;
1213
-    			    else return self::check_version(true);
1214
-    			} else return '';
1342
+    			    if ($error != '') {
1343
+    			    	return $error;
1344
+    			    } else {
1345
+    			    	return self::check_version(true);
1346
+    			    }
1347
+    			} else {
1348
+    				return '';
1349
+    			}
1350
+    		    } else {
1351
+    		    	return $result['value'];
1215 1352
     		    }
1216
-    		    else return $result['value'];
1217 1353
 		}
1218 1354
 		
1219
-	    } else return $version;
1355
+	    } else {
1356
+	    	return $version;
1357
+	    }
1220 1358
     	}
1221 1359
     	
1222 1360
 }
Please login to merge, or discard this patch.
Spacing   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
             try {
15 15
             	$sth = $Connection->db->prepare($query);
16 16
 		$sth->execute();
17
-    	    } catch(PDOException $e) {
17
+    	    } catch (PDOException $e) {
18 18
 		return "error : ".$e->getMessage()."\n";
19 19
     	    }
20 20
     	    while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
21
-    		$Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']);
21
+    		$Schedule->addSchedule($row['ident'], $row['departure_airport_icao'], $row['departure_airport_time'], $row['arrival_airport_icao'], $row['arrival_airport_time']);
22 22
     	    }
23 23
 	
24 24
 	}
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         	try {
51 51
             	    $sth = $Connection->db->prepare($query);
52 52
 		    $sth->execute();
53
-    		} catch(PDOException $e) {
53
+    		} catch (PDOException $e) {
54 54
 		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
55 55
     		}
56 56
     		// Copy schedules data to routes table
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         	try {
61 61
             	    $sth = $Connection->db->prepare($query);
62 62
 		    $sth->execute();
63
-    		} catch(PDOException $e) {
63
+    		} catch (PDOException $e) {
64 64
 		    return "error (delete schedule table) : ".$e->getMessage()."\n";
65 65
     		}
66 66
     		// Add source column
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     		try {
69 69
             	    $sth = $Connection->db->prepare($query);
70 70
 		    $sth->execute();
71
-    		} catch(PDOException $e) {
71
+    		} catch (PDOException $e) {
72 72
 		    return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n";
73 73
     		}
74 74
 		// Delete unused column
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     		try {
77 77
             	    $sth = $Connection->db->prepare($query);
78 78
 		    $sth->execute();
79
-    		} catch(PDOException $e) {
79
+    		} catch (PDOException $e) {
80 80
 		    return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n";
81 81
     		}
82 82
 		// Add ModeS column
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
     		try {
85 85
             	    $sth = $Connection->db->prepare($query);
86 86
 		    $sth->execute();
87
-    		} catch(PDOException $e) {
87
+    		} catch (PDOException $e) {
88 88
 		    return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n";
89 89
     		}
90 90
 		$query = "ALTER TABLE `spotter_live`  ADD `ModeS` VARCHAR(255)";
91 91
     		try {
92 92
             	    $sth = $Connection->db->prepare($query);
93 93
 		    $sth->execute();
94
-    		} catch(PDOException $e) {
94
+    		} catch (PDOException $e) {
95 95
 		    return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n";
96 96
     		}
97 97
     		// Add auto_increment for aircraft_modes
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     		try {
100 100
             	    $sth = $Connection->db->prepare($query);
101 101
 		    $sth->execute();
102
-    		} catch(PDOException $e) {
102
+    		} catch (PDOException $e) {
103 103
 		    return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n";
104 104
     		}
105 105
     		$error = '';
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         	try {
111 111
             	    $sth = $Connection->db->prepare($query);
112 112
 		    $sth->execute();
113
-    		} catch(PDOException $e) {
113
+    		} catch (PDOException $e) {
114 114
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
115 115
     		}
116 116
 		return $error;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         	try {
124 124
             	    $sth = $Connection->db->prepare($query);
125 125
 		    $sth->execute();
126
-    		} catch(PDOException $e) {
126
+    		} catch (PDOException $e) {
127 127
 		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
128 128
     		}
129 129
     		$error = '';
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         	try {
135 135
             	    $sth = $Connection->db->prepare($query);
136 136
 		    $sth->execute();
137
-    		} catch(PDOException $e) {
137
+    		} catch (PDOException $e) {
138 138
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
139 139
     		}
140 140
 		return $error;
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         	try {
148 148
             	    $sth = $Connection->db->prepare($query);
149 149
 		    $sth->execute();
150
-    		} catch(PDOException $e) {
150
+    		} catch (PDOException $e) {
151 151
 		    return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n";
152 152
     		}
153 153
     		// Add image_source_website column to spotter_image
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
         	try {
156 156
             	    $sth = $Connection->db->prepare($query);
157 157
 		    $sth->execute();
158
-    		} catch(PDOException $e) {
158
+    		} catch (PDOException $e) {
159 159
 		    return "error (add new columns to spotter_image) : ".$e->getMessage()."\n";
160 160
     		}
161 161
     		$error = '';
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         	try {
165 165
             	    $sth = $Connection->db->prepare($query);
166 166
 		    $sth->execute();
167
-    		} catch(PDOException $e) {
167
+    		} catch (PDOException $e) {
168 168
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
169 169
     		}
170 170
 		return $error;
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         	    try {
183 183
             		$sth = $Connection->db->prepare($query);
184 184
 			$sth->execute();
185
-    		    } catch(PDOException $e) {
185
+    		    } catch (PDOException $e) {
186 186
 			return "error (update schema_version) : ".$e->getMessage()."\n";
187 187
     		    }
188 188
     		}
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
         	try {
197 197
             	    $sth = $Connection->db->prepare($query);
198 198
 		    $sth->execute();
199
-    		} catch(PDOException $e) {
199
+    		} catch (PDOException $e) {
200 200
 		    return "error (add new columns to translation) : ".$e->getMessage()."\n";
201 201
     		}
202 202
     		// Add aircraft_shadow column to aircraft
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
         	try {
205 205
             	    $sth = $Connection->db->prepare($query);
206 206
 		    $sth->execute();
207
-    		} catch(PDOException $e) {
207
+    		} catch (PDOException $e) {
208 208
 		    return "error (add new column to aircraft) : ".$e->getMessage()."\n";
209 209
     		}
210 210
     		// Add aircraft_shadow column to spotter_live
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         	try {
213 213
             	    $sth = $Connection->db->prepare($query);
214 214
 		    $sth->execute();
215
-    		} catch(PDOException $e) {
215
+    		} catch (PDOException $e) {
216 216
 		    return "error (add new column to spotter_live) : ".$e->getMessage()."\n";
217 217
     		}
218 218
     		$error = '';
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         	try {
226 226
             	    $sth = $Connection->db->prepare($query);
227 227
 		    $sth->execute();
228
-    		} catch(PDOException $e) {
228
+    		} catch (PDOException $e) {
229 229
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
230 230
     		}
231 231
 		return $error;
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
 	private static function update_from_6() {
235 235
     		$Connection = new Connection();
236
-    		if (!$Connection->indexExists('spotter_output','flightaware_id')) {
236
+    		if (!$Connection->indexExists('spotter_output', 'flightaware_id')) {
237 237
     		    $query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id);
238 238
 			ALTER TABLE spotter_output ADD INDEX(date);
239 239
 			ALTER TABLE spotter_output ADD INDEX(ident);
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
         	    try {
251 251
             		$sth = $Connection->db->prepare($query);
252 252
 			$sth->execute();
253
-    		    } catch(PDOException $e) {
253
+    		    } catch (PDOException $e) {
254 254
 			return "error (add some indexes) : ".$e->getMessage()."\n";
255 255
     		    }
256 256
     		}
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         	try {
266 266
             	    $sth = $Connection->db->prepare($query);
267 267
 		    $sth->execute();
268
-    		} catch(PDOException $e) {
268
+    		} catch (PDOException $e) {
269 269
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
270 270
     		}
271 271
 		return $error;
@@ -274,12 +274,12 @@  discard block
 block discarded – undo
274 274
 	private static function update_from_7() {
275 275
 		global $globalDBname, $globalDBdriver;
276 276
     		$Connection = new Connection();
277
-    		$query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
277
+    		$query = "ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
278 278
     			ALTER TABLE spotter_output ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;";
279 279
         	try {
280 280
             	    $sth = $Connection->db->prepare($query);
281 281
 		    $sth->execute();
282
-    		} catch(PDOException $e) {
282
+    		} catch (PDOException $e) {
283 283
 		    return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
284 284
     		}
285 285
     		if ($globalDBdriver == 'mysql') {
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 		    try {
288 288
             		$sth = $Connection->db->prepare($query);
289 289
 			$sth->execute();
290
-    		    } catch(PDOException $e) {
290
+    		    } catch (PDOException $e) {
291 291
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
292 292
     		    }
293 293
     		    $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -299,15 +299,15 @@  discard block
 block discarded – undo
299 299
 				DROP TABLE spotter_archive;
300 300
 				RENAME TABLE copy TO spotter_archive;";
301 301
             	    } else {
302
-    			$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
302
+    			$query = "ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
303 303
             	    }
304 304
                 } else {
305
-    		    $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
305
+    		    $query = "ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
306 306
                 }
307 307
         	try {
308 308
             	    $sth = $Connection->db->prepare($query);
309 309
 		    $sth->execute();
310
-    		} catch(PDOException $e) {
310
+    		} catch (PDOException $e) {
311 311
 		    return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n";
312 312
     		}
313 313
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
         	try {
321 321
             	    $sth = $Connection->db->prepare($query);
322 322
 		    $sth->execute();
323
-    		} catch(PDOException $e) {
323
+    		} catch (PDOException $e) {
324 324
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
325 325
     		}
326 326
 		return $error;
@@ -339,14 +339,14 @@  discard block
 block discarded – undo
339 339
         	try {
340 340
             	    $sth = $Connection->db->prepare($query);
341 341
 		    $sth->execute();
342
-    		} catch(PDOException $e) {
342
+    		} catch (PDOException $e) {
343 343
 		    return "error (insert last_update values) : ".$e->getMessage()."\n";
344 344
     		}
345 345
 		$query = "UPDATE `config` SET `value` = '9' WHERE `name` = 'schema_version'";
346 346
         	try {
347 347
             	    $sth = $Connection->db->prepare($query);
348 348
 		    $sth->execute();
349
-    		} catch(PDOException $e) {
349
+    		} catch (PDOException $e) {
350 350
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
351 351
     		}
352 352
 		return $error;
@@ -354,12 +354,12 @@  discard block
 block discarded – undo
354 354
 
355 355
 	private static function update_from_9() {
356 356
     		$Connection = new Connection();
357
-    		$query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
357
+    		$query = "ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
358 358
     			ALTER TABLE spotter_output ADD verticalrate INT(11) NULL;";
359 359
         	try {
360 360
             	    $sth = $Connection->db->prepare($query);
361 361
 		    $sth->execute();
362
-    		} catch(PDOException $e) {
362
+    		} catch (PDOException $e) {
363 363
 		    return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
364 364
     		}
365 365
 		$error = '';
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
         	try {
372 372
             	    $sth = $Connection->db->prepare($query);
373 373
 		    $sth->execute();
374
-    		} catch(PDOException $e) {
374
+    		} catch (PDOException $e) {
375 375
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
376 376
     		}
377 377
 		return $error;
@@ -379,11 +379,11 @@  discard block
 block discarded – undo
379 379
 
380 380
 	private static function update_from_10() {
381 381
     		$Connection = new Connection();
382
-    		$query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
382
+    		$query = "ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
383 383
         	try {
384 384
             	    $sth = $Connection->db->prepare($query);
385 385
 		    $sth->execute();
386
-    		} catch(PDOException $e) {
386
+    		} catch (PDOException $e) {
387 387
 		    return "error (add new enum to ATC table) : ".$e->getMessage()."\n";
388 388
     		}
389 389
 		$error = '';
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
         	try {
402 402
             	    $sth = $Connection->db->prepare($query);
403 403
 		    $sth->execute();
404
-    		} catch(PDOException $e) {
404
+    		} catch (PDOException $e) {
405 405
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
406 406
     		}
407 407
 		return $error;
@@ -410,18 +410,18 @@  discard block
 block discarded – undo
410 410
 	private static function update_from_11() {
411 411
 		global $globalDBdriver, $globalDBname;
412 412
     		$Connection = new Connection();
413
-    		$query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
413
+    		$query = "ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
414 414
         	try {
415 415
             	    $sth = $Connection->db->prepare($query);
416 416
 		    $sth->execute();
417
-    		} catch(PDOException $e) {
417
+    		} catch (PDOException $e) {
418 418
 		    return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n";
419 419
     		}
420
-    		$query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
420
+    		$query = "ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
421 421
         	try {
422 422
             	    $sth = $Connection->db->prepare($query);
423 423
 		    $sth->execute();
424
-    		} catch(PDOException $e) {
424
+    		} catch (PDOException $e) {
425 425
 		    return "error (format_source column to spotter_live) : ".$e->getMessage()."\n";
426 426
     		}
427 427
     		if ($globalDBdriver == 'mysql') {
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 		    try {
430 430
             		$sth = $Connection->db->prepare($query);
431 431
 			$sth->execute();
432
-    		    } catch(PDOException $e) {
432
+    		    } catch (PDOException $e) {
433 433
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
434 434
     		    }
435 435
     		    $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -441,15 +441,15 @@  discard block
 block discarded – undo
441 441
 				DROP TABLE spotter_archive;
442 442
 				RENAME TABLE copy TO spotter_archive;";
443 443
             	    } else {
444
-    			$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
444
+    			$query = "ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
445 445
             	    }
446 446
                 } else {
447
-    		    $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
447
+    		    $query = "ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
448 448
                 }
449 449
         	try {
450 450
             	    $sth = $Connection->db->prepare($query);
451 451
 		    $sth->execute();
452
-    		} catch(PDOException $e) {
452
+    		} catch (PDOException $e) {
453 453
 		    return "error (add columns to spotter_archive) : ".$e->getMessage()."\n";
454 454
     		}
455 455
 
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
         	try {
460 460
             	    $sth = $Connection->db->prepare($query);
461 461
 		    $sth->execute();
462
-    		} catch(PDOException $e) {
462
+    		} catch (PDOException $e) {
463 463
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
464 464
     		}
465 465
 		return $error;
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
         	try {
488 488
             	    $sth = $Connection->db->prepare($query);
489 489
 		    $sth->execute();
490
-    		} catch(PDOException $e) {
490
+    		} catch (PDOException $e) {
491 491
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
492 492
     		}
493 493
 		return $error;
@@ -495,12 +495,12 @@  discard block
 block discarded – undo
495 495
 
496 496
 	private static function update_from_13() {
497 497
     		$Connection = new Connection();
498
-    		if (!$Connection->checkColumnName('spotter_archive_output','real_departure_airport_icao')) {
499
-    			$query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
498
+    		if (!$Connection->checkColumnName('spotter_archive_output', 'real_departure_airport_icao')) {
499
+    			$query = "ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
500 500
 			try {
501 501
 				$sth = $Connection->db->prepare($query);
502 502
 				$sth->execute();
503
-	    		} catch(PDOException $e) {
503
+	    		} catch (PDOException $e) {
504 504
 				return "error (update spotter_archive_output) : ".$e->getMessage()."\n";
505 505
     			}
506 506
 		}
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
         	try {
510 510
             	    $sth = $Connection->db->prepare($query);
511 511
 		    $sth->execute();
512
-    		} catch(PDOException $e) {
512
+    		} catch (PDOException $e) {
513 513
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
514 514
     		}
515 515
 		return $error;
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
         	try {
528 528
             	    $sth = $Connection->db->prepare($query);
529 529
 		    $sth->execute();
530
-    		} catch(PDOException $e) {
530
+    		} catch (PDOException $e) {
531 531
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
532 532
     		}
533 533
 		return $error;
@@ -538,11 +538,11 @@  discard block
 block discarded – undo
538 538
     		$Connection = new Connection();
539 539
 		$error = '';
540 540
     		// Add tables
541
-    		$query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
541
+    		$query = "ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
542 542
         	try {
543 543
             	    $sth = $Connection->db->prepare($query);
544 544
 		    $sth->execute();
545
-    		} catch(PDOException $e) {
545
+    		} catch (PDOException $e) {
546 546
 		    return "error (update stats) : ".$e->getMessage()."\n";
547 547
     		}
548 548
 		if ($error != '') return $error;
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
         	try {
551 551
             	    $sth = $Connection->db->prepare($query);
552 552
 		    $sth->execute();
553
-    		} catch(PDOException $e) {
553
+    		} catch (PDOException $e) {
554 554
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
555 555
     		}
556 556
 		return $error;
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
         	try {
572 572
             	    $sth = $Connection->db->prepare($query);
573 573
 		    $sth->execute();
574
-    		} catch(PDOException $e) {
574
+    		} catch (PDOException $e) {
575 575
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
576 576
     		}
577 577
 		return $error;
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
         	try {
590 590
             	    $sth = $Connection->db->prepare($query);
591 591
 		    $sth->execute();
592
-    		} catch(PDOException $e) {
592
+    		} catch (PDOException $e) {
593 593
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
594 594
     		}
595 595
 		return $error;
@@ -598,12 +598,12 @@  discard block
 block discarded – undo
598 598
     		$Connection = new Connection();
599 599
 		$error = '';
600 600
     		// Modify stats_airport table
601
-    		if (!$Connection->checkColumnName('stats_airport','airport_name')) {
601
+    		if (!$Connection->checkColumnName('stats_airport', 'airport_name')) {
602 602
     			$query = "ALTER TABLE `stats_airport` ADD `stats_type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)";
603 603
     	        	try {
604 604
 	            	    $sth = $Connection->db->prepare($query);
605 605
 			    $sth->execute();
606
-    			} catch(PDOException $e) {
606
+    			} catch (PDOException $e) {
607 607
 			    return "error (update stats) : ".$e->getMessage()."\n";
608 608
     			}
609 609
     		}
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
         	try {
613 613
             	    $sth = $Connection->db->prepare($query);
614 614
 		    $sth->execute();
615
-    		} catch(PDOException $e) {
615
+    		} catch (PDOException $e) {
616 616
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
617 617
     		}
618 618
 		return $error;
@@ -629,73 +629,73 @@  discard block
 block discarded – undo
629 629
         	try {
630 630
             	    $sth = $Connection->db->prepare($query);
631 631
 		    $sth->execute();
632
-    		} catch(PDOException $e) {
632
+    		} catch (PDOException $e) {
633 633
 		    return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n";
634 634
     		}
635 635
 		$query = "alter table spotter_archive add spotter_archive_id INT(11)";
636 636
         	try {
637 637
             	    $sth = $Connection->db->prepare($query);
638 638
 		    $sth->execute();
639
-    		} catch(PDOException $e) {
639
+    		} catch (PDOException $e) {
640 640
 		    return "error (add id again on spotter_archive) : ".$e->getMessage()."\n";
641 641
     		}
642
-		if (!$Connection->checkColumnName('spotter_archive','over_country')) {
642
+		if (!$Connection->checkColumnName('spotter_archive', 'over_country')) {
643 643
 			// Add column over_country
644 644
     			$query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
645 645
 			try {
646 646
             			$sth = $Connection->db->prepare($query);
647 647
 				$sth->execute();
648
-			} catch(PDOException $e) {
648
+			} catch (PDOException $e) {
649 649
 				return "error (add over_country) : ".$e->getMessage()."\n";
650 650
 			}
651 651
 		}
652
-		if (!$Connection->checkColumnName('spotter_live','over_country')) {
652
+		if (!$Connection->checkColumnName('spotter_live', 'over_country')) {
653 653
 			// Add column over_country
654 654
     			$query = "ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
655 655
 			try {
656 656
             			$sth = $Connection->db->prepare($query);
657 657
 				$sth->execute();
658
-			} catch(PDOException $e) {
658
+			} catch (PDOException $e) {
659 659
 				return "error (add over_country) : ".$e->getMessage()."\n";
660 660
 			}
661 661
 		}
662
-		if (!$Connection->checkColumnName('spotter_output','source_name')) {
662
+		if (!$Connection->checkColumnName('spotter_output', 'source_name')) {
663 663
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
664 664
     			$query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
665 665
 			try {
666 666
 				$sth = $Connection->db->prepare($query);
667 667
 				$sth->execute();
668
-			} catch(PDOException $e) {
668
+			} catch (PDOException $e) {
669 669
 				return "error (add source_name column) : ".$e->getMessage()."\n";
670 670
     			}
671 671
     		}
672
-		if (!$Connection->checkColumnName('spotter_live','source_name')) {
672
+		if (!$Connection->checkColumnName('spotter_live', 'source_name')) {
673 673
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
674 674
     			$query = "ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
675 675
 			try {
676 676
 				$sth = $Connection->db->prepare($query);
677 677
 				$sth->execute();
678
-			} catch(PDOException $e) {
678
+			} catch (PDOException $e) {
679 679
 				return "error (add source_name column) : ".$e->getMessage()."\n";
680 680
     			}
681 681
     		}
682
-		if (!$Connection->checkColumnName('spotter_archive_output','source_name')) {
682
+		if (!$Connection->checkColumnName('spotter_archive_output', 'source_name')) {
683 683
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
684 684
     			$query = "ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
685 685
 			try {
686 686
 				$sth = $Connection->db->prepare($query);
687 687
 				$sth->execute();
688
-			} catch(PDOException $e) {
688
+			} catch (PDOException $e) {
689 689
 				return "error (add source_name column) : ".$e->getMessage()."\n";
690 690
     			}
691 691
     		}
692
-		if (!$Connection->checkColumnName('spotter_archive','source_name')) {
692
+		if (!$Connection->checkColumnName('spotter_archive', 'source_name')) {
693 693
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
694 694
     			$query = "ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;";
695 695
 			try {
696 696
 				$sth = $Connection->db->prepare($query);
697 697
 				$sth->execute();
698
-			} catch(PDOException $e) {
698
+			} catch (PDOException $e) {
699 699
 				return "error (add source_name column) : ".$e->getMessage()."\n";
700 700
     			}
701 701
     		}
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
         	try {
705 705
             	    $sth = $Connection->db->prepare($query);
706 706
 		    $sth->execute();
707
-    		} catch(PDOException $e) {
707
+    		} catch (PDOException $e) {
708 708
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
709 709
     		}
710 710
 		return $error;
@@ -719,13 +719,13 @@  discard block
 block discarded – undo
719 719
 			$error .= create_db::import_file('../db/airlines.sql');
720 720
 			if ($error != '') return 'Import airlines.sql : '.$error;
721 721
 		}
722
-		if (!$Connection->checkColumnName('aircraft_modes','type_flight')) {
722
+		if (!$Connection->checkColumnName('aircraft_modes', 'type_flight')) {
723 723
 			// Add column over_country
724 724
     			$query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;";
725 725
         		try {
726 726
 				$sth = $Connection->db->prepare($query);
727 727
 				$sth->execute();
728
-			} catch(PDOException $e) {
728
+			} catch (PDOException $e) {
729 729
 				return "error (add over_country) : ".$e->getMessage()."\n";
730 730
     			}
731 731
     		}
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
         	try {
742 742
             	    $sth = $Connection->db->prepare($query);
743 743
 		    $sth->execute();
744
-    		} catch(PDOException $e) {
744
+    		} catch (PDOException $e) {
745 745
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
746 746
     		}
747 747
 		return $error;
@@ -750,13 +750,13 @@  discard block
 block discarded – undo
750 750
 	private static function update_from_21() {
751 751
 		$Connection = new Connection();
752 752
 		$error = '';
753
-		if (!$Connection->checkColumnName('stats_airport','stats_type')) {
753
+		if (!$Connection->checkColumnName('stats_airport', 'stats_type')) {
754 754
 			// Rename type to stats_type
755 755
 			$query = "ALTER TABLE `stats_airport` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats_flight` CHANGE `type` `stats_type` VARCHAR(50);";
756 756
 			try {
757 757
 				$sth = $Connection->db->prepare($query);
758 758
 				$sth->execute();
759
-			} catch(PDOException $e) {
759
+			} catch (PDOException $e) {
760 760
 				return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n";
761 761
 			}
762 762
 			if ($error != '') return $error;
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
         	try {
766 766
             	    $sth = $Connection->db->prepare($query);
767 767
 		    $sth->execute();
768
-    		} catch(PDOException $e) {
768
+    		} catch (PDOException $e) {
769 769
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
770 770
     		}
771 771
 		return $error;
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
         	try {
789 789
             	    $sth = $Connection->db->prepare($query);
790 790
 		    $sth->execute();
791
-    		} catch(PDOException $e) {
791
+    		} catch (PDOException $e) {
792 792
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
793 793
     		}
794 794
 		return $error;
@@ -815,17 +815,17 @@  discard block
 block discarded – undo
815 815
 			try {
816 816
 				$sth = $Connection->db->prepare($query);
817 817
 				$sth->execute();
818
-			} catch(PDOException $e) {
818
+			} catch (PDOException $e) {
819 819
 				return "error (create index on spotter_archive) : ".$e->getMessage()."\n";
820 820
 			}
821 821
 		}
822
-		if (!$Connection->checkColumnName('stats_aircraft','aircraft_manufacturer')) {
822
+		if (!$Connection->checkColumnName('stats_aircraft', 'aircraft_manufacturer')) {
823 823
 			// Add aircraft_manufacturer to stats_aircraft
824 824
     			$query = "ALTER TABLE stats_aircraft ADD aircraft_manufacturer VARCHAR(255) NULL";
825 825
 			try {
826 826
 				$sth = $Connection->db->prepare($query);
827 827
 				$sth->execute();
828
-			} catch(PDOException $e) {
828
+			} catch (PDOException $e) {
829 829
 				return "error (add aircraft_manufacturer column) : ".$e->getMessage()."\n";
830 830
     			}
831 831
     		}
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
 		try {
835 835
 			$sth = $Connection->db->prepare($query);
836 836
 			$sth->execute();
837
-		} catch(PDOException $e) {
837
+		} catch (PDOException $e) {
838 838
 			return "error (update schema_version) : ".$e->getMessage()."\n";
839 839
 		}
840 840
 		return $error;
@@ -850,23 +850,23 @@  discard block
 block discarded – undo
850 850
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
851 851
 		}
852 852
 		if ($error != '') return 'Import airlines.sql : '.$error;
853
-		if (!$Connection->checkColumnName('airlines','forsource')) {
853
+		if (!$Connection->checkColumnName('airlines', 'forsource')) {
854 854
 			// Add forsource to airlines
855 855
 			$query = "ALTER TABLE airlines ADD forsource VARCHAR(255) NULL DEFAULT NULL";
856 856
 			try {
857 857
 				$sth = $Connection->db->prepare($query);
858 858
 				$sth->execute();
859
-			} catch(PDOException $e) {
859
+			} catch (PDOException $e) {
860 860
 				return "error (add forsource column) : ".$e->getMessage()."\n";
861 861
 			}
862 862
 		}
863
-		if (!$Connection->checkColumnName('stats_aircraft','stats_airline')) {
863
+		if (!$Connection->checkColumnName('stats_aircraft', 'stats_airline')) {
864 864
 			// Add forsource to airlines
865 865
 			$query = "ALTER TABLE stats_aircraft ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
866 866
 			try {
867 867
 				$sth = $Connection->db->prepare($query);
868 868
 				$sth->execute();
869
-			} catch(PDOException $e) {
869
+			} catch (PDOException $e) {
870 870
 				return "error (add stats_airline & filter_name column in stats_aircraft) : ".$e->getMessage()."\n";
871 871
 			}
872 872
 			// Add unique key
@@ -878,17 +878,17 @@  discard block
 block discarded – undo
878 878
 			try {
879 879
 				$sth = $Connection->db->prepare($query);
880 880
 				$sth->execute();
881
-			} catch(PDOException $e) {
881
+			} catch (PDOException $e) {
882 882
 				return "error (add unique key in stats_aircraft) : ".$e->getMessage()."\n";
883 883
 			}
884 884
 		}
885
-		if (!$Connection->checkColumnName('stats_airport','stats_airline')) {
885
+		if (!$Connection->checkColumnName('stats_airport', 'stats_airline')) {
886 886
 			// Add forsource to airlines
887 887
 			$query = "ALTER TABLE stats_airport ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
888 888
 			try {
889 889
 				$sth = $Connection->db->prepare($query);
890 890
 				$sth->execute();
891
-			} catch(PDOException $e) {
891
+			} catch (PDOException $e) {
892 892
 				return "error (add filter_name column in stats_airport) : ".$e->getMessage()."\n";
893 893
 			}
894 894
 			// Add unique key
@@ -900,17 +900,17 @@  discard block
 block discarded – undo
900 900
 			try {
901 901
 				$sth = $Connection->db->prepare($query);
902 902
 				$sth->execute();
903
-			} catch(PDOException $e) {
903
+			} catch (PDOException $e) {
904 904
 				return "error (add unique key in stats_airport) : ".$e->getMessage()."\n";
905 905
 			}
906 906
 		}
907
-		if (!$Connection->checkColumnName('stats_country','stats_airline')) {
907
+		if (!$Connection->checkColumnName('stats_country', 'stats_airline')) {
908 908
 			// Add forsource to airlines
909 909
 			$query = "ALTER TABLE stats_country ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
910 910
 			try {
911 911
 				$sth = $Connection->db->prepare($query);
912 912
 				$sth->execute();
913
-			} catch(PDOException $e) {
913
+			} catch (PDOException $e) {
914 914
 				return "error (add stats_airline & filter_name column in stats_country) : ".$e->getMessage()."\n";
915 915
 			}
916 916
 			// Add unique key
@@ -922,37 +922,37 @@  discard block
 block discarded – undo
922 922
 			try {
923 923
 				$sth = $Connection->db->prepare($query);
924 924
 				$sth->execute();
925
-			} catch(PDOException $e) {
925
+			} catch (PDOException $e) {
926 926
 				return "error (add unique key in stats_airline) : ".$e->getMessage()."\n";
927 927
 			}
928 928
 		}
929
-		if (!$Connection->checkColumnName('stats_flight','stats_airline')) {
929
+		if (!$Connection->checkColumnName('stats_flight', 'stats_airline')) {
930 930
 			// Add forsource to airlines
931 931
 			$query = "ALTER TABLE stats_flight ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
932 932
 			try {
933 933
 				$sth = $Connection->db->prepare($query);
934 934
 				$sth->execute();
935
-			} catch(PDOException $e) {
935
+			} catch (PDOException $e) {
936 936
 				return "error (add stats_airline & filter_name column in stats_flight) : ".$e->getMessage()."\n";
937 937
 			}
938 938
 		}
939
-		if (!$Connection->checkColumnName('stats','stats_airline')) {
939
+		if (!$Connection->checkColumnName('stats', 'stats_airline')) {
940 940
 			// Add forsource to airlines
941 941
 			$query = "ALTER TABLE stats ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
942 942
 			try {
943 943
 				$sth = $Connection->db->prepare($query);
944 944
 				$sth->execute();
945
-			} catch(PDOException $e) {
945
+			} catch (PDOException $e) {
946 946
 				return "error (add stats_airline & filter_name column in stats) : ".$e->getMessage()."\n";
947 947
 			}
948 948
 		}
949
-		if ($globalDBdriver == 'mysql' && $Connection->indexExists('stats','type')) {
949
+		if ($globalDBdriver == 'mysql' && $Connection->indexExists('stats', 'type')) {
950 950
 			// Add unique key
951 951
 			$query = "drop index type on stats;ALTER TABLE stats ADD UNIQUE stats_type (stats_type,stats_date,stats_airline,filter_name);";
952 952
 			try {
953 953
 				$sth = $Connection->db->prepare($query);
954 954
 				$sth->execute();
955
-			} catch(PDOException $e) {
955
+			} catch (PDOException $e) {
956 956
 				return "error (add unique key in stats) : ".$e->getMessage()."\n";
957 957
 			}
958 958
 		
@@ -966,17 +966,17 @@  discard block
 block discarded – undo
966 966
 			try {
967 967
 				$sth = $Connection->db->prepare($query);
968 968
 				$sth->execute();
969
-			} catch(PDOException $e) {
969
+			} catch (PDOException $e) {
970 970
 				return "error (add unique key in stats) : ".$e->getMessage()."\n";
971 971
 			}
972 972
 		}
973
-		if (!$Connection->checkColumnName('stats_registration','stats_airline')) {
973
+		if (!$Connection->checkColumnName('stats_registration', 'stats_airline')) {
974 974
 			// Add forsource to airlines
975 975
 			$query = "ALTER TABLE stats_registration ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
976 976
 			try {
977 977
 				$sth = $Connection->db->prepare($query);
978 978
 				$sth->execute();
979
-			} catch(PDOException $e) {
979
+			} catch (PDOException $e) {
980 980
 				return "error (add stats_airline & filter_name column in stats_registration) : ".$e->getMessage()."\n";
981 981
 			}
982 982
 			// Add unique key
@@ -988,17 +988,17 @@  discard block
 block discarded – undo
988 988
 			try {
989 989
 				$sth = $Connection->db->prepare($query);
990 990
 				$sth->execute();
991
-			} catch(PDOException $e) {
991
+			} catch (PDOException $e) {
992 992
 				return "error (add unique key in stats_registration) : ".$e->getMessage()."\n";
993 993
 			}
994 994
 		}
995
-		if (!$Connection->checkColumnName('stats_callsign','filter_name')) {
995
+		if (!$Connection->checkColumnName('stats_callsign', 'filter_name')) {
996 996
 			// Add forsource to airlines
997 997
 			$query = "ALTER TABLE stats_callsign ADD filter_name VARCHAR(255) NULL DEFAULT ''";
998 998
 			try {
999 999
 				$sth = $Connection->db->prepare($query);
1000 1000
 				$sth->execute();
1001
-			} catch(PDOException $e) {
1001
+			} catch (PDOException $e) {
1002 1002
 				return "error (add filter_name column in stats_callsign) : ".$e->getMessage()."\n";
1003 1003
 			}
1004 1004
 			// Add unique key
@@ -1010,17 +1010,17 @@  discard block
 block discarded – undo
1010 1010
 			try {
1011 1011
 				$sth = $Connection->db->prepare($query);
1012 1012
 				$sth->execute();
1013
-			} catch(PDOException $e) {
1013
+			} catch (PDOException $e) {
1014 1014
 				return "error (add unique key in stats_callsign) : ".$e->getMessage()."\n";
1015 1015
 			}
1016 1016
 		}
1017
-		if (!$Connection->checkColumnName('stats_airline','filter_name')) {
1017
+		if (!$Connection->checkColumnName('stats_airline', 'filter_name')) {
1018 1018
 			// Add forsource to airlines
1019 1019
 			$query = "ALTER TABLE stats_airline ADD filter_name VARCHAR(255) NULL DEFAULT ''";
1020 1020
 			try {
1021 1021
 				$sth = $Connection->db->prepare($query);
1022 1022
 				$sth->execute();
1023
-			} catch(PDOException $e) {
1023
+			} catch (PDOException $e) {
1024 1024
 				return "error (add filter_name column in stats_airline) : ".$e->getMessage()."\n";
1025 1025
 			}
1026 1026
 			// Add unique key
@@ -1032,7 +1032,7 @@  discard block
 block discarded – undo
1032 1032
 			try {
1033 1033
 				$sth = $Connection->db->prepare($query);
1034 1034
 				$sth->execute();
1035
-			} catch(PDOException $e) {
1035
+			} catch (PDOException $e) {
1036 1036
 				return "error (add unique key in stats_callsign) : ".$e->getMessage()."\n";
1037 1037
 			}
1038 1038
 		}
@@ -1041,7 +1041,7 @@  discard block
 block discarded – undo
1041 1041
 		try {
1042 1042
 			$sth = $Connection->db->prepare($query);
1043 1043
 			$sth->execute();
1044
-		} catch(PDOException $e) {
1044
+		} catch (PDOException $e) {
1045 1045
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1046 1046
 		}
1047 1047
 		return $error;
@@ -1051,13 +1051,13 @@  discard block
 block discarded – undo
1051 1051
 		global $globalDBdriver;
1052 1052
 		$Connection = new Connection();
1053 1053
 		$error = '';
1054
-		if (!$Connection->checkColumnName('stats_owner','stats_airline')) {
1054
+		if (!$Connection->checkColumnName('stats_owner', 'stats_airline')) {
1055 1055
 			// Add forsource to airlines
1056 1056
 			$query = "ALTER TABLE stats_owner ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
1057 1057
 			try {
1058 1058
 				$sth = $Connection->db->prepare($query);
1059 1059
 				$sth->execute();
1060
-			} catch(PDOException $e) {
1060
+			} catch (PDOException $e) {
1061 1061
 				return "error (add stats_airline & filter_name column in stats_owner) : ".$e->getMessage()."\n";
1062 1062
 			}
1063 1063
 			// Add unique key
@@ -1069,17 +1069,17 @@  discard block
 block discarded – undo
1069 1069
 			try {
1070 1070
 				$sth = $Connection->db->prepare($query);
1071 1071
 				$sth->execute();
1072
-			} catch(PDOException $e) {
1072
+			} catch (PDOException $e) {
1073 1073
 				return "error (add unique key in stats_owner) : ".$e->getMessage()."\n";
1074 1074
 			}
1075 1075
 		}
1076
-		if (!$Connection->checkColumnName('stats_pilot','stats_airline')) {
1076
+		if (!$Connection->checkColumnName('stats_pilot', 'stats_airline')) {
1077 1077
 			// Add forsource to airlines
1078 1078
 			$query = "ALTER TABLE stats_pilot ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
1079 1079
 			try {
1080 1080
 				$sth = $Connection->db->prepare($query);
1081 1081
 				$sth->execute();
1082
-			} catch(PDOException $e) {
1082
+			} catch (PDOException $e) {
1083 1083
 				return "error (add stats_airline & filter_name column in stats_pilot) : ".$e->getMessage()."\n";
1084 1084
 			}
1085 1085
 			// Add unique key
@@ -1091,7 +1091,7 @@  discard block
 block discarded – undo
1091 1091
 			try {
1092 1092
 				$sth = $Connection->db->prepare($query);
1093 1093
 				$sth->execute();
1094
-			} catch(PDOException $e) {
1094
+			} catch (PDOException $e) {
1095 1095
 				return "error (add unique key in stats_pilot) : ".$e->getMessage()."\n";
1096 1096
 			}
1097 1097
 		}
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
 		try {
1100 1100
 			$sth = $Connection->db->prepare($query);
1101 1101
 			$sth->execute();
1102
-		} catch(PDOException $e) {
1102
+		} catch (PDOException $e) {
1103 1103
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1104 1104
 		}
1105 1105
 		return $error;
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
 		    try {
1123 1123
             		$sth = $Connection->db->prepare($query);
1124 1124
 		        $sth->execute();
1125
-		    } catch(PDOException $e) {
1125
+		    } catch (PDOException $e) {
1126 1126
 			return "error : ".$e->getMessage()."\n";
1127 1127
     		    }
1128 1128
     		    $result = $sth->fetch(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
require/class.Spotter.php 4 patches
Indentation   +1265 added lines, -1265 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;
22 22
 		if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter);
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
51 51
 	}
52 52
 
53 53
 	/**
54
-	* Executes the SQL statements to get the spotter information
55
-	*
56
-	* @param String $query the SQL query
57
-	* @param Array $params parameter of the query
58
-	* @param String $limitQuery the limit query
59
-	* @return Array the spotter information
60
-	*
61
-	*/
54
+	 * Executes the SQL statements to get the spotter information
55
+	 *
56
+	 * @param String $query the SQL query
57
+	 * @param Array $params parameter of the query
58
+	 * @param String $limitQuery the limit query
59
+	 * @return Array the spotter information
60
+	 *
61
+	 */
62 62
 	public function getDataFromDB($query, $params = array(), $limitQuery = '')
63 63
 	{
64 64
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS;
@@ -221,11 +221,11 @@  discard block
 block discarded – undo
221 221
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
222 222
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
223 223
 					} else $temp_array['aircraft_shadow'] = 'default.png';
224
-                                } else {
225
-                            		$temp_array['aircraft_shadow'] = 'default.png';
224
+								} else {
225
+									$temp_array['aircraft_shadow'] = 'default.png';
226 226
 					$temp_array['aircraft_name'] = 'N/A';
227 227
 					$temp_array['aircraft_manufacturer'] = 'N/A';
228
-                            	}
228
+								}
229 229
 			}
230 230
 			$fromsource = NULL;
231 231
 			if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
@@ -407,11 +407,11 @@  discard block
 block discarded – undo
407 407
 	
408 408
 	
409 409
 	/**
410
-	* Gets all the spotter information
411
-	*
412
-	* @return Array the spotter information
413
-	*
414
-	*/
410
+	 * Gets all the spotter information
411
+	 *
412
+	 * @return Array the spotter information
413
+	 *
414
+	 */
415 415
 	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 = '',$filter = array())
416 416
 	{
417 417
 		global $globalTimezone, $globalDBdriver;
@@ -758,11 +758,11 @@  discard block
 block discarded – undo
758 758
 	
759 759
 	
760 760
 	/**
761
-	* Gets all the spotter information based on the latest data entry
762
-	*
763
-	* @return Array the spotter information
764
-	*
765
-	*/
761
+	 * Gets all the spotter information based on the latest data entry
762
+	 *
763
+	 * @return Array the spotter information
764
+	 *
765
+	 */
766 766
 	public function getLatestSpotterData($limit = '', $sort = '', $filter = array())
767 767
 	{
768 768
 		global $global_query;
@@ -801,12 +801,12 @@  discard block
 block discarded – undo
801 801
 	}
802 802
     
803 803
     
804
-    /**
805
-	* Gets all the spotter information based on a user's latitude and longitude
806
-	*
807
-	* @return Array the spotter information
808
-	*
809
-	*/
804
+	/**
805
+	 * Gets all the spotter information based on a user's latitude and longitude
806
+	 *
807
+	 * @return Array the spotter information
808
+	 *
809
+	 */
810 810
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
811 811
 	{
812 812
 		date_default_timezone_set('UTC');
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
 				return false;
835 835
 			}
836 836
 		}
837
-    		$additional_query = '';
837
+			$additional_query = '';
838 838
 		if ($interval != "")
839 839
 		{
840 840
 			if (!is_string($interval))
@@ -874,12 +874,12 @@  discard block
 block discarded – undo
874 874
 	}
875 875
     
876 876
     
877
-    /**
878
-	* Gets all the spotter information sorted by the newest aircraft type
879
-	*
880
-	* @return Array the spotter information
881
-	*
882
-	*/
877
+	/**
878
+	 * Gets all the spotter information sorted by the newest aircraft type
879
+	 *
880
+	 * @return Array the spotter information
881
+	 *
882
+	 */
883 883
 	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
884 884
 	{
885 885
 		global $global_query;
@@ -920,11 +920,11 @@  discard block
 block discarded – undo
920 920
     
921 921
     
922 922
 	/**
923
-	* Gets all the spotter information sorted by the newest aircraft registration
924
-	*
925
-	* @return Array the spotter information
926
-	*
927
-	*/
923
+	 * Gets all the spotter information sorted by the newest aircraft registration
924
+	 *
925
+	 * @return Array the spotter information
926
+	 *
927
+	 */
928 928
 	public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array())
929 929
 	{
930 930
 		global $global_query;
@@ -964,11 +964,11 @@  discard block
 block discarded – undo
964 964
 
965 965
 
966 966
 	/**
967
-	* Gets all the spotter information sorted by the newest airline
968
-	*
969
-	* @return Array the spotter information
970
-	*
971
-	*/
967
+	 * Gets all the spotter information sorted by the newest airline
968
+	 *
969
+	 * @return Array the spotter information
970
+	 *
971
+	 */
972 972
 	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
973 973
 	{
974 974
 		global $global_query;
@@ -1007,12 +1007,12 @@  discard block
 block discarded – undo
1007 1007
 	}
1008 1008
     
1009 1009
     
1010
-    /**
1011
-	* Gets all the spotter information sorted by the newest departure airport
1012
-	*
1013
-	* @return Array the spotter information
1014
-	*
1015
-	*/
1010
+	/**
1011
+	 * Gets all the spotter information sorted by the newest departure airport
1012
+	 *
1013
+	 * @return Array the spotter information
1014
+	 *
1015
+	 */
1016 1016
 	public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array())
1017 1017
 	{
1018 1018
 		global $global_query;
@@ -1054,11 +1054,11 @@  discard block
 block discarded – undo
1054 1054
 
1055 1055
 
1056 1056
 	/**
1057
-	* Gets all the spotter information sorted by the newest arrival airport
1058
-	*
1059
-	* @return Array the spotter information
1060
-	*
1061
-	*/
1057
+	 * Gets all the spotter information sorted by the newest arrival airport
1058
+	 *
1059
+	 * @return Array the spotter information
1060
+	 *
1061
+	 */
1062 1062
 	public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array())
1063 1063
 	{
1064 1064
 		global $global_query;
@@ -1097,11 +1097,11 @@  discard block
 block discarded – undo
1097 1097
 	
1098 1098
 
1099 1099
 	/**
1100
-	* Gets all the spotter information based on the spotter id
1101
-	*
1102
-	* @return Array the spotter information
1103
-	*
1104
-	*/
1100
+	 * Gets all the spotter information based on the spotter id
1101
+	 *
1102
+	 * @return Array the spotter information
1103
+	 *
1104
+	 */
1105 1105
 	public function getSpotterDataByID($id = '')
1106 1106
 	{
1107 1107
 		global $global_query;
@@ -1123,11 +1123,11 @@  discard block
 block discarded – undo
1123 1123
 	
1124 1124
 	
1125 1125
 	/**
1126
-	* Gets all the spotter information based on the callsign
1127
-	*
1128
-	* @return Array the spotter information
1129
-	*
1130
-	*/
1126
+	 * Gets all the spotter information based on the callsign
1127
+	 *
1128
+	 * @return Array the spotter information
1129
+	 *
1130
+	 */
1131 1131
 	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
1132 1132
 	{
1133 1133
 		global $global_query;
@@ -1180,11 +1180,11 @@  discard block
 block discarded – undo
1180 1180
 	
1181 1181
 	
1182 1182
 	/**
1183
-	* Gets all the spotter information based on the aircraft type
1184
-	*
1185
-	* @return Array the spotter information
1186
-	*
1187
-	*/
1183
+	 * Gets all the spotter information based on the aircraft type
1184
+	 *
1185
+	 * @return Array the spotter information
1186
+	 *
1187
+	 */
1188 1188
 	public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array())
1189 1189
 	{
1190 1190
 		global $global_query;
@@ -1238,11 +1238,11 @@  discard block
 block discarded – undo
1238 1238
 	
1239 1239
 	
1240 1240
 	/**
1241
-	* Gets all the spotter information based on the aircraft registration
1242
-	*
1243
-	* @return Array the spotter information
1244
-	*
1245
-	*/
1241
+	 * Gets all the spotter information based on the aircraft registration
1242
+	 *
1243
+	 * @return Array the spotter information
1244
+	 *
1245
+	 */
1246 1246
 	public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array())
1247 1247
 	{
1248 1248
 		global $global_query;
@@ -1298,11 +1298,11 @@  discard block
 block discarded – undo
1298 1298
 	
1299 1299
 	
1300 1300
 	/**
1301
-	* Gets all the spotter information based on the airline
1302
-	*
1303
-	* @return Array the spotter information
1304
-	*
1305
-	*/
1301
+	 * Gets all the spotter information based on the airline
1302
+	 *
1303
+	 * @return Array the spotter information
1304
+	 *
1305
+	 */
1306 1306
 	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '')
1307 1307
 	{
1308 1308
 		global $global_query;
@@ -1354,11 +1354,11 @@  discard block
 block discarded – undo
1354 1354
 	
1355 1355
 	
1356 1356
 	/**
1357
-	* Gets all the spotter information based on the airport
1358
-	*
1359
-	* @return Array the spotter information
1360
-	*
1361
-	*/
1357
+	 * Gets all the spotter information based on the airport
1358
+	 *
1359
+	 * @return Array the spotter information
1360
+	 *
1361
+	 */
1362 1362
 	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '')
1363 1363
 	{
1364 1364
 		global $global_query;
@@ -1411,11 +1411,11 @@  discard block
 block discarded – undo
1411 1411
 
1412 1412
 
1413 1413
 	/**
1414
-	* Gets all the spotter information based on the date
1415
-	*
1416
-	* @return Array the spotter information
1417
-	*
1418
-	*/
1414
+	 * Gets all the spotter information based on the date
1415
+	 *
1416
+	 * @return Array the spotter information
1417
+	 *
1418
+	 */
1419 1419
 	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1420 1420
 	{
1421 1421
 		global $global_query, $globalTimezone, $globalDBdriver;
@@ -1492,11 +1492,11 @@  discard block
 block discarded – undo
1492 1492
 
1493 1493
 
1494 1494
 	/**
1495
-	* Gets all the spotter information based on the country name
1496
-	*
1497
-	* @return Array the spotter information
1498
-	*
1499
-	*/
1495
+	 * Gets all the spotter information based on the country name
1496
+	 *
1497
+	 * @return Array the spotter information
1498
+	 *
1499
+	 */
1500 1500
 	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '')
1501 1501
 	{
1502 1502
 		global $global_query;
@@ -1549,11 +1549,11 @@  discard block
 block discarded – undo
1549 1549
 	
1550 1550
 	
1551 1551
 	/**
1552
-	* Gets all the spotter information based on the manufacturer name
1553
-	*
1554
-	* @return Array the spotter information
1555
-	*
1556
-	*/
1552
+	 * Gets all the spotter information based on the manufacturer name
1553
+	 *
1554
+	 * @return Array the spotter information
1555
+	 *
1556
+	 */
1557 1557
 	public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '')
1558 1558
 	{
1559 1559
 		global $global_query;
@@ -1608,13 +1608,13 @@  discard block
 block discarded – undo
1608 1608
   
1609 1609
   
1610 1610
 	/**
1611
-	* Gets a list of all aircraft that take a route
1612
-	*
1613
-	* @param String $departure_airport_icao ICAO code of departure airport
1614
-	* @param String $arrival_airport_icao ICAO code of arrival airport
1615
-	* @return Array the spotter information
1616
-	*
1617
-	*/
1611
+	 * Gets a list of all aircraft that take a route
1612
+	 *
1613
+	 * @param String $departure_airport_icao ICAO code of departure airport
1614
+	 * @param String $arrival_airport_icao ICAO code of arrival airport
1615
+	 * @return Array the spotter information
1616
+	 *
1617
+	 */
1618 1618
 	public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '')
1619 1619
 	{
1620 1620
 		global $global_query;
@@ -1680,11 +1680,11 @@  discard block
 block discarded – undo
1680 1680
 	
1681 1681
 	
1682 1682
 	/**
1683
-	* Gets all the spotter information based on the special column in the table
1684
-	*
1685
-	* @return Array the spotter information
1686
-	*
1687
-	*/
1683
+	 * Gets all the spotter information based on the special column in the table
1684
+	 *
1685
+	 * @return Array the spotter information
1686
+	 *
1687
+	 */
1688 1688
 	public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array())
1689 1689
 	{
1690 1690
 		global $global_query;
@@ -1723,11 +1723,11 @@  discard block
 block discarded – undo
1723 1723
 	}
1724 1724
 
1725 1725
 	/**
1726
-	* Gets all the highlight based on a aircraft registration
1727
-	*
1728
-	* @return String the highlight text
1729
-	*
1730
-	*/
1726
+	 * Gets all the highlight based on a aircraft registration
1727
+	 *
1728
+	 * @return String the highlight text
1729
+	 *
1730
+	 */
1731 1731
 	public function getHighlightByRegistration($registration,$filter = array())
1732 1732
 	{
1733 1733
 		global $global_query;
@@ -1749,13 +1749,13 @@  discard block
 block discarded – undo
1749 1749
 
1750 1750
 	
1751 1751
 	/**
1752
-	* Gets the squawk usage from squawk code
1753
-	*
1754
-	* @param String $squawk squawk code
1755
-	* @param String $country country
1756
-	* @return String usage
1757
-	*
1758
-	*/
1752
+	 * Gets the squawk usage from squawk code
1753
+	 *
1754
+	 * @param String $squawk squawk code
1755
+	 * @param String $country country
1756
+	 * @return String usage
1757
+	 *
1758
+	 */
1759 1759
 	public function getSquawkUsage($squawk = '',$country = 'FR')
1760 1760
 	{
1761 1761
 		
@@ -1775,12 +1775,12 @@  discard block
 block discarded – undo
1775 1775
 	}
1776 1776
 
1777 1777
 	/**
1778
-	* Gets the airport icao from the iata
1779
-	*
1780
-	* @param String $airport_iata the iata code of the airport
1781
-	* @return String airport iata
1782
-	*
1783
-	*/
1778
+	 * Gets the airport icao from the iata
1779
+	 *
1780
+	 * @param String $airport_iata the iata code of the airport
1781
+	 * @return String airport iata
1782
+	 *
1783
+	 */
1784 1784
 	public function getAirportIcao($airport_iata = '')
1785 1785
 	{
1786 1786
 		
@@ -1799,14 +1799,14 @@  discard block
 block discarded – undo
1799 1799
 	}
1800 1800
 
1801 1801
 	/**
1802
-	* Gets the airport distance
1803
-	*
1804
-	* @param String $airport_icao the icao code of the airport
1805
-	* @param Float $latitude the latitude
1806
-	* @param Float $longitude the longitude
1807
-	* @return Float distance to the airport
1808
-	*
1809
-	*/
1802
+	 * Gets the airport distance
1803
+	 *
1804
+	 * @param String $airport_icao the icao code of the airport
1805
+	 * @param Float $latitude the latitude
1806
+	 * @param Float $longitude the longitude
1807
+	 * @return Float distance to the airport
1808
+	 *
1809
+	 */
1810 1810
 	public function getAirportDistance($airport_icao,$latitude,$longitude)
1811 1811
 	{
1812 1812
 		
@@ -1826,12 +1826,12 @@  discard block
 block discarded – undo
1826 1826
 	}
1827 1827
 	
1828 1828
 	/**
1829
-	* Gets the airport info based on the icao
1830
-	*
1831
-	* @param String $airport the icao code of the airport
1832
-	* @return Array airport information
1833
-	*
1834
-	*/
1829
+	 * Gets the airport info based on the icao
1830
+	 *
1831
+	 * @param String $airport the icao code of the airport
1832
+	 * @return Array airport information
1833
+	 *
1834
+	 */
1835 1835
 	public function getAllAirportInfo($airport = '')
1836 1836
 	{
1837 1837
 		
@@ -1877,12 +1877,12 @@  discard block
 block discarded – undo
1877 1877
 	}
1878 1878
 	
1879 1879
 	/**
1880
-	* Gets the airport info based on the country
1881
-	*
1882
-	* @param Array $countries Airports countries
1883
-	* @return Array airport information
1884
-	*
1885
-	*/
1880
+	 * Gets the airport info based on the country
1881
+	 *
1882
+	 * @param Array $countries Airports countries
1883
+	 * @return Array airport information
1884
+	 *
1885
+	 */
1886 1886
 	public function getAllAirportInfobyCountry($countries)
1887 1887
 	{
1888 1888
 		$lst_countries = '';
@@ -1920,12 +1920,12 @@  discard block
 block discarded – undo
1920 1920
 	}
1921 1921
 	
1922 1922
 	/**
1923
-	* Gets airports info based on the coord
1924
-	*
1925
-	* @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1926
-	* @return Array airport information
1927
-	*
1928
-	*/
1923
+	 * Gets airports info based on the coord
1924
+	 *
1925
+	 * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1926
+	 * @return Array airport information
1927
+	 *
1928
+	 */
1929 1929
 	public function getAllAirportInfobyCoord($coord)
1930 1930
 	{
1931 1931
 		global $globalDBdriver;
@@ -1956,12 +1956,12 @@  discard block
 block discarded – undo
1956 1956
 	}
1957 1957
 
1958 1958
 	/**
1959
-	* Gets waypoints info based on the coord
1960
-	*
1961
-	* @param Array $coord waypoints coord
1962
-	* @return Array airport information
1963
-	*
1964
-	*/
1959
+	 * Gets waypoints info based on the coord
1960
+	 *
1961
+	 * @param Array $coord waypoints coord
1962
+	 * @return Array airport information
1963
+	 *
1964
+	 */
1965 1965
 	public function getAllWaypointsInfobyCoord($coord)
1966 1966
 	{
1967 1967
 		if (is_array($coord)) {
@@ -1995,12 +1995,12 @@  discard block
 block discarded – undo
1995 1995
 	
1996 1996
 	
1997 1997
 	/**
1998
-	* Gets the airline info based on the icao code or iata code
1999
-	*
2000
-	* @param String $airline_icao the iata code of the airport
2001
-	* @return Array airport information
2002
-	*
2003
-	*/
1998
+	 * Gets the airline info based on the icao code or iata code
1999
+	 *
2000
+	 * @param String $airline_icao the iata code of the airport
2001
+	 * @return Array airport information
2002
+	 *
2003
+	 */
2004 2004
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2005 2005
 	{
2006 2006
 		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
@@ -2029,7 +2029,7 @@  discard block
 block discarded – undo
2029 2029
 			} else {
2030 2030
 				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2031 2031
 			}
2032
-                        /*
2032
+						/*
2033 2033
 			$airline_array = array();
2034 2034
 			$temp_array = array();
2035 2035
 		
@@ -2052,12 +2052,12 @@  discard block
 block discarded – undo
2052 2052
 	
2053 2053
 	
2054 2054
 	/**
2055
-	* Gets the aircraft info based on the aircraft type
2056
-	*
2057
-	* @param String $aircraft_type the aircraft type
2058
-	* @return Array aircraft information
2059
-	*
2060
-	*/
2055
+	 * Gets the aircraft info based on the aircraft type
2056
+	 *
2057
+	 * @param String $aircraft_type the aircraft type
2058
+	 * @return Array aircraft information
2059
+	 *
2060
+	 */
2061 2061
 	public function getAllAircraftInfo($aircraft_type)
2062 2062
 	{
2063 2063
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2089,12 +2089,12 @@  discard block
 block discarded – undo
2089 2089
 	}
2090 2090
 
2091 2091
 	/**
2092
-	* Gets the aircraft icao based on the aircraft name/type
2093
-	*
2094
-	* @param String $aircraft_type the aircraft type
2095
-	* @return String aircraft information
2096
-	*
2097
-	*/
2092
+	 * Gets the aircraft icao based on the aircraft name/type
2093
+	 *
2094
+	 * @param String $aircraft_type the aircraft type
2095
+	 * @return String aircraft information
2096
+	 *
2097
+	 */
2098 2098
 	public function getAircraftIcao($aircraft_type)
2099 2099
 	{
2100 2100
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2119,12 +2119,12 @@  discard block
 block discarded – undo
2119 2119
 	}
2120 2120
 	
2121 2121
 	/**
2122
-	* Gets the aircraft info based on the aircraft ident
2123
-	*
2124
-	* @param String $aircraft_modes the aircraft ident (hex)
2125
-	* @return String aircraft type
2126
-	*
2127
-	*/
2122
+	 * Gets the aircraft info based on the aircraft ident
2123
+	 *
2124
+	 * @param String $aircraft_modes the aircraft ident (hex)
2125
+	 * @return String aircraft type
2126
+	 *
2127
+	 */
2128 2128
 	public function getAllAircraftType($aircraft_modes)
2129 2129
 	{
2130 2130
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -2141,12 +2141,12 @@  discard block
 block discarded – undo
2141 2141
 	}
2142 2142
 
2143 2143
 	/**
2144
-	* Gets correct aircraft operator corde
2145
-	*
2146
-	* @param String $operator the aircraft operator code (callsign)
2147
-	* @return String aircraft operator code
2148
-	*
2149
-	*/
2144
+	 * Gets correct aircraft operator corde
2145
+	 *
2146
+	 * @param String $operator the aircraft operator code (callsign)
2147
+	 * @return String aircraft operator code
2148
+	 *
2149
+	 */
2150 2150
 	public function getOperator($operator)
2151 2151
 	{
2152 2152
 		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
@@ -2162,16 +2162,16 @@  discard block
 block discarded – undo
2162 2162
 	}
2163 2163
 
2164 2164
 	/**
2165
-	* Gets the aircraft route based on the aircraft callsign
2166
-	*
2167
-	* @param String $callsign the aircraft callsign
2168
-	* @return Array aircraft type
2169
-	*
2170
-	*/
2165
+	 * Gets the aircraft route based on the aircraft callsign
2166
+	 *
2167
+	 * @param String $callsign the aircraft callsign
2168
+	 * @return Array aircraft type
2169
+	 *
2170
+	 */
2171 2171
 	public function getRouteInfo($callsign)
2172 2172
 	{
2173 2173
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2174
-                if ($callsign == '') return array();
2174
+				if ($callsign == '') return array();
2175 2175
 		$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";
2176 2176
 		
2177 2177
 		$sth = $this->db->prepare($query);
@@ -2184,12 +2184,12 @@  discard block
 block discarded – undo
2184 2184
 	}
2185 2185
 	
2186 2186
 	/**
2187
-	* Gets the aircraft info based on the aircraft registration
2188
-	*
2189
-	* @param String $registration the aircraft registration
2190
-	* @return Array aircraft information
2191
-	*
2192
-	*/
2187
+	 * Gets the aircraft info based on the aircraft registration
2188
+	 *
2189
+	 * @param String $registration the aircraft registration
2190
+	 * @return Array aircraft information
2191
+	 *
2192
+	 */
2193 2193
 	public function getAircraftInfoByRegistration($registration)
2194 2194
 	{
2195 2195
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2216,12 +2216,12 @@  discard block
 block discarded – undo
2216 2216
 	}
2217 2217
 	
2218 2218
 	/**
2219
-	* Gets the aircraft owner & base based on the aircraft registration
2220
-	*
2221
-	* @param String $registration the aircraft registration
2222
-	* @return Array aircraft information
2223
-	*
2224
-	*/
2219
+	 * Gets the aircraft owner & base based on the aircraft registration
2220
+	 *
2221
+	 * @param String $registration the aircraft registration
2222
+	 * @return Array aircraft information
2223
+	 *
2224
+	 */
2225 2225
 	public function getAircraftOwnerByRegistration($registration)
2226 2226
 	{
2227 2227
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2237,11 +2237,11 @@  discard block
 block discarded – undo
2237 2237
 	
2238 2238
   
2239 2239
   /**
2240
-	* Gets all flights (but with only little info)
2241
-	*
2242
-	* @return Array basic flight information
2243
-	*
2244
-	*/
2240
+   * Gets all flights (but with only little info)
2241
+   *
2242
+   * @return Array basic flight information
2243
+   *
2244
+   */
2245 2245
 	public function getAllFlightsforSitemap()
2246 2246
 	{
2247 2247
 		//$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 ";
@@ -2249,7 +2249,7 @@  discard block
 block discarded – undo
2249 2249
 		
2250 2250
 		$sth = $this->db->prepare($query);
2251 2251
 		$sth->execute();
2252
-                  /*
2252
+				  /*
2253 2253
 		$flight_array = array();
2254 2254
 		$temp_array = array();
2255 2255
 		
@@ -2271,11 +2271,11 @@  discard block
 block discarded – undo
2271 2271
 	}
2272 2272
   
2273 2273
 	/**
2274
-	* Gets a list of all aircraft manufacturers
2275
-	*
2276
-	* @return Array list of aircraft types
2277
-	*
2278
-	*/
2274
+	 * Gets a list of all aircraft manufacturers
2275
+	 *
2276
+	 * @return Array list of aircraft types
2277
+	 *
2278
+	 */
2279 2279
 	public function getAllManufacturers()
2280 2280
 	{
2281 2281
 		/*
@@ -2304,11 +2304,11 @@  discard block
 block discarded – undo
2304 2304
   
2305 2305
   
2306 2306
   /**
2307
-	* Gets a list of all aircraft types
2308
-	*
2309
-	* @return Array list of aircraft types
2310
-	*
2311
-	*/
2307
+   * Gets a list of all aircraft types
2308
+   *
2309
+   * @return Array list of aircraft types
2310
+   *
2311
+   */
2312 2312
 	public function getAllAircraftTypes()
2313 2313
 	{
2314 2314
 		/*
@@ -2340,11 +2340,11 @@  discard block
 block discarded – undo
2340 2340
 	
2341 2341
 	
2342 2342
 	/**
2343
-	* Gets a list of all aircraft registrations
2344
-	*
2345
-	* @return Array list of aircraft registrations
2346
-	*
2347
-	*/
2343
+	 * Gets a list of all aircraft registrations
2344
+	 *
2345
+	 * @return Array list of aircraft registrations
2346
+	 *
2347
+	 */
2348 2348
 	public function getAllAircraftRegistrations()
2349 2349
 	{
2350 2350
 		$query  = "SELECT DISTINCT spotter_output.registration 
@@ -2369,12 +2369,12 @@  discard block
 block discarded – undo
2369 2369
 	}
2370 2370
 
2371 2371
 	/**
2372
-	* Gets all source name
2373
-	*
2374
-	* @param String type format of source
2375
-	* @return Array list of source name
2376
-	*
2377
-	*/
2372
+	 * Gets all source name
2373
+	 *
2374
+	 * @param String type format of source
2375
+	 * @return Array list of source name
2376
+	 *
2377
+	 */
2378 2378
 	public function getAllSourceName($type = '')
2379 2379
 	{
2380 2380
 		$query_values = array();
@@ -2405,11 +2405,11 @@  discard block
 block discarded – undo
2405 2405
 
2406 2406
 
2407 2407
 	/**
2408
-	* Gets a list of all airline names
2409
-	*
2410
-	* @return Array list of airline names
2411
-	*
2412
-	*/
2408
+	 * Gets a list of all airline names
2409
+	 *
2410
+	 * @return Array list of airline names
2411
+	 *
2412
+	 */
2413 2413
 	public function getAllAirlineNames($airline_type = '')
2414 2414
 	{
2415 2415
 		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
@@ -2452,11 +2452,11 @@  discard block
 block discarded – undo
2452 2452
 	
2453 2453
 	
2454 2454
 	/**
2455
-	* Gets a list of all airline countries
2456
-	*
2457
-	* @return Array list of airline countries
2458
-	*
2459
-	*/
2455
+	 * Gets a list of all airline countries
2456
+	 *
2457
+	 * @return Array list of airline countries
2458
+	 *
2459
+	 */
2460 2460
 	public function getAllAirlineCountries()
2461 2461
 	{
2462 2462
 		
@@ -2485,11 +2485,11 @@  discard block
 block discarded – undo
2485 2485
 	
2486 2486
 	
2487 2487
 	/**
2488
-	* Gets a list of all departure & arrival names
2489
-	*
2490
-	* @return Array list of airport names
2491
-	*
2492
-	*/
2488
+	 * Gets a list of all departure & arrival names
2489
+	 *
2490
+	 * @return Array list of airport names
2491
+	 *
2492
+	 */
2493 2493
 	public function getAllAirportNames()
2494 2494
 	{
2495 2495
 		$airport_array = array();
@@ -2540,11 +2540,11 @@  discard block
 block discarded – undo
2540 2540
 	
2541 2541
 	
2542 2542
 	/**
2543
-	* Gets a list of all departure & arrival airport countries
2544
-	*
2545
-	* @return Array list of airport countries
2546
-	*
2547
-	*/
2543
+	 * Gets a list of all departure & arrival airport countries
2544
+	 *
2545
+	 * @return Array list of airport countries
2546
+	 *
2547
+	 */
2548 2548
 	public function getAllAirportCountries()
2549 2549
 	{
2550 2550
 		$airport_array = array();
@@ -2593,11 +2593,11 @@  discard block
 block discarded – undo
2593 2593
 	
2594 2594
 	
2595 2595
 	/**
2596
-	* Gets a list of all countries (airline, departure airport & arrival airport)
2597
-	*
2598
-	* @return Array list of countries
2599
-	*
2600
-	*/
2596
+	 * Gets a list of all countries (airline, departure airport & arrival airport)
2597
+	 *
2598
+	 * @return Array list of countries
2599
+	 *
2600
+	 */
2601 2601
 	public function getAllCountries()
2602 2602
 	{
2603 2603
 		$Connection= new Connection($this->db);
@@ -2676,11 +2676,11 @@  discard block
 block discarded – undo
2676 2676
 	
2677 2677
 	
2678 2678
 	/**
2679
-	* Gets a list of all idents/callsigns
2680
-	*
2681
-	* @return Array list of ident/callsign names
2682
-	*
2683
-	*/
2679
+	 * Gets a list of all idents/callsigns
2680
+	 *
2681
+	 * @return Array list of ident/callsign names
2682
+	 *
2683
+	 */
2684 2684
 	public function getAllIdents()
2685 2685
 	{
2686 2686
 		$query  = "SELECT DISTINCT spotter_output.ident
@@ -2704,9 +2704,9 @@  discard block
 block discarded – undo
2704 2704
 	}
2705 2705
 
2706 2706
 	/**
2707
-	* Get a list of flights from airport since 7 days
2708
-	* @return Array number, icao, name and city of airports
2709
-	*/
2707
+	 * Get a list of flights from airport since 7 days
2708
+	 * @return Array number, icao, name and city of airports
2709
+	 */
2710 2710
 
2711 2711
 	public function getLast7DaysAirportsDeparture($airport_icao = '') {
2712 2712
 		global $globalTimezone, $globalDBdriver;
@@ -2736,9 +2736,9 @@  discard block
 block discarded – undo
2736 2736
 	}
2737 2737
 
2738 2738
 	/**
2739
-	* Get a list of flights from airport since 7 days
2740
-	* @return Array number, icao, name and city of airports
2741
-	*/
2739
+	 * Get a list of flights from airport since 7 days
2740
+	 * @return Array number, icao, name and city of airports
2741
+	 */
2742 2742
 
2743 2743
 	public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') {
2744 2744
 		global $globalTimezone, $globalDBdriver;
@@ -2768,9 +2768,9 @@  discard block
 block discarded – undo
2768 2768
 	}
2769 2769
 
2770 2770
 	/**
2771
-	* Get a list of flights from detected airport since 7 days
2772
-	* @return Array number, icao, name and city of airports
2773
-	*/
2771
+	 * Get a list of flights from detected airport since 7 days
2772
+	 * @return Array number, icao, name and city of airports
2773
+	 */
2774 2774
 
2775 2775
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '') {
2776 2776
 		global $globalTimezone, $globalDBdriver;
@@ -2811,9 +2811,9 @@  discard block
 block discarded – undo
2811 2811
 	}
2812 2812
 
2813 2813
 	/**
2814
-	* Get a list of flights from detected airport since 7 days
2815
-	* @return Array number, icao, name and city of airports
2816
-	*/
2814
+	 * Get a list of flights from detected airport since 7 days
2815
+	 * @return Array number, icao, name and city of airports
2816
+	 */
2817 2817
 
2818 2818
 	public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') {
2819 2819
 		global $globalTimezone, $globalDBdriver;
@@ -2855,9 +2855,9 @@  discard block
 block discarded – undo
2855 2855
 
2856 2856
 
2857 2857
 	/**
2858
-	* Get a list of flights to airport since 7 days
2859
-	* @return Array number, icao, name and city of airports
2860
-	*/
2858
+	 * Get a list of flights to airport since 7 days
2859
+	 * @return Array number, icao, name and city of airports
2860
+	 */
2861 2861
 
2862 2862
 	public function getLast7DaysAirportsArrival($airport_icao = '') {
2863 2863
 		global $globalTimezone, $globalDBdriver;
@@ -2889,9 +2889,9 @@  discard block
 block discarded – undo
2889 2889
 
2890 2890
 
2891 2891
 	/**
2892
-	* Get a list of flights detected to airport since 7 days
2893
-	* @return Array number, icao, name and city of airports
2894
-	*/
2892
+	 * Get a list of flights detected to airport since 7 days
2893
+	 * @return Array number, icao, name and city of airports
2894
+	 */
2895 2895
 
2896 2896
 	public function getLast7DaysDetectedAirportsArrival($airport_icao = '') {
2897 2897
 		global $globalTimezone, $globalDBdriver;
@@ -2935,9 +2935,9 @@  discard block
 block discarded – undo
2935 2935
 
2936 2936
 
2937 2937
 	/**
2938
-	* Get a list of flights to airport since 7 days
2939
-	* @return Array number, icao, name and city of airports
2940
-	*/
2938
+	 * Get a list of flights to airport since 7 days
2939
+	 * @return Array number, icao, name and city of airports
2940
+	 */
2941 2941
 
2942 2942
 	public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') {
2943 2943
 		global $globalTimezone, $globalDBdriver;
@@ -2969,9 +2969,9 @@  discard block
 block discarded – undo
2969 2969
 
2970 2970
 
2971 2971
 	/**
2972
-	* Get a list of flights detected to airport since 7 days
2973
-	* @return Array number, icao, name and city of airports
2974
-	*/
2972
+	 * Get a list of flights detected to airport since 7 days
2973
+	 * @return Array number, icao, name and city of airports
2974
+	 */
2975 2975
 
2976 2976
 	public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') {
2977 2977
 		global $globalTimezone, $globalDBdriver;
@@ -3015,11 +3015,11 @@  discard block
 block discarded – undo
3015 3015
 
3016 3016
 
3017 3017
 	/**
3018
-	* Gets a list of all dates
3019
-	*
3020
-	* @return Array list of date names
3021
-	*
3022
-	*/
3018
+	 * Gets a list of all dates
3019
+	 *
3020
+	 * @return Array list of date names
3021
+	 *
3022
+	 */
3023 3023
 	public function getAllDates()
3024 3024
 	{
3025 3025
 		global $globalTimezone, $globalDBdriver;
@@ -3060,11 +3060,11 @@  discard block
 block discarded – undo
3060 3060
 	
3061 3061
 	
3062 3062
 	/**
3063
-	* Gets all route combinations
3064
-	*
3065
-	* @return Array the route list
3066
-	*
3067
-	*/
3063
+	 * Gets all route combinations
3064
+	 *
3065
+	 * @return Array the route list
3066
+	 *
3067
+	 */
3068 3068
 	public function getAllRoutes()
3069 3069
 	{
3070 3070
 		$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 
@@ -3090,13 +3090,13 @@  discard block
 block discarded – undo
3090 3090
 	}
3091 3091
 
3092 3092
 	/**
3093
-	* Update ident spotter data
3094
-	*
3095
-	* @param String $flightaware_id the ID from flightaware
3096
-	* @param String $ident the flight ident
3097
-	* @return String success or false
3098
-	*
3099
-	*/	
3093
+	 * Update ident spotter data
3094
+	 *
3095
+	 * @param String $flightaware_id the ID from flightaware
3096
+	 * @param String $ident the flight ident
3097
+	 * @return String success or false
3098
+	 *
3099
+	 */	
3100 3100
 	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3101 3101
 	{
3102 3102
 		if (!is_numeric(substr($ident, 0, 3)))
@@ -3117,14 +3117,14 @@  discard block
 block discarded – undo
3117 3117
 		} else {
3118 3118
 			$airline_array = $this->getAllAirlineInfo("NA");
3119 3119
 		}
3120
-                $airline_name = $airline_array[0]['name'];
3121
-                $airline_icao = $airline_array[0]['icao'];
3122
-                $airline_country = $airline_array[0]['country'];
3123
-                $airline_type = $airline_array[0]['type'];
3120
+				$airline_name = $airline_array[0]['name'];
3121
+				$airline_icao = $airline_array[0]['icao'];
3122
+				$airline_country = $airline_array[0]['country'];
3123
+				$airline_type = $airline_array[0]['type'];
3124 3124
 
3125 3125
 
3126 3126
 		$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';
3127
-                $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);
3127
+				$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);
3128 3128
 
3129 3129
 		try {
3130 3130
 			$sth = $this->db->prepare($query);
@@ -3137,19 +3137,19 @@  discard block
 block discarded – undo
3137 3137
 
3138 3138
 	}
3139 3139
 	/**
3140
-	* Update latest spotter data
3141
-	*
3142
-	* @param String $flightaware_id the ID from flightaware
3143
-	* @param String $ident the flight ident
3144
-	* @param String $arrival_airport_icao the arrival airport
3145
-	* @return String success or false
3146
-	*
3147
-	*/	
3140
+	 * Update latest spotter data
3141
+	 *
3142
+	 * @param String $flightaware_id the ID from flightaware
3143
+	 * @param String $ident the flight ident
3144
+	 * @param String $arrival_airport_icao the arrival airport
3145
+	 * @return String success or false
3146
+	 *
3147
+	 */	
3148 3148
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3149 3149
 	{
3150 3150
 		if ($groundspeed == '') $groundspeed = NULL;
3151 3151
 		$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';
3152
-                $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);
3152
+				$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);
3153 3153
 
3154 3154
 		try {
3155 3155
 			$sth = $this->db->prepare($query);
@@ -3163,32 +3163,32 @@  discard block
 block discarded – undo
3163 3163
 	}
3164 3164
 
3165 3165
 	/**
3166
-	* Adds a new spotter data
3167
-	*
3168
-	* @param String $flightaware_id the ID from flightaware
3169
-	* @param String $ident the flight ident
3170
-	* @param String $aircraft_icao the aircraft type
3171
-	* @param String $departure_airport_icao the departure airport
3172
-	* @param String $arrival_airport_icao the arrival airport
3173
-	* @param String $latitude latitude of flight
3174
-	* @param String $longitude latitude of flight
3175
-	* @param String $waypoints waypoints of flight
3176
-	* @param String $altitude altitude of flight
3177
-	* @param String $heading heading of flight
3178
-	* @param String $groundspeed speed of flight
3179
-	* @param String $date date of flight
3180
-	* @param String $departure_airport_time departure time of flight
3181
-	* @param String $arrival_airport_time arrival time of flight
3182
-	* @param String $squawk squawk code of flight
3183
-	* @param String $route_stop route stop of flight
3184
-	* @param String $highlight highlight or not
3185
-	* @param String $ModeS ModesS code of flight
3186
-	* @param String $registration registration code of flight
3187
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
3188
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
3189
-	* @param String $verticalrate vertival rate of flight
3190
-	* @return String success or false
3191
-	*/
3166
+	 * Adds a new spotter data
3167
+	 *
3168
+	 * @param String $flightaware_id the ID from flightaware
3169
+	 * @param String $ident the flight ident
3170
+	 * @param String $aircraft_icao the aircraft type
3171
+	 * @param String $departure_airport_icao the departure airport
3172
+	 * @param String $arrival_airport_icao the arrival airport
3173
+	 * @param String $latitude latitude of flight
3174
+	 * @param String $longitude latitude of flight
3175
+	 * @param String $waypoints waypoints of flight
3176
+	 * @param String $altitude altitude of flight
3177
+	 * @param String $heading heading of flight
3178
+	 * @param String $groundspeed speed of flight
3179
+	 * @param String $date date of flight
3180
+	 * @param String $departure_airport_time departure time of flight
3181
+	 * @param String $arrival_airport_time arrival time of flight
3182
+	 * @param String $squawk squawk code of flight
3183
+	 * @param String $route_stop route stop of flight
3184
+	 * @param String $highlight highlight or not
3185
+	 * @param String $ModeS ModesS code of flight
3186
+	 * @param String $registration registration code of flight
3187
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
3188
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
3189
+	 * @param String $verticalrate vertival rate of flight
3190
+	 * @return String success or false
3191
+	 */
3192 3192
 	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 = '')
3193 3193
 	{
3194 3194
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed;
@@ -3400,8 +3400,8 @@  discard block
 block discarded – undo
3400 3400
     
3401 3401
 		if ($globalIVAO && $aircraft_icao != '')
3402 3402
 		{
3403
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3404
-            		else $airline_icao = '';
3403
+					if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3404
+					else $airline_icao = '';
3405 3405
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3406 3406
 			if (!isset($image_array[0]['registration']))
3407 3407
 			{
@@ -3432,48 +3432,48 @@  discard block
 block discarded – undo
3432 3432
 	
3433 3433
 		if (count($airline_array) == 0) 
3434 3434
 		{
3435
-                        $airline_array = $this->getAllAirlineInfo('NA');
3436
-                }
3437
-                if (count($aircraft_array) == 0) 
3438
-                {
3439
-                        $aircraft_array = $this->getAllAircraftInfo('NA');
3440
-                }
3441
-                if (count($departure_airport_array) == 0) 
3442
-                {
3443
-                        $departure_airport_array = $this->getAllAirportInfo('NA');
3444
-                }
3445
-                if (count($arrival_airport_array) == 0) 
3446
-                {
3447
-                        $arrival_airport_array = $this->getAllAirportInfo('NA');
3448
-                }
3449
-                if ($registration == '') $registration = 'NA';
3450
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3451
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3452
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3453
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3454
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3455
-                $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) 
3435
+						$airline_array = $this->getAllAirlineInfo('NA');
3436
+				}
3437
+				if (count($aircraft_array) == 0) 
3438
+				{
3439
+						$aircraft_array = $this->getAllAircraftInfo('NA');
3440
+				}
3441
+				if (count($departure_airport_array) == 0) 
3442
+				{
3443
+						$departure_airport_array = $this->getAllAirportInfo('NA');
3444
+				}
3445
+				if (count($arrival_airport_array) == 0) 
3446
+				{
3447
+						$arrival_airport_array = $this->getAllAirportInfo('NA');
3448
+				}
3449
+				if ($registration == '') $registration = 'NA';
3450
+				if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3451
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3452
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3453
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3454
+				if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3455
+				$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) 
3456 3456
                 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)";
3457 3457
 
3458
-                $airline_name = $airline_array[0]['name'];
3459
-                $airline_icao = $airline_array[0]['icao'];
3460
-                $airline_country = $airline_array[0]['country'];
3461
-                $airline_type = $airline_array[0]['type'];
3458
+				$airline_name = $airline_array[0]['name'];
3459
+				$airline_icao = $airline_array[0]['icao'];
3460
+				$airline_country = $airline_array[0]['country'];
3461
+				$airline_type = $airline_array[0]['type'];
3462 3462
 		if ($airline_type == '') {
3463 3463
 			$timeelapsed = microtime(true);
3464 3464
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3465 3465
 			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3466 3466
 		}
3467 3467
 		if ($airline_type == null) $airline_type = '';
3468
-                $aircraft_type = $aircraft_array[0]['type'];
3469
-                $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3470
-                $departure_airport_name = $departure_airport_array[0]['name'];
3471
-                $departure_airport_city = $departure_airport_array[0]['city'];
3472
-                $departure_airport_country = $departure_airport_array[0]['country'];
3473
-                $arrival_airport_name = $arrival_airport_array[0]['name'];
3474
-                $arrival_airport_city = $arrival_airport_array[0]['city'];
3475
-                $arrival_airport_country = $arrival_airport_array[0]['country'];
3476
-                $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);
3468
+				$aircraft_type = $aircraft_array[0]['type'];
3469
+				$aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3470
+				$departure_airport_name = $departure_airport_array[0]['name'];
3471
+				$departure_airport_city = $departure_airport_array[0]['city'];
3472
+				$departure_airport_country = $departure_airport_array[0]['country'];
3473
+				$arrival_airport_name = $arrival_airport_array[0]['name'];
3474
+				$arrival_airport_city = $arrival_airport_array[0]['city'];
3475
+				$arrival_airport_country = $arrival_airport_array[0]['country'];
3476
+				$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);
3477 3477
 
3478 3478
 		try {
3479 3479
 		        
@@ -3481,7 +3481,7 @@  discard block
 block discarded – undo
3481 3481
 			$sth->execute($query_values);
3482 3482
 			$this->db = null;
3483 3483
 		} catch (PDOException $e) {
3484
-		    return "error : ".$e->getMessage();
3484
+			return "error : ".$e->getMessage();
3485 3485
 		}
3486 3486
 		
3487 3487
 		return "success";
@@ -3490,11 +3490,11 @@  discard block
 block discarded – undo
3490 3490
 	
3491 3491
   
3492 3492
 	/**
3493
-	* Gets the aircraft ident within the last hour
3494
-	*
3495
-	* @return String the ident
3496
-	*
3497
-	*/
3493
+	 * Gets the aircraft ident within the last hour
3494
+	 *
3495
+	 * @return String the ident
3496
+	 *
3497
+	 */
3498 3498
 	public function getIdentFromLastHour($ident)
3499 3499
 	{
3500 3500
 		global $globalDBdriver, $globalTimezone;
@@ -3510,11 +3510,11 @@  discard block
 block discarded – undo
3510 3510
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3511 3511
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
3512 3512
 			$query_data = array(':ident' => $ident);
3513
-    		}
3513
+			}
3514 3514
 		
3515 3515
 		$sth = $this->db->prepare($query);
3516 3516
 		$sth->execute($query_data);
3517
-    		$ident_result='';
3517
+			$ident_result='';
3518 3518
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3519 3519
 		{
3520 3520
 			$ident_result = $row['ident'];
@@ -3525,11 +3525,11 @@  discard block
 block discarded – undo
3525 3525
 	
3526 3526
 	
3527 3527
 	/**
3528
-	* Gets the aircraft data from the last 20 seconds
3529
-	*
3530
-	* @return Array the spotter data
3531
-	*
3532
-	*/
3528
+	 * Gets the aircraft data from the last 20 seconds
3529
+	 *
3530
+	 * @return Array the spotter data
3531
+	 *
3532
+	 */
3533 3533
 	public function getRealTimeData($q = '')
3534 3534
 	{
3535 3535
 		global $globalDBdriver;
@@ -3573,11 +3573,11 @@  discard block
 block discarded – undo
3573 3573
 	
3574 3574
 	
3575 3575
 	 /**
3576
-	* Gets all airlines that have flown over
3577
-	*
3578
-	* @return Array the airline list
3579
-	*
3580
-	*/
3576
+	  * Gets all airlines that have flown over
3577
+	  *
3578
+	  * @return Array the airline list
3579
+	  *
3580
+	  */
3581 3581
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3582 3582
 	{
3583 3583
 		global $globalDBdriver;
@@ -3591,7 +3591,7 @@  discard block
 block discarded – undo
3591 3591
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3592 3592
 			}
3593 3593
 		}
3594
-                if ($sincedate != '') {
3594
+				if ($sincedate != '') {
3595 3595
 			if ($globalDBdriver == 'mysql') {
3596 3596
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3597 3597
 			} else {
@@ -3618,26 +3618,26 @@  discard block
 block discarded – undo
3618 3618
 	}
3619 3619
 
3620 3620
 	 /**
3621
-	* Gets all pilots that have flown over
3622
-	*
3623
-	* @return Array the pilots list
3624
-	*
3625
-	*/
3621
+	  * Gets all pilots that have flown over
3622
+	  *
3623
+	  * @return Array the pilots list
3624
+	  *
3625
+	  */
3626 3626
 	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3627 3627
 	{
3628 3628
 		global $globalDBdriver;
3629 3629
 		$filter_query = $this->getFilter($filters,true,true);
3630 3630
 		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3631 3631
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3632
-                if ($olderthanmonths > 0) {
3633
-            		if ($globalDBdriver == 'mysql') {
3632
+				if ($olderthanmonths > 0) {
3633
+					if ($globalDBdriver == 'mysql') {
3634 3634
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3635 3635
 			} else {
3636 3636
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3637 3637
 			}
3638 3638
 		}
3639
-                if ($sincedate != '') {
3640
-            		if ($globalDBdriver == 'mysql') {
3639
+				if ($sincedate != '') {
3640
+					if ($globalDBdriver == 'mysql') {
3641 3641
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3642 3642
 			} else {
3643 3643
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3664,25 +3664,25 @@  discard block
 block discarded – undo
3664 3664
 	}
3665 3665
 	
3666 3666
 		 /**
3667
-	* Gets all pilots that have flown over
3668
-	*
3669
-	* @return Array the pilots list
3670
-	*
3671
-	*/
3667
+		  * Gets all pilots that have flown over
3668
+		  *
3669
+		  * @return Array the pilots list
3670
+		  *
3671
+		  */
3672 3672
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3673 3673
 	{
3674 3674
 		global $globalDBdriver;
3675 3675
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3676 3676
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
3677
-                if ($olderthanmonths > 0) {
3678
-            		if ($globalDBdriver == 'mysql') {
3677
+				if ($olderthanmonths > 0) {
3678
+					if ($globalDBdriver == 'mysql') {
3679 3679
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3680 3680
 			} else {
3681 3681
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3682 3682
 			}
3683 3683
 		}
3684
-                if ($sincedate != '') {
3685
-            		if ($globalDBdriver == 'mysql') {
3684
+				if ($sincedate != '') {
3685
+					if ($globalDBdriver == 'mysql') {
3686 3686
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3687 3687
 			} else {
3688 3688
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3710,26 +3710,26 @@  discard block
 block discarded – undo
3710 3710
 	}
3711 3711
 	
3712 3712
 	 /**
3713
-	* Gets all owner that have flown over
3714
-	*
3715
-	* @return Array the pilots list
3716
-	*
3717
-	*/
3713
+	  * Gets all owner that have flown over
3714
+	  *
3715
+	  * @return Array the pilots list
3716
+	  *
3717
+	  */
3718 3718
 	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3719 3719
 	{
3720 3720
 		global $globalDBdriver;
3721 3721
 		$filter_query = $this->getFilter($filters,true,true);
3722 3722
 		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3723 3723
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3724
-                if ($olderthanmonths > 0) {
3725
-            		if ($globalDBdriver == 'mysql') {
3724
+				if ($olderthanmonths > 0) {
3725
+					if ($globalDBdriver == 'mysql') {
3726 3726
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3727 3727
 			} else {
3728 3728
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3729 3729
 			}
3730 3730
 		}
3731
-                if ($sincedate != '') {
3732
-            		if ($globalDBdriver == 'mysql') {
3731
+				if ($sincedate != '') {
3732
+					if ($globalDBdriver == 'mysql') {
3733 3733
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3734 3734
 			} else {
3735 3735
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3755,25 +3755,25 @@  discard block
 block discarded – undo
3755 3755
 	}
3756 3756
 	
3757 3757
 	 /**
3758
-	* Gets all owner that have flown over
3759
-	*
3760
-	* @return Array the pilots list
3761
-	*
3762
-	*/
3758
+	  * Gets all owner that have flown over
3759
+	  *
3760
+	  * @return Array the pilots list
3761
+	  *
3762
+	  */
3763 3763
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3764 3764
 	{
3765 3765
 		global $globalDBdriver;
3766 3766
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3767 3767
 		 			FROM spotter_output WHERE spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3768
-                if ($olderthanmonths > 0) {
3769
-            		if ($globalDBdriver == 'mysql') {
3768
+				if ($olderthanmonths > 0) {
3769
+					if ($globalDBdriver == 'mysql') {
3770 3770
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3771 3771
 			} else {
3772 3772
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3773 3773
 			}
3774 3774
 		}
3775
-                if ($sincedate != '') {
3776
-            		if ($globalDBdriver == 'mysql') {
3775
+				if ($sincedate != '') {
3776
+					if ($globalDBdriver == 'mysql') {
3777 3777
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3778 3778
 			} else {
3779 3779
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3800,11 +3800,11 @@  discard block
 block discarded – undo
3800 3800
 	}
3801 3801
 
3802 3802
 	/**
3803
-	* Gets all airlines that have flown over by aircraft
3804
-	*
3805
-	* @return Array the airline list
3806
-	*
3807
-	*/
3803
+	 * Gets all airlines that have flown over by aircraft
3804
+	 *
3805
+	 * @return Array the airline list
3806
+	 *
3807
+	 */
3808 3808
 	public function countAllAirlinesByAircraft($aircraft_icao)
3809 3809
 	{
3810 3810
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3837,11 +3837,11 @@  discard block
 block discarded – undo
3837 3837
 
3838 3838
 
3839 3839
 	/**
3840
-	* Gets all airline countries that have flown over by aircraft
3841
-	*
3842
-	* @return Array the airline country list
3843
-	*
3844
-	*/
3840
+	 * Gets all airline countries that have flown over by aircraft
3841
+	 *
3842
+	 * @return Array the airline country list
3843
+	 *
3844
+	 */
3845 3845
 	public function countAllAirlineCountriesByAircraft($aircraft_icao)
3846 3846
 	{
3847 3847
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3874,11 +3874,11 @@  discard block
 block discarded – undo
3874 3874
 	
3875 3875
 	
3876 3876
 	/**
3877
-	* Gets all airlines that have flown over by airport
3878
-	*
3879
-	* @return Array the airline list
3880
-	*
3881
-	*/
3877
+	 * Gets all airlines that have flown over by airport
3878
+	 *
3879
+	 * @return Array the airline list
3880
+	 *
3881
+	 */
3882 3882
 	public function countAllAirlinesByAirport($airport_icao)
3883 3883
 	{
3884 3884
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -3910,11 +3910,11 @@  discard block
 block discarded – undo
3910 3910
 
3911 3911
 
3912 3912
 	/**
3913
-	* Gets all airline countries that have flown over by airport icao
3914
-	*
3915
-	* @return Array the airline country list
3916
-	*
3917
-	*/
3913
+	 * Gets all airline countries that have flown over by airport icao
3914
+	 *
3915
+	 * @return Array the airline country list
3916
+	 *
3917
+	 */
3918 3918
 	public function countAllAirlineCountriesByAirport($airport_icao)
3919 3919
 	{
3920 3920
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -3945,11 +3945,11 @@  discard block
 block discarded – undo
3945 3945
 
3946 3946
 
3947 3947
 	/**
3948
-	* Gets all airlines that have flown over by aircraft manufacturer
3949
-	*
3950
-	* @return Array the airline list
3951
-	*
3952
-	*/
3948
+	 * Gets all airlines that have flown over by aircraft manufacturer
3949
+	 *
3950
+	 * @return Array the airline list
3951
+	 *
3952
+	 */
3953 3953
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer)
3954 3954
 	{
3955 3955
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -3981,11 +3981,11 @@  discard block
 block discarded – undo
3981 3981
 
3982 3982
 
3983 3983
 	/**
3984
-	* Gets all airline countries that have flown over by aircraft manufacturer
3985
-	*
3986
-	* @return Array the airline country list
3987
-	*
3988
-	*/
3984
+	 * Gets all airline countries that have flown over by aircraft manufacturer
3985
+	 *
3986
+	 * @return Array the airline country list
3987
+	 *
3988
+	 */
3989 3989
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer)
3990 3990
 	{
3991 3991
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4015,11 +4015,11 @@  discard block
 block discarded – undo
4015 4015
 
4016 4016
 
4017 4017
 	/**
4018
-	* Gets all airlines that have flown over by date
4019
-	*
4020
-	* @return Array the airline list
4021
-	*
4022
-	*/
4018
+	 * Gets all airlines that have flown over by date
4019
+	 *
4020
+	 * @return Array the airline list
4021
+	 *
4022
+	 */
4023 4023
 	public function countAllAirlinesByDate($date)
4024 4024
 	{
4025 4025
 		global $globalTimezone, $globalDBdriver;
@@ -4065,11 +4065,11 @@  discard block
 block discarded – undo
4065 4065
 	
4066 4066
 	
4067 4067
 	/**
4068
-	* Gets all airline countries that have flown over by date
4069
-	*
4070
-	* @return Array the airline country list
4071
-	*
4072
-	*/
4068
+	 * Gets all airline countries that have flown over by date
4069
+	 *
4070
+	 * @return Array the airline country list
4071
+	 *
4072
+	 */
4073 4073
 	public function countAllAirlineCountriesByDate($date)
4074 4074
 	{
4075 4075
 		global $globalTimezone, $globalDBdriver;
@@ -4113,11 +4113,11 @@  discard block
 block discarded – undo
4113 4113
 
4114 4114
 
4115 4115
 	/**
4116
-	* Gets all airlines that have flown over by ident/callsign
4117
-	*
4118
-	* @return Array the airline list
4119
-	*
4120
-	*/
4116
+	 * Gets all airlines that have flown over by ident/callsign
4117
+	 *
4118
+	 * @return Array the airline list
4119
+	 *
4120
+	 */
4121 4121
 	public function countAllAirlinesByIdent($ident)
4122 4122
 	{
4123 4123
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4148,11 +4148,11 @@  discard block
 block discarded – undo
4148 4148
 	}
4149 4149
 
4150 4150
 	/**
4151
-	* Gets all airlines that have flown over by route
4152
-	*
4153
-	* @return Array the airline list
4154
-	*
4155
-	*/
4151
+	 * Gets all airlines that have flown over by route
4152
+	 *
4153
+	 * @return Array the airline list
4154
+	 *
4155
+	 */
4156 4156
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao)
4157 4157
 	{
4158 4158
 		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
@@ -4184,11 +4184,11 @@  discard block
 block discarded – undo
4184 4184
 	}
4185 4185
 
4186 4186
 	/**
4187
-	* Gets all airline countries that have flown over by route
4188
-	*
4189
-	* @return Array the airline country list
4190
-	*
4191
-	*/
4187
+	 * Gets all airline countries that have flown over by route
4188
+	 *
4189
+	 * @return Array the airline country list
4190
+	 *
4191
+	 */
4192 4192
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao)
4193 4193
 	{
4194 4194
 		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
@@ -4220,11 +4220,11 @@  discard block
 block discarded – undo
4220 4220
 
4221 4221
 
4222 4222
 	/**
4223
-	* Gets all airlines that have flown over by country
4224
-	*
4225
-	* @return Array the airline list
4226
-	*
4227
-	*/
4223
+	 * Gets all airlines that have flown over by country
4224
+	 *
4225
+	 * @return Array the airline list
4226
+	 *
4227
+	 */
4228 4228
 	public function countAllAirlinesByCountry($country)
4229 4229
 	{
4230 4230
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4255,11 +4255,11 @@  discard block
 block discarded – undo
4255 4255
 
4256 4256
 
4257 4257
 	/**
4258
-	* Gets all airline countries that have flown over by country
4259
-	*
4260
-	* @return Array the airline country list
4261
-	*
4262
-	*/
4258
+	 * Gets all airline countries that have flown over by country
4259
+	 *
4260
+	 * @return Array the airline country list
4261
+	 *
4262
+	 */
4263 4263
 	public function countAllAirlineCountriesByCountry($country)
4264 4264
 	{
4265 4265
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4289,11 +4289,11 @@  discard block
 block discarded – undo
4289 4289
 
4290 4290
 
4291 4291
 	/**
4292
-	* Gets all airlines countries
4293
-	*
4294
-	* @return Array the airline country list
4295
-	*
4296
-	*/
4292
+	 * Gets all airlines countries
4293
+	 *
4294
+	 * @return Array the airline country list
4295
+	 *
4296
+	 */
4297 4297
 	public function countAllAirlineCountries($limit = true)
4298 4298
 	{
4299 4299
 		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
@@ -4319,11 +4319,11 @@  discard block
 block discarded – undo
4319 4319
 	}
4320 4320
 
4321 4321
 	/**
4322
-	* Gets all number of flight over countries
4323
-	*
4324
-	* @return Array the airline country list
4325
-	*
4326
-	*/
4322
+	 * Gets all number of flight over countries
4323
+	 *
4324
+	 * @return Array the airline country list
4325
+	 *
4326
+	 */
4327 4327
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
4328 4328
 	{
4329 4329
 		global $globalDBdriver;
@@ -4335,15 +4335,15 @@  discard block
 block discarded – undo
4335 4335
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
4336 4336
 					FROM countries c, spotter_live s
4337 4337
 					WHERE c.iso2 = s.over_country ";
4338
-                if ($olderthanmonths > 0) {
4338
+				if ($olderthanmonths > 0) {
4339 4339
 			if ($globalDBdriver == 'mysql') {
4340 4340
 				$query .= 'AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
4341 4341
 			} else {
4342 4342
 				$query .= "AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4343 4343
 			}
4344 4344
 		}
4345
-                if ($sincedate != '') {
4346
-            		if ($globalDBdriver == 'mysql') {
4345
+				if ($sincedate != '') {
4346
+					if ($globalDBdriver == 'mysql') {
4347 4347
 				$query .= "AND spotter_live.date > '".$sincedate."' ";
4348 4348
 			} else {
4349 4349
 				$query .= "AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4373,11 +4373,11 @@  discard block
 block discarded – undo
4373 4373
 	
4374 4374
 	
4375 4375
 	/**
4376
-	* Gets all aircraft types that have flown over
4377
-	*
4378
-	* @return Array the aircraft list
4379
-	*
4380
-	*/
4376
+	 * Gets all aircraft types that have flown over
4377
+	 *
4378
+	 * @return Array the aircraft list
4379
+	 *
4380
+	 */
4381 4381
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4382 4382
 	{
4383 4383
 		global $globalDBdriver;
@@ -4420,11 +4420,11 @@  discard block
 block discarded – undo
4420 4420
 	}
4421 4421
 
4422 4422
 	/**
4423
-	* Gets all aircraft types that have flown over by airline
4424
-	*
4425
-	* @return Array the aircraft list
4426
-	*
4427
-	*/
4423
+	 * Gets all aircraft types that have flown over by airline
4424
+	 *
4425
+	 * @return Array the aircraft list
4426
+	 *
4427
+	 */
4428 4428
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
4429 4429
 	{
4430 4430
 		global $globalDBdriver;
@@ -4468,11 +4468,11 @@  discard block
 block discarded – undo
4468 4468
 
4469 4469
 
4470 4470
 	/**
4471
-	* Gets all aircraft registration that have flown over by aircaft icao
4472
-	*
4473
-	* @return Array the aircraft list
4474
-	*
4475
-	*/
4471
+	 * Gets all aircraft registration that have flown over by aircaft icao
4472
+	 *
4473
+	 * @return Array the aircraft list
4474
+	 *
4475
+	 */
4476 4476
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao)
4477 4477
 	{
4478 4478
 		$Image = new Image($this->db);
@@ -4511,11 +4511,11 @@  discard block
 block discarded – undo
4511 4511
 
4512 4512
 
4513 4513
 	/**
4514
-	* Gets all aircraft types that have flown over by airline icao
4515
-	*
4516
-	* @return Array the aircraft list
4517
-	*
4518
-	*/
4514
+	 * Gets all aircraft types that have flown over by airline icao
4515
+	 *
4516
+	 * @return Array the aircraft list
4517
+	 *
4518
+	 */
4519 4519
 	public function countAllAircraftTypesByAirline($airline_icao)
4520 4520
 	{
4521 4521
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
@@ -4545,11 +4545,11 @@  discard block
 block discarded – undo
4545 4545
 
4546 4546
 
4547 4547
 	/**
4548
-	* Gets all aircraft registration that have flown over by airline icao
4549
-	*
4550
-	* @return Array the aircraft list
4551
-	*
4552
-	*/
4548
+	 * Gets all aircraft registration that have flown over by airline icao
4549
+	 *
4550
+	 * @return Array the aircraft list
4551
+	 *
4552
+	 */
4553 4553
 	public function countAllAircraftRegistrationByAirline($airline_icao)
4554 4554
 	{
4555 4555
 		$Image = new Image($this->db);
@@ -4587,11 +4587,11 @@  discard block
 block discarded – undo
4587 4587
 
4588 4588
 
4589 4589
 	/**
4590
-	* Gets all aircraft manufacturer that have flown over by airline icao
4591
-	*
4592
-	* @return Array the aircraft list
4593
-	*
4594
-	*/
4590
+	 * Gets all aircraft manufacturer that have flown over by airline icao
4591
+	 *
4592
+	 * @return Array the aircraft list
4593
+	 *
4594
+	 */
4595 4595
 	public function countAllAircraftManufacturerByAirline($airline_icao)
4596 4596
 	{
4597 4597
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
@@ -4620,11 +4620,11 @@  discard block
 block discarded – undo
4620 4620
 
4621 4621
 
4622 4622
 	/**
4623
-	* Gets all aircraft types that have flown over by airline icao
4624
-	*
4625
-	* @return Array the aircraft list
4626
-	*
4627
-	*/
4623
+	 * Gets all aircraft types that have flown over by airline icao
4624
+	 *
4625
+	 * @return Array the aircraft list
4626
+	 *
4627
+	 */
4628 4628
 	public function countAllAircraftTypesByAirport($airport_icao)
4629 4629
 	{
4630 4630
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4653,11 +4653,11 @@  discard block
 block discarded – undo
4653 4653
 
4654 4654
 
4655 4655
 	/**
4656
-	* Gets all aircraft registration that have flown over by airport icao
4657
-	*
4658
-	* @return Array the aircraft list
4659
-	*
4660
-	*/
4656
+	 * Gets all aircraft registration that have flown over by airport icao
4657
+	 *
4658
+	 * @return Array the aircraft list
4659
+	 *
4660
+	 */
4661 4661
 	public function countAllAircraftRegistrationByAirport($airport_icao)
4662 4662
 	{
4663 4663
 		$Image = new Image($this->db);
@@ -4695,11 +4695,11 @@  discard block
 block discarded – undo
4695 4695
 	
4696 4696
 	
4697 4697
 	/**
4698
-	* Gets all aircraft manufacturer that have flown over by airport icao
4699
-	*
4700
-	* @return Array the aircraft list
4701
-	*
4702
-	*/
4698
+	 * Gets all aircraft manufacturer that have flown over by airport icao
4699
+	 *
4700
+	 * @return Array the aircraft list
4701
+	 *
4702
+	 */
4703 4703
 	public function countAllAircraftManufacturerByAirport($airport_icao)
4704 4704
 	{
4705 4705
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4726,11 +4726,11 @@  discard block
 block discarded – undo
4726 4726
 	}
4727 4727
 
4728 4728
 	/**
4729
-	* Gets all aircraft types that have flown over by aircraft manufacturer
4730
-	*
4731
-	* @return Array the aircraft list
4732
-	*
4733
-	*/
4729
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
4730
+	 *
4731
+	 * @return Array the aircraft list
4732
+	 *
4733
+	 */
4734 4734
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer)
4735 4735
 	{
4736 4736
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4757,11 +4757,11 @@  discard block
 block discarded – undo
4757 4757
 
4758 4758
 
4759 4759
 	/**
4760
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
4761
-	*
4762
-	* @return Array the aircraft list
4763
-	*
4764
-	*/
4760
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
4761
+	 *
4762
+	 * @return Array the aircraft list
4763
+	 *
4764
+	 */
4765 4765
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer)
4766 4766
 	{
4767 4767
 		$Image = new Image($this->db);
@@ -4797,11 +4797,11 @@  discard block
 block discarded – undo
4797 4797
 	}
4798 4798
 
4799 4799
 	/**
4800
-	* Gets all aircraft types that have flown over by date
4801
-	*
4802
-	* @return Array the aircraft list
4803
-	*
4804
-	*/
4800
+	 * Gets all aircraft types that have flown over by date
4801
+	 *
4802
+	 * @return Array the aircraft list
4803
+	 *
4804
+	 */
4805 4805
 	public function countAllAircraftTypesByDate($date)
4806 4806
 	{
4807 4807
 		global $globalTimezone, $globalDBdriver;
@@ -4844,11 +4844,11 @@  discard block
 block discarded – undo
4844 4844
 
4845 4845
 
4846 4846
 	/**
4847
-	* Gets all aircraft registration that have flown over by date
4848
-	*
4849
-	* @return Array the aircraft list
4850
-	*
4851
-	*/
4847
+	 * Gets all aircraft registration that have flown over by date
4848
+	 *
4849
+	 * @return Array the aircraft list
4850
+	 *
4851
+	 */
4852 4852
 	public function countAllAircraftRegistrationByDate($date)
4853 4853
 	{
4854 4854
 		global $globalTimezone, $globalDBdriver;
@@ -4900,11 +4900,11 @@  discard block
 block discarded – undo
4900 4900
 
4901 4901
 
4902 4902
 	/**
4903
-	* Gets all aircraft manufacturer that have flown over by date
4904
-	*
4905
-	* @return Array the aircraft manufacturer list
4906
-	*
4907
-	*/
4903
+	 * Gets all aircraft manufacturer that have flown over by date
4904
+	 *
4905
+	 * @return Array the aircraft manufacturer list
4906
+	 *
4907
+	 */
4908 4908
 	public function countAllAircraftManufacturerByDate($date)
4909 4909
 	{
4910 4910
 		global $globalTimezone, $globalDBdriver;
@@ -4947,11 +4947,11 @@  discard block
 block discarded – undo
4947 4947
 
4948 4948
 
4949 4949
 	/**
4950
-	* Gets all aircraft types that have flown over by ident/callsign
4951
-	*
4952
-	* @return Array the aircraft list
4953
-	*
4954
-	*/
4950
+	 * Gets all aircraft types that have flown over by ident/callsign
4951
+	 *
4952
+	 * @return Array the aircraft list
4953
+	 *
4954
+	 */
4955 4955
 	public function countAllAircraftTypesByIdent($ident)
4956 4956
 	{
4957 4957
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4981,11 +4981,11 @@  discard block
 block discarded – undo
4981 4981
 
4982 4982
 
4983 4983
 	/**
4984
-	* Gets all aircraft registration that have flown over by ident/callsign
4985
-	*
4986
-	* @return Array the aircraft list
4987
-	*
4988
-	*/
4984
+	 * Gets all aircraft registration that have flown over by ident/callsign
4985
+	 *
4986
+	 * @return Array the aircraft list
4987
+	 *
4988
+	 */
4989 4989
 	public function countAllAircraftRegistrationByIdent($ident)
4990 4990
 	{
4991 4991
 		$Image = new Image($this->db);
@@ -5025,11 +5025,11 @@  discard block
 block discarded – undo
5025 5025
 
5026 5026
 
5027 5027
 	/**
5028
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
5029
-	*
5030
-	* @return Array the aircraft manufacturer list
5031
-	*
5032
-	*/
5028
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
5029
+	 *
5030
+	 * @return Array the aircraft manufacturer list
5031
+	 *
5032
+	 */
5033 5033
 	public function countAllAircraftManufacturerByIdent($ident)
5034 5034
 	{
5035 5035
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -5056,11 +5056,11 @@  discard block
 block discarded – undo
5056 5056
 
5057 5057
 
5058 5058
 	/**
5059
-	* Gets all aircraft types that have flown over by route
5060
-	*
5061
-	* @return Array the aircraft list
5062
-	*
5063
-	*/
5059
+	 * Gets all aircraft types that have flown over by route
5060
+	 *
5061
+	 * @return Array the aircraft list
5062
+	 *
5063
+	 */
5064 5064
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao)
5065 5065
 	{
5066 5066
 		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
@@ -5089,11 +5089,11 @@  discard block
 block discarded – undo
5089 5089
 	}
5090 5090
 
5091 5091
 	/**
5092
-	* Gets all aircraft registration that have flown over by route
5093
-	*
5094
-	* @return Array the aircraft list
5095
-	*
5096
-	*/
5092
+	 * Gets all aircraft registration that have flown over by route
5093
+	 *
5094
+	 * @return Array the aircraft list
5095
+	 *
5096
+	 */
5097 5097
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao)
5098 5098
 	{
5099 5099
 		$Image = new Image($this->db);
@@ -5135,11 +5135,11 @@  discard block
 block discarded – undo
5135 5135
 	
5136 5136
 	
5137 5137
 	/**
5138
-	* Gets all aircraft manufacturer that have flown over by route
5139
-	*
5140
-	* @return Array the aircraft manufacturer list
5141
-	*
5142
-	*/
5138
+	 * Gets all aircraft manufacturer that have flown over by route
5139
+	 *
5140
+	 * @return Array the aircraft manufacturer list
5141
+	 *
5142
+	 */
5143 5143
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao)
5144 5144
 	{
5145 5145
 		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
@@ -5173,11 +5173,11 @@  discard block
 block discarded – undo
5173 5173
 	
5174 5174
 	
5175 5175
 	/**
5176
-	* Gets all aircraft types that have flown over by country
5177
-	*
5178
-	* @return Array the aircraft list
5179
-	*
5180
-	*/
5176
+	 * Gets all aircraft types that have flown over by country
5177
+	 *
5178
+	 * @return Array the aircraft list
5179
+	 *
5180
+	 */
5181 5181
 	public function countAllAircraftTypesByCountry($country)
5182 5182
 	{
5183 5183
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -5209,11 +5209,11 @@  discard block
 block discarded – undo
5209 5209
 
5210 5210
 
5211 5211
 	/**
5212
-	* Gets all aircraft registration that have flown over by country
5213
-	*
5214
-	* @return Array the aircraft list
5215
-	*
5216
-	*/
5212
+	 * Gets all aircraft registration that have flown over by country
5213
+	 *
5214
+	 * @return Array the aircraft list
5215
+	 *
5216
+	 */
5217 5217
 	public function countAllAircraftRegistrationByCountry($country)
5218 5218
 	{
5219 5219
 		$Image = new Image($this->db);
@@ -5254,11 +5254,11 @@  discard block
 block discarded – undo
5254 5254
 	
5255 5255
 	
5256 5256
 	/**
5257
-	* Gets all aircraft manufacturer that have flown over by country
5258
-	*
5259
-	* @return Array the aircraft manufacturer list
5260
-	*
5261
-	*/
5257
+	 * Gets all aircraft manufacturer that have flown over by country
5258
+	 *
5259
+	 * @return Array the aircraft manufacturer list
5260
+	 *
5261
+	 */
5262 5262
 	public function countAllAircraftManufacturerByCountry($country)
5263 5263
 	{
5264 5264
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -5290,17 +5290,17 @@  discard block
 block discarded – undo
5290 5290
 	
5291 5291
 	
5292 5292
 	/**
5293
-	* Gets all aircraft manufacturers that have flown over
5294
-	*
5295
-	* @return Array the aircraft list
5296
-	*
5297
-	*/
5293
+	 * Gets all aircraft manufacturers that have flown over
5294
+	 *
5295
+	 * @return Array the aircraft list
5296
+	 *
5297
+	 */
5298 5298
 	public function countAllAircraftManufacturers($filter = array())
5299 5299
 	{
5300 5300
 		$filter_query = $this->getFilter($filter,true,true);
5301 5301
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5302 5302
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5303
-                $query .= " GROUP BY spotter_output.aircraft_manufacturer
5303
+				$query .= " GROUP BY spotter_output.aircraft_manufacturer
5304 5304
 					ORDER BY aircraft_manufacturer_count DESC
5305 5305
 					LIMIT 10";
5306 5306
       
@@ -5325,11 +5325,11 @@  discard block
 block discarded – undo
5325 5325
 	
5326 5326
 	
5327 5327
 	/**
5328
-	* Gets all aircraft registrations that have flown over
5329
-	*
5330
-	* @return Array the aircraft list
5331
-	*
5332
-	*/
5328
+	 * Gets all aircraft registrations that have flown over
5329
+	 *
5330
+	 * @return Array the aircraft list
5331
+	 *
5332
+	 */
5333 5333
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5334 5334
 	{
5335 5335
 		global $globalDBdriver;
@@ -5337,15 +5337,15 @@  discard block
 block discarded – undo
5337 5337
 		$filter_query = $this->getFilter($filters,true,true);
5338 5338
 		$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    
5339 5339
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5340
-                if ($olderthanmonths > 0) {
5341
-            		if ($globalDBdriver == 'mysql') {
5340
+				if ($olderthanmonths > 0) {
5341
+					if ($globalDBdriver == 'mysql') {
5342 5342
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5343 5343
 			} else {
5344 5344
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5345 5345
 			}
5346 5346
 		}
5347
-                if ($sincedate != '') {
5348
-            		if ($globalDBdriver == 'mysql') {
5347
+				if ($sincedate != '') {
5348
+					if ($globalDBdriver == 'mysql') {
5349 5349
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5350 5350
 			} else {
5351 5351
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5354,7 +5354,7 @@  discard block
 block discarded – undo
5354 5354
 
5355 5355
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5356 5356
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5357
-                $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5357
+				$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5358 5358
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5359 5359
 		
5360 5360
 		$sth = $this->db->prepare($query);
@@ -5385,11 +5385,11 @@  discard block
 block discarded – undo
5385 5385
 
5386 5386
 
5387 5387
 	/**
5388
-	* Gets all aircraft registrations that have flown over
5389
-	*
5390
-	* @return Array the aircraft list
5391
-	*
5392
-	*/
5388
+	 * Gets all aircraft registrations that have flown over
5389
+	 *
5390
+	 * @return Array the aircraft list
5391
+	 *
5392
+	 */
5393 5393
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
5394 5394
 	{
5395 5395
 		global $globalDBdriver;
@@ -5397,15 +5397,15 @@  discard block
 block discarded – undo
5397 5397
 		$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    
5398 5398
                     FROM spotter_output 
5399 5399
                     WHERE spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5400
-                if ($olderthanmonths > 0) {
5401
-            		if ($globalDBdriver == 'mysql') {
5400
+				if ($olderthanmonths > 0) {
5401
+					if ($globalDBdriver == 'mysql') {
5402 5402
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5403 5403
 			} else {
5404 5404
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5405 5405
 			}
5406 5406
 		}
5407
-                if ($sincedate != '') {
5408
-            		if ($globalDBdriver == 'mysql') {
5407
+				if ($sincedate != '') {
5408
+					if ($globalDBdriver == 'mysql') {
5409 5409
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5410 5410
 			} else {
5411 5411
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5414,7 +5414,7 @@  discard block
 block discarded – undo
5414 5414
 
5415 5415
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5416 5416
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5417
-                $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";
5417
+				$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";
5418 5418
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5419 5419
 		
5420 5420
 		$sth = $this->db->prepare($query);
@@ -5446,35 +5446,35 @@  discard block
 block discarded – undo
5446 5446
 	
5447 5447
 	
5448 5448
 	/**
5449
-	* Gets all departure airports of the airplanes that have flown over
5450
-	*
5451
-	* @return Array the airport list
5452
-	*
5453
-	*/
5449
+	 * Gets all departure airports of the airplanes that have flown over
5450
+	 *
5451
+	 * @return Array the airport list
5452
+	 *
5453
+	 */
5454 5454
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5455 5455
 	{
5456 5456
 		global $globalDBdriver;
5457 5457
 		$filter_query = $this->getFilter($filters,true,true);
5458 5458
 		$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 
5459 5459
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA'";
5460
-                if ($olderthanmonths > 0) {
5461
-            		if ($globalDBdriver == 'mysql') {
5460
+				if ($olderthanmonths > 0) {
5461
+					if ($globalDBdriver == 'mysql') {
5462 5462
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5463 5463
 			} else {
5464 5464
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5465 5465
 			}
5466
-                }
5467
-                if ($sincedate != '') {
5468
-            		if ($globalDBdriver == 'mysql') {
5466
+				}
5467
+				if ($sincedate != '') {
5468
+					if ($globalDBdriver == 'mysql') {
5469 5469
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5470 5470
 			} else {
5471 5471
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5472 5472
 			}
5473 5473
 		}
5474 5474
 
5475
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5476
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5477
-                $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5475
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5476
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5477
+				$query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5478 5478
 				ORDER BY airport_departure_icao_count DESC";
5479 5479
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5480 5480
       
@@ -5498,35 +5498,35 @@  discard block
 block discarded – undo
5498 5498
 	}
5499 5499
 
5500 5500
 	/**
5501
-	* Gets all departure airports of the airplanes that have flown over
5502
-	*
5503
-	* @return Array the airport list
5504
-	*
5505
-	*/
5501
+	 * Gets all departure airports of the airplanes that have flown over
5502
+	 *
5503
+	 * @return Array the airport list
5504
+	 *
5505
+	 */
5506 5506
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
5507 5507
 	{
5508 5508
 		global $globalDBdriver;
5509 5509
 		$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 
5510 5510
 								FROM spotter_output
5511 5511
                     WHERE spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' ";
5512
-                if ($olderthanmonths > 0) {
5513
-            		if ($globalDBdriver == 'mysql') {
5512
+				if ($olderthanmonths > 0) {
5513
+					if ($globalDBdriver == 'mysql') {
5514 5514
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5515 5515
 			} else {
5516 5516
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5517 5517
 			}
5518
-                }
5519
-                if ($sincedate != '') {
5520
-            		if ($globalDBdriver == 'mysql') {
5518
+				}
5519
+				if ($sincedate != '') {
5520
+					if ($globalDBdriver == 'mysql') {
5521 5521
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5522 5522
 			} else {
5523 5523
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5524 5524
 			}
5525 5525
 		}
5526 5526
 
5527
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5528
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5529
-                $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
5527
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5528
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5529
+				$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
5530 5530
 				ORDER BY airport_departure_icao_count DESC";
5531 5531
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5532 5532
       
@@ -5551,34 +5551,34 @@  discard block
 block discarded – undo
5551 5551
 	}
5552 5552
 
5553 5553
 	/**
5554
-	* Gets all detected departure airports of the airplanes that have flown over
5555
-	*
5556
-	* @return Array the airport list
5557
-	*
5558
-	*/
5554
+	 * Gets all detected departure airports of the airplanes that have flown over
5555
+	 *
5556
+	 * @return Array the airport list
5557
+	 *
5558
+	 */
5559 5559
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5560 5560
 	{
5561 5561
 		global $globalDBdriver;
5562 5562
 		$filter_query = $this->getFilter($filters,true,true);
5563 5563
 		$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
5564 5564
 				FROM spotter_output, airport".$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";
5565
-                if ($olderthanmonths > 0) {
5566
-            		if ($globalDBdriver == 'mysql') {
5565
+				if ($olderthanmonths > 0) {
5566
+					if ($globalDBdriver == 'mysql') {
5567 5567
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5568 5568
 			} else {
5569 5569
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5570 5570
 			}
5571
-                }
5572
-                if ($sincedate != '') {
5573
-            		if ($globalDBdriver == 'mysql') {
5571
+				}
5572
+				if ($sincedate != '') {
5573
+					if ($globalDBdriver == 'mysql') {
5574 5574
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5575 5575
 			} else {
5576 5576
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5577 5577
 			}
5578 5578
 		}
5579
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5580
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5581
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5579
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5580
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5581
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5582 5582
 				ORDER BY airport_departure_icao_count DESC";
5583 5583
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5584 5584
       
@@ -5602,35 +5602,35 @@  discard block
 block discarded – undo
5602 5602
 	}
5603 5603
 	
5604 5604
 	/**
5605
-	* Gets all detected departure airports of the airplanes that have flown over
5606
-	*
5607
-	* @return Array the airport list
5608
-	*
5609
-	*/
5605
+	 * Gets all detected departure airports of the airplanes that have flown over
5606
+	 *
5607
+	 * @return Array the airport list
5608
+	 *
5609
+	 */
5610 5610
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
5611 5611
 	{
5612 5612
 		global $globalDBdriver;
5613 5613
 		$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
5614 5614
 				FROM spotter_output, airport
5615 5615
                     WHERE 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 ";
5616
-                if ($olderthanmonths > 0) {
5617
-            		if ($globalDBdriver == 'mysql') {
5616
+				if ($olderthanmonths > 0) {
5617
+					if ($globalDBdriver == 'mysql') {
5618 5618
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5619 5619
 			} else {
5620 5620
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5621 5621
 			}
5622
-                }
5623
-                if ($sincedate != '') {
5624
-            		if ($globalDBdriver == 'mysql') {
5622
+				}
5623
+				if ($sincedate != '') {
5624
+					if ($globalDBdriver == 'mysql') {
5625 5625
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5626 5626
 			} else {
5627 5627
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
5628 5628
 			}
5629 5629
 		}
5630 5630
 
5631
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5632
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5633
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5631
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5632
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5633
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5634 5634
 				ORDER BY airport_departure_icao_count DESC";
5635 5635
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5636 5636
       
@@ -5655,11 +5655,11 @@  discard block
 block discarded – undo
5655 5655
 	}	
5656 5656
 	
5657 5657
 	/**
5658
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
5659
-	*
5660
-	* @return Array the airport list
5661
-	*
5662
-	*/
5658
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
5659
+	 *
5660
+	 * @return Array the airport list
5661
+	 *
5662
+	 */
5663 5663
 	public function countAllDepartureAirportsByAirline($airline_icao)
5664 5664
 	{
5665 5665
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
@@ -5694,11 +5694,11 @@  discard block
 block discarded – undo
5694 5694
 	
5695 5695
 	
5696 5696
 	/**
5697
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5698
-	*
5699
-	* @return Array the airport list
5700
-	*
5701
-	*/
5697
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5698
+	 *
5699
+	 * @return Array the airport list
5700
+	 *
5701
+	 */
5702 5702
 	public function countAllDepartureAirportCountriesByAirline($airline_icao)
5703 5703
 	{
5704 5704
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
@@ -5730,11 +5730,11 @@  discard block
 block discarded – undo
5730 5730
 	
5731 5731
 	
5732 5732
 	/**
5733
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5734
-	*
5735
-	* @return Array the airport list
5736
-	*
5737
-	*/
5733
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5734
+	 *
5735
+	 * @return Array the airport list
5736
+	 *
5737
+	 */
5738 5738
 	public function countAllDepartureAirportsByAircraft($aircraft_icao)
5739 5739
 	{
5740 5740
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -5768,11 +5768,11 @@  discard block
 block discarded – undo
5768 5768
 	
5769 5769
 	
5770 5770
 	/**
5771
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5772
-	*
5773
-	* @return Array the airport list
5774
-	*
5775
-	*/
5771
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5772
+	 *
5773
+	 * @return Array the airport list
5774
+	 *
5775
+	 */
5776 5776
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao)
5777 5777
 	{
5778 5778
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -5803,11 +5803,11 @@  discard block
 block discarded – undo
5803 5803
 	
5804 5804
 	
5805 5805
 	/**
5806
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5807
-	*
5808
-	* @return Array the airport list
5809
-	*
5810
-	*/
5806
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5807
+	 *
5808
+	 * @return Array the airport list
5809
+	 *
5810
+	 */
5811 5811
 	public function countAllDepartureAirportsByRegistration($registration)
5812 5812
 	{
5813 5813
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -5841,11 +5841,11 @@  discard block
 block discarded – undo
5841 5841
 	
5842 5842
 	
5843 5843
 	/**
5844
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
5845
-	*
5846
-	* @return Array the airport list
5847
-	*
5848
-	*/
5844
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
5845
+	 *
5846
+	 * @return Array the airport list
5847
+	 *
5848
+	 */
5849 5849
 	public function countAllDepartureAirportCountriesByRegistration($registration)
5850 5850
 	{
5851 5851
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -5876,11 +5876,11 @@  discard block
 block discarded – undo
5876 5876
 	
5877 5877
 	
5878 5878
 	/**
5879
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
5880
-	*
5881
-	* @return Array the airport list
5882
-	*
5883
-	*/
5879
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
5880
+	 *
5881
+	 * @return Array the airport list
5882
+	 *
5883
+	 */
5884 5884
 	public function countAllDepartureAirportsByAirport($airport_icao)
5885 5885
 	{
5886 5886
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -5914,11 +5914,11 @@  discard block
 block discarded – undo
5914 5914
 	
5915 5915
 	
5916 5916
 	/**
5917
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
5918
-	*
5919
-	* @return Array the airport list
5920
-	*
5921
-	*/
5917
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
5918
+	 *
5919
+	 * @return Array the airport list
5920
+	 *
5921
+	 */
5922 5922
 	public function countAllDepartureAirportCountriesByAirport($airport_icao)
5923 5923
 	{
5924 5924
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -5950,11 +5950,11 @@  discard block
 block discarded – undo
5950 5950
 	
5951 5951
 	
5952 5952
 	/**
5953
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
5954
-	*
5955
-	* @return Array the airport list
5956
-	*
5957
-	*/
5953
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
5954
+	 *
5955
+	 * @return Array the airport list
5956
+	 *
5957
+	 */
5958 5958
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer)
5959 5959
 	{
5960 5960
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -5988,11 +5988,11 @@  discard block
 block discarded – undo
5988 5988
 	
5989 5989
 	
5990 5990
 	/**
5991
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
5992
-	*
5993
-	* @return Array the airport list
5994
-	*
5995
-	*/
5991
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
5992
+	 *
5993
+	 * @return Array the airport list
5994
+	 *
5995
+	 */
5996 5996
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer)
5997 5997
 	{
5998 5998
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -6023,11 +6023,11 @@  discard block
 block discarded – undo
6023 6023
 	
6024 6024
 	
6025 6025
 	/**
6026
-	* Gets all departure airports of the airplanes that have flown over based on a date
6027
-	*
6028
-	* @return Array the airport list
6029
-	*
6030
-	*/
6026
+	 * Gets all departure airports of the airplanes that have flown over based on a date
6027
+	 *
6028
+	 * @return Array the airport list
6029
+	 *
6030
+	 */
6031 6031
 	public function countAllDepartureAirportsByDate($date)
6032 6032
 	{
6033 6033
 		global $globalTimezone, $globalDBdriver;
@@ -6075,11 +6075,11 @@  discard block
 block discarded – undo
6075 6075
 	
6076 6076
 	
6077 6077
 	/**
6078
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
6079
-	*
6080
-	* @return Array the airport list
6081
-	*
6082
-	*/
6078
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
6079
+	 *
6080
+	 * @return Array the airport list
6081
+	 *
6082
+	 */
6083 6083
 	public function countAllDepartureAirportCountriesByDate($date)
6084 6084
 	{
6085 6085
 		global $globalTimezone, $globalDBdriver;
@@ -6123,11 +6123,11 @@  discard block
 block discarded – undo
6123 6123
 	
6124 6124
 	
6125 6125
 	/**
6126
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6127
-	*
6128
-	* @return Array the airport list
6129
-	*
6130
-	*/
6126
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6127
+	 *
6128
+	 * @return Array the airport list
6129
+	 *
6130
+	 */
6131 6131
 	public function countAllDepartureAirportsByIdent($ident)
6132 6132
 	{
6133 6133
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -6162,11 +6162,11 @@  discard block
 block discarded – undo
6162 6162
 	
6163 6163
 	
6164 6164
 	/**
6165
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6166
-	*
6167
-	* @return Array the airport list
6168
-	*
6169
-	*/
6165
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6166
+	 *
6167
+	 * @return Array the airport list
6168
+	 *
6169
+	 */
6170 6170
 	public function countAllDepartureAirportCountriesByIdent($ident)
6171 6171
 	{
6172 6172
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -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 country
6202
-	*
6203
-	* @return Array the airport list
6204
-	*
6205
-	*/
6201
+	 * Gets all departure airports of the airplanes that have flown over based on a country
6202
+	 *
6203
+	 * @return Array the airport list
6204
+	 *
6205
+	 */
6206 6206
 	public function countAllDepartureAirportsByCountry($country)
6207 6207
 	{
6208 6208
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -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 an aircraft icao
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 an aircraft icao
6240
+	 *
6241
+	 * @return Array the airport list
6242
+	 *
6243
+	 */
6244 6244
 	public function countAllDepartureAirportCountriesByCountry($country)
6245 6245
 	{
6246 6246
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -6271,40 +6271,40 @@  discard block
 block discarded – undo
6271 6271
 	
6272 6272
 
6273 6273
 	/**
6274
-	* Gets all arrival airports of the airplanes that have flown over
6275
-	*
6276
-	* @return Array the airport list
6277
-	*
6278
-	*/
6274
+	 * Gets all arrival airports of the airplanes that have flown over
6275
+	 *
6276
+	 * @return Array the airport list
6277
+	 *
6278
+	 */
6279 6279
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6280 6280
 	{
6281 6281
 		global $globalDBdriver;
6282 6282
 		$filter_query = $this->getFilter($filters,true,true);
6283 6283
 		$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 
6284 6284
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
6285
-                if ($olderthanmonths > 0) {
6286
-            		if ($globalDBdriver == 'mysql') {
6285
+				if ($olderthanmonths > 0) {
6286
+					if ($globalDBdriver == 'mysql') {
6287 6287
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6288 6288
 			} else {
6289 6289
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6290 6290
 			}
6291
-                if ($sincedate != '') {
6292
-            		if ($globalDBdriver == 'mysql') {
6291
+				if ($sincedate != '') {
6292
+					if ($globalDBdriver == 'mysql') {
6293 6293
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6294 6294
 			} else {
6295 6295
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6296 6296
 			}
6297 6297
 		}
6298
-            		if ($globalDBdriver == 'mysql') {
6298
+					if ($globalDBdriver == 'mysql') {
6299 6299
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6300 6300
 			} else {
6301 6301
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6302 6302
 			}
6303 6303
 		}
6304 6304
 
6305
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6306
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6307
-                $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6305
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6306
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6307
+				$query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6308 6308
 					ORDER BY airport_arrival_icao_count DESC";
6309 6309
 		if ($limit) $query .= " LIMIT 10";
6310 6310
       
@@ -6333,40 +6333,40 @@  discard block
 block discarded – undo
6333 6333
 	}
6334 6334
 
6335 6335
 	/**
6336
-	* Gets all arrival airports of the airplanes that have flown over
6337
-	*
6338
-	* @return Array the airport list
6339
-	*
6340
-	*/
6336
+	 * Gets all arrival airports of the airplanes that have flown over
6337
+	 *
6338
+	 * @return Array the airport list
6339
+	 *
6340
+	 */
6341 6341
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false)
6342 6342
 	{
6343 6343
 		global $globalDBdriver;
6344 6344
 		$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 
6345 6345
 								FROM spotter_output 
6346 6346
                     WHERE spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' ";
6347
-                if ($olderthanmonths > 0) {
6348
-            		if ($globalDBdriver == 'mysql') {
6347
+				if ($olderthanmonths > 0) {
6348
+					if ($globalDBdriver == 'mysql') {
6349 6349
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6350 6350
 			} else {
6351 6351
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6352 6352
 			}
6353
-                if ($sincedate != '') {
6354
-            		if ($globalDBdriver == 'mysql') {
6353
+				if ($sincedate != '') {
6354
+					if ($globalDBdriver == 'mysql') {
6355 6355
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6356 6356
 			} else {
6357 6357
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6358 6358
 			}
6359 6359
 		}
6360
-            		if ($globalDBdriver == 'mysql') {
6360
+					if ($globalDBdriver == 'mysql') {
6361 6361
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6362 6362
 			} else {
6363 6363
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6364 6364
 			}
6365 6365
 		}
6366 6366
 
6367
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6368
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6369
-                $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
6367
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6368
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6369
+				$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
6370 6370
 					ORDER BY airport_arrival_icao_count DESC";
6371 6371
 		if ($limit) $query .= " LIMIT 10";
6372 6372
       
@@ -6397,39 +6397,39 @@  discard block
 block discarded – undo
6397 6397
 
6398 6398
 
6399 6399
 	/**
6400
-	* Gets all detected arrival airports of the airplanes that have flown over
6401
-	*
6402
-	* @return Array the airport list
6403
-	*
6404
-	*/
6400
+	 * Gets all detected arrival airports of the airplanes that have flown over
6401
+	 *
6402
+	 * @return Array the airport list
6403
+	 *
6404
+	 */
6405 6405
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6406 6406
 	{
6407 6407
 		global $globalDBdriver;
6408 6408
 		$filter_query = $this->getFilter($filters,true,true);
6409 6409
 		$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 
6410 6410
 			FROM spotter_output, airport".$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";
6411
-                if ($olderthanmonths > 0) {
6412
-            		if ($globalDBdriver == 'mysql') {
6411
+				if ($olderthanmonths > 0) {
6412
+					if ($globalDBdriver == 'mysql') {
6413 6413
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6414 6414
 			} else {
6415 6415
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6416 6416
 			}
6417
-                if ($sincedate != '') {
6418
-            		if ($globalDBdriver == 'mysql') {
6417
+				if ($sincedate != '') {
6418
+					if ($globalDBdriver == 'mysql') {
6419 6419
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6420 6420
 			} else {
6421 6421
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6422 6422
 			}
6423 6423
 		}
6424
-            		if ($globalDBdriver == 'mysql') {
6424
+					if ($globalDBdriver == 'mysql') {
6425 6425
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6426 6426
 			} else {
6427 6427
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6428 6428
 			}
6429 6429
 		}
6430
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6431
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6432
-                $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6430
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6431
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6432
+				$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6433 6433
 					ORDER BY airport_arrival_icao_count DESC";
6434 6434
 		if ($limit) $query .= " LIMIT 10";
6435 6435
       
@@ -6458,40 +6458,40 @@  discard block
 block discarded – undo
6458 6458
 	}
6459 6459
 	
6460 6460
 	/**
6461
-	* Gets all detected arrival airports of the airplanes that have flown over
6462
-	*
6463
-	* @return Array the airport list
6464
-	*
6465
-	*/
6461
+	 * Gets all detected arrival airports of the airplanes that have flown over
6462
+	 *
6463
+	 * @return Array the airport list
6464
+	 *
6465
+	 */
6466 6466
 	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false)
6467 6467
 	{
6468 6468
 		global $globalDBdriver;
6469 6469
 		$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 
6470 6470
 			FROM spotter_output, airport 
6471 6471
                     WHERE 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 ";
6472
-                if ($olderthanmonths > 0) {
6473
-            		if ($globalDBdriver == 'mysql') {
6472
+				if ($olderthanmonths > 0) {
6473
+					if ($globalDBdriver == 'mysql') {
6474 6474
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6475 6475
 			} else {
6476 6476
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6477 6477
 			}
6478
-                if ($sincedate != '') {
6479
-            		if ($globalDBdriver == 'mysql') {
6478
+				if ($sincedate != '') {
6479
+					if ($globalDBdriver == 'mysql') {
6480 6480
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6481 6481
 			} else {
6482 6482
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6483 6483
 			}
6484 6484
 		}
6485
-            		if ($globalDBdriver == 'mysql') {
6485
+					if ($globalDBdriver == 'mysql') {
6486 6486
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6487 6487
 			} else {
6488 6488
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6489 6489
 			}
6490 6490
 		}
6491 6491
 
6492
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6493
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6494
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6492
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6493
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6494
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6495 6495
 					ORDER BY airport_arrival_icao_count DESC";
6496 6496
 		if ($limit) $query .= " LIMIT 10";
6497 6497
       
@@ -6521,11 +6521,11 @@  discard block
 block discarded – undo
6521 6521
 	}	
6522 6522
 	
6523 6523
 	/**
6524
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
6525
-	*
6526
-	* @return Array the airport list
6527
-	*
6528
-	*/
6524
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
6525
+	 *
6526
+	 * @return Array the airport list
6527
+	 *
6528
+	 */
6529 6529
 	public function countAllArrivalAirportsByAirline($airline_icao)
6530 6530
 	{
6531 6531
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
@@ -6559,11 +6559,11 @@  discard block
 block discarded – undo
6559 6559
 	
6560 6560
 	
6561 6561
 	/**
6562
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6563
-	*
6564
-	* @return Array the airport list
6565
-	*
6566
-	*/
6562
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6563
+	 *
6564
+	 * @return Array the airport list
6565
+	 *
6566
+	 */
6567 6567
 	public function countAllArrivalAirportCountriesByAirline($airline_icao)
6568 6568
 	{
6569 6569
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
@@ -6594,11 +6594,11 @@  discard block
 block discarded – undo
6594 6594
 	
6595 6595
 	
6596 6596
 	/**
6597
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6598
-	*
6599
-	* @return Array the airport list
6600
-	*
6601
-	*/
6597
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6598
+	 *
6599
+	 * @return Array the airport list
6600
+	 *
6601
+	 */
6602 6602
 	public function countAllArrivalAirportsByAircraft($aircraft_icao)
6603 6603
 	{
6604 6604
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -6633,11 +6633,11 @@  discard block
 block discarded – undo
6633 6633
 	
6634 6634
 	
6635 6635
 	/**
6636
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6637
-	*
6638
-	* @return Array the airport list
6639
-	*
6640
-	*/
6636
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6637
+	 *
6638
+	 * @return Array the airport list
6639
+	 *
6640
+	 */
6641 6641
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao)
6642 6642
 	{
6643 6643
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -6668,11 +6668,11 @@  discard block
 block discarded – undo
6668 6668
 	
6669 6669
 	
6670 6670
 	/**
6671
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6672
-	*
6673
-	* @return Array the airport list
6674
-	*
6675
-	*/
6671
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6672
+	 *
6673
+	 * @return Array the airport list
6674
+	 *
6675
+	 */
6676 6676
 	public function countAllArrivalAirportsByRegistration($registration)
6677 6677
 	{
6678 6678
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -6706,11 +6706,11 @@  discard block
 block discarded – undo
6706 6706
 	
6707 6707
 	
6708 6708
 	/**
6709
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6710
-	*
6711
-	* @return Array the airport list
6712
-	*
6713
-	*/
6709
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6710
+	 *
6711
+	 * @return Array the airport list
6712
+	 *
6713
+	 */
6714 6714
 	public function countAllArrivalAirportCountriesByRegistration($registration)
6715 6715
 	{
6716 6716
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -6742,11 +6742,11 @@  discard block
 block discarded – undo
6742 6742
 	
6743 6743
 	
6744 6744
 	/**
6745
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
6746
-	*
6747
-	* @return Array the airport list
6748
-	*
6749
-	*/
6745
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
6746
+	 *
6747
+	 * @return Array the airport list
6748
+	 *
6749
+	 */
6750 6750
 	public function countAllArrivalAirportsByAirport($airport_icao)
6751 6751
 	{
6752 6752
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -6780,11 +6780,11 @@  discard block
 block discarded – undo
6780 6780
 	
6781 6781
 	
6782 6782
 	/**
6783
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6784
-	*
6785
-	* @return Array the airport list
6786
-	*
6787
-	*/
6783
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6784
+	 *
6785
+	 * @return Array the airport list
6786
+	 *
6787
+	 */
6788 6788
 	public function countAllArrivalAirportCountriesByAirport($airport_icao)
6789 6789
 	{
6790 6790
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -6815,11 +6815,11 @@  discard block
 block discarded – undo
6815 6815
 	
6816 6816
 	
6817 6817
 	/**
6818
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6819
-	*
6820
-	* @return Array the airport list
6821
-	*
6822
-	*/
6818
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6819
+	 *
6820
+	 * @return Array the airport list
6821
+	 *
6822
+	 */
6823 6823
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer)
6824 6824
 	{
6825 6825
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -6854,11 +6854,11 @@  discard block
 block discarded – undo
6854 6854
 	
6855 6855
 	
6856 6856
 	/**
6857
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
6858
-	*
6859
-	* @return Array the airport list
6860
-	*
6861
-	*/
6857
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
6858
+	 *
6859
+	 * @return Array the airport list
6860
+	 *
6861
+	 */
6862 6862
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer)
6863 6863
 	{
6864 6864
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -6890,11 +6890,11 @@  discard block
 block discarded – undo
6890 6890
 	
6891 6891
 	
6892 6892
 	/**
6893
-	* Gets all arrival airports of the airplanes that have flown over based on a date
6894
-	*
6895
-	* @return Array the airport list
6896
-	*
6897
-	*/
6893
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
6894
+	 *
6895
+	 * @return Array the airport list
6896
+	 *
6897
+	 */
6898 6898
 	public function countAllArrivalAirportsByDate($date)
6899 6899
 	{
6900 6900
 		global $globalTimezone, $globalDBdriver;
@@ -6941,11 +6941,11 @@  discard block
 block discarded – undo
6941 6941
 	
6942 6942
 	
6943 6943
 	/**
6944
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
6945
-	*
6946
-	* @return Array the airport list
6947
-	*
6948
-	*/
6944
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
6945
+	 *
6946
+	 * @return Array the airport list
6947
+	 *
6948
+	 */
6949 6949
 	public function countAllArrivalAirportCountriesByDate($date)
6950 6950
 	{
6951 6951
 		global $globalTimezone, $globalDBdriver;
@@ -6989,11 +6989,11 @@  discard block
 block discarded – undo
6989 6989
 	
6990 6990
 	
6991 6991
 	/**
6992
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
6993
-	*
6994
-	* @return Array the airport list
6995
-	*
6996
-	*/
6992
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
6993
+	 *
6994
+	 * @return Array the airport list
6995
+	 *
6996
+	 */
6997 6997
 	public function countAllArrivalAirportsByIdent($ident)
6998 6998
 	{
6999 6999
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -7027,11 +7027,11 @@  discard block
 block discarded – undo
7027 7027
 	
7028 7028
 	
7029 7029
 	/**
7030
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7031
-	*
7032
-	* @return Array the airport list
7033
-	*
7034
-	*/
7030
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7031
+	 *
7032
+	 * @return Array the airport list
7033
+	 *
7034
+	 */
7035 7035
 	public function countAllArrivalAirportCountriesByIdent($ident)
7036 7036
 	{
7037 7037
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -7063,11 +7063,11 @@  discard block
 block discarded – undo
7063 7063
 	
7064 7064
 	
7065 7065
 	/**
7066
-	* Gets all arrival airports of the airplanes that have flown over based on a country
7067
-	*
7068
-	* @return Array the airport list
7069
-	*
7070
-	*/
7066
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
7067
+	 *
7068
+	 * @return Array the airport list
7069
+	 *
7070
+	 */
7071 7071
 	public function countAllArrivalAirportsByCountry($country)
7072 7072
 	{
7073 7073
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -7101,11 +7101,11 @@  discard block
 block discarded – undo
7101 7101
 	
7102 7102
 	
7103 7103
 	/**
7104
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
7105
-	*
7106
-	* @return Array the airport list
7107
-	*
7108
-	*/
7104
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
7105
+	 *
7106
+	 * @return Array the airport list
7107
+	 *
7108
+	 */
7109 7109
 	public function countAllArrivalAirportCountriesByCountry($country)
7110 7110
 	{
7111 7111
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -7137,11 +7137,11 @@  discard block
 block discarded – undo
7137 7137
 
7138 7138
 
7139 7139
 	/**
7140
-	* Counts all airport departure countries
7141
-	*
7142
-	* @return Array the airport departure list
7143
-	*
7144
-	*/
7140
+	 * Counts all airport departure countries
7141
+	 *
7142
+	 * @return Array the airport departure list
7143
+	 *
7144
+	 */
7145 7145
 	public function countAllDepartureCountries($filters = array())
7146 7146
 	{
7147 7147
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7171,11 +7171,11 @@  discard block
 block discarded – undo
7171 7171
 	
7172 7172
 	
7173 7173
 	/**
7174
-	* Counts all airport arrival countries
7175
-	*
7176
-	* @return Array the airport arrival list
7177
-	*
7178
-	*/
7174
+	 * Counts all airport arrival countries
7175
+	 *
7176
+	 * @return Array the airport arrival list
7177
+	 *
7178
+	 */
7179 7179
 	public function countAllArrivalCountries($limit = true,$filters = array())
7180 7180
 	{
7181 7181
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7208,11 +7208,11 @@  discard block
 block discarded – undo
7208 7208
 
7209 7209
 
7210 7210
 	/**
7211
-	* Gets all route combinations
7212
-	*
7213
-	* @return Array the route list
7214
-	*
7215
-	*/
7211
+	 * Gets all route combinations
7212
+	 *
7213
+	 * @return Array the route list
7214
+	 *
7215
+	 */
7216 7216
 	public function countAllRoutes()
7217 7217
 	{
7218 7218
 		
@@ -7252,11 +7252,11 @@  discard block
 block discarded – undo
7252 7252
 	
7253 7253
 	
7254 7254
 	/**
7255
-	* Gets all route combinations based on an aircraft
7256
-	*
7257
-	* @return Array the route list
7258
-	*
7259
-	*/
7255
+	 * Gets all route combinations based on an aircraft
7256
+	 *
7257
+	 * @return Array the route list
7258
+	 *
7259
+	 */
7260 7260
 	public function countAllRoutesByAircraft($aircraft_icao)
7261 7261
 	{
7262 7262
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -7294,11 +7294,11 @@  discard block
 block discarded – undo
7294 7294
 	
7295 7295
 	
7296 7296
 	/**
7297
-	* Gets all route combinations based on an aircraft registration
7298
-	*
7299
-	* @return Array the route list
7300
-	*
7301
-	*/
7297
+	 * Gets all route combinations based on an aircraft registration
7298
+	 *
7299
+	 * @return Array the route list
7300
+	 *
7301
+	 */
7302 7302
 	public function countAllRoutesByRegistration($registration)
7303 7303
 	{
7304 7304
 		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
@@ -7337,11 +7337,11 @@  discard block
 block discarded – undo
7337 7337
 	
7338 7338
 	
7339 7339
 	/**
7340
-	* Gets all route combinations based on an airline
7341
-	*
7342
-	* @return Array the route list
7343
-	*
7344
-	*/
7340
+	 * Gets all route combinations based on an airline
7341
+	 *
7342
+	 * @return Array the route list
7343
+	 *
7344
+	 */
7345 7345
 	public function countAllRoutesByAirline($airline_icao)
7346 7346
 	{
7347 7347
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
@@ -7380,11 +7380,11 @@  discard block
 block discarded – undo
7380 7380
 	
7381 7381
 	
7382 7382
 	/**
7383
-	* Gets all route combinations based on an airport
7384
-	*
7385
-	* @return Array the route list
7386
-	*
7387
-	*/
7383
+	 * Gets all route combinations based on an airport
7384
+	 *
7385
+	 * @return Array the route list
7386
+	 *
7387
+	 */
7388 7388
 	public function countAllRoutesByAirport($airport_icao)
7389 7389
 	{
7390 7390
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -7423,11 +7423,11 @@  discard block
 block discarded – undo
7423 7423
 	
7424 7424
 	
7425 7425
 	/**
7426
-	* Gets all route combinations based on an country
7427
-	*
7428
-	* @return Array the route list
7429
-	*
7430
-	*/
7426
+	 * Gets all route combinations based on an country
7427
+	 *
7428
+	 * @return Array the route list
7429
+	 *
7430
+	 */
7431 7431
 	public function countAllRoutesByCountry($country)
7432 7432
 	{
7433 7433
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -7465,11 +7465,11 @@  discard block
 block discarded – undo
7465 7465
 
7466 7466
 
7467 7467
 	/**
7468
-	* Gets all route combinations based on an date
7469
-	*
7470
-	* @return Array the route list
7471
-	*
7472
-	*/
7468
+	 * Gets all route combinations based on an date
7469
+	 *
7470
+	 * @return Array the route list
7471
+	 *
7472
+	 */
7473 7473
 	public function countAllRoutesByDate($date)
7474 7474
 	{
7475 7475
 		global $globalTimezone, $globalDBdriver;
@@ -7520,11 +7520,11 @@  discard block
 block discarded – undo
7520 7520
 	
7521 7521
 	
7522 7522
 	/**
7523
-	* Gets all route combinations based on an ident/callsign
7524
-	*
7525
-	* @return Array the route list
7526
-	*
7527
-	*/
7523
+	 * Gets all route combinations based on an ident/callsign
7524
+	 *
7525
+	 * @return Array the route list
7526
+	 *
7527
+	 */
7528 7528
 	public function countAllRoutesByIdent($ident)
7529 7529
 	{
7530 7530
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -7562,11 +7562,11 @@  discard block
 block discarded – undo
7562 7562
 	
7563 7563
 	
7564 7564
 	/**
7565
-	* Gets all route combinations based on an manufacturer
7566
-	*
7567
-	* @return Array the route list
7568
-	*
7569
-	*/
7565
+	 * Gets all route combinations based on an manufacturer
7566
+	 *
7567
+	 * @return Array the route list
7568
+	 *
7569
+	 */
7570 7570
 	public function countAllRoutesByManufacturer($aircraft_manufacturer)
7571 7571
 	{
7572 7572
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -7605,11 +7605,11 @@  discard block
 block discarded – undo
7605 7605
 	
7606 7606
 	
7607 7607
 	/**
7608
-	* Gets all route combinations with waypoints
7609
-	*
7610
-	* @return Array the route list
7611
-	*
7612
-	*/
7608
+	 * Gets all route combinations with waypoints
7609
+	 *
7610
+	 * @return Array the route list
7611
+	 *
7612
+	 */
7613 7613
 	public function countAllRoutesWithWaypoints()
7614 7614
 	{
7615 7615
 		$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
@@ -7649,11 +7649,11 @@  discard block
 block discarded – undo
7649 7649
 	
7650 7650
 	
7651 7651
 	/**
7652
-	* Gets all callsigns that have flown over
7653
-	*
7654
-	* @return Array the callsign list
7655
-	*
7656
-	*/
7652
+	 * Gets all callsigns that have flown over
7653
+	 *
7654
+	 * @return Array the callsign list
7655
+	 *
7656
+	 */
7657 7657
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
7658 7658
 	{
7659 7659
 		global $globalDBdriver;
@@ -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 countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
7700 7700
 	{
7701 7701
 		global $globalDBdriver;
@@ -7736,11 +7736,11 @@  discard block
 block discarded – undo
7736 7736
 
7737 7737
 
7738 7738
 	/**
7739
-	* Counts all dates
7740
-	*
7741
-	* @return Array the date list
7742
-	*
7743
-	*/
7739
+	 * Counts all dates
7740
+	 *
7741
+	 * @return Array the date list
7742
+	 *
7743
+	 */
7744 7744
 	public function countAllDates($filters = array())
7745 7745
 	{
7746 7746
 		global $globalTimezone, $globalDBdriver;
@@ -7785,11 +7785,11 @@  discard block
 block discarded – undo
7785 7785
 	}
7786 7786
 	
7787 7787
 	/**
7788
-	* Counts all dates
7789
-	*
7790
-	* @return Array the date list
7791
-	*
7792
-	*/
7788
+	 * Counts all dates
7789
+	 *
7790
+	 * @return Array the date list
7791
+	 *
7792
+	 */
7793 7793
 	public function countAllDatesByAirlines()
7794 7794
 	{
7795 7795
 		global $globalTimezone, $globalDBdriver;
@@ -7835,11 +7835,11 @@  discard block
 block discarded – undo
7835 7835
 	}	
7836 7836
 	
7837 7837
 	/**
7838
-	* Counts all dates during the last 7 days
7839
-	*
7840
-	* @return Array the date list
7841
-	*
7842
-	*/
7838
+	 * Counts all dates during the last 7 days
7839
+	 *
7840
+	 * @return Array the date list
7841
+	 *
7842
+	 */
7843 7843
 	public function countAllDatesLast7Days($filters = array())
7844 7844
 	{
7845 7845
 		global $globalTimezone, $globalDBdriver;
@@ -7861,7 +7861,7 @@  discard block
 block discarded – undo
7861 7861
 			$query .= " GROUP BY date_name 
7862 7862
 								ORDER BY date_name ASC";
7863 7863
 			$query_data = array(':offset' => $offset);
7864
-    		}
7864
+			}
7865 7865
 		
7866 7866
 		$sth = $this->db->prepare($query);
7867 7867
 		$sth->execute($query_data);
@@ -7881,11 +7881,11 @@  discard block
 block discarded – undo
7881 7881
 	}
7882 7882
 
7883 7883
 	/**
7884
-	* Counts all dates during the last month
7885
-	*
7886
-	* @return Array the date list
7887
-	*
7888
-	*/
7884
+	 * Counts all dates during the last month
7885
+	 *
7886
+	 * @return Array the date list
7887
+	 *
7888
+	 */
7889 7889
 	public function countAllDatesLastMonth($filters = array())
7890 7890
 	{
7891 7891
 		global $globalTimezone, $globalDBdriver;
@@ -7907,7 +7907,7 @@  discard block
 block discarded – undo
7907 7907
 			$query .= " GROUP BY date_name 
7908 7908
 								ORDER BY date_name ASC";
7909 7909
 			$query_data = array(':offset' => $offset);
7910
-    		}
7910
+			}
7911 7911
 		
7912 7912
 		$sth = $this->db->prepare($query);
7913 7913
 		$sth->execute($query_data);
@@ -7928,11 +7928,11 @@  discard block
 block discarded – undo
7928 7928
 
7929 7929
 
7930 7930
 	/**
7931
-	* Counts all dates during the last month
7932
-	*
7933
-	* @return Array the date list
7934
-	*
7935
-	*/
7931
+	 * Counts all dates during the last month
7932
+	 *
7933
+	 * @return Array the date list
7934
+	 *
7935
+	 */
7936 7936
 	public function countAllDatesLastMonthByAirlines()
7937 7937
 	{
7938 7938
 		global $globalTimezone, $globalDBdriver;
@@ -7956,7 +7956,7 @@  discard block
 block discarded – undo
7956 7956
 								GROUP BY spotter_output.airline_icao, date_name 
7957 7957
 								ORDER BY date_name ASC";
7958 7958
 			$query_data = array(':offset' => $offset);
7959
-    		}
7959
+			}
7960 7960
 		
7961 7961
 		$sth = $this->db->prepare($query);
7962 7962
 		$sth->execute($query_data);
@@ -7978,11 +7978,11 @@  discard block
 block discarded – undo
7978 7978
 	
7979 7979
 
7980 7980
 	/**
7981
-	* Counts all month
7982
-	*
7983
-	* @return Array the month list
7984
-	*
7985
-	*/
7981
+	 * Counts all month
7982
+	 *
7983
+	 * @return Array the month list
7984
+	 *
7985
+	 */
7986 7986
 	public function countAllMonths($filters = array())
7987 7987
 	{
7988 7988
 		global $globalTimezone, $globalDBdriver;
@@ -8026,11 +8026,11 @@  discard block
 block discarded – undo
8026 8026
 	}
8027 8027
 
8028 8028
 	/**
8029
-	* Counts all month
8030
-	*
8031
-	* @return Array the month list
8032
-	*
8033
-	*/
8029
+	 * Counts all month
8030
+	 *
8031
+	 * @return Array the month list
8032
+	 *
8033
+	 */
8034 8034
 	public function countAllMonthsByAirlines()
8035 8035
 	{
8036 8036
 		global $globalTimezone, $globalDBdriver;
@@ -8075,11 +8075,11 @@  discard block
 block discarded – undo
8075 8075
 	}
8076 8076
 
8077 8077
 	/**
8078
-	* Counts all military month
8079
-	*
8080
-	* @return Array the month list
8081
-	*
8082
-	*/
8078
+	 * Counts all military month
8079
+	 *
8080
+	 * @return Array the month list
8081
+	 *
8082
+	 */
8083 8083
 	public function countAllMilitaryMonths()
8084 8084
 	{
8085 8085
 		global $globalTimezone, $globalDBdriver;
@@ -8122,11 +8122,11 @@  discard block
 block discarded – undo
8122 8122
 	}
8123 8123
 	
8124 8124
 	/**
8125
-	* Counts all month owners
8126
-	*
8127
-	* @return Array the month list
8128
-	*
8129
-	*/
8125
+	 * Counts all month owners
8126
+	 *
8127
+	 * @return Array the month list
8128
+	 *
8129
+	 */
8130 8130
 	public function countAllMonthsOwners()
8131 8131
 	{
8132 8132
 		global $globalTimezone, $globalDBdriver;
@@ -8169,11 +8169,11 @@  discard block
 block discarded – undo
8169 8169
 	}
8170 8170
 	
8171 8171
 	/**
8172
-	* Counts all month owners
8173
-	*
8174
-	* @return Array the month list
8175
-	*
8176
-	*/
8172
+	 * Counts all month owners
8173
+	 *
8174
+	 * @return Array the month list
8175
+	 *
8176
+	 */
8177 8177
 	public function countAllMonthsOwnersByAirlines()
8178 8178
 	{
8179 8179
 		global $globalTimezone, $globalDBdriver;
@@ -8217,11 +8217,11 @@  discard block
 block discarded – undo
8217 8217
 	}
8218 8218
 
8219 8219
 	/**
8220
-	* Counts all month pilot
8221
-	*
8222
-	* @return Array the month list
8223
-	*
8224
-	*/
8220
+	 * Counts all month pilot
8221
+	 *
8222
+	 * @return Array the month list
8223
+	 *
8224
+	 */
8225 8225
 	public function countAllMonthsPilots()
8226 8226
 	{
8227 8227
 		global $globalTimezone, $globalDBdriver;
@@ -8264,11 +8264,11 @@  discard block
 block discarded – undo
8264 8264
 	}
8265 8265
 	
8266 8266
 	/**
8267
-	* Counts all month pilot
8268
-	*
8269
-	* @return Array the month list
8270
-	*
8271
-	*/
8267
+	 * Counts all month pilot
8268
+	 *
8269
+	 * @return Array the month list
8270
+	 *
8271
+	 */
8272 8272
 	public function countAllMonthsPilotsByAirlines()
8273 8273
 	{
8274 8274
 		global $globalTimezone, $globalDBdriver;
@@ -8312,11 +8312,11 @@  discard block
 block discarded – undo
8312 8312
 	}
8313 8313
 
8314 8314
 	/**
8315
-	* Counts all month airline
8316
-	*
8317
-	* @return Array the month list
8318
-	*
8319
-	*/
8315
+	 * Counts all month airline
8316
+	 *
8317
+	 * @return Array the month list
8318
+	 *
8319
+	 */
8320 8320
 	public function countAllMonthsAirlines()
8321 8321
 	{
8322 8322
 		global $globalTimezone, $globalDBdriver;
@@ -8359,11 +8359,11 @@  discard block
 block discarded – undo
8359 8359
 	}
8360 8360
 	
8361 8361
 	/**
8362
-	* Counts all month aircraft
8363
-	*
8364
-	* @return Array the month list
8365
-	*
8366
-	*/
8362
+	 * Counts all month aircraft
8363
+	 *
8364
+	 * @return Array the month list
8365
+	 *
8366
+	 */
8367 8367
 	public function countAllMonthsAircrafts()
8368 8368
 	{
8369 8369
 		global $globalTimezone, $globalDBdriver;
@@ -8407,11 +8407,11 @@  discard block
 block discarded – undo
8407 8407
 	
8408 8408
 
8409 8409
 	/**
8410
-	* Counts all month aircraft
8411
-	*
8412
-	* @return Array the month list
8413
-	*
8414
-	*/
8410
+	 * Counts all month aircraft
8411
+	 *
8412
+	 * @return Array the month list
8413
+	 *
8414
+	 */
8415 8415
 	public function countAllMonthsAircraftsByAirlines()
8416 8416
 	{
8417 8417
 		global $globalTimezone, $globalDBdriver;
@@ -8455,11 +8455,11 @@  discard block
 block discarded – undo
8455 8455
 	}
8456 8456
 
8457 8457
 	/**
8458
-	* Counts all month real arrival
8459
-	*
8460
-	* @return Array the month list
8461
-	*
8462
-	*/
8458
+	 * Counts all month real arrival
8459
+	 *
8460
+	 * @return Array the month list
8461
+	 *
8462
+	 */
8463 8463
 	public function countAllMonthsRealArrivals()
8464 8464
 	{
8465 8465
 		global $globalTimezone, $globalDBdriver;
@@ -8503,11 +8503,11 @@  discard block
 block discarded – undo
8503 8503
 	
8504 8504
 
8505 8505
 	/**
8506
-	* Counts all month real arrival
8507
-	*
8508
-	* @return Array the month list
8509
-	*
8510
-	*/
8506
+	 * Counts all month real arrival
8507
+	 *
8508
+	 * @return Array the month list
8509
+	 *
8510
+	 */
8511 8511
 	public function countAllMonthsRealArrivalsByAirlines()
8512 8512
 	{
8513 8513
 		global $globalTimezone, $globalDBdriver;
@@ -8552,11 +8552,11 @@  discard block
 block discarded – undo
8552 8552
 	
8553 8553
 
8554 8554
 	/**
8555
-	* Counts all dates during the last year
8556
-	*
8557
-	* @return Array the date list
8558
-	*
8559
-	*/
8555
+	 * Counts all dates during the last year
8556
+	 *
8557
+	 * @return Array the date list
8558
+	 *
8559
+	 */
8560 8560
 	public function countAllMonthsLastYear($filters)
8561 8561
 	{
8562 8562
 		global $globalTimezone, $globalDBdriver;
@@ -8578,7 +8578,7 @@  discard block
 block discarded – undo
8578 8578
 			$query .= " GROUP BY year_name, month_name
8579 8579
 								ORDER BY year_name, month_name ASC";
8580 8580
 			$query_data = array(':offset' => $offset);
8581
-    		}
8581
+			}
8582 8582
 		
8583 8583
 		$sth = $this->db->prepare($query);
8584 8584
 		$sth->execute($query_data);
@@ -8601,11 +8601,11 @@  discard block
 block discarded – undo
8601 8601
 	
8602 8602
 	
8603 8603
 	/**
8604
-	* Counts all hours
8605
-	*
8606
-	* @return Array the hour list
8607
-	*
8608
-	*/
8604
+	 * Counts all hours
8605
+	 *
8606
+	 * @return Array the hour list
8607
+	 *
8608
+	 */
8609 8609
 	public function countAllHours($orderby,$filters = array())
8610 8610
 	{
8611 8611
 		global $globalTimezone, $globalDBdriver;
@@ -8666,11 +8666,11 @@  discard block
 block discarded – undo
8666 8666
 	}
8667 8667
 	
8668 8668
 	/**
8669
-	* Counts all hours
8670
-	*
8671
-	* @return Array the hour list
8672
-	*
8673
-	*/
8669
+	 * Counts all hours
8670
+	 *
8671
+	 * @return Array the hour list
8672
+	 *
8673
+	 */
8674 8674
 	public function countAllHoursByAirlines($orderby)
8675 8675
 	{
8676 8676
 		global $globalTimezone, $globalDBdriver;
@@ -8734,11 +8734,11 @@  discard block
 block discarded – undo
8734 8734
 
8735 8735
 
8736 8736
 	/**
8737
-	* Counts all hours by airline
8738
-	*
8739
-	* @return Array the hour list
8740
-	*
8741
-	*/
8737
+	 * Counts all hours by airline
8738
+	 *
8739
+	 * @return Array the hour list
8740
+	 *
8741
+	 */
8742 8742
 	public function countAllHoursByAirline($airline_icao)
8743 8743
 	{
8744 8744
 		global $globalTimezone, $globalDBdriver;
@@ -8785,11 +8785,11 @@  discard block
 block discarded – undo
8785 8785
 	
8786 8786
 	
8787 8787
 	/**
8788
-	* Counts all hours by aircraft
8789
-	*
8790
-	* @return Array the hour list
8791
-	*
8792
-	*/
8788
+	 * Counts all hours by aircraft
8789
+	 *
8790
+	 * @return Array the hour list
8791
+	 *
8792
+	 */
8793 8793
 	public function countAllHoursByAircraft($aircraft_icao)
8794 8794
 	{
8795 8795
 		global $globalTimezone, $globalDBdriver;
@@ -8833,11 +8833,11 @@  discard block
 block discarded – undo
8833 8833
 	
8834 8834
 	
8835 8835
 	/**
8836
-	* Counts all hours by aircraft registration
8837
-	*
8838
-	* @return Array the hour list
8839
-	*
8840
-	*/
8836
+	 * Counts all hours by aircraft registration
8837
+	 *
8838
+	 * @return Array the hour list
8839
+	 *
8840
+	 */
8841 8841
 	public function countAllHoursByRegistration($registration)
8842 8842
 	{
8843 8843
 		global $globalTimezone, $globalDBdriver;
@@ -8881,11 +8881,11 @@  discard block
 block discarded – undo
8881 8881
 	
8882 8882
 	
8883 8883
 	/**
8884
-	* Counts all hours by airport
8885
-	*
8886
-	* @return Array the hour list
8887
-	*
8888
-	*/
8884
+	 * Counts all hours by airport
8885
+	 *
8886
+	 * @return Array the hour list
8887
+	 *
8888
+	 */
8889 8889
 	public function countAllHoursByAirport($airport_icao)
8890 8890
 	{
8891 8891
 		global $globalTimezone, $globalDBdriver;
@@ -8930,11 +8930,11 @@  discard block
 block discarded – undo
8930 8930
 	
8931 8931
 	
8932 8932
 	/**
8933
-	* Counts all hours by manufacturer
8934
-	*
8935
-	* @return Array the hour list
8936
-	*
8937
-	*/
8933
+	 * Counts all hours by manufacturer
8934
+	 *
8935
+	 * @return Array the hour list
8936
+	 *
8937
+	 */
8938 8938
 	public function countAllHoursByManufacturer($aircraft_manufacturer)
8939 8939
 	{
8940 8940
 		global $globalTimezone, $globalDBdriver;
@@ -8979,11 +8979,11 @@  discard block
 block discarded – undo
8979 8979
 	
8980 8980
 	
8981 8981
 	/**
8982
-	* Counts all hours by date
8983
-	*
8984
-	* @return Array the hour list
8985
-	*
8986
-	*/
8982
+	 * Counts all hours by date
8983
+	 *
8984
+	 * @return Array the hour list
8985
+	 *
8986
+	 */
8987 8987
 	public function countAllHoursByDate($date)
8988 8988
 	{
8989 8989
 		global $globalTimezone, $globalDBdriver;
@@ -9028,11 +9028,11 @@  discard block
 block discarded – undo
9028 9028
 	
9029 9029
 	
9030 9030
 	/**
9031
-	* Counts all hours by a ident/callsign
9032
-	*
9033
-	* @return Array the hour list
9034
-	*
9035
-	*/
9031
+	 * Counts all hours by a ident/callsign
9032
+	 *
9033
+	 * @return Array the hour list
9034
+	 *
9035
+	 */
9036 9036
 	public function countAllHoursByIdent($ident)
9037 9037
 	{
9038 9038
 		global $globalTimezone, $globalDBdriver;
@@ -9078,11 +9078,11 @@  discard block
 block discarded – undo
9078 9078
 	
9079 9079
 	
9080 9080
 	/**
9081
-	* Counts all hours by route
9082
-	*
9083
-	* @return Array the hour list
9084
-	*
9085
-	*/
9081
+	 * Counts all hours by route
9082
+	 *
9083
+	 * @return Array the hour list
9084
+	 *
9085
+	 */
9086 9086
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao)
9087 9087
 	{
9088 9088
 		global $globalTimezone, $globalDBdriver;
@@ -9127,11 +9127,11 @@  discard block
 block discarded – undo
9127 9127
 	
9128 9128
 	
9129 9129
 	/**
9130
-	* Counts all hours by country
9131
-	*
9132
-	* @return Array the hour list
9133
-	*
9134
-	*/
9130
+	 * Counts all hours by country
9131
+	 *
9132
+	 * @return Array the hour list
9133
+	 *
9134
+	 */
9135 9135
 	public function countAllHoursByCountry($country)
9136 9136
 	{
9137 9137
 		global $globalTimezone, $globalDBdriver;
@@ -9177,11 +9177,11 @@  discard block
 block discarded – undo
9177 9177
 
9178 9178
 
9179 9179
 	/**
9180
-	* Counts all aircraft that have flown over
9181
-	*
9182
-	* @return Integer the number of aircrafts
9183
-	*
9184
-	*/
9180
+	 * Counts all aircraft that have flown over
9181
+	 *
9182
+	 * @return Integer the number of aircrafts
9183
+	 *
9184
+	 */
9185 9185
 	public function countOverallAircrafts($filters = array())
9186 9186
 	{
9187 9187
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9193,11 +9193,11 @@  discard block
 block discarded – undo
9193 9193
 	}
9194 9194
 
9195 9195
 	/**
9196
-	* Counts all flight that really arrival
9197
-	*
9198
-	* @return Integer the number of aircrafts
9199
-	*
9200
-	*/
9196
+	 * Counts all flight that really arrival
9197
+	 *
9198
+	 * @return Integer the number of aircrafts
9199
+	 *
9200
+	 */
9201 9201
 	public function countOverallArrival($filters = array())
9202 9202
 	{
9203 9203
 		$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 pilots that have flown over
9214
-	*
9215
-	* @return Integer the number of pilots
9216
-	*
9217
-	*/
9213
+	 * Counts all pilots that have flown over
9214
+	 *
9215
+	 * @return Integer the number of pilots
9216
+	 *
9217
+	 */
9218 9218
 	public function countOverallPilots($filters = array())
9219 9219
 	{
9220 9220
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9226,11 +9226,11 @@  discard block
 block discarded – undo
9226 9226
 	}
9227 9227
 
9228 9228
 	/**
9229
-	* Counts all owners that have flown over
9230
-	*
9231
-	* @return Integer the number of owners
9232
-	*
9233
-	*/
9229
+	 * Counts all owners that have flown over
9230
+	 *
9231
+	 * @return Integer the number of owners
9232
+	 *
9233
+	 */
9234 9234
 	public function countOverallOwners($filters = array())
9235 9235
 	{
9236 9236
 		$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 flights that have flown over
9247
-	*
9248
-	* @return Integer the number of flights
9249
-	*
9250
-	*/
9246
+	 * Counts all flights that have flown over
9247
+	 *
9248
+	 * @return Integer the number of flights
9249
+	 *
9250
+	 */
9251 9251
 	public function countOverallFlights($filters = array())
9252 9252
 	{
9253 9253
 		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
@@ -9260,11 +9260,11 @@  discard block
 block discarded – undo
9260 9260
 	}
9261 9261
 	
9262 9262
 	/**
9263
-	* Counts all military flights that have flown over
9264
-	*
9265
-	* @return Integer the number of flights
9266
-	*
9267
-	*/
9263
+	 * Counts all military flights that have flown over
9264
+	 *
9265
+	 * @return Integer the number of flights
9266
+	 *
9267
+	 */
9268 9268
 	public function countOverallMilitaryFlights($filters = array())
9269 9269
 	{
9270 9270
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9279,11 +9279,11 @@  discard block
 block discarded – undo
9279 9279
 	
9280 9280
 	
9281 9281
 	/**
9282
-	* Counts all airlines that have flown over
9283
-	*
9284
-	* @return Integer the number of airlines
9285
-	*
9286
-	*/
9282
+	 * Counts all airlines that have flown over
9283
+	 *
9284
+	 * @return Integer the number of airlines
9285
+	 *
9286
+	 */
9287 9287
 	public function countOverallAirlines($filters = array())
9288 9288
 	{
9289 9289
 		$query  = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
@@ -9297,11 +9297,11 @@  discard block
 block discarded – undo
9297 9297
 
9298 9298
   
9299 9299
 	/**
9300
-	* Counts all hours of today
9301
-	*
9302
-	* @return Array the hour list
9303
-	*
9304
-	*/
9300
+	 * Counts all hours of today
9301
+	 *
9302
+	 * @return Array the hour list
9303
+	 *
9304
+	 */
9305 9305
 	public function countAllHoursFromToday()
9306 9306
 	{
9307 9307
 		global $globalTimezone, $globalDBdriver;
@@ -9342,11 +9342,11 @@  discard block
 block discarded – undo
9342 9342
 	}
9343 9343
     
9344 9344
 	/**
9345
-	* Gets all the spotter information based on calculated upcoming flights
9346
-	*
9347
-	* @return Array the spotter information
9348
-	*
9349
-	*/
9345
+	 * Gets all the spotter information based on calculated upcoming flights
9346
+	 *
9347
+	 * @return Array the spotter information
9348
+	 *
9349
+	 */
9350 9350
 	public function getUpcomingFlights($limit = '', $sort = '')
9351 9351
 	{
9352 9352
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -9422,12 +9422,12 @@  discard block
 block discarded – undo
9422 9422
 	}
9423 9423
     
9424 9424
     
9425
-     /**
9426
-	* Gets the Barrie Spotter ID based on the FlightAware ID
9427
-	*
9428
-	* @return Integer the Barrie Spotter ID
9425
+	 /**
9426
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
9427
+	  *
9428
+	  * @return Integer the Barrie Spotter ID
9429 9429
 q	*
9430
-	*/
9430
+	  */
9431 9431
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
9432 9432
 	{
9433 9433
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -9448,13 +9448,13 @@  discard block
 block discarded – undo
9448 9448
   
9449 9449
  
9450 9450
 	/**
9451
-	* Parses a date string
9452
-	*
9453
-	* @param String $dateString the date string
9454
-	* @param String $timezone the timezone of a user
9455
-	* @return Array the time information
9456
-	*
9457
-	*/
9451
+	 * Parses a date string
9452
+	 *
9453
+	 * @param String $dateString the date string
9454
+	 * @param String $timezone the timezone of a user
9455
+	 * @return Array the time information
9456
+	 *
9457
+	 */
9458 9458
 	public function parseDateString($dateString, $timezone = '')
9459 9459
 	{
9460 9460
 		$time_array = array();
@@ -9490,12 +9490,12 @@  discard block
 block discarded – undo
9490 9490
 	
9491 9491
 	
9492 9492
 	/**
9493
-	* Parses the direction degrees to working
9494
-	*
9495
-	* @param Float $direction the direction in degrees
9496
-	* @return Array the direction information
9497
-	*
9498
-	*/
9493
+	 * Parses the direction degrees to working
9494
+	 *
9495
+	 * @param Float $direction the direction in degrees
9496
+	 * @return Array the direction information
9497
+	 *
9498
+	 */
9499 9499
 	public function parseDirection($direction = 0)
9500 9500
 	{
9501 9501
 		if ($direction == '') $direction = 0;
@@ -9574,12 +9574,12 @@  discard block
 block discarded – undo
9574 9574
 	
9575 9575
 	
9576 9576
 	/**
9577
-	* Gets the aircraft registration
9578
-	*
9579
-	* @param String $flightaware_id the flight aware id
9580
-	* @return String the aircraft registration
9581
-	*
9582
-	*/
9577
+	 * Gets the aircraft registration
9578
+	 *
9579
+	 * @param String $flightaware_id the flight aware id
9580
+	 * @return String the aircraft registration
9581
+	 *
9582
+	 */
9583 9583
 	
9584 9584
 	public function getAircraftRegistration($flightaware_id)
9585 9585
 	{
@@ -9608,12 +9608,12 @@  discard block
 block discarded – undo
9608 9608
 
9609 9609
 
9610 9610
 	/**
9611
-	* Gets the aircraft registration from ModeS
9612
-	*
9613
-	* @param String $aircraft_modes the flight ModeS in hex
9614
-	* @return String the aircraft registration
9615
-	*
9616
-	*/
9611
+	 * Gets the aircraft registration from ModeS
9612
+	 *
9613
+	 * @param String $aircraft_modes the flight ModeS in hex
9614
+	 * @return String the aircraft registration
9615
+	 *
9616
+	 */
9617 9617
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
9618 9618
 	{
9619 9619
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9625,19 +9625,19 @@  discard block
 block discarded – undo
9625 9625
     
9626 9626
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9627 9627
 		if (count($row) > 0) {
9628
-		    //return $row['Registration'];
9629
-		    return $row['registration'];
9628
+			//return $row['Registration'];
9629
+			return $row['registration'];
9630 9630
 		} else return '';
9631 9631
 	
9632 9632
 	}
9633 9633
 
9634 9634
 	/**
9635
-	* Gets the aircraft type from ModeS
9636
-	*
9637
-	* @param String $aircraft_modes the flight ModeS in hex
9638
-	* @return String the aircraft type
9639
-	*
9640
-	*/
9635
+	 * Gets the aircraft type from ModeS
9636
+	 *
9637
+	 * @param String $aircraft_modes the flight ModeS in hex
9638
+	 * @return String the aircraft type
9639
+	 *
9640
+	 */
9641 9641
 	public function getAircraftTypeBymodeS($aircraft_modes)
9642 9642
 	{
9643 9643
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9649,19 +9649,19 @@  discard block
 block discarded – undo
9649 9649
     
9650 9650
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9651 9651
 		if (count($row) > 0) {
9652
-		    if ($row['type_flight'] == null) return '';
9653
-		    else return $row['type_flight'];
9652
+			if ($row['type_flight'] == null) return '';
9653
+			else return $row['type_flight'];
9654 9654
 		} else return '';
9655 9655
 	
9656 9656
 	}
9657 9657
 
9658 9658
 	/**
9659
-	* Gets Countrie from latitude/longitude
9660
-	*
9661
-	* @param Float $latitude latitute of the flight
9662
-	* @param Float $longitude longitute of the flight
9663
-	* @return String the countrie
9664
-	*/
9659
+	 * Gets Countrie from latitude/longitude
9660
+	 *
9661
+	 * @param Float $latitude latitute of the flight
9662
+	 * @param Float $longitude longitute of the flight
9663
+	 * @return String the countrie
9664
+	 */
9665 9665
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
9666 9666
 	{
9667 9667
 		global $globalDBdriver, $globalDebug;
@@ -9694,12 +9694,12 @@  discard block
 block discarded – undo
9694 9694
 	}
9695 9695
 
9696 9696
 	/**
9697
-	* converts the registration code using the country prefix
9698
-	*
9699
-	* @param String $registration the aircraft registration
9700
-	* @return String the aircraft registration
9701
-	*
9702
-	*/
9697
+	 * converts the registration code using the country prefix
9698
+	 *
9699
+	 * @param String $registration the aircraft registration
9700
+	 * @return String the aircraft registration
9701
+	 *
9702
+	 */
9703 9703
 	public function convertAircraftRegistration($registration)
9704 9704
 	{
9705 9705
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9751,12 +9751,12 @@  discard block
 block discarded – undo
9751 9751
 	}
9752 9752
 
9753 9753
 	/**
9754
-	* Country from the registration code
9755
-	*
9756
-	* @param String $registration the aircraft registration
9757
-	* @return String the country
9758
-	*
9759
-	*/
9754
+	 * Country from the registration code
9755
+	 *
9756
+	 * @param String $registration the aircraft registration
9757
+	 * @return String the country
9758
+	 *
9759
+	 */
9760 9760
 	public function countryFromAircraftRegistration($registration)
9761 9761
 	{
9762 9762
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9775,8 +9775,8 @@  discard block
 block discarded – undo
9775 9775
 				$country = $row['country'];
9776 9776
 			}
9777 9777
 		} else {
9778
-    			$registration_1 = substr($registration, 0, 1);
9779
-		        $registration_2 = substr($registration, 0, 2);
9778
+				$registration_1 = substr($registration, 0, 1);
9779
+				$registration_2 = substr($registration, 0, 2);
9780 9780
 
9781 9781
 			$country = '';
9782 9782
 			//first get the prefix based on two characters
@@ -9812,11 +9812,11 @@  discard block
 block discarded – undo
9812 9812
 	}
9813 9813
 	
9814 9814
 	/**
9815
-	* Set a new highlight value for a flight
9816
-	*
9817
-	* @param String $flightaware_id flightaware_id from spotter_output table
9818
-	* @param String $highlight New highlight value
9819
-	*/
9815
+	 * Set a new highlight value for a flight
9816
+	 *
9817
+	 * @param String $flightaware_id flightaware_id from spotter_output table
9818
+	 * @param String $highlight New highlight value
9819
+	 */
9820 9820
 	public function setHighlightFlight($flightaware_id,$highlight) {
9821 9821
 		
9822 9822
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -9825,12 +9825,12 @@  discard block
 block discarded – undo
9825 9825
 	}
9826 9826
 	
9827 9827
 	/**
9828
-	* Gets the short url from bit.ly
9829
-	*
9830
-	* @param String $url the full url
9831
-	* @return String the bit.ly url
9832
-	*
9833
-	*/
9828
+	 * Gets the short url from bit.ly
9829
+	 *
9830
+	 * @param String $url the full url
9831
+	 * @return String the bit.ly url
9832
+	 *
9833
+	 */
9834 9834
 	public function getBitlyURL($url)
9835 9835
 	{
9836 9836
 		global $globalBitlyAccessToken;
@@ -10119,11 +10119,11 @@  discard block
 block discarded – undo
10119 10119
 			$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 
10120 10120
 	                      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)) 
10121 10121
 	                      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;";
10122
-                } else {
10122
+				} else {
10123 10123
 			$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 
10124 10124
 	                      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)) 
10125 10125
 	                      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;";
10126
-    		}
10126
+			}
10127 10127
 		$sth = $this->db->prepare($query);
10128 10128
 		$sth->execute();
10129 10129
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
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.
Spacing   +791 added lines, -791 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,14 +17,14 @@  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;
22
-		if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter);
22
+		if (is_array($globalFilter)) $filter = array_merge($globalFilter, $filter);
23 23
 		$filter_query_join = '';
24 24
 		$filter_query_where = '';
25 25
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
26 26
 			if ($filter['airlines'][0] != '') {
27
-				$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";
27
+				$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";
28 28
 			}
29 29
 		}
30 30
 		
@@ -32,16 +32,16 @@  discard block
 block discarded – undo
32 32
 			$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 ";
33 33
 		}
34 34
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
35
-			$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";
35
+			$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";
36 36
 		}
37 37
 		if (isset($filter['source']) && !empty($filter['source'])) {
38
-			$filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
38
+			$filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')";
39 39
 		}
40 40
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
41 41
 			if ($filter_query_where == '') {
42
-				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
42
+				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
43 43
 			} else {
44
-				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
44
+				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
45 45
 			}
46 46
 		}
47 47
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 			$sth = $this->db->prepare($query.$limitQuery);
89 89
 			$sth->execute($params);
90 90
 		} catch (PDOException $e) {
91
-			printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery);
91
+			printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery);
92 92
 			exit();
93 93
 		}
94 94
 		
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 		$spotter_array = array();
99 99
 		
100 100
 
101
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
101
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
102 102
 		{
103 103
 			$num_rows++;
104 104
 			$temp_array = array();
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 			if (isset($row['route_stop'])) {
144 144
 				$temp_array['route_stop'] = $row['route_stop'];
145 145
 				if ($row['route_stop'] != '') {
146
-					$allroute = explode(' ',$row['route_stop']);
146
+					$allroute = explode(' ', $row['route_stop']);
147 147
 			
148 148
 					foreach ($allroute as $route) {
149 149
 						$route_airport_array = $this->getAllAirportInfo($route);
@@ -198,11 +198,11 @@  discard block
 block discarded – undo
198 198
 				{
199 199
 					$temp_array['date'] = "about ".$dateArray['hours']." hours ago";
200 200
 				} else {
201
-					$temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC"));
201
+					$temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC"));
202 202
 				}
203 203
 				$temp_array['date_minutes_past'] = $dateArray['minutes'];
204
-				$temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC"));
205
-				$temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC"));
204
+				$temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC"));
205
+				$temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC"));
206 206
 				$temp_array['date_unix'] = strtotime($row['date']." UTC");
207 207
 			}
208 208
 			
@@ -236,9 +236,9 @@  discard block
 block discarded – undo
236 236
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
237 237
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
238 238
 					if (is_numeric(substr($row['ident'], 2, 1))) {
239
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2),$fromsource);
239
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2), $fromsource);
240 240
 					} elseif (is_numeric(substr($row['ident'], 3, 1))) {
241
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
241
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
242 242
 					} else {
243 243
 						$airline_array = $this->getAllAirlineInfo('NA');
244 244
 					}
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 				$temp_array['airline_type'] = $row['airline_type'];
265 265
 			}
266 266
 			if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') {
267
-				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'],3));
267
+				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'], 3));
268 268
 				//$acars_array = ACARS->getLiveAcarsData('BA40YL');
269 269
 				if (count($acars_array) > 0) {
270 270
 					$temp_array['acars'] = $acars_array;
@@ -281,11 +281,11 @@  discard block
 block discarded – undo
281 281
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
282 282
 			}
283 283
 
284
-			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
284
+			if ($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
285 285
 			{
286 286
 				if ($globalIVAO) {
287
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
288
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
287
+					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('', $temp_array['aircraft_type'], $temp_array['airline_icao']);
288
+					else $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type']);
289 289
 				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
290 290
 				if (count($image_array) > 0) {
291 291
 					$temp_array['image'] = $image_array[0]['image'];
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 			if (isset($row['arrival_airport_time']) && $row['arrival_airport_time'] != '') {
309 309
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
310 310
 			}
311
-			if ((!isset($globalIVAO) || ! $globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
311
+			if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
312 312
 				$schedule_array = $Schedule->getSchedule($temp_array['ident']);
313 313
 				//print_r($schedule_array);
314 314
 				if (count($schedule_array) > 0) {
@@ -389,12 +389,12 @@  discard block
 block discarded – undo
389 389
 			if (isset($row['squawk'])) {
390 390
 				$temp_array['squawk'] = $row['squawk'];
391 391
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
392
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
393
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
392
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['country_iso2']);
393
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
394 394
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
395
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
396
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
397
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
395
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['over_country']);
396
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
397
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
398 398
 			}
399 399
     			
400 400
 			$temp_array['query_number_rows'] = $num_rows;
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 	* @return Array the spotter information
414 414
 	*
415 415
 	*/
416
-	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 = '',$filter = array())
416
+	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 = '', $filter = array())
417 417
 	{
418 418
 		global $globalTimezone, $globalDBdriver;
419 419
 		require_once(dirname(__FILE__).'/class.Translation.php');
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 
424 424
 		$query_values = array();
425 425
 		$additional_query = '';
426
-		$filter_query = $this->getFilter($filter,true,true);
426
+		$filter_query = $this->getFilter($filter, true, true);
427 427
 		if ($q != "")
428 428
 		{
429 429
 			if (!is_string($q))
@@ -431,8 +431,8 @@  discard block
 block discarded – undo
431 431
 				return false;
432 432
 			} else {
433 433
 				$q_array = explode(" ", $q);
434
-				foreach ($q_array as $q_item){
435
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
434
+				foreach ($q_array as $q_item) {
435
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
436 436
 					$additional_query .= " AND (";
437 437
 					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
438 438
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
@@ -464,37 +464,37 @@  discard block
 block discarded – undo
464 464
 
465 465
 		if ($registration != "")
466 466
 		{
467
-			$registration = filter_var($registration,FILTER_SANITIZE_STRING);
467
+			$registration = filter_var($registration, FILTER_SANITIZE_STRING);
468 468
 			if (!is_string($registration))
469 469
 			{
470 470
 				return false;
471 471
 			} else {
472 472
 				$additional_query .= " AND spotter_output.registration = :registration";
473
-				$query_values = array_merge($query_values,array(':registration' => $registration));
473
+				$query_values = array_merge($query_values, array(':registration' => $registration));
474 474
 			}
475 475
 		}
476 476
 
477 477
 		if ($aircraft_icao != "")
478 478
 		{
479
-			$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
479
+			$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
480 480
 			if (!is_string($aircraft_icao))
481 481
 			{
482 482
 				return false;
483 483
 			} else {
484 484
 				$additional_query .= " AND spotter_output.aircraft_icao = :aircraft_icao";
485
-				$query_values = array_merge($query_values,array(':aircraft_icao' => $aircraft_icao));
485
+				$query_values = array_merge($query_values, array(':aircraft_icao' => $aircraft_icao));
486 486
 			}
487 487
 		}
488 488
 
489 489
 		if ($aircraft_manufacturer != "")
490 490
 		{
491
-			$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
491
+			$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
492 492
 			if (!is_string($aircraft_manufacturer))
493 493
 			{
494 494
 				return false;
495 495
 			} else {
496 496
 				$additional_query .= " AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer";
497
-				$query_values = array_merge($query_values,array(':aircraft_manufacturer' => $aircraft_manufacturer));
497
+				$query_values = array_merge($query_values, array(':aircraft_manufacturer' => $aircraft_manufacturer));
498 498
 			}
499 499
 		}
500 500
 
@@ -510,25 +510,25 @@  discard block
 block discarded – undo
510 510
 
511 511
 		if ($airline_icao != "")
512 512
 		{
513
-			$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
513
+			$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
514 514
 			if (!is_string($airline_icao))
515 515
 			{
516 516
 				return false;
517 517
 			} else {
518 518
 				$additional_query .= " AND spotter_output.airline_icao = :airline_icao";
519
-				$query_values = array_merge($query_values,array(':airline_icao' => $airline_icao));
519
+				$query_values = array_merge($query_values, array(':airline_icao' => $airline_icao));
520 520
 			}
521 521
 		}
522 522
 
523 523
 		if ($airline_country != "")
524 524
 		{
525
-			$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
525
+			$airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING);
526 526
 			if (!is_string($airline_country))
527 527
 			{
528 528
 				return false;
529 529
 			} else {
530 530
 				$additional_query .= " AND spotter_output.airline_country = :airline_country";
531
-				$query_values = array_merge($query_values,array(':airline_country' => $airline_country));
531
+				$query_values = array_merge($query_values, array(':airline_country' => $airline_country));
532 532
 			}
533 533
 		}
534 534
 
@@ -555,31 +555,31 @@  discard block
 block discarded – undo
555 555
 
556 556
 		if ($airport != "")
557 557
 		{
558
-			$airport = filter_var($airport,FILTER_SANITIZE_STRING);
558
+			$airport = filter_var($airport, FILTER_SANITIZE_STRING);
559 559
 			if (!is_string($airport))
560 560
 			{
561 561
 				return false;
562 562
 			} else {
563 563
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :airport OR spotter_output.arrival_airport_icao = :airport)";
564
-				$query_values = array_merge($query_values,array(':airport' => $airport));
564
+				$query_values = array_merge($query_values, array(':airport' => $airport));
565 565
 			}
566 566
 		}
567 567
 
568 568
 		if ($airport_country != "")
569 569
 		{
570
-			$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
570
+			$airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING);
571 571
 			if (!is_string($airport_country))
572 572
 			{
573 573
 				return false;
574 574
 			} else {
575 575
 				$additional_query .= " AND (spotter_output.departure_airport_country = :airport_country OR spotter_output.arrival_airport_country = :airport_country)";
576
-				$query_values = array_merge($query_values,array(':airport_country' => $airport_country));
576
+				$query_values = array_merge($query_values, array(':airport_country' => $airport_country));
577 577
 			}
578 578
 		}
579 579
     
580 580
 		if ($callsign != "")
581 581
 		{
582
-			$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
582
+			$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
583 583
 			if (!is_string($callsign))
584 584
 			{
585 585
 				return false;
@@ -587,79 +587,79 @@  discard block
 block discarded – undo
587 587
 				$translate = $Translation->ident2icao($callsign);
588 588
 				if ($translate != $callsign) {
589 589
 					$additional_query .= " AND (spotter_output.ident = :callsign OR spotter_output.ident = :translate)";
590
-					$query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate));
590
+					$query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate));
591 591
 				} else {
592 592
 					$additional_query .= " AND spotter_output.ident = :callsign";
593
-					$query_values = array_merge($query_values,array(':callsign' => $callsign));
593
+					$query_values = array_merge($query_values, array(':callsign' => $callsign));
594 594
 				}
595 595
 			}
596 596
 		}
597 597
 
598 598
 		if ($owner != "")
599 599
 		{
600
-			$owner = filter_var($owner,FILTER_SANITIZE_STRING);
600
+			$owner = filter_var($owner, FILTER_SANITIZE_STRING);
601 601
 			if (!is_string($owner))
602 602
 			{
603 603
 				return false;
604 604
 			} else {
605 605
 				$additional_query .= " AND spotter_output.owner_name = :owner";
606
-				$query_values = array_merge($query_values,array(':owner' => $owner));
606
+				$query_values = array_merge($query_values, array(':owner' => $owner));
607 607
 			}
608 608
 		}
609 609
 
610 610
 		if ($pilot_name != "")
611 611
 		{
612
-			$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
612
+			$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
613 613
 			if (!is_string($pilot_name))
614 614
 			{
615 615
 				return false;
616 616
 			} else {
617 617
 				$additional_query .= " AND spotter_output.pilot_name = :pilot_name";
618
-				$query_values = array_merge($query_values,array(':pilot_name' => $pilot_name));
618
+				$query_values = array_merge($query_values, array(':pilot_name' => $pilot_name));
619 619
 			}
620 620
 		}
621 621
 
622 622
 		if ($pilot_id != "")
623 623
 		{
624
-			$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
624
+			$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT);
625 625
 			if (!is_string($pilot_id))
626 626
 			{
627 627
 				return false;
628 628
 			} else {
629 629
 				$additional_query .= " AND spotter_output.pilot_id = :pilot_id";
630
-				$query_values = array_merge($query_values,array(':pilot_id' => $pilot_id));
630
+				$query_values = array_merge($query_values, array(':pilot_id' => $pilot_id));
631 631
 			}
632 632
 		}
633 633
 
634 634
 		if ($departure_airport_route != "")
635 635
 		{
636
-			$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
636
+			$departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING);
637 637
 			if (!is_string($departure_airport_route))
638 638
 			{
639 639
 				return false;
640 640
 			} else {
641 641
 				$additional_query .= " AND spotter_output.departure_airport_icao = :departure_airport_route";
642
-				$query_values = array_merge($query_values,array(':departure_airport_route' => $departure_airport_route));
642
+				$query_values = array_merge($query_values, array(':departure_airport_route' => $departure_airport_route));
643 643
 			}
644 644
 		}
645 645
 
646 646
 		if ($arrival_airport_route != "")
647 647
 		{
648
-			$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
648
+			$arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING);
649 649
 			if (!is_string($arrival_airport_route))
650 650
 			{
651 651
 				return false;
652 652
 			} else {
653 653
 				$additional_query .= " AND spotter_output.arrival_airport_icao = :arrival_airport_route";
654
-				$query_values = array_merge($query_values,array(':arrival_airport_route' => $arrival_airport_route));
654
+				$query_values = array_merge($query_values, array(':arrival_airport_route' => $arrival_airport_route));
655 655
 			}
656 656
 		}
657 657
 
658 658
 		if ($altitude != "")
659 659
 		{
660 660
 			$altitude_array = explode(",", $altitude);
661
-			$altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
662
-			$altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
661
+			$altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
662
+			$altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
663 663
 
664 664
 			if ($altitude_array[1] != "")
665 665
 			{                
@@ -675,8 +675,8 @@  discard block
 block discarded – undo
675 675
 		if ($date_posted != "")
676 676
 		{
677 677
 			$date_array = explode(",", $date_posted);
678
-			$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
679
-			$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
678
+			$date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
679
+			$date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
680 680
 
681 681
 			if ($globalTimezone != '') {
682 682
 				date_default_timezone_set($globalTimezone);
@@ -707,8 +707,8 @@  discard block
 block discarded – undo
707 707
 		{
708 708
 			$limit_array = explode(",", $limit);
709 709
 			
710
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
711
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
710
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
711
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
712 712
 			
713 713
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
714 714
 			{
@@ -737,23 +737,23 @@  discard block
 block discarded – undo
737 737
 
738 738
 
739 739
 		if ($origLat != "" && $origLon != "" && $dist != "") {
740
-			$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
740
+			$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
741 741
 
742 742
 			if ($globalDBdriver == 'mysql') {
743
-				$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 
743
+				$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 
744 744
 						FROM spotter_output, spotter_archive".$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)) 
745 745
 						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;
746 746
 			} else {
747
-				$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 
747
+				$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 
748 748
 						FROM spotter_output, spotter_archive".$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)) 
749 749
 						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;
750 750
 			}
751 751
 		} else {		
752
-			$query  = "SELECT spotter_output.* FROM spotter_output ".$filter_query." spotter_output.ident <> '' 
752
+			$query = "SELECT spotter_output.* FROM spotter_output ".$filter_query." spotter_output.ident <> '' 
753 753
 					".$additional_query."
754 754
 					".$orderby_query;
755 755
 		}
756
-		$spotter_array = $this->getDataFromDB($query, $query_values,$limit_query);
756
+		$spotter_array = $this->getDataFromDB($query, $query_values, $limit_query);
757 757
 		return $spotter_array;
758 758
 	}
759 759
 	
@@ -776,8 +776,8 @@  discard block
 block discarded – undo
776 776
 		{
777 777
 			$limit_array = explode(",", $limit);
778 778
 			
779
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
780
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
779
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
780
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
781 781
 			
782 782
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
783 783
 			{
@@ -794,9 +794,9 @@  discard block
 block discarded – undo
794 794
 			$orderby_query = " ORDER BY spotter_output.date DESC";
795 795
 		}
796 796
 
797
-		$query  = $global_query.$filter_query." ".$orderby_query;
797
+		$query = $global_query.$filter_query." ".$orderby_query;
798 798
 
799
-		$spotter_array = $this->getDataFromDB($query, array(),$limit_query);
799
+		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
800 800
 
801 801
 		return $spotter_array;
802 802
 	}
@@ -842,34 +842,34 @@  discard block
 block discarded – undo
842 842
 			{
843 843
 				return false;
844 844
 			} else {
845
-				if ($interval == "30m"){
845
+				if ($interval == "30m") {
846 846
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) <= $this_output.date ';
847
-				} else if ($interval == "1h"){
847
+				} else if ($interval == "1h") {
848 848
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) <= $this_output.date ';
849
-				} else if ($interval == "3h"){
849
+				} else if ($interval == "3h") {
850 850
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 3 HOUR) <= $this_output.date ';
851
-				} else if ($interval == "6h"){
851
+				} else if ($interval == "6h") {
852 852
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 6 HOUR) <= $this_output.date ';
853
-				} else if ($interval == "12h"){
853
+				} else if ($interval == "12h") {
854 854
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 HOUR) <= $this_output.date ';
855
-				} else if ($interval == "24h"){
855
+				} else if ($interval == "24h") {
856 856
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 24 HOUR) <= $this_output.date ';
857
-				} else if ($interval == "7d"){
857
+				} else if ($interval == "7d") {
858 858
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) <= $this_output.date ';
859
-				} else if ($interval == "30d"){
859
+				} else if ($interval == "30d") {
860 860
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 DAY) <= $this_output.date ';
861 861
 				} 
862 862
 			}
863 863
 		}
864 864
 
865
-		$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 
865
+		$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 
866 866
                    WHERE spotter_output.latitude <> '' 
867 867
 				   AND spotter_output.longitude <> '' 
868 868
                    ".$additional_query."
869 869
                    HAVING distance < :radius  
870 870
 				   ORDER BY distance";
871 871
 
872
-		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius),$limit_query);
872
+		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius), $limit_query);
873 873
 
874 874
 		return $spotter_array;
875 875
 	}
@@ -881,21 +881,21 @@  discard block
 block discarded – undo
881 881
 	* @return Array the spotter information
882 882
 	*
883 883
 	*/
884
-	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
884
+	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '', $filter = array())
885 885
 	{
886 886
 		global $global_query;
887 887
 		
888 888
 		date_default_timezone_set('UTC');
889 889
 
890
-		$filter_query = $this->getFilter($filter,true,true);
890
+		$filter_query = $this->getFilter($filter, true, true);
891 891
 
892 892
 		$limit_query = '';
893 893
 		if ($limit != "")
894 894
 		{
895 895
 			$limit_array = explode(",", $limit);
896 896
 			
897
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
898
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
897
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
898
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
899 899
 			
900 900
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
901 901
 			{
@@ -912,7 +912,7 @@  discard block
 block discarded – undo
912 912
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
913 913
 		}
914 914
 
915
-		$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;
915
+		$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;
916 916
 
917 917
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
918 918
 
@@ -931,15 +931,15 @@  discard block
 block discarded – undo
931 931
 		global $global_query;
932 932
 		
933 933
 		date_default_timezone_set('UTC');
934
-		$filter_query = $this->getFilter($filter,true,true);
934
+		$filter_query = $this->getFilter($filter, true, true);
935 935
 
936 936
 		$limit_query = '';
937 937
 		if ($limit != "")
938 938
 		{
939 939
 			$limit_array = explode(",", $limit);
940 940
 			
941
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
942
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
941
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
942
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
943 943
 			
944 944
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
945 945
 			{
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
957 957
 		}
958 958
 
959
-		$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;
959
+		$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;
960 960
 
961 961
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
962 962
 
@@ -970,20 +970,20 @@  discard block
 block discarded – undo
970 970
 	* @return Array the spotter information
971 971
 	*
972 972
 	*/
973
-	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
973
+	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '', $filter = array())
974 974
 	{
975 975
 		global $global_query;
976 976
 		
977 977
 		date_default_timezone_set('UTC');
978
-		$filter_query = $this->getFilter($filter,true,true);
978
+		$filter_query = $this->getFilter($filter, true, true);
979 979
 		
980 980
 		$limit_query = '';
981 981
 		if ($limit != "")
982 982
 		{
983 983
 			$limit_array = explode(",", $limit);
984 984
 			
985
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
986
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
985
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
986
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
987 987
 			
988 988
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
989 989
 			{
@@ -1000,7 +1000,7 @@  discard block
 block discarded – undo
1000 1000
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1001 1001
 		}
1002 1002
 
1003
-		$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;
1003
+		$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;
1004 1004
 
1005 1005
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1006 1006
 
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
 		
1021 1021
 		date_default_timezone_set('UTC');
1022 1022
 		
1023
-		$filter_query = $this->getFilter($filter,true,true);
1023
+		$filter_query = $this->getFilter($filter, true, true);
1024 1024
 		
1025 1025
 		$limit_query = '';
1026 1026
 		
@@ -1028,8 +1028,8 @@  discard block
 block discarded – undo
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.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;
1049
+		$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;
1050 1050
 
1051 1051
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1052 1052
 
@@ -1065,14 +1065,14 @@  discard block
 block discarded – undo
1065 1065
 		global $global_query;
1066 1066
 		
1067 1067
 		date_default_timezone_set('UTC');
1068
-		$filter_query = $this->getFilter($filter,true,true);
1068
+		$filter_query = $this->getFilter($filter, true, true);
1069 1069
 		$limit_query = '';
1070 1070
 		if ($limit != "")
1071 1071
 		{
1072 1072
 			$limit_array = explode(",", $limit);
1073 1073
 			
1074
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1075
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1074
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1075
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1076 1076
 			
1077 1077
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1078 1078
 			{
@@ -1089,7 +1089,7 @@  discard block
 block discarded – undo
1089 1089
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1090 1090
 		}
1091 1091
 
1092
-		$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;
1092
+		$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;
1093 1093
 
1094 1094
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1095 1095
 
@@ -1113,9 +1113,9 @@  discard block
 block discarded – undo
1113 1113
 		$query_values = array(':id' => $id);
1114 1114
 
1115 1115
 		//$query  = $global_query." WHERE spotter_output.ident <> '' ".$additional_query." ";
1116
-		$query  = $global_query." WHERE ".$additional_query." ";
1116
+		$query = $global_query." WHERE ".$additional_query." ";
1117 1117
 
1118
-		$spotter_array = $this->getDataFromDB($query,$query_values);
1118
+		$spotter_array = $this->getDataFromDB($query, $query_values);
1119 1119
 
1120 1120
 		return $spotter_array;
1121 1121
 	}
@@ -1153,8 +1153,8 @@  discard block
 block discarded – undo
1153 1153
 		{
1154 1154
 			$limit_array = explode(",", $limit);
1155 1155
 			
1156
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1157
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1156
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1157
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1158 1158
 			
1159 1159
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1160 1160
 			{
@@ -1195,7 +1195,7 @@  discard block
 block discarded – undo
1195 1195
 		$query_values = array();
1196 1196
 		$limit_query = '';
1197 1197
 		$additional_query = '';
1198
-		$filter_query = $this->getFilter($filter,true,true);
1198
+		$filter_query = $this->getFilter($filter, true, true);
1199 1199
 		
1200 1200
 		if ($aircraft_type != "")
1201 1201
 		{
@@ -1212,8 +1212,8 @@  discard block
 block discarded – undo
1212 1212
 		{
1213 1213
 			$limit_array = explode(",", $limit);
1214 1214
 			
1215
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1216
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1215
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1216
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1217 1217
 			
1218 1218
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1219 1219
 			{
@@ -1253,7 +1253,7 @@  discard block
 block discarded – undo
1253 1253
 		$query_values = array();
1254 1254
 		$limit_query = '';
1255 1255
 		$additional_query = '';
1256
-		$filter_query = $this->getFilter($filter,true,true);
1256
+		$filter_query = $this->getFilter($filter, true, true);
1257 1257
 		
1258 1258
 		if ($registration != "")
1259 1259
 		{
@@ -1270,8 +1270,8 @@  discard block
 block discarded – undo
1270 1270
 		{
1271 1271
 			$limit_array = explode(",", $limit);
1272 1272
 			
1273
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1274
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1273
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1274
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1275 1275
 			
1276 1276
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1277 1277
 			{
@@ -1329,8 +1329,8 @@  discard block
 block discarded – undo
1329 1329
 		{
1330 1330
 			$limit_array = explode(",", $limit);
1331 1331
 			
1332
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1333
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1332
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1333
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1334 1334
 			
1335 1335
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1336 1336
 			{
@@ -1384,8 +1384,8 @@  discard block
 block discarded – undo
1384 1384
 		{
1385 1385
 			$limit_array = explode(",", $limit);
1386 1386
 			
1387
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1388
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1387
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1388
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1389 1389
 			
1390 1390
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1391 1391
 			{
@@ -1417,7 +1417,7 @@  discard block
 block discarded – undo
1417 1417
 	* @return Array the spotter information
1418 1418
 	*
1419 1419
 	*/
1420
-	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1420
+	public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array())
1421 1421
 	{
1422 1422
 		global $global_query, $globalTimezone, $globalDBdriver;
1423 1423
 		
@@ -1427,19 +1427,19 @@  discard block
 block discarded – undo
1427 1427
 
1428 1428
 		$filter_query = '';
1429 1429
 		if (isset($filter['source']) && !empty($filter['source'])) {
1430
-			$filter_query = " AND format_source IN ('".implode("','",$filter['source'])."')";
1430
+			$filter_query = " AND format_source IN ('".implode("','", $filter['source'])."')";
1431 1431
 		}
1432 1432
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
1433
-			$filter_query .= " 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";
1433
+			$filter_query .= " 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";
1434 1434
 		}
1435 1435
 		if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
1436 1436
 			$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id ";
1437 1437
 		}
1438 1438
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
1439
-			$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
1439
+			$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
1440 1440
 		}
1441 1441
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
1442
-			$filter_query .= " 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";
1442
+			$filter_query .= " 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";
1443 1443
 		}
1444 1444
 	
1445 1445
 		
@@ -1467,8 +1467,8 @@  discard block
 block discarded – undo
1467 1467
 		{
1468 1468
 			$limit_array = explode(",", $limit);
1469 1469
 			
1470
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1471
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1470
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1471
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1472 1472
 			
1473 1473
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1474 1474
 			{
@@ -1523,8 +1523,8 @@  discard block
 block discarded – undo
1523 1523
 		{
1524 1524
 			$limit_array = explode(",", $limit);
1525 1525
 			
1526
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1527
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1526
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1527
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1528 1528
 			
1529 1529
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1530 1530
 			{
@@ -1580,8 +1580,8 @@  discard block
 block discarded – undo
1580 1580
 		{
1581 1581
 			$limit_array = explode(",", $limit);
1582 1582
 			
1583
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1584
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1583
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1584
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1585 1585
 			
1586 1586
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1587 1587
 			{
@@ -1629,7 +1629,7 @@  discard block
 block discarded – undo
1629 1629
 			{
1630 1630
 				return false;
1631 1631
 			} else {
1632
-				$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1632
+				$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1633 1633
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)";
1634 1634
 				$query_values = array(':departure_airport_icao' => $departure_airport_icao);
1635 1635
 			}
@@ -1641,9 +1641,9 @@  discard block
 block discarded – undo
1641 1641
 			{
1642 1642
 				return false;
1643 1643
 			} else {
1644
-				$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1644
+				$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1645 1645
 				$additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)";
1646
-				$query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao));
1646
+				$query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao));
1647 1647
 			}
1648 1648
 		}
1649 1649
 		
@@ -1651,8 +1651,8 @@  discard block
 block discarded – undo
1651 1651
 		{
1652 1652
 			$limit_array = explode(",", $limit);
1653 1653
 			
1654
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1655
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1654
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1655
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1656 1656
 			
1657 1657
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1658 1658
 			{
@@ -1691,15 +1691,15 @@  discard block
 block discarded – undo
1691 1691
 		global $global_query;
1692 1692
 		
1693 1693
 		date_default_timezone_set('UTC');
1694
-		$filter_query = $this->getFilter($filter,true,true);
1694
+		$filter_query = $this->getFilter($filter, true, true);
1695 1695
 		$limit_query = '';
1696 1696
 		
1697 1697
 		if ($limit != "")
1698 1698
 		{
1699 1699
 			$limit_array = explode(",", $limit);
1700 1700
 			
1701
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1702
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1701
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1702
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1703 1703
 			
1704 1704
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1705 1705
 			{
@@ -1716,7 +1716,7 @@  discard block
 block discarded – undo
1716 1716
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1717 1717
 		}
1718 1718
 
1719
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1719
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1720 1720
 
1721 1721
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1722 1722
 
@@ -1729,19 +1729,19 @@  discard block
 block discarded – undo
1729 1729
 	* @return String the highlight text
1730 1730
 	*
1731 1731
 	*/
1732
-	public function getHighlightByRegistration($registration,$filter = array())
1732
+	public function getHighlightByRegistration($registration, $filter = array())
1733 1733
 	{
1734 1734
 		global $global_query;
1735 1735
 		
1736 1736
 		date_default_timezone_set('UTC');
1737
-		$filter_query = $this->getFilter($filter,true,true);
1738
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
1737
+		$filter_query = $this->getFilter($filter, true, true);
1738
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
1739 1739
 		
1740
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1740
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1741 1741
 		$sth = $this->db->prepare($query);
1742 1742
 		$sth->execute(array(':registration' => $registration));
1743 1743
 
1744
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1744
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1745 1745
 		{
1746 1746
 			$highlight = $row['highlight'];
1747 1747
 		}
@@ -1757,14 +1757,14 @@  discard block
 block discarded – undo
1757 1757
 	* @return String usage
1758 1758
 	*
1759 1759
 	*/
1760
-	public function getSquawkUsage($squawk = '',$country = 'FR')
1760
+	public function getSquawkUsage($squawk = '', $country = 'FR')
1761 1761
 	{
1762 1762
 		
1763
-		$squawk = filter_var($squawk,FILTER_SANITIZE_STRING);
1764
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
1763
+		$squawk = filter_var($squawk, FILTER_SANITIZE_STRING);
1764
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
1765 1765
 
1766 1766
 		$query  = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1";
1767
-		$query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country);
1767
+		$query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country);
1768 1768
 		
1769 1769
 		$sth = $this->db->prepare($query);
1770 1770
 		$sth->execute($query_values);
@@ -1785,9 +1785,9 @@  discard block
 block discarded – undo
1785 1785
 	public function getAirportIcao($airport_iata = '')
1786 1786
 	{
1787 1787
 		
1788
-		$airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING);
1788
+		$airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING);
1789 1789
 
1790
-		$query  = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1790
+		$query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1791 1791
 		$query_values = array(':airport' => $airport_iata);
1792 1792
 		
1793 1793
 		$sth = $this->db->prepare($query);
@@ -1808,12 +1808,12 @@  discard block
 block discarded – undo
1808 1808
 	* @return Float distance to the airport
1809 1809
 	*
1810 1810
 	*/
1811
-	public function getAirportDistance($airport_icao,$latitude,$longitude)
1811
+	public function getAirportDistance($airport_icao, $latitude, $longitude)
1812 1812
 	{
1813 1813
 		
1814
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
1814
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
1815 1815
 
1816
-		$query  = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
1816
+		$query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
1817 1817
 		$query_values = array(':airport' => $airport_icao);
1818 1818
 		$sth = $this->db->prepare($query);
1819 1819
 		$sth->execute($query_values);
@@ -1822,7 +1822,7 @@  discard block
 block discarded – undo
1822 1822
 			$airport_latitude = $row['latitude'];
1823 1823
 			$airport_longitude = $row['longitude'];
1824 1824
 			$Common = new Common();
1825
-			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
1825
+			return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude);
1826 1826
 		} else return '';
1827 1827
 	}
1828 1828
 	
@@ -1836,11 +1836,11 @@  discard block
 block discarded – undo
1836 1836
 	public function getAllAirportInfo($airport = '')
1837 1837
 	{
1838 1838
 		
1839
-		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
1839
+		$airport = filter_var($airport, FILTER_SANITIZE_STRING);
1840 1840
 
1841 1841
 		$query_values = array();
1842 1842
 		if ($airport == 'NA') {
1843
-			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' => ''));
1843
+			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' => ''));
1844 1844
 		} elseif ($airport == '') {
1845 1845
 			$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";
1846 1846
 		} else {
@@ -1888,14 +1888,14 @@  discard block
 block discarded – undo
1888 1888
 	{
1889 1889
 		$lst_countries = '';
1890 1890
 		foreach ($countries as $country) {
1891
-			$country = filter_var($country,FILTER_SANITIZE_STRING);
1891
+			$country = filter_var($country, FILTER_SANITIZE_STRING);
1892 1892
 			if ($lst_countries == '') {
1893 1893
 				$lst_countries = "'".$country."'";
1894 1894
 			} else {
1895 1895
 				$lst_countries .= ",'".$country."'";
1896 1896
 			}
1897 1897
 		}
1898
-		$query  = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
1898
+		$query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
1899 1899
 		
1900 1900
 		$sth = $this->db->prepare($query);
1901 1901
 		$sth->execute();
@@ -1903,7 +1903,7 @@  discard block
 block discarded – undo
1903 1903
 		$airport_array = array();
1904 1904
 		$temp_array = array();
1905 1905
 		
1906
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1906
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1907 1907
 		{
1908 1908
 			$temp_array['name'] = $row['name'];
1909 1909
 			$temp_array['city'] = $row['city'];
@@ -1931,10 +1931,10 @@  discard block
 block discarded – undo
1931 1931
 	{
1932 1932
 		global $globalDBdriver;
1933 1933
 		if (is_array($coord)) {
1934
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1935
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1936
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1937
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1934
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1935
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1936
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1937
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1938 1938
 		} else return array();
1939 1939
 		if ($globalDBdriver == 'mysql') {
1940 1940
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
@@ -1946,7 +1946,7 @@  discard block
 block discarded – undo
1946 1946
     
1947 1947
 		$airport_array = array();
1948 1948
 		
1949
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1949
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1950 1950
 		{
1951 1951
 			$temp_array = $row;
1952 1952
 
@@ -1966,13 +1966,13 @@  discard block
 block discarded – undo
1966 1966
 	public function getAllWaypointsInfobyCoord($coord)
1967 1967
 	{
1968 1968
 		if (is_array($coord)) {
1969
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1970
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1971
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1972
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1969
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1970
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1971
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1972
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1973 1973
 		} else return array();
1974 1974
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
1975
-		$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.")";
1975
+		$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.")";
1976 1976
 		//$query  = "SELECT waypoints.* FROM waypoints";
1977 1977
 		//$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";
1978 1978
 		//$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;
@@ -1984,7 +1984,7 @@  discard block
 block discarded – undo
1984 1984
     
1985 1985
 		$waypoints_array = array();
1986 1986
 		
1987
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1987
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1988 1988
 		{
1989 1989
 			$temp_array = $row;
1990 1990
 
@@ -2004,10 +2004,10 @@  discard block
 block discarded – undo
2004 2004
 	*/
2005 2005
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2006 2006
 	{
2007
-		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2007
+		$airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING));
2008 2008
 		if ($airline_icao == 'NA') {
2009 2009
 			$airline_array = array();
2010
-			$airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2010
+			$airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2011 2011
 			return $airline_array;
2012 2012
 		} else {
2013 2013
 			if (strlen($airline_icao) == 2) {
@@ -2028,7 +2028,7 @@  discard block
 block discarded – undo
2028 2028
 			if ($fromsource === NULL) {
2029 2029
 				$sth->execute(array(':airline_icao' => $airline_icao));
2030 2030
 			} else {
2031
-				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2031
+				$sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource));
2032 2032
 			}
2033 2033
                         /*
2034 2034
 			$airline_array = array();
@@ -2061,12 +2061,12 @@  discard block
 block discarded – undo
2061 2061
 	*/
2062 2062
 	public function getAllAircraftInfo($aircraft_type)
2063 2063
 	{
2064
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2064
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2065 2065
 
2066 2066
 		if ($aircraft_type == 'NA') {
2067
-			return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2067
+			return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2068 2068
 		}
2069
-		$query  = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow FROM aircraft WHERE aircraft.icao = :aircraft_type";
2069
+		$query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow FROM aircraft WHERE aircraft.icao = :aircraft_type";
2070 2070
 		
2071 2071
 		$sth = $this->db->prepare($query);
2072 2072
 		$sth->execute(array(':aircraft_type' => $aircraft_type));
@@ -2098,7 +2098,7 @@  discard block
 block discarded – undo
2098 2098
 	*/
2099 2099
 	public function getAircraftIcao($aircraft_type)
2100 2100
 	{
2101
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2101
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2102 2102
 		$all_aircraft = array('737-300' => 'B733',
2103 2103
 				'777-200' => 'B772',
2104 2104
 				'777-200ER' => 'B772',
@@ -2110,10 +2110,10 @@  discard block
 block discarded – undo
2110 2110
 				'A380' => 'A388');
2111 2111
 		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2112 2112
 
2113
-		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2113
+		$query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2114 2114
 		$aircraft_type = strtoupper($aircraft_type);
2115 2115
 		$sth = $this->db->prepare($query);
2116
-		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2116
+		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,));
2117 2117
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2118 2118
 		if (isset($result[0]['icao'])) return $result[0]['icao'];
2119 2119
 		else return '';
@@ -2128,9 +2128,9 @@  discard block
 block discarded – undo
2128 2128
 	*/
2129 2129
 	public function getAllAircraftType($aircraft_modes)
2130 2130
 	{
2131
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
2131
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
2132 2132
 
2133
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
2133
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
2134 2134
 		
2135 2135
 		$sth = $this->db->prepare($query);
2136 2136
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -2150,8 +2150,8 @@  discard block
 block discarded – undo
2150 2150
 	*/
2151 2151
 	public function getOperator($operator)
2152 2152
 	{
2153
-		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
2154
-		$query  = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2153
+		$operator = filter_var($operator, FILTER_SANITIZE_STRING);
2154
+		$query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2155 2155
 		
2156 2156
 		$sth = $this->db->prepare($query);
2157 2157
 		$sth->execute(array(':operator' => $operator));
@@ -2171,9 +2171,9 @@  discard block
 block discarded – undo
2171 2171
 	*/
2172 2172
 	public function getRouteInfo($callsign)
2173 2173
 	{
2174
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2174
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
2175 2175
                 if ($callsign == '') return array();
2176
-		$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";
2176
+		$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";
2177 2177
 		
2178 2178
 		$sth = $this->db->prepare($query);
2179 2179
 		$sth->execute(array(':callsign' => $callsign));
@@ -2193,9 +2193,9 @@  discard block
 block discarded – undo
2193 2193
 	*/
2194 2194
 	public function getAircraftInfoByRegistration($registration)
2195 2195
 	{
2196
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2196
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2197 2197
 
2198
-		$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";
2198
+		$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";
2199 2199
 		
2200 2200
 		$sth = $this->db->prepare($query);
2201 2201
 		$sth->execute(array(':registration' => $registration));
@@ -2203,7 +2203,7 @@  discard block
 block discarded – undo
2203 2203
 		$aircraft_array = array();
2204 2204
 		$temp_array = array();
2205 2205
 		
2206
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2206
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2207 2207
 		{
2208 2208
 			$temp_array['airline_icao'] = $row['airline_icao'];
2209 2209
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -2225,10 +2225,10 @@  discard block
 block discarded – undo
2225 2225
 	*/
2226 2226
 	public function getAircraftOwnerByRegistration($registration)
2227 2227
 	{
2228
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2228
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2229 2229
 		$Connection = new Connection($this->db);
2230 2230
 		if ($Connection->tableExists('aircraft_owner')) {
2231
-			$query  = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1";
2231
+			$query = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1";
2232 2232
 			$sth = $this->db->prepare($query);
2233 2233
 			$sth->execute(array(':registration' => $registration));
2234 2234
 
@@ -2246,7 +2246,7 @@  discard block
 block discarded – undo
2246 2246
 	public function getAllFlightsforSitemap()
2247 2247
 	{
2248 2248
 		//$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 ";
2249
-		$query  = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2249
+		$query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2250 2250
 		
2251 2251
 		$sth = $this->db->prepare($query);
2252 2252
 		$sth->execute();
@@ -2293,7 +2293,7 @@  discard block
 block discarded – undo
2293 2293
 		$manufacturer_array = array();
2294 2294
 		$temp_array = array();
2295 2295
 		
2296
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2296
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2297 2297
 		{
2298 2298
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
2299 2299
 
@@ -2327,7 +2327,7 @@  discard block
 block discarded – undo
2327 2327
 		$aircraft_array = array();
2328 2328
 		$temp_array = array();
2329 2329
 		
2330
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2330
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2331 2331
 		{
2332 2332
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
2333 2333
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
@@ -2348,7 +2348,7 @@  discard block
 block discarded – undo
2348 2348
 	*/
2349 2349
 	public function getAllAircraftRegistrations()
2350 2350
 	{
2351
-		$query  = "SELECT DISTINCT spotter_output.registration 
2351
+		$query = "SELECT DISTINCT spotter_output.registration 
2352 2352
 				FROM spotter_output  
2353 2353
 				WHERE spotter_output.registration <> '' 
2354 2354
 				ORDER BY spotter_output.registration ASC";
@@ -2359,7 +2359,7 @@  discard block
 block discarded – undo
2359 2359
 		$aircraft_array = array();
2360 2360
 		$temp_array = array();
2361 2361
 		
2362
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2362
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2363 2363
 		{
2364 2364
 			$temp_array['registration'] = $row['registration'];
2365 2365
 
@@ -2379,7 +2379,7 @@  discard block
 block discarded – undo
2379 2379
 	public function getAllSourceName($type = '')
2380 2380
 	{
2381 2381
 		$query_values = array();
2382
-		$query  = "SELECT DISTINCT spotter_output.source_name 
2382
+		$query = "SELECT DISTINCT spotter_output.source_name 
2383 2383
 				FROM spotter_output  
2384 2384
 				WHERE spotter_output.source_name <> ''";
2385 2385
 		if ($type != '') {
@@ -2395,7 +2395,7 @@  discard block
 block discarded – undo
2395 2395
 		$source_array = array();
2396 2396
 		$temp_array = array();
2397 2397
 		
2398
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2398
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2399 2399
 		{
2400 2400
 			$temp_array['source_name'] = $row['source_name'];
2401 2401
 			$source_array[] = $temp_array;
@@ -2411,10 +2411,10 @@  discard block
 block discarded – undo
2411 2411
 	* @return Array list of airline names
2412 2412
 	*
2413 2413
 	*/
2414
-	public function getAllAirlineNames($airline_type = '',$forsource = NULL)
2414
+	public function getAllAirlineNames($airline_type = '', $forsource = NULL)
2415 2415
 	{
2416
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2417
-		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
2416
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2417
+		$airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
2418 2418
 		if ($airline_type == '' || $airline_type == 'all') {
2419 2419
 			/*
2420 2420
 			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
@@ -2433,7 +2433,7 @@  discard block
 block discarded – undo
2433 2433
 				$query_data = array(':forsource' => $forsource);
2434 2434
 			}
2435 2435
 		} else {
2436
-			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2436
+			$query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2437 2437
 					FROM spotter_output
2438 2438
 					WHERE spotter_output.airline_icao <> '' 
2439 2439
 					AND spotter_output.airline_type = :airline_type 
@@ -2447,7 +2447,7 @@  discard block
 block discarded – undo
2447 2447
 		$airline_array = array();
2448 2448
 		$temp_array = array();
2449 2449
 		
2450
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2450
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2451 2451
 		{
2452 2452
 			$temp_array['airline_icao'] = $row['airline_icao'];
2453 2453
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -2468,7 +2468,7 @@  discard block
 block discarded – undo
2468 2468
 	public function getAllAirlineCountries()
2469 2469
 	{
2470 2470
 		
2471
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2471
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2472 2472
 				FROM spotter_output  
2473 2473
 				WHERE spotter_output.airline_country <> '' 
2474 2474
 				ORDER BY spotter_output.airline_country ASC";
@@ -2480,7 +2480,7 @@  discard block
 block discarded – undo
2480 2480
 		$airline_array = array();
2481 2481
 		$temp_array = array();
2482 2482
 		
2483
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2483
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2484 2484
 		{
2485 2485
 			$temp_array['airline_country'] = $row['airline_country'];
2486 2486
 
@@ -2502,7 +2502,7 @@  discard block
 block discarded – undo
2502 2502
 	{
2503 2503
 		$airport_array = array();
2504 2504
 
2505
-		$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
2505
+		$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
2506 2506
 				FROM spotter_output 
2507 2507
 				WHERE spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' 
2508 2508
 				ORDER BY spotter_output.departure_airport_city ASC";
@@ -2512,7 +2512,7 @@  discard block
 block discarded – undo
2512 2512
 		$sth->execute();
2513 2513
 
2514 2514
 		$temp_array = array();
2515
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2515
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2516 2516
 		{
2517 2517
 			$temp_array['airport_icao'] = $row['airport_icao'];
2518 2518
 			$temp_array['airport_name'] = $row['airport_name'];
@@ -2522,7 +2522,7 @@  discard block
 block discarded – undo
2522 2522
 			$airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array;
2523 2523
 		}
2524 2524
 
2525
-		$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
2525
+		$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
2526 2526
 								FROM spotter_output 
2527 2527
 								WHERE spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' 
2528 2528
 								ORDER BY spotter_output.arrival_airport_city ASC";
@@ -2530,7 +2530,7 @@  discard block
 block discarded – undo
2530 2530
 		$sth = $this->db->prepare($query);
2531 2531
 		$sth->execute();
2532 2532
 
2533
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2533
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2534 2534
 			{
2535 2535
 		//	if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao'])
2536 2536
 		//	{
@@ -2570,14 +2570,14 @@  discard block
 block discarded – undo
2570 2570
    
2571 2571
 		$temp_array = array();
2572 2572
 		
2573
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2573
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2574 2574
 		{
2575 2575
 			$temp_array['airport_country'] = $row['airport_country'];
2576 2576
 
2577 2577
 			$airport_array[$row['airport_country']] = $temp_array;
2578 2578
 		}
2579 2579
 								
2580
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2580
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2581 2581
 								FROM spotter_output
2582 2582
 								WHERE spotter_output.arrival_airport_country <> '' 
2583 2583
 								ORDER BY spotter_output.arrival_airport_country ASC";
@@ -2585,7 +2585,7 @@  discard block
 block discarded – undo
2585 2585
 		$sth = $this->db->prepare($query);
2586 2586
 		$sth->execute();
2587 2587
 		
2588
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2588
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2589 2589
 		{
2590 2590
 			if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country'])
2591 2591
 			{
@@ -2608,9 +2608,9 @@  discard block
 block discarded – undo
2608 2608
 	*/
2609 2609
 	public function getAllCountries()
2610 2610
 	{
2611
-		$Connection= new Connection($this->db);
2611
+		$Connection = new Connection($this->db);
2612 2612
 		if ($Connection->tableExists('countries')) {
2613
-			$query  = "SELECT countries.name AS airport_country
2613
+			$query = "SELECT countries.name AS airport_country
2614 2614
 				FROM countries
2615 2615
 				ORDER BY countries.name ASC";
2616 2616
 			$sth = $this->db->prepare($query);
@@ -2619,13 +2619,13 @@  discard block
 block discarded – undo
2619 2619
 			$temp_array = array();
2620 2620
 			$country_array = array();
2621 2621
 		
2622
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2622
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2623 2623
 			{
2624 2624
 				$temp_array['country'] = $row['airport_country'];
2625 2625
 				$country_array[$row['airport_country']] = $temp_array;
2626 2626
 			}
2627 2627
 		} else {
2628
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2628
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2629 2629
 								FROM spotter_output
2630 2630
 								WHERE spotter_output.departure_airport_country <> '' 
2631 2631
 								ORDER BY spotter_output.departure_airport_country ASC";
@@ -2635,13 +2635,13 @@  discard block
 block discarded – undo
2635 2635
    
2636 2636
 			$temp_array = array();
2637 2637
 			$country_array = array();
2638
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2638
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2639 2639
 			{
2640 2640
 				$temp_array['country'] = $row['airport_country'];
2641 2641
 				$country_array[$row['airport_country']] = $temp_array;
2642 2642
 			}
2643 2643
 
2644
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2644
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2645 2645
 								FROM spotter_output
2646 2646
 								WHERE spotter_output.arrival_airport_country <> '' 
2647 2647
 								ORDER BY spotter_output.arrival_airport_country ASC";
@@ -2649,7 +2649,7 @@  discard block
 block discarded – undo
2649 2649
 		$sth = $this->db->prepare($query);
2650 2650
 		$sth->execute();
2651 2651
 		
2652
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2652
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2653 2653
 		{
2654 2654
 			if ($country_array[$row['airport_country']]['country'] != $row['airport_country'])
2655 2655
 			{
@@ -2659,7 +2659,7 @@  discard block
 block discarded – undo
2659 2659
 			}
2660 2660
 		}
2661 2661
 		
2662
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2662
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2663 2663
 								FROM spotter_output  
2664 2664
 								WHERE spotter_output.airline_country <> '' 
2665 2665
 								ORDER BY spotter_output.airline_country ASC";
@@ -2667,7 +2667,7 @@  discard block
 block discarded – undo
2667 2667
 		$sth = $this->db->prepare($query);
2668 2668
 		$sth->execute();
2669 2669
 		
2670
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2670
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2671 2671
 		{
2672 2672
 			if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country'])
2673 2673
 			{
@@ -2691,7 +2691,7 @@  discard block
 block discarded – undo
2691 2691
 	*/
2692 2692
 	public function getAllIdents()
2693 2693
 	{
2694
-		$query  = "SELECT DISTINCT spotter_output.ident
2694
+		$query = "SELECT DISTINCT spotter_output.ident
2695 2695
 								FROM spotter_output
2696 2696
 								WHERE spotter_output.ident <> '' 
2697 2697
 								ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0";
@@ -2702,7 +2702,7 @@  discard block
 block discarded – undo
2702 2702
 		$ident_array = array();
2703 2703
 		$temp_array = array();
2704 2704
 		
2705
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2705
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2706 2706
 		{
2707 2707
 			$temp_array['ident'] = $row['ident'];
2708 2708
 			$ident_array[] = $temp_array;
@@ -3038,12 +3038,12 @@  discard block
 block discarded – undo
3038 3038
 		} else $offset = '+00:00';
3039 3039
 
3040 3040
 		if ($globalDBdriver == 'mysql') {
3041
-			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3041
+			$query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3042 3042
 								FROM spotter_output
3043 3043
 								WHERE spotter_output.date <> '' 
3044 3044
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
3045 3045
 		} else {
3046
-			$query  = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3046
+			$query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3047 3047
 								FROM spotter_output
3048 3048
 								WHERE spotter_output.date <> '' 
3049 3049
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
@@ -3055,7 +3055,7 @@  discard block
 block discarded – undo
3055 3055
 		$date_array = array();
3056 3056
 		$temp_array = array();
3057 3057
 		
3058
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3058
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3059 3059
 		{
3060 3060
 			$temp_array['date'] = $row['date'];
3061 3061
 
@@ -3075,7 +3075,7 @@  discard block
 block discarded – undo
3075 3075
 	*/
3076 3076
 	public function getAllRoutes()
3077 3077
 	{
3078
-		$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 
3078
+		$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 
3079 3079
 				FROM spotter_output
3080 3080
 				WHERE spotter_output.ident <> '' 
3081 3081
 				GROUP BY route
@@ -3086,7 +3086,7 @@  discard block
 block discarded – undo
3086 3086
 
3087 3087
 		$routes_array = array();
3088 3088
 		$temp_array = array();
3089
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3089
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3090 3090
 		{
3091 3091
 			$temp_array['route'] = $row['route'];
3092 3092
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -3105,21 +3105,21 @@  discard block
 block discarded – undo
3105 3105
 	* @return String success or false
3106 3106
 	*
3107 3107
 	*/	
3108
-	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3108
+	public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL)
3109 3109
 	{
3110 3110
 		if (!is_numeric(substr($ident, 0, 3)))
3111 3111
 		{
3112 3112
 			if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3113
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3113
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3114 3114
 			} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3115
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3115
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3116 3116
 			} else {
3117 3117
 				$airline_array = $this->getAllAirlineInfo("NA");
3118 3118
 			}
3119 3119
 			if (count($airline_array) == 0) {
3120 3120
 				$airline_array = $this->getAllAirlineInfo("NA");
3121 3121
 			}
3122
-			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3122
+			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3123 3123
 				$airline_array = $this->getAllAirlineInfo("NA");
3124 3124
 			}
3125 3125
 		} else {
@@ -3132,7 +3132,7 @@  discard block
 block discarded – undo
3132 3132
 
3133 3133
 
3134 3134
 		$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';
3135
-                $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);
3135
+                $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);
3136 3136
 
3137 3137
 		try {
3138 3138
 			$sth = $this->db->prepare($query);
@@ -3153,11 +3153,11 @@  discard block
 block discarded – undo
3153 3153
 	* @return String success or false
3154 3154
 	*
3155 3155
 	*/	
3156
-	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3156
+	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '')
3157 3157
 	{
3158 3158
 		if ($groundspeed == '') $groundspeed = NULL;
3159 3159
 		$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';
3160
-                $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);
3160
+                $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);
3161 3161
 
3162 3162
 		try {
3163 3163
 			$sth = $this->db->prepare($query);
@@ -3197,7 +3197,7 @@  discard block
 block discarded – undo
3197 3197
 	* @param String $verticalrate vertival rate of flight
3198 3198
 	* @return String success or false
3199 3199
 	*/
3200
-	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 = '')
3200
+	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 = '')
3201 3201
 	{
3202 3202
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource;
3203 3203
 		
@@ -3220,13 +3220,13 @@  discard block
 block discarded – undo
3220 3220
 				if ($ModeS != '') {
3221 3221
 					$timeelapsed = microtime(true);
3222 3222
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3223
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3223
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3224 3224
 				} else {
3225
-					$myhex = explode('-',$flightaware_id);
3225
+					$myhex = explode('-', $flightaware_id);
3226 3226
 					if (count($myhex) > 0) {
3227 3227
 						$timeelapsed = microtime(true);
3228 3228
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3229
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3229
+						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3230 3230
 					}
3231 3231
 				}
3232 3232
 			}
@@ -3248,24 +3248,24 @@  discard block
 block discarded – undo
3248 3248
 				{
3249 3249
 					$timeelapsed = microtime(true);
3250 3250
 					if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3251
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3251
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3252 3252
 					} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3253
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3253
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3254 3254
 					} else {
3255 3255
 						$airline_array = $this->getAllAirlineInfo("NA");
3256 3256
 					}
3257 3257
 					if (count($airline_array) == 0) {
3258 3258
 						$airline_array = $this->getAllAirlineInfo("NA");
3259 3259
 					}
3260
-					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3260
+					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3261 3261
 						$airline_array = $this->getAllAirlineInfo("NA");
3262 3262
 					}
3263
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3263
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3264 3264
 
3265 3265
 				} else {
3266 3266
 					$timeelapsed = microtime(true);
3267 3267
 					$airline_array = $this->getAllAirlineInfo("NA");
3268
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3268
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3269 3269
 				}
3270 3270
 			}
3271 3271
 		} else $airline_array = array();
@@ -3282,27 +3282,27 @@  discard block
 block discarded – undo
3282 3282
 				{
3283 3283
 					$timeelapsed = microtime(true);
3284 3284
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3285
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3285
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3286 3286
 				} else {
3287 3287
 					$timeelapsed = microtime(true);
3288 3288
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3289
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3289
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3290 3290
 				}
3291 3291
 			}
3292 3292
 		} else {
3293 3293
 			if ($ModeS != '') {
3294 3294
 				$timeelapsed = microtime(true);
3295 3295
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3296
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3296
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3297 3297
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3298 3298
 				{
3299 3299
 					$timeelapsed = microtime(true);
3300 3300
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3301
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3301
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3302 3302
 				} else {
3303 3303
 					$timeelapsed = microtime(true);
3304 3304
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3305
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3305
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3306 3306
 				}
3307 3307
 			}
3308 3308
 		}
@@ -3317,7 +3317,7 @@  discard block
 block discarded – undo
3317 3317
 			} else {
3318 3318
 				$timeelapsed = microtime(true);
3319 3319
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3320
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3320
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3321 3321
 			}
3322 3322
 		}
3323 3323
 		
@@ -3331,7 +3331,7 @@  discard block
 block discarded – undo
3331 3331
 			} else {
3332 3332
 				$timeelapsed = microtime(true);
3333 3333
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3334
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3334
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3335 3335
 			}
3336 3336
 		}
3337 3337
 
@@ -3395,7 +3395,7 @@  discard block
 block discarded – undo
3395 3395
 		{
3396 3396
 			$timeelapsed = microtime(true);
3397 3397
 			$image_array = $Image->getSpotterImage($registration);
3398
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3398
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3399 3399
 			if (!isset($image_array[0]['registration']))
3400 3400
 			{
3401 3401
 				//echo "Add image !!!! \n";
@@ -3403,7 +3403,7 @@  discard block
 block discarded – undo
3403 3403
 			}
3404 3404
 			$timeelapsed = microtime(true);
3405 3405
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3406
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3406
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3407 3407
 			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3408 3408
 		}
3409 3409
     
@@ -3411,33 +3411,33 @@  discard block
 block discarded – undo
3411 3411
 		{
3412 3412
             		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3413 3413
             		else $airline_icao = '';
3414
-			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3414
+			$image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao);
3415 3415
 			if (!isset($image_array[0]['registration']))
3416 3416
 			{
3417 3417
 				//echo "Add image !!!! \n";
3418
-				$Image->addSpotterImage('',$aircraft_icao,$airline_icao);
3418
+				$Image->addSpotterImage('', $aircraft_icao, $airline_icao);
3419 3419
 			}
3420 3420
 		}
3421 3421
     
3422
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
3423
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
3424
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
3425
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3426
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
3427
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
3428
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3429
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3430
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
3431
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3432
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
3433
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3434
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
3435
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
3436
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
3437
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
3438
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
3439
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
3440
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
3422
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
3423
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
3424
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
3425
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3426
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
3427
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
3428
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3429
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3430
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
3431
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3432
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
3433
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3434
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
3435
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
3436
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
3437
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
3438
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
3439
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
3440
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
3441 3441
 	
3442 3442
 		if (count($airline_array) == 0) 
3443 3443
 		{
@@ -3461,7 +3461,7 @@  discard block
 block discarded – undo
3461 3461
                 if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3462 3462
                 if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3463 3463
                 if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3464
-                $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) 
3464
+                $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) 
3465 3465
                 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)";
3466 3466
 
3467 3467
                 $airline_name = $airline_array[0]['name'];
@@ -3471,7 +3471,7 @@  discard block
 block discarded – undo
3471 3471
 		if ($airline_type == '') {
3472 3472
 			$timeelapsed = microtime(true);
3473 3473
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3474
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3474
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3475 3475
 		}
3476 3476
 		if ($airline_type == null) $airline_type = '';
3477 3477
                 $aircraft_type = $aircraft_array[0]['type'];
@@ -3482,7 +3482,7 @@  discard block
 block discarded – undo
3482 3482
                 $arrival_airport_name = $arrival_airport_array[0]['name'];
3483 3483
                 $arrival_airport_city = $arrival_airport_array[0]['city'];
3484 3484
                 $arrival_airport_country = $arrival_airport_array[0]['country'];
3485
-                $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);
3485
+                $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);
3486 3486
 
3487 3487
 		try {
3488 3488
 		        
@@ -3508,13 +3508,13 @@  discard block
 block discarded – undo
3508 3508
 	{
3509 3509
 		global $globalDBdriver, $globalTimezone;
3510 3510
 		if ($globalDBdriver == 'mysql') {
3511
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3511
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3512 3512
 								WHERE spotter_output.ident = :ident 
3513 3513
 								AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
3514 3514
 								AND spotter_output.date < UTC_TIMESTAMP()";
3515 3515
 			$query_data = array(':ident' => $ident);
3516 3516
 		} else {
3517
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3517
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3518 3518
 								WHERE spotter_output.ident = :ident 
3519 3519
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3520 3520
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
@@ -3523,8 +3523,8 @@  discard block
 block discarded – undo
3523 3523
 		
3524 3524
 		$sth = $this->db->prepare($query);
3525 3525
 		$sth->execute($query_data);
3526
-    		$ident_result='';
3527
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3526
+    		$ident_result = '';
3527
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3528 3528
 		{
3529 3529
 			$ident_result = $row['ident'];
3530 3530
 		}
@@ -3550,8 +3550,8 @@  discard block
 block discarded – undo
3550 3550
 				return false;
3551 3551
 			} else {
3552 3552
 				$q_array = explode(" ", $q);
3553
-				foreach ($q_array as $q_item){
3554
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
3553
+				foreach ($q_array as $q_item) {
3554
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
3555 3555
 					$additional_query .= " AND (";
3556 3556
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
3557 3557
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
@@ -3566,11 +3566,11 @@  discard block
 block discarded – undo
3566 3566
 			}
3567 3567
 		}
3568 3568
 		if ($globalDBdriver == 'mysql') {
3569
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3569
+			$query = "SELECT spotter_output.* FROM spotter_output 
3570 3570
 				WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
3571 3571
 				AND spotter_output.date < UTC_TIMESTAMP()";
3572 3572
 		} else {
3573
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3573
+			$query = "SELECT spotter_output.* FROM spotter_output 
3574 3574
 				WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
3575 3575
 				AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
3576 3576
 		}
@@ -3590,7 +3590,7 @@  discard block
 block discarded – undo
3590 3590
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3591 3591
 	{
3592 3592
 		global $globalDBdriver;
3593
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3593
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3594 3594
 		 			FROM spotter_output
3595 3595
 					WHERE spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA' ";
3596 3596
 		if ($olderthanmonths > 0) {
@@ -3615,7 +3615,7 @@  discard block
 block discarded – undo
3615 3615
  
3616 3616
 		$airline_array = array();
3617 3617
 		$temp_array = array();
3618
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3618
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3619 3619
 		{
3620 3620
 			$temp_array['airline_name'] = $row['airline_name'];
3621 3621
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3632,11 +3632,11 @@  discard block
 block discarded – undo
3632 3632
 	* @return Array the pilots list
3633 3633
 	*
3634 3634
 	*/
3635
-	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3635
+	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3636 3636
 	{
3637 3637
 		global $globalDBdriver;
3638
-		$filter_query = $this->getFilter($filters,true,true);
3639
-		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3638
+		$filter_query = $this->getFilter($filters, true, true);
3639
+		$query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3640 3640
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3641 3641
                 if ($olderthanmonths > 0) {
3642 3642
             		if ($globalDBdriver == 'mysql') {
@@ -3662,7 +3662,7 @@  discard block
 block discarded – undo
3662 3662
 		$airline_array = array();
3663 3663
 		$temp_array = array();
3664 3664
         
3665
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3665
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3666 3666
 		{
3667 3667
 			$temp_array['pilot_name'] = $row['pilot_name'];
3668 3668
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -3681,7 +3681,7 @@  discard block
 block discarded – undo
3681 3681
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3682 3682
 	{
3683 3683
 		global $globalDBdriver;
3684
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3684
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3685 3685
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
3686 3686
                 if ($olderthanmonths > 0) {
3687 3687
             		if ($globalDBdriver == 'mysql') {
@@ -3707,7 +3707,7 @@  discard block
 block discarded – undo
3707 3707
 		$airline_array = array();
3708 3708
 		$temp_array = array();
3709 3709
         
3710
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3710
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3711 3711
 		{
3712 3712
 			$temp_array['pilot_name'] = $row['pilot_name'];
3713 3713
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -3724,11 +3724,11 @@  discard block
 block discarded – undo
3724 3724
 	* @return Array the pilots list
3725 3725
 	*
3726 3726
 	*/
3727
-	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3727
+	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3728 3728
 	{
3729 3729
 		global $globalDBdriver;
3730
-		$filter_query = $this->getFilter($filters,true,true);
3731
-		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3730
+		$filter_query = $this->getFilter($filters, true, true);
3731
+		$query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3732 3732
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3733 3733
                 if ($olderthanmonths > 0) {
3734 3734
             		if ($globalDBdriver == 'mysql') {
@@ -3754,7 +3754,7 @@  discard block
 block discarded – undo
3754 3754
 		$airline_array = array();
3755 3755
 		$temp_array = array();
3756 3756
         
3757
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3757
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3758 3758
 		{
3759 3759
 			$temp_array['owner_name'] = $row['owner_name'];
3760 3760
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -3772,7 +3772,7 @@  discard block
 block discarded – undo
3772 3772
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3773 3773
 	{
3774 3774
 		global $globalDBdriver;
3775
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3775
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3776 3776
 		 			FROM spotter_output WHERE spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3777 3777
                 if ($olderthanmonths > 0) {
3778 3778
             		if ($globalDBdriver == 'mysql') {
@@ -3798,7 +3798,7 @@  discard block
 block discarded – undo
3798 3798
 		$airline_array = array();
3799 3799
 		$temp_array = array();
3800 3800
         
3801
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3801
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3802 3802
 		{
3803 3803
 			$temp_array['owner_name'] = $row['owner_name'];
3804 3804
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -3816,9 +3816,9 @@  discard block
 block discarded – undo
3816 3816
 	*/
3817 3817
 	public function countAllAirlinesByAircraft($aircraft_icao)
3818 3818
 	{
3819
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3819
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3820 3820
 
3821
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3821
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3822 3822
 		 			FROM spotter_output
3823 3823
 					WHERE spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
3824 3824
                     GROUP BY spotter_output.airline_name
@@ -3831,7 +3831,7 @@  discard block
 block discarded – undo
3831 3831
 		$airline_array = array();
3832 3832
 		$temp_array = array();
3833 3833
         
3834
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3834
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3835 3835
 		{
3836 3836
 			$temp_array['airline_name'] = $row['airline_name'];
3837 3837
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3853,9 +3853,9 @@  discard block
 block discarded – undo
3853 3853
 	*/
3854 3854
 	public function countAllAirlineCountriesByAircraft($aircraft_icao)
3855 3855
 	{
3856
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3856
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3857 3857
       
3858
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3858
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3859 3859
 		 			FROM spotter_output
3860 3860
 					WHERE spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
3861 3861
                     GROUP BY spotter_output.airline_country
@@ -3869,7 +3869,7 @@  discard block
 block discarded – undo
3869 3869
 		$airline_country_array = array();
3870 3870
 		$temp_array = array();
3871 3871
         
3872
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3872
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3873 3873
 		{
3874 3874
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
3875 3875
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -3890,9 +3890,9 @@  discard block
 block discarded – undo
3890 3890
 	*/
3891 3891
 	public function countAllAirlinesByAirport($airport_icao)
3892 3892
 	{
3893
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
3893
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
3894 3894
 
3895
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3895
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3896 3896
 		 			FROM spotter_output
3897 3897
 					WHERE spotter_output.airline_name <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao ) 
3898 3898
                     GROUP BY spotter_output.airline_name
@@ -3905,7 +3905,7 @@  discard block
 block discarded – undo
3905 3905
 		$airline_array = array();
3906 3906
 		$temp_array = array();
3907 3907
         
3908
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3908
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3909 3909
 		{
3910 3910
 			$temp_array['airline_name'] = $row['airline_name'];
3911 3911
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3926,9 +3926,9 @@  discard block
 block discarded – undo
3926 3926
 	*/
3927 3927
 	public function countAllAirlineCountriesByAirport($airport_icao)
3928 3928
 	{
3929
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
3929
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
3930 3930
       
3931
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3931
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3932 3932
 		 			FROM spotter_output
3933 3933
 					WHERE spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao )
3934 3934
 					GROUP BY spotter_output.airline_country
@@ -3942,7 +3942,7 @@  discard block
 block discarded – undo
3942 3942
 		$airline_country_array = array();
3943 3943
 		$temp_array = array();
3944 3944
         
3945
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3945
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3946 3946
 		{
3947 3947
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
3948 3948
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -3961,9 +3961,9 @@  discard block
 block discarded – undo
3961 3961
 	*/
3962 3962
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer)
3963 3963
 	{
3964
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
3964
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
3965 3965
 
3966
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3966
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3967 3967
 		 			FROM spotter_output
3968 3968
 					WHERE spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
3969 3969
 					GROUP BY spotter_output.airline_name
@@ -3975,7 +3975,7 @@  discard block
 block discarded – undo
3975 3975
 		$airline_array = array();
3976 3976
 		$temp_array = array();
3977 3977
         
3978
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3978
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3979 3979
 		{
3980 3980
 			$temp_array['airline_name'] = $row['airline_name'];
3981 3981
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3997,9 +3997,9 @@  discard block
 block discarded – undo
3997 3997
 	*/
3998 3998
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer)
3999 3999
 	{
4000
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4000
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4001 4001
       
4002
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4002
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4003 4003
 		 			FROM spotter_output
4004 4004
 					WHERE spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4005 4005
 					GROUP BY spotter_output.airline_country
@@ -4013,7 +4013,7 @@  discard block
 block discarded – undo
4013 4013
 		$airline_country_array = array();
4014 4014
 		$temp_array = array();
4015 4015
         
4016
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4016
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4017 4017
 		{
4018 4018
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4019 4019
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4032,7 +4032,7 @@  discard block
 block discarded – undo
4032 4032
 	public function countAllAirlinesByDate($date)
4033 4033
 	{
4034 4034
 		global $globalTimezone, $globalDBdriver;
4035
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4035
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4036 4036
 
4037 4037
 		if ($globalTimezone != '') {
4038 4038
 			date_default_timezone_set($globalTimezone);
@@ -4041,13 +4041,13 @@  discard block
 block discarded – undo
4041 4041
 		} else $offset = '+00:00';
4042 4042
 
4043 4043
 		if ($globalDBdriver == 'mysql') {
4044
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4044
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4045 4045
 		 			FROM spotter_output
4046 4046
 					WHERE DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4047 4047
 					GROUP BY spotter_output.airline_name
4048 4048
 					ORDER BY airline_count DESC";
4049 4049
 		} else {
4050
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4050
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4051 4051
 		 			FROM spotter_output
4052 4052
 					WHERE to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4053 4053
 					GROUP BY spotter_output.airline_name
@@ -4059,7 +4059,7 @@  discard block
 block discarded – undo
4059 4059
 
4060 4060
 		$airline_array = array();
4061 4061
 		$temp_array = array();
4062
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4062
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4063 4063
 		{
4064 4064
 			$temp_array['airline_name'] = $row['airline_name'];
4065 4065
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4082,7 +4082,7 @@  discard block
 block discarded – undo
4082 4082
 	public function countAllAirlineCountriesByDate($date)
4083 4083
 	{
4084 4084
 		global $globalTimezone, $globalDBdriver;
4085
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4085
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4086 4086
 		if ($globalTimezone != '') {
4087 4087
 			date_default_timezone_set($globalTimezone);
4088 4088
 			$datetime = new DateTime($date);
@@ -4090,14 +4090,14 @@  discard block
 block discarded – undo
4090 4090
 		} else $offset = '+00:00';
4091 4091
 		
4092 4092
 		if ($globalDBdriver == 'mysql') {
4093
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4093
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4094 4094
 		 			FROM spotter_output
4095 4095
 					WHERE spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4096 4096
 					GROUP BY spotter_output.airline_country
4097 4097
 					ORDER BY airline_country_count DESC
4098 4098
 					LIMIT 10 OFFSET 0";
4099 4099
 		} else {
4100
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4100
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4101 4101
 		 			FROM spotter_output
4102 4102
 					WHERE spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4103 4103
 					GROUP BY spotter_output.airline_country
@@ -4110,7 +4110,7 @@  discard block
 block discarded – undo
4110 4110
  
4111 4111
 		$airline_country_array = array();
4112 4112
 		$temp_array = array();
4113
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4113
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4114 4114
 		{
4115 4115
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4116 4116
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4129,9 +4129,9 @@  discard block
 block discarded – undo
4129 4129
 	*/
4130 4130
 	public function countAllAirlinesByIdent($ident)
4131 4131
 	{
4132
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4132
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4133 4133
 
4134
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4134
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4135 4135
 		 		FROM spotter_output
4136 4136
 				WHERE spotter_output.ident = :ident  
4137 4137
 				GROUP BY spotter_output.airline_name
@@ -4144,7 +4144,7 @@  discard block
 block discarded – undo
4144 4144
 		$airline_array = array();
4145 4145
 		$temp_array = array();
4146 4146
         
4147
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4147
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4148 4148
 		{
4149 4149
 			$temp_array['airline_name'] = $row['airline_name'];
4150 4150
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4164,10 +4164,10 @@  discard block
 block discarded – undo
4164 4164
 	*/
4165 4165
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao)
4166 4166
 	{
4167
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4168
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4167
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4168
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4169 4169
 
4170
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4170
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4171 4171
 		 			FROM spotter_output
4172 4172
 					WHERE (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4173 4173
 					GROUP BY spotter_output.airline_name
@@ -4175,12 +4175,12 @@  discard block
 block discarded – undo
4175 4175
       
4176 4176
 		
4177 4177
 		$sth = $this->db->prepare($query);
4178
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4178
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4179 4179
       
4180 4180
 		$airline_array = array();
4181 4181
 		$temp_array = array();
4182 4182
         
4183
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4183
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4184 4184
 		{
4185 4185
 			$temp_array['airline_name'] = $row['airline_name'];
4186 4186
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4200,10 +4200,10 @@  discard block
 block discarded – undo
4200 4200
 	*/
4201 4201
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao)
4202 4202
 	{
4203
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4204
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4203
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4204
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4205 4205
       
4206
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4206
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4207 4207
 		 		FROM spotter_output
4208 4208
 				WHERE spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4209 4209
 				GROUP BY spotter_output.airline_country
@@ -4212,11 +4212,11 @@  discard block
 block discarded – undo
4212 4212
       
4213 4213
 		
4214 4214
 		$sth = $this->db->prepare($query);
4215
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4215
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4216 4216
       
4217 4217
 		$airline_country_array = array();
4218 4218
 		$temp_array = array();
4219
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4219
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4220 4220
 		{
4221 4221
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4222 4222
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4236,9 +4236,9 @@  discard block
 block discarded – undo
4236 4236
 	*/
4237 4237
 	public function countAllAirlinesByCountry($country)
4238 4238
 	{
4239
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4239
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4240 4240
 
4241
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4241
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4242 4242
 		 		FROM spotter_output
4243 4243
 				WHERE ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
4244 4244
 				GROUP BY spotter_output.airline_name
@@ -4250,7 +4250,7 @@  discard block
 block discarded – undo
4250 4250
 
4251 4251
 		$airline_array = array();
4252 4252
 		$temp_array = array();
4253
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4253
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4254 4254
 		{
4255 4255
 			$temp_array['airline_name'] = $row['airline_name'];
4256 4256
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4271,9 +4271,9 @@  discard block
 block discarded – undo
4271 4271
 	*/
4272 4272
 	public function countAllAirlineCountriesByCountry($country)
4273 4273
 	{
4274
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4274
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4275 4275
       
4276
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4276
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4277 4277
 		 		FROM spotter_output
4278 4278
 				WHERE spotter_output.airline_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
4279 4279
 				GROUP BY spotter_output.airline_country
@@ -4286,7 +4286,7 @@  discard block
 block discarded – undo
4286 4286
 
4287 4287
 		$airline_country_array = array();
4288 4288
 		$temp_array = array();
4289
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4289
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4290 4290
 		{
4291 4291
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4292 4292
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4305,7 +4305,7 @@  discard block
 block discarded – undo
4305 4305
 	*/
4306 4306
 	public function countAllAirlineCountries($limit = true)
4307 4307
 	{
4308
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4308
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4309 4309
 		 			FROM spotter_output
4310 4310
 					WHERE spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' 
4311 4311
 					GROUP BY spotter_output.airline_country
@@ -4317,7 +4317,7 @@  discard block
 block discarded – undo
4317 4317
 
4318 4318
 		$airline_array = array();
4319 4319
 		$temp_array = array();
4320
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4320
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4321 4321
 		{
4322 4322
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4323 4323
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4333,10 +4333,10 @@  discard block
 block discarded – undo
4333 4333
 	* @return Array the airline country list
4334 4334
 	*
4335 4335
 	*/
4336
-	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
4336
+	public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '')
4337 4337
 	{
4338 4338
 		global $globalDBdriver;
4339
-		$Connection= new Connection($this->db);
4339
+		$Connection = new Connection($this->db);
4340 4340
 		if (!$Connection->tableExists('countries')) return array();
4341 4341
 		/*
4342 4342
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -4371,7 +4371,7 @@  discard block
 block discarded – undo
4371 4371
 		$flight_array = array();
4372 4372
 		$temp_array = array();
4373 4373
         
4374
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4374
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4375 4375
 		{
4376 4376
 			$temp_array['flight_count'] = $row['nb'];
4377 4377
 			$temp_array['flight_country'] = $row['name'];
@@ -4389,12 +4389,12 @@  discard block
 block discarded – undo
4389 4389
 	* @return Array the aircraft list
4390 4390
 	*
4391 4391
 	*/
4392
-	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4392
+	public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4393 4393
 	{
4394 4394
 		global $globalDBdriver;
4395
-		$filter_query = $this->getFilter($filters,true,true);
4395
+		$filter_query = $this->getFilter($filters, true, true);
4396 4396
 
4397
-		$query  = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4397
+		$query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4398 4398
 		    FROM spotter_output ".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> ''";
4399 4399
 		if ($olderthanmonths > 0) {
4400 4400
 			if ($globalDBdriver == 'mysql') {
@@ -4419,7 +4419,7 @@  discard block
 block discarded – undo
4419 4419
 
4420 4420
 		$aircraft_array = array();
4421 4421
 		$temp_array = array();
4422
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4422
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4423 4423
 		{
4424 4424
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4425 4425
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4436,10 +4436,10 @@  discard block
 block discarded – undo
4436 4436
 	* @return Array the aircraft list
4437 4437
 	*
4438 4438
 	*/
4439
-	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
4439
+	public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
4440 4440
 	{
4441 4441
 		global $globalDBdriver;
4442
-		$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 
4442
+		$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 
4443 4443
 		    FROM spotter_output
4444 4444
 		    WHERE spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA' ";
4445 4445
 		if ($olderthanmonths > 0) {
@@ -4465,7 +4465,7 @@  discard block
 block discarded – undo
4465 4465
 
4466 4466
 		$aircraft_array = array();
4467 4467
 		$temp_array = array();
4468
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4468
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4469 4469
 		{
4470 4470
 			$temp_array['airline_icao'] = $row['airline_icao'];
4471 4471
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -4487,9 +4487,9 @@  discard block
 block discarded – undo
4487 4487
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao)
4488 4488
 	{
4489 4489
 		$Image = new Image($this->db);
4490
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4490
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4491 4491
 
4492
-		$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  
4492
+		$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  
4493 4493
 				FROM spotter_output
4494 4494
 				WHERE spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao  
4495 4495
 				GROUP BY spotter_output.registration 
@@ -4501,14 +4501,14 @@  discard block
 block discarded – undo
4501 4501
 		$aircraft_array = array();
4502 4502
 		$temp_array = array();
4503 4503
         
4504
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4504
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4505 4505
 		{
4506 4506
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4507 4507
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4508 4508
 			$temp_array['registration'] = $row['registration'];
4509 4509
 			$temp_array['airline_name'] = $row['airline_name'];
4510 4510
 			$temp_array['image_thumbnail'] = "";
4511
-			if($row['registration'] != "")
4511
+			if ($row['registration'] != "")
4512 4512
 			{
4513 4513
 				$image_array = $Image->getSpotterImage($row['registration']);
4514 4514
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4529,9 +4529,9 @@  discard block
 block discarded – undo
4529 4529
 	*/
4530 4530
 	public function countAllAircraftTypesByAirline($airline_icao)
4531 4531
 	{
4532
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4532
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4533 4533
 
4534
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4534
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4535 4535
 				FROM spotter_output
4536 4536
 				WHERE spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao 
4537 4537
 				GROUP BY spotter_output.aircraft_name 
@@ -4543,7 +4543,7 @@  discard block
 block discarded – undo
4543 4543
 		$aircraft_array = array();
4544 4544
 		$temp_array = array();
4545 4545
 
4546
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4546
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4547 4547
 		{
4548 4548
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4549 4549
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4564,9 +4564,9 @@  discard block
 block discarded – undo
4564 4564
 	public function countAllAircraftRegistrationByAirline($airline_icao)
4565 4565
 	{
4566 4566
 		$Image = new Image($this->db);
4567
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4567
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4568 4568
 
4569
-		$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   
4569
+		$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   
4570 4570
 				FROM spotter_output
4571 4571
 				WHERE spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao 
4572 4572
 				GROUP BY spotter_output.registration 
@@ -4577,14 +4577,14 @@  discard block
 block discarded – undo
4577 4577
 
4578 4578
 		$aircraft_array = array();
4579 4579
 		$temp_array = array();
4580
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4580
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4581 4581
 		{
4582 4582
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4583 4583
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4584 4584
 			$temp_array['registration'] = $row['registration'];
4585 4585
 			$temp_array['airline_name'] = $row['airline_name'];
4586 4586
 			$temp_array['image_thumbnail'] = "";
4587
-			if($row['registration'] != "")
4587
+			if ($row['registration'] != "")
4588 4588
 			{
4589 4589
 				$image_array = $Image->getSpotterImage($row['registration']);
4590 4590
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4605,9 +4605,9 @@  discard block
 block discarded – undo
4605 4605
 	*/
4606 4606
 	public function countAllAircraftManufacturerByAirline($airline_icao)
4607 4607
 	{
4608
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4608
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4609 4609
 
4610
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4610
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4611 4611
 				FROM spotter_output
4612 4612
 				WHERE spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao 
4613 4613
 				GROUP BY spotter_output.aircraft_manufacturer 
@@ -4619,7 +4619,7 @@  discard block
 block discarded – undo
4619 4619
 		$aircraft_array = array();
4620 4620
 		$temp_array = array();
4621 4621
 
4622
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4622
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4623 4623
 		{
4624 4624
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4625 4625
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4638,9 +4638,9 @@  discard block
 block discarded – undo
4638 4638
 	*/
4639 4639
 	public function countAllAircraftTypesByAirport($airport_icao)
4640 4640
 	{
4641
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4641
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4642 4642
 
4643
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4643
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4644 4644
 				FROM spotter_output
4645 4645
 				WHERE spotter_output.aircraft_icao <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) 
4646 4646
 				GROUP BY spotter_output.aircraft_name 
@@ -4651,7 +4651,7 @@  discard block
 block discarded – undo
4651 4651
 
4652 4652
 		$aircraft_array = array();
4653 4653
 		$temp_array = array();
4654
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4654
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4655 4655
 		{
4656 4656
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4657 4657
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4672,9 +4672,9 @@  discard block
 block discarded – undo
4672 4672
 	public function countAllAircraftRegistrationByAirport($airport_icao)
4673 4673
 	{
4674 4674
 		$Image = new Image($this->db);
4675
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4675
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4676 4676
 
4677
-		$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  
4677
+		$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  
4678 4678
                     FROM spotter_output
4679 4679
                     WHERE spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)   
4680 4680
                     GROUP BY spotter_output.registration 
@@ -4686,14 +4686,14 @@  discard block
 block discarded – undo
4686 4686
 
4687 4687
 		$aircraft_array = array();
4688 4688
 		$temp_array = array();
4689
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4689
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4690 4690
 		{
4691 4691
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4692 4692
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4693 4693
 			$temp_array['registration'] = $row['registration'];
4694 4694
 			$temp_array['airline_name'] = $row['airline_name'];
4695 4695
 			$temp_array['image_thumbnail'] = "";
4696
-			if($row['registration'] != "")
4696
+			if ($row['registration'] != "")
4697 4697
 			{
4698 4698
 				$image_array = $Image->getSpotterImage($row['registration']);
4699 4699
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4713,9 +4713,9 @@  discard block
 block discarded – undo
4713 4713
 	*/
4714 4714
 	public function countAllAircraftManufacturerByAirport($airport_icao)
4715 4715
 	{
4716
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4716
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4717 4717
 
4718
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4718
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4719 4719
                     FROM spotter_output
4720 4720
                     WHERE spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)  
4721 4721
                     GROUP BY spotter_output.aircraft_manufacturer 
@@ -4727,7 +4727,7 @@  discard block
 block discarded – undo
4727 4727
 
4728 4728
 		$aircraft_array = array();
4729 4729
 		$temp_array = array();
4730
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4730
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4731 4731
 		{
4732 4732
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4733 4733
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4744,9 +4744,9 @@  discard block
 block discarded – undo
4744 4744
 	*/
4745 4745
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer)
4746 4746
 	{
4747
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4747
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4748 4748
 
4749
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4749
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4750 4750
                     FROM spotter_output
4751 4751
                     WHERE spotter_output.aircraft_manufacturer = :aircraft_manufacturer
4752 4752
                     GROUP BY spotter_output.aircraft_name 
@@ -4756,7 +4756,7 @@  discard block
 block discarded – undo
4756 4756
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
4757 4757
 		$aircraft_array = array();
4758 4758
 		$temp_array = array();
4759
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4759
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4760 4760
 		{
4761 4761
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4762 4762
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4776,9 +4776,9 @@  discard block
 block discarded – undo
4776 4776
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer)
4777 4777
 	{
4778 4778
 		$Image = new Image($this->db);
4779
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4779
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4780 4780
 
4781
-		$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   
4781
+		$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   
4782 4782
                     FROM spotter_output
4783 4783
                     WHERE spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
4784 4784
                     GROUP BY spotter_output.registration 
@@ -4789,14 +4789,14 @@  discard block
 block discarded – undo
4789 4789
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
4790 4790
 		$aircraft_array = array();
4791 4791
 		$temp_array = array();
4792
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4792
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4793 4793
 		{
4794 4794
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4795 4795
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4796 4796
 			$temp_array['registration'] = $row['registration'];
4797 4797
 			$temp_array['airline_name'] = $row['airline_name'];
4798 4798
 			$temp_array['image_thumbnail'] = "";
4799
-			if($row['registration'] != "")
4799
+			if ($row['registration'] != "")
4800 4800
 			{
4801 4801
 				$image_array = $Image->getSpotterImage($row['registration']);
4802 4802
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4816,7 +4816,7 @@  discard block
 block discarded – undo
4816 4816
 	public function countAllAircraftTypesByDate($date)
4817 4817
 	{
4818 4818
 		global $globalTimezone, $globalDBdriver;
4819
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4819
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4820 4820
 		if ($globalTimezone != '') {
4821 4821
 			date_default_timezone_set($globalTimezone);
4822 4822
 			$datetime = new DateTime($date);
@@ -4824,13 +4824,13 @@  discard block
 block discarded – undo
4824 4824
 		} else $offset = '+00:00';
4825 4825
 
4826 4826
 		if ($globalDBdriver == 'mysql') {
4827
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4827
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4828 4828
 					FROM spotter_output
4829 4829
 					WHERE DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
4830 4830
 					GROUP BY spotter_output.aircraft_name 
4831 4831
 					ORDER BY aircraft_icao_count DESC";
4832 4832
 		} else {
4833
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4833
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4834 4834
 					FROM spotter_output
4835 4835
 					WHERE to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
4836 4836
 					GROUP BY spotter_output.aircraft_name 
@@ -4842,7 +4842,7 @@  discard block
 block discarded – undo
4842 4842
 
4843 4843
 		$aircraft_array = array();
4844 4844
 		$temp_array = array();
4845
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4845
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4846 4846
 		{
4847 4847
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4848 4848
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4864,7 +4864,7 @@  discard block
 block discarded – undo
4864 4864
 	{
4865 4865
 		global $globalTimezone, $globalDBdriver;
4866 4866
 		$Image = new Image($this->db);
4867
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4867
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4868 4868
 		if ($globalTimezone != '') {
4869 4869
 			date_default_timezone_set($globalTimezone);
4870 4870
 			$datetime = new DateTime($date);
@@ -4872,13 +4872,13 @@  discard block
 block discarded – undo
4872 4872
 		} else $offset = '+00:00';
4873 4873
 
4874 4874
 		if ($globalDBdriver == 'mysql') {
4875
-			$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    
4875
+			$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    
4876 4876
 					FROM spotter_output
4877 4877
 					WHERE spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4878 4878
 					GROUP BY spotter_output.registration 
4879 4879
 					ORDER BY registration_count DESC";
4880 4880
 		} else {
4881
-			$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    
4881
+			$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    
4882 4882
 					FROM spotter_output
4883 4883
 					WHERE spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4884 4884
 					GROUP BY spotter_output.registration 
@@ -4890,14 +4890,14 @@  discard block
 block discarded – undo
4890 4890
 
4891 4891
 		$aircraft_array = array();
4892 4892
 		$temp_array = array();
4893
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4893
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4894 4894
 		{
4895 4895
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4896 4896
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4897 4897
 			$temp_array['registration'] = $row['registration'];
4898 4898
 			$temp_array['airline_name'] = $row['airline_name'];
4899 4899
 			$temp_array['image_thumbnail'] = "";
4900
-			if($row['registration'] != "")
4900
+			if ($row['registration'] != "")
4901 4901
 			{
4902 4902
 				$image_array = $Image->getSpotterImage($row['registration']);
4903 4903
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4919,7 +4919,7 @@  discard block
 block discarded – undo
4919 4919
 	public function countAllAircraftManufacturerByDate($date)
4920 4920
 	{
4921 4921
 		global $globalTimezone, $globalDBdriver;
4922
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4922
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4923 4923
 		if ($globalTimezone != '') {
4924 4924
 			date_default_timezone_set($globalTimezone);
4925 4925
 			$datetime = new DateTime($date);
@@ -4927,13 +4927,13 @@  discard block
 block discarded – undo
4927 4927
 		} else $offset = '+00:00';
4928 4928
 
4929 4929
 		if ($globalDBdriver == 'mysql') {
4930
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4930
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4931 4931
 				FROM spotter_output
4932 4932
 				WHERE spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4933 4933
 				GROUP BY spotter_output.aircraft_manufacturer 
4934 4934
 				ORDER BY aircraft_manufacturer_count DESC";
4935 4935
 		} else {
4936
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4936
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4937 4937
 				FROM spotter_output
4938 4938
 				WHERE spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4939 4939
 				GROUP BY spotter_output.aircraft_manufacturer 
@@ -4946,7 +4946,7 @@  discard block
 block discarded – undo
4946 4946
 		$aircraft_array = array();
4947 4947
 		$temp_array = array();
4948 4948
 
4949
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4949
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4950 4950
 		{
4951 4951
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4952 4952
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4965,9 +4965,9 @@  discard block
 block discarded – undo
4965 4965
 	*/
4966 4966
 	public function countAllAircraftTypesByIdent($ident)
4967 4967
 	{
4968
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4968
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4969 4969
 
4970
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4970
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4971 4971
 				FROM spotter_output
4972 4972
 				WHERE spotter_output.ident = :ident 
4973 4973
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
@@ -4979,7 +4979,7 @@  discard block
 block discarded – undo
4979 4979
 		$aircraft_array = array();
4980 4980
 		$temp_array = array();
4981 4981
 
4982
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4982
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4983 4983
 		{
4984 4984
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4985 4985
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5000,9 +5000,9 @@  discard block
 block discarded – undo
5000 5000
 	public function countAllAircraftRegistrationByIdent($ident)
5001 5001
 	{
5002 5002
 		$Image = new Image($this->db);
5003
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5003
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5004 5004
 
5005
-		$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  
5005
+		$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  
5006 5006
                     FROM spotter_output
5007 5007
                     WHERE spotter_output.registration <> '' AND spotter_output.ident = :ident   
5008 5008
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
@@ -5015,14 +5015,14 @@  discard block
 block discarded – undo
5015 5015
 		$aircraft_array = array();
5016 5016
 		$temp_array = array();
5017 5017
         
5018
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5018
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5019 5019
 		{
5020 5020
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5021 5021
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5022 5022
 			$temp_array['registration'] = $row['registration'];
5023 5023
 			$temp_array['airline_name'] = $row['airline_name'];
5024 5024
 			$temp_array['image_thumbnail'] = "";
5025
-			if($row['registration'] != "")
5025
+			if ($row['registration'] != "")
5026 5026
 			{
5027 5027
 				$image_array = $Image->getSpotterImage($row['registration']);
5028 5028
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5043,9 +5043,9 @@  discard block
 block discarded – undo
5043 5043
 	*/
5044 5044
 	public function countAllAircraftManufacturerByIdent($ident)
5045 5045
 	{
5046
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5046
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5047 5047
 
5048
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5048
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5049 5049
                     FROM spotter_output
5050 5050
                     WHERE spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident  
5051 5051
                     GROUP BY spotter_output.aircraft_manufacturer 
@@ -5056,7 +5056,7 @@  discard block
 block discarded – undo
5056 5056
 		$sth->execute(array(':ident' => $ident));
5057 5057
 		$aircraft_array = array();
5058 5058
 		$temp_array = array();
5059
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5059
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5060 5060
 		{
5061 5061
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5062 5062
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5074,11 +5074,11 @@  discard block
 block discarded – undo
5074 5074
 	*/
5075 5075
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao)
5076 5076
 	{
5077
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5078
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5077
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5078
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5079 5079
 		
5080 5080
 
5081
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5081
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5082 5082
                     FROM spotter_output
5083 5083
                     WHERE (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
5084 5084
                     GROUP BY spotter_output.aircraft_name 
@@ -5086,10 +5086,10 @@  discard block
 block discarded – undo
5086 5086
  
5087 5087
 		
5088 5088
 		$sth = $this->db->prepare($query);
5089
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5089
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5090 5090
 		$aircraft_array = array();
5091 5091
 		$temp_array = array();
5092
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5092
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5093 5093
 		{
5094 5094
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5095 5095
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5108,10 +5108,10 @@  discard block
 block discarded – undo
5108 5108
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao)
5109 5109
 	{
5110 5110
 		$Image = new Image($this->db);
5111
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5112
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5111
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5112
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5113 5113
 
5114
-		$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   
5114
+		$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   
5115 5115
                     FROM spotter_output
5116 5116
                     WHERE spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)   
5117 5117
                     GROUP BY spotter_output.registration 
@@ -5119,19 +5119,19 @@  discard block
 block discarded – undo
5119 5119
 
5120 5120
 		
5121 5121
 		$sth = $this->db->prepare($query);
5122
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5122
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5123 5123
       
5124 5124
 		$aircraft_array = array();
5125 5125
 		$temp_array = array();
5126 5126
         
5127
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5127
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5128 5128
 		{
5129 5129
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5130 5130
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5131 5131
 			$temp_array['registration'] = $row['registration'];
5132 5132
 			$temp_array['airline_name'] = $row['airline_name'];
5133 5133
 			$temp_array['image_thumbnail'] = "";
5134
-			if($row['registration'] != "")
5134
+			if ($row['registration'] != "")
5135 5135
 			{
5136 5136
 				$image_array = $Image->getSpotterImage($row['registration']);
5137 5137
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5153,10 +5153,10 @@  discard block
 block discarded – undo
5153 5153
 	*/
5154 5154
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao)
5155 5155
 	{
5156
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5157
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5156
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5157
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5158 5158
 
5159
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5159
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5160 5160
                     FROM spotter_output
5161 5161
                     WHERE spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
5162 5162
                     GROUP BY spotter_output.aircraft_manufacturer 
@@ -5164,12 +5164,12 @@  discard block
 block discarded – undo
5164 5164
 
5165 5165
 		
5166 5166
 		$sth = $this->db->prepare($query);
5167
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5167
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5168 5168
       
5169 5169
 		$aircraft_array = array();
5170 5170
 		$temp_array = array();
5171 5171
         
5172
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5172
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5173 5173
 		{
5174 5174
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5175 5175
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5191,9 +5191,9 @@  discard block
 block discarded – undo
5191 5191
 	*/
5192 5192
 	public function countAllAircraftTypesByCountry($country)
5193 5193
 	{
5194
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5194
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5195 5195
 
5196
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5196
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5197 5197
                     FROM spotter_output
5198 5198
                     WHERE ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
5199 5199
                     GROUP BY spotter_output.aircraft_name 
@@ -5206,7 +5206,7 @@  discard block
 block discarded – undo
5206 5206
 		$aircraft_array = array();
5207 5207
 		$temp_array = array();
5208 5208
         
5209
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5209
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5210 5210
 		{
5211 5211
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5212 5212
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5228,9 +5228,9 @@  discard block
 block discarded – undo
5228 5228
 	public function countAllAircraftRegistrationByCountry($country)
5229 5229
 	{
5230 5230
 		$Image = new Image($this->db);
5231
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5231
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5232 5232
 
5233
-		$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 
5233
+		$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 
5234 5234
                     FROM spotter_output
5235 5235
                     WHERE spotter_output.registration <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country)    
5236 5236
                     GROUP BY spotter_output.registration 
@@ -5243,14 +5243,14 @@  discard block
 block discarded – undo
5243 5243
 		$aircraft_array = array();
5244 5244
 		$temp_array = array();
5245 5245
         
5246
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5246
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5247 5247
 		{
5248 5248
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5249 5249
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5250 5250
 			$temp_array['registration'] = $row['registration'];
5251 5251
 			$temp_array['airline_name'] = $row['airline_name'];
5252 5252
 			$temp_array['image_thumbnail'] = "";
5253
-			if($row['registration'] != "")
5253
+			if ($row['registration'] != "")
5254 5254
 			{
5255 5255
 				$image_array = $Image->getSpotterImage($row['registration']);
5256 5256
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5272,9 +5272,9 @@  discard block
 block discarded – undo
5272 5272
 	*/
5273 5273
 	public function countAllAircraftManufacturerByCountry($country)
5274 5274
 	{
5275
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5275
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5276 5276
 
5277
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5277
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5278 5278
                     FROM spotter_output
5279 5279
                     WHERE spotter_output.aircraft_manufacturer <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country) 
5280 5280
                     GROUP BY spotter_output.aircraft_manufacturer 
@@ -5287,7 +5287,7 @@  discard block
 block discarded – undo
5287 5287
 		$aircraft_array = array();
5288 5288
 		$temp_array = array();
5289 5289
         
5290
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5290
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5291 5291
 		{
5292 5292
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5293 5293
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5308,8 +5308,8 @@  discard block
 block discarded – undo
5308 5308
 	*/
5309 5309
 	public function countAllAircraftManufacturers($filter = array())
5310 5310
 	{
5311
-		$filter_query = $this->getFilter($filter,true,true);
5312
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5311
+		$filter_query = $this->getFilter($filter, true, true);
5312
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5313 5313
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5314 5314
                 $query .= " GROUP BY spotter_output.aircraft_manufacturer
5315 5315
 					ORDER BY aircraft_manufacturer_count DESC
@@ -5322,7 +5322,7 @@  discard block
 block discarded – undo
5322 5322
 		$manufacturer_array = array();
5323 5323
 		$temp_array = array();
5324 5324
         
5325
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5325
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5326 5326
 		{
5327 5327
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5328 5328
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5341,12 +5341,12 @@  discard block
 block discarded – undo
5341 5341
 	* @return Array the aircraft list
5342 5342
 	*
5343 5343
 	*/
5344
-	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5344
+	public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5345 5345
 	{
5346 5346
 		global $globalDBdriver;
5347 5347
 		$Image = new Image($this->db);
5348
-		$filter_query = $this->getFilter($filters,true,true);
5349
-		$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    
5348
+		$filter_query = $this->getFilter($filters, true, true);
5349
+		$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    
5350 5350
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5351 5351
                 if ($olderthanmonths > 0) {
5352 5352
             		if ($globalDBdriver == 'mysql') {
@@ -5374,7 +5374,7 @@  discard block
 block discarded – undo
5374 5374
 		$aircraft_array = array();
5375 5375
 		$temp_array = array();
5376 5376
         
5377
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5377
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5378 5378
 		{
5379 5379
 			$temp_array['registration'] = $row['registration'];
5380 5380
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -5382,7 +5382,7 @@  discard block
 block discarded – undo
5382 5382
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5383 5383
 			$temp_array['airline_name'] = $row['airline_name'];
5384 5384
 			$temp_array['image_thumbnail'] = "";
5385
-			if($row['registration'] != "")
5385
+			if ($row['registration'] != "")
5386 5386
 			{
5387 5387
 				$image_array = $Image->getSpotterImage($row['registration']);
5388 5388
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5401,11 +5401,11 @@  discard block
 block discarded – undo
5401 5401
 	* @return Array the aircraft list
5402 5402
 	*
5403 5403
 	*/
5404
-	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
5404
+	public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
5405 5405
 	{
5406 5406
 		global $globalDBdriver;
5407 5407
 		$Image = new Image($this->db);
5408
-		$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    
5408
+		$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    
5409 5409
                     FROM spotter_output 
5410 5410
                     WHERE spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5411 5411
                 if ($olderthanmonths > 0) {
@@ -5434,7 +5434,7 @@  discard block
 block discarded – undo
5434 5434
 		$aircraft_array = array();
5435 5435
 		$temp_array = array();
5436 5436
         
5437
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5437
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5438 5438
 		{
5439 5439
 			$temp_array['registration'] = $row['registration'];
5440 5440
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -5443,7 +5443,7 @@  discard block
 block discarded – undo
5443 5443
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5444 5444
 			$temp_array['airline_name'] = $row['airline_name'];
5445 5445
 			$temp_array['image_thumbnail'] = "";
5446
-			if($row['registration'] != "")
5446
+			if ($row['registration'] != "")
5447 5447
 			{
5448 5448
 				$image_array = $Image->getSpotterImage($row['registration']);
5449 5449
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5462,11 +5462,11 @@  discard block
 block discarded – undo
5462 5462
 	* @return Array the airport list
5463 5463
 	*
5464 5464
 	*/
5465
-	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5465
+	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5466 5466
 	{
5467 5467
 		global $globalDBdriver;
5468
-		$filter_query = $this->getFilter($filters,true,true);
5469
-		$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 
5468
+		$filter_query = $this->getFilter($filters, true, true);
5469
+		$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 
5470 5470
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA'";
5471 5471
                 if ($olderthanmonths > 0) {
5472 5472
             		if ($globalDBdriver == 'mysql') {
@@ -5495,7 +5495,7 @@  discard block
 block discarded – undo
5495 5495
 		$airport_array = array();
5496 5496
 		$temp_array = array();
5497 5497
         
5498
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5498
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5499 5499
 		{
5500 5500
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5501 5501
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5517,7 +5517,7 @@  discard block
 block discarded – undo
5517 5517
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
5518 5518
 	{
5519 5519
 		global $globalDBdriver;
5520
-		$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 
5520
+		$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 
5521 5521
 								FROM spotter_output
5522 5522
                     WHERE spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' ";
5523 5523
                 if ($olderthanmonths > 0) {
@@ -5547,7 +5547,7 @@  discard block
 block discarded – undo
5547 5547
 		$airport_array = array();
5548 5548
 		$temp_array = array();
5549 5549
         
5550
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5550
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5551 5551
 		{
5552 5552
 			$temp_array['airline_icao'] = $row['airline_icao'];
5553 5553
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -5567,11 +5567,11 @@  discard block
 block discarded – undo
5567 5567
 	* @return Array the airport list
5568 5568
 	*
5569 5569
 	*/
5570
-	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5570
+	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5571 5571
 	{
5572 5572
 		global $globalDBdriver;
5573
-		$filter_query = $this->getFilter($filters,true,true);
5574
-		$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
5573
+		$filter_query = $this->getFilter($filters, true, true);
5574
+		$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
5575 5575
 				FROM spotter_output, airport".$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";
5576 5576
                 if ($olderthanmonths > 0) {
5577 5577
             		if ($globalDBdriver == 'mysql') {
@@ -5599,7 +5599,7 @@  discard block
 block discarded – undo
5599 5599
 		$airport_array = array();
5600 5600
 		$temp_array = array();
5601 5601
         
5602
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5602
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5603 5603
 		{
5604 5604
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5605 5605
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5621,7 +5621,7 @@  discard block
 block discarded – undo
5621 5621
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
5622 5622
 	{
5623 5623
 		global $globalDBdriver;
5624
-		$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
5624
+		$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
5625 5625
 				FROM spotter_output, airport
5626 5626
                     WHERE 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 ";
5627 5627
                 if ($olderthanmonths > 0) {
@@ -5651,7 +5651,7 @@  discard block
 block discarded – undo
5651 5651
 		$airport_array = array();
5652 5652
 		$temp_array = array();
5653 5653
         
5654
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5654
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5655 5655
 		{
5656 5656
 			$temp_array['airline_icao'] = $row['airline_icao'];
5657 5657
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -5673,9 +5673,9 @@  discard block
 block discarded – undo
5673 5673
 	*/
5674 5674
 	public function countAllDepartureAirportsByAirline($airline_icao)
5675 5675
 	{
5676
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5676
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5677 5677
 
5678
-		$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 
5678
+		$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 
5679 5679
 								FROM spotter_output
5680 5680
                     WHERE spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao 
5681 5681
                     GROUP BY spotter_output.departure_airport_icao
@@ -5688,7 +5688,7 @@  discard block
 block discarded – undo
5688 5688
 		$airport_array = array();
5689 5689
 		$temp_array = array();
5690 5690
         
5691
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5691
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5692 5692
 		{
5693 5693
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5694 5694
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5712,9 +5712,9 @@  discard block
 block discarded – undo
5712 5712
 	*/
5713 5713
 	public function countAllDepartureAirportCountriesByAirline($airline_icao)
5714 5714
 	{
5715
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5715
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5716 5716
 					
5717
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5717
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5718 5718
 								FROM spotter_output 
5719 5719
                     WHERE spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
5720 5720
                     GROUP BY spotter_output.departure_airport_country
@@ -5727,7 +5727,7 @@  discard block
 block discarded – undo
5727 5727
 		$airport_array = array();
5728 5728
 		$temp_array = array();
5729 5729
         
5730
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5730
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5731 5731
 		{
5732 5732
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5733 5733
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5748,9 +5748,9 @@  discard block
 block discarded – undo
5748 5748
 	*/
5749 5749
 	public function countAllDepartureAirportsByAircraft($aircraft_icao)
5750 5750
 	{
5751
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5751
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5752 5752
 
5753
-		$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
+		$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 
5754 5754
 								FROM spotter_output
5755 5755
                     WHERE spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao 
5756 5756
                     GROUP BY spotter_output.departure_airport_icao
@@ -5763,7 +5763,7 @@  discard block
 block discarded – undo
5763 5763
 		$airport_array = array();
5764 5764
 		$temp_array = array();
5765 5765
         
5766
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5766
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5767 5767
 		{
5768 5768
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5769 5769
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5786,9 +5786,9 @@  discard block
 block discarded – undo
5786 5786
 	*/
5787 5787
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao)
5788 5788
 	{
5789
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5789
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5790 5790
 					
5791
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5791
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5792 5792
 								FROM spotter_output 
5793 5793
                     WHERE spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
5794 5794
                     GROUP BY spotter_output.departure_airport_country
@@ -5801,7 +5801,7 @@  discard block
 block discarded – undo
5801 5801
 		$airport_array = array();
5802 5802
 		$temp_array = array();
5803 5803
         
5804
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5804
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5805 5805
 		{
5806 5806
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5807 5807
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5821,9 +5821,9 @@  discard block
 block discarded – undo
5821 5821
 	*/
5822 5822
 	public function countAllDepartureAirportsByRegistration($registration)
5823 5823
 	{
5824
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
5824
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
5825 5825
 
5826
-		$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
+		$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 
5827 5827
 								FROM spotter_output
5828 5828
                     WHERE spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.registration = :registration 
5829 5829
                     GROUP BY spotter_output.departure_airport_icao
@@ -5836,7 +5836,7 @@  discard block
 block discarded – undo
5836 5836
 		$airport_array = array();
5837 5837
 		$temp_array = array();
5838 5838
         
5839
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5839
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5840 5840
 		{
5841 5841
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5842 5842
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5859,9 +5859,9 @@  discard block
 block discarded – undo
5859 5859
 	*/
5860 5860
 	public function countAllDepartureAirportCountriesByRegistration($registration)
5861 5861
 	{
5862
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
5862
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
5863 5863
 					
5864
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5864
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5865 5865
 								FROM spotter_output 
5866 5866
                     WHERE spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration 
5867 5867
                     GROUP BY spotter_output.departure_airport_country
@@ -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'];
@@ -5894,9 +5894,9 @@  discard block
 block discarded – undo
5894 5894
 	*/
5895 5895
 	public function countAllDepartureAirportsByAirport($airport_icao)
5896 5896
 	{
5897
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5897
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5898 5898
 
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 
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
5901 5901
                     WHERE spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao = :airport_icao 
5902 5902
                     GROUP BY spotter_output.departure_airport_icao
@@ -5909,7 +5909,7 @@  discard block
 block discarded – undo
5909 5909
 		$airport_array = array();
5910 5910
 		$temp_array = array();
5911 5911
         
5912
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5912
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5913 5913
 		{
5914 5914
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5915 5915
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5932,9 +5932,9 @@  discard block
 block discarded – undo
5932 5932
 	*/
5933 5933
 	public function countAllDepartureAirportCountriesByAirport($airport_icao)
5934 5934
 	{
5935
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5935
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5936 5936
 					
5937
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5937
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5938 5938
 								FROM spotter_output 
5939 5939
                     WHERE spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao 
5940 5940
                     GROUP BY spotter_output.departure_airport_country
@@ -5947,7 +5947,7 @@  discard block
 block discarded – undo
5947 5947
 		$airport_array = array();
5948 5948
 		$temp_array = array();
5949 5949
         
5950
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5950
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5951 5951
 		{
5952 5952
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5953 5953
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5968,9 +5968,9 @@  discard block
 block discarded – undo
5968 5968
 	*/
5969 5969
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer)
5970 5970
 	{
5971
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5971
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5972 5972
 
5973
-		$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 
5973
+		$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 
5974 5974
 								FROM spotter_output
5975 5975
                     WHERE spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
5976 5976
                     GROUP BY spotter_output.departure_airport_icao
@@ -5983,7 +5983,7 @@  discard block
 block discarded – undo
5983 5983
 		$airport_array = array();
5984 5984
 		$temp_array = array();
5985 5985
         
5986
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5986
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5987 5987
 		{
5988 5988
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5989 5989
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6006,9 +6006,9 @@  discard block
 block discarded – undo
6006 6006
 	*/
6007 6007
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer)
6008 6008
 	{
6009
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6009
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6010 6010
 					
6011
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6011
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6012 6012
 								FROM spotter_output 
6013 6013
                     WHERE spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6014 6014
                     GROUP BY spotter_output.departure_airport_country
@@ -6021,7 +6021,7 @@  discard block
 block discarded – undo
6021 6021
 		$airport_array = array();
6022 6022
 		$temp_array = array();
6023 6023
         
6024
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6024
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6025 6025
 		{
6026 6026
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6027 6027
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6042,7 +6042,7 @@  discard block
 block discarded – undo
6042 6042
 	public function countAllDepartureAirportsByDate($date)
6043 6043
 	{
6044 6044
 		global $globalTimezone, $globalDBdriver;
6045
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6045
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6046 6046
 
6047 6047
 		if ($globalTimezone != '') {
6048 6048
 			date_default_timezone_set($globalTimezone);
@@ -6051,13 +6051,13 @@  discard block
 block discarded – undo
6051 6051
 		} else $offset = '+00:00';
6052 6052
 
6053 6053
 		if ($globalDBdriver == 'mysql') {
6054
-			$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 
6054
+			$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 
6055 6055
 					FROM spotter_output
6056 6056
 					WHERE spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
6057 6057
 					GROUP BY spotter_output.departure_airport_icao
6058 6058
 					ORDER BY airport_departure_icao_count DESC";
6059 6059
 		} else {
6060
-			$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 
6060
+			$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 
6061 6061
 					FROM spotter_output
6062 6062
 					WHERE 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
6063 6063
 					GROUP BY spotter_output.departure_airport_icao
@@ -6070,7 +6070,7 @@  discard block
 block discarded – undo
6070 6070
 		$airport_array = array();
6071 6071
 		$temp_array = array();
6072 6072
         
6073
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6073
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6074 6074
 		{
6075 6075
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6076 6076
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6094,7 +6094,7 @@  discard block
 block discarded – undo
6094 6094
 	public function countAllDepartureAirportCountriesByDate($date)
6095 6095
 	{
6096 6096
 		global $globalTimezone, $globalDBdriver;
6097
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6097
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6098 6098
 		if ($globalTimezone != '') {
6099 6099
 			date_default_timezone_set($globalTimezone);
6100 6100
 			$datetime = new DateTime($date);
@@ -6102,13 +6102,13 @@  discard block
 block discarded – undo
6102 6102
 		} else $offset = '+00:00';
6103 6103
 
6104 6104
 		if ($globalDBdriver == 'mysql') {
6105
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6105
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6106 6106
 					FROM spotter_output 
6107 6107
 					WHERE spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
6108 6108
 					GROUP BY spotter_output.departure_airport_country
6109 6109
 					ORDER BY airport_departure_country_count DESC";
6110 6110
 		} else {
6111
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6111
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6112 6112
 					FROM spotter_output 
6113 6113
 					WHERE spotter_output.departure_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
6114 6114
 					GROUP BY spotter_output.departure_airport_country
@@ -6121,7 +6121,7 @@  discard block
 block discarded – undo
6121 6121
 		$airport_array = array();
6122 6122
 		$temp_array = array();
6123 6123
         
6124
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6124
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6125 6125
 		{
6126 6126
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6127 6127
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6141,9 +6141,9 @@  discard block
 block discarded – undo
6141 6141
 	*/
6142 6142
 	public function countAllDepartureAirportsByIdent($ident)
6143 6143
 	{
6144
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6144
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6145 6145
 
6146
-		$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 
6146
+		$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 
6147 6147
 		    FROM spotter_output
6148 6148
                     WHERE spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.ident = :ident 
6149 6149
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
@@ -6156,7 +6156,7 @@  discard block
 block discarded – undo
6156 6156
 		$airport_array = array();
6157 6157
 		$temp_array = array();
6158 6158
         
6159
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6159
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6160 6160
 		{
6161 6161
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6162 6162
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6180,9 +6180,9 @@  discard block
 block discarded – undo
6180 6180
 	*/
6181 6181
 	public function countAllDepartureAirportCountriesByIdent($ident)
6182 6182
 	{
6183
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6183
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6184 6184
 					
6185
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6185
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6186 6186
 								FROM spotter_output 
6187 6187
                     WHERE spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident 
6188 6188
                     GROUP BY spotter_output.departure_airport_country
@@ -6195,7 +6195,7 @@  discard block
 block discarded – undo
6195 6195
 		$airport_array = array();
6196 6196
 		$temp_array = array();
6197 6197
         
6198
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6198
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6199 6199
 		{
6200 6200
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6201 6201
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6216,9 +6216,9 @@  discard block
 block discarded – undo
6216 6216
 	*/
6217 6217
 	public function countAllDepartureAirportsByCountry($country)
6218 6218
 	{
6219
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6219
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6220 6220
 
6221
-		$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 
6221
+		$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 
6222 6222
 								FROM spotter_output
6223 6223
                     WHERE ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
6224 6224
                     GROUP BY spotter_output.departure_airport_icao
@@ -6231,7 +6231,7 @@  discard block
 block discarded – undo
6231 6231
 		$airport_array = array();
6232 6232
 		$temp_array = array();
6233 6233
         
6234
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6234
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6235 6235
 		{
6236 6236
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6237 6237
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6254,9 +6254,9 @@  discard block
 block discarded – undo
6254 6254
 	*/
6255 6255
 	public function countAllDepartureAirportCountriesByCountry($country)
6256 6256
 	{
6257
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6257
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6258 6258
 					
6259
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6259
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6260 6260
 								FROM spotter_output 
6261 6261
                     WHERE 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 
6262 6262
                     GROUP BY spotter_output.departure_airport_country
@@ -6269,7 +6269,7 @@  discard block
 block discarded – undo
6269 6269
 		$airport_array = array();
6270 6270
 		$temp_array = array();
6271 6271
         
6272
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6272
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6273 6273
 		{
6274 6274
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6275 6275
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6287,11 +6287,11 @@  discard block
 block discarded – undo
6287 6287
 	* @return Array the airport list
6288 6288
 	*
6289 6289
 	*/
6290
-	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6290
+	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6291 6291
 	{
6292 6292
 		global $globalDBdriver;
6293
-		$filter_query = $this->getFilter($filters,true,true);
6294
-		$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 
6293
+		$filter_query = $this->getFilter($filters, true, true);
6294
+		$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 
6295 6295
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
6296 6296
                 if ($olderthanmonths > 0) {
6297 6297
             		if ($globalDBdriver == 'mysql') {
@@ -6326,7 +6326,7 @@  discard block
 block discarded – undo
6326 6326
 		$airport_array = array();
6327 6327
 		$temp_array = array();
6328 6328
         
6329
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6329
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6330 6330
 		{
6331 6331
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6332 6332
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6352,7 +6352,7 @@  discard block
 block discarded – undo
6352 6352
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false)
6353 6353
 	{
6354 6354
 		global $globalDBdriver;
6355
-		$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 
6355
+		$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 
6356 6356
 								FROM spotter_output 
6357 6357
                     WHERE spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' ";
6358 6358
                 if ($olderthanmonths > 0) {
@@ -6388,7 +6388,7 @@  discard block
 block discarded – undo
6388 6388
 		$airport_array = array();
6389 6389
 		$temp_array = array();
6390 6390
         
6391
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6391
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6392 6392
 		{
6393 6393
 			$temp_array['airline_icao'] = $row['airline_icao'];
6394 6394
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
@@ -6413,11 +6413,11 @@  discard block
 block discarded – undo
6413 6413
 	* @return Array the airport list
6414 6414
 	*
6415 6415
 	*/
6416
-	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6416
+	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6417 6417
 	{
6418 6418
 		global $globalDBdriver;
6419
-		$filter_query = $this->getFilter($filters,true,true);
6420
-		$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 
6419
+		$filter_query = $this->getFilter($filters, true, true);
6420
+		$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 
6421 6421
 			FROM spotter_output, airport".$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";
6422 6422
                 if ($olderthanmonths > 0) {
6423 6423
             		if ($globalDBdriver == 'mysql') {
@@ -6451,7 +6451,7 @@  discard block
 block discarded – undo
6451 6451
 		$airport_array = array();
6452 6452
 		$temp_array = array();
6453 6453
         
6454
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6454
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6455 6455
 		{
6456 6456
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6457 6457
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6474,10 +6474,10 @@  discard block
 block discarded – undo
6474 6474
 	* @return Array the airport list
6475 6475
 	*
6476 6476
 	*/
6477
-	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false)
6477
+	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false)
6478 6478
 	{
6479 6479
 		global $globalDBdriver;
6480
-		$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 
6480
+		$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 
6481 6481
 			FROM spotter_output, airport 
6482 6482
                     WHERE 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 ";
6483 6483
                 if ($olderthanmonths > 0) {
@@ -6513,7 +6513,7 @@  discard block
 block discarded – undo
6513 6513
 		$airport_array = array();
6514 6514
 		$temp_array = array();
6515 6515
         
6516
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6516
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6517 6517
 		{
6518 6518
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6519 6519
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6539,9 +6539,9 @@  discard block
 block discarded – undo
6539 6539
 	*/
6540 6540
 	public function countAllArrivalAirportsByAirline($airline_icao)
6541 6541
 	{
6542
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6542
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6543 6543
 
6544
-		$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 
6544
+		$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 
6545 6545
 								FROM spotter_output 
6546 6546
                     WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao 
6547 6547
                     GROUP BY spotter_output.arrival_airport_icao
@@ -6554,7 +6554,7 @@  discard block
 block discarded – undo
6554 6554
 		$airport_array = array();
6555 6555
 		$temp_array = array();
6556 6556
         
6557
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6557
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6558 6558
 		{
6559 6559
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6560 6560
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6577,9 +6577,9 @@  discard block
 block discarded – undo
6577 6577
 	*/
6578 6578
 	public function countAllArrivalAirportCountriesByAirline($airline_icao)
6579 6579
 	{
6580
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6580
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6581 6581
 					
6582
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6582
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6583 6583
 								FROM spotter_output 
6584 6584
                     WHERE spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
6585 6585
                     GROUP BY spotter_output.arrival_airport_country
@@ -6592,7 +6592,7 @@  discard block
 block discarded – undo
6592 6592
 		$airport_array = array();
6593 6593
 		$temp_array = array();
6594 6594
         
6595
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6595
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6596 6596
 		{
6597 6597
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6598 6598
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6612,9 +6612,9 @@  discard block
 block discarded – undo
6612 6612
 	*/
6613 6613
 	public function countAllArrivalAirportsByAircraft($aircraft_icao)
6614 6614
 	{
6615
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6615
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6616 6616
 
6617
-		$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 
6617
+		$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 
6618 6618
 								FROM spotter_output 
6619 6619
                     WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao 
6620 6620
                     GROUP BY spotter_output.arrival_airport_icao
@@ -6627,7 +6627,7 @@  discard block
 block discarded – undo
6627 6627
 		$airport_array = array();
6628 6628
 		$temp_array = array();
6629 6629
         
6630
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6630
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6631 6631
 		{
6632 6632
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6633 6633
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6651,9 +6651,9 @@  discard block
 block discarded – undo
6651 6651
 	*/
6652 6652
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao)
6653 6653
 	{
6654
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6654
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6655 6655
 					
6656
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6656
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6657 6657
 								FROM spotter_output 
6658 6658
                     WHERE spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
6659 6659
                     GROUP BY spotter_output.arrival_airport_country
@@ -6666,7 +6666,7 @@  discard block
 block discarded – undo
6666 6666
 		$airport_array = array();
6667 6667
 		$temp_array = array();
6668 6668
         
6669
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6669
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6670 6670
 		{
6671 6671
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6672 6672
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6686,9 +6686,9 @@  discard block
 block discarded – undo
6686 6686
 	*/
6687 6687
 	public function countAllArrivalAirportsByRegistration($registration)
6688 6688
 	{
6689
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6689
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6690 6690
 
6691
-		$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 
6691
+		$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 
6692 6692
 								FROM spotter_output 
6693 6693
                     WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.registration = :registration 
6694 6694
                     GROUP BY spotter_output.arrival_airport_icao
@@ -6701,7 +6701,7 @@  discard block
 block discarded – undo
6701 6701
 		$airport_array = array();
6702 6702
 		$temp_array = array();
6703 6703
         
6704
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6704
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6705 6705
 		{
6706 6706
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6707 6707
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6724,9 +6724,9 @@  discard block
 block discarded – undo
6724 6724
 	*/
6725 6725
 	public function countAllArrivalAirportCountriesByRegistration($registration)
6726 6726
 	{
6727
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6727
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6728 6728
 					
6729
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6729
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6730 6730
 								FROM spotter_output 
6731 6731
                     WHERE spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration 
6732 6732
                     GROUP BY spotter_output.arrival_airport_country
@@ -6739,7 +6739,7 @@  discard block
 block discarded – undo
6739 6739
 		$airport_array = array();
6740 6740
 		$temp_array = array();
6741 6741
         
6742
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6742
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6743 6743
 		{
6744 6744
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6745 6745
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6760,9 +6760,9 @@  discard block
 block discarded – undo
6760 6760
 	*/
6761 6761
 	public function countAllArrivalAirportsByAirport($airport_icao)
6762 6762
 	{
6763
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6763
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6764 6764
 
6765
-		$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 
6765
+		$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 
6766 6766
 								FROM spotter_output 
6767 6767
                     WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.departure_airport_icao = :airport_icao 
6768 6768
                     GROUP BY spotter_output.arrival_airport_icao
@@ -6775,7 +6775,7 @@  discard block
 block discarded – undo
6775 6775
 		$airport_array = array();
6776 6776
 		$temp_array = array();
6777 6777
         
6778
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6778
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6779 6779
 		{
6780 6780
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6781 6781
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6798,9 +6798,9 @@  discard block
 block discarded – undo
6798 6798
 	*/
6799 6799
 	public function countAllArrivalAirportCountriesByAirport($airport_icao)
6800 6800
 	{
6801
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6801
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6802 6802
 					
6803
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6803
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6804 6804
 								FROM spotter_output 
6805 6805
                     WHERE spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao 
6806 6806
                     GROUP BY spotter_output.arrival_airport_country
@@ -6813,7 +6813,7 @@  discard block
 block discarded – undo
6813 6813
 		$airport_array = array();
6814 6814
 		$temp_array = array();
6815 6815
         
6816
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6816
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6817 6817
 		{
6818 6818
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6819 6819
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6833,9 +6833,9 @@  discard block
 block discarded – undo
6833 6833
 	*/
6834 6834
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer)
6835 6835
 	{
6836
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6836
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6837 6837
 
6838
-		$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 
6838
+		$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 
6839 6839
 								FROM spotter_output 
6840 6840
                     WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6841 6841
                     GROUP BY spotter_output.arrival_airport_icao
@@ -6848,7 +6848,7 @@  discard block
 block discarded – undo
6848 6848
 		$airport_array = array();
6849 6849
 		$temp_array = array();
6850 6850
         
6851
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6851
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6852 6852
 		{
6853 6853
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6854 6854
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6872,9 +6872,9 @@  discard block
 block discarded – undo
6872 6872
 	*/
6873 6873
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer)
6874 6874
 	{
6875
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6875
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6876 6876
 					
6877
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6877
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6878 6878
 								FROM spotter_output 
6879 6879
                     WHERE spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6880 6880
                     GROUP BY spotter_output.arrival_airport_country
@@ -6887,7 +6887,7 @@  discard block
 block discarded – undo
6887 6887
 		$airport_array = array();
6888 6888
 		$temp_array = array();
6889 6889
         
6890
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6890
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6891 6891
 		{
6892 6892
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6893 6893
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6909,7 +6909,7 @@  discard block
 block discarded – undo
6909 6909
 	public function countAllArrivalAirportsByDate($date)
6910 6910
 	{
6911 6911
 		global $globalTimezone, $globalDBdriver;
6912
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6912
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6913 6913
 		if ($globalTimezone != '') {
6914 6914
 			date_default_timezone_set($globalTimezone);
6915 6915
 			$datetime = new DateTime($date);
@@ -6917,13 +6917,13 @@  discard block
 block discarded – undo
6917 6917
 		} else $offset = '+00:00';
6918 6918
 
6919 6919
 		if ($globalDBdriver == 'mysql') {
6920
-			$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 
6920
+			$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 
6921 6921
 					FROM spotter_output 
6922 6922
 					WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
6923 6923
 					GROUP BY spotter_output.arrival_airport_icao
6924 6924
 					ORDER BY airport_arrival_icao_count DESC";
6925 6925
 		} else {
6926
-			$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 
6926
+			$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 
6927 6927
 					FROM spotter_output 
6928 6928
 					WHERE 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  
6929 6929
 					GROUP BY spotter_output.arrival_airport_icao
@@ -6936,7 +6936,7 @@  discard block
 block discarded – undo
6936 6936
 		$airport_array = array();
6937 6937
 		$temp_array = array();
6938 6938
         
6939
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6939
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6940 6940
 		{
6941 6941
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6942 6942
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6960,7 +6960,7 @@  discard block
 block discarded – undo
6960 6960
 	public function countAllArrivalAirportCountriesByDate($date)
6961 6961
 	{
6962 6962
 		global $globalTimezone, $globalDBdriver;
6963
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6963
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6964 6964
 		if ($globalTimezone != '') {
6965 6965
 			date_default_timezone_set($globalTimezone);
6966 6966
 			$datetime = new DateTime($date);
@@ -6968,13 +6968,13 @@  discard block
 block discarded – undo
6968 6968
 		} else $offset = '+00:00';
6969 6969
 
6970 6970
 		if ($globalDBdriver == 'mysql') {
6971
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6971
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6972 6972
 					FROM spotter_output 
6973 6973
 					WHERE spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
6974 6974
 					GROUP BY spotter_output.arrival_airport_country
6975 6975
 					ORDER BY airport_arrival_country_count DESC";
6976 6976
 		} else {
6977
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6977
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6978 6978
 					FROM spotter_output 
6979 6979
 					WHERE spotter_output.arrival_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
6980 6980
 					GROUP BY spotter_output.arrival_airport_country
@@ -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['arrival_airport_country'] = $row['arrival_airport_country'];
6993 6993
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7007,9 +7007,9 @@  discard block
 block discarded – undo
7007 7007
 	*/
7008 7008
 	public function countAllArrivalAirportsByIdent($ident)
7009 7009
 	{
7010
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7010
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7011 7011
 
7012
-		$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 
7012
+		$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 
7013 7013
 		    FROM spotter_output 
7014 7014
                     WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.ident = :ident  
7015 7015
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
@@ -7022,7 +7022,7 @@  discard block
 block discarded – undo
7022 7022
 		$airport_array = array();
7023 7023
 		$temp_array = array();
7024 7024
         
7025
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7025
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7026 7026
 		{
7027 7027
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7028 7028
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7045,9 +7045,9 @@  discard block
 block discarded – undo
7045 7045
 	*/
7046 7046
 	public function countAllArrivalAirportCountriesByIdent($ident)
7047 7047
 	{
7048
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7048
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7049 7049
 					
7050
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7050
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7051 7051
 								FROM spotter_output 
7052 7052
                     WHERE spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident 
7053 7053
                     GROUP BY spotter_output.arrival_airport_country
@@ -7060,7 +7060,7 @@  discard block
 block discarded – undo
7060 7060
 		$airport_array = array();
7061 7061
 		$temp_array = array();
7062 7062
         
7063
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7063
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7064 7064
 		{
7065 7065
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7066 7066
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7081,9 +7081,9 @@  discard block
 block discarded – undo
7081 7081
 	*/
7082 7082
 	public function countAllArrivalAirportsByCountry($country)
7083 7083
 	{
7084
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7084
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7085 7085
 
7086
-		$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 
7086
+		$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 
7087 7087
 								FROM spotter_output 
7088 7088
                     WHERE ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
7089 7089
                     GROUP BY spotter_output.arrival_airport_icao
@@ -7096,7 +7096,7 @@  discard block
 block discarded – undo
7096 7096
 		$airport_array = array();
7097 7097
 		$temp_array = array();
7098 7098
         
7099
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7099
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7100 7100
 		{
7101 7101
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7102 7102
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7119,9 +7119,9 @@  discard block
 block discarded – undo
7119 7119
 	*/
7120 7120
 	public function countAllArrivalAirportCountriesByCountry($country)
7121 7121
 	{
7122
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7122
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7123 7123
 					
7124
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7124
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7125 7125
 								FROM spotter_output 
7126 7126
                     WHERE 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 
7127 7127
                     GROUP BY spotter_output.arrival_airport_country
@@ -7134,7 +7134,7 @@  discard block
 block discarded – undo
7134 7134
 		$airport_array = array();
7135 7135
 		$temp_array = array();
7136 7136
         
7137
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7137
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7138 7138
 		{
7139 7139
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7140 7140
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7155,7 +7155,7 @@  discard block
 block discarded – undo
7155 7155
 	*/
7156 7156
 	public function countAllDepartureCountries($filters = array())
7157 7157
 	{
7158
-		$filter_query = $this->getFilter($filters,true,true);
7158
+		$filter_query = $this->getFilter($filters, true, true);
7159 7159
 		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7160 7160
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA'";
7161 7161
 		$query .= " GROUP BY spotter_output.departure_airport_country
@@ -7169,7 +7169,7 @@  discard block
 block discarded – undo
7169 7169
 		$airport_array = array();
7170 7170
 		$temp_array = array();
7171 7171
         
7172
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7172
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7173 7173
 		{
7174 7174
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
7175 7175
 			$temp_array['airport_departure_country'] = $row['departure_airport_country'];
@@ -7187,9 +7187,9 @@  discard block
 block discarded – undo
7187 7187
 	* @return Array the airport arrival list
7188 7188
 	*
7189 7189
 	*/
7190
-	public function countAllArrivalCountries($limit = true,$filters = array())
7190
+	public function countAllArrivalCountries($limit = true, $filters = array())
7191 7191
 	{
7192
-		$filter_query = $this->getFilter($filters,true,true);
7192
+		$filter_query = $this->getFilter($filters, true, true);
7193 7193
 		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7194 7194
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
7195 7195
 		$query .= " GROUP BY spotter_output.arrival_airport_country
@@ -7203,7 +7203,7 @@  discard block
 block discarded – undo
7203 7203
 		$airport_array = array();
7204 7204
 		$temp_array = array();
7205 7205
         
7206
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7206
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7207 7207
 		{
7208 7208
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
7209 7209
 			$temp_array['airport_arrival_country'] = $row['arrival_airport_country'];
@@ -7227,7 +7227,7 @@  discard block
 block discarded – undo
7227 7227
 	public function countAllRoutes()
7228 7228
 	{
7229 7229
 		
7230
-		$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
7230
+		$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
7231 7231
 		    FROM spotter_output
7232 7232
                     WHERE spotter_output.ident <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> 'NA'
7233 7233
                     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
@@ -7241,7 +7241,7 @@  discard block
 block discarded – undo
7241 7241
 		$routes_array = array();
7242 7242
 		$temp_array = array();
7243 7243
         
7244
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7244
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7245 7245
 		{
7246 7246
 			$temp_array['route_count'] = $row['route_count'];
7247 7247
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7270,9 +7270,9 @@  discard block
 block discarded – undo
7270 7270
 	*/
7271 7271
 	public function countAllRoutesByAircraft($aircraft_icao)
7272 7272
 	{
7273
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7273
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7274 7274
 		
7275
-		$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
+		$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
7276 7276
 								FROM spotter_output
7277 7277
                     WHERE spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
7278 7278
                     GROUP BY route
@@ -7285,7 +7285,7 @@  discard block
 block discarded – undo
7285 7285
 		$routes_array = array();
7286 7286
 		$temp_array = array();
7287 7287
         
7288
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7288
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7289 7289
 		{
7290 7290
 			$temp_array['route_count'] = $row['route_count'];
7291 7291
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7314,7 +7314,7 @@  discard block
 block discarded – undo
7314 7314
 	{
7315 7315
 		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7316 7316
 		
7317
-		$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
7317
+		$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 7318
 								FROM spotter_output
7319 7319
                     WHERE spotter_output.ident <> '' AND spotter_output.registration = :registration 
7320 7320
                     GROUP BY route
@@ -7327,7 +7327,7 @@  discard block
 block discarded – undo
7327 7327
 		$routes_array = array();
7328 7328
 		$temp_array = array();
7329 7329
         
7330
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7330
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7331 7331
 		{
7332 7332
 			$temp_array['route_count'] = $row['route_count'];
7333 7333
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7355,9 +7355,9 @@  discard block
 block discarded – undo
7355 7355
 	*/
7356 7356
 	public function countAllRoutesByAirline($airline_icao)
7357 7357
 	{
7358
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7358
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7359 7359
 		
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
7362 7362
                     WHERE spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao 
7363 7363
                     GROUP BY route
@@ -7370,7 +7370,7 @@  discard block
 block discarded – undo
7370 7370
 		$routes_array = array();
7371 7371
 		$temp_array = array();
7372 7372
         
7373
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7373
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7374 7374
 		{
7375 7375
 			$temp_array['route_count'] = $row['route_count'];
7376 7376
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7398,9 +7398,9 @@  discard block
 block discarded – undo
7398 7398
 	*/
7399 7399
 	public function countAllRoutesByAirport($airport_icao)
7400 7400
 	{
7401
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7401
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7402 7402
 		
7403
-		$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
+		$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
7404 7404
 								FROM spotter_output
7405 7405
                     WHERE spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
7406 7406
                     GROUP BY route
@@ -7413,7 +7413,7 @@  discard block
 block discarded – undo
7413 7413
 		$routes_array = array();
7414 7414
 		$temp_array = array();
7415 7415
         
7416
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7416
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7417 7417
 		{
7418 7418
 			$temp_array['route_count'] = $row['route_count'];
7419 7419
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7441,9 +7441,9 @@  discard block
 block discarded – undo
7441 7441
 	*/
7442 7442
 	public function countAllRoutesByCountry($country)
7443 7443
 	{
7444
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7444
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7445 7445
 		
7446
-		$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
7446
+		$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
7447 7447
 								FROM spotter_output
7448 7448
                     WHERE spotter_output.ident <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
7449 7449
                     GROUP BY route
@@ -7456,7 +7456,7 @@  discard block
 block discarded – undo
7456 7456
 		$routes_array = array();
7457 7457
 		$temp_array = array();
7458 7458
         
7459
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7459
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7460 7460
 		{
7461 7461
 			$temp_array['route_count'] = $row['route_count'];
7462 7462
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7484,7 +7484,7 @@  discard block
 block discarded – undo
7484 7484
 	public function countAllRoutesByDate($date)
7485 7485
 	{
7486 7486
 		global $globalTimezone, $globalDBdriver;
7487
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7487
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7488 7488
 		if ($globalTimezone != '') {
7489 7489
 			date_default_timezone_set($globalTimezone);
7490 7490
 			$datetime = new DateTime($date);
@@ -7492,13 +7492,13 @@  discard block
 block discarded – undo
7492 7492
 		} else $offset = '+00:00';
7493 7493
 		
7494 7494
 		if ($globalDBdriver == 'mysql') {
7495
-			$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
7495
+			$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
7496 7496
 					FROM spotter_output
7497 7497
 					WHERE spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
7498 7498
 					GROUP BY route
7499 7499
 					ORDER BY route_count DESC";
7500 7500
 		} else {
7501
-			$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
7501
+			$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
7502 7502
 					FROM spotter_output
7503 7503
 					WHERE spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
7504 7504
 					GROUP BY route
@@ -7511,7 +7511,7 @@  discard block
 block discarded – undo
7511 7511
 		$routes_array = array();
7512 7512
 		$temp_array = array();
7513 7513
         
7514
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7514
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7515 7515
 		{
7516 7516
 			$temp_array['route_count'] = $row['route_count'];
7517 7517
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7538,9 +7538,9 @@  discard block
 block discarded – undo
7538 7538
 	*/
7539 7539
 	public function countAllRoutesByIdent($ident)
7540 7540
 	{
7541
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7541
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7542 7542
 		
7543
-		$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
7543
+		$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
7544 7544
 		    FROM spotter_output
7545 7545
                     WHERE spotter_output.ident <> '' AND spotter_output.ident = :ident   
7546 7546
                     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
@@ -7553,7 +7553,7 @@  discard block
 block discarded – undo
7553 7553
 		$routes_array = array();
7554 7554
 		$temp_array = array();
7555 7555
         
7556
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7556
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7557 7557
 		{
7558 7558
 			$temp_array['route_count'] = $row['route_count'];
7559 7559
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7580,9 +7580,9 @@  discard block
 block discarded – undo
7580 7580
 	*/
7581 7581
 	public function countAllRoutesByManufacturer($aircraft_manufacturer)
7582 7582
 	{
7583
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7583
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7584 7584
 		
7585
-		$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
7585
+		$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
7586 7586
 		    FROM spotter_output
7587 7587
                     WHERE spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
7588 7588
                     GROUP BY route
@@ -7595,7 +7595,7 @@  discard block
 block discarded – undo
7595 7595
 		$routes_array = array();
7596 7596
 		$temp_array = array();
7597 7597
         
7598
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7598
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7599 7599
 		{
7600 7600
 			$temp_array['route_count'] = $row['route_count'];
7601 7601
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7623,7 +7623,7 @@  discard block
 block discarded – undo
7623 7623
 	*/
7624 7624
 	public function countAllRoutesWithWaypoints()
7625 7625
 	{
7626
-		$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
7626
+		$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
7627 7627
 		    FROM spotter_output
7628 7628
                     WHERE spotter_output.ident <> '' AND spotter_output.waypoints <> '' 
7629 7629
                     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
@@ -7637,7 +7637,7 @@  discard block
 block discarded – undo
7637 7637
 		$routes_array = array();
7638 7638
 		$temp_array = array();
7639 7639
         
7640
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7640
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7641 7641
 		{
7642 7642
 			$temp_array['spotter_id'] = $row['spotter_id'];
7643 7643
 			$temp_array['route_count'] = $row['route_count'];
@@ -7665,11 +7665,11 @@  discard block
 block discarded – undo
7665 7665
 	* @return Array the callsign list
7666 7666
 	*
7667 7667
 	*/
7668
-	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
7668
+	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7669 7669
 	{
7670 7670
 		global $globalDBdriver;
7671
-		$filter_query = $this->getFilter($filters,true,true);
7672
-		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7671
+		$filter_query = $this->getFilter($filters, true, true);
7672
+		$query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7673 7673
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
7674 7674
 		 if ($olderthanmonths > 0) {
7675 7675
 			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
@@ -7688,7 +7688,7 @@  discard block
 block discarded – undo
7688 7688
 		$callsign_array = array();
7689 7689
 		$temp_array = array();
7690 7690
         
7691
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7691
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7692 7692
 		{
7693 7693
 			$temp_array['callsign_icao'] = $row['ident'];
7694 7694
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -7710,7 +7710,7 @@  discard block
 block discarded – undo
7710 7710
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
7711 7711
 	{
7712 7712
 		global $globalDBdriver;
7713
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7713
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7714 7714
                     FROM spotter_output
7715 7715
                     WHERE spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
7716 7716
 		 if ($olderthanmonths > 0) {
@@ -7730,7 +7730,7 @@  discard block
 block discarded – undo
7730 7730
 		$callsign_array = array();
7731 7731
 		$temp_array = array();
7732 7732
         
7733
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7733
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7734 7734
 		{
7735 7735
 			$temp_array['callsign_icao'] = $row['ident'];
7736 7736
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -7784,7 +7784,7 @@  discard block
 block discarded – undo
7784 7784
 		$date_array = array();
7785 7785
 		$temp_array = array();
7786 7786
         
7787
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7787
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7788 7788
 		{
7789 7789
 			$temp_array['date_name'] = $row['date_name'];
7790 7790
 			$temp_array['date_count'] = $row['date_count'];
@@ -7811,14 +7811,14 @@  discard block
 block discarded – undo
7811 7811
 		} else $offset = '+00:00';
7812 7812
 
7813 7813
 		if ($globalDBdriver == 'mysql') {
7814
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7814
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7815 7815
 								FROM spotter_output 
7816 7816
 								WHERE spotter_output.airline_icao <> '' 
7817 7817
 								GROUP BY spotter_output.airline_icao, date_name 
7818 7818
 								ORDER BY date_count DESC
7819 7819
 								LIMIT 10 OFFSET 0";
7820 7820
 		} else {
7821
-			$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
7821
+			$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
7822 7822
 								FROM spotter_output 
7823 7823
 								WHERE spotter_output.airline_icao <> '' 
7824 7824
 								GROUP BY spotter_output.airline_icao, date_name 
@@ -7833,7 +7833,7 @@  discard block
 block discarded – undo
7833 7833
 		$date_array = array();
7834 7834
 		$temp_array = array();
7835 7835
         
7836
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7836
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7837 7837
 		{
7838 7838
 			$temp_array['date_name'] = $row['date_name'];
7839 7839
 			$temp_array['date_count'] = $row['date_count'];
@@ -7859,7 +7859,7 @@  discard block
 block discarded – undo
7859 7859
 			$datetime = new DateTime();
7860 7860
 			$offset = $datetime->format('P');
7861 7861
 		} else $offset = '+00:00';
7862
-		$filter_query = $this->getFilter($filters,true,true);
7862
+		$filter_query = $this->getFilter($filters, true, true);
7863 7863
 		if ($globalDBdriver == 'mysql') {
7864 7864
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7865 7865
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -7880,7 +7880,7 @@  discard block
 block discarded – undo
7880 7880
 		$date_array = array();
7881 7881
 		$temp_array = array();
7882 7882
         
7883
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7883
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7884 7884
 		{
7885 7885
 			$temp_array['date_name'] = $row['date_name'];
7886 7886
 			$temp_array['date_count'] = $row['date_count'];
@@ -7905,7 +7905,7 @@  discard block
 block discarded – undo
7905 7905
 			$datetime = new DateTime();
7906 7906
 			$offset = $datetime->format('P');
7907 7907
 		} else $offset = '+00:00';
7908
-		$filter_query = $this->getFilter($filters,true,true);
7908
+		$filter_query = $this->getFilter($filters, true, true);
7909 7909
 		if ($globalDBdriver == 'mysql') {
7910 7910
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7911 7911
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)";
@@ -7926,7 +7926,7 @@  discard block
 block discarded – undo
7926 7926
 		$date_array = array();
7927 7927
 		$temp_array = array();
7928 7928
         
7929
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7929
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7930 7930
 		{
7931 7931
 			$temp_array['date_name'] = $row['date_name'];
7932 7932
 			$temp_array['date_count'] = $row['date_count'];
@@ -7954,14 +7954,14 @@  discard block
 block discarded – undo
7954 7954
 		} else $offset = '+00:00';
7955 7955
 		
7956 7956
 		if ($globalDBdriver == 'mysql') {
7957
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7957
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7958 7958
 								FROM spotter_output 
7959 7959
 								WHERE spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)
7960 7960
 								GROUP BY spotter_output.airline_icao, date_name 
7961 7961
 								ORDER BY spotter_output.date ASC";
7962 7962
 			$query_data = array(':offset' => $offset);
7963 7963
 		} else {
7964
-			$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
7964
+			$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
7965 7965
 								FROM spotter_output 
7966 7966
 								WHERE spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS'
7967 7967
 								GROUP BY spotter_output.airline_icao, date_name 
@@ -7975,7 +7975,7 @@  discard block
 block discarded – undo
7975 7975
 		$date_array = array();
7976 7976
 		$temp_array = array();
7977 7977
         
7978
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7978
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7979 7979
 		{
7980 7980
 			$temp_array['date_name'] = $row['date_name'];
7981 7981
 			$temp_array['date_count'] = $row['date_count'];
@@ -8024,7 +8024,7 @@  discard block
 block discarded – undo
8024 8024
 		$date_array = array();
8025 8025
 		$temp_array = array();
8026 8026
         
8027
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8027
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8028 8028
 		{
8029 8029
 			$temp_array['month_name'] = $row['month_name'];
8030 8030
 			$temp_array['year_name'] = $row['year_name'];
@@ -8052,13 +8052,13 @@  discard block
 block discarded – undo
8052 8052
 		} else $offset = '+00:00';
8053 8053
 
8054 8054
 		if ($globalDBdriver == 'mysql') {
8055
-			$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
8055
+			$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
8056 8056
 								FROM spotter_output 
8057 8057
 								WHERE spotter_output.airline_icao <> '' 
8058 8058
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
8059 8059
 								ORDER BY date_count DESC";
8060 8060
 		} else {
8061
-			$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
8061
+			$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
8062 8062
 								FROM spotter_output 
8063 8063
 								WHERE spotter_output.airline_icao <> '' 
8064 8064
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
@@ -8072,7 +8072,7 @@  discard block
 block discarded – undo
8072 8072
 		$date_array = array();
8073 8073
 		$temp_array = array();
8074 8074
         
8075
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8075
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8076 8076
 		{
8077 8077
 			$temp_array['month_name'] = $row['month_name'];
8078 8078
 			$temp_array['year_name'] = $row['year_name'];
@@ -8101,13 +8101,13 @@  discard block
 block discarded – undo
8101 8101
 		} else $offset = '+00:00';
8102 8102
 
8103 8103
 		if ($globalDBdriver == 'mysql') {
8104
-			$query  = "SELECT YEAR(CONVERT_TZ(s.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(s.date,'+00:00', :offset)) AS month_name, count(*) as date_count
8104
+			$query = "SELECT YEAR(CONVERT_TZ(s.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(s.date,'+00:00', :offset)) AS month_name, count(*) as date_count
8105 8105
 								FROM spotter_output s
8106 8106
 								WHERE s.airline_type = 'military'
8107 8107
 								GROUP BY year_name, month_name 
8108 8108
 								ORDER BY date_count DESC";
8109 8109
 		} else {
8110
-			$query  = "SELECT EXTRACT(YEAR FROM s.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM s.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
8110
+			$query = "SELECT EXTRACT(YEAR FROM s.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM s.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
8111 8111
 								FROM spotter_output s
8112 8112
 								WHERE s.airline_type = 'military'
8113 8113
 								GROUP BY year_name, month_name 
@@ -8120,7 +8120,7 @@  discard block
 block discarded – undo
8120 8120
 		$date_array = array();
8121 8121
 		$temp_array = array();
8122 8122
         
8123
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8123
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8124 8124
 		{
8125 8125
 			$temp_array['month_name'] = $row['month_name'];
8126 8126
 			$temp_array['year_name'] = $row['year_name'];
@@ -8148,13 +8148,13 @@  discard block
 block discarded – undo
8148 8148
 		} else $offset = '+00:00';
8149 8149
 
8150 8150
 		if ($globalDBdriver == 'mysql') {
8151
-			$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
8151
+			$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
8152 8152
 								FROM spotter_output 
8153 8153
 								WHERE owner_name <> ''
8154 8154
 								GROUP BY year_name, month_name
8155 8155
 								ORDER BY date_count DESC";
8156 8156
 		} else {
8157
-			$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
8157
+			$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
8158 8158
 								FROM spotter_output 
8159 8159
 								WHERE owner_name <> ''
8160 8160
 								GROUP BY year_name, month_name
@@ -8167,7 +8167,7 @@  discard block
 block discarded – undo
8167 8167
 		$date_array = array();
8168 8168
 		$temp_array = array();
8169 8169
         
8170
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8170
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8171 8171
 		{
8172 8172
 			$temp_array['month_name'] = $row['month_name'];
8173 8173
 			$temp_array['year_name'] = $row['year_name'];
@@ -8195,13 +8195,13 @@  discard block
 block discarded – undo
8195 8195
 		} else $offset = '+00:00';
8196 8196
 
8197 8197
 		if ($globalDBdriver == 'mysql') {
8198
-			$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
8198
+			$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
8199 8199
 								FROM spotter_output 
8200 8200
 								WHERE owner_name <> '' AND spotter_output.airline_icao <> '' 
8201 8201
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8202 8202
 								ORDER BY date_count DESC";
8203 8203
 		} else {
8204
-			$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
8204
+			$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
8205 8205
 								FROM spotter_output 
8206 8206
 								WHERE owner_name <> '' AND spotter_output.airline_icao <> '' 
8207 8207
 								GROUP BY spotter_output.airline_icao, year_name, month_name
@@ -8214,7 +8214,7 @@  discard block
 block discarded – undo
8214 8214
 		$date_array = array();
8215 8215
 		$temp_array = array();
8216 8216
         
8217
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8217
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8218 8218
 		{
8219 8219
 			$temp_array['month_name'] = $row['month_name'];
8220 8220
 			$temp_array['year_name'] = $row['year_name'];
@@ -8243,13 +8243,13 @@  discard block
 block discarded – undo
8243 8243
 		} else $offset = '+00:00';
8244 8244
 
8245 8245
 		if ($globalDBdriver == 'mysql') {
8246
-			$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
8246
+			$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
8247 8247
 								FROM spotter_output 
8248 8248
 								WHERE pilot_id <> '' AND pilot_id IS NOT NULL
8249 8249
 								GROUP BY year_name, month_name
8250 8250
 								ORDER BY date_count DESC";
8251 8251
 		} else {
8252
-			$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
8252
+			$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
8253 8253
 								FROM spotter_output 
8254 8254
 								WHERE pilot_id <> '' AND pilot_id IS NOT NULL
8255 8255
 								GROUP BY year_name, month_name
@@ -8262,7 +8262,7 @@  discard block
 block discarded – undo
8262 8262
 		$date_array = array();
8263 8263
 		$temp_array = array();
8264 8264
         
8265
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8265
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8266 8266
 		{
8267 8267
 			$temp_array['month_name'] = $row['month_name'];
8268 8268
 			$temp_array['year_name'] = $row['year_name'];
@@ -8290,13 +8290,13 @@  discard block
 block discarded – undo
8290 8290
 		} else $offset = '+00:00';
8291 8291
 
8292 8292
 		if ($globalDBdriver == 'mysql') {
8293
-			$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
8293
+			$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
8294 8294
 								FROM spotter_output 
8295 8295
 								WHERE spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
8296 8296
 								GROUP BY spotter_output.airline_icao,year_name, month_name
8297 8297
 								ORDER BY date_count DESC";
8298 8298
 		} else {
8299
-			$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
8299
+			$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
8300 8300
 								FROM spotter_output 
8301 8301
 								WHERE spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
8302 8302
 								GROUP BY spotter_output.airline_icao, year_name, month_name
@@ -8309,7 +8309,7 @@  discard block
 block discarded – undo
8309 8309
 		$date_array = array();
8310 8310
 		$temp_array = array();
8311 8311
         
8312
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8312
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8313 8313
 		{
8314 8314
 			$temp_array['month_name'] = $row['month_name'];
8315 8315
 			$temp_array['year_name'] = $row['year_name'];
@@ -8338,13 +8338,13 @@  discard block
 block discarded – undo
8338 8338
 		} else $offset = '+00:00';
8339 8339
 
8340 8340
 		if ($globalDBdriver == 'mysql') {
8341
-			$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
8341
+			$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
8342 8342
 								FROM spotter_output 
8343 8343
 								WHERE airline_icao <> '' 
8344 8344
 								GROUP BY year_name, month_name
8345 8345
 								ORDER BY date_count DESC";
8346 8346
 		} else {
8347
-			$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
8347
+			$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
8348 8348
 								FROM spotter_output 
8349 8349
 								WHERE airline_icao <> '' 
8350 8350
 								GROUP BY year_name, month_name
@@ -8357,7 +8357,7 @@  discard block
 block discarded – undo
8357 8357
 		$date_array = array();
8358 8358
 		$temp_array = array();
8359 8359
         
8360
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8360
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8361 8361
 		{
8362 8362
 			$temp_array['month_name'] = $row['month_name'];
8363 8363
 			$temp_array['year_name'] = $row['year_name'];
@@ -8385,13 +8385,13 @@  discard block
 block discarded – undo
8385 8385
 		} else $offset = '+00:00';
8386 8386
 
8387 8387
 		if ($globalDBdriver == 'mysql') {
8388
-			$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
8388
+			$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
8389 8389
 								FROM spotter_output 
8390 8390
 								WHERE aircraft_icao <> '' 
8391 8391
 								GROUP BY year_name, month_name
8392 8392
 								ORDER BY date_count DESC";
8393 8393
 		} else {
8394
-			$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
8394
+			$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
8395 8395
 								FROM spotter_output 
8396 8396
 								WHERE aircraft_icao <> '' 
8397 8397
 								GROUP BY year_name, month_name
@@ -8404,7 +8404,7 @@  discard block
 block discarded – undo
8404 8404
 		$date_array = array();
8405 8405
 		$temp_array = array();
8406 8406
         
8407
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8407
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8408 8408
 		{
8409 8409
 			$temp_array['month_name'] = $row['month_name'];
8410 8410
 			$temp_array['year_name'] = $row['year_name'];
@@ -8433,13 +8433,13 @@  discard block
 block discarded – undo
8433 8433
 		} else $offset = '+00:00';
8434 8434
 
8435 8435
 		if ($globalDBdriver == 'mysql') {
8436
-			$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
8436
+			$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
8437 8437
 								FROM spotter_output 
8438 8438
 								WHERE aircraft_icao <> ''  AND spotter_output.airline_icao <> '' 
8439 8439
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8440 8440
 								ORDER BY date_count DESC";
8441 8441
 		} else {
8442
-			$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
8442
+			$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
8443 8443
 								FROM spotter_output 
8444 8444
 								WHERE aircraft_icao <> '' AND spotter_output.airline_icao <> '' 
8445 8445
 								GROUP BY spotter_output.airline_icao, year_name, month_name
@@ -8452,7 +8452,7 @@  discard block
 block discarded – undo
8452 8452
 		$date_array = array();
8453 8453
 		$temp_array = array();
8454 8454
         
8455
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8455
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8456 8456
 		{
8457 8457
 			$temp_array['month_name'] = $row['month_name'];
8458 8458
 			$temp_array['year_name'] = $row['year_name'];
@@ -8481,13 +8481,13 @@  discard block
 block discarded – undo
8481 8481
 		} else $offset = '+00:00';
8482 8482
 
8483 8483
 		if ($globalDBdriver == 'mysql') {
8484
-			$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
8484
+			$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
8485 8485
 								FROM spotter_output 
8486 8486
 								WHERE real_arrival_airport_icao <> '' 
8487 8487
 								GROUP BY year_name, month_name
8488 8488
 								ORDER BY date_count DESC";
8489 8489
 		} else {
8490
-			$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
8490
+			$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
8491 8491
 								FROM spotter_output 
8492 8492
 								WHERE real_arrival_airport_icao <> '' 
8493 8493
 								GROUP BY year_name, month_name
@@ -8500,7 +8500,7 @@  discard block
 block discarded – undo
8500 8500
 		$date_array = array();
8501 8501
 		$temp_array = array();
8502 8502
         
8503
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8503
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8504 8504
 		{
8505 8505
 			$temp_array['month_name'] = $row['month_name'];
8506 8506
 			$temp_array['year_name'] = $row['year_name'];
@@ -8529,13 +8529,13 @@  discard block
 block discarded – undo
8529 8529
 		} else $offset = '+00:00';
8530 8530
 
8531 8531
 		if ($globalDBdriver == 'mysql') {
8532
-			$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
8532
+			$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
8533 8533
 								FROM spotter_output 
8534 8534
 								WHERE real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
8535 8535
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8536 8536
 								ORDER BY date_count DESC";
8537 8537
 		} else {
8538
-			$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
8538
+			$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
8539 8539
 								FROM spotter_output 
8540 8540
 								WHERE real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
8541 8541
 								GROUP BY spotter_output.airline_icao, year_name, month_name
@@ -8548,7 +8548,7 @@  discard block
 block discarded – undo
8548 8548
 		$date_array = array();
8549 8549
 		$temp_array = array();
8550 8550
         
8551
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8551
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8552 8552
 		{
8553 8553
 			$temp_array['month_name'] = $row['month_name'];
8554 8554
 			$temp_array['year_name'] = $row['year_name'];
@@ -8576,7 +8576,7 @@  discard block
 block discarded – undo
8576 8576
 			$datetime = new DateTime();
8577 8577
 			$offset = $datetime->format('P');
8578 8578
 		} else $offset = '+00:00';
8579
-		$filter_query = $this->getFilter($filters,true,true);
8579
+		$filter_query = $this->getFilter($filters, true, true);
8580 8580
 		if ($globalDBdriver == 'mysql') {
8581 8581
 			$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
8582 8582
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
@@ -8597,7 +8597,7 @@  discard block
 block discarded – undo
8597 8597
 		$date_array = array();
8598 8598
 		$temp_array = array();
8599 8599
         
8600
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8600
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8601 8601
 		{
8602 8602
 			$temp_array['year_name'] = $row['year_name'];
8603 8603
 			$temp_array['month_name'] = $row['month_name'];
@@ -8617,7 +8617,7 @@  discard block
 block discarded – undo
8617 8617
 	* @return Array the hour list
8618 8618
 	*
8619 8619
 	*/
8620
-	public function countAllHours($orderby,$filters = array())
8620
+	public function countAllHours($orderby, $filters = array())
8621 8621
 	{
8622 8622
 		global $globalTimezone, $globalDBdriver;
8623 8623
 		if ($globalTimezone != '') {
@@ -8665,7 +8665,7 @@  discard block
 block discarded – undo
8665 8665
 		$hour_array = array();
8666 8666
 		$temp_array = array();
8667 8667
         
8668
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8668
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8669 8669
 		{
8670 8670
 			$temp_array['hour_name'] = $row['hour_name'];
8671 8671
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8702,7 +8702,7 @@  discard block
 block discarded – undo
8702 8702
 		}
8703 8703
 		
8704 8704
 		if ($globalDBdriver == 'mysql') {
8705
-			$query  = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8705
+			$query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8706 8706
 								FROM spotter_output 
8707 8707
 								WHERE spotter_output.airline_icao <> '' 
8708 8708
 								GROUP BY spotter_output.airline_icao, hour_name 
@@ -8716,7 +8716,7 @@  discard block
 block discarded – undo
8716 8716
   */    
8717 8717
 		$query_data = array(':offset' => $offset);
8718 8718
 		} else {
8719
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8719
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8720 8720
 								FROM spotter_output 
8721 8721
 								WHERE spotter_output.airline_icao <> '' 
8722 8722
 								GROUP BY spotter_output.airline_icao, hour_name 
@@ -8730,7 +8730,7 @@  discard block
 block discarded – undo
8730 8730
 		$hour_array = array();
8731 8731
 		$temp_array = array();
8732 8732
         
8733
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8733
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8734 8734
 		{
8735 8735
 			$temp_array['hour_name'] = $row['hour_name'];
8736 8736
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8759,16 +8759,16 @@  discard block
 block discarded – undo
8759 8759
 			$offset = $datetime->format('P');
8760 8760
 		} else $offset = '+00:00';
8761 8761
 
8762
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8762
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
8763 8763
 
8764 8764
 		if ($globalDBdriver == 'mysql') {
8765
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8765
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8766 8766
 								FROM spotter_output 
8767 8767
 								WHERE spotter_output.airline_icao = :airline_icao
8768 8768
 								GROUP BY hour_name 
8769 8769
 								ORDER BY hour_name ASC";
8770 8770
 		} else {
8771
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8771
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8772 8772
 								FROM spotter_output 
8773 8773
 								WHERE spotter_output.airline_icao = :airline_icao
8774 8774
 								GROUP BY hour_name 
@@ -8776,12 +8776,12 @@  discard block
 block discarded – undo
8776 8776
 		}
8777 8777
 		
8778 8778
 		$sth = $this->db->prepare($query);
8779
-		$sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset));
8779
+		$sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset));
8780 8780
       
8781 8781
 		$hour_array = array();
8782 8782
 		$temp_array = array();
8783 8783
         
8784
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8784
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8785 8785
 		{
8786 8786
 			$temp_array['hour_name'] = $row['hour_name'];
8787 8787
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8804,7 +8804,7 @@  discard block
 block discarded – undo
8804 8804
 	public function countAllHoursByAircraft($aircraft_icao)
8805 8805
 	{
8806 8806
 		global $globalTimezone, $globalDBdriver;
8807
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
8807
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
8808 8808
 		if ($globalTimezone != '') {
8809 8809
 			date_default_timezone_set($globalTimezone);
8810 8810
 			$datetime = new DateTime();
@@ -8812,13 +8812,13 @@  discard block
 block discarded – undo
8812 8812
 		} else $offset = '+00:00';
8813 8813
 
8814 8814
 		if ($globalDBdriver == 'mysql') {
8815
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8815
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8816 8816
 								FROM spotter_output 
8817 8817
 								WHERE spotter_output.aircraft_icao = :aircraft_icao
8818 8818
 								GROUP BY hour_name 
8819 8819
 								ORDER BY hour_name ASC";
8820 8820
 		} else {
8821
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8821
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8822 8822
 								FROM spotter_output 
8823 8823
 								WHERE spotter_output.aircraft_icao = :aircraft_icao
8824 8824
 								GROUP BY hour_name 
@@ -8826,12 +8826,12 @@  discard block
 block discarded – undo
8826 8826
 		}
8827 8827
 		
8828 8828
 		$sth = $this->db->prepare($query);
8829
-		$sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset));
8829
+		$sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset));
8830 8830
       
8831 8831
 		$hour_array = array();
8832 8832
 		$temp_array = array();
8833 8833
         
8834
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8834
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8835 8835
 		{
8836 8836
 			$temp_array['hour_name'] = $row['hour_name'];
8837 8837
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8852,7 +8852,7 @@  discard block
 block discarded – undo
8852 8852
 	public function countAllHoursByRegistration($registration)
8853 8853
 	{
8854 8854
 		global $globalTimezone, $globalDBdriver;
8855
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
8855
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8856 8856
 		if ($globalTimezone != '') {
8857 8857
 			date_default_timezone_set($globalTimezone);
8858 8858
 			$datetime = new DateTime();
@@ -8860,13 +8860,13 @@  discard block
 block discarded – undo
8860 8860
 		} else $offset = '+00:00';
8861 8861
 
8862 8862
 		if ($globalDBdriver == 'mysql') {
8863
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8863
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8864 8864
 								FROM spotter_output 
8865 8865
 								WHERE spotter_output.registration = :registration
8866 8866
 								GROUP BY hour_name 
8867 8867
 								ORDER BY hour_name ASC";
8868 8868
 		} else {
8869
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8869
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8870 8870
 								FROM spotter_output 
8871 8871
 								WHERE spotter_output.registration = :registration
8872 8872
 								GROUP BY hour_name 
@@ -8874,12 +8874,12 @@  discard block
 block discarded – undo
8874 8874
 		}
8875 8875
 		
8876 8876
 		$sth = $this->db->prepare($query);
8877
-		$sth->execute(array(':registration' => $registration,':offset' => $offset));
8877
+		$sth->execute(array(':registration' => $registration, ':offset' => $offset));
8878 8878
       
8879 8879
 		$hour_array = array();
8880 8880
 		$temp_array = array();
8881 8881
         
8882
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8882
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8883 8883
 		{
8884 8884
 			$temp_array['hour_name'] = $row['hour_name'];
8885 8885
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8900,7 +8900,7 @@  discard block
 block discarded – undo
8900 8900
 	public function countAllHoursByAirport($airport_icao)
8901 8901
 	{
8902 8902
 		global $globalTimezone, $globalDBdriver;
8903
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8903
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8904 8904
 		if ($globalTimezone != '') {
8905 8905
 			date_default_timezone_set($globalTimezone);
8906 8906
 			$datetime = new DateTime();
@@ -8908,13 +8908,13 @@  discard block
 block discarded – undo
8908 8908
 		} else $offset = '+00:00';
8909 8909
 
8910 8910
 		if ($globalDBdriver == 'mysql') {
8911
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8911
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8912 8912
 								FROM spotter_output 
8913 8913
 								WHERE (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
8914 8914
 								GROUP BY hour_name 
8915 8915
 								ORDER BY hour_name ASC";
8916 8916
 		} else {
8917
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8917
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8918 8918
 								FROM spotter_output 
8919 8919
 								WHERE (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
8920 8920
 								GROUP BY hour_name 
@@ -8922,12 +8922,12 @@  discard block
 block discarded – undo
8922 8922
 		}
8923 8923
 		
8924 8924
 		$sth = $this->db->prepare($query);
8925
-		$sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset));
8925
+		$sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset));
8926 8926
       
8927 8927
 		$hour_array = array();
8928 8928
 		$temp_array = array();
8929 8929
         
8930
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8930
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8931 8931
 		{
8932 8932
 			$temp_array['hour_name'] = $row['hour_name'];
8933 8933
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8949,7 +8949,7 @@  discard block
 block discarded – undo
8949 8949
 	public function countAllHoursByManufacturer($aircraft_manufacturer)
8950 8950
 	{
8951 8951
 		global $globalTimezone, $globalDBdriver;
8952
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
8952
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
8953 8953
 		if ($globalTimezone != '') {
8954 8954
 			date_default_timezone_set($globalTimezone);
8955 8955
 			$datetime = new DateTime();
@@ -8957,13 +8957,13 @@  discard block
 block discarded – undo
8957 8957
 		} else $offset = '+00:00';
8958 8958
 
8959 8959
 		if ($globalDBdriver == 'mysql') {
8960
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8960
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8961 8961
 								FROM spotter_output 
8962 8962
 								WHERE spotter_output.aircraft_manufacturer = :aircraft_manufacturer
8963 8963
 								GROUP BY hour_name 
8964 8964
 								ORDER BY hour_name ASC";
8965 8965
 		} else {
8966
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8966
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8967 8967
 								FROM spotter_output 
8968 8968
 								WHERE spotter_output.aircraft_manufacturer = :aircraft_manufacturer
8969 8969
 								GROUP BY hour_name 
@@ -8971,12 +8971,12 @@  discard block
 block discarded – undo
8971 8971
 		}
8972 8972
 		
8973 8973
 		$sth = $this->db->prepare($query);
8974
-		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset));
8974
+		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset));
8975 8975
       
8976 8976
 		$hour_array = array();
8977 8977
 		$temp_array = array();
8978 8978
         
8979
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8979
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8980 8980
 		{
8981 8981
 			$temp_array['hour_name'] = $row['hour_name'];
8982 8982
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8998,7 +8998,7 @@  discard block
 block discarded – undo
8998 8998
 	public function countAllHoursByDate($date)
8999 8999
 	{
9000 9000
 		global $globalTimezone, $globalDBdriver;
9001
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
9001
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
9002 9002
 		if ($globalTimezone != '') {
9003 9003
 			date_default_timezone_set($globalTimezone);
9004 9004
 			$datetime = new DateTime($date);
@@ -9006,13 +9006,13 @@  discard block
 block discarded – undo
9006 9006
 		} else $offset = '+00:00';
9007 9007
 
9008 9008
 		if ($globalDBdriver == 'mysql') {
9009
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9009
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9010 9010
 								FROM spotter_output 
9011 9011
 								WHERE DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
9012 9012
 								GROUP BY hour_name 
9013 9013
 								ORDER BY hour_name ASC";
9014 9014
 		} else {
9015
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9015
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9016 9016
 								FROM spotter_output 
9017 9017
 								WHERE to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date
9018 9018
 								GROUP BY hour_name 
@@ -9025,7 +9025,7 @@  discard block
 block discarded – undo
9025 9025
 		$hour_array = array();
9026 9026
 		$temp_array = array();
9027 9027
         
9028
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9028
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9029 9029
 		{
9030 9030
 			$temp_array['hour_name'] = $row['hour_name'];
9031 9031
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9047,7 +9047,7 @@  discard block
 block discarded – undo
9047 9047
 	public function countAllHoursByIdent($ident)
9048 9048
 	{
9049 9049
 		global $globalTimezone, $globalDBdriver;
9050
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
9050
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
9051 9051
 		if ($globalTimezone != '') {
9052 9052
 			date_default_timezone_set($globalTimezone);
9053 9053
 			$datetime = new DateTime();
@@ -9055,13 +9055,13 @@  discard block
 block discarded – undo
9055 9055
 		} else $offset = '+00:00';
9056 9056
 
9057 9057
 		if ($globalDBdriver == 'mysql') {
9058
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9058
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9059 9059
 								FROM spotter_output 
9060 9060
 								WHERE spotter_output.ident = :ident 
9061 9061
 								GROUP BY hour_name 
9062 9062
 								ORDER BY hour_name ASC";
9063 9063
 		} else {
9064
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9064
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9065 9065
 								FROM spotter_output 
9066 9066
 								WHERE spotter_output.ident = :ident 
9067 9067
 								GROUP BY hour_name 
@@ -9070,12 +9070,12 @@  discard block
 block discarded – undo
9070 9070
       
9071 9071
 		
9072 9072
 		$sth = $this->db->prepare($query);
9073
-		$sth->execute(array(':ident' => $ident,':offset' => $offset));
9073
+		$sth->execute(array(':ident' => $ident, ':offset' => $offset));
9074 9074
       
9075 9075
 		$hour_array = array();
9076 9076
 		$temp_array = array();
9077 9077
         
9078
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9078
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9079 9079
 		{
9080 9080
 			$temp_array['hour_name'] = $row['hour_name'];
9081 9081
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9097,8 +9097,8 @@  discard block
 block discarded – undo
9097 9097
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao)
9098 9098
 	{
9099 9099
 		global $globalTimezone, $globalDBdriver;
9100
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
9101
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
9100
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
9101
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
9102 9102
 		if ($globalTimezone != '') {
9103 9103
 			date_default_timezone_set($globalTimezone);
9104 9104
 			$datetime = new DateTime();
@@ -9106,13 +9106,13 @@  discard block
 block discarded – undo
9106 9106
 		} else $offset = '+00:00';
9107 9107
 
9108 9108
 		if ($globalDBdriver == 'mysql') {
9109
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9109
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9110 9110
 								FROM spotter_output 
9111 9111
 								WHERE (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
9112 9112
 								GROUP BY hour_name 
9113 9113
 								ORDER BY hour_name ASC";
9114 9114
 		} else {
9115
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9115
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9116 9116
 								FROM spotter_output 
9117 9117
 								WHERE (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
9118 9118
 								GROUP BY hour_name 
@@ -9120,12 +9120,12 @@  discard block
 block discarded – undo
9120 9120
 		}
9121 9121
 		
9122 9122
 		$sth = $this->db->prepare($query);
9123
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset));
9123
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset));
9124 9124
       
9125 9125
 		$hour_array = array();
9126 9126
 		$temp_array = array();
9127 9127
         
9128
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9128
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9129 9129
 		{
9130 9130
 			$temp_array['hour_name'] = $row['hour_name'];
9131 9131
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9146,7 +9146,7 @@  discard block
 block discarded – undo
9146 9146
 	public function countAllHoursByCountry($country)
9147 9147
 	{
9148 9148
 		global $globalTimezone, $globalDBdriver;
9149
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
9149
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
9150 9150
 		if ($globalTimezone != '') {
9151 9151
 			date_default_timezone_set($globalTimezone);
9152 9152
 			$datetime = new DateTime();
@@ -9154,13 +9154,13 @@  discard block
 block discarded – undo
9154 9154
 		} else $offset = '+00:00';
9155 9155
 
9156 9156
 		if ($globalDBdriver == 'mysql') {
9157
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9157
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9158 9158
 								FROM spotter_output 
9159 9159
 								WHERE ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
9160 9160
 								GROUP BY hour_name 
9161 9161
 								ORDER BY hour_name ASC";
9162 9162
 		} else {
9163
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9163
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9164 9164
 								FROM spotter_output 
9165 9165
 								WHERE ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
9166 9166
 								GROUP BY hour_name 
@@ -9168,12 +9168,12 @@  discard block
 block discarded – undo
9168 9168
 		}
9169 9169
 		
9170 9170
 		$sth = $this->db->prepare($query);
9171
-		$sth->execute(array(':country' => $country,':offset' => $offset));
9171
+		$sth->execute(array(':country' => $country, ':offset' => $offset));
9172 9172
       
9173 9173
 		$hour_array = array();
9174 9174
 		$temp_array = array();
9175 9175
         
9176
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9176
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9177 9177
 		{
9178 9178
 			$temp_array['hour_name'] = $row['hour_name'];
9179 9179
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9195,8 +9195,8 @@  discard block
 block discarded – undo
9195 9195
 	*/
9196 9196
 	public function countOverallAircrafts($filters = array())
9197 9197
 	{
9198
-		$filter_query = $this->getFilter($filters,true,true);
9199
-		$query  = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
9198
+		$filter_query = $this->getFilter($filters, true, true);
9199
+		$query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
9200 9200
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
9201 9201
 		$sth = $this->db->prepare($query);
9202 9202
 		$sth->execute();
@@ -9211,8 +9211,8 @@  discard block
 block discarded – undo
9211 9211
 	*/
9212 9212
 	public function countOverallArrival($filters = array())
9213 9213
 	{
9214
-		$filter_query = $this->getFilter($filters,true,true);
9215
-		$query  = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
9214
+		$filter_query = $this->getFilter($filters, true, true);
9215
+		$query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
9216 9216
                     FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''";
9217 9217
 		
9218 9218
 		$sth = $this->db->prepare($query);
@@ -9228,8 +9228,8 @@  discard block
 block discarded – undo
9228 9228
 	*/
9229 9229
 	public function countOverallPilots($filters = array())
9230 9230
 	{
9231
-		$filter_query = $this->getFilter($filters,true,true);
9232
-		$query  = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
9231
+		$filter_query = $this->getFilter($filters, true, true);
9232
+		$query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
9233 9233
                     FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''";
9234 9234
 		$sth = $this->db->prepare($query);
9235 9235
 		$sth->execute();
@@ -9244,8 +9244,8 @@  discard block
 block discarded – undo
9244 9244
 	*/
9245 9245
 	public function countOverallOwners($filters = array())
9246 9246
 	{
9247
-		$filter_query = $this->getFilter($filters,true,true);
9248
-		$query  = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
9247
+		$filter_query = $this->getFilter($filters, true, true);
9248
+		$query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
9249 9249
                     FROM spotter_output".$filter_query." spotter_output.owner_name <> ''";
9250 9250
 		$sth = $this->db->prepare($query);
9251 9251
 		$sth->execute();
@@ -9278,8 +9278,8 @@  discard block
 block discarded – undo
9278 9278
 	*/
9279 9279
 	public function countOverallMilitaryFlights($filters = array())
9280 9280
 	{
9281
-		$filter_query = $this->getFilter($filters,true,true);
9282
-		$query  = "SELECT COUNT(s.spotter_id) AS flight_count  
9281
+		$filter_query = $this->getFilter($filters, true, true);
9282
+		$query = "SELECT COUNT(s.spotter_id) AS flight_count  
9283 9283
                     FROM spotter_output s, airlines a".$filter_query." s.airline_icao = a.icao AND a.type = 'military'";
9284 9284
       
9285 9285
 		$sth = $this->db->prepare($query);
@@ -9323,13 +9323,13 @@  discard block
 block discarded – undo
9323 9323
 		} else $offset = '+00:00';
9324 9324
 
9325 9325
 		if ($globalDBdriver == 'mysql') {
9326
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9326
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9327 9327
 								FROM spotter_output 
9328 9328
 								WHERE DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE()
9329 9329
 								GROUP BY hour_name 
9330 9330
 								ORDER BY hour_name ASC";
9331 9331
 		} else {
9332
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9332
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9333 9333
 								FROM spotter_output 
9334 9334
 								WHERE to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date)
9335 9335
 								GROUP BY hour_name 
@@ -9342,7 +9342,7 @@  discard block
 block discarded – undo
9342 9342
 		$hour_array = array();
9343 9343
 		$temp_array = array();
9344 9344
         
9345
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9345
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9346 9346
 		{
9347 9347
 			$temp_array['hour_name'] = $row['hour_name'];
9348 9348
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9366,8 +9366,8 @@  discard block
 block discarded – undo
9366 9366
 		if ($limit != "")
9367 9367
 		{
9368 9368
 			$limit_array = explode(",", $limit);
9369
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
9370
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
9369
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
9370
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
9371 9371
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
9372 9372
 			{
9373 9373
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
@@ -9422,7 +9422,7 @@  discard block
 block discarded – undo
9422 9422
 			    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')
9423 9423
 			    HAVING count(spotter_output.ident) > 5$orderby_query";
9424 9424
 			//echo $query;
9425
-			$spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone));
9425
+			$spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone));
9426 9426
 			/*
9427 9427
 			$sth = $this->db->prepare($query);
9428 9428
 			$sth->execute(array(':timezone' => $globalTimezone));
@@ -9441,9 +9441,9 @@  discard block
 block discarded – undo
9441 9441
 	*/
9442 9442
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
9443 9443
 	{
9444
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
9444
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
9445 9445
 
9446
-		$query  = "SELECT spotter_output.spotter_id
9446
+		$query = "SELECT spotter_output.spotter_id
9447 9447
 								FROM spotter_output 
9448 9448
 								WHERE spotter_output.flightaware_id = '".$flightaware_id."'";
9449 9449
         
@@ -9451,7 +9451,7 @@  discard block
 block discarded – undo
9451 9451
 		$sth = $this->db->prepare($query);
9452 9452
 		$sth->execute();
9453 9453
 
9454
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9454
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9455 9455
 		{
9456 9456
 			return $row['spotter_id'];
9457 9457
 		}
@@ -9476,23 +9476,23 @@  discard block
 block discarded – undo
9476 9476
 		}
9477 9477
 		
9478 9478
 		$current_date = date("Y-m-d H:i:s");
9479
-		$date = date("Y-m-d H:i:s",strtotime($dateString." UTC"));
9479
+		$date = date("Y-m-d H:i:s", strtotime($dateString." UTC"));
9480 9480
 		
9481 9481
 		$diff = abs(strtotime($current_date) - strtotime($date));
9482 9482
 
9483
-		$time_array['years'] = floor($diff / (365*60*60*24)); 
9483
+		$time_array['years'] = floor($diff/(365*60*60*24)); 
9484 9484
 		$years = $time_array['years'];
9485 9485
 		
9486
-		$time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
9486
+		$time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24));
9487 9487
 		$months = $time_array['months'];
9488 9488
 		
9489
-		$time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
9489
+		$time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24));
9490 9490
 		$days = $time_array['days'];
9491
-		$time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60));
9491
+		$time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60));
9492 9492
 		$hours = $time_array['hours'];
9493
-		$time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60);
9493
+		$time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60);
9494 9494
 		$minutes = $time_array['minutes'];
9495
-		$time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
9495
+		$time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
9496 9496
 		
9497 9497
 		return $time_array;	
9498 9498
 	}	
@@ -9518,63 +9518,63 @@  discard block
 block discarded – undo
9518 9518
 			$temp_array['direction_degree'] = $direction;
9519 9519
 			$temp_array['direction_shortname'] = "N";
9520 9520
 			$temp_array['direction_fullname'] = "North";
9521
-		} elseif ($direction >= 22.5 && $direction < 45){
9521
+		} elseif ($direction >= 22.5 && $direction < 45) {
9522 9522
 			$temp_array['direction_degree'] = $direction;
9523 9523
 			$temp_array['direction_shortname'] = "NNE";
9524 9524
 			$temp_array['direction_fullname'] = "North-Northeast";
9525
-		} elseif ($direction >= 45 && $direction < 67.5){
9525
+		} elseif ($direction >= 45 && $direction < 67.5) {
9526 9526
 			$temp_array['direction_degree'] = $direction;
9527 9527
 			$temp_array['direction_shortname'] = "NE";
9528 9528
 			$temp_array['direction_fullname'] = "Northeast";
9529
-		} elseif ($direction >= 67.5 && $direction < 90){
9529
+		} elseif ($direction >= 67.5 && $direction < 90) {
9530 9530
 			$temp_array['direction_degree'] = $direction;
9531 9531
 			$temp_array['direction_shortname'] = "ENE";
9532 9532
 			$temp_array['direction_fullname'] = "East-Northeast";
9533
-		} elseif ($direction >= 90 && $direction < 112.5){
9533
+		} elseif ($direction >= 90 && $direction < 112.5) {
9534 9534
 			$temp_array['direction_degree'] = $direction;
9535 9535
 			$temp_array['direction_shortname'] = "E";
9536 9536
 			$temp_array['direction_fullname'] = "East";
9537
-		} elseif ($direction >= 112.5 && $direction < 135){
9537
+		} elseif ($direction >= 112.5 && $direction < 135) {
9538 9538
 			$temp_array['direction_degree'] = $direction;
9539 9539
 			$temp_array['direction_shortname'] = "ESE";
9540 9540
 			$temp_array['direction_fullname'] = "East-Southeast";
9541
-		} elseif ($direction >= 135 && $direction < 157.5){
9541
+		} elseif ($direction >= 135 && $direction < 157.5) {
9542 9542
 			$temp_array['direction_degree'] = $direction;
9543 9543
 			$temp_array['direction_shortname'] = "SE";
9544 9544
 			$temp_array['direction_fullname'] = "Southeast";
9545
-		} elseif ($direction >= 157.5 && $direction < 180){
9545
+		} elseif ($direction >= 157.5 && $direction < 180) {
9546 9546
 			$temp_array['direction_degree'] = $direction;
9547 9547
 			$temp_array['direction_shortname'] = "SSE";
9548 9548
 			$temp_array['direction_fullname'] = "South-Southeast";
9549
-		} elseif ($direction >= 180 && $direction < 202.5){
9549
+		} elseif ($direction >= 180 && $direction < 202.5) {
9550 9550
 			$temp_array['direction_degree'] = $direction;
9551 9551
 			$temp_array['direction_shortname'] = "S";
9552 9552
 			$temp_array['direction_fullname'] = "South";
9553
-		} elseif ($direction >= 202.5 && $direction < 225){
9553
+		} elseif ($direction >= 202.5 && $direction < 225) {
9554 9554
 			$temp_array['direction_degree'] = $direction;
9555 9555
 			$temp_array['direction_shortname'] = "SSW";
9556 9556
 			$temp_array['direction_fullname'] = "South-Southwest";
9557
-		} elseif ($direction >= 225 && $direction < 247.5){
9557
+		} elseif ($direction >= 225 && $direction < 247.5) {
9558 9558
 			$temp_array['direction_degree'] = $direction;
9559 9559
 			$temp_array['direction_shortname'] = "SW";
9560 9560
 			$temp_array['direction_fullname'] = "Southwest";
9561
-		} elseif ($direction >= 247.5 && $direction < 270){
9561
+		} elseif ($direction >= 247.5 && $direction < 270) {
9562 9562
 			$temp_array['direction_degree'] = $direction;
9563 9563
 			$temp_array['direction_shortname'] = "WSW";
9564 9564
 			$temp_array['direction_fullname'] = "West-Southwest";
9565
-		} elseif ($direction >= 270 && $direction < 292.5){
9565
+		} elseif ($direction >= 270 && $direction < 292.5) {
9566 9566
 			$temp_array['direction_degree'] = $direction;
9567 9567
 			$temp_array['direction_shortname'] = "W";
9568 9568
 			$temp_array['direction_fullname'] = "West";
9569
-		} elseif ($direction >= 292.5 && $direction < 315){
9569
+		} elseif ($direction >= 292.5 && $direction < 315) {
9570 9570
 			$temp_array['direction_degree'] = $direction;
9571 9571
 			$temp_array['direction_shortname'] = "WNW";
9572 9572
 			$temp_array['direction_fullname'] = "West-Northwest";
9573
-		} elseif ($direction >= 315 && $direction < 337.5){
9573
+		} elseif ($direction >= 315 && $direction < 337.5) {
9574 9574
 			$temp_array['direction_degree'] = $direction;
9575 9575
 			$temp_array['direction_shortname'] = "NW";
9576 9576
 			$temp_array['direction_fullname'] = "Northwest";
9577
-		} elseif ($direction >= 337.5 && $direction < 360){
9577
+		} elseif ($direction >= 337.5 && $direction < 360) {
9578 9578
 			$temp_array['direction_degree'] = $direction;
9579 9579
 			$temp_array['direction_shortname'] = "NNW";
9580 9580
 			$temp_array['direction_fullname'] = "North-Northwest";
@@ -9627,9 +9627,9 @@  discard block
 block discarded – undo
9627 9627
 	*/
9628 9628
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
9629 9629
 	{
9630
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
9630
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
9631 9631
 	
9632
-		$query  = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9632
+		$query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9633 9633
 		
9634 9634
 		$sth = $this->db->prepare($query);
9635 9635
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -9651,9 +9651,9 @@  discard block
 block discarded – undo
9651 9651
 	*/
9652 9652
 	public function getAircraftTypeBymodeS($aircraft_modes)
9653 9653
 	{
9654
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
9654
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
9655 9655
 	
9656
-		$query  = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9656
+		$query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9657 9657
 		
9658 9658
 		$sth = $this->db->prepare($query);
9659 9659
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -9673,11 +9673,11 @@  discard block
 block discarded – undo
9673 9673
 	* @param Float $longitude longitute of the flight
9674 9674
 	* @return String the countrie
9675 9675
 	*/
9676
-	public function getCountryFromLatitudeLongitude($latitude,$longitude)
9676
+	public function getCountryFromLatitudeLongitude($latitude, $longitude)
9677 9677
 	{
9678 9678
 		global $globalDBdriver, $globalDebug;
9679
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9680
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9679
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
9680
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
9681 9681
 	
9682 9682
 		$Connection = new Connection($this->db);
9683 9683
 		if (!$Connection->tableExists('countries')) return '';
@@ -9716,19 +9716,19 @@  discard block
 block discarded – undo
9716 9716
 	*/
9717 9717
 	public function convertAircraftRegistration($registration)
9718 9718
 	{
9719
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9719
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9720 9720
 		$registration_prefix = '';
9721 9721
 		$registration_1 = substr($registration, 0, 1);
9722 9722
 		$registration_2 = substr($registration, 0, 2);
9723 9723
 
9724 9724
 		//first get the prefix based on two characters
9725
-		$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
9725
+		$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
9726 9726
       
9727 9727
 		
9728 9728
 		$sth = $this->db->prepare($query);
9729 9729
 		$sth->execute(array(':registration_2' => $registration_2));
9730 9730
         
9731
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9731
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9732 9732
 		{
9733 9733
 			$registration_prefix = $row['registration_prefix'];
9734 9734
 		}
@@ -9736,11 +9736,11 @@  discard block
 block discarded – undo
9736 9736
 		//if we didn't find a two chracter prefix lets just search the one with one character
9737 9737
 		if ($registration_prefix == '')
9738 9738
 		{
9739
-			$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
9739
+			$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
9740 9740
 			$sth = $this->db->prepare($query);
9741 9741
 			$sth->execute(array(':registration_1' => $registration_1));
9742 9742
 	        
9743
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9743
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9744 9744
 			{
9745 9745
 				$registration_prefix = $row['registration_prefix'];
9746 9746
 			}
@@ -9754,7 +9754,7 @@  discard block
 block discarded – undo
9754 9754
 			} else {
9755 9755
 				$registration = preg_replace("/^(.{1})/", "$1-", $registration);
9756 9756
 			}
9757
-		} else if(strlen($registration_prefix) == 2){
9757
+		} else if (strlen($registration_prefix) == 2) {
9758 9758
 			if (0 === strpos($registration, 'N')) {
9759 9759
 				$registration = preg_replace("/^(.{2})/", "$1", $registration);
9760 9760
 			} else {
@@ -9773,17 +9773,17 @@  discard block
 block discarded – undo
9773 9773
 	*/
9774 9774
 	public function countryFromAircraftRegistration($registration)
9775 9775
 	{
9776
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9776
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9777 9777
 		
9778 9778
 		$registration_prefix = '';
9779
-		$registration_test = explode('-',$registration);
9779
+		$registration_test = explode('-', $registration);
9780 9780
 		$country = '';
9781 9781
 		if ($registration_test[0] != $registration) {
9782 9782
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9783 9783
 	      
9784 9784
 			$sth = $this->db->prepare($query);
9785 9785
 			$sth->execute(array(':registration_1' => $registration_test[0]));
9786
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9786
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9787 9787
 			{
9788 9788
 				//$registration_prefix = $row['registration_prefix'];
9789 9789
 				$country = $row['country'];
@@ -9794,13 +9794,13 @@  discard block
 block discarded – undo
9794 9794
 
9795 9795
 			$country = '';
9796 9796
 			//first get the prefix based on two characters
9797
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
9797
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
9798 9798
       
9799 9799
 			
9800 9800
 			$sth = $this->db->prepare($query);
9801 9801
 			$sth->execute(array(':registration_2' => $registration_2));
9802 9802
         
9803
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9803
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9804 9804
 			{
9805 9805
 				$registration_prefix = $row['registration_prefix'];
9806 9806
 				$country = $row['country'];
@@ -9809,12 +9809,12 @@  discard block
 block discarded – undo
9809 9809
 			//if we didn't find a two chracter prefix lets just search the one with one character
9810 9810
 			if ($registration_prefix == "")
9811 9811
 			{
9812
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9812
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9813 9813
 	      
9814 9814
 				$sth = $this->db->prepare($query);
9815 9815
 				$sth->execute(array(':registration_1' => $registration_1));
9816 9816
 	        
9817
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
9817
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9818 9818
 				{
9819 9819
 					//$registration_prefix = $row['registration_prefix'];
9820 9820
 					$country = $row['country'];
@@ -9831,9 +9831,9 @@  discard block
 block discarded – undo
9831 9831
 	* @param String $flightaware_id flightaware_id from spotter_output table
9832 9832
 	* @param String $highlight New highlight value
9833 9833
 	*/
9834
-	public function setHighlightFlight($flightaware_id,$highlight) {
9834
+	public function setHighlightFlight($flightaware_id, $highlight) {
9835 9835
 		
9836
-		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
9836
+		$query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
9837 9837
 		$sth = $this->db->prepare($query);
9838 9838
 		$sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight));
9839 9839
 	}
@@ -9862,7 +9862,7 @@  discard block
 block discarded – undo
9862 9862
 		
9863 9863
 		$bitly_data = json_decode($bitly_data);
9864 9864
 		$bitly_url = '';
9865
-		if ($bitly_data->status_txt = "OK"){
9865
+		if ($bitly_data->status_txt = "OK") {
9866 9866
 			$bitly_url = $bitly_data->data->url;
9867 9867
 		}
9868 9868
 
@@ -9872,7 +9872,7 @@  discard block
 block discarded – undo
9872 9872
 
9873 9873
 	public function getOrderBy()
9874 9874
 	{
9875
-		$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"));
9875
+		$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"));
9876 9876
 		
9877 9877
 		return $orderby;
9878 9878
 		
@@ -10006,14 +10006,14 @@  discard block
 block discarded – undo
10006 10006
 		}
10007 10007
 		$sth = $this->db->prepare($query);
10008 10008
 		$sth->execute();
10009
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10009
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10010 10010
 		{
10011 10011
 			$departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']);
10012 10012
 			$arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']);
10013 10013
 			if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) {
10014
-				$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";
10014
+				$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";
10015 10015
 				$sthu = $this->db->prepare($update_query);
10016
-				$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']));
10016
+				$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']));
10017 10017
 			}
10018 10018
 		}
10019 10019
 		
@@ -10026,7 +10026,7 @@  discard block
 block discarded – undo
10026 10026
 		}
10027 10027
 		$sth = $this->db->prepare($query);
10028 10028
 		$sth->execute();
10029
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10029
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10030 10030
 		{
10031 10031
 			if (is_numeric(substr($row['ident'], -1, 1)))
10032 10032
 			{
@@ -10035,11 +10035,11 @@  discard block
 block discarded – undo
10035 10035
 				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
10036 10036
 				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
10037 10037
 				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
10038
-				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
10038
+				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
10039 10039
 				if (isset($airline_array[0]['name'])) {
10040
-					$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";
10040
+					$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";
10041 10041
 					$sthu = $this->db->prepare($update_query);
10042
-					$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']));
10042
+					$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']));
10043 10043
 				}
10044 10044
 			}
10045 10045
 		}
@@ -10059,18 +10059,18 @@  discard block
 block discarded – undo
10059 10059
 		}
10060 10060
 		$sth = $this->db->prepare($query);
10061 10061
 		$sth->execute();
10062
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10062
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10063 10063
 		{
10064 10064
 			if ($row['aircraft_icao'] != '') {
10065 10065
 				$aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']);
10066
-				if ($row['registration'] != ""){
10066
+				if ($row['registration'] != "") {
10067 10067
 					$image_array = $Image->getSpotterImage($row['registration']);
10068 10068
 					if (count($image_array) == 0) {
10069 10069
 						$Image->addSpotterImage($row['registration']);
10070 10070
 					}
10071 10071
 				}
10072 10072
 				if (count($aircraft_name) > 0) {
10073
-					$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";
10073
+					$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";
10074 10074
 					$sthu = $this->db->prepare($update_query);
10075 10075
 					$sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id']));
10076 10076
 				}
@@ -10085,10 +10085,10 @@  discard block
 block discarded – undo
10085 10085
 		$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";
10086 10086
 		$sth = $this->db->prepare($query);
10087 10087
 		$sth->execute();
10088
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10088
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10089 10089
 		{
10090 10090
 			if ($row['last_latitude'] != '' && $row['last_longitude'] != '') {
10091
-				$closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist);
10091
+				$closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist);
10092 10092
 				$airport_icao = '';
10093 10093
 				 if (isset($closestAirports[0])) {
10094 10094
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
@@ -10102,7 +10102,7 @@  discard block
 block discarded – undo
10102 10102
 								break;
10103 10103
 							}
10104 10104
 						}
10105
-					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
10105
+					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) {
10106 10106
 						$airport_icao = $closestAirports[0]['icao'];
10107 10107
 						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";
10108 10108
 					} else {
@@ -10113,28 +10113,28 @@  discard block
 block discarded – undo
10113 10113
 				}
10114 10114
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
10115 10115
 					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
10116
-					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10116
+					$update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10117 10117
 					$sthu = $this->db->prepare($update_query);
10118
-					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
10118
+					$sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id']));
10119 10119
 				}
10120 10120
 			}
10121 10121
 		}
10122 10122
 	}
10123 10123
 	
10124
-	public function closestAirports($origLat,$origLon,$dist = 10) {
10124
+	public function closestAirports($origLat, $origLon, $dist = 10) {
10125 10125
 		global $globalDBdriver;
10126
-		$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
10126
+		$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
10127 10127
 /*
10128 10128
 		$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 
10129 10129
                       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)) 
10130 10130
                       having distance < $dist ORDER BY distance limit 100;";
10131 10131
 */
10132 10132
 		if ($globalDBdriver == 'mysql') {
10133
-			$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 
10133
+			$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 
10134 10134
 	                      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)) 
10135 10135
 	                      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;";
10136 10136
                 } else {
10137
-			$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 
10137
+			$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 
10138 10138
 	                      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)) 
10139 10139
 	                      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;";
10140 10140
     		}
Please login to merge, or discard this patch.
Braces   +646 added lines, -224 removed lines patch added patch discarded remove patch
@@ -19,7 +19,9 @@  discard block
 block discarded – undo
19 19
 	*/
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter;
22
-		if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter);
22
+		if (is_array($globalFilter)) {
23
+			$filter = array_merge($globalFilter,$filter);
24
+		}
23 25
 		$filter_query_join = '';
24 26
 		$filter_query_where = '';
25 27
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
@@ -44,8 +46,11 @@  discard block
 block discarded – undo
44 46
 				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
45 47
 			}
46 48
 		}
47
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
48
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
49
+		if ($filter_query_where == '' && $where) {
50
+			$filter_query_where = ' WHERE';
51
+		} elseif ($filter_query_where != '' && $and) {
52
+			$filter_query_where .= ' AND';
53
+		}
49 54
 		$filter_query = $filter_query_join.$filter_query_where;
50 55
 		return $filter_query;
51 56
 	}
@@ -65,9 +70,15 @@  discard block
 block discarded – undo
65 70
 		$Image = new Image($this->db);
66 71
 		$Schedule = new Schedule($this->db);
67 72
 		$ACARS = new ACARS($this->db);
68
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
69
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
70
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
73
+		if (!isset($globalIVAO)) {
74
+			$globalIVAO = FALSE;
75
+		}
76
+		if (!isset($globalVATSIM)) {
77
+			$globalVATSIM = FALSE;
78
+		}
79
+		if (!isset($globalphpVMS)) {
80
+			$globalphpVMS = FALSE;
81
+		}
71 82
 		date_default_timezone_set('UTC');
72 83
 		
73 84
 		if (!is_string($query))
@@ -114,21 +125,35 @@  discard block
 block discarded – undo
114 125
 			} else {
115 126
 				$temp_array['spotter_id'] = '';
116 127
 			}
117
-			if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id'];
118
-			if (isset($row['modes'])) $temp_array['modes'] = $row['modes'];
128
+			if (isset($row['flightaware_id'])) {
129
+				$temp_array['flightaware_id'] = $row['flightaware_id'];
130
+			}
131
+			if (isset($row['modes'])) {
132
+				$temp_array['modes'] = $row['modes'];
133
+			}
119 134
 			$temp_array['ident'] = $row['ident'];
120 135
 			if (isset($row['registration']) && $row['registration'] != '') {
121 136
 				$temp_array['registration'] = $row['registration'];
122 137
 			} elseif (isset($temp_array['modes'])) {
123 138
 				$temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']);
124
-			} else $temp_array['registration'] = '';
125
-			if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao'];
139
+			} else {
140
+				$temp_array['registration'] = '';
141
+			}
142
+			if (isset($row['aircraft_icao'])) {
143
+				$temp_array['aircraft_type'] = $row['aircraft_icao'];
144
+			}
126 145
 			
127 146
 			$temp_array['departure_airport'] = $row['departure_airport_icao'];
128 147
 			$temp_array['arrival_airport'] = $row['arrival_airport_icao'];
129
-			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
130
-			if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude'];
131
-			if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude'];
148
+			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) {
149
+				$temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
150
+			}
151
+			if (isset($row['latitude'])) {
152
+				$temp_array['latitude'] = $row['latitude'];
153
+			}
154
+			if (isset($row['longitude'])) {
155
+				$temp_array['longitude'] = $row['longitude'];
156
+			}
132 157
 			/*
133 158
 			if (Connection->tableExists('countries')) {
134 159
 				$country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']);
@@ -138,8 +163,12 @@  discard block
 block discarded – undo
138 163
 				}
139 164
 			}
140 165
 			*/
141
-			if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints'];
142
-			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
166
+			if (isset($row['waypoints'])) {
167
+				$temp_array['waypoints'] = $row['waypoints'];
168
+			}
169
+			if (isset($row['format_source'])) {
170
+				$temp_array['format_source'] = $row['format_source'];
171
+			}
143 172
 			if (isset($row['route_stop'])) {
144 173
 				$temp_array['route_stop'] = $row['route_stop'];
145 174
 				if ($row['route_stop'] != '') {
@@ -158,13 +187,19 @@  discard block
 block discarded – undo
158 187
 					}
159 188
 				}
160 189
 			}
161
-			if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude'];
190
+			if (isset($row['altitude'])) {
191
+				$temp_array['altitude'] = $row['altitude'];
192
+			}
162 193
 			if (isset($row['heading'])) {
163 194
 				$temp_array['heading'] = $row['heading'];
164 195
 				$heading_direction = $this->parseDirection($row['heading']);
165
-				if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
196
+				if (isset($heading_direction[0]['direction_fullname'])) {
197
+					$temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
198
+				}
199
+			}
200
+			if (isset($row['ground_speed'])) {
201
+				$temp_array['ground_speed'] = $row['ground_speed'];
166 202
 			}
167
-			if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed'];
168 203
 			$temp_array['image'] = "";
169 204
 			$temp_array['image_thumbnail'] = "";
170 205
 			$temp_array['image_source'] = "";
@@ -172,7 +207,9 @@  discard block
 block discarded – undo
172 207
  
173 208
 			if (isset($row['highlight'])) {
174 209
 				$temp_array['highlight'] = $row['highlight'];
175
-			} else $temp_array['highlight'] = '';
210
+			} else {
211
+				$temp_array['highlight'] = '';
212
+			}
176 213
 			
177 214
 			if (isset($row['date'])) {
178 215
 				$dateArray = $this->parseDateString($row['date']);
@@ -220,7 +257,9 @@  discard block
 block discarded – undo
220 257
 				
221 258
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
222 259
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
223
-					} else $temp_array['aircraft_shadow'] = 'default.png';
260
+					} else {
261
+						$temp_array['aircraft_shadow'] = 'default.png';
262
+					}
224 263
                                 } else {
225 264
                             		$temp_array['aircraft_shadow'] = 'default.png';
226 265
 					$temp_array['aircraft_name'] = 'N/A';
@@ -228,11 +267,17 @@  discard block
 block discarded – undo
228 267
                             	}
229 268
 			}
230 269
 			$fromsource = NULL;
231
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
232
-			elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
233
-			elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
234
-			elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
235
-			elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
270
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
271
+				$fromsource = $globalAirlinesSource;
272
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
273
+				$fromsource = 'vatsim';
274
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
275
+				$fromsource = 'ivao';
276
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
277
+				$fromsource = 'vatsim';
278
+			} elseif (isset($globalIVAO) && $globalIVAO) {
279
+				$fromsource = 'ivao';
280
+			}
236 281
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
237 282
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
238 283
 					if (is_numeric(substr($row['ident'], 2, 1))) {
@@ -255,12 +300,18 @@  discard block
 block discarded – undo
255 300
 				}
256 301
 			} else {
257 302
 				$temp_array['airline_icao'] = $row['airline_icao'];
258
-				if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata'];
259
-				else $temp_array['airline_iata'] = '';
303
+				if (isset($row['airline_iata'])) {
304
+					$temp_array['airline_iata'] = $row['airline_iata'];
305
+				} else {
306
+					$temp_array['airline_iata'] = '';
307
+				}
260 308
 				$temp_array['airline_name'] = $row['airline_name'];
261 309
 				$temp_array['airline_country'] = $row['airline_country'];
262
-				if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign'];
263
-				else $temp_array['airline_callsign'] = 'N/A';
310
+				if (isset($row['airline_callsign'])) {
311
+					$temp_array['airline_callsign'] = $row['airline_callsign'];
312
+				} else {
313
+					$temp_array['airline_callsign'] = 'N/A';
314
+				}
264 315
 				$temp_array['airline_type'] = $row['airline_type'];
265 316
 			}
266 317
 			if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') {
@@ -276,7 +327,9 @@  discard block
 block discarded – undo
276 327
 			}
277 328
 			if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !isset($temp_array['aircraft_owner'])) {
278 329
 				$owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']);
279
-				if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
330
+				if ($owner_info['owner'] != '') {
331
+					$temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
332
+				}
280 333
 				$temp_array['aircraft_base'] = $owner_info['base'];
281 334
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
282 335
 			}
@@ -284,9 +337,14 @@  discard block
 block discarded – undo
284 337
 			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
285 338
 			{
286 339
 				if ($globalIVAO) {
287
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
288
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
289
-				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
340
+					if (isset($temp_array['airline_icao'])) {
341
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
342
+					} else {
343
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
344
+					}
345
+				} else {
346
+					$image_array = $Image->getSpotterImage($temp_array['registration']);
347
+				}
290 348
 				if (count($image_array) > 0) {
291 349
 					$temp_array['image'] = $image_array[0]['image'];
292 350
 					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -336,7 +394,9 @@  discard block
 block discarded – undo
336 394
 			//if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') {
337 395
 			if ($row['departure_airport_icao'] != '') {
338 396
 				$departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']);
339
-				if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA');
397
+				if (!isset($departure_airport_array[0]['name'])) {
398
+					$departure_airport_array = $this->getAllAirportInfo('NA');
399
+				}
340 400
 			/*
341 401
 			} elseif ($row['departure_airport_name'] != '') {
342 402
 				$temp_array['departure_airport_name'] = $row['departure_airport_name'];
@@ -344,7 +404,9 @@  discard block
 block discarded – undo
344 404
 				$temp_array['departure_airport_country'] = $row['departure_airport_country'];
345 405
 				$temp_array['departure_airport_icao'] = $row['departure_airport_icao'];
346 406
 			*/
347
-			} else $departure_airport_array = $this->getAllAirportInfo('NA');
407
+			} else {
408
+				$departure_airport_array = $this->getAllAirportInfo('NA');
409
+			}
348 410
 			if (isset($departure_airport_array[0]['name'])) {
349 411
 				$temp_array['departure_airport_name'] = $departure_airport_array[0]['name'];
350 412
 				$temp_array['departure_airport_city'] = $departure_airport_array[0]['city'];
@@ -364,8 +426,12 @@  discard block
 block discarded – undo
364 426
 			
365 427
 			if ($row['arrival_airport_icao'] != '') {
366 428
 				$arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']);
367
-				if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA');
368
-			} else $arrival_airport_array = $this->getAllAirportInfo('NA');
429
+				if (count($arrival_airport_array) == 0) {
430
+					$arrival_airport_array = $this->getAllAirportInfo('NA');
431
+				}
432
+			} else {
433
+				$arrival_airport_array = $this->getAllAirportInfo('NA');
434
+			}
369 435
 			if (isset($arrival_airport_array[0]['name'])) {
370 436
 				$temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name'];
371 437
 				$temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city'];
@@ -381,27 +447,45 @@  discard block
 block discarded – undo
381 447
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
382 448
 			}
383 449
 			*/
384
-			if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id'];
385
-			if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name'];
386
-			if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name'];
387
-			if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country'];
388
-			if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance'];
450
+			if (isset($row['pilot_id']) && $row['pilot_id'] != '') {
451
+				$temp_array['pilot_id'] = $row['pilot_id'];
452
+			}
453
+			if (isset($row['pilot_name']) && $row['pilot_name'] != '') {
454
+				$temp_array['pilot_name'] = $row['pilot_name'];
455
+			}
456
+			if (isset($row['source_name']) && $row['source_name'] != '') {
457
+				$temp_array['source_name'] = $row['source_name'];
458
+			}
459
+			if (isset($row['over_country']) && $row['over_country'] != '') {
460
+				$temp_array['over_country'] = $row['over_country'];
461
+			}
462
+			if (isset($row['distance']) && $row['distance'] != '') {
463
+				$temp_array['distance'] = $row['distance'];
464
+			}
389 465
 			if (isset($row['squawk'])) {
390 466
 				$temp_array['squawk'] = $row['squawk'];
391 467
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
392 468
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
393
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
469
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
470
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
471
+					}
394 472
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
395 473
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
396
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
397
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
474
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
475
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
476
+					}
477
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) {
478
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
479
+				}
398 480
 			}
399 481
     			
400 482
 			$temp_array['query_number_rows'] = $num_rows;
401 483
 			
402 484
 			$spotter_array[] = $temp_array;
403 485
 		}
404
-		if ($num_rows == 0) return array();
486
+		if ($num_rows == 0) {
487
+			return array();
488
+		}
405 489
 		$spotter_array[0]['query_number_rows'] = $num_rows;
406 490
 		return $spotter_array;
407 491
 	}	
@@ -434,7 +518,9 @@  discard block
 block discarded – undo
434 518
 				foreach ($q_array as $q_item){
435 519
 					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
436 520
 					$additional_query .= " AND (";
437
-					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
521
+					if (is_int($q_item)) {
522
+						$additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
523
+					}
438 524
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
439 525
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
440 526
 					$additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR ";
@@ -455,7 +541,9 @@  discard block
 block discarded – undo
455 541
 					$additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR ";
456 542
 					$additional_query .= "(spotter_output.ident like '%".$q_item."%') OR ";
457 543
 					$translate = $Translation->ident2icao($q_item);
458
-					if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
544
+					if ($translate != $q_item) {
545
+						$additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
546
+					}
459 547
 					$additional_query .= "(spotter_output.highlight like '%".$q_item."%')";
460 548
 					$additional_query .= ")";
461 549
 				}
@@ -682,7 +770,9 @@  discard block
 block discarded – undo
682 770
 				date_default_timezone_set($globalTimezone);
683 771
 				$datetime = new DateTime();
684 772
 				$offset = $datetime->format('P');
685
-			} else $offset = '+00:00';
773
+			} else {
774
+				$offset = '+00:00';
775
+			}
686 776
 
687 777
 			if ($date_array[1] != "")
688 778
 			{
@@ -714,8 +804,12 @@  discard block
 block discarded – undo
714 804
 			{
715 805
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
716 806
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
717
-			} else $limit_query = "";
718
-		} else $limit_query = "";
807
+			} else {
808
+				$limit_query = "";
809
+			}
810
+		} else {
811
+			$limit_query = "";
812
+		}
719 813
 
720 814
 
721 815
 		if ($sort != "")
@@ -783,8 +877,12 @@  discard block
 block discarded – undo
783 877
 			{
784 878
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
785 879
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
786
-			} else $limit_query = "";
787
-		} else $limit_query = "";
880
+			} else {
881
+				$limit_query = "";
882
+			}
883
+		} else {
884
+			$limit_query = "";
885
+		}
788 886
 		
789 887
 		if ($sort != "")
790 888
 		{
@@ -1108,7 +1206,9 @@  discard block
 block discarded – undo
1108 1206
 		global $global_query;
1109 1207
 		
1110 1208
 		date_default_timezone_set('UTC');
1111
-		if ($id == '') return array();
1209
+		if ($id == '') {
1210
+			return array();
1211
+		}
1112 1212
 		$additional_query = "spotter_output.spotter_id = :id";
1113 1213
 		$query_values = array(':id' => $id);
1114 1214
 
@@ -1745,7 +1845,9 @@  discard block
 block discarded – undo
1745 1845
 		{
1746 1846
 			$highlight = $row['highlight'];
1747 1847
 		}
1748
-		if (isset($highlight)) return $highlight;
1848
+		if (isset($highlight)) {
1849
+			return $highlight;
1850
+		}
1749 1851
 	}
1750 1852
 
1751 1853
 	
@@ -1772,7 +1874,9 @@  discard block
 block discarded – undo
1772 1874
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
1773 1875
 		if (count($row) > 0) {
1774 1876
 			return $row['usage'];
1775
-		} else return '';
1877
+		} else {
1878
+			return '';
1879
+		}
1776 1880
 	}
1777 1881
 
1778 1882
 	/**
@@ -1796,7 +1900,9 @@  discard block
 block discarded – undo
1796 1900
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
1797 1901
 		if (count($row) > 0) {
1798 1902
 			return $row['icao'];
1799
-		} else return '';
1903
+		} else {
1904
+			return '';
1905
+		}
1800 1906
 	}
1801 1907
 
1802 1908
 	/**
@@ -1823,7 +1929,9 @@  discard block
 block discarded – undo
1823 1929
 			$airport_longitude = $row['longitude'];
1824 1930
 			$Common = new Common();
1825 1931
 			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
1826
-		} else return '';
1932
+		} else {
1933
+			return '';
1934
+		}
1827 1935
 	}
1828 1936
 	
1829 1937
 	/**
@@ -1935,7 +2043,9 @@  discard block
 block discarded – undo
1935 2043
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1936 2044
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1937 2045
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1938
-		} else return array();
2046
+		} else {
2047
+			return array();
2048
+		}
1939 2049
 		if ($globalDBdriver == 'mysql') {
1940 2050
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
1941 2051
 		} else {
@@ -1970,7 +2080,9 @@  discard block
 block discarded – undo
1970 2080
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1971 2081
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1972 2082
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1973
-		} else return array();
2083
+		} else {
2084
+			return array();
2085
+		}
1974 2086
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
1975 2087
 		$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.")";
1976 2088
 		//$query  = "SELECT waypoints.* FROM waypoints";
@@ -2108,15 +2220,20 @@  discard block
 block discarded – undo
2108 2220
 				'A320-211' => 'A320',
2109 2221
 				'747-8i' => 'B748',
2110 2222
 				'A380' => 'A388');
2111
-		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2223
+		if (isset($all_aircraft[$aircraft_type])) {
2224
+			return $all_aircraft[$aircraft_type];
2225
+		}
2112 2226
 
2113 2227
 		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2114 2228
 		$aircraft_type = strtoupper($aircraft_type);
2115 2229
 		$sth = $this->db->prepare($query);
2116 2230
 		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2117 2231
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2118
-		if (isset($result[0]['icao'])) return $result[0]['icao'];
2119
-		else return '';
2232
+		if (isset($result[0]['icao'])) {
2233
+			return $result[0]['icao'];
2234
+		} else {
2235
+			return '';
2236
+		}
2120 2237
 	}
2121 2238
 	
2122 2239
 	/**
@@ -2138,7 +2255,9 @@  discard block
 block discarded – undo
2138 2255
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
2139 2256
 		if (isset($row['icaotypecode'])) {
2140 2257
 			return $row['icaotypecode'];
2141
-		} else return '';
2258
+		} else {
2259
+			return '';
2260
+		}
2142 2261
 	}
2143 2262
 
2144 2263
 	/**
@@ -2159,7 +2278,9 @@  discard block
 block discarded – undo
2159 2278
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
2160 2279
 		if (isset($row['operator_correct'])) {
2161 2280
 			return $row['operator_correct'];
2162
-		} else return $operator;
2281
+		} else {
2282
+			return $operator;
2283
+		}
2163 2284
 	}
2164 2285
 
2165 2286
 	/**
@@ -2172,7 +2293,9 @@  discard block
 block discarded – undo
2172 2293
 	public function getRouteInfo($callsign)
2173 2294
 	{
2174 2295
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2175
-                if ($callsign == '') return array();
2296
+                if ($callsign == '') {
2297
+                	return array();
2298
+                }
2176 2299
 		$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";
2177 2300
 		
2178 2301
 		$sth = $this->db->prepare($query);
@@ -2181,7 +2304,9 @@  discard block
 block discarded – undo
2181 2304
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
2182 2305
 		if (count($row) > 0) {
2183 2306
 			return $row;
2184
-		} else return array();
2307
+		} else {
2308
+			return array();
2309
+		}
2185 2310
 	}
2186 2311
 	
2187 2312
 	/**
@@ -2233,7 +2358,9 @@  discard block
 block discarded – undo
2233 2358
 			$sth->execute(array(':registration' => $registration));
2234 2359
 
2235 2360
 			return $sth->fetch(PDO::FETCH_ASSOC);
2236
-		} else return array();
2361
+		} else {
2362
+			return array();
2363
+		}
2237 2364
 	}
2238 2365
 	
2239 2366
   
@@ -2389,8 +2516,11 @@  discard block
 block discarded – undo
2389 2516
 		$query .= " ORDER BY spotter_output.source_name ASC";
2390 2517
 
2391 2518
 		$sth = $this->db->prepare($query);
2392
-		if (!empty($query_values)) $sth->execute($query_values);
2393
-		else $sth->execute();
2519
+		if (!empty($query_values)) {
2520
+			$sth->execute($query_values);
2521
+		} else {
2522
+			$sth->execute();
2523
+		}
2394 2524
 
2395 2525
 		$source_array = array();
2396 2526
 		$temp_array = array();
@@ -2422,9 +2552,13 @@  discard block
 block discarded – undo
2422 2552
 								WHERE spotter_output.airline_icao <> '' 
2423 2553
 								ORDER BY spotter_output.airline_name ASC";
2424 2554
 			*/
2425
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2426
-			elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2427
-			elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2555
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2556
+				$forsource = $globalAirlinesSource;
2557
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
2558
+				$forsource = 'vatsim';
2559
+			} elseif (isset($globalIVAO) && $globalIVAO) {
2560
+				$forsource = 'ivao';
2561
+			}
2428 2562
 			if ($forsource === NULL) {
2429 2563
 				$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";
2430 2564
 				$query_data = array();
@@ -2722,7 +2856,9 @@  discard block
 block discarded – undo
2722 2856
 			date_default_timezone_set($globalTimezone);
2723 2857
 			$datetime = new DateTime();
2724 2858
 			$offset = $datetime->format('P');
2725
-		} else $offset = '+00:00';
2859
+		} else {
2860
+			$offset = '+00:00';
2861
+		}
2726 2862
 		if ($airport_icao == '') {
2727 2863
 			if ($globalDBdriver == 'mysql') {
2728 2864
 				$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` WHERE 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";
@@ -2754,7 +2890,9 @@  discard block
 block discarded – undo
2754 2890
 			date_default_timezone_set($globalTimezone);
2755 2891
 			$datetime = new DateTime();
2756 2892
 			$offset = $datetime->format('P');
2757
-		} else $offset = '+00:00';
2893
+		} else {
2894
+			$offset = '+00:00';
2895
+		}
2758 2896
 		if ($airport_icao == '') {
2759 2897
 			if ($globalDBdriver == 'mysql') {
2760 2898
 				$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";
@@ -2786,7 +2924,9 @@  discard block
 block discarded – undo
2786 2924
 			date_default_timezone_set($globalTimezone);
2787 2925
 			$datetime = new DateTime();
2788 2926
 			$offset = $datetime->format('P');
2789
-		} else $offset = '+00:00';
2927
+		} else {
2928
+			$offset = '+00:00';
2929
+		}
2790 2930
 		if ($airport_icao == '') {
2791 2931
 			if ($globalDBdriver == 'mysql') {
2792 2932
 				$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 
@@ -2829,7 +2969,9 @@  discard block
 block discarded – undo
2829 2969
 			date_default_timezone_set($globalTimezone);
2830 2970
 			$datetime = new DateTime();
2831 2971
 			$offset = $datetime->format('P');
2832
-		} else $offset = '+00:00';
2972
+		} else {
2973
+			$offset = '+00:00';
2974
+		}
2833 2975
 		if ($airport_icao == '') {
2834 2976
 			if ($globalDBdriver == 'mysql') {
2835 2977
 				$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 
@@ -2873,7 +3015,9 @@  discard block
 block discarded – undo
2873 3015
 			date_default_timezone_set($globalTimezone);
2874 3016
 			$datetime = new DateTime();
2875 3017
 			$offset = $datetime->format('P');
2876
-		} else $offset = '+00:00';
3018
+		} else {
3019
+			$offset = '+00:00';
3020
+		}
2877 3021
 		if ($airport_icao == '') {
2878 3022
 			if ($globalDBdriver == 'mysql') {
2879 3023
 				$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` WHERE 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";
@@ -2907,7 +3051,9 @@  discard block
 block discarded – undo
2907 3051
 			date_default_timezone_set($globalTimezone);
2908 3052
 			$datetime = new DateTime();
2909 3053
 			$offset = $datetime->format('P');
2910
-		} else $offset = '+00:00';
3054
+		} else {
3055
+			$offset = '+00:00';
3056
+		}
2911 3057
 		if ($airport_icao == '') {
2912 3058
 			if ($globalDBdriver == 'mysql') {
2913 3059
 				$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 
@@ -2953,7 +3099,9 @@  discard block
 block discarded – undo
2953 3099
 			date_default_timezone_set($globalTimezone);
2954 3100
 			$datetime = new DateTime();
2955 3101
 			$offset = $datetime->format('P');
2956
-		} else $offset = '+00:00';
3102
+		} else {
3103
+			$offset = '+00:00';
3104
+		}
2957 3105
 		if ($airport_icao == '') {
2958 3106
 			if ($globalDBdriver == 'mysql') {
2959 3107
 				$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";
@@ -2987,7 +3135,9 @@  discard block
 block discarded – undo
2987 3135
 			date_default_timezone_set($globalTimezone);
2988 3136
 			$datetime = new DateTime();
2989 3137
 			$offset = $datetime->format('P');
2990
-		} else $offset = '+00:00';
3138
+		} else {
3139
+			$offset = '+00:00';
3140
+		}
2991 3141
 		if ($airport_icao == '') {
2992 3142
 			if ($globalDBdriver == 'mysql') {
2993 3143
 				$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 
@@ -3035,7 +3185,9 @@  discard block
 block discarded – undo
3035 3185
 			date_default_timezone_set($globalTimezone);
3036 3186
 			$datetime = new DateTime();
3037 3187
 			$offset = $datetime->format('P');
3038
-		} else $offset = '+00:00';
3188
+		} else {
3189
+			$offset = '+00:00';
3190
+		}
3039 3191
 
3040 3192
 		if ($globalDBdriver == 'mysql') {
3041 3193
 			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
@@ -3155,7 +3307,9 @@  discard block
 block discarded – undo
3155 3307
 	*/	
3156 3308
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3157 3309
 	{
3158
-		if ($groundspeed == '') $groundspeed = NULL;
3310
+		if ($groundspeed == '') {
3311
+			$groundspeed = NULL;
3312
+		}
3159 3313
 		$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';
3160 3314
                 $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);
3161 3315
 
@@ -3205,9 +3359,15 @@  discard block
 block discarded – undo
3205 3359
 		$Image = new Image($this->db);
3206 3360
 		$Common = new Common();
3207 3361
 		
3208
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
3209
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
3210
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
3362
+		if (!isset($globalIVAO)) {
3363
+			$globalIVAO = FALSE;
3364
+		}
3365
+		if (!isset($globalVATSIM)) {
3366
+			$globalVATSIM = FALSE;
3367
+		}
3368
+		if (!isset($globalphpVMS)) {
3369
+			$globalphpVMS = FALSE;
3370
+		}
3211 3371
 		date_default_timezone_set('UTC');
3212 3372
 		
3213 3373
 		//getting the registration
@@ -3220,23 +3380,33 @@  discard block
 block discarded – undo
3220 3380
 				if ($ModeS != '') {
3221 3381
 					$timeelapsed = microtime(true);
3222 3382
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3223
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3383
+					if ($globalDebugTimeElapsed) {
3384
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3385
+					}
3224 3386
 				} else {
3225 3387
 					$myhex = explode('-',$flightaware_id);
3226 3388
 					if (count($myhex) > 0) {
3227 3389
 						$timeelapsed = microtime(true);
3228 3390
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3229
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3391
+						if ($globalDebugTimeElapsed) {
3392
+							echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3393
+						}
3230 3394
 					}
3231 3395
 				}
3232 3396
 			}
3233 3397
 		}
3234 3398
 		$fromsource = NULL;
3235
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
3236
-		elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim';
3237
-		elseif ($format_source == 'whazzup') $fromsource = 'ivao';
3238
-		elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
3239
-		elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
3399
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
3400
+			$fromsource = $globalAirlinesSource;
3401
+		} elseif ($format_source == 'vatsimtxt') {
3402
+			$fromsource = 'vatsim';
3403
+		} elseif ($format_source == 'whazzup') {
3404
+			$fromsource = 'ivao';
3405
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
3406
+			$fromsource = 'vatsim';
3407
+		} elseif (isset($globalIVAO) && $globalIVAO) {
3408
+			$fromsource = 'ivao';
3409
+		}
3240 3410
 		//getting the airline information
3241 3411
 		if ($ident != "")
3242 3412
 		{
@@ -3260,15 +3430,21 @@  discard block
 block discarded – undo
3260 3430
 					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3261 3431
 						$airline_array = $this->getAllAirlineInfo("NA");
3262 3432
 					}
3263
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3433
+					if ($globalDebugTimeElapsed) {
3434
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3435
+					}
3264 3436
 
3265 3437
 				} else {
3266 3438
 					$timeelapsed = microtime(true);
3267 3439
 					$airline_array = $this->getAllAirlineInfo("NA");
3268
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3440
+					if ($globalDebugTimeElapsed) {
3441
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3442
+					}
3269 3443
 				}
3270 3444
 			}
3271
-		} else $airline_array = array();
3445
+		} else {
3446
+			$airline_array = array();
3447
+		}
3272 3448
 		
3273 3449
 		//getting the aircraft information
3274 3450
 		$aircraft_array = array();
@@ -3282,27 +3458,37 @@  discard block
 block discarded – undo
3282 3458
 				{
3283 3459
 					$timeelapsed = microtime(true);
3284 3460
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3285
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3461
+					if ($globalDebugTimeElapsed) {
3462
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3463
+					}
3286 3464
 				} else {
3287 3465
 					$timeelapsed = microtime(true);
3288 3466
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3289
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3467
+					if ($globalDebugTimeElapsed) {
3468
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3469
+					}
3290 3470
 				}
3291 3471
 			}
3292 3472
 		} else {
3293 3473
 			if ($ModeS != '') {
3294 3474
 				$timeelapsed = microtime(true);
3295 3475
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3296
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3476
+				if ($globalDebugTimeElapsed) {
3477
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3478
+				}
3297 3479
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3298 3480
 				{
3299 3481
 					$timeelapsed = microtime(true);
3300 3482
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3301
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3483
+					if ($globalDebugTimeElapsed) {
3484
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3485
+					}
3302 3486
 				} else {
3303 3487
 					$timeelapsed = microtime(true);
3304 3488
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3305
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3489
+					if ($globalDebugTimeElapsed) {
3490
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3491
+					}
3306 3492
 				}
3307 3493
 			}
3308 3494
 		}
@@ -3317,7 +3503,9 @@  discard block
 block discarded – undo
3317 3503
 			} else {
3318 3504
 				$timeelapsed = microtime(true);
3319 3505
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3320
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3506
+				if ($globalDebugTimeElapsed) {
3507
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3508
+				}
3321 3509
 			}
3322 3510
 		}
3323 3511
 		
@@ -3331,7 +3519,9 @@  discard block
 block discarded – undo
3331 3519
 			} else {
3332 3520
 				$timeelapsed = microtime(true);
3333 3521
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3334
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3522
+				if ($globalDebugTimeElapsed) {
3523
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3524
+				}
3335 3525
 			}
3336 3526
 		}
3337 3527
 
@@ -3366,7 +3556,9 @@  discard block
 block discarded – undo
3366 3556
 			{
3367 3557
 				return false;
3368 3558
 			}
3369
-		} else $altitude = 0;
3559
+		} else {
3560
+			$altitude = 0;
3561
+		}
3370 3562
 		
3371 3563
 		if ($heading != "")
3372 3564
 		{
@@ -3395,7 +3587,9 @@  discard block
 block discarded – undo
3395 3587
 		{
3396 3588
 			$timeelapsed = microtime(true);
3397 3589
 			$image_array = $Image->getSpotterImage($registration);
3398
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3590
+			if ($globalDebugTimeElapsed) {
3591
+				echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3592
+			}
3399 3593
 			if (!isset($image_array[0]['registration']))
3400 3594
 			{
3401 3595
 				//echo "Add image !!!! \n";
@@ -3403,14 +3597,21 @@  discard block
 block discarded – undo
3403 3597
 			}
3404 3598
 			$timeelapsed = microtime(true);
3405 3599
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3406
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3407
-			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3600
+			if ($globalDebugTimeElapsed) {
3601
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3602
+			}
3603
+			if ($owner_info['owner'] != '') {
3604
+				$aircraft_owner = ucwords(strtolower($owner_info['owner']));
3605
+			}
3408 3606
 		}
3409 3607
     
3410 3608
 		if ($globalIVAO && $aircraft_icao != '')
3411 3609
 		{
3412
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3413
-            		else $airline_icao = '';
3610
+            		if (isset($airline_array[0]['icao'])) {
3611
+            			$airline_icao = $airline_array[0]['icao'];
3612
+            		} else {
3613
+            			$airline_icao = '';
3614
+            		}
3414 3615
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3415 3616
 			if (!isset($image_array[0]['registration']))
3416 3617
 			{
@@ -3455,12 +3656,24 @@  discard block
 block discarded – undo
3455 3656
                 {
3456 3657
                         $arrival_airport_array = $this->getAllAirportInfo('NA');
3457 3658
                 }
3458
-                if ($registration == '') $registration = 'NA';
3459
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3460
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3461
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3462
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3463
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3659
+                if ($registration == '') {
3660
+                	$registration = 'NA';
3661
+                }
3662
+                if ($squawk == '' || $Common->isInteger($squawk) === false) {
3663
+                	$squawk = NULL;
3664
+                }
3665
+                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) {
3666
+                	$verticalrate = NULL;
3667
+                }
3668
+                if ($heading == '' || $Common->isInteger($heading) === false) {
3669
+                	$heading = 0;
3670
+                }
3671
+                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) {
3672
+                	$groundspeed = 0;
3673
+                }
3674
+                if (!isset($aircraft_owner)) {
3675
+                	$aircraft_owner = NULL;
3676
+                }
3464 3677
                 $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) 
3465 3678
                 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)";
3466 3679
 
@@ -3471,9 +3684,13 @@  discard block
 block discarded – undo
3471 3684
 		if ($airline_type == '') {
3472 3685
 			$timeelapsed = microtime(true);
3473 3686
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3474
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3687
+			if ($globalDebugTimeElapsed) {
3688
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3689
+			}
3690
+		}
3691
+		if ($airline_type == null) {
3692
+			$airline_type = '';
3475 3693
 		}
3476
-		if ($airline_type == null) $airline_type = '';
3477 3694
                 $aircraft_type = $aircraft_array[0]['type'];
3478 3695
                 $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3479 3696
                 $departure_airport_name = $departure_airport_array[0]['name'];
@@ -3608,7 +3825,9 @@  discard block
 block discarded – undo
3608 3825
 			}
3609 3826
 		}
3610 3827
 		$query .= "GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
3611
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3828
+		if ($limit) {
3829
+			$query .= " LIMIT 10 OFFSET 0";
3830
+		}
3612 3831
 		
3613 3832
 		$sth = $this->db->prepare($query);
3614 3833
 		$sth->execute();
@@ -3653,7 +3872,9 @@  discard block
 block discarded – undo
3653 3872
 			}
3654 3873
 		}
3655 3874
 		$query .= "GROUP BY spotter_output.pilot_id,spotter_output.pilot_name ORDER BY pilot_count DESC";
3656
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3875
+		if ($limit) {
3876
+			$query .= " LIMIT 10 OFFSET 0";
3877
+		}
3657 3878
       
3658 3879
 		
3659 3880
 		$sth = $this->db->prepare($query);
@@ -3698,7 +3919,9 @@  discard block
 block discarded – undo
3698 3919
 			}
3699 3920
 		}
3700 3921
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name ORDER BY pilot_count DESC";
3701
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3922
+		if ($limit) {
3923
+			$query .= " LIMIT 10 OFFSET 0";
3924
+		}
3702 3925
       
3703 3926
 		
3704 3927
 		$sth = $this->db->prepare($query);
@@ -3745,7 +3968,9 @@  discard block
 block discarded – undo
3745 3968
 			}
3746 3969
 		}
3747 3970
 		$query .= "GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
3748
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3971
+		if ($limit) {
3972
+			$query .= " LIMIT 10 OFFSET 0";
3973
+		}
3749 3974
       
3750 3975
 		
3751 3976
 		$sth = $this->db->prepare($query);
@@ -3789,7 +4014,9 @@  discard block
 block discarded – undo
3789 4014
 			}
3790 4015
 		}
3791 4016
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC";
3792
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4017
+		if ($limit) {
4018
+			$query .= " LIMIT 10 OFFSET 0";
4019
+		}
3793 4020
       
3794 4021
 		
3795 4022
 		$sth = $this->db->prepare($query);
@@ -4038,7 +4265,9 @@  discard block
 block discarded – undo
4038 4265
 			date_default_timezone_set($globalTimezone);
4039 4266
 			$datetime = new DateTime($date);
4040 4267
 			$offset = $datetime->format('P');
4041
-		} else $offset = '+00:00';
4268
+		} else {
4269
+			$offset = '+00:00';
4270
+		}
4042 4271
 
4043 4272
 		if ($globalDBdriver == 'mysql') {
4044 4273
 			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
@@ -4087,7 +4316,9 @@  discard block
 block discarded – undo
4087 4316
 			date_default_timezone_set($globalTimezone);
4088 4317
 			$datetime = new DateTime($date);
4089 4318
 			$offset = $datetime->format('P');
4090
-		} else $offset = '+00:00';
4319
+		} else {
4320
+			$offset = '+00:00';
4321
+		}
4091 4322
 		
4092 4323
 		if ($globalDBdriver == 'mysql') {
4093 4324
 			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
@@ -4310,7 +4541,9 @@  discard block
 block discarded – undo
4310 4541
 					WHERE spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' 
4311 4542
 					GROUP BY spotter_output.airline_country
4312 4543
 					ORDER BY airline_country_count DESC";
4313
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4544
+		if ($limit) {
4545
+			$query .= " LIMIT 10 OFFSET 0";
4546
+		}
4314 4547
       
4315 4548
 		$sth = $this->db->prepare($query);
4316 4549
 		$sth->execute();
@@ -4337,7 +4570,9 @@  discard block
 block discarded – undo
4337 4570
 	{
4338 4571
 		global $globalDBdriver;
4339 4572
 		$Connection= new Connection($this->db);
4340
-		if (!$Connection->tableExists('countries')) return array();
4573
+		if (!$Connection->tableExists('countries')) {
4574
+			return array();
4575
+		}
4341 4576
 		/*
4342 4577
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
4343 4578
 					FROM countries c, spotter_output s
@@ -4362,7 +4597,9 @@  discard block
 block discarded – undo
4362 4597
 		}
4363 4598
 
4364 4599
 		$query .= "GROUP BY c.name ORDER BY nb DESC";
4365
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4600
+		if ($limit) {
4601
+			$query .= " LIMIT 10 OFFSET 0";
4602
+		}
4366 4603
       
4367 4604
 		
4368 4605
 		$sth = $this->db->prepare($query);
@@ -4412,7 +4649,9 @@  discard block
 block discarded – undo
4412 4649
 		}
4413 4650
 
4414 4651
 		$query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
4415
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4652
+		if ($limit) {
4653
+			$query .= " LIMIT 10 OFFSET 0";
4654
+		}
4416 4655
  
4417 4656
 		$sth = $this->db->prepare($query);
4418 4657
 		$sth->execute();
@@ -4458,7 +4697,9 @@  discard block
 block discarded – undo
4458 4697
 		}
4459 4698
 
4460 4699
 		$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";
4461
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4700
+		if ($limit) {
4701
+			$query .= " LIMIT 10 OFFSET 0";
4702
+		}
4462 4703
  
4463 4704
 		$sth = $this->db->prepare($query);
4464 4705
 		$sth->execute();
@@ -4511,7 +4752,9 @@  discard block
 block discarded – undo
4511 4752
 			if($row['registration'] != "")
4512 4753
 			{
4513 4754
 				$image_array = $Image->getSpotterImage($row['registration']);
4514
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4755
+				if (isset($image_array[0]['image_thumbnail'])) {
4756
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4757
+				}
4515 4758
 			}
4516 4759
 			$temp_array['registration_count'] = $row['registration_count'];
4517 4760
 
@@ -4587,7 +4830,9 @@  discard block
 block discarded – undo
4587 4830
 			if($row['registration'] != "")
4588 4831
 			{
4589 4832
 				$image_array = $Image->getSpotterImage($row['registration']);
4590
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4833
+				if (isset($image_array[0]['image_thumbnail'])) {
4834
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4835
+				}
4591 4836
 			}
4592 4837
 			$temp_array['registration_count'] = $row['registration_count'];
4593 4838
 
@@ -4821,7 +5066,9 @@  discard block
 block discarded – undo
4821 5066
 			date_default_timezone_set($globalTimezone);
4822 5067
 			$datetime = new DateTime($date);
4823 5068
 			$offset = $datetime->format('P');
4824
-		} else $offset = '+00:00';
5069
+		} else {
5070
+			$offset = '+00:00';
5071
+		}
4825 5072
 
4826 5073
 		if ($globalDBdriver == 'mysql') {
4827 5074
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
@@ -4869,7 +5116,9 @@  discard block
 block discarded – undo
4869 5116
 			date_default_timezone_set($globalTimezone);
4870 5117
 			$datetime = new DateTime($date);
4871 5118
 			$offset = $datetime->format('P');
4872
-		} else $offset = '+00:00';
5119
+		} else {
5120
+			$offset = '+00:00';
5121
+		}
4873 5122
 
4874 5123
 		if ($globalDBdriver == 'mysql') {
4875 5124
 			$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    
@@ -4924,7 +5173,9 @@  discard block
 block discarded – undo
4924 5173
 			date_default_timezone_set($globalTimezone);
4925 5174
 			$datetime = new DateTime($date);
4926 5175
 			$offset = $datetime->format('P');
4927
-		} else $offset = '+00:00';
5176
+		} else {
5177
+			$offset = '+00:00';
5178
+		}
4928 5179
 
4929 5180
 		if ($globalDBdriver == 'mysql') {
4930 5181
 			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
@@ -5025,8 +5276,11 @@  discard block
 block discarded – undo
5025 5276
 			if($row['registration'] != "")
5026 5277
 			{
5027 5278
 				$image_array = $Image->getSpotterImage($row['registration']);
5028
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5029
-				else $temp_array['image_thumbnail'] = '';
5279
+				if (isset($image_array[0]['image_thumbnail'])) {
5280
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5281
+				} else {
5282
+					$temp_array['image_thumbnail'] = '';
5283
+				}
5030 5284
 			}
5031 5285
 			$temp_array['registration_count'] = $row['registration_count'];
5032 5286
 			$aircraft_array[] = $temp_array;
@@ -5134,7 +5388,9 @@  discard block
 block discarded – undo
5134 5388
 			if($row['registration'] != "")
5135 5389
 			{
5136 5390
 				$image_array = $Image->getSpotterImage($row['registration']);
5137
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5391
+				if (isset($image_array[0]['image_thumbnail'])) {
5392
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5393
+				}
5138 5394
 			}
5139 5395
 			$temp_array['registration_count'] = $row['registration_count'];
5140 5396
           
@@ -5253,7 +5509,9 @@  discard block
 block discarded – undo
5253 5509
 			if($row['registration'] != "")
5254 5510
 			{
5255 5511
 				$image_array = $Image->getSpotterImage($row['registration']);
5256
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5512
+				if (isset($image_array[0]['image_thumbnail'])) {
5513
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5514
+				}
5257 5515
 			}
5258 5516
 			$temp_array['registration_count'] = $row['registration_count'];
5259 5517
           
@@ -5366,7 +5624,9 @@  discard block
 block discarded – undo
5366 5624
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5367 5625
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5368 5626
                 $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5369
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5627
+		if ($limit) {
5628
+			$query .= " LIMIT 10 OFFSET 0";
5629
+		}
5370 5630
 		
5371 5631
 		$sth = $this->db->prepare($query);
5372 5632
 		$sth->execute();
@@ -5385,7 +5645,9 @@  discard block
 block discarded – undo
5385 5645
 			if($row['registration'] != "")
5386 5646
 			{
5387 5647
 				$image_array = $Image->getSpotterImage($row['registration']);
5388
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5648
+				if (isset($image_array[0]['image_thumbnail'])) {
5649
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5650
+				}
5389 5651
 			}
5390 5652
           
5391 5653
 			$aircraft_array[] = $temp_array;
@@ -5426,7 +5688,9 @@  discard block
 block discarded – undo
5426 5688
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5427 5689
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5428 5690
                 $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";
5429
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5691
+		if ($limit) {
5692
+			$query .= " LIMIT 10 OFFSET 0";
5693
+		}
5430 5694
 		
5431 5695
 		$sth = $this->db->prepare($query);
5432 5696
 		$sth->execute();
@@ -5446,7 +5710,9 @@  discard block
 block discarded – undo
5446 5710
 			if($row['registration'] != "")
5447 5711
 			{
5448 5712
 				$image_array = $Image->getSpotterImage($row['registration']);
5449
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5713
+				if (isset($image_array[0]['image_thumbnail'])) {
5714
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5715
+				}
5450 5716
 			}
5451 5717
           
5452 5718
 			$aircraft_array[] = $temp_array;
@@ -5487,7 +5753,9 @@  discard block
 block discarded – undo
5487 5753
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5488 5754
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5489 5755
 				ORDER BY airport_departure_icao_count DESC";
5490
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5756
+		if ($limit) {
5757
+			$query .= " LIMIT 10 OFFSET 0";
5758
+		}
5491 5759
       
5492 5760
 		$sth = $this->db->prepare($query);
5493 5761
 		$sth->execute();
@@ -5539,7 +5807,9 @@  discard block
 block discarded – undo
5539 5807
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5540 5808
                 $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
5541 5809
 				ORDER BY airport_departure_icao_count DESC";
5542
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5810
+		if ($limit) {
5811
+			$query .= " LIMIT 10 OFFSET 0";
5812
+		}
5543 5813
       
5544 5814
 		$sth = $this->db->prepare($query);
5545 5815
 		$sth->execute();
@@ -5591,7 +5861,9 @@  discard block
 block discarded – undo
5591 5861
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5592 5862
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5593 5863
 				ORDER BY airport_departure_icao_count DESC";
5594
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5864
+		if ($limit) {
5865
+			$query .= " LIMIT 10 OFFSET 0";
5866
+		}
5595 5867
       
5596 5868
 		$sth = $this->db->prepare($query);
5597 5869
 		$sth->execute();
@@ -5643,7 +5915,9 @@  discard block
 block discarded – undo
5643 5915
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5644 5916
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5645 5917
 				ORDER BY airport_departure_icao_count DESC";
5646
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5918
+		if ($limit) {
5919
+			$query .= " LIMIT 10 OFFSET 0";
5920
+		}
5647 5921
       
5648 5922
 		$sth = $this->db->prepare($query);
5649 5923
 		$sth->execute();
@@ -6048,7 +6322,9 @@  discard block
 block discarded – undo
6048 6322
 			date_default_timezone_set($globalTimezone);
6049 6323
 			$datetime = new DateTime($date);
6050 6324
 			$offset = $datetime->format('P');
6051
-		} else $offset = '+00:00';
6325
+		} else {
6326
+			$offset = '+00:00';
6327
+		}
6052 6328
 
6053 6329
 		if ($globalDBdriver == 'mysql') {
6054 6330
 			$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 
@@ -6099,7 +6375,9 @@  discard block
 block discarded – undo
6099 6375
 			date_default_timezone_set($globalTimezone);
6100 6376
 			$datetime = new DateTime($date);
6101 6377
 			$offset = $datetime->format('P');
6102
-		} else $offset = '+00:00';
6378
+		} else {
6379
+			$offset = '+00:00';
6380
+		}
6103 6381
 
6104 6382
 		if ($globalDBdriver == 'mysql') {
6105 6383
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
@@ -6317,7 +6595,9 @@  discard block
 block discarded – undo
6317 6595
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6318 6596
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6319 6597
 					ORDER BY airport_arrival_icao_count DESC";
6320
-		if ($limit) $query .= " LIMIT 10";
6598
+		if ($limit) {
6599
+			$query .= " LIMIT 10";
6600
+		}
6321 6601
       
6322 6602
 		
6323 6603
 		$sth = $this->db->prepare($query);
@@ -6337,7 +6617,9 @@  discard block
 block discarded – undo
6337 6617
 			if ($icaoaskey) {
6338 6618
 				$icao = $row['arrival_airport_icao'];
6339 6619
 				$airport_array[$icao] = $temp_array;
6340
-			} else $airport_array[] = $temp_array;
6620
+			} else {
6621
+				$airport_array[] = $temp_array;
6622
+			}
6341 6623
 		}
6342 6624
 
6343 6625
 		return $airport_array;
@@ -6379,7 +6661,9 @@  discard block
 block discarded – undo
6379 6661
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6380 6662
                 $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
6381 6663
 					ORDER BY airport_arrival_icao_count DESC";
6382
-		if ($limit) $query .= " LIMIT 10";
6664
+		if ($limit) {
6665
+			$query .= " LIMIT 10";
6666
+		}
6383 6667
       
6384 6668
 		
6385 6669
 		$sth = $this->db->prepare($query);
@@ -6400,7 +6684,9 @@  discard block
 block discarded – undo
6400 6684
 			if ($icaoaskey) {
6401 6685
 				$icao = $row['arrival_airport_icao'];
6402 6686
 				$airport_array[$icao] = $temp_array;
6403
-			} else $airport_array[] = $temp_array;
6687
+			} else {
6688
+				$airport_array[] = $temp_array;
6689
+			}
6404 6690
 		}
6405 6691
 
6406 6692
 		return $airport_array;
@@ -6442,7 +6728,9 @@  discard block
 block discarded – undo
6442 6728
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6443 6729
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6444 6730
 					ORDER BY airport_arrival_icao_count DESC";
6445
-		if ($limit) $query .= " LIMIT 10";
6731
+		if ($limit) {
6732
+			$query .= " LIMIT 10";
6733
+		}
6446 6734
       
6447 6735
 		
6448 6736
 		$sth = $this->db->prepare($query);
@@ -6462,7 +6750,9 @@  discard block
 block discarded – undo
6462 6750
 			if ($icaoaskey) {
6463 6751
 				$icao = $row['arrival_airport_icao'];
6464 6752
 				$airport_array[$icao] = $temp_array;
6465
-			} else $airport_array[] = $temp_array;
6753
+			} else {
6754
+				$airport_array[] = $temp_array;
6755
+			}
6466 6756
 		}
6467 6757
 
6468 6758
 		return $airport_array;
@@ -6504,7 +6794,9 @@  discard block
 block discarded – undo
6504 6794
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6505 6795
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6506 6796
 					ORDER BY airport_arrival_icao_count DESC";
6507
-		if ($limit) $query .= " LIMIT 10";
6797
+		if ($limit) {
6798
+			$query .= " LIMIT 10";
6799
+		}
6508 6800
       
6509 6801
 		
6510 6802
 		$sth = $this->db->prepare($query);
@@ -6525,7 +6817,9 @@  discard block
 block discarded – undo
6525 6817
 			if ($icaoaskey) {
6526 6818
 				$icao = $row['arrival_airport_icao'];
6527 6819
 				$airport_array[$icao] = $temp_array;
6528
-			} else $airport_array[] = $temp_array;
6820
+			} else {
6821
+				$airport_array[] = $temp_array;
6822
+			}
6529 6823
 		}
6530 6824
 
6531 6825
 		return $airport_array;
@@ -6914,7 +7208,9 @@  discard block
 block discarded – undo
6914 7208
 			date_default_timezone_set($globalTimezone);
6915 7209
 			$datetime = new DateTime($date);
6916 7210
 			$offset = $datetime->format('P');
6917
-		} else $offset = '+00:00';
7211
+		} else {
7212
+			$offset = '+00:00';
7213
+		}
6918 7214
 
6919 7215
 		if ($globalDBdriver == 'mysql') {
6920 7216
 			$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 
@@ -6965,7 +7261,9 @@  discard block
 block discarded – undo
6965 7261
 			date_default_timezone_set($globalTimezone);
6966 7262
 			$datetime = new DateTime($date);
6967 7263
 			$offset = $datetime->format('P');
6968
-		} else $offset = '+00:00';
7264
+		} else {
7265
+			$offset = '+00:00';
7266
+		}
6969 7267
 
6970 7268
 		if ($globalDBdriver == 'mysql') {
6971 7269
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
@@ -7194,7 +7492,9 @@  discard block
 block discarded – undo
7194 7492
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
7195 7493
 		$query .= " GROUP BY spotter_output.arrival_airport_country
7196 7494
 					ORDER BY airport_arrival_country_count DESC";
7197
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7495
+		if ($limit) {
7496
+			$query .= " LIMIT 10 OFFSET 0";
7497
+		}
7198 7498
       
7199 7499
 		
7200 7500
 		$sth = $this->db->prepare($query);
@@ -7489,7 +7789,9 @@  discard block
 block discarded – undo
7489 7789
 			date_default_timezone_set($globalTimezone);
7490 7790
 			$datetime = new DateTime($date);
7491 7791
 			$offset = $datetime->format('P');
7492
-		} else $offset = '+00:00';
7792
+		} else {
7793
+			$offset = '+00:00';
7794
+		}
7493 7795
 		
7494 7796
 		if ($globalDBdriver == 'mysql') {
7495 7797
 			$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
@@ -7672,15 +7974,23 @@  discard block
 block discarded – undo
7672 7974
 		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7673 7975
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
7674 7976
 		 if ($olderthanmonths > 0) {
7675
-			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
7676
-			else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7977
+			if ($globalDBdriver == 'mysql') {
7978
+				$query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
7979
+			} else {
7980
+				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7981
+			}
7677 7982
 		}
7678 7983
 		if ($sincedate != '') {
7679
-			if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'";
7680
-			else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7984
+			if ($globalDBdriver == 'mysql') {
7985
+				$query .= " AND spotter_output.date > '".$sincedate."'";
7986
+			} else {
7987
+				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7988
+			}
7681 7989
 		}
7682 7990
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
7683
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7991
+		if ($limit) {
7992
+			$query .= " LIMIT 10 OFFSET 0";
7993
+		}
7684 7994
       		
7685 7995
 		$sth = $this->db->prepare($query);
7686 7996
 		$sth->execute();
@@ -7714,15 +8024,23 @@  discard block
 block discarded – undo
7714 8024
                     FROM spotter_output
7715 8025
                     WHERE spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
7716 8026
 		 if ($olderthanmonths > 0) {
7717
-			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7718
-			else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
8027
+			if ($globalDBdriver == 'mysql') {
8028
+				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
8029
+			} else {
8030
+				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
8031
+			}
7719 8032
 		}
7720 8033
 		if ($sincedate != '') {
7721
-			if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' ";
7722
-			else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
8034
+			if ($globalDBdriver == 'mysql') {
8035
+				$query .= "AND spotter_output.date > '".$sincedate."' ";
8036
+			} else {
8037
+				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
8038
+			}
7723 8039
 		}
7724 8040
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
7725
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
8041
+		if ($limit) {
8042
+			$query .= " LIMIT 10 OFFSET 0";
8043
+		}
7726 8044
       		
7727 8045
 		$sth = $this->db->prepare($query);
7728 8046
 		$sth->execute();
@@ -7759,7 +8077,9 @@  discard block
 block discarded – undo
7759 8077
 			date_default_timezone_set($globalTimezone);
7760 8078
 			$datetime = new DateTime();
7761 8079
 			$offset = $datetime->format('P');
7762
-		} else $offset = '+00:00';
8080
+		} else {
8081
+			$offset = '+00:00';
8082
+		}
7763 8083
 
7764 8084
 		if ($globalDBdriver == 'mysql') {
7765 8085
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7808,7 +8128,9 @@  discard block
 block discarded – undo
7808 8128
 			date_default_timezone_set($globalTimezone);
7809 8129
 			$datetime = new DateTime();
7810 8130
 			$offset = $datetime->format('P');
7811
-		} else $offset = '+00:00';
8131
+		} else {
8132
+			$offset = '+00:00';
8133
+		}
7812 8134
 
7813 8135
 		if ($globalDBdriver == 'mysql') {
7814 8136
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7858,7 +8180,9 @@  discard block
 block discarded – undo
7858 8180
 			date_default_timezone_set($globalTimezone);
7859 8181
 			$datetime = new DateTime();
7860 8182
 			$offset = $datetime->format('P');
7861
-		} else $offset = '+00:00';
8183
+		} else {
8184
+			$offset = '+00:00';
8185
+		}
7862 8186
 		$filter_query = $this->getFilter($filters,true,true);
7863 8187
 		if ($globalDBdriver == 'mysql') {
7864 8188
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7904,7 +8228,9 @@  discard block
 block discarded – undo
7904 8228
 			date_default_timezone_set($globalTimezone);
7905 8229
 			$datetime = new DateTime();
7906 8230
 			$offset = $datetime->format('P');
7907
-		} else $offset = '+00:00';
8231
+		} else {
8232
+			$offset = '+00:00';
8233
+		}
7908 8234
 		$filter_query = $this->getFilter($filters,true,true);
7909 8235
 		if ($globalDBdriver == 'mysql') {
7910 8236
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7951,7 +8277,9 @@  discard block
 block discarded – undo
7951 8277
 			date_default_timezone_set($globalTimezone);
7952 8278
 			$datetime = new DateTime();
7953 8279
 			$offset = $datetime->format('P');
7954
-		} else $offset = '+00:00';
8280
+		} else {
8281
+			$offset = '+00:00';
8282
+		}
7955 8283
 		
7956 8284
 		if ($globalDBdriver == 'mysql') {
7957 8285
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -8001,7 +8329,9 @@  discard block
 block discarded – undo
8001 8329
 			date_default_timezone_set($globalTimezone);
8002 8330
 			$datetime = new DateTime();
8003 8331
 			$offset = $datetime->format('P');
8004
-		} else $offset = '+00:00';
8332
+		} else {
8333
+			$offset = '+00:00';
8334
+		}
8005 8335
 
8006 8336
 		if ($globalDBdriver == 'mysql') {
8007 8337
 			$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
@@ -8049,7 +8379,9 @@  discard block
 block discarded – undo
8049 8379
 			date_default_timezone_set($globalTimezone);
8050 8380
 			$datetime = new DateTime();
8051 8381
 			$offset = $datetime->format('P');
8052
-		} else $offset = '+00:00';
8382
+		} else {
8383
+			$offset = '+00:00';
8384
+		}
8053 8385
 
8054 8386
 		if ($globalDBdriver == 'mysql') {
8055 8387
 			$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
@@ -8098,7 +8430,9 @@  discard block
 block discarded – undo
8098 8430
 			date_default_timezone_set($globalTimezone);
8099 8431
 			$datetime = new DateTime();
8100 8432
 			$offset = $datetime->format('P');
8101
-		} else $offset = '+00:00';
8433
+		} else {
8434
+			$offset = '+00:00';
8435
+		}
8102 8436
 
8103 8437
 		if ($globalDBdriver == 'mysql') {
8104 8438
 			$query  = "SELECT YEAR(CONVERT_TZ(s.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(s.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -8145,7 +8479,9 @@  discard block
 block discarded – undo
8145 8479
 			date_default_timezone_set($globalTimezone);
8146 8480
 			$datetime = new DateTime();
8147 8481
 			$offset = $datetime->format('P');
8148
-		} else $offset = '+00:00';
8482
+		} else {
8483
+			$offset = '+00:00';
8484
+		}
8149 8485
 
8150 8486
 		if ($globalDBdriver == 'mysql') {
8151 8487
 			$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
@@ -8192,7 +8528,9 @@  discard block
 block discarded – undo
8192 8528
 			date_default_timezone_set($globalTimezone);
8193 8529
 			$datetime = new DateTime();
8194 8530
 			$offset = $datetime->format('P');
8195
-		} else $offset = '+00:00';
8531
+		} else {
8532
+			$offset = '+00:00';
8533
+		}
8196 8534
 
8197 8535
 		if ($globalDBdriver == 'mysql') {
8198 8536
 			$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
@@ -8240,7 +8578,9 @@  discard block
 block discarded – undo
8240 8578
 			date_default_timezone_set($globalTimezone);
8241 8579
 			$datetime = new DateTime();
8242 8580
 			$offset = $datetime->format('P');
8243
-		} else $offset = '+00:00';
8581
+		} else {
8582
+			$offset = '+00:00';
8583
+		}
8244 8584
 
8245 8585
 		if ($globalDBdriver == 'mysql') {
8246 8586
 			$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
@@ -8287,7 +8627,9 @@  discard block
 block discarded – undo
8287 8627
 			date_default_timezone_set($globalTimezone);
8288 8628
 			$datetime = new DateTime();
8289 8629
 			$offset = $datetime->format('P');
8290
-		} else $offset = '+00:00';
8630
+		} else {
8631
+			$offset = '+00:00';
8632
+		}
8291 8633
 
8292 8634
 		if ($globalDBdriver == 'mysql') {
8293 8635
 			$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
@@ -8335,7 +8677,9 @@  discard block
 block discarded – undo
8335 8677
 			date_default_timezone_set($globalTimezone);
8336 8678
 			$datetime = new DateTime();
8337 8679
 			$offset = $datetime->format('P');
8338
-		} else $offset = '+00:00';
8680
+		} else {
8681
+			$offset = '+00:00';
8682
+		}
8339 8683
 
8340 8684
 		if ($globalDBdriver == 'mysql') {
8341 8685
 			$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
@@ -8382,7 +8726,9 @@  discard block
 block discarded – undo
8382 8726
 			date_default_timezone_set($globalTimezone);
8383 8727
 			$datetime = new DateTime();
8384 8728
 			$offset = $datetime->format('P');
8385
-		} else $offset = '+00:00';
8729
+		} else {
8730
+			$offset = '+00:00';
8731
+		}
8386 8732
 
8387 8733
 		if ($globalDBdriver == 'mysql') {
8388 8734
 			$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
@@ -8430,7 +8776,9 @@  discard block
 block discarded – undo
8430 8776
 			date_default_timezone_set($globalTimezone);
8431 8777
 			$datetime = new DateTime();
8432 8778
 			$offset = $datetime->format('P');
8433
-		} else $offset = '+00:00';
8779
+		} else {
8780
+			$offset = '+00:00';
8781
+		}
8434 8782
 
8435 8783
 		if ($globalDBdriver == 'mysql') {
8436 8784
 			$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
@@ -8478,7 +8826,9 @@  discard block
 block discarded – undo
8478 8826
 			date_default_timezone_set($globalTimezone);
8479 8827
 			$datetime = new DateTime();
8480 8828
 			$offset = $datetime->format('P');
8481
-		} else $offset = '+00:00';
8829
+		} else {
8830
+			$offset = '+00:00';
8831
+		}
8482 8832
 
8483 8833
 		if ($globalDBdriver == 'mysql') {
8484 8834
 			$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
@@ -8526,7 +8876,9 @@  discard block
 block discarded – undo
8526 8876
 			date_default_timezone_set($globalTimezone);
8527 8877
 			$datetime = new DateTime();
8528 8878
 			$offset = $datetime->format('P');
8529
-		} else $offset = '+00:00';
8879
+		} else {
8880
+			$offset = '+00:00';
8881
+		}
8530 8882
 
8531 8883
 		if ($globalDBdriver == 'mysql') {
8532 8884
 			$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
@@ -8575,7 +8927,9 @@  discard block
 block discarded – undo
8575 8927
 			date_default_timezone_set($globalTimezone);
8576 8928
 			$datetime = new DateTime();
8577 8929
 			$offset = $datetime->format('P');
8578
-		} else $offset = '+00:00';
8930
+		} else {
8931
+			$offset = '+00:00';
8932
+		}
8579 8933
 		$filter_query = $this->getFilter($filters,true,true);
8580 8934
 		if ($globalDBdriver == 'mysql') {
8581 8935
 			$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
@@ -8624,7 +8978,9 @@  discard block
 block discarded – undo
8624 8978
 			date_default_timezone_set($globalTimezone);
8625 8979
 			$datetime = new DateTime();
8626 8980
 			$offset = $datetime->format('P');
8627
-		} else $offset = '+00:00';
8981
+		} else {
8982
+			$offset = '+00:00';
8983
+		}
8628 8984
 
8629 8985
 		$orderby_sql = '';
8630 8986
 		if ($orderby == "hour")
@@ -8689,7 +9045,9 @@  discard block
 block discarded – undo
8689 9045
 			date_default_timezone_set($globalTimezone);
8690 9046
 			$datetime = new DateTime();
8691 9047
 			$offset = $datetime->format('P');
8692
-		} else $offset = '+00:00';
9048
+		} else {
9049
+			$offset = '+00:00';
9050
+		}
8693 9051
 
8694 9052
 		$orderby_sql = '';
8695 9053
 		if ($orderby == "hour")
@@ -8757,7 +9115,9 @@  discard block
 block discarded – undo
8757 9115
 			date_default_timezone_set($globalTimezone);
8758 9116
 			$datetime = new DateTime();
8759 9117
 			$offset = $datetime->format('P');
8760
-		} else $offset = '+00:00';
9118
+		} else {
9119
+			$offset = '+00:00';
9120
+		}
8761 9121
 
8762 9122
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8763 9123
 
@@ -8809,7 +9169,9 @@  discard block
 block discarded – undo
8809 9169
 			date_default_timezone_set($globalTimezone);
8810 9170
 			$datetime = new DateTime();
8811 9171
 			$offset = $datetime->format('P');
8812
-		} else $offset = '+00:00';
9172
+		} else {
9173
+			$offset = '+00:00';
9174
+		}
8813 9175
 
8814 9176
 		if ($globalDBdriver == 'mysql') {
8815 9177
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8857,7 +9219,9 @@  discard block
 block discarded – undo
8857 9219
 			date_default_timezone_set($globalTimezone);
8858 9220
 			$datetime = new DateTime();
8859 9221
 			$offset = $datetime->format('P');
8860
-		} else $offset = '+00:00';
9222
+		} else {
9223
+			$offset = '+00:00';
9224
+		}
8861 9225
 
8862 9226
 		if ($globalDBdriver == 'mysql') {
8863 9227
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8905,7 +9269,9 @@  discard block
 block discarded – undo
8905 9269
 			date_default_timezone_set($globalTimezone);
8906 9270
 			$datetime = new DateTime();
8907 9271
 			$offset = $datetime->format('P');
8908
-		} else $offset = '+00:00';
9272
+		} else {
9273
+			$offset = '+00:00';
9274
+		}
8909 9275
 
8910 9276
 		if ($globalDBdriver == 'mysql') {
8911 9277
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8954,7 +9320,9 @@  discard block
 block discarded – undo
8954 9320
 			date_default_timezone_set($globalTimezone);
8955 9321
 			$datetime = new DateTime();
8956 9322
 			$offset = $datetime->format('P');
8957
-		} else $offset = '+00:00';
9323
+		} else {
9324
+			$offset = '+00:00';
9325
+		}
8958 9326
 
8959 9327
 		if ($globalDBdriver == 'mysql') {
8960 9328
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9003,7 +9371,9 @@  discard block
 block discarded – undo
9003 9371
 			date_default_timezone_set($globalTimezone);
9004 9372
 			$datetime = new DateTime($date);
9005 9373
 			$offset = $datetime->format('P');
9006
-		} else $offset = '+00:00';
9374
+		} else {
9375
+			$offset = '+00:00';
9376
+		}
9007 9377
 
9008 9378
 		if ($globalDBdriver == 'mysql') {
9009 9379
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9052,7 +9422,9 @@  discard block
 block discarded – undo
9052 9422
 			date_default_timezone_set($globalTimezone);
9053 9423
 			$datetime = new DateTime();
9054 9424
 			$offset = $datetime->format('P');
9055
-		} else $offset = '+00:00';
9425
+		} else {
9426
+			$offset = '+00:00';
9427
+		}
9056 9428
 
9057 9429
 		if ($globalDBdriver == 'mysql') {
9058 9430
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9103,7 +9475,9 @@  discard block
 block discarded – undo
9103 9475
 			date_default_timezone_set($globalTimezone);
9104 9476
 			$datetime = new DateTime();
9105 9477
 			$offset = $datetime->format('P');
9106
-		} else $offset = '+00:00';
9478
+		} else {
9479
+			$offset = '+00:00';
9480
+		}
9107 9481
 
9108 9482
 		if ($globalDBdriver == 'mysql') {
9109 9483
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9151,7 +9525,9 @@  discard block
 block discarded – undo
9151 9525
 			date_default_timezone_set($globalTimezone);
9152 9526
 			$datetime = new DateTime();
9153 9527
 			$offset = $datetime->format('P');
9154
-		} else $offset = '+00:00';
9528
+		} else {
9529
+			$offset = '+00:00';
9530
+		}
9155 9531
 
9156 9532
 		if ($globalDBdriver == 'mysql') {
9157 9533
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9320,7 +9696,9 @@  discard block
 block discarded – undo
9320 9696
 			date_default_timezone_set($globalTimezone);
9321 9697
 			$datetime = new DateTime();
9322 9698
 			$offset = $datetime->format('P');
9323
-		} else $offset = '+00:00';
9699
+		} else {
9700
+			$offset = '+00:00';
9701
+		}
9324 9702
 
9325 9703
 		if ($globalDBdriver == 'mysql') {
9326 9704
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9509,7 +9887,9 @@  discard block
 block discarded – undo
9509 9887
 	*/
9510 9888
 	public function parseDirection($direction = 0)
9511 9889
 	{
9512
-		if ($direction == '') $direction = 0;
9890
+		if ($direction == '') {
9891
+			$direction = 0;
9892
+		}
9513 9893
 		$direction_array = array();
9514 9894
 		$temp_array = array();
9515 9895
 
@@ -9610,7 +9990,9 @@  discard block
 block discarded – undo
9610 9990
 		if (isset($result->AirlineFlightInfoResult))
9611 9991
 		{
9612 9992
 			$registration = $result->AirlineFlightInfoResult->tailnumber;
9613
-		} else return '';
9993
+		} else {
9994
+			return '';
9995
+		}
9614 9996
 		
9615 9997
 		$registration = $this->convertAircraftRegistration($registration);
9616 9998
 		
@@ -9638,7 +10020,9 @@  discard block
 block discarded – undo
9638 10020
 		if (count($row) > 0) {
9639 10021
 		    //return $row['Registration'];
9640 10022
 		    return $row['registration'];
9641
-		} else return '';
10023
+		} else {
10024
+			return '';
10025
+		}
9642 10026
 	
9643 10027
 	}
9644 10028
 
@@ -9660,9 +10044,14 @@  discard block
 block discarded – undo
9660 10044
     
9661 10045
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9662 10046
 		if (count($row) > 0) {
9663
-		    if ($row['type_flight'] == null) return '';
9664
-		    else return $row['type_flight'];
9665
-		} else return '';
10047
+		    if ($row['type_flight'] == null) {
10048
+		    	return '';
10049
+		    } else {
10050
+		    	return $row['type_flight'];
10051
+		    }
10052
+		} else {
10053
+			return '';
10054
+		}
9666 10055
 	
9667 10056
 	}
9668 10057
 
@@ -9680,7 +10069,9 @@  discard block
 block discarded – undo
9680 10069
 		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9681 10070
 	
9682 10071
 		$Connection = new Connection($this->db);
9683
-		if (!$Connection->tableExists('countries')) return '';
10072
+		if (!$Connection->tableExists('countries')) {
10073
+			return '';
10074
+		}
9684 10075
 	
9685 10076
 		try {
9686 10077
 			/*
@@ -9699,9 +10090,13 @@  discard block
 block discarded – undo
9699 10090
 			$row = $sth->fetch(PDO::FETCH_ASSOC);
9700 10091
 			if (count($row) > 0) {
9701 10092
 				return $row;
9702
-			} else return '';
10093
+			} else {
10094
+				return '';
10095
+			}
9703 10096
 		} catch (PDOException $e) {
9704
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
10097
+			if (isset($globalDebug) && $globalDebug) {
10098
+				echo 'Error : '.$e->getMessage()."\n";
10099
+			}
9705 10100
 			return '';
9706 10101
 		}
9707 10102
 	
@@ -9849,7 +10244,9 @@  discard block
 block discarded – undo
9849 10244
 	{
9850 10245
 		global $globalBitlyAccessToken;
9851 10246
 		
9852
-		if ($globalBitlyAccessToken == '') return $url;
10247
+		if ($globalBitlyAccessToken == '') {
10248
+			return $url;
10249
+		}
9853 10250
         
9854 10251
 		$google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url;
9855 10252
 		
@@ -9998,7 +10395,9 @@  discard block
 block discarded – undo
9998 10395
 		
9999 10396
 
10000 10397
 		// routes
10001
-		if ($globalDebug) print "Routes...\n";
10398
+		if ($globalDebug) {
10399
+			print "Routes...\n";
10400
+		}
10002 10401
 		if ($globalDBdriver == 'mysql') {
10003 10402
 			$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)";
10004 10403
 		} else {
@@ -10017,7 +10416,9 @@  discard block
 block discarded – undo
10017 10416
 			}
10018 10417
 		}
10019 10418
 		
10020
-		if ($globalDebug) print "Airlines...\n";
10419
+		if ($globalDebug) {
10420
+			print "Airlines...\n";
10421
+		}
10021 10422
 		//airlines
10022 10423
 		if ($globalDBdriver == 'mysql') {
10023 10424
 			$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)";
@@ -10031,10 +10432,15 @@  discard block
 block discarded – undo
10031 10432
 			if (is_numeric(substr($row['ident'], -1, 1)))
10032 10433
 			{
10033 10434
 				$fromsource = NULL;
10034
-				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
10035
-				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
10036
-				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
10037
-				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
10435
+				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
10436
+					$fromsource = 'vatsim';
10437
+				} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
10438
+					$fromsource = 'ivao';
10439
+				} elseif (isset($globalVATSIM) && $globalVATSIM) {
10440
+					$fromsource = 'vatsim';
10441
+				} elseif (isset($globalIVAO) && $globalIVAO) {
10442
+					$fromsource = 'ivao';
10443
+				}
10038 10444
 				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
10039 10445
 				if (isset($airline_array[0]['name'])) {
10040 10446
 					$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";
@@ -10044,13 +10450,17 @@  discard block
 block discarded – undo
10044 10450
 			}
10045 10451
 		}
10046 10452
 
10047
-		if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n";
10453
+		if ($globalDebug) {
10454
+			print "Remove Duplicate in aircraft_modes...\n";
10455
+		}
10048 10456
 		//duplicate modes
10049 10457
 		$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";
10050 10458
 		$sth = $this->db->prepare($query);
10051 10459
 		$sth->execute();
10052 10460
 		
10053
-		if ($globalDebug) print "Aircraft...\n";
10461
+		if ($globalDebug) {
10462
+			print "Aircraft...\n";
10463
+		}
10054 10464
 		//aircraft
10055 10465
 		if ($globalDBdriver == 'mysql') {
10056 10466
 			$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)";
@@ -10093,26 +10503,38 @@  discard block
 block discarded – undo
10093 10503
 				 if (isset($closestAirports[0])) {
10094 10504
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
10095 10505
 						$airport_icao = $closestAirports[0]['icao'];
10096
-						if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10506
+						if ($globalDebug) {
10507
+							echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10508
+						}
10097 10509
 					} elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') {
10098 10510
 						foreach ($closestAirports as $airport) {
10099 10511
 							if ($row['arrival_airport_icao'] == $airport['icao']) {
10100 10512
 								$airport_icao = $airport['icao'];
10101
-								if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10513
+								if ($globalDebug) {
10514
+									echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10515
+								}
10102 10516
 								break;
10103 10517
 							}
10104 10518
 						}
10105 10519
 					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
10106 10520
 						$airport_icao = $closestAirports[0]['icao'];
10107
-						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";
10521
+						if ($globalDebug) {
10522
+							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";
10523
+						}
10108 10524
 					} else {
10109
-						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";
10525
+						if ($globalDebug) {
10526
+							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";
10527
+						}
10110 10528
 					}
10111 10529
 				} else {
10112
-					if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
10530
+					if ($globalDebug) {
10531
+						echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
10532
+					}
10113 10533
 				}
10114 10534
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
10115
-					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
10535
+					if ($globalDebug) {
10536
+						echo "Updating airport to ".$airport_icao."...\n";
10537
+					}
10116 10538
 					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10117 10539
 					$sthu = $this->db->prepare($update_query);
10118 10540
 					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
Please login to merge, or discard this patch.
statistics-airport-arrival-country.php 3 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@  discard block
 block discarded – undo
5 5
 $Stats = new Stats();
6 6
 $title = _("Statistics").' - '._("Most common Arrival Airport by Country");
7 7
 
8
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
8
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10 10
     $airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12 12
     if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13 13
 }
14
-setcookie('stats_airline_icao',$airline_icao);
14
+setcookie('stats_airline_icao', $airline_icao);
15 15
 
16 16
 require_once('header.php');
17 17
 include('statistics-sub-menu.php'); 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	  </div>
23 23
     	 <p>'._("Below are the <strong>Top 10</strong> most common countries of all the arrival airports.").'</p>';
24 24
 
25
-$airport_country_array = $Stats->countAllArrivalCountries(true,$airline_icao);
25
+$airport_country_array = $Stats->countAllArrivalCountries(true, $airline_icao);
26 26
 
27 27
 print '<script>
28 28
     	google.load("visualization", "1", {packages:["geochart"]});
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
         	["'._("Country").'", "'._("# of times").'"],';
37 37
 
38 38
 $country_data = '';
39
-foreach($airport_country_array as $airport_item)
39
+foreach ($airport_country_array as $airport_item)
40 40
 {
41 41
 	$country_data .= '[ "'.$airport_item['airport_arrival_country'].'",'.$airport_item['airport_arrival_country_count'].'],';
42 42
 }
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 print '</thead>';
72 72
 print '<tbody>';
73 73
 $i = 1;
74
-foreach($airport_country_array as $airport_item)
74
+foreach ($airport_country_array as $airport_item)
75 75
 {
76 76
 	print '<tr>';
77 77
 	print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@
 block discarded – undo
7 7
 
8 8
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10
-    $airline_icao = $_COOKIE['stats_airline_icao'];
10
+	$airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12
+	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13 13
 }
14 14
 setcookie('stats_airline_icao',$airline_icao);
15 15
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,10 @@
 block discarded – undo
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10 10
     $airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13
-}
12
+    if (isset($globalFilter['airline'])) {
13
+    	$airline_icao = $globalFilter['airline'][0];
14
+    }
15
+    }
14 16
 setcookie('stats_airline_icao',$airline_icao);
15 17
 
16 18
 require_once('header.php');
Please login to merge, or discard this patch.
statistics-date.php 3 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@  discard block
 block discarded – undo
5 5
 $Stats = new Stats();
6 6
 $title = _("Statistics").' - '._("Busiest Day");
7 7
 
8
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
8
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10 10
     $airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12 12
     if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13 13
 }
14
-setcookie('stats_airline_icao',$airline_icao);
14
+setcookie('stats_airline_icao', $airline_icao);
15 15
 
16 16
 require_once('header.php');
17 17
 include('statistics-sub-menu.php'); 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
             	["'._("Date").'", "'._("# of Flights").'"], ';
36 36
 
37 37
 $date_data = '';
38
-foreach($date_array as $date_item)
38
+foreach ($date_array as $date_item)
39 39
 {
40 40
 	$date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
41 41
 }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
       </script>';
62 62
 }
63 63
 if (isset($globalDBArchiveMonths) && $globalDBArchiveMonths > 0) {
64
-	print '<p>'.sprintf(_("Below are the <strong>Top 10</strong> most busiest dates of last %d month(s)."),$globalDBArchiveMonths).'</p>';
64
+	print '<p>'.sprintf(_("Below are the <strong>Top 10</strong> most busiest dates of last %d month(s)."), $globalDBArchiveMonths).'</p>';
65 65
 } else {
66 66
 	print '<p>'._("Below are the <strong>Top 10</strong> most busiest dates.").'</p>';
67 67
 }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	print '</thead>';
78 78
 	print '<tbody>';
79 79
 	$i = 1;
80
-	foreach($date_array as $date_item)
80
+	foreach ($date_array as $date_item)
81 81
 	{
82 82
 		print '<tr>';
83 83
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@
 block discarded – undo
7 7
 
8 8
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10
-    $airline_icao = $_COOKIE['stats_airline_icao'];
10
+	$airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12
+	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13 13
 }
14 14
 setcookie('stats_airline_icao',$airline_icao);
15 15
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,10 @@
 block discarded – undo
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10 10
     $airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13
-}
12
+    if (isset($globalFilter['airline'])) {
13
+    	$airline_icao = $globalFilter['airline'][0];
14
+    }
15
+    }
14 16
 setcookie('stats_airline_icao',$airline_icao);
15 17
 
16 18
 require_once('header.php');
Please login to merge, or discard this patch.
statistics-month.php 3 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@  discard block
 block discarded – undo
5 5
 $Stats = new Stats();
6 6
 $title = _("Statistics").' - '._("Busiest Month of Last Year");
7 7
 
8
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
8
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10 10
     $airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12 12
     if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13 13
 }
14
-setcookie('stats_airline_icao',$airline_icao);
14
+setcookie('stats_airline_icao', $airline_icao);
15 15
 
16 16
 require_once('header.php');
17 17
 include('statistics-sub-menu.php'); 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
             	["'._("Month").'", "'._("# of Flights").'"], ';
33 33
 
34 34
 $date_data = '';
35
-foreach($date_array as $date_item)
35
+foreach ($date_array as $date_item)
36 36
 {
37 37
 	$date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
38 38
 }
@@ -69,12 +69,12 @@  discard block
 block discarded – undo
69 69
 	print '</thead>';
70 70
 	print '<tbody>';
71 71
 	$i = 1;
72
-	foreach($date_array as $date_item)
72
+	foreach ($date_array as $date_item)
73 73
 	{
74 74
 		print '<tr>';
75 75
 		print '<td><strong>'.$i.'</strong></td>';
76 76
 		print '<td>';
77
-		print '<a href="'.$globalURL.'/date/'.date('Y-m-d',strtotime($date_item['date_name'])).'">'.date("l F j, Y", strtotime($date_item['date_name'])).'</a>';
77
+		print '<a href="'.$globalURL.'/date/'.date('Y-m-d', strtotime($date_item['date_name'])).'">'.date("l F j, Y", strtotime($date_item['date_name'])).'</a>';
78 78
 		print '</td>';
79 79
 		print '<td>';
80 80
 		print $date_item['date_count'];
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@
 block discarded – undo
7 7
 
8 8
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10
-    $airline_icao = $_COOKIE['stats_airline_icao'];
10
+	$airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12
+	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13 13
 }
14 14
 setcookie('stats_airline_icao',$airline_icao);
15 15
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,10 @@
 block discarded – undo
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10 10
     $airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13
-}
12
+    if (isset($globalFilter['airline'])) {
13
+    	$airline_icao = $globalFilter['airline'][0];
14
+    }
15
+    }
14 16
 setcookie('stats_airline_icao',$airline_icao);
15 17
 
16 18
 require_once('header.php');
Please login to merge, or discard this patch.
statistics-year.php 3 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@  discard block
 block discarded – undo
5 5
 $Stats = new Stats();
6 6
 $title = _("Statistics").' - '._("Busiest Month of Last Year");
7 7
 
8
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
8
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10 10
     $airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12 12
     if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13 13
 }
14
-setcookie('stats_airline_icao',$airline_icao);
14
+setcookie('stats_airline_icao', $airline_icao);
15 15
 
16 16
 require_once('header.php');
17 17
 include('statistics-sub-menu.php');
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	</div>
22 22
       <p>'._("Below is a chart that plots the busiest month during the <strong>last year</strong>.").'</p>';
23 23
 
24
-$date_array = $Stats->countAllMonthsLastYear(true,$airline_icao);
24
+$date_array = $Stats->countAllMonthsLastYear(true, $airline_icao);
25 25
 print '<div id="chart" class="chart" width="100%"></div>
26 26
       	<script> 
27 27
       		google.load("visualization", "1", {packages:["corechart"]});
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
             	["'._("Month").'", "'._("# of Flights").'"], ';
32 32
 
33 33
 $date_data = '';
34
-foreach($date_array as $date_item)
34
+foreach ($date_array as $date_item)
35 35
 {
36 36
 	$date_data .= '[ "'.date("F, Y", strtotime($date_item['year_name'].'-'.$date_item['month_name'].'-01')).'",'.$date_item['date_count'].'],';
37 37
 }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	print '</thead>';
69 69
 	print '<tbody>';
70 70
 	$i = 1;
71
-	foreach($date_array as $date_item)
71
+	foreach ($date_array as $date_item)
72 72
 	{
73 73
 		print '<tr>';
74 74
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@
 block discarded – undo
7 7
 
8 8
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10
-    $airline_icao = $_COOKIE['stats_airline_icao'];
10
+	$airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12
+	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13 13
 }
14 14
 setcookie('stats_airline_icao',$airline_icao);
15 15
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,10 @@
 block discarded – undo
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10 10
     $airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13
-}
12
+    if (isset($globalFilter['airline'])) {
13
+    	$airline_icao = $globalFilter['airline'][0];
14
+    }
15
+    }
14 16
 setcookie('stats_airline_icao',$airline_icao);
15 17
 
16 18
 require_once('header.php');
Please login to merge, or discard this patch.
statistics-aircraft.php 3 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@  discard block
 block discarded – undo
5 5
 $Stats = new Stats();
6 6
 $title = _("Statistics").' - '._("Most common Aircraft");
7 7
 
8
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
8
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10 10
     $airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12 12
     if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13 13
 }
14
-setcookie('stats_airline_icao',$airline_icao);
14
+setcookie('stats_airline_icao', $airline_icao);
15 15
 
16 16
 require_once('header.php');
17 17
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	</div>
23 23
 	<p>'._("Below are the <strong>Top 10</strong> most common aircraft types.").'</p>';
24 24
 	  
25
-$aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao);
25
+$aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao);
26 26
 print '<div id="chart" class="chart" width="100%"></div>
27 27
       	<script> 
28 28
       		google.load("visualization", "1", {packages:["corechart"]});
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
             var data = google.visualization.arrayToDataTable([
32 32
             	["'._("Aircraft").'", "'._("# of times").'"], ';
33 33
 $aircraft_data = '';
34
-foreach($aircraft_array as $aircraft_item)
34
+foreach ($aircraft_array as $aircraft_item)
35 35
 {
36 36
 	$aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
37 37
 }
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	print '</thead>';
65 65
 	print '<tbody>';
66 66
 	$i = 1;
67
-	foreach($aircraft_array as $aircraft_item)
67
+	foreach ($aircraft_array as $aircraft_item)
68 68
 	{
69 69
 		print '<tr>';
70 70
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@
 block discarded – undo
7 7
 
8 8
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10
-    $airline_icao = $_COOKIE['stats_airline_icao'];
10
+	$airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12
+	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13 13
 }
14 14
 setcookie('stats_airline_icao',$airline_icao);
15 15
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,10 @@
 block discarded – undo
9 9
 if ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
10 10
     $airline_icao = $_COOKIE['stats_airline_icao'];
11 11
 } elseif ($airline_icao == '' && isset($globalFilter)) {
12
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13
-}
12
+    if (isset($globalFilter['airline'])) {
13
+    	$airline_icao = $globalFilter['airline'][0];
14
+    }
15
+    }
14 16
 setcookie('stats_airline_icao',$airline_icao);
15 17
 
16 18
 require_once('header.php');
Please login to merge, or discard this patch.