Completed
Push — master ( da5902...5156bc )
by Yannick
10:30
created
table-output.php 3 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -390,17 +390,17 @@  discard block
 block discarded – undo
390 390
 				else {
391 391
 					$planespotter_url_array = explode("_", $spotter_item['image']);
392 392
 					$planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]);
393
-                                        $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
393
+										$image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
394 394
 				}
395 395
 				if (isset($spotter_item['airline_name'])) {
396 396
 					print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
397 397
 				} else {
398 398
 					print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
399 399
 				}
400
-                        } else {
401
-                    		if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
402
-                    		$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
403
-                    		} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
400
+						} else {
401
+							if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
402
+							$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
403
+							} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
404 404
 				if (isset($spotter_item['airline_name'])) {
405 405
 					print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
406 406
 				} else {
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 		}
416 416
 	} elseif(strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed"){
417 417
 		if (!isset($spotter_item['squawk']) || $spotter_item['squawk'] == 0) {
418
-		    $spotter_item['squawk'] = '-';
418
+			$spotter_item['squawk'] = '-';
419 419
 		}
420 420
 		if ($spotter_item['image_thumbnail'] != "")
421 421
 		{
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 				else {
427 427
 					$planespotter_url_array = explode("_", $spotter_array[0]['image']);
428 428
 					$planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]);
429
-                                        $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
429
+										$image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
430 430
 				}
431 431
 				if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) {
432 432
 					print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
@@ -438,9 +438,9 @@  discard block
 block discarded – undo
438 438
 					print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
439 439
 				}
440 440
 			} else {
441
-                    		if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
442
-                    		$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
443
-                    		} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
441
+							if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
442
+							$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
443
+							} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
444 444
 				if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) {
445 445
 					print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
446 446
 				} elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) {
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 			print '</td>'."\n";
455 455
 		} else {
456 456
 			print '<td class="aircraft_thumbnail">'."\n";
457
-       //   	 	print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>';
457
+	   //   	 	print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>';
458 458
 	//}
459 459
 			if (!isset($spotter_item['airline_name']) && !isset($spotter_item['aircraft_name'])) {
460 460
 				print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '._("Not available").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n";
@@ -559,13 +559,13 @@  discard block
 block discarded – undo
559 559
 				$distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude);
560 560
 			} else $distance = '';
561 561
 			if ($distance != '') {
562
-			    if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
563
-				    echo '<br/><i>'.round($distance*0.539957).' nm</i>';
564
-			    } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
565
-				    echo '<br/><i>'.round($distance*0.621371).' mi</i>';
566
-			    } elseif ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
567
-				    echo '<br/><i>'.$distance.' km</i>';
568
-			    }
562
+				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
563
+					echo '<br/><i>'.round($distance*0.539957).' nm</i>';
564
+				} elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
565
+					echo '<br/><i>'.round($distance*0.621371).' mi</i>';
566
+				} elseif ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
567
+					echo '<br/><i>'.$distance.' km</i>';
568
+				}
569 569
 			}
570 570
 		}
571 571
 		print '</td>'."\n";
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	}
95 95
 	print '<th class="more"></th>';
96 96
 	print '</thead>';
97
-} else if (strtolower($current_page) == "upcoming"){
97
+} else if (strtolower($current_page) == "upcoming") {
98 98
 	print '<thead>';
99 99
 	if ($_GET['sort'] == "airline_name_asc")
100 100
 	{
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	}
145 145
 	*/
146 146
 	print '</thead>';
147
-} else if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive"){
147
+} else if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive") {
148 148
 	print '<thead>';
149 149
 	print '<th class="aircraft_thumbnail"></th>';
150 150
 	print '<th class="logo">'._("Airline").'</th>';
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	print '</thead>';
182 182
 } else {
183 183
 
184
-	if ($hide_th_links === true){
184
+	if ($hide_th_links === true) {
185 185
 		print '<thead>';
186 186
 		print '<th class="aircraft_thumbnail"></th>';
187 187
 		if ($_GET['sort'] == "airline_name_asc")
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 }
363 363
 
364 364
 print '<tbody>'."\n";
365
-foreach($spotter_array as $spotter_item)
365
+foreach ($spotter_array as $spotter_item)
366 366
 {
367 367
 	if (isset($globalTimezone))
368 368
 	{
@@ -393,13 +393,13 @@  discard block
 block discarded – undo
393 393
                                         $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
394 394
 				}
395 395
 				if (isset($spotter_item['airline_name'])) {
396
-					print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
396
+					print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
397 397
 				} else {
398
-					print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
398
+					print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
399 399
 				}
400 400
                         } else {
401 401
                     		if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
402
-                    		$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
402
+                    		$image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
403 403
                     		} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
404 404
 				if (isset($spotter_item['airline_name'])) {
405 405
 					print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 			print '<img src="'.$globalURL.'/images/placeholder_thumb.png" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" />'."\n";
414 414
 			print '</td>'."\n";
415 415
 		}
416
-	} elseif(strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed"){
416
+	} elseif (strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed") {
417 417
 		if (!isset($spotter_item['squawk']) || $spotter_item['squawk'] == 0) {
418 418
 		    $spotter_item['squawk'] = '-';
419 419
 		}
@@ -429,17 +429,17 @@  discard block
 block discarded – undo
429 429
                                         $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
430 430
 				}
431 431
 				if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) {
432
-					print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
432
+					print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
433 433
 				} elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) {
434
-					print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
434
+					print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
435 435
 				} elseif (!isset($spotter_item['aircraft_name']) && !isset($spotter_item['airline_name'])) {
436
-					print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
436
+					print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
437 437
 				} else {
438
-					print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
438
+					print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
439 439
 				}
440 440
 			} else {
441 441
                     		if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
442
-                    		$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
442
+                    		$image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
443 443
                     		} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
444 444
 				if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) {
445 445
 					print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 	}
503 503
 	print '</td>'."\n";
504 504
 	// Aircraft type
505
-	if(strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive"){
505
+	if (strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive") {
506 506
 		print '<td class="type">'."\n";
507 507
 		if (!isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_name'])) {
508 508
 			print '<span class="nomobile">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].'</span>'."\n";
@@ -526,22 +526,22 @@  discard block
 block discarded – undo
526 526
 		}
527 527
 		if (isset($spotter_item['departure_airport_time']) && isset($spotter_item['real_departure_airport_time'])) {
528 528
 			if ($spotter_item['departure_airport_time'] > 2460) {
529
-				$departure_airport_time = date('H:m',$spotter_item['departure_airport_time']);
530
-			} else $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2);
529
+				$departure_airport_time = date('H:m', $spotter_item['departure_airport_time']);
530
+			} else $departure_airport_time = substr($spotter_item['departure_airport_time'], 0, -2).':'.substr($spotter_item['departure_airport_time'], -2);
531 531
 			if ($spotter_item['real_departure_airport_time'] > 2460) {
532
-				$real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']);
532
+				$real_departure_airport_time = date('H:m', $spotter_item['real_departure_airport_time']);
533 533
 			} else $real_departure_airport_time = $spotter_item['real_departure_airport_time'];
534 534
 			print '<br /><span class="airport_time">'.$departure_airport_time.' ('.$real_departure_airport_time.')</span>'."\n";
535 535
 		} elseif (isset($spotter_item['real_departure_airport_time']) && $spotter_item['real_departure_airport_time'] != 'NULL') {
536 536
 			if ($spotter_item['real_departure_airport_time'] > 2460) {
537
-				$real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']);
537
+				$real_departure_airport_time = date('H:m', $spotter_item['real_departure_airport_time']);
538 538
 			} else $real_departure_airport_time = $spotter_item['real_departure_airport_time'];
539 539
 			print '<br /><span class="airport_time">'.$real_departure_airport_time.'</span>'."\n";
540 540
 		} elseif (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') {
541 541
 			if ($spotter_item['departure_airport_time'] > 2460) {
542
-				$departure_airport_time = date('H:m',$spotter_item['departure_airport_time']);
542
+				$departure_airport_time = date('H:m', $spotter_item['departure_airport_time']);
543 543
 			} else {
544
-				$departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2);
544
+				$departure_airport_time = substr($spotter_item['departure_airport_time'], 0, -2).':'.substr($spotter_item['departure_airport_time'], -2);
545 545
 			}
546 546
 			print '<br /><span class="airport_time">'.$departure_airport_time.'</span>'."\n";
547 547
 		}
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
 					$latitude = $spotter_item['latitude'];
557 557
 					$longitude = $spotter_item['longitude'];
558 558
 				}
559
-				$distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude);
559
+				$distance = $Spotter->getAirportDistance($spotter_item['departure_airport'], $latitude, $longitude);
560 560
 			} else $distance = '';
561 561
 			if ($distance != '') {
562 562
 			    if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
@@ -597,20 +597,20 @@  discard block
 block discarded – undo
597 597
 		}
598 598
 		if (isset($spotter_item['arrival_airport_time']) && isset($spotter_item['real_arrival_airport_time'])) {
599 599
 			if ($spotter_item['arrival_airport_time'] > 2460) {
600
-				$arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']);
600
+				$arrival_airport_time = date('H:m', $spotter_item['arrival_airport_time']);
601 601
 			} else $arrival_airport_time = $spotter_item['arrival_airport_time'];
602 602
 			if ($spotter_item['real_arrival_airport_time'] > 2460) {
603
-				$real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']);
603
+				$real_arrival_airport_time = date('H:m', $spotter_item['real_arrival_airport_time']);
604 604
 			} else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
605 605
 			print '<br /><span class="airport_time">'.$spotter_item['arrival_airport_time'].' ('.$spotter_item['real_arrival_airport_time'].')</span>'."\n";
606 606
 		} elseif (isset($spotter_item['real_arrival_airport_time'])) {
607 607
 			if ($spotter_item['real_arrival_airport_time'] > 2460) {
608
-				$real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']);
608
+				$real_arrival_airport_time = date('H:m', $spotter_item['real_arrival_airport_time']);
609 609
 			} else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
610 610
 			print '<br /><span class="airport_time">'.$real_arrival_airport_time.'</span>'."\n";
611 611
 		} elseif (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') {
612 612
 			if ($spotter_item['arrival_airport_time'] > 2460) {
613
-				$arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']);
613
+				$arrival_airport_time = date('H:m', $spotter_item['arrival_airport_time']);
614 614
 			} else $arrival_airport_time = $spotter_item['arrival_airport_time'];
615 615
 			print '<br /><span class="airport_time">'.$arrival_airport_time.'</span>'."\n";
616 616
 		}
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 					$latitude = $spotter_item['latitude'];
624 624
 					$longitude = $spotter_item['longitude'];
625 625
 				}
626
-				$distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'],$latitude,$longitude);
626
+				$distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'], $latitude, $longitude);
627 627
 			} else $distance = '';
628 628
 			if ($distance != '') {
629 629
 				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
 		print '</td>'."\n";
639 639
 		if ((isset($globalIvAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalVAM) && $globalVAM) || (isset($globalphpVMS) && $globalphpVMS)) {
640 640
 			// Route stop
641
-			if(strtolower($current_page) != "upcoming"){
641
+			if (strtolower($current_page) != "upcoming") {
642 642
 				print '<td class="route_stop">'."\n";
643 643
 				if (!isset($spotter_item['route_stop']) || $spotter_item['route_stop'] == '' || $spotter_item['route_stop'] == 'NULL') {
644 644
 					print '<span class="nomobile">-</span>'."\n";
@@ -663,21 +663,21 @@  discard block
 block discarded – undo
663 663
 			} else {
664 664
 				//if (!isset($globalUnitDistance) || $globalUnitDistance == 'km') {
665 665
 				if ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
666
-					print '<span class="nomobile">'.round($spotter_item['distance'],2).' km</span>'."\n";
667
-					print '<span class="mobile">'.round($spotter_item['distance'],2).' km</span><br />'."\n";
666
+					print '<span class="nomobile">'.round($spotter_item['distance'], 2).' km</span>'."\n";
667
+					print '<span class="mobile">'.round($spotter_item['distance'], 2).' km</span><br />'."\n";
668 668
 				//} elseif ($globalUnitDistance == 'mi') {
669 669
 				} elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
670
-					print '<span class="nomobile">'.round($spotter_item['distance']*0.621371,2).' mi</span>'."\n";
671
-					print '<span class="mobile">'.round($spotter_item['distance']*0.621371,2).' mi</span><br />'."\n";
670
+					print '<span class="nomobile">'.round($spotter_item['distance']*0.621371, 2).' mi</span>'."\n";
671
+					print '<span class="mobile">'.round($spotter_item['distance']*0.621371, 2).' mi</span><br />'."\n";
672 672
 				//} elseif ($globalUnitDistance == 'nm') {
673 673
 				} elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
674
-					print '<span class="nomobile">'.round($spotter_item['distance']*0.539957,2).' nm</span>'."\n";
675
-					print '<span class="mobile">'.round($spotter_item['distance']*0.539957,2).' nm</span><br />'."\n";
674
+					print '<span class="nomobile">'.round($spotter_item['distance']*0.539957, 2).' nm</span>'."\n";
675
+					print '<span class="mobile">'.round($spotter_item['distance']*0.539957, 2).' nm</span><br />'."\n";
676 676
 				}
677 677
 			}
678 678
 			print '</td>'."\n";
679 679
 		}
680
-		if(strtolower($current_page) != "upcoming"){
680
+		if (strtolower($current_page) != "upcoming") {
681 681
 			if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
682 682
 				print '<td class="pilot">'."\n";
683 683
 				if ((!isset($spotter_item['pilot_id']) || $spotter_item['pilot_id'] == '') && (!isset($spotter_item['pilot_name']) || $spotter_item['pilot_name'] == '')) {
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 	if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive") {
713 713
 		if (isset($spotter_item['decode']) && $spotter_item['decode'] != '') {
714 714
 			print '<td class="message"><p>'."\n";
715
-			print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']);
715
+			print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']);
716 716
 			print '</p><p class="decode">';
717 717
 			$decode_array = json_decode($spotter_item['decode']);
718 718
 			foreach ($decode_array as $key => $value) {
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
 			print '</td>'."\n";
723 723
 		} else {
724 724
 			print '<td class="message">'."\n";
725
-			print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']);
725
+			print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']);
726 726
 			print '</td>'."\n";
727 727
 		}
728 728
 	}
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
 		}
748 748
 		print '</td>'."\n";
749 749
 		print '<td class="message">'."\n";
750
-		print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']);
750
+		print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']);
751 751
 		print '</td>'."\n";
752 752
 	}
753 753
 	if (strtolower($current_page) == "incident-latest" || strtolower($current_page) == "incident-detailed") {
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
 		print '</td>'."\n";
774 774
 		*/
775 775
 		print '<td class="message">'."\n";
776
-		print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']);
776
+		print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']);
777 777
 		print '</td>'."\n";
778 778
 	}
779 779
 	// Date
Please login to merge, or discard this patch.
Braces   +45 added lines, -17 removed lines patch added patch discarded remove patch
@@ -367,7 +367,9 @@  discard block
 block discarded – undo
367 367
 	if (isset($globalTimezone))
368 368
 	{
369 369
 		date_default_timezone_set($globalTimezone);
370
-	} else date_default_timezone_set('UTC');
370
+	} else {
371
+		date_default_timezone_set('UTC');
372
+	}
371 373
 	if ($showSpecial === true)
372 374
 	{
373 375
 		print '<tr class="special">'."\n";
@@ -386,8 +388,9 @@  discard block
 block discarded – undo
386 388
 			print '<td class="aircraft_thumbnail">'."\n";
387 389
 			
388 390
 			if ($spotter_item['image_source'] == 'planespotters') {
389
-				if ($spotter_item['image_source_website'] != '') $image_src = $spotter_item['image_source_website'];
390
-				else {
391
+				if ($spotter_item['image_source_website'] != '') {
392
+					$image_src = $spotter_item['image_source_website'];
393
+				} else {
391 394
 					$planespotter_url_array = explode("_", $spotter_item['image']);
392 395
 					$planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]);
393 396
                                         $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
@@ -400,7 +403,9 @@  discard block
 block discarded – undo
400 403
                         } else {
401 404
                     		if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
402 405
                     		$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
403
-                    		} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
406
+                    		} else {
407
+                    			$image_thumbnail = $spotter_item['image_thumbnail'];
408
+                    		}
404 409
 				if (isset($spotter_item['airline_name'])) {
405 410
 					print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
406 411
 				} else {
@@ -422,8 +427,9 @@  discard block
 block discarded – undo
422 427
 			print '<td class="aircraft_thumbnail">'."\n";
423 428
 			//print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$spotter_item['image_thumbnail'].'" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>';
424 429
 			if ($spotter_item['image_source'] == 'planespotters') {
425
-				if ($spotter_item['image_source_website'] != '') $image_src = $spotter_item['image_source_website'];
426
-				else {
430
+				if ($spotter_item['image_source_website'] != '') {
431
+					$image_src = $spotter_item['image_source_website'];
432
+				} else {
427 433
 					$planespotter_url_array = explode("_", $spotter_array[0]['image']);
428 434
 					$planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]);
429 435
                                         $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
@@ -440,7 +446,9 @@  discard block
 block discarded – undo
440 446
 			} else {
441 447
                     		if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
442 448
                     		$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
443
-                    		} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
449
+                    		} else {
450
+                    			$image_thumbnail = $spotter_item['image_thumbnail'];
451
+                    		}
444 452
 				if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) {
445 453
 					print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
446 454
 				} elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) {
@@ -527,15 +535,21 @@  discard block
 block discarded – undo
527 535
 		if (isset($spotter_item['departure_airport_time']) && isset($spotter_item['real_departure_airport_time'])) {
528 536
 			if ($spotter_item['departure_airport_time'] > 2460) {
529 537
 				$departure_airport_time = date('H:m',$spotter_item['departure_airport_time']);
530
-			} else $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2);
538
+			} else {
539
+				$departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2);
540
+			}
531 541
 			if ($spotter_item['real_departure_airport_time'] > 2460) {
532 542
 				$real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']);
533
-			} else $real_departure_airport_time = $spotter_item['real_departure_airport_time'];
543
+			} else {
544
+				$real_departure_airport_time = $spotter_item['real_departure_airport_time'];
545
+			}
534 546
 			print '<br /><span class="airport_time">'.$departure_airport_time.' ('.$real_departure_airport_time.')</span>'."\n";
535 547
 		} elseif (isset($spotter_item['real_departure_airport_time']) && $spotter_item['real_departure_airport_time'] != 'NULL') {
536 548
 			if ($spotter_item['real_departure_airport_time'] > 2460) {
537 549
 				$real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']);
538
-			} else $real_departure_airport_time = $spotter_item['real_departure_airport_time'];
550
+			} else {
551
+				$real_departure_airport_time = $spotter_item['real_departure_airport_time'];
552
+			}
539 553
 			print '<br /><span class="airport_time">'.$real_departure_airport_time.'</span>'."\n";
540 554
 		} elseif (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') {
541 555
 			if ($spotter_item['departure_airport_time'] > 2460) {
@@ -557,7 +571,9 @@  discard block
 block discarded – undo
557 571
 					$longitude = $spotter_item['longitude'];
558 572
 				}
559 573
 				$distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude);
560
-			} else $distance = '';
574
+			} else {
575
+				$distance = '';
576
+			}
561 577
 			if ($distance != '') {
562 578
 			    if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
563 579
 				    echo '<br/><i>'.round($distance*0.539957).' nm</i>';
@@ -582,7 +598,9 @@  discard block
 block discarded – undo
582 598
 		} else {
583 599
 			if (isset($spotter_item['real_arrival_airport']) && $spotter_item['real_arrival_airport'] != $spotter_item['arrival_airport']) {
584 600
 				print '<span class="nomobile">Scheduled : <a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'">'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].' ('.$spotter_item['arrival_airport'].')</a></span>'."\n";
585
-				if (!isset($Spotter)) $Spotter = new Spotter();
601
+				if (!isset($Spotter)) {
602
+					$Spotter = new Spotter();
603
+				}
586 604
 				$arrival_airport_info = $Spotter->getAllAirportInfo($spotter_item['real_arrival_airport']);
587 605
 				print '<br /><span class="nomobile">'._("Real:").' <a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$arrival_airport_info[0]['city'].','.$arrival_airport_info[0]['country'].' ('.$spotter_item['real_arrival_airport'].')</a></span>'."\n";
588 606
 				print '<span class="mobile">'._("Scheduled:").' <a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$spotter_item['real_arrival_airport'].'</a></span>'."\n";
@@ -598,20 +616,28 @@  discard block
 block discarded – undo
598 616
 		if (isset($spotter_item['arrival_airport_time']) && isset($spotter_item['real_arrival_airport_time'])) {
599 617
 			if ($spotter_item['arrival_airport_time'] > 2460) {
600 618
 				$arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']);
601
-			} else $arrival_airport_time = $spotter_item['arrival_airport_time'];
619
+			} else {
620
+				$arrival_airport_time = $spotter_item['arrival_airport_time'];
621
+			}
602 622
 			if ($spotter_item['real_arrival_airport_time'] > 2460) {
603 623
 				$real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']);
604
-			} else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
624
+			} else {
625
+				$real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
626
+			}
605 627
 			print '<br /><span class="airport_time">'.$spotter_item['arrival_airport_time'].' ('.$spotter_item['real_arrival_airport_time'].')</span>'."\n";
606 628
 		} elseif (isset($spotter_item['real_arrival_airport_time'])) {
607 629
 			if ($spotter_item['real_arrival_airport_time'] > 2460) {
608 630
 				$real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']);
609
-			} else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
631
+			} else {
632
+				$real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
633
+			}
610 634
 			print '<br /><span class="airport_time">'.$real_arrival_airport_time.'</span>'."\n";
611 635
 		} elseif (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') {
612 636
 			if ($spotter_item['arrival_airport_time'] > 2460) {
613 637
 				$arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']);
614
-			} else $arrival_airport_time = $spotter_item['arrival_airport_time'];
638
+			} else {
639
+				$arrival_airport_time = $spotter_item['arrival_airport_time'];
640
+			}
615 641
 			print '<br /><span class="airport_time">'.$arrival_airport_time.'</span>'."\n";
616 642
 		}
617 643
 		if (!isset($spotter_item['real_arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
@@ -624,7 +650,9 @@  discard block
 block discarded – undo
624 650
 					$longitude = $spotter_item['longitude'];
625 651
 				}
626 652
 				$distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'],$latitude,$longitude);
627
-			} else $distance = '';
653
+			} else {
654
+				$distance = '';
655
+			}
628 656
 			if ($distance != '') {
629 657
 				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
630 658
 					echo '<br/><i>'.round($distance*0.539957).' nm</i>';
Please login to merge, or discard this patch.
require/class.Spotter.php 2 patches
Indentation   +1324 added lines, -1324 removed lines patch added patch discarded remove patch
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 	}
56 56
 
57 57
 	/**
58
-	* Get SQL query part for filter used
59
-	* @param Array $filter the filter
60
-	* @return Array the SQL part
61
-	*/
58
+	 * Get SQL query part for filter used
59
+	 * @param Array $filter the filter
60
+	 * @return Array the SQL part
61
+	 */
62 62
 	public function getFilter($filter = array(),$where = false,$and = false) {
63 63
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
64 64
 		$filters = array();
@@ -129,14 +129,14 @@  discard block
 block discarded – undo
129 129
 	}
130 130
 
131 131
 	/**
132
-	* Executes the SQL statements to get the spotter information
133
-	*
134
-	* @param String $query the SQL query
135
-	* @param Array $params parameter of the query
136
-	* @param String $limitQuery the limit query
137
-	* @return Array the spotter information
138
-	*
139
-	*/
132
+	 * Executes the SQL statements to get the spotter information
133
+	 *
134
+	 * @param String $query the SQL query
135
+	 * @param Array $params parameter of the query
136
+	 * @param String $limitQuery the limit query
137
+	 * @return Array the spotter information
138
+	 *
139
+	 */
140 140
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
141 141
 	{
142 142
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
@@ -300,11 +300,11 @@  discard block
 block discarded – undo
300 300
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
301 301
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
302 302
 					} else $temp_array['aircraft_shadow'] = 'default.png';
303
-                                } else {
304
-                            		$temp_array['aircraft_shadow'] = 'default.png';
303
+								} else {
304
+									$temp_array['aircraft_shadow'] = 'default.png';
305 305
 					$temp_array['aircraft_name'] = 'N/A';
306 306
 					$temp_array['aircraft_manufacturer'] = 'N/A';
307
-                            	}
307
+								}
308 308
 			}
309 309
 			$fromsource = NULL;
310 310
 			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
@@ -500,11 +500,11 @@  discard block
 block discarded – undo
500 500
 	
501 501
 	
502 502
 	/**
503
-	* Gets all the spotter information
504
-	*
505
-	* @return Array the spotter information
506
-	*
507
-	*/
503
+	 * Gets all the spotter information
504
+	 *
505
+	 * @return Array the spotter information
506
+	 *
507
+	 */
508 508
 	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
509 509
 	{
510 510
 		global $globalTimezone, $globalDBdriver;
@@ -851,11 +851,11 @@  discard block
 block discarded – undo
851 851
 	
852 852
 	
853 853
 	/**
854
-	* Gets all the spotter information based on the latest data entry
855
-	*
856
-	* @return Array the spotter information
857
-	*
858
-	*/
854
+	 * Gets all the spotter information based on the latest data entry
855
+	 *
856
+	 * @return Array the spotter information
857
+	 *
858
+	 */
859 859
 	public function getLatestSpotterData($limit = '', $sort = '', $filter = array())
860 860
 	{
861 861
 		global $global_query;
@@ -894,12 +894,12 @@  discard block
 block discarded – undo
894 894
 	}
895 895
     
896 896
     
897
-    /**
898
-	* Gets all the spotter information based on a user's latitude and longitude
899
-	*
900
-	* @return Array the spotter information
901
-	*
902
-	*/
897
+	/**
898
+	 * Gets all the spotter information based on a user's latitude and longitude
899
+	 *
900
+	 * @return Array the spotter information
901
+	 *
902
+	 */
903 903
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
904 904
 	{
905 905
 		date_default_timezone_set('UTC');
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
 				return false;
928 928
 			}
929 929
 		}
930
-    		$additional_query = '';
930
+			$additional_query = '';
931 931
 		if ($interval != "")
932 932
 		{
933 933
 			if (!is_string($interval))
@@ -967,12 +967,12 @@  discard block
 block discarded – undo
967 967
 	}
968 968
     
969 969
     
970
-    /**
971
-	* Gets all the spotter information sorted by the newest aircraft type
972
-	*
973
-	* @return Array the spotter information
974
-	*
975
-	*/
970
+	/**
971
+	 * Gets all the spotter information sorted by the newest aircraft type
972
+	 *
973
+	 * @return Array the spotter information
974
+	 *
975
+	 */
976 976
 	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
977 977
 	{
978 978
 		global $global_query;
@@ -1013,11 +1013,11 @@  discard block
 block discarded – undo
1013 1013
     
1014 1014
     
1015 1015
 	/**
1016
-	* Gets all the spotter information sorted by the newest aircraft registration
1017
-	*
1018
-	* @return Array the spotter information
1019
-	*
1020
-	*/
1016
+	 * Gets all the spotter information sorted by the newest aircraft registration
1017
+	 *
1018
+	 * @return Array the spotter information
1019
+	 *
1020
+	 */
1021 1021
 	public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array())
1022 1022
 	{
1023 1023
 		global $global_query;
@@ -1057,11 +1057,11 @@  discard block
 block discarded – undo
1057 1057
 
1058 1058
 
1059 1059
 	/**
1060
-	* Gets all the spotter information sorted by the newest airline
1061
-	*
1062
-	* @return Array the spotter information
1063
-	*
1064
-	*/
1060
+	 * Gets all the spotter information sorted by the newest airline
1061
+	 *
1062
+	 * @return Array the spotter information
1063
+	 *
1064
+	 */
1065 1065
 	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1066 1066
 	{
1067 1067
 		global $global_query;
@@ -1100,12 +1100,12 @@  discard block
 block discarded – undo
1100 1100
 	}
1101 1101
     
1102 1102
     
1103
-    /**
1104
-	* Gets all the spotter information sorted by the newest departure airport
1105
-	*
1106
-	* @return Array the spotter information
1107
-	*
1108
-	*/
1103
+	/**
1104
+	 * Gets all the spotter information sorted by the newest departure airport
1105
+	 *
1106
+	 * @return Array the spotter information
1107
+	 *
1108
+	 */
1109 1109
 	public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array())
1110 1110
 	{
1111 1111
 		global $global_query;
@@ -1147,11 +1147,11 @@  discard block
 block discarded – undo
1147 1147
 
1148 1148
 
1149 1149
 	/**
1150
-	* Gets all the spotter information sorted by the newest arrival airport
1151
-	*
1152
-	* @return Array the spotter information
1153
-	*
1154
-	*/
1150
+	 * Gets all the spotter information sorted by the newest arrival airport
1151
+	 *
1152
+	 * @return Array the spotter information
1153
+	 *
1154
+	 */
1155 1155
 	public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array())
1156 1156
 	{
1157 1157
 		global $global_query;
@@ -1190,11 +1190,11 @@  discard block
 block discarded – undo
1190 1190
 	
1191 1191
 
1192 1192
 	/**
1193
-	* Gets all the spotter information based on the spotter id
1194
-	*
1195
-	* @return Array the spotter information
1196
-	*
1197
-	*/
1193
+	 * Gets all the spotter information based on the spotter id
1194
+	 *
1195
+	 * @return Array the spotter information
1196
+	 *
1197
+	 */
1198 1198
 	public function getSpotterDataByID($id = '')
1199 1199
 	{
1200 1200
 		global $global_query;
@@ -1216,11 +1216,11 @@  discard block
 block discarded – undo
1216 1216
 	
1217 1217
 	
1218 1218
 	/**
1219
-	* Gets all the spotter information based on the callsign
1220
-	*
1221
-	* @return Array the spotter information
1222
-	*
1223
-	*/
1219
+	 * Gets all the spotter information based on the callsign
1220
+	 *
1221
+	 * @return Array the spotter information
1222
+	 *
1223
+	 */
1224 1224
 	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
1225 1225
 	{
1226 1226
 		global $global_query;
@@ -1273,11 +1273,11 @@  discard block
 block discarded – undo
1273 1273
 	
1274 1274
 	
1275 1275
 	/**
1276
-	* Gets all the spotter information based on the aircraft type
1277
-	*
1278
-	* @return Array the spotter information
1279
-	*
1280
-	*/
1276
+	 * Gets all the spotter information based on the aircraft type
1277
+	 *
1278
+	 * @return Array the spotter information
1279
+	 *
1280
+	 */
1281 1281
 	public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array())
1282 1282
 	{
1283 1283
 		global $global_query;
@@ -1331,11 +1331,11 @@  discard block
 block discarded – undo
1331 1331
 	
1332 1332
 	
1333 1333
 	/**
1334
-	* Gets all the spotter information based on the aircraft registration
1335
-	*
1336
-	* @return Array the spotter information
1337
-	*
1338
-	*/
1334
+	 * Gets all the spotter information based on the aircraft registration
1335
+	 *
1336
+	 * @return Array the spotter information
1337
+	 *
1338
+	 */
1339 1339
 	public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array())
1340 1340
 	{
1341 1341
 		global $global_query;
@@ -1392,11 +1392,11 @@  discard block
 block discarded – undo
1392 1392
 	
1393 1393
 	
1394 1394
 	/**
1395
-	* Gets all the spotter information based on the airline
1396
-	*
1397
-	* @return Array the spotter information
1398
-	*
1399
-	*/
1395
+	 * Gets all the spotter information based on the airline
1396
+	 *
1397
+	 * @return Array the spotter information
1398
+	 *
1399
+	 */
1400 1400
 	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1401 1401
 	{
1402 1402
 		global $global_query;
@@ -1449,11 +1449,11 @@  discard block
 block discarded – undo
1449 1449
 	
1450 1450
 	
1451 1451
 	/**
1452
-	* Gets all the spotter information based on the airport
1453
-	*
1454
-	* @return Array the spotter information
1455
-	*
1456
-	*/
1452
+	 * Gets all the spotter information based on the airport
1453
+	 *
1454
+	 * @return Array the spotter information
1455
+	 *
1456
+	 */
1457 1457
 	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1458 1458
 	{
1459 1459
 		global $global_query;
@@ -1507,11 +1507,11 @@  discard block
 block discarded – undo
1507 1507
 
1508 1508
 
1509 1509
 	/**
1510
-	* Gets all the spotter information based on the date
1511
-	*
1512
-	* @return Array the spotter information
1513
-	*
1514
-	*/
1510
+	 * Gets all the spotter information based on the date
1511
+	 *
1512
+	 * @return Array the spotter information
1513
+	 *
1514
+	 */
1515 1515
 	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1516 1516
 	{
1517 1517
 		global $global_query, $globalTimezone, $globalDBdriver;
@@ -1575,11 +1575,11 @@  discard block
 block discarded – undo
1575 1575
 
1576 1576
 
1577 1577
 	/**
1578
-	* Gets all the spotter information based on the country name
1579
-	*
1580
-	* @return Array the spotter information
1581
-	*
1582
-	*/
1578
+	 * Gets all the spotter information based on the country name
1579
+	 *
1580
+	 * @return Array the spotter information
1581
+	 *
1582
+	 */
1583 1583
 	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1584 1584
 	{
1585 1585
 		global $global_query;
@@ -1633,11 +1633,11 @@  discard block
 block discarded – undo
1633 1633
 	
1634 1634
 	
1635 1635
 	/**
1636
-	* Gets all the spotter information based on the manufacturer name
1637
-	*
1638
-	* @return Array the spotter information
1639
-	*
1640
-	*/
1636
+	 * Gets all the spotter information based on the manufacturer name
1637
+	 *
1638
+	 * @return Array the spotter information
1639
+	 *
1640
+	 */
1641 1641
 	public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array())
1642 1642
 	{
1643 1643
 		global $global_query;
@@ -1693,13 +1693,13 @@  discard block
 block discarded – undo
1693 1693
   
1694 1694
   
1695 1695
 	/**
1696
-	* Gets a list of all aircraft that take a route
1697
-	*
1698
-	* @param String $departure_airport_icao ICAO code of departure airport
1699
-	* @param String $arrival_airport_icao ICAO code of arrival airport
1700
-	* @return Array the spotter information
1701
-	*
1702
-	*/
1696
+	 * Gets a list of all aircraft that take a route
1697
+	 *
1698
+	 * @param String $departure_airport_icao ICAO code of departure airport
1699
+	 * @param String $arrival_airport_icao ICAO code of arrival airport
1700
+	 * @return Array the spotter information
1701
+	 *
1702
+	 */
1703 1703
 	public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array())
1704 1704
 	{
1705 1705
 		global $global_query;
@@ -1768,11 +1768,11 @@  discard block
 block discarded – undo
1768 1768
 	
1769 1769
 	
1770 1770
 	/**
1771
-	* Gets all the spotter information based on the special column in the table
1772
-	*
1773
-	* @return Array the spotter information
1774
-	*
1775
-	*/
1771
+	 * Gets all the spotter information based on the special column in the table
1772
+	 *
1773
+	 * @return Array the spotter information
1774
+	 *
1775
+	 */
1776 1776
 	public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array())
1777 1777
 	{
1778 1778
 		global $global_query;
@@ -1811,11 +1811,11 @@  discard block
 block discarded – undo
1811 1811
 	}
1812 1812
 
1813 1813
 	/**
1814
-	* Gets all the highlight based on a aircraft registration
1815
-	*
1816
-	* @return String the highlight text
1817
-	*
1818
-	*/
1814
+	 * Gets all the highlight based on a aircraft registration
1815
+	 *
1816
+	 * @return String the highlight text
1817
+	 *
1818
+	 */
1819 1819
 	public function getHighlightByRegistration($registration,$filter = array())
1820 1820
 	{
1821 1821
 		global $global_query;
@@ -1837,13 +1837,13 @@  discard block
 block discarded – undo
1837 1837
 
1838 1838
 	
1839 1839
 	/**
1840
-	* Gets the squawk usage from squawk code
1841
-	*
1842
-	* @param String $squawk squawk code
1843
-	* @param String $country country
1844
-	* @return String usage
1845
-	*
1846
-	*/
1840
+	 * Gets the squawk usage from squawk code
1841
+	 *
1842
+	 * @param String $squawk squawk code
1843
+	 * @param String $country country
1844
+	 * @return String usage
1845
+	 *
1846
+	 */
1847 1847
 	public function getSquawkUsage($squawk = '',$country = 'FR')
1848 1848
 	{
1849 1849
 		
@@ -1864,12 +1864,12 @@  discard block
 block discarded – undo
1864 1864
 	}
1865 1865
 
1866 1866
 	/**
1867
-	* Gets the airport icao from the iata
1868
-	*
1869
-	* @param String $airport_iata the iata code of the airport
1870
-	* @return String airport iata
1871
-	*
1872
-	*/
1867
+	 * Gets the airport icao from the iata
1868
+	 *
1869
+	 * @param String $airport_iata the iata code of the airport
1870
+	 * @return String airport iata
1871
+	 *
1872
+	 */
1873 1873
 	public function getAirportIcao($airport_iata = '')
1874 1874
 	{
1875 1875
 		
@@ -1889,14 +1889,14 @@  discard block
 block discarded – undo
1889 1889
 	}
1890 1890
 
1891 1891
 	/**
1892
-	* Gets the airport distance
1893
-	*
1894
-	* @param String $airport_icao the icao code of the airport
1895
-	* @param Float $latitude the latitude
1896
-	* @param Float $longitude the longitude
1897
-	* @return Float distance to the airport
1898
-	*
1899
-	*/
1892
+	 * Gets the airport distance
1893
+	 *
1894
+	 * @param String $airport_icao the icao code of the airport
1895
+	 * @param Float $latitude the latitude
1896
+	 * @param Float $longitude the longitude
1897
+	 * @return Float distance to the airport
1898
+	 *
1899
+	 */
1900 1900
 	public function getAirportDistance($airport_icao,$latitude,$longitude)
1901 1901
 	{
1902 1902
 		
@@ -1917,12 +1917,12 @@  discard block
 block discarded – undo
1917 1917
 	}
1918 1918
 	
1919 1919
 	/**
1920
-	* Gets the airport info based on the icao
1921
-	*
1922
-	* @param String $airport the icao code of the airport
1923
-	* @return Array airport information
1924
-	*
1925
-	*/
1920
+	 * Gets the airport info based on the icao
1921
+	 *
1922
+	 * @param String $airport the icao code of the airport
1923
+	 * @return Array airport information
1924
+	 *
1925
+	 */
1926 1926
 	public function getAllAirportInfo($airport = '')
1927 1927
 	{
1928 1928
 		
@@ -1968,12 +1968,12 @@  discard block
 block discarded – undo
1968 1968
 	}
1969 1969
 	
1970 1970
 	/**
1971
-	* Gets the airport info based on the country
1972
-	*
1973
-	* @param Array $countries Airports countries
1974
-	* @return Array airport information
1975
-	*
1976
-	*/
1971
+	 * Gets the airport info based on the country
1972
+	 *
1973
+	 * @param Array $countries Airports countries
1974
+	 * @return Array airport information
1975
+	 *
1976
+	 */
1977 1977
 	public function getAllAirportInfobyCountry($countries)
1978 1978
 	{
1979 1979
 		$lst_countries = '';
@@ -2011,12 +2011,12 @@  discard block
 block discarded – undo
2011 2011
 	}
2012 2012
 	
2013 2013
 	/**
2014
-	* Gets airports info based on the coord
2015
-	*
2016
-	* @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
2017
-	* @return Array airport information
2018
-	*
2019
-	*/
2014
+	 * Gets airports info based on the coord
2015
+	 *
2016
+	 * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
2017
+	 * @return Array airport information
2018
+	 *
2019
+	 */
2020 2020
 	public function getAllAirportInfobyCoord($coord)
2021 2021
 	{
2022 2022
 		global $globalDBdriver;
@@ -2047,12 +2047,12 @@  discard block
 block discarded – undo
2047 2047
 	}
2048 2048
 
2049 2049
 	/**
2050
-	* Gets waypoints info based on the coord
2051
-	*
2052
-	* @param Array $coord waypoints coord
2053
-	* @return Array airport information
2054
-	*
2055
-	*/
2050
+	 * Gets waypoints info based on the coord
2051
+	 *
2052
+	 * @param Array $coord waypoints coord
2053
+	 * @return Array airport information
2054
+	 *
2055
+	 */
2056 2056
 	public function getAllWaypointsInfobyCoord($coord)
2057 2057
 	{
2058 2058
 		if (is_array($coord)) {
@@ -2086,12 +2086,12 @@  discard block
 block discarded – undo
2086 2086
 	
2087 2087
 	
2088 2088
 	/**
2089
-	* Gets the airline info based on the icao code or iata code
2090
-	*
2091
-	* @param String $airline_icao the iata code of the airport
2092
-	* @return Array airport information
2093
-	*
2094
-	*/
2089
+	 * Gets the airline info based on the icao code or iata code
2090
+	 *
2091
+	 * @param String $airline_icao the iata code of the airport
2092
+	 * @return Array airport information
2093
+	 *
2094
+	 */
2095 2095
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2096 2096
 	{
2097 2097
 		global $globalUseRealAirlines;
@@ -2122,7 +2122,7 @@  discard block
 block discarded – undo
2122 2122
 			} else {
2123 2123
 				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2124 2124
 			}
2125
-                        /*
2125
+						/*
2126 2126
 			$airline_array = array();
2127 2127
 			$temp_array = array();
2128 2128
 		
@@ -2152,12 +2152,12 @@  discard block
 block discarded – undo
2152 2152
 	}
2153 2153
 	
2154 2154
 	/**
2155
-	* Gets the airline info based on the airline name
2156
-	*
2157
-	* @param String $airline_name the name of the airline
2158
-	* @return Array airline information
2159
-	*
2160
-	*/
2155
+	 * Gets the airline info based on the airline name
2156
+	 *
2157
+	 * @param String $airline_name the name of the airline
2158
+	 * @return Array airline information
2159
+	 *
2160
+	 */
2161 2161
 	public function getAllAirlineInfoByName($airline_name, $fromsource = NULL)
2162 2162
 	{
2163 2163
 		global $globalUseRealAirlines;
@@ -2185,12 +2185,12 @@  discard block
 block discarded – undo
2185 2185
 	
2186 2186
 	
2187 2187
 	/**
2188
-	* Gets the aircraft info based on the aircraft type
2189
-	*
2190
-	* @param String $aircraft_type the aircraft type
2191
-	* @return Array aircraft information
2192
-	*
2193
-	*/
2188
+	 * Gets the aircraft info based on the aircraft type
2189
+	 *
2190
+	 * @param String $aircraft_type the aircraft type
2191
+	 * @return Array aircraft information
2192
+	 *
2193
+	 */
2194 2194
 	public function getAllAircraftInfo($aircraft_type)
2195 2195
 	{
2196 2196
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2222,12 +2222,12 @@  discard block
 block discarded – undo
2222 2222
 	}
2223 2223
 
2224 2224
 	/**
2225
-	* Gets the aircraft icao based on the aircraft name/type
2226
-	*
2227
-	* @param String $aircraft_type the aircraft type
2228
-	* @return String aircraft information
2229
-	*
2230
-	*/
2225
+	 * Gets the aircraft icao based on the aircraft name/type
2226
+	 *
2227
+	 * @param String $aircraft_type the aircraft type
2228
+	 * @return String aircraft information
2229
+	 *
2230
+	 */
2231 2231
 	public function getAircraftIcao($aircraft_type)
2232 2232
 	{
2233 2233
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2252,12 +2252,12 @@  discard block
 block discarded – undo
2252 2252
 	}
2253 2253
 	
2254 2254
 	/**
2255
-	* Gets the aircraft info based on the aircraft modes
2256
-	*
2257
-	* @param String $aircraft_modes the aircraft ident (hex)
2258
-	* @return String aircraft type
2259
-	*
2260
-	*/
2255
+	 * Gets the aircraft info based on the aircraft modes
2256
+	 *
2257
+	 * @param String $aircraft_modes the aircraft ident (hex)
2258
+	 * @return String aircraft type
2259
+	 *
2260
+	 */
2261 2261
 	public function getAllAircraftType($aircraft_modes)
2262 2262
 	{
2263 2263
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -2277,12 +2277,12 @@  discard block
 block discarded – undo
2277 2277
 	}
2278 2278
 
2279 2279
 	/**
2280
-	* Gets the aircraft info based on the aircraft registration
2281
-	*
2282
-	* @param String $registration the aircraft registration
2283
-	* @return String aircraft type
2284
-	*
2285
-	*/
2280
+	 * Gets the aircraft info based on the aircraft registration
2281
+	 *
2282
+	 * @param String $registration the aircraft registration
2283
+	 * @return String aircraft type
2284
+	 *
2285
+	 */
2286 2286
 	public function getAllAircraftTypeByRegistration($registration)
2287 2287
 	{
2288 2288
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2300,12 +2300,12 @@  discard block
 block discarded – undo
2300 2300
 	}
2301 2301
 
2302 2302
 	/**
2303
-	* Gets the spotter_id and flightaware_id based on the aircraft registration
2304
-	*
2305
-	* @param String $registration the aircraft registration
2306
-	* @return Array spotter_id and flightaware_id
2307
-	*
2308
-	*/
2303
+	 * Gets the spotter_id and flightaware_id based on the aircraft registration
2304
+	 *
2305
+	 * @param String $registration the aircraft registration
2306
+	 * @return Array spotter_id and flightaware_id
2307
+	 *
2308
+	 */
2309 2309
 	public function getAllIDByRegistration($registration)
2310 2310
 	{
2311 2311
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2324,12 +2324,12 @@  discard block
 block discarded – undo
2324 2324
 	}
2325 2325
 
2326 2326
 	/**
2327
-	* Gets correct aircraft operator code
2328
-	*
2329
-	* @param String $operator the aircraft operator code (callsign)
2330
-	* @return String aircraft operator code
2331
-	*
2332
-	*/
2327
+	 * Gets correct aircraft operator code
2328
+	 *
2329
+	 * @param String $operator the aircraft operator code (callsign)
2330
+	 * @return String aircraft operator code
2331
+	 *
2332
+	 */
2333 2333
 	public function getOperator($operator)
2334 2334
 	{
2335 2335
 		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
@@ -2346,16 +2346,16 @@  discard block
 block discarded – undo
2346 2346
 	}
2347 2347
 
2348 2348
 	/**
2349
-	* Gets the aircraft route based on the aircraft callsign
2350
-	*
2351
-	* @param String $callsign the aircraft callsign
2352
-	* @return Array aircraft type
2353
-	*
2354
-	*/
2349
+	 * Gets the aircraft route based on the aircraft callsign
2350
+	 *
2351
+	 * @param String $callsign the aircraft callsign
2352
+	 * @return Array aircraft type
2353
+	 *
2354
+	 */
2355 2355
 	public function getRouteInfo($callsign)
2356 2356
 	{
2357 2357
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2358
-                if ($callsign == '') return array();
2358
+				if ($callsign == '') return array();
2359 2359
 		$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";
2360 2360
 		
2361 2361
 		$sth = $this->db->prepare($query);
@@ -2369,12 +2369,12 @@  discard block
 block discarded – undo
2369 2369
 	}
2370 2370
 	
2371 2371
 	/**
2372
-	* Gets the aircraft info based on the aircraft registration
2373
-	*
2374
-	* @param String $registration the aircraft registration
2375
-	* @return Array aircraft information
2376
-	*
2377
-	*/
2372
+	 * Gets the aircraft info based on the aircraft registration
2373
+	 *
2374
+	 * @param String $registration the aircraft registration
2375
+	 * @return Array aircraft information
2376
+	 *
2377
+	 */
2378 2378
 	public function getAircraftInfoByRegistration($registration)
2379 2379
 	{
2380 2380
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2401,12 +2401,12 @@  discard block
 block discarded – undo
2401 2401
 	}
2402 2402
 	
2403 2403
 	/**
2404
-	* Gets the aircraft owner & base based on the aircraft registration
2405
-	*
2406
-	* @param String $registration the aircraft registration
2407
-	* @return Array aircraft information
2408
-	*
2409
-	*/
2404
+	 * Gets the aircraft owner & base based on the aircraft registration
2405
+	 *
2406
+	 * @param String $registration the aircraft registration
2407
+	 * @return Array aircraft information
2408
+	 *
2409
+	 */
2410 2410
 	public function getAircraftOwnerByRegistration($registration)
2411 2411
 	{
2412 2412
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2423,11 +2423,11 @@  discard block
 block discarded – undo
2423 2423
 	
2424 2424
   
2425 2425
   /**
2426
-	* Gets all flights (but with only little info)
2427
-	*
2428
-	* @return Array basic flight information
2429
-	*
2430
-	*/
2426
+   * Gets all flights (but with only little info)
2427
+   *
2428
+   * @return Array basic flight information
2429
+   *
2430
+   */
2431 2431
 	public function getAllFlightsforSitemap()
2432 2432
 	{
2433 2433
 		//$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 ";
@@ -2435,7 +2435,7 @@  discard block
 block discarded – undo
2435 2435
 		
2436 2436
 		$sth = $this->db->prepare($query);
2437 2437
 		$sth->execute();
2438
-                  /*
2438
+				  /*
2439 2439
 		$flight_array = array();
2440 2440
 		$temp_array = array();
2441 2441
 		
@@ -2457,11 +2457,11 @@  discard block
 block discarded – undo
2457 2457
 	}
2458 2458
   
2459 2459
 	/**
2460
-	* Gets a list of all aircraft manufacturers
2461
-	*
2462
-	* @return Array list of aircraft types
2463
-	*
2464
-	*/
2460
+	 * Gets a list of all aircraft manufacturers
2461
+	 *
2462
+	 * @return Array list of aircraft types
2463
+	 *
2464
+	 */
2465 2465
 	public function getAllManufacturers()
2466 2466
 	{
2467 2467
 		/*
@@ -2490,11 +2490,11 @@  discard block
 block discarded – undo
2490 2490
   
2491 2491
   
2492 2492
   /**
2493
-	* Gets a list of all aircraft types
2494
-	*
2495
-	* @return Array list of aircraft types
2496
-	*
2497
-	*/
2493
+   * Gets a list of all aircraft types
2494
+   *
2495
+   * @return Array list of aircraft types
2496
+   *
2497
+   */
2498 2498
 	public function getAllAircraftTypes($filters = array())
2499 2499
 	{
2500 2500
 		/*
@@ -2529,11 +2529,11 @@  discard block
 block discarded – undo
2529 2529
 	
2530 2530
 	
2531 2531
 	/**
2532
-	* Gets a list of all aircraft registrations
2533
-	*
2534
-	* @return Array list of aircraft registrations
2535
-	*
2536
-	*/
2532
+	 * Gets a list of all aircraft registrations
2533
+	 *
2534
+	 * @return Array list of aircraft registrations
2535
+	 *
2536
+	 */
2537 2537
 	public function getAllAircraftRegistrations($filters = array())
2538 2538
 	{
2539 2539
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2558,12 +2558,12 @@  discard block
 block discarded – undo
2558 2558
 	}
2559 2559
 
2560 2560
 	/**
2561
-	* Gets all source name
2562
-	*
2563
-	* @param String type format of source
2564
-	* @return Array list of source name
2565
-	*
2566
-	*/
2561
+	 * Gets all source name
2562
+	 *
2563
+	 * @param String type format of source
2564
+	 * @return Array list of source name
2565
+	 *
2566
+	 */
2567 2567
 	public function getAllSourceName($type = '',$filters = array())
2568 2568
 	{
2569 2569
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2594,11 +2594,11 @@  discard block
 block discarded – undo
2594 2594
 
2595 2595
 
2596 2596
 	/**
2597
-	* Gets a list of all airline names
2598
-	*
2599
-	* @return Array list of airline names
2600
-	*
2601
-	*/
2597
+	 * Gets a list of all airline names
2598
+	 *
2599
+	 * @return Array list of airline names
2600
+	 *
2601
+	 */
2602 2602
 	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2603 2603
 	{
2604 2604
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2647,11 +2647,11 @@  discard block
 block discarded – undo
2647 2647
 	}
2648 2648
 	
2649 2649
 	/**
2650
-	* Gets a list of all alliance names
2651
-	*
2652
-	* @return Array list of alliance names
2653
-	*
2654
-	*/
2650
+	 * Gets a list of all alliance names
2651
+	 *
2652
+	 * @return Array list of alliance names
2653
+	 *
2654
+	 */
2655 2655
 	public function getAllAllianceNames($forsource = NULL,$filters = array())
2656 2656
 	{
2657 2657
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2676,11 +2676,11 @@  discard block
 block discarded – undo
2676 2676
 	}
2677 2677
 	
2678 2678
 	/**
2679
-	* Gets a list of all airline countries
2680
-	*
2681
-	* @return Array list of airline countries
2682
-	*
2683
-	*/
2679
+	 * Gets a list of all airline countries
2680
+	 *
2681
+	 * @return Array list of airline countries
2682
+	 *
2683
+	 */
2684 2684
 	public function getAllAirlineCountries($filters = array())
2685 2685
 	{
2686 2686
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2708,11 +2708,11 @@  discard block
 block discarded – undo
2708 2708
 	
2709 2709
 	
2710 2710
 	/**
2711
-	* Gets a list of all departure & arrival names
2712
-	*
2713
-	* @return Array list of airport names
2714
-	*
2715
-	*/
2711
+	 * Gets a list of all departure & arrival names
2712
+	 *
2713
+	 * @return Array list of airport names
2714
+	 *
2715
+	 */
2716 2716
 	public function getAllAirportNames($filters = array())
2717 2717
 	{
2718 2718
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2761,11 +2761,11 @@  discard block
 block discarded – undo
2761 2761
 	
2762 2762
 	
2763 2763
 	/**
2764
-	* Gets a list of all departure & arrival airport countries
2765
-	*
2766
-	* @return Array list of airport countries
2767
-	*
2768
-	*/
2764
+	 * Gets a list of all departure & arrival airport countries
2765
+	 *
2766
+	 * @return Array list of airport countries
2767
+	 *
2768
+	 */
2769 2769
 	public function getAllAirportCountries($filters = array())
2770 2770
 	{
2771 2771
 		$airport_array = array();
@@ -2813,11 +2813,11 @@  discard block
 block discarded – undo
2813 2813
 	
2814 2814
 	
2815 2815
 	/**
2816
-	* Gets a list of all countries (airline, departure airport & arrival airport)
2817
-	*
2818
-	* @return Array list of countries
2819
-	*
2820
-	*/
2816
+	 * Gets a list of all countries (airline, departure airport & arrival airport)
2817
+	 *
2818
+	 * @return Array list of countries
2819
+	 *
2820
+	 */
2821 2821
 	public function getAllCountries($filters = array())
2822 2822
 	{
2823 2823
 		$Connection= new Connection($this->db);
@@ -2894,11 +2894,11 @@  discard block
 block discarded – undo
2894 2894
 	
2895 2895
 	
2896 2896
 	/**
2897
-	* Gets a list of all idents/callsigns
2898
-	*
2899
-	* @return Array list of ident/callsign names
2900
-	*
2901
-	*/
2897
+	 * Gets a list of all idents/callsigns
2898
+	 *
2899
+	 * @return Array list of ident/callsign names
2900
+	 *
2901
+	 */
2902 2902
 	public function getAllIdents($filters = array())
2903 2903
 	{
2904 2904
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2922,9 +2922,9 @@  discard block
 block discarded – undo
2922 2922
 	}
2923 2923
 
2924 2924
 	/**
2925
-	* Get a list of flights from airport since 7 days
2926
-	* @return Array number, icao, name and city of airports
2927
-	*/
2925
+	 * Get a list of flights from airport since 7 days
2926
+	 * @return Array number, icao, name and city of airports
2927
+	 */
2928 2928
 
2929 2929
 	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
2930 2930
 		global $globalTimezone, $globalDBdriver;
@@ -2955,9 +2955,9 @@  discard block
 block discarded – undo
2955 2955
 	}
2956 2956
 
2957 2957
 	/**
2958
-	* Get a list of flights from airport since 7 days
2959
-	* @return Array number, icao, name and city of airports
2960
-	*/
2958
+	 * Get a list of flights from airport since 7 days
2959
+	 * @return Array number, icao, name and city of airports
2960
+	 */
2961 2961
 
2962 2962
 	public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') {
2963 2963
 		global $globalTimezone, $globalDBdriver;
@@ -2987,9 +2987,9 @@  discard block
 block discarded – undo
2987 2987
 	}
2988 2988
 
2989 2989
 	/**
2990
-	* Get a list of flights from detected airport since 7 days
2991
-	* @return Array number, icao, name and city of airports
2992
-	*/
2990
+	 * Get a list of flights from detected airport since 7 days
2991
+	 * @return Array number, icao, name and city of airports
2992
+	 */
2993 2993
 
2994 2994
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
2995 2995
 		global $globalTimezone, $globalDBdriver;
@@ -3027,9 +3027,9 @@  discard block
 block discarded – undo
3027 3027
 	}
3028 3028
 
3029 3029
 	/**
3030
-	* Get a list of flights from detected airport since 7 days
3031
-	* @return Array number, icao, name and city of airports
3032
-	*/
3030
+	 * Get a list of flights from detected airport since 7 days
3031
+	 * @return Array number, icao, name and city of airports
3032
+	 */
3033 3033
 
3034 3034
 	public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') {
3035 3035
 		global $globalTimezone, $globalDBdriver;
@@ -3071,9 +3071,9 @@  discard block
 block discarded – undo
3071 3071
 
3072 3072
 
3073 3073
 	/**
3074
-	* Get a list of flights to airport since 7 days
3075
-	* @return Array number, icao, name and city of airports
3076
-	*/
3074
+	 * Get a list of flights to airport since 7 days
3075
+	 * @return Array number, icao, name and city of airports
3076
+	 */
3077 3077
 
3078 3078
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
3079 3079
 		global $globalTimezone, $globalDBdriver;
@@ -3106,9 +3106,9 @@  discard block
 block discarded – undo
3106 3106
 
3107 3107
 
3108 3108
 	/**
3109
-	* Get a list of flights detected to airport since 7 days
3110
-	* @return Array number, icao, name and city of airports
3111
-	*/
3109
+	 * Get a list of flights detected to airport since 7 days
3110
+	 * @return Array number, icao, name and city of airports
3111
+	 */
3112 3112
 
3113 3113
 	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3114 3114
 		global $globalTimezone, $globalDBdriver;
@@ -3149,9 +3149,9 @@  discard block
 block discarded – undo
3149 3149
 
3150 3150
 
3151 3151
 	/**
3152
-	* Get a list of flights to airport since 7 days
3153
-	* @return Array number, icao, name and city of airports
3154
-	*/
3152
+	 * Get a list of flights to airport since 7 days
3153
+	 * @return Array number, icao, name and city of airports
3154
+	 */
3155 3155
 
3156 3156
 	public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') {
3157 3157
 		global $globalTimezone, $globalDBdriver;
@@ -3183,9 +3183,9 @@  discard block
 block discarded – undo
3183 3183
 
3184 3184
 
3185 3185
 	/**
3186
-	* Get a list of flights detected to airport since 7 days
3187
-	* @return Array number, icao, name and city of airports
3188
-	*/
3186
+	 * Get a list of flights detected to airport since 7 days
3187
+	 * @return Array number, icao, name and city of airports
3188
+	 */
3189 3189
 
3190 3190
 	public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') {
3191 3191
 		global $globalTimezone, $globalDBdriver;
@@ -3229,11 +3229,11 @@  discard block
 block discarded – undo
3229 3229
 
3230 3230
 
3231 3231
 	/**
3232
-	* Gets a list of all dates
3233
-	*
3234
-	* @return Array list of date names
3235
-	*
3236
-	*/
3232
+	 * Gets a list of all dates
3233
+	 *
3234
+	 * @return Array list of date names
3235
+	 *
3236
+	 */
3237 3237
 	public function getAllDates()
3238 3238
 	{
3239 3239
 		global $globalTimezone, $globalDBdriver;
@@ -3274,11 +3274,11 @@  discard block
 block discarded – undo
3274 3274
 	
3275 3275
 	
3276 3276
 	/**
3277
-	* Gets all route combinations
3278
-	*
3279
-	* @return Array the route list
3280
-	*
3281
-	*/
3277
+	 * Gets all route combinations
3278
+	 *
3279
+	 * @return Array the route list
3280
+	 *
3281
+	 */
3282 3282
 	public function getAllRoutes()
3283 3283
 	{
3284 3284
 		$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 
@@ -3304,13 +3304,13 @@  discard block
 block discarded – undo
3304 3304
 	}
3305 3305
 
3306 3306
 	/**
3307
-	* Update ident spotter data
3308
-	*
3309
-	* @param String $flightaware_id the ID from flightaware
3310
-	* @param String $ident the flight ident
3311
-	* @return String success or false
3312
-	*
3313
-	*/	
3307
+	 * Update ident spotter data
3308
+	 *
3309
+	 * @param String $flightaware_id the ID from flightaware
3310
+	 * @param String $ident the flight ident
3311
+	 * @return String success or false
3312
+	 *
3313
+	 */	
3314 3314
 	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3315 3315
 	{
3316 3316
 		if (!is_numeric(substr($ident, 0, 3)))
@@ -3331,14 +3331,14 @@  discard block
 block discarded – undo
3331 3331
 		} else {
3332 3332
 			$airline_array = $this->getAllAirlineInfo("NA");
3333 3333
 		}
3334
-                $airline_name = $airline_array[0]['name'];
3335
-                $airline_icao = $airline_array[0]['icao'];
3336
-                $airline_country = $airline_array[0]['country'];
3337
-                $airline_type = $airline_array[0]['type'];
3334
+				$airline_name = $airline_array[0]['name'];
3335
+				$airline_icao = $airline_array[0]['icao'];
3336
+				$airline_country = $airline_array[0]['country'];
3337
+				$airline_type = $airline_array[0]['type'];
3338 3338
 
3339 3339
 
3340 3340
 		$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';
3341
-                $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);
3341
+				$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);
3342 3342
 
3343 3343
 		try {
3344 3344
 			$sth = $this->db->prepare($query);
@@ -3351,19 +3351,19 @@  discard block
 block discarded – undo
3351 3351
 
3352 3352
 	}
3353 3353
 	/**
3354
-	* Update latest spotter data
3355
-	*
3356
-	* @param String $flightaware_id the ID from flightaware
3357
-	* @param String $ident the flight ident
3358
-	* @param String $arrival_airport_icao the arrival airport
3359
-	* @return String success or false
3360
-	*
3361
-	*/	
3354
+	 * Update latest spotter data
3355
+	 *
3356
+	 * @param String $flightaware_id the ID from flightaware
3357
+	 * @param String $ident the flight ident
3358
+	 * @param String $arrival_airport_icao the arrival airport
3359
+	 * @return String success or false
3360
+	 *
3361
+	 */	
3362 3362
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3363 3363
 	{
3364 3364
 		if ($groundspeed == '') $groundspeed = NULL;
3365 3365
 		$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';
3366
-                $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);
3366
+				$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);
3367 3367
 
3368 3368
 		try {
3369 3369
 			$sth = $this->db->prepare($query);
@@ -3377,32 +3377,32 @@  discard block
 block discarded – undo
3377 3377
 	}
3378 3378
 
3379 3379
 	/**
3380
-	* Adds a new spotter data
3381
-	*
3382
-	* @param String $flightaware_id the ID from flightaware
3383
-	* @param String $ident the flight ident
3384
-	* @param String $aircraft_icao the aircraft type
3385
-	* @param String $departure_airport_icao the departure airport
3386
-	* @param String $arrival_airport_icao the arrival airport
3387
-	* @param String $latitude latitude of flight
3388
-	* @param String $longitude latitude of flight
3389
-	* @param String $waypoints waypoints of flight
3390
-	* @param String $altitude altitude of flight
3391
-	* @param String $heading heading of flight
3392
-	* @param String $groundspeed speed of flight
3393
-	* @param String $date date of flight
3394
-	* @param String $departure_airport_time departure time of flight
3395
-	* @param String $arrival_airport_time arrival time of flight
3396
-	* @param String $squawk squawk code of flight
3397
-	* @param String $route_stop route stop of flight
3398
-	* @param String $highlight highlight or not
3399
-	* @param String $ModeS ModesS code of flight
3400
-	* @param String $registration registration code of flight
3401
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
3402
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
3403
-	* @param String $verticalrate vertival rate of flight
3404
-	* @return String success or false
3405
-	*/
3380
+	 * Adds a new spotter data
3381
+	 *
3382
+	 * @param String $flightaware_id the ID from flightaware
3383
+	 * @param String $ident the flight ident
3384
+	 * @param String $aircraft_icao the aircraft type
3385
+	 * @param String $departure_airport_icao the departure airport
3386
+	 * @param String $arrival_airport_icao the arrival airport
3387
+	 * @param String $latitude latitude of flight
3388
+	 * @param String $longitude latitude of flight
3389
+	 * @param String $waypoints waypoints of flight
3390
+	 * @param String $altitude altitude of flight
3391
+	 * @param String $heading heading of flight
3392
+	 * @param String $groundspeed speed of flight
3393
+	 * @param String $date date of flight
3394
+	 * @param String $departure_airport_time departure time of flight
3395
+	 * @param String $arrival_airport_time arrival time of flight
3396
+	 * @param String $squawk squawk code of flight
3397
+	 * @param String $route_stop route stop of flight
3398
+	 * @param String $highlight highlight or not
3399
+	 * @param String $ModeS ModesS code of flight
3400
+	 * @param String $registration registration code of flight
3401
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
3402
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
3403
+	 * @param String $verticalrate vertival rate of flight
3404
+	 * @return String success or false
3405
+	 */
3406 3406
 	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 = '')
3407 3407
 	{
3408 3408
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
@@ -3617,8 +3617,8 @@  discard block
 block discarded – undo
3617 3617
     
3618 3618
 		if ($globalIVAO && $aircraft_icao != '')
3619 3619
 		{
3620
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3621
-            		else $airline_icao = '';
3620
+					if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3621
+					else $airline_icao = '';
3622 3622
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3623 3623
 			if (!isset($image_array[0]['registration']))
3624 3624
 			{
@@ -3649,53 +3649,53 @@  discard block
 block discarded – undo
3649 3649
 	
3650 3650
 		if (count($airline_array) == 0) 
3651 3651
 		{
3652
-                        $airline_array = $this->getAllAirlineInfo('NA');
3653
-                }
3654
-                if (count($aircraft_array) == 0) 
3655
-                {
3656
-                        $aircraft_array = $this->getAllAircraftInfo('NA');
3657
-                }
3658
-                if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3659
-                {
3660
-                        $departure_airport_array = $this->getAllAirportInfo('NA');
3661
-                }
3662
-                if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3663
-                {
3664
-                        $arrival_airport_array = $this->getAllAirportInfo('NA');
3665
-                }
3666
-                if ($registration == '') $registration = 'NA';
3667
-                if ($latitude == '' && $longitude == '') {
3668
-            		$latitude = 0;
3669
-            		$longitude = 0;
3670
-            	}
3671
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3672
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3673
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3674
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3675
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3676
-                $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) 
3652
+						$airline_array = $this->getAllAirlineInfo('NA');
3653
+				}
3654
+				if (count($aircraft_array) == 0) 
3655
+				{
3656
+						$aircraft_array = $this->getAllAircraftInfo('NA');
3657
+				}
3658
+				if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3659
+				{
3660
+						$departure_airport_array = $this->getAllAirportInfo('NA');
3661
+				}
3662
+				if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3663
+				{
3664
+						$arrival_airport_array = $this->getAllAirportInfo('NA');
3665
+				}
3666
+				if ($registration == '') $registration = 'NA';
3667
+				if ($latitude == '' && $longitude == '') {
3668
+					$latitude = 0;
3669
+					$longitude = 0;
3670
+				}
3671
+				if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3672
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3673
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3674
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3675
+				if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3676
+				$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) 
3677 3677
                 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)";
3678 3678
 
3679
-                $airline_name = $airline_array[0]['name'];
3680
-                $airline_icao = $airline_array[0]['icao'];
3681
-                $airline_country = $airline_array[0]['country'];
3682
-                $airline_type = $airline_array[0]['type'];
3679
+				$airline_name = $airline_array[0]['name'];
3680
+				$airline_icao = $airline_array[0]['icao'];
3681
+				$airline_country = $airline_array[0]['country'];
3682
+				$airline_type = $airline_array[0]['type'];
3683 3683
 		if ($airline_type == '') {
3684 3684
 			$timeelapsed = microtime(true);
3685 3685
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3686 3686
 			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3687 3687
 		}
3688 3688
 		if ($airline_type == null) $airline_type = '';
3689
-                $aircraft_type = $aircraft_array[0]['type'];
3690
-                $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3691
-                $departure_airport_name = $departure_airport_array[0]['name'];
3692
-	        $departure_airport_city = $departure_airport_array[0]['city'];
3693
-            	$departure_airport_country = $departure_airport_array[0]['country'];
3689
+				$aircraft_type = $aircraft_array[0]['type'];
3690
+				$aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3691
+				$departure_airport_name = $departure_airport_array[0]['name'];
3692
+			$departure_airport_city = $departure_airport_array[0]['city'];
3693
+				$departure_airport_country = $departure_airport_array[0]['country'];
3694 3694
                 
3695
-                $arrival_airport_name = $arrival_airport_array[0]['name'];
3696
-                $arrival_airport_city = $arrival_airport_array[0]['city'];
3697
-                $arrival_airport_country = $arrival_airport_array[0]['country'];
3698
-                $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);
3695
+				$arrival_airport_name = $arrival_airport_array[0]['name'];
3696
+				$arrival_airport_city = $arrival_airport_array[0]['city'];
3697
+				$arrival_airport_country = $arrival_airport_array[0]['country'];
3698
+				$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);
3699 3699
 
3700 3700
 		try {
3701 3701
 		        
@@ -3703,7 +3703,7 @@  discard block
 block discarded – undo
3703 3703
 			$sth->execute($query_values);
3704 3704
 			$this->db = null;
3705 3705
 		} catch (PDOException $e) {
3706
-		    return "error : ".$e->getMessage();
3706
+			return "error : ".$e->getMessage();
3707 3707
 		}
3708 3708
 		
3709 3709
 		return "success";
@@ -3712,11 +3712,11 @@  discard block
 block discarded – undo
3712 3712
 	
3713 3713
   
3714 3714
 	/**
3715
-	* Gets the aircraft ident within the last hour
3716
-	*
3717
-	* @return String the ident
3718
-	*
3719
-	*/
3715
+	 * Gets the aircraft ident within the last hour
3716
+	 *
3717
+	 * @return String the ident
3718
+	 *
3719
+	 */
3720 3720
 	public function getIdentFromLastHour($ident)
3721 3721
 	{
3722 3722
 		global $globalDBdriver, $globalTimezone;
@@ -3732,11 +3732,11 @@  discard block
 block discarded – undo
3732 3732
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3733 3733
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
3734 3734
 			$query_data = array(':ident' => $ident);
3735
-    		}
3735
+			}
3736 3736
 		
3737 3737
 		$sth = $this->db->prepare($query);
3738 3738
 		$sth->execute($query_data);
3739
-    		$ident_result='';
3739
+			$ident_result='';
3740 3740
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3741 3741
 		{
3742 3742
 			$ident_result = $row['ident'];
@@ -3747,11 +3747,11 @@  discard block
 block discarded – undo
3747 3747
 	
3748 3748
 	
3749 3749
 	/**
3750
-	* Gets the aircraft data from the last 20 seconds
3751
-	*
3752
-	* @return Array the spotter data
3753
-	*
3754
-	*/
3750
+	 * Gets the aircraft data from the last 20 seconds
3751
+	 *
3752
+	 * @return Array the spotter data
3753
+	 *
3754
+	 */
3755 3755
 	public function getRealTimeData($q = '')
3756 3756
 	{
3757 3757
 		global $globalDBdriver;
@@ -3795,11 +3795,11 @@  discard block
 block discarded – undo
3795 3795
 	
3796 3796
 	
3797 3797
 	 /**
3798
-	* Gets all airlines that have flown over
3799
-	*
3800
-	* @return Array the airline list
3801
-	*
3802
-	*/
3798
+	  * Gets all airlines that have flown over
3799
+	  *
3800
+	  * @return Array the airline list
3801
+	  *
3802
+	  */
3803 3803
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3804 3804
 	{
3805 3805
 		global $globalDBdriver;
@@ -3813,7 +3813,7 @@  discard block
 block discarded – undo
3813 3813
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3814 3814
 			}
3815 3815
 		}
3816
-                if ($sincedate != '') {
3816
+				if ($sincedate != '') {
3817 3817
 			if ($globalDBdriver == 'mysql') {
3818 3818
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3819 3819
 			} else {
@@ -3840,26 +3840,26 @@  discard block
 block discarded – undo
3840 3840
 	}
3841 3841
 
3842 3842
 	 /**
3843
-	* Gets all pilots that have flown over
3844
-	*
3845
-	* @return Array the pilots list
3846
-	*
3847
-	*/
3843
+	  * Gets all pilots that have flown over
3844
+	  *
3845
+	  * @return Array the pilots list
3846
+	  *
3847
+	  */
3848 3848
 	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3849 3849
 	{
3850 3850
 		global $globalDBdriver;
3851 3851
 		$filter_query = $this->getFilter($filters,true,true);
3852 3852
 		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3853 3853
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3854
-                if ($olderthanmonths > 0) {
3855
-            		if ($globalDBdriver == 'mysql') {
3854
+				if ($olderthanmonths > 0) {
3855
+					if ($globalDBdriver == 'mysql') {
3856 3856
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3857 3857
 			} else {
3858 3858
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3859 3859
 			}
3860 3860
 		}
3861
-                if ($sincedate != '') {
3862
-            		if ($globalDBdriver == 'mysql') {
3861
+				if ($sincedate != '') {
3862
+					if ($globalDBdriver == 'mysql') {
3863 3863
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3864 3864
 			} else {
3865 3865
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3887,25 +3887,25 @@  discard block
 block discarded – undo
3887 3887
 	}
3888 3888
 	
3889 3889
 		 /**
3890
-	* Gets all pilots that have flown over
3891
-	*
3892
-	* @return Array the pilots list
3893
-	*
3894
-	*/
3890
+		  * Gets all pilots that have flown over
3891
+		  *
3892
+		  * @return Array the pilots list
3893
+		  *
3894
+		  */
3895 3895
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3896 3896
 	{
3897 3897
 		global $globalDBdriver;
3898 3898
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3899 3899
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
3900
-                if ($olderthanmonths > 0) {
3901
-            		if ($globalDBdriver == 'mysql') {
3900
+				if ($olderthanmonths > 0) {
3901
+					if ($globalDBdriver == 'mysql') {
3902 3902
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3903 3903
 			} else {
3904 3904
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3905 3905
 			}
3906 3906
 		}
3907
-                if ($sincedate != '') {
3908
-            		if ($globalDBdriver == 'mysql') {
3907
+				if ($sincedate != '') {
3908
+					if ($globalDBdriver == 'mysql') {
3909 3909
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3910 3910
 			} else {
3911 3911
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3934,26 +3934,26 @@  discard block
 block discarded – undo
3934 3934
 	}
3935 3935
 	
3936 3936
 	 /**
3937
-	* Gets all owner that have flown over
3938
-	*
3939
-	* @return Array the pilots list
3940
-	*
3941
-	*/
3937
+	  * Gets all owner that have flown over
3938
+	  *
3939
+	  * @return Array the pilots list
3940
+	  *
3941
+	  */
3942 3942
 	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3943 3943
 	{
3944 3944
 		global $globalDBdriver;
3945 3945
 		$filter_query = $this->getFilter($filters,true,true);
3946 3946
 		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3947 3947
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3948
-                if ($olderthanmonths > 0) {
3949
-            		if ($globalDBdriver == 'mysql') {
3948
+				if ($olderthanmonths > 0) {
3949
+					if ($globalDBdriver == 'mysql') {
3950 3950
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3951 3951
 			} else {
3952 3952
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3953 3953
 			}
3954 3954
 		}
3955
-                if ($sincedate != '') {
3956
-            		if ($globalDBdriver == 'mysql') {
3955
+				if ($sincedate != '') {
3956
+					if ($globalDBdriver == 'mysql') {
3957 3957
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3958 3958
 			} else {
3959 3959
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3979,26 +3979,26 @@  discard block
 block discarded – undo
3979 3979
 	}
3980 3980
 	
3981 3981
 	 /**
3982
-	* Gets all owner that have flown over
3983
-	*
3984
-	* @return Array the pilots list
3985
-	*
3986
-	*/
3982
+	  * Gets all owner that have flown over
3983
+	  *
3984
+	  * @return Array the pilots list
3985
+	  *
3986
+	  */
3987 3987
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3988 3988
 	{
3989 3989
 		global $globalDBdriver;
3990 3990
 		$filter_query = $this->getFilter($filters,true,true);
3991 3991
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3992 3992
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3993
-                if ($olderthanmonths > 0) {
3994
-            		if ($globalDBdriver == 'mysql') {
3993
+				if ($olderthanmonths > 0) {
3994
+					if ($globalDBdriver == 'mysql') {
3995 3995
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3996 3996
 			} else {
3997 3997
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3998 3998
 			}
3999 3999
 		}
4000
-                if ($sincedate != '') {
4001
-            		if ($globalDBdriver == 'mysql') {
4000
+				if ($sincedate != '') {
4001
+					if ($globalDBdriver == 'mysql') {
4002 4002
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
4003 4003
 			} else {
4004 4004
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4025,11 +4025,11 @@  discard block
 block discarded – undo
4025 4025
 	}
4026 4026
 
4027 4027
 	/**
4028
-	* Gets all airlines that have flown over by aircraft
4029
-	*
4030
-	* @return Array the airline list
4031
-	*
4032
-	*/
4028
+	 * Gets all airlines that have flown over by aircraft
4029
+	 *
4030
+	 * @return Array the airline list
4031
+	 *
4032
+	 */
4033 4033
 	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
4034 4034
 	{
4035 4035
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -4061,11 +4061,11 @@  discard block
 block discarded – undo
4061 4061
 
4062 4062
 
4063 4063
 	/**
4064
-	* Gets all airline countries that have flown over by aircraft
4065
-	*
4066
-	* @return Array the airline country list
4067
-	*
4068
-	*/
4064
+	 * Gets all airline countries that have flown over by aircraft
4065
+	 *
4066
+	 * @return Array the airline country list
4067
+	 *
4068
+	 */
4069 4069
 	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
4070 4070
 	{
4071 4071
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -4097,11 +4097,11 @@  discard block
 block discarded – undo
4097 4097
 	
4098 4098
 	
4099 4099
 	/**
4100
-	* Gets all airlines that have flown over by airport
4101
-	*
4102
-	* @return Array the airline list
4103
-	*
4104
-	*/
4100
+	 * Gets all airlines that have flown over by airport
4101
+	 *
4102
+	 * @return Array the airline list
4103
+	 *
4104
+	 */
4105 4105
 	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4106 4106
 	{
4107 4107
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4132,11 +4132,11 @@  discard block
 block discarded – undo
4132 4132
 
4133 4133
 
4134 4134
 	/**
4135
-	* Gets all airline countries that have flown over by airport icao
4136
-	*
4137
-	* @return Array the airline country list
4138
-	*
4139
-	*/
4135
+	 * Gets all airline countries that have flown over by airport icao
4136
+	 *
4137
+	 * @return Array the airline country list
4138
+	 *
4139
+	 */
4140 4140
 	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4141 4141
 	{
4142 4142
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4166,11 +4166,11 @@  discard block
 block discarded – undo
4166 4166
 
4167 4167
 
4168 4168
 	/**
4169
-	* Gets all airlines that have flown over by aircraft manufacturer
4170
-	*
4171
-	* @return Array the airline list
4172
-	*
4173
-	*/
4169
+	 * Gets all airlines that have flown over by aircraft manufacturer
4170
+	 *
4171
+	 * @return Array the airline list
4172
+	 *
4173
+	 */
4174 4174
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4175 4175
 	{
4176 4176
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4201,11 +4201,11 @@  discard block
 block discarded – undo
4201 4201
 
4202 4202
 
4203 4203
 	/**
4204
-	* Gets all airline countries that have flown over by aircraft manufacturer
4205
-	*
4206
-	* @return Array the airline country list
4207
-	*
4208
-	*/
4204
+	 * Gets all airline countries that have flown over by aircraft manufacturer
4205
+	 *
4206
+	 * @return Array the airline country list
4207
+	 *
4208
+	 */
4209 4209
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4210 4210
 	{
4211 4211
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4234,11 +4234,11 @@  discard block
 block discarded – undo
4234 4234
 
4235 4235
 
4236 4236
 	/**
4237
-	* Gets all airlines that have flown over by date
4238
-	*
4239
-	* @return Array the airline list
4240
-	*
4241
-	*/
4237
+	 * Gets all airlines that have flown over by date
4238
+	 *
4239
+	 * @return Array the airline list
4240
+	 *
4241
+	 */
4242 4242
 	public function countAllAirlinesByDate($date,$filters = array())
4243 4243
 	{
4244 4244
 		global $globalTimezone, $globalDBdriver;
@@ -4282,11 +4282,11 @@  discard block
 block discarded – undo
4282 4282
 	
4283 4283
 	
4284 4284
 	/**
4285
-	* Gets all airline countries that have flown over by date
4286
-	*
4287
-	* @return Array the airline country list
4288
-	*
4289
-	*/
4285
+	 * Gets all airline countries that have flown over by date
4286
+	 *
4287
+	 * @return Array the airline country list
4288
+	 *
4289
+	 */
4290 4290
 	public function countAllAirlineCountriesByDate($date,$filters = array())
4291 4291
 	{
4292 4292
 		global $globalTimezone, $globalDBdriver;
@@ -4329,11 +4329,11 @@  discard block
 block discarded – undo
4329 4329
 
4330 4330
 
4331 4331
 	/**
4332
-	* Gets all airlines that have flown over by ident/callsign
4333
-	*
4334
-	* @return Array the airline list
4335
-	*
4336
-	*/
4332
+	 * Gets all airlines that have flown over by ident/callsign
4333
+	 *
4334
+	 * @return Array the airline list
4335
+	 *
4336
+	 */
4337 4337
 	public function countAllAirlinesByIdent($ident,$filters = array())
4338 4338
 	{
4339 4339
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4363,11 +4363,11 @@  discard block
 block discarded – undo
4363 4363
 	}
4364 4364
 
4365 4365
 	/**
4366
-	* Gets all airlines that have flown over by route
4367
-	*
4368
-	* @return Array the airline list
4369
-	*
4370
-	*/
4366
+	 * Gets all airlines that have flown over by route
4367
+	 *
4368
+	 * @return Array the airline list
4369
+	 *
4370
+	 */
4371 4371
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4372 4372
 	{
4373 4373
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4399,11 +4399,11 @@  discard block
 block discarded – undo
4399 4399
 	}
4400 4400
 
4401 4401
 	/**
4402
-	* Gets all airline countries that have flown over by route
4403
-	*
4404
-	* @return Array the airline country list
4405
-	*
4406
-	*/
4402
+	 * Gets all airline countries that have flown over by route
4403
+	 *
4404
+	 * @return Array the airline country list
4405
+	 *
4406
+	 */
4407 4407
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4408 4408
 	{
4409 4409
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4435,11 +4435,11 @@  discard block
 block discarded – undo
4435 4435
 
4436 4436
 
4437 4437
 	/**
4438
-	* Gets all airlines that have flown over by country
4439
-	*
4440
-	* @return Array the airline list
4441
-	*
4442
-	*/
4438
+	 * Gets all airlines that have flown over by country
4439
+	 *
4440
+	 * @return Array the airline list
4441
+	 *
4442
+	 */
4443 4443
 	public function countAllAirlinesByCountry($country,$filters = array())
4444 4444
 	{
4445 4445
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4469,11 +4469,11 @@  discard block
 block discarded – undo
4469 4469
 
4470 4470
 
4471 4471
 	/**
4472
-	* Gets all airline countries that have flown over by country
4473
-	*
4474
-	* @return Array the airline country list
4475
-	*
4476
-	*/
4472
+	 * Gets all airline countries that have flown over by country
4473
+	 *
4474
+	 * @return Array the airline country list
4475
+	 *
4476
+	 */
4477 4477
 	public function countAllAirlineCountriesByCountry($country,$filters = array())
4478 4478
 	{
4479 4479
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4502,11 +4502,11 @@  discard block
 block discarded – undo
4502 4502
 
4503 4503
 
4504 4504
 	/**
4505
-	* Gets all airlines countries
4506
-	*
4507
-	* @return Array the airline country list
4508
-	*
4509
-	*/
4505
+	 * Gets all airlines countries
4506
+	 *
4507
+	 * @return Array the airline country list
4508
+	 *
4509
+	 */
4510 4510
 	public function countAllAirlineCountries($limit = true, $filters = array())
4511 4511
 	{
4512 4512
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4532,11 +4532,11 @@  discard block
 block discarded – undo
4532 4532
 	}
4533 4533
 
4534 4534
 	/**
4535
-	* Gets all number of flight over countries
4536
-	*
4537
-	* @return Array the airline country list
4538
-	*
4539
-	*/
4535
+	 * Gets all number of flight over countries
4536
+	 *
4537
+	 * @return Array the airline country list
4538
+	 *
4539
+	 */
4540 4540
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4541 4541
 	{
4542 4542
 		global $globalDBdriver;
@@ -4558,15 +4558,15 @@  discard block
 block discarded – undo
4558 4558
 		$SpotterLive = new SpotterLive();
4559 4559
 		$filter_query = $SpotterLive->getFilter($filters,true,true);
4560 4560
 		$filter_query .= ' over_country IS NOT NULL';
4561
-                if ($olderthanmonths > 0) {
4561
+				if ($olderthanmonths > 0) {
4562 4562
 			if ($globalDBdriver == 'mysql') {
4563 4563
 				$filter_query .= ' AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
4564 4564
 			} else {
4565 4565
 				$filter_query .= " AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4566 4566
 			}
4567 4567
 		}
4568
-                if ($sincedate != '') {
4569
-            		if ($globalDBdriver == 'mysql') {
4568
+				if ($sincedate != '') {
4569
+					if ($globalDBdriver == 'mysql') {
4570 4570
 				$filter_query .= " AND spotter_live.date > '".$sincedate."' ";
4571 4571
 			} else {
4572 4572
 				$filter_query .= " AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4596,11 +4596,11 @@  discard block
 block discarded – undo
4596 4596
 	
4597 4597
 	
4598 4598
 	/**
4599
-	* Gets all aircraft types that have flown over
4600
-	*
4601
-	* @return Array the aircraft list
4602
-	*
4603
-	*/
4599
+	 * Gets all aircraft types that have flown over
4600
+	 *
4601
+	 * @return Array the aircraft list
4602
+	 *
4603
+	 */
4604 4604
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4605 4605
 	{
4606 4606
 		global $globalDBdriver;
@@ -4643,11 +4643,11 @@  discard block
 block discarded – undo
4643 4643
 	}
4644 4644
 
4645 4645
 	/**
4646
-	* Gets all aircraft types that have flown over by airline
4647
-	*
4648
-	* @return Array the aircraft list
4649
-	*
4650
-	*/
4646
+	 * Gets all aircraft types that have flown over by airline
4647
+	 *
4648
+	 * @return Array the aircraft list
4649
+	 *
4650
+	 */
4651 4651
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4652 4652
 	{
4653 4653
 		global $globalDBdriver;
@@ -4690,11 +4690,11 @@  discard block
 block discarded – undo
4690 4690
 	}
4691 4691
 
4692 4692
 	/**
4693
-	* Gets all aircraft types that have flown over by months
4694
-	*
4695
-	* @return Array the aircraft list
4696
-	*
4697
-	*/
4693
+	 * Gets all aircraft types that have flown over by months
4694
+	 *
4695
+	 * @return Array the aircraft list
4696
+	 *
4697
+	 */
4698 4698
 	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4699 4699
 	{
4700 4700
 		global $globalDBdriver;
@@ -4738,11 +4738,11 @@  discard block
 block discarded – undo
4738 4738
 
4739 4739
 
4740 4740
 	/**
4741
-	* Gets all aircraft registration that have flown over by aircaft icao
4742
-	*
4743
-	* @return Array the aircraft list
4744
-	*
4745
-	*/
4741
+	 * Gets all aircraft registration that have flown over by aircaft icao
4742
+	 *
4743
+	 * @return Array the aircraft list
4744
+	 *
4745
+	 */
4746 4746
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
4747 4747
 	{
4748 4748
 		$Image = new Image($this->db);
@@ -4781,11 +4781,11 @@  discard block
 block discarded – undo
4781 4781
 
4782 4782
 
4783 4783
 	/**
4784
-	* Gets all aircraft types that have flown over by airline icao
4785
-	*
4786
-	* @return Array the aircraft list
4787
-	*
4788
-	*/
4784
+	 * Gets all aircraft types that have flown over by airline icao
4785
+	 *
4786
+	 * @return Array the aircraft list
4787
+	 *
4788
+	 */
4789 4789
 	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
4790 4790
 	{
4791 4791
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4814,11 +4814,11 @@  discard block
 block discarded – undo
4814 4814
 
4815 4815
 
4816 4816
 	/**
4817
-	* Gets all aircraft registration that have flown over by airline icao
4818
-	*
4819
-	* @return Array the aircraft list
4820
-	*
4821
-	*/
4817
+	 * Gets all aircraft registration that have flown over by airline icao
4818
+	 *
4819
+	 * @return Array the aircraft list
4820
+	 *
4821
+	 */
4822 4822
 	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
4823 4823
 	{
4824 4824
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4856,11 +4856,11 @@  discard block
 block discarded – undo
4856 4856
 
4857 4857
 
4858 4858
 	/**
4859
-	* Gets all aircraft manufacturer that have flown over by airline icao
4860
-	*
4861
-	* @return Array the aircraft list
4862
-	*
4863
-	*/
4859
+	 * Gets all aircraft manufacturer that have flown over by airline icao
4860
+	 *
4861
+	 * @return Array the aircraft list
4862
+	 *
4863
+	 */
4864 4864
 	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
4865 4865
 	{
4866 4866
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4888,11 +4888,11 @@  discard block
 block discarded – undo
4888 4888
 
4889 4889
 
4890 4890
 	/**
4891
-	* Gets all aircraft types that have flown over by airline icao
4892
-	*
4893
-	* @return Array the aircraft list
4894
-	*
4895
-	*/
4891
+	 * Gets all aircraft types that have flown over by airline icao
4892
+	 *
4893
+	 * @return Array the aircraft list
4894
+	 *
4895
+	 */
4896 4896
 	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
4897 4897
 	{
4898 4898
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4921,11 +4921,11 @@  discard block
 block discarded – undo
4921 4921
 
4922 4922
 
4923 4923
 	/**
4924
-	* Gets all aircraft registration that have flown over by airport icao
4925
-	*
4926
-	* @return Array the aircraft list
4927
-	*
4928
-	*/
4924
+	 * Gets all aircraft registration that have flown over by airport icao
4925
+	 *
4926
+	 * @return Array the aircraft list
4927
+	 *
4928
+	 */
4929 4929
 	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
4930 4930
 	{
4931 4931
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4962,11 +4962,11 @@  discard block
 block discarded – undo
4962 4962
 	
4963 4963
 	
4964 4964
 	/**
4965
-	* Gets all aircraft manufacturer that have flown over by airport icao
4966
-	*
4967
-	* @return Array the aircraft list
4968
-	*
4969
-	*/
4965
+	 * Gets all aircraft manufacturer that have flown over by airport icao
4966
+	 *
4967
+	 * @return Array the aircraft list
4968
+	 *
4969
+	 */
4970 4970
 	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
4971 4971
 	{
4972 4972
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4992,11 +4992,11 @@  discard block
 block discarded – undo
4992 4992
 	}
4993 4993
 
4994 4994
 	/**
4995
-	* Gets all aircraft types that have flown over by aircraft manufacturer
4996
-	*
4997
-	* @return Array the aircraft list
4998
-	*
4999
-	*/
4995
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
4996
+	 *
4997
+	 * @return Array the aircraft list
4998
+	 *
4999
+	 */
5000 5000
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
5001 5001
 	{
5002 5002
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5023,11 +5023,11 @@  discard block
 block discarded – undo
5023 5023
 
5024 5024
 
5025 5025
 	/**
5026
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
5027
-	*
5028
-	* @return Array the aircraft list
5029
-	*
5030
-	*/
5026
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
5027
+	 *
5028
+	 * @return Array the aircraft list
5029
+	 *
5030
+	 */
5031 5031
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
5032 5032
 	{
5033 5033
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5063,11 +5063,11 @@  discard block
 block discarded – undo
5063 5063
 	}
5064 5064
 
5065 5065
 	/**
5066
-	* Gets all aircraft types that have flown over by date
5067
-	*
5068
-	* @return Array the aircraft list
5069
-	*
5070
-	*/
5066
+	 * Gets all aircraft types that have flown over by date
5067
+	 *
5068
+	 * @return Array the aircraft list
5069
+	 *
5070
+	 */
5071 5071
 	public function countAllAircraftTypesByDate($date,$filters = array())
5072 5072
 	{
5073 5073
 		global $globalTimezone, $globalDBdriver;
@@ -5109,11 +5109,11 @@  discard block
 block discarded – undo
5109 5109
 
5110 5110
 
5111 5111
 	/**
5112
-	* Gets all aircraft registration that have flown over by date
5113
-	*
5114
-	* @return Array the aircraft list
5115
-	*
5116
-	*/
5112
+	 * Gets all aircraft registration that have flown over by date
5113
+	 *
5114
+	 * @return Array the aircraft list
5115
+	 *
5116
+	 */
5117 5117
 	public function countAllAircraftRegistrationByDate($date,$filters = array())
5118 5118
 	{
5119 5119
 		global $globalTimezone, $globalDBdriver;
@@ -5164,11 +5164,11 @@  discard block
 block discarded – undo
5164 5164
 
5165 5165
 
5166 5166
 	/**
5167
-	* Gets all aircraft manufacturer that have flown over by date
5168
-	*
5169
-	* @return Array the aircraft manufacturer list
5170
-	*
5171
-	*/
5167
+	 * Gets all aircraft manufacturer that have flown over by date
5168
+	 *
5169
+	 * @return Array the aircraft manufacturer list
5170
+	 *
5171
+	 */
5172 5172
 	public function countAllAircraftManufacturerByDate($date,$filters = array())
5173 5173
 	{
5174 5174
 		global $globalTimezone, $globalDBdriver;
@@ -5210,11 +5210,11 @@  discard block
 block discarded – undo
5210 5210
 
5211 5211
 
5212 5212
 	/**
5213
-	* Gets all aircraft types that have flown over by ident/callsign
5214
-	*
5215
-	* @return Array the aircraft list
5216
-	*
5217
-	*/
5213
+	 * Gets all aircraft types that have flown over by ident/callsign
5214
+	 *
5215
+	 * @return Array the aircraft list
5216
+	 *
5217
+	 */
5218 5218
 	public function countAllAircraftTypesByIdent($ident,$filters = array())
5219 5219
 	{
5220 5220
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5243,11 +5243,11 @@  discard block
 block discarded – undo
5243 5243
 
5244 5244
 
5245 5245
 	/**
5246
-	* Gets all aircraft registration that have flown over by ident/callsign
5247
-	*
5248
-	* @return Array the aircraft list
5249
-	*
5250
-	*/
5246
+	 * Gets all aircraft registration that have flown over by ident/callsign
5247
+	 *
5248
+	 * @return Array the aircraft list
5249
+	 *
5250
+	 */
5251 5251
 	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5252 5252
 	{
5253 5253
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5287,11 +5287,11 @@  discard block
 block discarded – undo
5287 5287
 
5288 5288
 
5289 5289
 	/**
5290
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
5291
-	*
5292
-	* @return Array the aircraft manufacturer list
5293
-	*
5294
-	*/
5290
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
5291
+	 *
5292
+	 * @return Array the aircraft manufacturer list
5293
+	 *
5294
+	 */
5295 5295
 	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5296 5296
 	{
5297 5297
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5317,11 +5317,11 @@  discard block
 block discarded – undo
5317 5317
 
5318 5318
 
5319 5319
 	/**
5320
-	* Gets all aircraft types that have flown over by route
5321
-	*
5322
-	* @return Array the aircraft list
5323
-	*
5324
-	*/
5320
+	 * Gets all aircraft types that have flown over by route
5321
+	 *
5322
+	 * @return Array the aircraft list
5323
+	 *
5324
+	 */
5325 5325
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5326 5326
 	{
5327 5327
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5350,11 +5350,11 @@  discard block
 block discarded – undo
5350 5350
 	}
5351 5351
 
5352 5352
 	/**
5353
-	* Gets all aircraft registration that have flown over by route
5354
-	*
5355
-	* @return Array the aircraft list
5356
-	*
5357
-	*/
5353
+	 * Gets all aircraft registration that have flown over by route
5354
+	 *
5355
+	 * @return Array the aircraft list
5356
+	 *
5357
+	 */
5358 5358
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5359 5359
 	{
5360 5360
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5396,11 +5396,11 @@  discard block
 block discarded – undo
5396 5396
 	
5397 5397
 	
5398 5398
 	/**
5399
-	* Gets all aircraft manufacturer that have flown over by route
5400
-	*
5401
-	* @return Array the aircraft manufacturer list
5402
-	*
5403
-	*/
5399
+	 * Gets all aircraft manufacturer that have flown over by route
5400
+	 *
5401
+	 * @return Array the aircraft manufacturer list
5402
+	 *
5403
+	 */
5404 5404
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5405 5405
 	{
5406 5406
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5434,11 +5434,11 @@  discard block
 block discarded – undo
5434 5434
 	
5435 5435
 	
5436 5436
 	/**
5437
-	* Gets all aircraft types that have flown over by country
5438
-	*
5439
-	* @return Array the aircraft list
5440
-	*
5441
-	*/
5437
+	 * Gets all aircraft types that have flown over by country
5438
+	 *
5439
+	 * @return Array the aircraft list
5440
+	 *
5441
+	 */
5442 5442
 	public function countAllAircraftTypesByCountry($country,$filters = array())
5443 5443
 	{
5444 5444
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5469,11 +5469,11 @@  discard block
 block discarded – undo
5469 5469
 
5470 5470
 
5471 5471
 	/**
5472
-	* Gets all aircraft registration that have flown over by country
5473
-	*
5474
-	* @return Array the aircraft list
5475
-	*
5476
-	*/
5472
+	 * Gets all aircraft registration that have flown over by country
5473
+	 *
5474
+	 * @return Array the aircraft list
5475
+	 *
5476
+	 */
5477 5477
 	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5478 5478
 	{
5479 5479
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5513,11 +5513,11 @@  discard block
 block discarded – undo
5513 5513
 	
5514 5514
 	
5515 5515
 	/**
5516
-	* Gets all aircraft manufacturer that have flown over by country
5517
-	*
5518
-	* @return Array the aircraft manufacturer list
5519
-	*
5520
-	*/
5516
+	 * Gets all aircraft manufacturer that have flown over by country
5517
+	 *
5518
+	 * @return Array the aircraft manufacturer list
5519
+	 *
5520
+	 */
5521 5521
 	public function countAllAircraftManufacturerByCountry($country,$filters = array())
5522 5522
 	{
5523 5523
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5548,17 +5548,17 @@  discard block
 block discarded – undo
5548 5548
 	
5549 5549
 	
5550 5550
 	/**
5551
-	* Gets all aircraft manufacturers that have flown over
5552
-	*
5553
-	* @return Array the aircraft list
5554
-	*
5555
-	*/
5551
+	 * Gets all aircraft manufacturers that have flown over
5552
+	 *
5553
+	 * @return Array the aircraft list
5554
+	 *
5555
+	 */
5556 5556
 	public function countAllAircraftManufacturers($filters = array())
5557 5557
 	{
5558 5558
 		$filter_query = $this->getFilter($filters,true,true);
5559 5559
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5560 5560
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5561
-                $query .= " GROUP BY spotter_output.aircraft_manufacturer
5561
+				$query .= " GROUP BY spotter_output.aircraft_manufacturer
5562 5562
 					ORDER BY aircraft_manufacturer_count DESC
5563 5563
 					LIMIT 10";
5564 5564
       
@@ -5583,11 +5583,11 @@  discard block
 block discarded – undo
5583 5583
 	
5584 5584
 	
5585 5585
 	/**
5586
-	* Gets all aircraft registrations that have flown over
5587
-	*
5588
-	* @return Array the aircraft list
5589
-	*
5590
-	*/
5586
+	 * Gets all aircraft registrations that have flown over
5587
+	 *
5588
+	 * @return Array the aircraft list
5589
+	 *
5590
+	 */
5591 5591
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5592 5592
 	{
5593 5593
 		global $globalDBdriver;
@@ -5595,15 +5595,15 @@  discard block
 block discarded – undo
5595 5595
 		$filter_query = $this->getFilter($filters,true,true);
5596 5596
 		$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    
5597 5597
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5598
-                if ($olderthanmonths > 0) {
5599
-            		if ($globalDBdriver == 'mysql') {
5598
+				if ($olderthanmonths > 0) {
5599
+					if ($globalDBdriver == 'mysql') {
5600 5600
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5601 5601
 			} else {
5602 5602
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5603 5603
 			}
5604 5604
 		}
5605
-                if ($sincedate != '') {
5606
-            		if ($globalDBdriver == 'mysql') {
5605
+				if ($sincedate != '') {
5606
+					if ($globalDBdriver == 'mysql') {
5607 5607
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5608 5608
 			} else {
5609 5609
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5612,7 +5612,7 @@  discard block
 block discarded – undo
5612 5612
 
5613 5613
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5614 5614
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5615
-                $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5615
+				$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5616 5616
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5617 5617
 		
5618 5618
 		$sth = $this->db->prepare($query);
@@ -5643,11 +5643,11 @@  discard block
 block discarded – undo
5643 5643
 
5644 5644
 
5645 5645
 	/**
5646
-	* Gets all aircraft registrations that have flown over
5647
-	*
5648
-	* @return Array the aircraft list
5649
-	*
5650
-	*/
5646
+	 * Gets all aircraft registrations that have flown over
5647
+	 *
5648
+	 * @return Array the aircraft list
5649
+	 *
5650
+	 */
5651 5651
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5652 5652
 	{
5653 5653
 		global $globalDBdriver;
@@ -5655,15 +5655,15 @@  discard block
 block discarded – undo
5655 5655
 		$Image = new Image($this->db);
5656 5656
 		$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    
5657 5657
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5658
-                if ($olderthanmonths > 0) {
5659
-            		if ($globalDBdriver == 'mysql') {
5658
+				if ($olderthanmonths > 0) {
5659
+					if ($globalDBdriver == 'mysql') {
5660 5660
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5661 5661
 			} else {
5662 5662
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5663 5663
 			}
5664 5664
 		}
5665
-                if ($sincedate != '') {
5666
-            		if ($globalDBdriver == 'mysql') {
5665
+				if ($sincedate != '') {
5666
+					if ($globalDBdriver == 'mysql') {
5667 5667
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5668 5668
 			} else {
5669 5669
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5672,7 +5672,7 @@  discard block
 block discarded – undo
5672 5672
 
5673 5673
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5674 5674
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5675
-                $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";
5675
+				$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";
5676 5676
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5677 5677
 		
5678 5678
 		$sth = $this->db->prepare($query);
@@ -5704,35 +5704,35 @@  discard block
 block discarded – undo
5704 5704
 	
5705 5705
 	
5706 5706
 	/**
5707
-	* Gets all departure airports of the airplanes that have flown over
5708
-	*
5709
-	* @return Array the airport list
5710
-	*
5711
-	*/
5707
+	 * Gets all departure airports of the airplanes that have flown over
5708
+	 *
5709
+	 * @return Array the airport list
5710
+	 *
5711
+	 */
5712 5712
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5713 5713
 	{
5714 5714
 		global $globalDBdriver;
5715 5715
 		$filter_query = $this->getFilter($filters,true,true);
5716 5716
 		$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 
5717 5717
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
5718
-                if ($olderthanmonths > 0) {
5719
-            		if ($globalDBdriver == 'mysql') {
5718
+				if ($olderthanmonths > 0) {
5719
+					if ($globalDBdriver == 'mysql') {
5720 5720
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5721 5721
 			} else {
5722 5722
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5723 5723
 			}
5724
-                }
5725
-                if ($sincedate != '') {
5726
-            		if ($globalDBdriver == 'mysql') {
5724
+				}
5725
+				if ($sincedate != '') {
5726
+					if ($globalDBdriver == 'mysql') {
5727 5727
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5728 5728
 			} else {
5729 5729
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5730 5730
 			}
5731 5731
 		}
5732 5732
 
5733
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5734
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5735
-                $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5733
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5734
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5735
+				$query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5736 5736
 				ORDER BY airport_departure_icao_count DESC";
5737 5737
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5738 5738
       
@@ -5756,35 +5756,35 @@  discard block
 block discarded – undo
5756 5756
 	}
5757 5757
 
5758 5758
 	/**
5759
-	* Gets all departure airports of the airplanes that have flown over
5760
-	*
5761
-	* @return Array the airport list
5762
-	*
5763
-	*/
5759
+	 * Gets all departure airports of the airplanes that have flown over
5760
+	 *
5761
+	 * @return Array the airport list
5762
+	 *
5763
+	 */
5764 5764
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5765 5765
 	{
5766 5766
 		global $globalDBdriver;
5767 5767
 		$filter_query = $this->getFilter($filters,true,true);
5768 5768
 		$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 
5769 5769
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' ";
5770
-                if ($olderthanmonths > 0) {
5771
-            		if ($globalDBdriver == 'mysql') {
5770
+				if ($olderthanmonths > 0) {
5771
+					if ($globalDBdriver == 'mysql') {
5772 5772
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5773 5773
 			} else {
5774 5774
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5775 5775
 			}
5776
-                }
5777
-                if ($sincedate != '') {
5778
-            		if ($globalDBdriver == 'mysql') {
5776
+				}
5777
+				if ($sincedate != '') {
5778
+					if ($globalDBdriver == 'mysql') {
5779 5779
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5780 5780
 			} else {
5781 5781
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5782 5782
 			}
5783 5783
 		}
5784 5784
 
5785
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5786
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5787
-                $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
5785
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5786
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5787
+				$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
5788 5788
 				ORDER BY airport_departure_icao_count DESC";
5789 5789
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5790 5790
       
@@ -5809,37 +5809,37 @@  discard block
 block discarded – undo
5809 5809
 	}
5810 5810
 
5811 5811
 	/**
5812
-	* Gets all detected departure airports of the airplanes that have flown over
5813
-	*
5814
-	* @return Array the airport list
5815
-	*
5816
-	*/
5812
+	 * Gets all detected departure airports of the airplanes that have flown over
5813
+	 *
5814
+	 * @return Array the airport list
5815
+	 *
5816
+	 */
5817 5817
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5818 5818
 	{
5819 5819
 		global $globalDBdriver;
5820 5820
 		$filter_query = $this->getFilter($filters,true,true);
5821 5821
 		$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
5822 5822
 				FROM airport, spotter_output".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao";
5823
-                if ($olderthanmonths > 0) {
5824
-            		if ($globalDBdriver == 'mysql') {
5823
+				if ($olderthanmonths > 0) {
5824
+					if ($globalDBdriver == 'mysql') {
5825 5825
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5826 5826
 			} else {
5827 5827
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5828 5828
 			}
5829
-                }
5830
-                if ($sincedate != '') {
5831
-            		if ($globalDBdriver == 'mysql') {
5829
+				}
5830
+				if ($sincedate != '') {
5831
+					if ($globalDBdriver == 'mysql') {
5832 5832
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5833 5833
 			} else {
5834 5834
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5835 5835
 			}
5836 5836
 		}
5837
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5838
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5839
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5837
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5838
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5839
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5840 5840
 				ORDER BY airport_departure_icao_count DESC";
5841 5841
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5842
-    		//echo $query;
5842
+			//echo $query;
5843 5843
 		$sth = $this->db->prepare($query);
5844 5844
 		$sth->execute();
5845 5845
       
@@ -5860,35 +5860,35 @@  discard block
 block discarded – undo
5860 5860
 	}
5861 5861
 	
5862 5862
 	/**
5863
-	* Gets all detected departure airports of the airplanes that have flown over
5864
-	*
5865
-	* @return Array the airport list
5866
-	*
5867
-	*/
5863
+	 * Gets all detected departure airports of the airplanes that have flown over
5864
+	 *
5865
+	 * @return Array the airport list
5866
+	 *
5867
+	 */
5868 5868
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5869 5869
 	{
5870 5870
 		global $globalDBdriver;
5871 5871
 		$filter_query = $this->getFilter($filters,true,true);
5872 5872
 		$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
5873 5873
 				FROM airport, spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao ";
5874
-                if ($olderthanmonths > 0) {
5875
-            		if ($globalDBdriver == 'mysql') {
5874
+				if ($olderthanmonths > 0) {
5875
+					if ($globalDBdriver == 'mysql') {
5876 5876
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5877 5877
 			} else {
5878 5878
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5879 5879
 			}
5880
-                }
5881
-                if ($sincedate != '') {
5882
-            		if ($globalDBdriver == 'mysql') {
5880
+				}
5881
+				if ($sincedate != '') {
5882
+					if ($globalDBdriver == 'mysql') {
5883 5883
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5884 5884
 			} else {
5885 5885
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
5886 5886
 			}
5887 5887
 		}
5888 5888
 
5889
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5890
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5891
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5889
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5890
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5891
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5892 5892
 				ORDER BY airport_departure_icao_count DESC";
5893 5893
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5894 5894
       
@@ -5913,11 +5913,11 @@  discard block
 block discarded – undo
5913 5913
 	}	
5914 5914
 	
5915 5915
 	/**
5916
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
5917
-	*
5918
-	* @return Array the airport list
5919
-	*
5920
-	*/
5916
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
5917
+	 *
5918
+	 * @return Array the airport list
5919
+	 *
5920
+	 */
5921 5921
 	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
5922 5922
 	{
5923 5923
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5951,11 +5951,11 @@  discard block
 block discarded – undo
5951 5951
 	
5952 5952
 	
5953 5953
 	/**
5954
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5955
-	*
5956
-	* @return Array the airport list
5957
-	*
5958
-	*/
5954
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5955
+	 *
5956
+	 * @return Array the airport list
5957
+	 *
5958
+	 */
5959 5959
 	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
5960 5960
 	{
5961 5961
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5986,11 +5986,11 @@  discard block
 block discarded – undo
5986 5986
 	
5987 5987
 	
5988 5988
 	/**
5989
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5990
-	*
5991
-	* @return Array the airport list
5992
-	*
5993
-	*/
5989
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5990
+	 *
5991
+	 * @return Array the airport list
5992
+	 *
5993
+	 */
5994 5994
 	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
5995 5995
 	{
5996 5996
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6023,11 +6023,11 @@  discard block
 block discarded – undo
6023 6023
 	
6024 6024
 	
6025 6025
 	/**
6026
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6027
-	*
6028
-	* @return Array the airport list
6029
-	*
6030
-	*/
6026
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6027
+	 *
6028
+	 * @return Array the airport list
6029
+	 *
6030
+	 */
6031 6031
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
6032 6032
 	{
6033 6033
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6057,11 +6057,11 @@  discard block
 block discarded – undo
6057 6057
 	
6058 6058
 	
6059 6059
 	/**
6060
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
6061
-	*
6062
-	* @return Array the airport list
6063
-	*
6064
-	*/
6060
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
6061
+	 *
6062
+	 * @return Array the airport list
6063
+	 *
6064
+	 */
6065 6065
 	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
6066 6066
 	{
6067 6067
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6094,11 +6094,11 @@  discard block
 block discarded – undo
6094 6094
 	
6095 6095
 	
6096 6096
 	/**
6097
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
6098
-	*
6099
-	* @return Array the airport list
6100
-	*
6101
-	*/
6097
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
6098
+	 *
6099
+	 * @return Array the airport list
6100
+	 *
6101
+	 */
6102 6102
 	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
6103 6103
 	{
6104 6104
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6128,11 +6128,11 @@  discard block
 block discarded – undo
6128 6128
 	
6129 6129
 	
6130 6130
 	/**
6131
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
6132
-	*
6133
-	* @return Array the airport list
6134
-	*
6135
-	*/
6131
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
6132
+	 *
6133
+	 * @return Array the airport list
6134
+	 *
6135
+	 */
6136 6136
 	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
6137 6137
 	{
6138 6138
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6165,11 +6165,11 @@  discard block
 block discarded – undo
6165 6165
 	
6166 6166
 	
6167 6167
 	/**
6168
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
6169
-	*
6170
-	* @return Array the airport list
6171
-	*
6172
-	*/
6168
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
6169
+	 *
6170
+	 * @return Array the airport list
6171
+	 *
6172
+	 */
6173 6173
 	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
6174 6174
 	{
6175 6175
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6200,11 +6200,11 @@  discard block
 block discarded – undo
6200 6200
 	
6201 6201
 	
6202 6202
 	/**
6203
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
6204
-	*
6205
-	* @return Array the airport list
6206
-	*
6207
-	*/
6203
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
6204
+	 *
6205
+	 * @return Array the airport list
6206
+	 *
6207
+	 */
6208 6208
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6209 6209
 	{
6210 6210
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6237,11 +6237,11 @@  discard block
 block discarded – undo
6237 6237
 	
6238 6238
 	
6239 6239
 	/**
6240
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
6241
-	*
6242
-	* @return Array the airport list
6243
-	*
6244
-	*/
6240
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
6241
+	 *
6242
+	 * @return Array the airport list
6243
+	 *
6244
+	 */
6245 6245
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6246 6246
 	{
6247 6247
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6271,11 +6271,11 @@  discard block
 block discarded – undo
6271 6271
 	
6272 6272
 	
6273 6273
 	/**
6274
-	* Gets all departure airports of the airplanes that have flown over based on a date
6275
-	*
6276
-	* @return Array the airport list
6277
-	*
6278
-	*/
6274
+	 * Gets all departure airports of the airplanes that have flown over based on a date
6275
+	 *
6276
+	 * @return Array the airport list
6277
+	 *
6278
+	 */
6279 6279
 	public function countAllDepartureAirportsByDate($date,$filters = array())
6280 6280
 	{
6281 6281
 		global $globalTimezone, $globalDBdriver;
@@ -6321,11 +6321,11 @@  discard block
 block discarded – undo
6321 6321
 	
6322 6322
 	
6323 6323
 	/**
6324
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
6325
-	*
6326
-	* @return Array the airport list
6327
-	*
6328
-	*/
6324
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
6325
+	 *
6326
+	 * @return Array the airport list
6327
+	 *
6328
+	 */
6329 6329
 	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6330 6330
 	{
6331 6331
 		global $globalTimezone, $globalDBdriver;
@@ -6368,11 +6368,11 @@  discard block
 block discarded – undo
6368 6368
 	
6369 6369
 	
6370 6370
 	/**
6371
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6372
-	*
6373
-	* @return Array the airport list
6374
-	*
6375
-	*/
6371
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6372
+	 *
6373
+	 * @return Array the airport list
6374
+	 *
6375
+	 */
6376 6376
 	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6377 6377
 	{
6378 6378
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6406,11 +6406,11 @@  discard block
 block discarded – undo
6406 6406
 	
6407 6407
 	
6408 6408
 	/**
6409
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6410
-	*
6411
-	* @return Array the airport list
6412
-	*
6413
-	*/
6409
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6410
+	 *
6411
+	 * @return Array the airport list
6412
+	 *
6413
+	 */
6414 6414
 	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
6415 6415
 	{
6416 6416
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6441,11 +6441,11 @@  discard block
 block discarded – undo
6441 6441
 	
6442 6442
 	
6443 6443
 	/**
6444
-	* Gets all departure airports of the airplanes that have flown over based on a country
6445
-	*
6446
-	* @return Array the airport list
6447
-	*
6448
-	*/
6444
+	 * Gets all departure airports of the airplanes that have flown over based on a country
6445
+	 *
6446
+	 * @return Array the airport list
6447
+	 *
6448
+	 */
6449 6449
 	public function countAllDepartureAirportsByCountry($country,$filters = array())
6450 6450
 	{
6451 6451
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6479,11 +6479,11 @@  discard block
 block discarded – undo
6479 6479
 
6480 6480
 
6481 6481
 	/**
6482
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6483
-	*
6484
-	* @return Array the airport list
6485
-	*
6486
-	*/
6482
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6483
+	 *
6484
+	 * @return Array the airport list
6485
+	 *
6486
+	 */
6487 6487
 	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
6488 6488
 	{
6489 6489
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6513,40 +6513,40 @@  discard block
 block discarded – undo
6513 6513
 	
6514 6514
 
6515 6515
 	/**
6516
-	* Gets all arrival airports of the airplanes that have flown over
6517
-	*
6518
-	* @param Boolean $limit Limit result to 10 or not
6519
-	* @param Integer $olderthanmonths Only show result older than x months
6520
-	* @param String $sincedate Only show result since x date
6521
-	* @param Boolean $icaoaskey Show result by ICAO
6522
-	* @param Array $filters Filter used here
6523
-	* @return Array the airport list
6524
-	*
6525
-	*/
6516
+	 * Gets all arrival airports of the airplanes that have flown over
6517
+	 *
6518
+	 * @param Boolean $limit Limit result to 10 or not
6519
+	 * @param Integer $olderthanmonths Only show result older than x months
6520
+	 * @param String $sincedate Only show result since x date
6521
+	 * @param Boolean $icaoaskey Show result by ICAO
6522
+	 * @param Array $filters Filter used here
6523
+	 * @return Array the airport list
6524
+	 *
6525
+	 */
6526 6526
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6527 6527
 	{
6528 6528
 		global $globalDBdriver;
6529 6529
 		$filter_query = $this->getFilter($filters,true,true);
6530 6530
 		$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 
6531 6531
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
6532
-                if ($olderthanmonths > 0) {
6533
-            		if ($globalDBdriver == 'mysql') {
6532
+				if ($olderthanmonths > 0) {
6533
+					if ($globalDBdriver == 'mysql') {
6534 6534
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6535 6535
 			} else {
6536 6536
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6537 6537
 			}
6538 6538
 		}
6539
-                if ($sincedate != '') {
6540
-            		if ($globalDBdriver == 'mysql') {
6539
+				if ($sincedate != '') {
6540
+					if ($globalDBdriver == 'mysql') {
6541 6541
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6542 6542
 			} else {
6543 6543
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6544 6544
 			}
6545 6545
 		}
6546 6546
 
6547
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6548
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6549
-                $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6547
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6548
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6549
+				$query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6550 6550
 					ORDER BY airport_arrival_icao_count DESC";
6551 6551
 		if ($limit) $query .= " LIMIT 10";
6552 6552
       
@@ -6575,35 +6575,35 @@  discard block
 block discarded – undo
6575 6575
 	}
6576 6576
 
6577 6577
 	/**
6578
-	* Gets all arrival airports of the airplanes that have flown over
6579
-	*
6580
-	* @return Array the airport list
6581
-	*
6582
-	*/
6578
+	 * Gets all arrival airports of the airplanes that have flown over
6579
+	 *
6580
+	 * @return Array the airport list
6581
+	 *
6582
+	 */
6583 6583
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6584 6584
 	{
6585 6585
 		global $globalDBdriver;
6586 6586
 		$filter_query = $this->getFilter($filters,true,true);
6587 6587
 		$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 
6588 6588
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' ";
6589
-                if ($olderthanmonths > 0) {
6590
-            		if ($globalDBdriver == 'mysql') {
6589
+				if ($olderthanmonths > 0) {
6590
+					if ($globalDBdriver == 'mysql') {
6591 6591
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6592 6592
 			} else {
6593 6593
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6594 6594
 			}
6595 6595
 		}
6596
-                if ($sincedate != '') {
6597
-            		if ($globalDBdriver == 'mysql') {
6596
+				if ($sincedate != '') {
6597
+					if ($globalDBdriver == 'mysql') {
6598 6598
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6599 6599
 			} else {
6600 6600
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6601 6601
 			}
6602 6602
 		}
6603 6603
 
6604
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6605
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6606
-                $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
6604
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6605
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6606
+				$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
6607 6607
 					ORDER BY airport_arrival_icao_count DESC";
6608 6608
 		if ($limit) $query .= " LIMIT 10";
6609 6609
       
@@ -6634,34 +6634,34 @@  discard block
 block discarded – undo
6634 6634
 
6635 6635
 
6636 6636
 	/**
6637
-	* Gets all detected arrival airports of the airplanes that have flown over
6638
-	*
6639
-	* @return Array the airport list
6640
-	*
6641
-	*/
6637
+	 * Gets all detected arrival airports of the airplanes that have flown over
6638
+	 *
6639
+	 * @return Array the airport list
6640
+	 *
6641
+	 */
6642 6642
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6643 6643
 	{
6644 6644
 		global $globalDBdriver;
6645 6645
 		$filter_query = $this->getFilter($filters,true,true);
6646 6646
 		$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 
6647 6647
 			FROM airport,spotter_output".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao";
6648
-                if ($olderthanmonths > 0) {
6649
-            		if ($globalDBdriver == 'mysql') {
6648
+				if ($olderthanmonths > 0) {
6649
+					if ($globalDBdriver == 'mysql') {
6650 6650
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6651 6651
 			} else {
6652 6652
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6653 6653
 			}
6654 6654
 		}
6655
-                if ($sincedate != '') {
6656
-            		if ($globalDBdriver == 'mysql') {
6655
+				if ($sincedate != '') {
6656
+					if ($globalDBdriver == 'mysql') {
6657 6657
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6658 6658
 			} else {
6659 6659
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6660 6660
 			}
6661 6661
 		}
6662
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6663
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6664
-                $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6662
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6663
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6664
+				$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6665 6665
 					ORDER BY airport_arrival_icao_count DESC";
6666 6666
 		if ($limit) $query .= " LIMIT 10";
6667 6667
       
@@ -6690,35 +6690,35 @@  discard block
 block discarded – undo
6690 6690
 	}
6691 6691
 	
6692 6692
 	/**
6693
-	* Gets all detected arrival airports of the airplanes that have flown over
6694
-	*
6695
-	* @return Array the airport list
6696
-	*
6697
-	*/
6693
+	 * Gets all detected arrival airports of the airplanes that have flown over
6694
+	 *
6695
+	 * @return Array the airport list
6696
+	 *
6697
+	 */
6698 6698
 	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6699 6699
 	{
6700 6700
 		global $globalDBdriver;
6701 6701
 		$filter_query = $this->getFilter($filters,true,true);
6702 6702
 		$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 
6703 6703
 			FROM airport,spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao ";
6704
-                if ($olderthanmonths > 0) {
6705
-            		if ($globalDBdriver == 'mysql') {
6704
+				if ($olderthanmonths > 0) {
6705
+					if ($globalDBdriver == 'mysql') {
6706 6706
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6707 6707
 			} else {
6708 6708
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6709 6709
 			}
6710 6710
 		}
6711
-                if ($sincedate != '') {
6712
-            		if ($globalDBdriver == 'mysql') {
6711
+				if ($sincedate != '') {
6712
+					if ($globalDBdriver == 'mysql') {
6713 6713
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6714 6714
 			} else {
6715 6715
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6716 6716
 			}
6717 6717
 		}
6718 6718
 
6719
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6720
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6721
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6719
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6720
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6721
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6722 6722
 					ORDER BY airport_arrival_icao_count DESC";
6723 6723
 		if ($limit) $query .= " LIMIT 10";
6724 6724
       
@@ -6748,11 +6748,11 @@  discard block
 block discarded – undo
6748 6748
 	}	
6749 6749
 	
6750 6750
 	/**
6751
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
6752
-	*
6753
-	* @return Array the airport list
6754
-	*
6755
-	*/
6751
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
6752
+	 *
6753
+	 * @return Array the airport list
6754
+	 *
6755
+	 */
6756 6756
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
6757 6757
 	{
6758 6758
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6784,11 +6784,11 @@  discard block
 block discarded – undo
6784 6784
 	
6785 6785
 	
6786 6786
 	/**
6787
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6788
-	*
6789
-	* @return Array the airport list
6790
-	*
6791
-	*/
6787
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6788
+	 *
6789
+	 * @return Array the airport list
6790
+	 *
6791
+	 */
6792 6792
 	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
6793 6793
 	{
6794 6794
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6819,11 +6819,11 @@  discard block
 block discarded – undo
6819 6819
 	
6820 6820
 	
6821 6821
 	/**
6822
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6823
-	*
6824
-	* @return Array the airport list
6825
-	*
6826
-	*/
6822
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6823
+	 *
6824
+	 * @return Array the airport list
6825
+	 *
6826
+	 */
6827 6827
 	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
6828 6828
 	{
6829 6829
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6857,11 +6857,11 @@  discard block
 block discarded – undo
6857 6857
 	
6858 6858
 	
6859 6859
 	/**
6860
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6861
-	*
6862
-	* @return Array the airport list
6863
-	*
6864
-	*/
6860
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6861
+	 *
6862
+	 * @return Array the airport list
6863
+	 *
6864
+	 */
6865 6865
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
6866 6866
 	{
6867 6867
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6891,11 +6891,11 @@  discard block
 block discarded – undo
6891 6891
 	
6892 6892
 	
6893 6893
 	/**
6894
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6895
-	*
6896
-	* @return Array the airport list
6897
-	*
6898
-	*/
6894
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6895
+	 *
6896
+	 * @return Array the airport list
6897
+	 *
6898
+	 */
6899 6899
 	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
6900 6900
 	{
6901 6901
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6929,11 +6929,11 @@  discard block
 block discarded – undo
6929 6929
 	
6930 6930
 	
6931 6931
 	/**
6932
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6933
-	*
6934
-	* @return Array the airport list
6935
-	*
6936
-	*/
6932
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6933
+	 *
6934
+	 * @return Array the airport list
6935
+	 *
6936
+	 */
6937 6937
 	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
6938 6938
 	{
6939 6939
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6964,11 +6964,11 @@  discard block
 block discarded – undo
6964 6964
 	
6965 6965
 	
6966 6966
 	/**
6967
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
6968
-	*
6969
-	* @return Array the airport list
6970
-	*
6971
-	*/
6967
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
6968
+	 *
6969
+	 * @return Array the airport list
6970
+	 *
6971
+	 */
6972 6972
 	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
6973 6973
 	{
6974 6974
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7001,11 +7001,11 @@  discard block
 block discarded – undo
7001 7001
 	
7002 7002
 	
7003 7003
 	/**
7004
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
7005
-	*
7006
-	* @return Array the airport list
7007
-	*
7008
-	*/
7004
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
7005
+	 *
7006
+	 * @return Array the airport list
7007
+	 *
7008
+	 */
7009 7009
 	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
7010 7010
 	{
7011 7011
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7035,11 +7035,11 @@  discard block
 block discarded – undo
7035 7035
 	
7036 7036
 	
7037 7037
 	/**
7038
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
7039
-	*
7040
-	* @return Array the airport list
7041
-	*
7042
-	*/
7038
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
7039
+	 *
7040
+	 * @return Array the airport list
7041
+	 *
7042
+	 */
7043 7043
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
7044 7044
 	{
7045 7045
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7073,11 +7073,11 @@  discard block
 block discarded – undo
7073 7073
 	
7074 7074
 	
7075 7075
 	/**
7076
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
7077
-	*
7078
-	* @return Array the airport list
7079
-	*
7080
-	*/
7076
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
7077
+	 *
7078
+	 * @return Array the airport list
7079
+	 *
7080
+	 */
7081 7081
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
7082 7082
 	{
7083 7083
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7108,11 +7108,11 @@  discard block
 block discarded – undo
7108 7108
 	
7109 7109
 	
7110 7110
 	/**
7111
-	* Gets all arrival airports of the airplanes that have flown over based on a date
7112
-	*
7113
-	* @return Array the airport list
7114
-	*
7115
-	*/
7111
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
7112
+	 *
7113
+	 * @return Array the airport list
7114
+	 *
7115
+	 */
7116 7116
 	public function countAllArrivalAirportsByDate($date,$filters = array())
7117 7117
 	{
7118 7118
 		global $globalTimezone, $globalDBdriver;
@@ -7158,11 +7158,11 @@  discard block
 block discarded – undo
7158 7158
 	
7159 7159
 	
7160 7160
 	/**
7161
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
7162
-	*
7163
-	* @return Array the airport list
7164
-	*
7165
-	*/
7161
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
7162
+	 *
7163
+	 * @return Array the airport list
7164
+	 *
7165
+	 */
7166 7166
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
7167 7167
 	{
7168 7168
 		global $globalTimezone, $globalDBdriver;
@@ -7205,11 +7205,11 @@  discard block
 block discarded – undo
7205 7205
 	
7206 7206
 	
7207 7207
 	/**
7208
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
7209
-	*
7210
-	* @return Array the airport list
7211
-	*
7212
-	*/
7208
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
7209
+	 *
7210
+	 * @return Array the airport list
7211
+	 *
7212
+	 */
7213 7213
 	public function countAllArrivalAirportsByIdent($ident,$filters = array())
7214 7214
 	{
7215 7215
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7242,11 +7242,11 @@  discard block
 block discarded – undo
7242 7242
 	
7243 7243
 	
7244 7244
 	/**
7245
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7246
-	*
7247
-	* @return Array the airport list
7248
-	*
7249
-	*/
7245
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7246
+	 *
7247
+	 * @return Array the airport list
7248
+	 *
7249
+	 */
7250 7250
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
7251 7251
 	{
7252 7252
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7277,11 +7277,11 @@  discard block
 block discarded – undo
7277 7277
 	
7278 7278
 	
7279 7279
 	/**
7280
-	* Gets all arrival airports of the airplanes that have flown over based on a country
7281
-	*
7282
-	* @return Array the airport list
7283
-	*
7284
-	*/
7280
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
7281
+	 *
7282
+	 * @return Array the airport list
7283
+	 *
7284
+	 */
7285 7285
 	public function countAllArrivalAirportsByCountry($country,$filters = array())
7286 7286
 	{
7287 7287
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7314,11 +7314,11 @@  discard block
 block discarded – undo
7314 7314
 	
7315 7315
 	
7316 7316
 	/**
7317
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
7318
-	*
7319
-	* @return Array the airport list
7320
-	*
7321
-	*/
7317
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
7318
+	 *
7319
+	 * @return Array the airport list
7320
+	 *
7321
+	 */
7322 7322
 	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
7323 7323
 	{
7324 7324
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7349,11 +7349,11 @@  discard block
 block discarded – undo
7349 7349
 
7350 7350
 
7351 7351
 	/**
7352
-	* Counts all airport departure countries
7353
-	*
7354
-	* @return Array the airport departure list
7355
-	*
7356
-	*/
7352
+	 * Counts all airport departure countries
7353
+	 *
7354
+	 * @return Array the airport departure list
7355
+	 *
7356
+	 */
7357 7357
 	public function countAllDepartureCountries($filters = array())
7358 7358
 	{
7359 7359
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7383,11 +7383,11 @@  discard block
 block discarded – undo
7383 7383
 	
7384 7384
 	
7385 7385
 	/**
7386
-	* Counts all airport arrival countries
7387
-	*
7388
-	* @return Array the airport arrival list
7389
-	*
7390
-	*/
7386
+	 * Counts all airport arrival countries
7387
+	 *
7388
+	 * @return Array the airport arrival list
7389
+	 *
7390
+	 */
7391 7391
 	public function countAllArrivalCountries($limit = true,$filters = array())
7392 7392
 	{
7393 7393
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7420,11 +7420,11 @@  discard block
 block discarded – undo
7420 7420
 
7421 7421
 
7422 7422
 	/**
7423
-	* Gets all route combinations
7424
-	*
7425
-	* @return Array the route list
7426
-	*
7427
-	*/
7423
+	 * Gets all route combinations
7424
+	 *
7425
+	 * @return Array the route list
7426
+	 *
7427
+	 */
7428 7428
 	public function countAllRoutes($filters = array())
7429 7429
 	{
7430 7430
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7463,11 +7463,11 @@  discard block
 block discarded – undo
7463 7463
 	
7464 7464
 	
7465 7465
 	/**
7466
-	* Gets all route combinations based on an aircraft
7467
-	*
7468
-	* @return Array the route list
7469
-	*
7470
-	*/
7466
+	 * Gets all route combinations based on an aircraft
7467
+	 *
7468
+	 * @return Array the route list
7469
+	 *
7470
+	 */
7471 7471
 	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
7472 7472
 	{
7473 7473
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7503,11 +7503,11 @@  discard block
 block discarded – undo
7503 7503
 	
7504 7504
 	
7505 7505
 	/**
7506
-	* Gets all route combinations based on an aircraft registration
7507
-	*
7508
-	* @return Array the route list
7509
-	*
7510
-	*/
7506
+	 * Gets all route combinations based on an aircraft registration
7507
+	 *
7508
+	 * @return Array the route list
7509
+	 *
7510
+	 */
7511 7511
 	public function countAllRoutesByRegistration($registration, $filters = array())
7512 7512
 	{
7513 7513
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7545,11 +7545,11 @@  discard block
 block discarded – undo
7545 7545
 	
7546 7546
 	
7547 7547
 	/**
7548
-	* Gets all route combinations based on an airline
7549
-	*
7550
-	* @return Array the route list
7551
-	*
7552
-	*/
7548
+	 * Gets all route combinations based on an airline
7549
+	 *
7550
+	 * @return Array the route list
7551
+	 *
7552
+	 */
7553 7553
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
7554 7554
 	{
7555 7555
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7587,11 +7587,11 @@  discard block
 block discarded – undo
7587 7587
 	
7588 7588
 	
7589 7589
 	/**
7590
-	* Gets all route combinations based on an airport
7591
-	*
7592
-	* @return Array the route list
7593
-	*
7594
-	*/
7590
+	 * Gets all route combinations based on an airport
7591
+	 *
7592
+	 * @return Array the route list
7593
+	 *
7594
+	 */
7595 7595
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
7596 7596
 	{
7597 7597
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7628,11 +7628,11 @@  discard block
 block discarded – undo
7628 7628
 	
7629 7629
 	
7630 7630
 	/**
7631
-	* Gets all route combinations based on an country
7632
-	*
7633
-	* @return Array the route list
7634
-	*
7635
-	*/
7631
+	 * Gets all route combinations based on an country
7632
+	 *
7633
+	 * @return Array the route list
7634
+	 *
7635
+	 */
7636 7636
 	public function countAllRoutesByCountry($country, $filters = array())
7637 7637
 	{
7638 7638
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7668,11 +7668,11 @@  discard block
 block discarded – undo
7668 7668
 
7669 7669
 
7670 7670
 	/**
7671
-	* Gets all route combinations based on an date
7672
-	*
7673
-	* @return Array the route list
7674
-	*
7675
-	*/
7671
+	 * Gets all route combinations based on an date
7672
+	 *
7673
+	 * @return Array the route list
7674
+	 *
7675
+	 */
7676 7676
 	public function countAllRoutesByDate($date, $filters = array())
7677 7677
 	{
7678 7678
 		global $globalTimezone, $globalDBdriver;
@@ -7722,11 +7722,11 @@  discard block
 block discarded – undo
7722 7722
 	
7723 7723
 	
7724 7724
 	/**
7725
-	* Gets all route combinations based on an ident/callsign
7726
-	*
7727
-	* @return Array the route list
7728
-	*
7729
-	*/
7725
+	 * Gets all route combinations based on an ident/callsign
7726
+	 *
7727
+	 * @return Array the route list
7728
+	 *
7729
+	 */
7730 7730
 	public function countAllRoutesByIdent($ident, $filters = array())
7731 7731
 	{
7732 7732
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7763,11 +7763,11 @@  discard block
 block discarded – undo
7763 7763
 	
7764 7764
 	
7765 7765
 	/**
7766
-	* Gets all route combinations based on an manufacturer
7767
-	*
7768
-	* @return Array the route list
7769
-	*
7770
-	*/
7766
+	 * Gets all route combinations based on an manufacturer
7767
+	 *
7768
+	 * @return Array the route list
7769
+	 *
7770
+	 */
7771 7771
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
7772 7772
 	{
7773 7773
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7805,11 +7805,11 @@  discard block
 block discarded – undo
7805 7805
 	
7806 7806
 	
7807 7807
 	/**
7808
-	* Gets all route combinations with waypoints
7809
-	*
7810
-	* @return Array the route list
7811
-	*
7812
-	*/
7808
+	 * Gets all route combinations with waypoints
7809
+	 *
7810
+	 * @return Array the route list
7811
+	 *
7812
+	 */
7813 7813
 	public function countAllRoutesWithWaypoints($filters = array())
7814 7814
 	{
7815 7815
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7846,11 +7846,11 @@  discard block
 block discarded – undo
7846 7846
 	}
7847 7847
 	
7848 7848
 	/**
7849
-	* Gets all callsigns that have flown over
7850
-	*
7851
-	* @return Array the callsign list
7852
-	*
7853
-	*/
7849
+	 * Gets all callsigns that have flown over
7850
+	 *
7851
+	 * @return Array the callsign list
7852
+	 *
7853
+	 */
7854 7854
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
7855 7855
 	{
7856 7856
 		global $globalDBdriver;
@@ -7888,11 +7888,11 @@  discard block
 block discarded – undo
7888 7888
 	}
7889 7889
 
7890 7890
 	/**
7891
-	* Gets all callsigns that have flown over
7892
-	*
7893
-	* @return Array the callsign list
7894
-	*
7895
-	*/
7891
+	 * Gets all callsigns that have flown over
7892
+	 *
7893
+	 * @return Array the callsign list
7894
+	 *
7895
+	 */
7896 7896
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7897 7897
 	{
7898 7898
 		global $globalDBdriver;
@@ -7933,11 +7933,11 @@  discard block
 block discarded – undo
7933 7933
 
7934 7934
 
7935 7935
 	/**
7936
-	* Counts all dates
7937
-	*
7938
-	* @return Array the date list
7939
-	*
7940
-	*/
7936
+	 * Counts all dates
7937
+	 *
7938
+	 * @return Array the date list
7939
+	 *
7940
+	 */
7941 7941
 	public function countAllDates($filters = array())
7942 7942
 	{
7943 7943
 		global $globalTimezone, $globalDBdriver;
@@ -7982,11 +7982,11 @@  discard block
 block discarded – undo
7982 7982
 	}
7983 7983
 	
7984 7984
 	/**
7985
-	* Counts all dates
7986
-	*
7987
-	* @return Array the date list
7988
-	*
7989
-	*/
7985
+	 * Counts all dates
7986
+	 *
7987
+	 * @return Array the date list
7988
+	 *
7989
+	 */
7990 7990
 	public function countAllDatesByAirlines($filters = array())
7991 7991
 	{
7992 7992
 		global $globalTimezone, $globalDBdriver;
@@ -8031,11 +8031,11 @@  discard block
 block discarded – undo
8031 8031
 	}	
8032 8032
 	
8033 8033
 	/**
8034
-	* Counts all dates during the last 7 days
8035
-	*
8036
-	* @return Array the date list
8037
-	*
8038
-	*/
8034
+	 * Counts all dates during the last 7 days
8035
+	 *
8036
+	 * @return Array the date list
8037
+	 *
8038
+	 */
8039 8039
 	public function countAllDatesLast7Days($filters = array())
8040 8040
 	{
8041 8041
 		global $globalTimezone, $globalDBdriver;
@@ -8057,7 +8057,7 @@  discard block
 block discarded – undo
8057 8057
 			$query .= " GROUP BY date_name 
8058 8058
 								ORDER BY date_name ASC";
8059 8059
 			$query_data = array(':offset' => $offset);
8060
-    		}
8060
+			}
8061 8061
 		
8062 8062
 		$sth = $this->db->prepare($query);
8063 8063
 		$sth->execute($query_data);
@@ -8077,11 +8077,11 @@  discard block
 block discarded – undo
8077 8077
 	}
8078 8078
 
8079 8079
 	/**
8080
-	* Counts all dates during the last month
8081
-	*
8082
-	* @return Array the date list
8083
-	*
8084
-	*/
8080
+	 * Counts all dates during the last month
8081
+	 *
8082
+	 * @return Array the date list
8083
+	 *
8084
+	 */
8085 8085
 	public function countAllDatesLastMonth($filters = array())
8086 8086
 	{
8087 8087
 		global $globalTimezone, $globalDBdriver;
@@ -8103,7 +8103,7 @@  discard block
 block discarded – undo
8103 8103
 			$query .= " GROUP BY date_name 
8104 8104
 								ORDER BY date_name ASC";
8105 8105
 			$query_data = array(':offset' => $offset);
8106
-    		}
8106
+			}
8107 8107
 		
8108 8108
 		$sth = $this->db->prepare($query);
8109 8109
 		$sth->execute($query_data);
@@ -8124,11 +8124,11 @@  discard block
 block discarded – undo
8124 8124
 
8125 8125
 
8126 8126
 	/**
8127
-	* Counts all dates during the last month
8128
-	*
8129
-	* @return Array the date list
8130
-	*
8131
-	*/
8127
+	 * Counts all dates during the last month
8128
+	 *
8129
+	 * @return Array the date list
8130
+	 *
8131
+	 */
8132 8132
 	public function countAllDatesLastMonthByAirlines($filters = array())
8133 8133
 	{
8134 8134
 		global $globalTimezone, $globalDBdriver;
@@ -8151,7 +8151,7 @@  discard block
 block discarded – undo
8151 8151
 								GROUP BY spotter_output.airline_icao, date_name 
8152 8152
 								ORDER BY date_name ASC";
8153 8153
 			$query_data = array(':offset' => $offset);
8154
-    		}
8154
+			}
8155 8155
 		
8156 8156
 		$sth = $this->db->prepare($query);
8157 8157
 		$sth->execute($query_data);
@@ -8173,11 +8173,11 @@  discard block
 block discarded – undo
8173 8173
 	
8174 8174
 
8175 8175
 	/**
8176
-	* Counts all month
8177
-	*
8178
-	* @return Array the month list
8179
-	*
8180
-	*/
8176
+	 * Counts all month
8177
+	 *
8178
+	 * @return Array the month list
8179
+	 *
8180
+	 */
8181 8181
 	public function countAllMonths($filters = array())
8182 8182
 	{
8183 8183
 		global $globalTimezone, $globalDBdriver;
@@ -8219,11 +8219,11 @@  discard block
 block discarded – undo
8219 8219
 	}
8220 8220
 
8221 8221
 	/**
8222
-	* Counts all month
8223
-	*
8224
-	* @return Array the month list
8225
-	*
8226
-	*/
8222
+	 * Counts all month
8223
+	 *
8224
+	 * @return Array the month list
8225
+	 *
8226
+	 */
8227 8227
 	public function countAllMonthsByAirlines($filters = array())
8228 8228
 	{
8229 8229
 		global $globalTimezone, $globalDBdriver;
@@ -8268,11 +8268,11 @@  discard block
 block discarded – undo
8268 8268
 	}
8269 8269
 
8270 8270
 	/**
8271
-	* Counts all military month
8272
-	*
8273
-	* @return Array the month list
8274
-	*
8275
-	*/
8271
+	 * Counts all military month
8272
+	 *
8273
+	 * @return Array the month list
8274
+	 *
8275
+	 */
8276 8276
 	public function countAllMilitaryMonths($filters = array())
8277 8277
 	{
8278 8278
 		global $globalTimezone, $globalDBdriver;
@@ -8313,11 +8313,11 @@  discard block
 block discarded – undo
8313 8313
 	}
8314 8314
 	
8315 8315
 	/**
8316
-	* Counts all month owners
8317
-	*
8318
-	* @return Array the month list
8319
-	*
8320
-	*/
8316
+	 * Counts all month owners
8317
+	 *
8318
+	 * @return Array the month list
8319
+	 *
8320
+	 */
8321 8321
 	public function countAllMonthsOwners($filters = array())
8322 8322
 	{
8323 8323
 		global $globalTimezone, $globalDBdriver;
@@ -8359,11 +8359,11 @@  discard block
 block discarded – undo
8359 8359
 	}
8360 8360
 	
8361 8361
 	/**
8362
-	* Counts all month owners
8363
-	*
8364
-	* @return Array the month list
8365
-	*
8366
-	*/
8362
+	 * Counts all month owners
8363
+	 *
8364
+	 * @return Array the month list
8365
+	 *
8366
+	 */
8367 8367
 	public function countAllMonthsOwnersByAirlines($filters = array())
8368 8368
 	{
8369 8369
 		global $globalTimezone, $globalDBdriver;
@@ -8406,11 +8406,11 @@  discard block
 block discarded – undo
8406 8406
 	}
8407 8407
 
8408 8408
 	/**
8409
-	* Counts all month pilot
8410
-	*
8411
-	* @return Array the month list
8412
-	*
8413
-	*/
8409
+	 * Counts all month pilot
8410
+	 *
8411
+	 * @return Array the month list
8412
+	 *
8413
+	 */
8414 8414
 	public function countAllMonthsPilots($filters = array())
8415 8415
 	{
8416 8416
 		global $globalTimezone, $globalDBdriver;
@@ -8452,11 +8452,11 @@  discard block
 block discarded – undo
8452 8452
 	}
8453 8453
 	
8454 8454
 	/**
8455
-	* Counts all month pilot
8456
-	*
8457
-	* @return Array the month list
8458
-	*
8459
-	*/
8455
+	 * Counts all month pilot
8456
+	 *
8457
+	 * @return Array the month list
8458
+	 *
8459
+	 */
8460 8460
 	public function countAllMonthsPilotsByAirlines($filters = array())
8461 8461
 	{
8462 8462
 		global $globalTimezone, $globalDBdriver;
@@ -8499,11 +8499,11 @@  discard block
 block discarded – undo
8499 8499
 	}
8500 8500
 
8501 8501
 	/**
8502
-	* Counts all month airline
8503
-	*
8504
-	* @return Array the month list
8505
-	*
8506
-	*/
8502
+	 * Counts all month airline
8503
+	 *
8504
+	 * @return Array the month list
8505
+	 *
8506
+	 */
8507 8507
 	public function countAllMonthsAirlines($filters = array())
8508 8508
 	{
8509 8509
 		global $globalTimezone, $globalDBdriver;
@@ -8545,11 +8545,11 @@  discard block
 block discarded – undo
8545 8545
 	}
8546 8546
 	
8547 8547
 	/**
8548
-	* Counts all month aircraft
8549
-	*
8550
-	* @return Array the month list
8551
-	*
8552
-	*/
8548
+	 * Counts all month aircraft
8549
+	 *
8550
+	 * @return Array the month list
8551
+	 *
8552
+	 */
8553 8553
 	public function countAllMonthsAircrafts($filters = array())
8554 8554
 	{
8555 8555
 		global $globalTimezone, $globalDBdriver;
@@ -8592,11 +8592,11 @@  discard block
 block discarded – undo
8592 8592
 	
8593 8593
 
8594 8594
 	/**
8595
-	* Counts all month aircraft
8596
-	*
8597
-	* @return Array the month list
8598
-	*
8599
-	*/
8595
+	 * Counts all month aircraft
8596
+	 *
8597
+	 * @return Array the month list
8598
+	 *
8599
+	 */
8600 8600
 	public function countAllMonthsAircraftsByAirlines($filters = array())
8601 8601
 	{
8602 8602
 		global $globalTimezone, $globalDBdriver;
@@ -8639,11 +8639,11 @@  discard block
 block discarded – undo
8639 8639
 	}
8640 8640
 
8641 8641
 	/**
8642
-	* Counts all month real arrival
8643
-	*
8644
-	* @return Array the month list
8645
-	*
8646
-	*/
8642
+	 * Counts all month real arrival
8643
+	 *
8644
+	 * @return Array the month list
8645
+	 *
8646
+	 */
8647 8647
 	public function countAllMonthsRealArrivals($filters = array())
8648 8648
 	{
8649 8649
 		global $globalTimezone, $globalDBdriver;
@@ -8686,11 +8686,11 @@  discard block
 block discarded – undo
8686 8686
 	
8687 8687
 
8688 8688
 	/**
8689
-	* Counts all month real arrival
8690
-	*
8691
-	* @return Array the month list
8692
-	*
8693
-	*/
8689
+	 * Counts all month real arrival
8690
+	 *
8691
+	 * @return Array the month list
8692
+	 *
8693
+	 */
8694 8694
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
8695 8695
 	{
8696 8696
 		global $globalTimezone, $globalDBdriver;
@@ -8734,11 +8734,11 @@  discard block
 block discarded – undo
8734 8734
 	
8735 8735
 
8736 8736
 	/**
8737
-	* Counts all dates during the last year
8738
-	*
8739
-	* @return Array the date list
8740
-	*
8741
-	*/
8737
+	 * Counts all dates during the last year
8738
+	 *
8739
+	 * @return Array the date list
8740
+	 *
8741
+	 */
8742 8742
 	public function countAllMonthsLastYear($filters)
8743 8743
 	{
8744 8744
 		global $globalTimezone, $globalDBdriver;
@@ -8760,7 +8760,7 @@  discard block
 block discarded – undo
8760 8760
 			$query .= " GROUP BY year_name, month_name
8761 8761
 								ORDER BY year_name, month_name ASC";
8762 8762
 			$query_data = array(':offset' => $offset);
8763
-    		}
8763
+			}
8764 8764
 		
8765 8765
 		$sth = $this->db->prepare($query);
8766 8766
 		$sth->execute($query_data);
@@ -8783,11 +8783,11 @@  discard block
 block discarded – undo
8783 8783
 	
8784 8784
 	
8785 8785
 	/**
8786
-	* Counts all hours
8787
-	*
8788
-	* @return Array the hour list
8789
-	*
8790
-	*/
8786
+	 * Counts all hours
8787
+	 *
8788
+	 * @return Array the hour list
8789
+	 *
8790
+	 */
8791 8791
 	public function countAllHours($orderby,$filters = array())
8792 8792
 	{
8793 8793
 		global $globalTimezone, $globalDBdriver;
@@ -8848,11 +8848,11 @@  discard block
 block discarded – undo
8848 8848
 	}
8849 8849
 	
8850 8850
 	/**
8851
-	* Counts all hours
8852
-	*
8853
-	* @return Array the hour list
8854
-	*
8855
-	*/
8851
+	 * Counts all hours
8852
+	 *
8853
+	 * @return Array the hour list
8854
+	 *
8855
+	 */
8856 8856
 	public function countAllHoursByAirlines($orderby, $filters = array())
8857 8857
 	{
8858 8858
 		global $globalTimezone, $globalDBdriver;
@@ -8915,11 +8915,11 @@  discard block
 block discarded – undo
8915 8915
 
8916 8916
 
8917 8917
 	/**
8918
-	* Counts all hours by airline
8919
-	*
8920
-	* @return Array the hour list
8921
-	*
8922
-	*/
8918
+	 * Counts all hours by airline
8919
+	 *
8920
+	 * @return Array the hour list
8921
+	 *
8922
+	 */
8923 8923
 	public function countAllHoursByAirline($airline_icao, $filters = array())
8924 8924
 	{
8925 8925
 		global $globalTimezone, $globalDBdriver;
@@ -8965,11 +8965,11 @@  discard block
 block discarded – undo
8965 8965
 	
8966 8966
 	
8967 8967
 	/**
8968
-	* Counts all hours by aircraft
8969
-	*
8970
-	* @return Array the hour list
8971
-	*
8972
-	*/
8968
+	 * Counts all hours by aircraft
8969
+	 *
8970
+	 * @return Array the hour list
8971
+	 *
8972
+	 */
8973 8973
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
8974 8974
 	{
8975 8975
 		global $globalTimezone, $globalDBdriver;
@@ -9012,11 +9012,11 @@  discard block
 block discarded – undo
9012 9012
 	
9013 9013
 	
9014 9014
 	/**
9015
-	* Counts all hours by aircraft registration
9016
-	*
9017
-	* @return Array the hour list
9018
-	*
9019
-	*/
9015
+	 * Counts all hours by aircraft registration
9016
+	 *
9017
+	 * @return Array the hour list
9018
+	 *
9019
+	 */
9020 9020
 	public function countAllHoursByRegistration($registration, $filters = array())
9021 9021
 	{
9022 9022
 		global $globalTimezone, $globalDBdriver;
@@ -9059,11 +9059,11 @@  discard block
 block discarded – undo
9059 9059
 	
9060 9060
 	
9061 9061
 	/**
9062
-	* Counts all hours by airport
9063
-	*
9064
-	* @return Array the hour list
9065
-	*
9066
-	*/
9062
+	 * Counts all hours by airport
9063
+	 *
9064
+	 * @return Array the hour list
9065
+	 *
9066
+	 */
9067 9067
 	public function countAllHoursByAirport($airport_icao, $filters = array())
9068 9068
 	{
9069 9069
 		global $globalTimezone, $globalDBdriver;
@@ -9107,11 +9107,11 @@  discard block
 block discarded – undo
9107 9107
 	
9108 9108
 	
9109 9109
 	/**
9110
-	* Counts all hours by manufacturer
9111
-	*
9112
-	* @return Array the hour list
9113
-	*
9114
-	*/
9110
+	 * Counts all hours by manufacturer
9111
+	 *
9112
+	 * @return Array the hour list
9113
+	 *
9114
+	 */
9115 9115
 	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
9116 9116
 	{
9117 9117
 		global $globalTimezone, $globalDBdriver;
@@ -9155,11 +9155,11 @@  discard block
 block discarded – undo
9155 9155
 	
9156 9156
 	
9157 9157
 	/**
9158
-	* Counts all hours by date
9159
-	*
9160
-	* @return Array the hour list
9161
-	*
9162
-	*/
9158
+	 * Counts all hours by date
9159
+	 *
9160
+	 * @return Array the hour list
9161
+	 *
9162
+	 */
9163 9163
 	public function countAllHoursByDate($date, $filters = array())
9164 9164
 	{
9165 9165
 		global $globalTimezone, $globalDBdriver;
@@ -9203,11 +9203,11 @@  discard block
 block discarded – undo
9203 9203
 	
9204 9204
 	
9205 9205
 	/**
9206
-	* Counts all hours by a ident/callsign
9207
-	*
9208
-	* @return Array the hour list
9209
-	*
9210
-	*/
9206
+	 * Counts all hours by a ident/callsign
9207
+	 *
9208
+	 * @return Array the hour list
9209
+	 *
9210
+	 */
9211 9211
 	public function countAllHoursByIdent($ident, $filters = array())
9212 9212
 	{
9213 9213
 		global $globalTimezone, $globalDBdriver;
@@ -9252,11 +9252,11 @@  discard block
 block discarded – undo
9252 9252
 	
9253 9253
 	
9254 9254
 	/**
9255
-	* Counts all hours by route
9256
-	*
9257
-	* @return Array the hour list
9258
-	*
9259
-	*/
9255
+	 * Counts all hours by route
9256
+	 *
9257
+	 * @return Array the hour list
9258
+	 *
9259
+	 */
9260 9260
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
9261 9261
 	{
9262 9262
 		global $globalTimezone, $globalDBdriver;
@@ -9300,11 +9300,11 @@  discard block
 block discarded – undo
9300 9300
 	
9301 9301
 	
9302 9302
 	/**
9303
-	* Counts all hours by country
9304
-	*
9305
-	* @return Array the hour list
9306
-	*
9307
-	*/
9303
+	 * Counts all hours by country
9304
+	 *
9305
+	 * @return Array the hour list
9306
+	 *
9307
+	 */
9308 9308
 	public function countAllHoursByCountry($country, $filters = array())
9309 9309
 	{
9310 9310
 		global $globalTimezone, $globalDBdriver;
@@ -9349,11 +9349,11 @@  discard block
 block discarded – undo
9349 9349
 
9350 9350
 
9351 9351
 	/**
9352
-	* Counts all aircraft that have flown over
9353
-	*
9354
-	* @return Integer the number of aircrafts
9355
-	*
9356
-	*/
9352
+	 * Counts all aircraft that have flown over
9353
+	 *
9354
+	 * @return Integer the number of aircrafts
9355
+	 *
9356
+	 */
9357 9357
 	public function countOverallAircrafts($filters = array())
9358 9358
 	{
9359 9359
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9365,11 +9365,11 @@  discard block
 block discarded – undo
9365 9365
 	}
9366 9366
 
9367 9367
 	/**
9368
-	* Counts all flight that really arrival
9369
-	*
9370
-	* @return Integer the number of aircrafts
9371
-	*
9372
-	*/
9368
+	 * Counts all flight that really arrival
9369
+	 *
9370
+	 * @return Integer the number of aircrafts
9371
+	 *
9372
+	 */
9373 9373
 	public function countOverallArrival($filters = array())
9374 9374
 	{
9375 9375
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9382,11 +9382,11 @@  discard block
 block discarded – undo
9382 9382
 	}
9383 9383
 
9384 9384
 	/**
9385
-	* Counts all pilots that have flown over
9386
-	*
9387
-	* @return Integer the number of pilots
9388
-	*
9389
-	*/
9385
+	 * Counts all pilots that have flown over
9386
+	 *
9387
+	 * @return Integer the number of pilots
9388
+	 *
9389
+	 */
9390 9390
 	public function countOverallPilots($filters = array())
9391 9391
 	{
9392 9392
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9398,11 +9398,11 @@  discard block
 block discarded – undo
9398 9398
 	}
9399 9399
 
9400 9400
 	/**
9401
-	* Counts all owners that have flown over
9402
-	*
9403
-	* @return Integer the number of owners
9404
-	*
9405
-	*/
9401
+	 * Counts all owners that have flown over
9402
+	 *
9403
+	 * @return Integer the number of owners
9404
+	 *
9405
+	 */
9406 9406
 	public function countOverallOwners($filters = array())
9407 9407
 	{
9408 9408
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9415,11 +9415,11 @@  discard block
 block discarded – undo
9415 9415
 	
9416 9416
 	
9417 9417
 	/**
9418
-	* Counts all flights that have flown over
9419
-	*
9420
-	* @return Integer the number of flights
9421
-	*
9422
-	*/
9418
+	 * Counts all flights that have flown over
9419
+	 *
9420
+	 * @return Integer the number of flights
9421
+	 *
9422
+	 */
9423 9423
 	public function countOverallFlights($filters = array())
9424 9424
 	{
9425 9425
 		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
@@ -9432,11 +9432,11 @@  discard block
 block discarded – undo
9432 9432
 	}
9433 9433
 	
9434 9434
 	/**
9435
-	* Counts all military flights that have flown over
9436
-	*
9437
-	* @return Integer the number of flights
9438
-	*
9439
-	*/
9435
+	 * Counts all military flights that have flown over
9436
+	 *
9437
+	 * @return Integer the number of flights
9438
+	 *
9439
+	 */
9440 9440
 	public function countOverallMilitaryFlights($filters = array())
9441 9441
 	{
9442 9442
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9451,11 +9451,11 @@  discard block
 block discarded – undo
9451 9451
 	
9452 9452
 	
9453 9453
 	/**
9454
-	* Counts all airlines that have flown over
9455
-	*
9456
-	* @return Integer the number of airlines
9457
-	*
9458
-	*/
9454
+	 * Counts all airlines that have flown over
9455
+	 *
9456
+	 * @return Integer the number of airlines
9457
+	 *
9458
+	 */
9459 9459
 	public function countOverallAirlines($filters = array())
9460 9460
 	{
9461 9461
 		$query  = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
@@ -9469,11 +9469,11 @@  discard block
 block discarded – undo
9469 9469
 
9470 9470
   
9471 9471
 	/**
9472
-	* Counts all hours of today
9473
-	*
9474
-	* @return Array the hour list
9475
-	*
9476
-	*/
9472
+	 * Counts all hours of today
9473
+	 *
9474
+	 * @return Array the hour list
9475
+	 *
9476
+	 */
9477 9477
 	public function countAllHoursFromToday($filters = array())
9478 9478
 	{
9479 9479
 		global $globalTimezone, $globalDBdriver;
@@ -9513,11 +9513,11 @@  discard block
 block discarded – undo
9513 9513
 	}
9514 9514
     
9515 9515
 	/**
9516
-	* Gets all the spotter information based on calculated upcoming flights
9517
-	*
9518
-	* @return Array the spotter information
9519
-	*
9520
-	*/
9516
+	 * Gets all the spotter information based on calculated upcoming flights
9517
+	 *
9518
+	 * @return Array the spotter information
9519
+	 *
9520
+	 */
9521 9521
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
9522 9522
 	{
9523 9523
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -9592,12 +9592,12 @@  discard block
 block discarded – undo
9592 9592
 	}
9593 9593
     
9594 9594
     
9595
-     /**
9596
-	* Gets the Barrie Spotter ID based on the FlightAware ID
9597
-	*
9598
-	* @return Integer the Barrie Spotter ID
9595
+	 /**
9596
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
9597
+	  *
9598
+	  * @return Integer the Barrie Spotter ID
9599 9599
 q	*
9600
-	*/
9600
+	  */
9601 9601
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
9602 9602
 	{
9603 9603
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -9618,13 +9618,13 @@  discard block
 block discarded – undo
9618 9618
   
9619 9619
  
9620 9620
 	/**
9621
-	* Parses a date string
9622
-	*
9623
-	* @param String $dateString the date string
9624
-	* @param String $timezone the timezone of a user
9625
-	* @return Array the time information
9626
-	*
9627
-	*/
9621
+	 * Parses a date string
9622
+	 *
9623
+	 * @param String $dateString the date string
9624
+	 * @param String $timezone the timezone of a user
9625
+	 * @return Array the time information
9626
+	 *
9627
+	 */
9628 9628
 	public function parseDateString($dateString, $timezone = '')
9629 9629
 	{
9630 9630
 		$time_array = array();
@@ -9660,12 +9660,12 @@  discard block
 block discarded – undo
9660 9660
 	
9661 9661
 	
9662 9662
 	/**
9663
-	* Parses the direction degrees to working
9664
-	*
9665
-	* @param Float $direction the direction in degrees
9666
-	* @return Array the direction information
9667
-	*
9668
-	*/
9663
+	 * Parses the direction degrees to working
9664
+	 *
9665
+	 * @param Float $direction the direction in degrees
9666
+	 * @return Array the direction information
9667
+	 *
9668
+	 */
9669 9669
 	public function parseDirection($direction = 0)
9670 9670
 	{
9671 9671
 		if ($direction == '') $direction = 0;
@@ -9744,12 +9744,12 @@  discard block
 block discarded – undo
9744 9744
 	
9745 9745
 	
9746 9746
 	/**
9747
-	* Gets the aircraft registration
9748
-	*
9749
-	* @param String $flightaware_id the flight aware id
9750
-	* @return String the aircraft registration
9751
-	*
9752
-	*/
9747
+	 * Gets the aircraft registration
9748
+	 *
9749
+	 * @param String $flightaware_id the flight aware id
9750
+	 * @return String the aircraft registration
9751
+	 *
9752
+	 */
9753 9753
 	
9754 9754
 	public function getAircraftRegistration($flightaware_id)
9755 9755
 	{
@@ -9778,12 +9778,12 @@  discard block
 block discarded – undo
9778 9778
 
9779 9779
 
9780 9780
 	/**
9781
-	* Gets the aircraft registration from ModeS
9782
-	*
9783
-	* @param String $aircraft_modes the flight ModeS in hex
9784
-	* @return String the aircraft registration
9785
-	*
9786
-	*/
9781
+	 * Gets the aircraft registration from ModeS
9782
+	 *
9783
+	 * @param String $aircraft_modes the flight ModeS in hex
9784
+	 * @return String the aircraft registration
9785
+	 *
9786
+	 */
9787 9787
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
9788 9788
 	{
9789 9789
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9796,19 +9796,19 @@  discard block
 block discarded – undo
9796 9796
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9797 9797
 		$sth->closeCursor();
9798 9798
 		if (count($row) > 0) {
9799
-		    //return $row['Registration'];
9800
-		    return $row['registration'];
9799
+			//return $row['Registration'];
9800
+			return $row['registration'];
9801 9801
 		} else return '';
9802 9802
 	
9803 9803
 	}
9804 9804
 
9805 9805
 	/**
9806
-	* Gets the aircraft type from ModeS
9807
-	*
9808
-	* @param String $aircraft_modes the flight ModeS in hex
9809
-	* @return String the aircraft type
9810
-	*
9811
-	*/
9806
+	 * Gets the aircraft type from ModeS
9807
+	 *
9808
+	 * @param String $aircraft_modes the flight ModeS in hex
9809
+	 * @return String the aircraft type
9810
+	 *
9811
+	 */
9812 9812
 	public function getAircraftTypeBymodeS($aircraft_modes)
9813 9813
 	{
9814 9814
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9821,19 +9821,19 @@  discard block
 block discarded – undo
9821 9821
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9822 9822
 		$sth->closeCursor();
9823 9823
 		if (count($row) > 0) {
9824
-		    if ($row['type_flight'] == null) return '';
9825
-		    else return $row['type_flight'];
9824
+			if ($row['type_flight'] == null) return '';
9825
+			else return $row['type_flight'];
9826 9826
 		} else return '';
9827 9827
 	
9828 9828
 	}
9829 9829
 
9830 9830
 	/**
9831
-	* Gets Country from latitude/longitude
9832
-	*
9833
-	* @param Float $latitude latitute of the flight
9834
-	* @param Float $longitude longitute of the flight
9835
-	* @return String the countrie
9836
-	*/
9831
+	 * Gets Country from latitude/longitude
9832
+	 *
9833
+	 * @param Float $latitude latitute of the flight
9834
+	 * @param Float $longitude longitute of the flight
9835
+	 * @return String the countrie
9836
+	 */
9837 9837
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
9838 9838
 	{
9839 9839
 		global $globalDBdriver, $globalDebug;
@@ -9870,11 +9870,11 @@  discard block
 block discarded – undo
9870 9870
 	}
9871 9871
 
9872 9872
 	/**
9873
-	* Gets Country from iso2
9874
-	*
9875
-	* @param String $iso2 ISO2 country code
9876
-	* @return String the countrie
9877
-	*/
9873
+	 * Gets Country from iso2
9874
+	 *
9875
+	 * @param String $iso2 ISO2 country code
9876
+	 * @return String the countrie
9877
+	 */
9878 9878
 	public function getCountryFromISO2($iso2)
9879 9879
 	{
9880 9880
 		global $globalDBdriver, $globalDebug;
@@ -9902,12 +9902,12 @@  discard block
 block discarded – undo
9902 9902
 	}
9903 9903
 
9904 9904
 	/**
9905
-	* converts the registration code using the country prefix
9906
-	*
9907
-	* @param String $registration the aircraft registration
9908
-	* @return String the aircraft registration
9909
-	*
9910
-	*/
9905
+	 * converts the registration code using the country prefix
9906
+	 *
9907
+	 * @param String $registration the aircraft registration
9908
+	 * @return String the aircraft registration
9909
+	 *
9910
+	 */
9911 9911
 	public function convertAircraftRegistration($registration)
9912 9912
 	{
9913 9913
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9959,12 +9959,12 @@  discard block
 block discarded – undo
9959 9959
 	}
9960 9960
 
9961 9961
 	/**
9962
-	* Country from the registration code
9963
-	*
9964
-	* @param String $registration the aircraft registration
9965
-	* @return String the country
9966
-	*
9967
-	*/
9962
+	 * Country from the registration code
9963
+	 *
9964
+	 * @param String $registration the aircraft registration
9965
+	 * @return String the country
9966
+	 *
9967
+	 */
9968 9968
 	public function countryFromAircraftRegistration($registration)
9969 9969
 	{
9970 9970
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9983,8 +9983,8 @@  discard block
 block discarded – undo
9983 9983
 				$country = $row['country'];
9984 9984
 			}
9985 9985
 		} else {
9986
-    			$registration_1 = substr($registration, 0, 1);
9987
-		        $registration_2 = substr($registration, 0, 2);
9986
+				$registration_1 = substr($registration, 0, 1);
9987
+				$registration_2 = substr($registration, 0, 2);
9988 9988
 
9989 9989
 			$country = '';
9990 9990
 			//first get the prefix based on two characters
@@ -10020,12 +10020,12 @@  discard block
 block discarded – undo
10020 10020
 	}
10021 10021
 
10022 10022
 	/**
10023
-	* Registration prefix from the registration code
10024
-	*
10025
-	* @param String $registration the aircraft registration
10026
-	* @return String the registration prefix
10027
-	*
10028
-	*/
10023
+	 * Registration prefix from the registration code
10024
+	 *
10025
+	 * @param String $registration the aircraft registration
10026
+	 * @return String the registration prefix
10027
+	 *
10028
+	 */
10029 10029
 	public function registrationPrefixFromAircraftRegistration($registration)
10030 10030
 	{
10031 10031
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -10044,8 +10044,8 @@  discard block
 block discarded – undo
10044 10044
 				//$country = $row['country'];
10045 10045
 			}
10046 10046
 		} else {
10047
-    			$registration_1 = substr($registration, 0, 1);
10048
-		        $registration_2 = substr($registration, 0, 2);
10047
+				$registration_1 = substr($registration, 0, 1);
10048
+				$registration_2 = substr($registration, 0, 2);
10049 10049
 
10050 10050
 			//first get the prefix based on two characters
10051 10051
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
@@ -10081,12 +10081,12 @@  discard block
 block discarded – undo
10081 10081
 
10082 10082
 
10083 10083
 	/**
10084
-	* Country from the registration code
10085
-	*
10086
-	* @param String $registration the aircraft registration
10087
-	* @return String the country
10088
-	*
10089
-	*/
10084
+	 * Country from the registration code
10085
+	 *
10086
+	 * @param String $registration the aircraft registration
10087
+	 * @return String the country
10088
+	 *
10089
+	 */
10090 10090
 	public function countryFromAircraftRegistrationCode($registration)
10091 10091
 	{
10092 10092
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -10103,11 +10103,11 @@  discard block
 block discarded – undo
10103 10103
 	}
10104 10104
 	
10105 10105
 	/**
10106
-	* Set a new highlight value for a flight
10107
-	*
10108
-	* @param String $flightaware_id flightaware_id from spotter_output table
10109
-	* @param String $highlight New highlight value
10110
-	*/
10106
+	 * Set a new highlight value for a flight
10107
+	 *
10108
+	 * @param String $flightaware_id flightaware_id from spotter_output table
10109
+	 * @param String $highlight New highlight value
10110
+	 */
10111 10111
 	public function setHighlightFlight($flightaware_id,$highlight) {
10112 10112
 		
10113 10113
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -10116,12 +10116,12 @@  discard block
 block discarded – undo
10116 10116
 	}
10117 10117
 
10118 10118
 	/**
10119
-	* Set a new highlight value for a flight by Registration
10120
-	*
10121
-	* @param String $registration Registration of the aircraft
10122
-	* @param String $date Date of spotted aircraft
10123
-	* @param String $highlight New highlight value
10124
-	*/
10119
+	 * Set a new highlight value for a flight by Registration
10120
+	 *
10121
+	 * @param String $registration Registration of the aircraft
10122
+	 * @param String $date Date of spotted aircraft
10123
+	 * @param String $highlight New highlight value
10124
+	 */
10125 10125
 	public function setHighlightFlightByRegistration($registration,$highlight, $date = '') {
10126 10126
 		if ($date == '') {
10127 10127
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)";
@@ -10135,12 +10135,12 @@  discard block
 block discarded – undo
10135 10135
 	}
10136 10136
 	
10137 10137
 	/**
10138
-	* Gets the short url from bit.ly
10139
-	*
10140
-	* @param String $url the full url
10141
-	* @return String the bit.ly url
10142
-	*
10143
-	*/
10138
+	 * Gets the short url from bit.ly
10139
+	 *
10140
+	 * @param String $url the full url
10141
+	 * @return String the bit.ly url
10142
+	 *
10143
+	 */
10144 10144
 	public function getBitlyURL($url)
10145 10145
 	{
10146 10146
 		global $globalBitlyAccessToken;
@@ -10429,11 +10429,11 @@  discard block
 block discarded – undo
10429 10429
 			$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 
10430 10430
 	                      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)) 
10431 10431
 	                      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;";
10432
-                } else {
10432
+				} else {
10433 10433
 			$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 
10434 10434
 	                      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)) 
10435 10435
 	                      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;";
10436
-    		}
10436
+			}
10437 10437
 		$sth = $this->db->prepare($query);
10438 10438
 		$sth->execute();
10439 10439
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
Spacing   +1029 added lines, -1029 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 $aircraft_correct_icaotype = array('CL64' => 'CL60',
9 9
 					'F9LX' => 'F900',
10 10
 					'K35T' => 'K35R',
@@ -59,45 +59,45 @@  discard block
 block discarded – undo
59 59
 	* @param Array $filter the filter
60 60
 	* @return Array the SQL part
61 61
 	*/
62
-	public function getFilter($filter = array(),$where = false,$and = false) {
62
+	public function getFilter($filter = array(), $where = false, $and = false) {
63 63
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
64 64
 		$filters = array();
65 65
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
66 66
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
67 67
 				$filters = $globalStatsFilters[$globalFilterName];
68 68
 			} else {
69
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
69
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
70 70
 			}
71 71
 		}
72
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
72
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
73 73
 		$filter_query_join = '';
74 74
 		$filter_query_where = '';
75
-		foreach($filters as $flt) {
75
+		foreach ($filters as $flt) {
76 76
 			if (isset($flt['airlines']) && !empty($flt['airlines'])) {
77 77
 				if ($flt['airlines'][0] != '') {
78 78
 					if (isset($flt['source'])) {
79
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
79
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
80 80
 					} else {
81
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
81
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
82 82
 					}
83 83
 				}
84 84
 			}
85 85
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
86 86
 				if (isset($flt['source'])) {
87
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
87
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
88 88
 				} else {
89
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
89
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
90 90
 				}
91 91
 			}
92 92
 			if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']))) {
93 93
 				if (isset($flt['source'])) {
94
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
94
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
95 95
 				}
96 96
 			}
97 97
 		}
98 98
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
99 99
 			if ($filter['airlines'][0] != '') {
100
-					$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";
100
+					$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";
101 101
 			}
102 102
 		}
103 103
 		if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
@@ -107,19 +107,19 @@  discard block
 block discarded – undo
107 107
 			$filter_query_join .= " INNER JOIN (SELECT icao FROM airlines WHERE alliance = '".$filter['alliance']."') sal ON sal.icao = spotter_output.airline_icao ";
108 108
 		}
109 109
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
110
-				$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";
110
+				$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";
111 111
 			}
112 112
 		if (isset($filter['source']) && !empty($filter['source'])) {
113
-			$filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
113
+			$filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')";
114 114
 		}
115 115
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
116 116
 			$filter_query_where = " WHERE ident = '".$filter['ident']."'";
117 117
 		}
118 118
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
119 119
 			if ($filter_query_where == '') {
120
-				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
120
+				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
121 121
 			} else {
122
-				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
122
+				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
123 123
 			}
124 124
 		}
125 125
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	* @return Array the spotter information
138 138
 	*
139 139
 	*/
140
-	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
140
+	public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false)
141 141
 	{
142 142
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
143 143
 		$Image = new Image($this->db);
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 			$sth = $this->db->prepare($query.$limitQuery);
168 168
 			$sth->execute($params);
169 169
 		} catch (PDOException $e) {
170
-			printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery);
170
+			printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery);
171 171
 			exit();
172 172
 		}
173 173
 		
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		$spotter_array = array();
178 178
 		
179 179
 
180
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
180
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
181 181
 		{
182 182
 			$num_rows++;
183 183
 			$temp_array = array();
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 			if (isset($row['route_stop'])) {
223 223
 				$temp_array['route_stop'] = $row['route_stop'];
224 224
 				if ($row['route_stop'] != '') {
225
-					$allroute = explode(' ',$row['route_stop']);
225
+					$allroute = explode(' ', $row['route_stop']);
226 226
 			
227 227
 					foreach ($allroute as $route) {
228 228
 						$route_airport_array = $this->getAllAirportInfo($route);
@@ -277,11 +277,11 @@  discard block
 block discarded – undo
277 277
 				{
278 278
 					$temp_array['date'] = "about ".$dateArray['hours']." hours ago";
279 279
 				} else {
280
-					$temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC"));
280
+					$temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC"));
281 281
 				}
282 282
 				$temp_array['date_minutes_past'] = $dateArray['minutes'];
283
-				$temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC"));
284
-				$temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC"));
283
+				$temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC"));
284
+				$temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC"));
285 285
 				$temp_array['date_unix'] = strtotime($row['date']." UTC");
286 286
 			}
287 287
 			
@@ -315,9 +315,9 @@  discard block
 block discarded – undo
315 315
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
316 316
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
317 317
 					if (is_numeric(substr($row['ident'], 2, 1))) {
318
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2),$fromsource);
318
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2), $fromsource);
319 319
 					} elseif (is_numeric(substr($row['ident'], 3, 1))) {
320
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
320
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
321 321
 					} else {
322 322
 						$airline_array = $this->getAllAirlineInfo('NA');
323 323
 					}
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 				}
355 355
 			}
356 356
 			if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') {
357
-				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'],3));
357
+				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'], 3));
358 358
 				//$acars_array = ACARS->getLiveAcarsData('BA40YL');
359 359
 				if (count($acars_array) > 0) {
360 360
 					$temp_array['acars'] = $acars_array;
@@ -371,11 +371,11 @@  discard block
 block discarded – undo
371 371
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
372 372
 			}
373 373
 
374
-			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
374
+			if ($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
375 375
 			{
376 376
 				if ($globalIVAO) {
377
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
378
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
377
+					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('', $temp_array['aircraft_type'], $temp_array['airline_icao']);
378
+					else $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type']);
379 379
 				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
380 380
 				if (count($image_array) > 0) {
381 381
 					$temp_array['image'] = $image_array[0]['image'];
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
400 400
 			}
401 401
 			
402
-			if ((!isset($globalIVAO) || ! $globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
402
+			if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
403 403
 				if ($schedules === true) {
404 404
 					$schedule_array = $Schedule->getSchedule($temp_array['ident']);
405 405
 					//print_r($schedule_array);
@@ -481,12 +481,12 @@  discard block
 block discarded – undo
481 481
 			if (isset($row['squawk'])) {
482 482
 				$temp_array['squawk'] = $row['squawk'];
483 483
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
484
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
485
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
484
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['country_iso2']);
485
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
486 486
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
487
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
488
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
489
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
487
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['over_country']);
488
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
489
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
490 490
 			}
491 491
     			
492 492
 			$temp_array['query_number_rows'] = $num_rows;
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 	* @return Array the spotter information
506 506
 	*
507 507
 	*/
508
-	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
508
+	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array())
509 509
 	{
510 510
 		global $globalTimezone, $globalDBdriver;
511 511
 		require_once(dirname(__FILE__).'/class.Translation.php');
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 
516 516
 		$query_values = array();
517 517
 		$additional_query = '';
518
-		$filter_query = $this->getFilter($filters,true,true);
518
+		$filter_query = $this->getFilter($filters, true, true);
519 519
 		if ($q != "")
520 520
 		{
521 521
 			if (!is_string($q))
@@ -523,8 +523,8 @@  discard block
 block discarded – undo
523 523
 				return false;
524 524
 			} else {
525 525
 				$q_array = explode(" ", $q);
526
-				foreach ($q_array as $q_item){
527
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
526
+				foreach ($q_array as $q_item) {
527
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
528 528
 					$additional_query .= " AND (";
529 529
 					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
530 530
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
@@ -556,37 +556,37 @@  discard block
 block discarded – undo
556 556
 
557 557
 		if ($registration != "")
558 558
 		{
559
-			$registration = filter_var($registration,FILTER_SANITIZE_STRING);
559
+			$registration = filter_var($registration, FILTER_SANITIZE_STRING);
560 560
 			if (!is_string($registration))
561 561
 			{
562 562
 				return false;
563 563
 			} else {
564 564
 				$additional_query .= " AND spotter_output.registration = :registration";
565
-				$query_values = array_merge($query_values,array(':registration' => $registration));
565
+				$query_values = array_merge($query_values, array(':registration' => $registration));
566 566
 			}
567 567
 		}
568 568
 
569 569
 		if ($aircraft_icao != "")
570 570
 		{
571
-			$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
571
+			$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
572 572
 			if (!is_string($aircraft_icao))
573 573
 			{
574 574
 				return false;
575 575
 			} else {
576 576
 				$additional_query .= " AND spotter_output.aircraft_icao = :aircraft_icao";
577
-				$query_values = array_merge($query_values,array(':aircraft_icao' => $aircraft_icao));
577
+				$query_values = array_merge($query_values, array(':aircraft_icao' => $aircraft_icao));
578 578
 			}
579 579
 		}
580 580
 
581 581
 		if ($aircraft_manufacturer != "")
582 582
 		{
583
-			$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
583
+			$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
584 584
 			if (!is_string($aircraft_manufacturer))
585 585
 			{
586 586
 				return false;
587 587
 			} else {
588 588
 				$additional_query .= " AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer";
589
-				$query_values = array_merge($query_values,array(':aircraft_manufacturer' => $aircraft_manufacturer));
589
+				$query_values = array_merge($query_values, array(':aircraft_manufacturer' => $aircraft_manufacturer));
590 590
 			}
591 591
 		}
592 592
 
@@ -602,25 +602,25 @@  discard block
 block discarded – undo
602 602
 
603 603
 		if ($airline_icao != "")
604 604
 		{
605
-			$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
605
+			$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
606 606
 			if (!is_string($airline_icao))
607 607
 			{
608 608
 				return false;
609 609
 			} else {
610 610
 				$additional_query .= " AND spotter_output.airline_icao = :airline_icao";
611
-				$query_values = array_merge($query_values,array(':airline_icao' => $airline_icao));
611
+				$query_values = array_merge($query_values, array(':airline_icao' => $airline_icao));
612 612
 			}
613 613
 		}
614 614
 
615 615
 		if ($airline_country != "")
616 616
 		{
617
-			$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
617
+			$airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING);
618 618
 			if (!is_string($airline_country))
619 619
 			{
620 620
 				return false;
621 621
 			} else {
622 622
 				$additional_query .= " AND spotter_output.airline_country = :airline_country";
623
-				$query_values = array_merge($query_values,array(':airline_country' => $airline_country));
623
+				$query_values = array_merge($query_values, array(':airline_country' => $airline_country));
624 624
 			}
625 625
 		}
626 626
 
@@ -647,31 +647,31 @@  discard block
 block discarded – undo
647 647
 
648 648
 		if ($airport != "")
649 649
 		{
650
-			$airport = filter_var($airport,FILTER_SANITIZE_STRING);
650
+			$airport = filter_var($airport, FILTER_SANITIZE_STRING);
651 651
 			if (!is_string($airport))
652 652
 			{
653 653
 				return false;
654 654
 			} else {
655 655
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :airport OR spotter_output.arrival_airport_icao = :airport)";
656
-				$query_values = array_merge($query_values,array(':airport' => $airport));
656
+				$query_values = array_merge($query_values, array(':airport' => $airport));
657 657
 			}
658 658
 		}
659 659
 
660 660
 		if ($airport_country != "")
661 661
 		{
662
-			$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
662
+			$airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING);
663 663
 			if (!is_string($airport_country))
664 664
 			{
665 665
 				return false;
666 666
 			} else {
667 667
 				$additional_query .= " AND (spotter_output.departure_airport_country = :airport_country OR spotter_output.arrival_airport_country = :airport_country)";
668
-				$query_values = array_merge($query_values,array(':airport_country' => $airport_country));
668
+				$query_values = array_merge($query_values, array(':airport_country' => $airport_country));
669 669
 			}
670 670
 		}
671 671
     
672 672
 		if ($callsign != "")
673 673
 		{
674
-			$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
674
+			$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
675 675
 			if (!is_string($callsign))
676 676
 			{
677 677
 				return false;
@@ -679,79 +679,79 @@  discard block
 block discarded – undo
679 679
 				$translate = $Translation->ident2icao($callsign);
680 680
 				if ($translate != $callsign) {
681 681
 					$additional_query .= " AND (spotter_output.ident = :callsign OR spotter_output.ident = :translate)";
682
-					$query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate));
682
+					$query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate));
683 683
 				} else {
684 684
 					$additional_query .= " AND spotter_output.ident = :callsign";
685
-					$query_values = array_merge($query_values,array(':callsign' => $callsign));
685
+					$query_values = array_merge($query_values, array(':callsign' => $callsign));
686 686
 				}
687 687
 			}
688 688
 		}
689 689
 
690 690
 		if ($owner != "")
691 691
 		{
692
-			$owner = filter_var($owner,FILTER_SANITIZE_STRING);
692
+			$owner = filter_var($owner, FILTER_SANITIZE_STRING);
693 693
 			if (!is_string($owner))
694 694
 			{
695 695
 				return false;
696 696
 			} else {
697 697
 				$additional_query .= " AND spotter_output.owner_name = :owner";
698
-				$query_values = array_merge($query_values,array(':owner' => $owner));
698
+				$query_values = array_merge($query_values, array(':owner' => $owner));
699 699
 			}
700 700
 		}
701 701
 
702 702
 		if ($pilot_name != "")
703 703
 		{
704
-			$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
704
+			$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
705 705
 			if (!is_string($pilot_name))
706 706
 			{
707 707
 				return false;
708 708
 			} else {
709 709
 				$additional_query .= " AND spotter_output.pilot_name = :pilot_name";
710
-				$query_values = array_merge($query_values,array(':pilot_name' => $pilot_name));
710
+				$query_values = array_merge($query_values, array(':pilot_name' => $pilot_name));
711 711
 			}
712 712
 		}
713 713
 
714 714
 		if ($pilot_id != "")
715 715
 		{
716
-			$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
716
+			$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT);
717 717
 			if (!is_string($pilot_id))
718 718
 			{
719 719
 				return false;
720 720
 			} else {
721 721
 				$additional_query .= " AND spotter_output.pilot_id = :pilot_id";
722
-				$query_values = array_merge($query_values,array(':pilot_id' => $pilot_id));
722
+				$query_values = array_merge($query_values, array(':pilot_id' => $pilot_id));
723 723
 			}
724 724
 		}
725 725
 
726 726
 		if ($departure_airport_route != "")
727 727
 		{
728
-			$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
728
+			$departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING);
729 729
 			if (!is_string($departure_airport_route))
730 730
 			{
731 731
 				return false;
732 732
 			} else {
733 733
 				$additional_query .= " AND spotter_output.departure_airport_icao = :departure_airport_route";
734
-				$query_values = array_merge($query_values,array(':departure_airport_route' => $departure_airport_route));
734
+				$query_values = array_merge($query_values, array(':departure_airport_route' => $departure_airport_route));
735 735
 			}
736 736
 		}
737 737
 
738 738
 		if ($arrival_airport_route != "")
739 739
 		{
740
-			$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
740
+			$arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING);
741 741
 			if (!is_string($arrival_airport_route))
742 742
 			{
743 743
 				return false;
744 744
 			} else {
745 745
 				$additional_query .= " AND spotter_output.arrival_airport_icao = :arrival_airport_route";
746
-				$query_values = array_merge($query_values,array(':arrival_airport_route' => $arrival_airport_route));
746
+				$query_values = array_merge($query_values, array(':arrival_airport_route' => $arrival_airport_route));
747 747
 			}
748 748
 		}
749 749
 
750 750
 		if ($altitude != "")
751 751
 		{
752 752
 			$altitude_array = explode(",", $altitude);
753
-			$altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
754
-			$altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
753
+			$altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
754
+			$altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
755 755
 
756 756
 			if ($altitude_array[1] != "")
757 757
 			{                
@@ -767,8 +767,8 @@  discard block
 block discarded – undo
767 767
 		if ($date_posted != "")
768 768
 		{
769 769
 			$date_array = explode(",", $date_posted);
770
-			$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
771
-			$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
770
+			$date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
771
+			$date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
772 772
 
773 773
 			if ($globalTimezone != '') {
774 774
 				date_default_timezone_set($globalTimezone);
@@ -799,8 +799,8 @@  discard block
 block discarded – undo
799 799
 		{
800 800
 			$limit_array = explode(",", $limit);
801 801
 			
802
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
803
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
802
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
803
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
804 804
 			
805 805
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
806 806
 			{
@@ -829,23 +829,23 @@  discard block
 block discarded – undo
829 829
 
830 830
 
831 831
 		if ($origLat != "" && $origLon != "" && $dist != "") {
832
-			$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
832
+			$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
833 833
 
834 834
 			if ($globalDBdriver == 'mysql') {
835
-				$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 
835
+				$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 
836 836
 						FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND spotter_archive.longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and spotter_archive.latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
837 837
 						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;
838 838
 			} else {
839
-				$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 
839
+				$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 
840 840
 						FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
841 841
 						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;
842 842
 			}
843 843
 		} else {		
844
-			$query  = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' 
844
+			$query = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' 
845 845
 					".$additional_query."
846 846
 					".$orderby_query;
847 847
 		}
848
-		$spotter_array = $this->getDataFromDB($query, $query_values,$limit_query);
848
+		$spotter_array = $this->getDataFromDB($query, $query_values, $limit_query);
849 849
 		return $spotter_array;
850 850
 	}
851 851
 	
@@ -868,8 +868,8 @@  discard block
 block discarded – undo
868 868
 		{
869 869
 			$limit_array = explode(",", $limit);
870 870
 			
871
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
872
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
871
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
872
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
873 873
 			
874 874
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
875 875
 			{
@@ -886,9 +886,9 @@  discard block
 block discarded – undo
886 886
 			$orderby_query = " ORDER BY spotter_output.date DESC";
887 887
 		}
888 888
 
889
-		$query  = $global_query.$filter_query." ".$orderby_query;
889
+		$query = $global_query.$filter_query." ".$orderby_query;
890 890
 
891
-		$spotter_array = $this->getDataFromDB($query, array(),$limit_query,true);
891
+		$spotter_array = $this->getDataFromDB($query, array(), $limit_query, true);
892 892
 
893 893
 		return $spotter_array;
894 894
 	}
@@ -934,34 +934,34 @@  discard block
 block discarded – undo
934 934
 			{
935 935
 				return false;
936 936
 			} else {
937
-				if ($interval == "30m"){
937
+				if ($interval == "30m") {
938 938
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) <= $this_output.date ';
939
-				} else if ($interval == "1h"){
939
+				} else if ($interval == "1h") {
940 940
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) <= $this_output.date ';
941
-				} else if ($interval == "3h"){
941
+				} else if ($interval == "3h") {
942 942
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 3 HOUR) <= $this_output.date ';
943
-				} else if ($interval == "6h"){
943
+				} else if ($interval == "6h") {
944 944
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 6 HOUR) <= $this_output.date ';
945
-				} else if ($interval == "12h"){
945
+				} else if ($interval == "12h") {
946 946
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 HOUR) <= $this_output.date ';
947
-				} else if ($interval == "24h"){
947
+				} else if ($interval == "24h") {
948 948
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 24 HOUR) <= $this_output.date ';
949
-				} else if ($interval == "7d"){
949
+				} else if ($interval == "7d") {
950 950
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) <= $this_output.date ';
951
-				} else if ($interval == "30d"){
951
+				} else if ($interval == "30d") {
952 952
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 DAY) <= $this_output.date ';
953 953
 				} 
954 954
 			}
955 955
 		}
956 956
 
957
-		$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 
957
+		$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 
958 958
                    WHERE spotter_output.latitude <> '' 
959 959
 				   AND spotter_output.longitude <> '' 
960 960
                    ".$additional_query."
961 961
                    HAVING distance < :radius  
962 962
 				   ORDER BY distance";
963 963
 
964
-		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius),$limit_query);
964
+		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius), $limit_query);
965 965
 
966 966
 		return $spotter_array;
967 967
 	}
@@ -973,21 +973,21 @@  discard block
 block discarded – undo
973 973
 	* @return Array the spotter information
974 974
 	*
975 975
 	*/
976
-	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
976
+	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '', $filter = array())
977 977
 	{
978 978
 		global $global_query;
979 979
 		
980 980
 		date_default_timezone_set('UTC');
981 981
 
982
-		$filter_query = $this->getFilter($filter,true,true);
982
+		$filter_query = $this->getFilter($filter, true, true);
983 983
 
984 984
 		$limit_query = '';
985 985
 		if ($limit != "")
986 986
 		{
987 987
 			$limit_array = explode(",", $limit);
988 988
 			
989
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
990
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
989
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
990
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
991 991
 			
992 992
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
993 993
 			{
@@ -1004,7 +1004,7 @@  discard block
 block discarded – undo
1004 1004
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1005 1005
 		}
1006 1006
 
1007
-		$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;
1007
+		$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;
1008 1008
 
1009 1009
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1010 1010
 
@@ -1023,15 +1023,15 @@  discard block
 block discarded – undo
1023 1023
 		global $global_query;
1024 1024
 		
1025 1025
 		date_default_timezone_set('UTC');
1026
-		$filter_query = $this->getFilter($filter,true,true);
1026
+		$filter_query = $this->getFilter($filter, true, true);
1027 1027
 
1028 1028
 		$limit_query = '';
1029 1029
 		if ($limit != "")
1030 1030
 		{
1031 1031
 			$limit_array = explode(",", $limit);
1032 1032
 			
1033
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1034
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1033
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1034
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1035 1035
 			
1036 1036
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1037 1037
 			{
@@ -1048,7 +1048,7 @@  discard block
 block discarded – undo
1048 1048
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1049 1049
 		}
1050 1050
 
1051
-		$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;
1051
+		$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;
1052 1052
 
1053 1053
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1054 1054
 
@@ -1062,20 +1062,20 @@  discard block
 block discarded – undo
1062 1062
 	* @return Array the spotter information
1063 1063
 	*
1064 1064
 	*/
1065
-	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1065
+	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '', $filter = array())
1066 1066
 	{
1067 1067
 		global $global_query;
1068 1068
 		
1069 1069
 		date_default_timezone_set('UTC');
1070
-		$filter_query = $this->getFilter($filter,true,true);
1070
+		$filter_query = $this->getFilter($filter, true, true);
1071 1071
 		
1072 1072
 		$limit_query = '';
1073 1073
 		if ($limit != "")
1074 1074
 		{
1075 1075
 			$limit_array = explode(",", $limit);
1076 1076
 			
1077
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1078
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1077
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1078
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1079 1079
 			
1080 1080
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1081 1081
 			{
@@ -1092,7 +1092,7 @@  discard block
 block discarded – undo
1092 1092
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1093 1093
 		}
1094 1094
 
1095
-		$query  = $global_query." ".$filter_query." spotter_output.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;
1095
+		$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;
1096 1096
 
1097 1097
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1098 1098
 
@@ -1112,7 +1112,7 @@  discard block
 block discarded – undo
1112 1112
 		
1113 1113
 		date_default_timezone_set('UTC');
1114 1114
 		
1115
-		$filter_query = $this->getFilter($filter,true,true);
1115
+		$filter_query = $this->getFilter($filter, true, true);
1116 1116
 		
1117 1117
 		$limit_query = '';
1118 1118
 		
@@ -1120,8 +1120,8 @@  discard block
 block discarded – undo
1120 1120
 		{
1121 1121
 			$limit_array = explode(",", $limit);
1122 1122
 			
1123
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1124
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1123
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1124
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1125 1125
 			
1126 1126
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1127 1127
 			{
@@ -1138,7 +1138,7 @@  discard block
 block discarded – undo
1138 1138
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1139 1139
 		}
1140 1140
 
1141
-		$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;
1141
+		$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;
1142 1142
 
1143 1143
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1144 1144
 
@@ -1157,14 +1157,14 @@  discard block
 block discarded – undo
1157 1157
 		global $global_query;
1158 1158
 		
1159 1159
 		date_default_timezone_set('UTC');
1160
-		$filter_query = $this->getFilter($filter,true,true);
1160
+		$filter_query = $this->getFilter($filter, true, true);
1161 1161
 		$limit_query = '';
1162 1162
 		if ($limit != "")
1163 1163
 		{
1164 1164
 			$limit_array = explode(",", $limit);
1165 1165
 			
1166
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1167
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1166
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1167
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1168 1168
 			
1169 1169
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1170 1170
 			{
@@ -1181,7 +1181,7 @@  discard block
 block discarded – undo
1181 1181
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1182 1182
 		}
1183 1183
 
1184
-		$query  = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' 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;
1184
+		$query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' 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;
1185 1185
 
1186 1186
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1187 1187
 
@@ -1205,9 +1205,9 @@  discard block
 block discarded – undo
1205 1205
 		$query_values = array(':id' => $id);
1206 1206
 
1207 1207
 		//$query  = $global_query." WHERE spotter_output.ident <> '' ".$additional_query." ";
1208
-		$query  = $global_query." WHERE ".$additional_query." ";
1208
+		$query = $global_query." WHERE ".$additional_query." ";
1209 1209
 
1210
-		$spotter_array = $this->getDataFromDB($query,$query_values);
1210
+		$spotter_array = $this->getDataFromDB($query, $query_values);
1211 1211
 
1212 1212
 		return $spotter_array;
1213 1213
 	}
@@ -1245,8 +1245,8 @@  discard block
 block discarded – undo
1245 1245
 		{
1246 1246
 			$limit_array = explode(",", $limit);
1247 1247
 			
1248
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1249
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1248
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1249
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1250 1250
 			
1251 1251
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1252 1252
 			{
@@ -1287,7 +1287,7 @@  discard block
 block discarded – undo
1287 1287
 		$query_values = array();
1288 1288
 		$limit_query = '';
1289 1289
 		$additional_query = '';
1290
-		$filter_query = $this->getFilter($filter,true,true);
1290
+		$filter_query = $this->getFilter($filter, true, true);
1291 1291
 		
1292 1292
 		if ($aircraft_type != "")
1293 1293
 		{
@@ -1304,8 +1304,8 @@  discard block
 block discarded – undo
1304 1304
 		{
1305 1305
 			$limit_array = explode(",", $limit);
1306 1306
 			
1307
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1308
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1307
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1308
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1309 1309
 			
1310 1310
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1311 1311
 			{
@@ -1361,8 +1361,8 @@  discard block
 block discarded – undo
1361 1361
 		{
1362 1362
 			$limit_array = explode(",", $limit);
1363 1363
 			
1364
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1365
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1364
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1365
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1366 1366
 			
1367 1367
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1368 1368
 			{
@@ -1378,7 +1378,7 @@  discard block
 block discarded – undo
1378 1378
 		} else {
1379 1379
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1380 1380
 		}
1381
-		$filter_query = $this->getFilter($filter,true,true);
1381
+		$filter_query = $this->getFilter($filter, true, true);
1382 1382
 
1383 1383
 		//$query = $global_query.$filter_query." spotter_output.ident <> '' ".$additional_query." ".$orderby_query;
1384 1384
 		$query = $global_query.$filter_query." ".$additional_query." ".$orderby_query;
@@ -1397,7 +1397,7 @@  discard block
 block discarded – undo
1397 1397
 	* @return Array the spotter information
1398 1398
 	*
1399 1399
 	*/
1400
-	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1400
+	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '', $filters = array())
1401 1401
 	{
1402 1402
 		global $global_query;
1403 1403
 		
@@ -1406,7 +1406,7 @@  discard block
 block discarded – undo
1406 1406
 		$query_values = array();
1407 1407
 		$limit_query = '';
1408 1408
 		$additional_query = '';
1409
-		$filter_query = $this->getFilter($filters,true,true);
1409
+		$filter_query = $this->getFilter($filters, true, true);
1410 1410
 		
1411 1411
 		if ($airline != "")
1412 1412
 		{
@@ -1423,8 +1423,8 @@  discard block
 block discarded – undo
1423 1423
 		{
1424 1424
 			$limit_array = explode(",", $limit);
1425 1425
 			
1426
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1427
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1426
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1427
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1428 1428
 			
1429 1429
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1430 1430
 			{
@@ -1454,7 +1454,7 @@  discard block
 block discarded – undo
1454 1454
 	* @return Array the spotter information
1455 1455
 	*
1456 1456
 	*/
1457
-	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1457
+	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array())
1458 1458
 	{
1459 1459
 		global $global_query;
1460 1460
 		
@@ -1462,7 +1462,7 @@  discard block
 block discarded – undo
1462 1462
 		$query_values = array();
1463 1463
 		$limit_query = '';
1464 1464
 		$additional_query = '';
1465
-		$filter_query = $this->getFilter($filters,true,true);
1465
+		$filter_query = $this->getFilter($filters, true, true);
1466 1466
 		
1467 1467
 		if ($airport != "")
1468 1468
 		{
@@ -1479,8 +1479,8 @@  discard block
 block discarded – undo
1479 1479
 		{
1480 1480
 			$limit_array = explode(",", $limit);
1481 1481
 			
1482
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1483
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1482
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1483
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1484 1484
 			
1485 1485
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1486 1486
 			{
@@ -1512,7 +1512,7 @@  discard block
 block discarded – undo
1512 1512
 	* @return Array the spotter information
1513 1513
 	*
1514 1514
 	*/
1515
-	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1515
+	public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array())
1516 1516
 	{
1517 1517
 		global $global_query, $globalTimezone, $globalDBdriver;
1518 1518
 		
@@ -1520,7 +1520,7 @@  discard block
 block discarded – undo
1520 1520
 		$limit_query = '';
1521 1521
 		$additional_query = '';
1522 1522
 
1523
-		$filter_query = $this->getFilter($filter,true,true);
1523
+		$filter_query = $this->getFilter($filter, true, true);
1524 1524
 		
1525 1525
 		if ($date != "")
1526 1526
 		{
@@ -1549,8 +1549,8 @@  discard block
 block discarded – undo
1549 1549
 		{
1550 1550
 			$limit_array = explode(",", $limit);
1551 1551
 			
1552
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1553
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1552
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1553
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1554 1554
 			
1555 1555
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1556 1556
 			{
@@ -1580,7 +1580,7 @@  discard block
 block discarded – undo
1580 1580
 	* @return Array the spotter information
1581 1581
 	*
1582 1582
 	*/
1583
-	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1583
+	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '', $filters = array())
1584 1584
 	{
1585 1585
 		global $global_query;
1586 1586
 		
@@ -1589,7 +1589,7 @@  discard block
 block discarded – undo
1589 1589
 		$query_values = array();
1590 1590
 		$limit_query = '';
1591 1591
 		$additional_query = '';
1592
-		$filter_query = $this->getFilter($filters,true,true);
1592
+		$filter_query = $this->getFilter($filters, true, true);
1593 1593
 		if ($country != "")
1594 1594
 		{
1595 1595
 			if (!is_string($country))
@@ -1606,8 +1606,8 @@  discard block
 block discarded – undo
1606 1606
 		{
1607 1607
 			$limit_array = explode(",", $limit);
1608 1608
 			
1609
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1610
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1609
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1610
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1611 1611
 			
1612 1612
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1613 1613
 			{
@@ -1647,7 +1647,7 @@  discard block
 block discarded – undo
1647 1647
 		$query_values = array();
1648 1648
 		$additional_query = '';
1649 1649
 		$limit_query = '';
1650
-		$filter_query = $this->getFilter($filters,true,true);
1650
+		$filter_query = $this->getFilter($filters, true, true);
1651 1651
 		
1652 1652
 		if ($aircraft_manufacturer != "")
1653 1653
 		{
@@ -1664,8 +1664,8 @@  discard block
 block discarded – undo
1664 1664
 		{
1665 1665
 			$limit_array = explode(",", $limit);
1666 1666
 			
1667
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1668
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1667
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1668
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1669 1669
 			
1670 1670
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1671 1671
 			{
@@ -1707,14 +1707,14 @@  discard block
 block discarded – undo
1707 1707
 		$query_values = array();
1708 1708
 		$additional_query = '';
1709 1709
 		$limit_query = '';
1710
-		$filter_query = $this->getFilter($filters,true,true);
1710
+		$filter_query = $this->getFilter($filters, true, true);
1711 1711
 		if ($departure_airport_icao != "")
1712 1712
 		{
1713 1713
 			if (!is_string($departure_airport_icao))
1714 1714
 			{
1715 1715
 				return false;
1716 1716
 			} else {
1717
-				$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1717
+				$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1718 1718
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)";
1719 1719
 				//$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao AND spotter_output.real_departure_airport_icao IS NULL) OR spotter_output.real_departure_airport_icao = :departure_airport_icao";
1720 1720
 				$query_values = array(':departure_airport_icao' => $departure_airport_icao);
@@ -1727,10 +1727,10 @@  discard block
 block discarded – undo
1727 1727
 			{
1728 1728
 				return false;
1729 1729
 			} else {
1730
-				$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1730
+				$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1731 1731
 				$additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)";
1732 1732
 				//$additional_query .= " AND ((spotter_output.arrival_airport_icao = :arrival_airport_icao AND spotter_output.real_arrival_airport_icao IS NULL) OR spotter_output.real_arrival_airport_icao = :arrival_airport_icao)";
1733
-				$query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao));
1733
+				$query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao));
1734 1734
 			}
1735 1735
 		}
1736 1736
 		
@@ -1738,8 +1738,8 @@  discard block
 block discarded – undo
1738 1738
 		{
1739 1739
 			$limit_array = explode(",", $limit);
1740 1740
 			
1741
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1742
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1741
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1742
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1743 1743
 			
1744 1744
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1745 1745
 			{
@@ -1778,15 +1778,15 @@  discard block
 block discarded – undo
1778 1778
 		global $global_query;
1779 1779
 		
1780 1780
 		date_default_timezone_set('UTC');
1781
-		$filter_query = $this->getFilter($filter,true,true);
1781
+		$filter_query = $this->getFilter($filter, true, true);
1782 1782
 		$limit_query = '';
1783 1783
 		
1784 1784
 		if ($limit != "")
1785 1785
 		{
1786 1786
 			$limit_array = explode(",", $limit);
1787 1787
 			
1788
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1789
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1788
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1789
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1790 1790
 			
1791 1791
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1792 1792
 			{
@@ -1803,7 +1803,7 @@  discard block
 block discarded – undo
1803 1803
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1804 1804
 		}
1805 1805
 
1806
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1806
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1807 1807
 
1808 1808
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1809 1809
 
@@ -1816,19 +1816,19 @@  discard block
 block discarded – undo
1816 1816
 	* @return String the highlight text
1817 1817
 	*
1818 1818
 	*/
1819
-	public function getHighlightByRegistration($registration,$filter = array())
1819
+	public function getHighlightByRegistration($registration, $filter = array())
1820 1820
 	{
1821 1821
 		global $global_query;
1822 1822
 		
1823 1823
 		date_default_timezone_set('UTC');
1824
-		$filter_query = $this->getFilter($filter,true,true);
1825
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
1824
+		$filter_query = $this->getFilter($filter, true, true);
1825
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
1826 1826
 		
1827
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1827
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1828 1828
 		$sth = $this->db->prepare($query);
1829 1829
 		$sth->execute(array(':registration' => $registration));
1830 1830
 
1831
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1831
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1832 1832
 		{
1833 1833
 			$highlight = $row['highlight'];
1834 1834
 		}
@@ -1844,14 +1844,14 @@  discard block
 block discarded – undo
1844 1844
 	* @return String usage
1845 1845
 	*
1846 1846
 	*/
1847
-	public function getSquawkUsage($squawk = '',$country = 'FR')
1847
+	public function getSquawkUsage($squawk = '', $country = 'FR')
1848 1848
 	{
1849 1849
 		
1850
-		$squawk = filter_var($squawk,FILTER_SANITIZE_STRING);
1851
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
1850
+		$squawk = filter_var($squawk, FILTER_SANITIZE_STRING);
1851
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
1852 1852
 
1853 1853
 		$query  = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1";
1854
-		$query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country);
1854
+		$query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country);
1855 1855
 		
1856 1856
 		$sth = $this->db->prepare($query);
1857 1857
 		$sth->execute($query_values);
@@ -1873,9 +1873,9 @@  discard block
 block discarded – undo
1873 1873
 	public function getAirportIcao($airport_iata = '')
1874 1874
 	{
1875 1875
 		
1876
-		$airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING);
1876
+		$airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING);
1877 1877
 
1878
-		$query  = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1878
+		$query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1879 1879
 		$query_values = array(':airport' => $airport_iata);
1880 1880
 		
1881 1881
 		$sth = $this->db->prepare($query);
@@ -1897,12 +1897,12 @@  discard block
 block discarded – undo
1897 1897
 	* @return Float distance to the airport
1898 1898
 	*
1899 1899
 	*/
1900
-	public function getAirportDistance($airport_icao,$latitude,$longitude)
1900
+	public function getAirportDistance($airport_icao, $latitude, $longitude)
1901 1901
 	{
1902 1902
 		
1903
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
1903
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
1904 1904
 
1905
-		$query  = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
1905
+		$query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
1906 1906
 		$query_values = array(':airport' => $airport_icao);
1907 1907
 		$sth = $this->db->prepare($query);
1908 1908
 		$sth->execute($query_values);
@@ -1912,7 +1912,7 @@  discard block
 block discarded – undo
1912 1912
 			$airport_latitude = $row['latitude'];
1913 1913
 			$airport_longitude = $row['longitude'];
1914 1914
 			$Common = new Common();
1915
-			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
1915
+			return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude);
1916 1916
 		} else return '';
1917 1917
 	}
1918 1918
 	
@@ -1926,11 +1926,11 @@  discard block
 block discarded – undo
1926 1926
 	public function getAllAirportInfo($airport = '')
1927 1927
 	{
1928 1928
 		
1929
-		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
1929
+		$airport = filter_var($airport, FILTER_SANITIZE_STRING);
1930 1930
 
1931 1931
 		$query_values = array();
1932 1932
 		if ($airport == 'NA') {
1933
-			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' => ''));
1933
+			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' => ''));
1934 1934
 		} elseif ($airport == '') {
1935 1935
 			$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";
1936 1936
 		} else {
@@ -1978,14 +1978,14 @@  discard block
 block discarded – undo
1978 1978
 	{
1979 1979
 		$lst_countries = '';
1980 1980
 		foreach ($countries as $country) {
1981
-			$country = filter_var($country,FILTER_SANITIZE_STRING);
1981
+			$country = filter_var($country, FILTER_SANITIZE_STRING);
1982 1982
 			if ($lst_countries == '') {
1983 1983
 				$lst_countries = "'".$country."'";
1984 1984
 			} else {
1985 1985
 				$lst_countries .= ",'".$country."'";
1986 1986
 			}
1987 1987
 		}
1988
-		$query  = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
1988
+		$query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
1989 1989
 		
1990 1990
 		$sth = $this->db->prepare($query);
1991 1991
 		$sth->execute();
@@ -1993,7 +1993,7 @@  discard block
 block discarded – undo
1993 1993
 		$airport_array = array();
1994 1994
 		$temp_array = array();
1995 1995
 		
1996
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1996
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1997 1997
 		{
1998 1998
 			$temp_array['name'] = $row['name'];
1999 1999
 			$temp_array['city'] = $row['city'];
@@ -2021,10 +2021,10 @@  discard block
 block discarded – undo
2021 2021
 	{
2022 2022
 		global $globalDBdriver;
2023 2023
 		if (is_array($coord)) {
2024
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2025
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2026
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2027
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2024
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2025
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2026
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2027
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2028 2028
 		} else return array();
2029 2029
 		if ($globalDBdriver == 'mysql') {
2030 2030
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
@@ -2036,7 +2036,7 @@  discard block
 block discarded – undo
2036 2036
     
2037 2037
 		$airport_array = array();
2038 2038
 		
2039
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2039
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2040 2040
 		{
2041 2041
 			$temp_array = $row;
2042 2042
 
@@ -2056,13 +2056,13 @@  discard block
 block discarded – undo
2056 2056
 	public function getAllWaypointsInfobyCoord($coord)
2057 2057
 	{
2058 2058
 		if (is_array($coord)) {
2059
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2060
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2061
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2062
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2059
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2060
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2061
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2062
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2063 2063
 		} else return array();
2064 2064
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2065
-		$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.")";
2065
+		$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.")";
2066 2066
 		//$query  = "SELECT waypoints.* FROM waypoints";
2067 2067
 		//$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";
2068 2068
 		//$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;
@@ -2074,7 +2074,7 @@  discard block
 block discarded – undo
2074 2074
     
2075 2075
 		$waypoints_array = array();
2076 2076
 		
2077
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2077
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2078 2078
 		{
2079 2079
 			$temp_array = $row;
2080 2080
 
@@ -2096,10 +2096,10 @@  discard block
 block discarded – undo
2096 2096
 	{
2097 2097
 		global $globalUseRealAirlines;
2098 2098
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2099
-		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2099
+		$airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING));
2100 2100
 		if ($airline_icao == 'NA') {
2101 2101
 			$airline_array = array();
2102
-			$airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2102
+			$airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2103 2103
 			return $airline_array;
2104 2104
 		} else {
2105 2105
 			if (strlen($airline_icao) == 2) {
@@ -2120,7 +2120,7 @@  discard block
 block discarded – undo
2120 2120
 			if ($fromsource === NULL) {
2121 2121
 				$sth->execute(array(':airline_icao' => $airline_icao));
2122 2122
 			} else {
2123
-				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2123
+				$sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource));
2124 2124
 			}
2125 2125
                         /*
2126 2126
 			$airline_array = array();
@@ -2162,13 +2162,13 @@  discard block
 block discarded – undo
2162 2162
 	{
2163 2163
 		global $globalUseRealAirlines;
2164 2164
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2165
-		$airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING));
2166
-		$query  = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1";
2165
+		$airline_name = strtolower(filter_var($airline_name, FILTER_SANITIZE_STRING));
2166
+		$query = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1";
2167 2167
 		$sth = $this->db->prepare($query);
2168 2168
 		if ($fromsource === NULL) {
2169 2169
 			$sth->execute(array(':airline_name' => $airline_name));
2170 2170
 		} else {
2171
-			$sth->execute(array(':airline_name' => $airline_name,':fromsource' => $fromsource));
2171
+			$sth->execute(array(':airline_name' => $airline_name, ':fromsource' => $fromsource));
2172 2172
 		}
2173 2173
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2174 2174
 		if (empty($result) && $fromsource !== NULL) {
@@ -2193,12 +2193,12 @@  discard block
 block discarded – undo
2193 2193
 	*/
2194 2194
 	public function getAllAircraftInfo($aircraft_type)
2195 2195
 	{
2196
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2196
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2197 2197
 
2198 2198
 		if ($aircraft_type == 'NA') {
2199
-			return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2199
+			return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2200 2200
 		}
2201
-		$query  = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow, aircraft.official_page, aircraft.aircraft_description, aircraft.engine_type, aircraft.engine_count, aircraft.wake_category FROM aircraft WHERE aircraft.icao = :aircraft_type";
2201
+		$query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow, aircraft.official_page, aircraft.aircraft_description, aircraft.engine_type, aircraft.engine_count, aircraft.wake_category FROM aircraft WHERE aircraft.icao = :aircraft_type";
2202 2202
 		
2203 2203
 		$sth = $this->db->prepare($query);
2204 2204
 		$sth->execute(array(':aircraft_type' => $aircraft_type));
@@ -2230,7 +2230,7 @@  discard block
 block discarded – undo
2230 2230
 	*/
2231 2231
 	public function getAircraftIcao($aircraft_type)
2232 2232
 	{
2233
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2233
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2234 2234
 		$all_aircraft = array('737-300' => 'B733',
2235 2235
 				'777-200' => 'B772',
2236 2236
 				'777-200ER' => 'B772',
@@ -2242,10 +2242,10 @@  discard block
 block discarded – undo
2242 2242
 				'A380' => 'A388');
2243 2243
 		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2244 2244
 
2245
-		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2245
+		$query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2246 2246
 		$aircraft_type = strtoupper($aircraft_type);
2247 2247
 		$sth = $this->db->prepare($query);
2248
-		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2248
+		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,));
2249 2249
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2250 2250
 		if (isset($result[0]['icao'])) return $result[0]['icao'];
2251 2251
 		else return '';
@@ -2260,9 +2260,9 @@  discard block
 block discarded – undo
2260 2260
 	*/
2261 2261
 	public function getAllAircraftType($aircraft_modes)
2262 2262
 	{
2263
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
2263
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
2264 2264
 
2265
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
2265
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
2266 2266
 		
2267 2267
 		$sth = $this->db->prepare($query);
2268 2268
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -2285,9 +2285,9 @@  discard block
 block discarded – undo
2285 2285
 	*/
2286 2286
 	public function getAllAircraftTypeByRegistration($registration)
2287 2287
 	{
2288
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2288
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2289 2289
 
2290
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1";
2290
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1";
2291 2291
 		
2292 2292
 		$sth = $this->db->prepare($query);
2293 2293
 		$sth->execute(array(':registration' => $registration));
@@ -2308,9 +2308,9 @@  discard block
 block discarded – undo
2308 2308
 	*/
2309 2309
 	public function getAllIDByRegistration($registration)
2310 2310
 	{
2311
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2311
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2312 2312
 
2313
-		$query  = "SELECT spotter_id,flightaware_id, date FROM spotter_output WHERE spotter_output.registration = :registration";
2313
+		$query = "SELECT spotter_id,flightaware_id, date FROM spotter_output WHERE spotter_output.registration = :registration";
2314 2314
 		
2315 2315
 		$sth = $this->db->prepare($query);
2316 2316
 		$sth->execute(array(':registration' => $registration));
@@ -2318,7 +2318,7 @@  discard block
 block discarded – undo
2318 2318
 		$idarray = array();
2319 2319
 		while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
2320 2320
 			$date = $row['date'];
2321
-			$idarray[$date] = array('flightaware_id' => $row['flightaware_id'],'spotter_id' => $row['spotter_id']);
2321
+			$idarray[$date] = array('flightaware_id' => $row['flightaware_id'], 'spotter_id' => $row['spotter_id']);
2322 2322
 		}
2323 2323
 		return $idarray;
2324 2324
 	}
@@ -2332,8 +2332,8 @@  discard block
 block discarded – undo
2332 2332
 	*/
2333 2333
 	public function getOperator($operator)
2334 2334
 	{
2335
-		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
2336
-		$query  = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2335
+		$operator = filter_var($operator, FILTER_SANITIZE_STRING);
2336
+		$query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2337 2337
 		
2338 2338
 		$sth = $this->db->prepare($query);
2339 2339
 		$sth->execute(array(':operator' => $operator));
@@ -2354,9 +2354,9 @@  discard block
 block discarded – undo
2354 2354
 	*/
2355 2355
 	public function getRouteInfo($callsign)
2356 2356
 	{
2357
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2357
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
2358 2358
                 if ($callsign == '') return array();
2359
-		$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";
2359
+		$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";
2360 2360
 		
2361 2361
 		$sth = $this->db->prepare($query);
2362 2362
 		$sth->execute(array(':callsign' => $callsign));
@@ -2377,9 +2377,9 @@  discard block
 block discarded – undo
2377 2377
 	*/
2378 2378
 	public function getAircraftInfoByRegistration($registration)
2379 2379
 	{
2380
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2380
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2381 2381
 
2382
-		$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";
2382
+		$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";
2383 2383
 		
2384 2384
 		$sth = $this->db->prepare($query);
2385 2385
 		$sth->execute(array(':registration' => $registration));
@@ -2387,7 +2387,7 @@  discard block
 block discarded – undo
2387 2387
 		$aircraft_array = array();
2388 2388
 		$temp_array = array();
2389 2389
 		
2390
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2390
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2391 2391
 		{
2392 2392
 			$temp_array['airline_icao'] = $row['airline_icao'];
2393 2393
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -2409,7 +2409,7 @@  discard block
 block discarded – undo
2409 2409
 	*/
2410 2410
 	public function getAircraftOwnerByRegistration($registration)
2411 2411
 	{
2412
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2412
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2413 2413
 		$Connection = new Connection($this->db);
2414 2414
 		if ($Connection->tableExists('aircraft_owner')) {
2415 2415
 			$query  = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1";
@@ -2431,7 +2431,7 @@  discard block
 block discarded – undo
2431 2431
 	public function getAllFlightsforSitemap()
2432 2432
 	{
2433 2433
 		//$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 ";
2434
-		$query  = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2434
+		$query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2435 2435
 		
2436 2436
 		$sth = $this->db->prepare($query);
2437 2437
 		$sth->execute();
@@ -2478,7 +2478,7 @@  discard block
 block discarded – undo
2478 2478
 		$manufacturer_array = array();
2479 2479
 		$temp_array = array();
2480 2480
 		
2481
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2481
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2482 2482
 		{
2483 2483
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
2484 2484
 
@@ -2515,7 +2515,7 @@  discard block
 block discarded – undo
2515 2515
 		$aircraft_array = array();
2516 2516
 		$temp_array = array();
2517 2517
 		
2518
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2518
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2519 2519
 		{
2520 2520
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
2521 2521
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
@@ -2536,8 +2536,8 @@  discard block
 block discarded – undo
2536 2536
 	*/
2537 2537
 	public function getAllAircraftRegistrations($filters = array())
2538 2538
 	{
2539
-		$filter_query = $this->getFilter($filters,true,true);
2540
-		$query  = "SELECT DISTINCT spotter_output.registration 
2539
+		$filter_query = $this->getFilter($filters, true, true);
2540
+		$query = "SELECT DISTINCT spotter_output.registration 
2541 2541
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' 
2542 2542
 				ORDER BY spotter_output.registration ASC";
2543 2543
 
@@ -2547,7 +2547,7 @@  discard block
 block discarded – undo
2547 2547
 		$aircraft_array = array();
2548 2548
 		$temp_array = array();
2549 2549
 		
2550
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2550
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2551 2551
 		{
2552 2552
 			$temp_array['registration'] = $row['registration'];
2553 2553
 
@@ -2564,11 +2564,11 @@  discard block
 block discarded – undo
2564 2564
 	* @return Array list of source name
2565 2565
 	*
2566 2566
 	*/
2567
-	public function getAllSourceName($type = '',$filters = array())
2567
+	public function getAllSourceName($type = '', $filters = array())
2568 2568
 	{
2569
-		$filter_query = $this->getFilter($filters,true,true);
2569
+		$filter_query = $this->getFilter($filters, true, true);
2570 2570
 		$query_values = array();
2571
-		$query  = "SELECT DISTINCT spotter_output.source_name 
2571
+		$query = "SELECT DISTINCT spotter_output.source_name 
2572 2572
 				FROM spotter_output".$filter_query." spotter_output.source_name <> ''";
2573 2573
 		if ($type != '') {
2574 2574
 			$query_values = array(':type' => $type);
@@ -2583,7 +2583,7 @@  discard block
 block discarded – undo
2583 2583
 		$source_array = array();
2584 2584
 		$temp_array = array();
2585 2585
 		
2586
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2586
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2587 2587
 		{
2588 2588
 			$temp_array['source_name'] = $row['source_name'];
2589 2589
 			$source_array[] = $temp_array;
@@ -2599,11 +2599,11 @@  discard block
 block discarded – undo
2599 2599
 	* @return Array list of airline names
2600 2600
 	*
2601 2601
 	*/
2602
-	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2602
+	public function getAllAirlineNames($airline_type = '', $forsource = NULL, $filters = array())
2603 2603
 	{
2604
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2605
-		$filter_query = $this->getFilter($filters,true,true);
2606
-		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
2604
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2605
+		$filter_query = $this->getFilter($filters, true, true);
2606
+		$airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
2607 2607
 		if ($airline_type == '' || $airline_type == 'all') {
2608 2608
 			/*
2609 2609
 			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
@@ -2622,7 +2622,7 @@  discard block
 block discarded – undo
2622 2622
 				$query_data = array(':forsource' => $forsource);
2623 2623
 			}
2624 2624
 		} else {
2625
-			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2625
+			$query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2626 2626
 					FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
2627 2627
 					AND spotter_output.airline_type = :airline_type 
2628 2628
 					ORDER BY spotter_output.airline_icao ASC";
@@ -2635,7 +2635,7 @@  discard block
 block discarded – undo
2635 2635
 		$airline_array = array();
2636 2636
 		$temp_array = array();
2637 2637
 		
2638
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2638
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2639 2639
 		{
2640 2640
 			$temp_array['airline_icao'] = $row['airline_icao'];
2641 2641
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -2652,10 +2652,10 @@  discard block
 block discarded – undo
2652 2652
 	* @return Array list of alliance names
2653 2653
 	*
2654 2654
 	*/
2655
-	public function getAllAllianceNames($forsource = NULL,$filters = array())
2655
+	public function getAllAllianceNames($forsource = NULL, $filters = array())
2656 2656
 	{
2657
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2658
-		$filter_query = $this->getFilter($filters,true,true);
2657
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2658
+		$filter_query = $this->getFilter($filters, true, true);
2659 2659
 		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2660 2660
 		elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2661 2661
 		elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
@@ -2683,8 +2683,8 @@  discard block
 block discarded – undo
2683 2683
 	*/
2684 2684
 	public function getAllAirlineCountries($filters = array())
2685 2685
 	{
2686
-		$filter_query = $this->getFilter($filters,true,true);
2687
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2686
+		$filter_query = $this->getFilter($filters, true, true);
2687
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2688 2688
 				FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2689 2689
 				ORDER BY spotter_output.airline_country ASC";
2690 2690
 		
@@ -2695,7 +2695,7 @@  discard block
 block discarded – undo
2695 2695
 		$airline_array = array();
2696 2696
 		$temp_array = array();
2697 2697
 		
2698
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2698
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2699 2699
 		{
2700 2700
 			$temp_array['airline_country'] = $row['airline_country'];
2701 2701
 
@@ -2715,9 +2715,9 @@  discard block
 block discarded – undo
2715 2715
 	*/
2716 2716
 	public function getAllAirportNames($filters = array())
2717 2717
 	{
2718
-		$filter_query = $this->getFilter($filters,true,true);
2718
+		$filter_query = $this->getFilter($filters, true, true);
2719 2719
 		$airport_array = array();
2720
-		$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
2720
+		$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
2721 2721
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' 
2722 2722
 				ORDER BY spotter_output.departure_airport_city ASC";
2723 2723
 		
@@ -2726,7 +2726,7 @@  discard block
 block discarded – undo
2726 2726
 		$sth->execute();
2727 2727
 
2728 2728
 		$temp_array = array();
2729
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2729
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2730 2730
 		{
2731 2731
 			$temp_array['airport_icao'] = $row['airport_icao'];
2732 2732
 			$temp_array['airport_name'] = $row['airport_name'];
@@ -2736,14 +2736,14 @@  discard block
 block discarded – undo
2736 2736
 			$airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array;
2737 2737
 		}
2738 2738
 
2739
-		$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
2739
+		$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
2740 2740
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' 
2741 2741
 								ORDER BY spotter_output.arrival_airport_city ASC";
2742 2742
 					
2743 2743
 		$sth = $this->db->prepare($query);
2744 2744
 		$sth->execute();
2745 2745
 
2746
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2746
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2747 2747
 			{
2748 2748
 		//	if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao'])
2749 2749
 		//	{
@@ -2783,21 +2783,21 @@  discard block
 block discarded – undo
2783 2783
    
2784 2784
 		$temp_array = array();
2785 2785
 		
2786
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2786
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2787 2787
 		{
2788 2788
 			$temp_array['airport_country'] = $row['airport_country'];
2789 2789
 
2790 2790
 			$airport_array[$row['airport_country']] = $temp_array;
2791 2791
 		}
2792
-		$filter_query = $this->getFilter($filters,true,true);
2793
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2792
+		$filter_query = $this->getFilter($filters, true, true);
2793
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2794 2794
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2795 2795
 								ORDER BY spotter_output.arrival_airport_country ASC";
2796 2796
 					
2797 2797
 		$sth = $this->db->prepare($query);
2798 2798
 		$sth->execute();
2799 2799
 		
2800
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2800
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2801 2801
 		{
2802 2802
 			if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country'])
2803 2803
 			{
@@ -2820,9 +2820,9 @@  discard block
 block discarded – undo
2820 2820
 	*/
2821 2821
 	public function getAllCountries($filters = array())
2822 2822
 	{
2823
-		$Connection= new Connection($this->db);
2823
+		$Connection = new Connection($this->db);
2824 2824
 		if ($Connection->tableExists('countries')) {
2825
-			$query  = "SELECT countries.name AS airport_country
2825
+			$query = "SELECT countries.name AS airport_country
2826 2826
 				FROM countries
2827 2827
 				ORDER BY countries.name ASC";
2828 2828
 			$sth = $this->db->prepare($query);
@@ -2831,14 +2831,14 @@  discard block
 block discarded – undo
2831 2831
 			$temp_array = array();
2832 2832
 			$country_array = array();
2833 2833
 		
2834
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2834
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2835 2835
 			{
2836 2836
 				$temp_array['country'] = $row['airport_country'];
2837 2837
 				$country_array[$row['airport_country']] = $temp_array;
2838 2838
 			}
2839 2839
 		} else {
2840
-			$filter_query = $this->getFilter($filters,true,true);
2841
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2840
+			$filter_query = $this->getFilter($filters, true, true);
2841
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2842 2842
 								FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' 
2843 2843
 								ORDER BY spotter_output.departure_airport_country ASC";
2844 2844
 
@@ -2847,20 +2847,20 @@  discard block
 block discarded – undo
2847 2847
    
2848 2848
 			$temp_array = array();
2849 2849
 			$country_array = array();
2850
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2850
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2851 2851
 			{
2852 2852
 				$temp_array['country'] = $row['airport_country'];
2853 2853
 				$country_array[$row['airport_country']] = $temp_array;
2854 2854
 			}
2855 2855
 
2856
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2856
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2857 2857
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2858 2858
 								ORDER BY spotter_output.arrival_airport_country ASC";
2859 2859
 					
2860 2860
 		$sth = $this->db->prepare($query);
2861 2861
 		$sth->execute();
2862 2862
 		
2863
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2863
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2864 2864
 		{
2865 2865
 			if ($country_array[$row['airport_country']]['country'] != $row['airport_country'])
2866 2866
 			{
@@ -2870,14 +2870,14 @@  discard block
 block discarded – undo
2870 2870
 			}
2871 2871
 		}
2872 2872
 		
2873
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2873
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2874 2874
 								FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2875 2875
 								ORDER BY spotter_output.airline_country ASC";
2876 2876
 					
2877 2877
 		$sth = $this->db->prepare($query);
2878 2878
 		$sth->execute();
2879 2879
 		
2880
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2880
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2881 2881
 		{
2882 2882
 			if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country'])
2883 2883
 			{
@@ -2901,8 +2901,8 @@  discard block
 block discarded – undo
2901 2901
 	*/
2902 2902
 	public function getAllIdents($filters = array())
2903 2903
 	{
2904
-		$filter_query = $this->getFilter($filters,true,true);
2905
-		$query  = "SELECT DISTINCT spotter_output.ident
2904
+		$filter_query = $this->getFilter($filters, true, true);
2905
+		$query = "SELECT DISTINCT spotter_output.ident
2906 2906
 								FROM spotter_output".$filter_query." spotter_output.ident <> '' 
2907 2907
 								ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0";
2908 2908
 
@@ -2912,7 +2912,7 @@  discard block
 block discarded – undo
2912 2912
 		$ident_array = array();
2913 2913
 		$temp_array = array();
2914 2914
 		
2915
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2915
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2916 2916
 		{
2917 2917
 			$temp_array['ident'] = $row['ident'];
2918 2918
 			$ident_array[] = $temp_array;
@@ -2926,9 +2926,9 @@  discard block
 block discarded – undo
2926 2926
 	* @return Array number, icao, name and city of airports
2927 2927
 	*/
2928 2928
 
2929
-	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
2929
+	public function getLast7DaysAirportsDeparture($airport_icao = '', $filters = array()) {
2930 2930
 		global $globalTimezone, $globalDBdriver;
2931
-		$filter_query = $this->getFilter($filters,true,true);
2931
+		$filter_query = $this->getFilter($filters, true, true);
2932 2932
 		if ($globalTimezone != '') {
2933 2933
 			date_default_timezone_set($globalTimezone);
2934 2934
 			$datetime = new DateTime();
@@ -2993,7 +2993,7 @@  discard block
 block discarded – undo
2993 2993
 
2994 2994
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
2995 2995
 		global $globalTimezone, $globalDBdriver;
2996
-		$filter_query = $this->getFilter($filters,true,true);
2996
+		$filter_query = $this->getFilter($filters, true, true);
2997 2997
 		if ($globalTimezone != '') {
2998 2998
 			date_default_timezone_set($globalTimezone);
2999 2999
 			$datetime = new DateTime();
@@ -3077,7 +3077,7 @@  discard block
 block discarded – undo
3077 3077
 
3078 3078
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
3079 3079
 		global $globalTimezone, $globalDBdriver;
3080
-		$filter_query = $this->getFilter($filters,true,true);
3080
+		$filter_query = $this->getFilter($filters, true, true);
3081 3081
 		if ($globalTimezone != '') {
3082 3082
 			date_default_timezone_set($globalTimezone);
3083 3083
 			$datetime = new DateTime();
@@ -3110,9 +3110,9 @@  discard block
 block discarded – undo
3110 3110
 	* @return Array number, icao, name and city of airports
3111 3111
 	*/
3112 3112
 
3113
-	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3113
+	public function getLast7DaysDetectedAirportsArrival($airport_icao = '', $filters = array()) {
3114 3114
 		global $globalTimezone, $globalDBdriver;
3115
-		$filter_query = $this->getFilter($filters,true,true);
3115
+		$filter_query = $this->getFilter($filters, true, true);
3116 3116
 		if ($globalTimezone != '') {
3117 3117
 			date_default_timezone_set($globalTimezone);
3118 3118
 			$datetime = new DateTime();
@@ -3244,12 +3244,12 @@  discard block
 block discarded – undo
3244 3244
 		} else $offset = '+00:00';
3245 3245
 
3246 3246
 		if ($globalDBdriver == 'mysql') {
3247
-			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3247
+			$query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3248 3248
 								FROM spotter_output
3249 3249
 								WHERE spotter_output.date <> '' 
3250 3250
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
3251 3251
 		} else {
3252
-			$query  = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3252
+			$query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3253 3253
 								FROM spotter_output
3254 3254
 								WHERE spotter_output.date <> '' 
3255 3255
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
@@ -3261,7 +3261,7 @@  discard block
 block discarded – undo
3261 3261
 		$date_array = array();
3262 3262
 		$temp_array = array();
3263 3263
 		
3264
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3264
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3265 3265
 		{
3266 3266
 			$temp_array['date'] = $row['date'];
3267 3267
 
@@ -3281,7 +3281,7 @@  discard block
 block discarded – undo
3281 3281
 	*/
3282 3282
 	public function getAllRoutes()
3283 3283
 	{
3284
-		$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 
3284
+		$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 
3285 3285
 				FROM spotter_output
3286 3286
 				WHERE spotter_output.ident <> '' 
3287 3287
 				GROUP BY route
@@ -3292,7 +3292,7 @@  discard block
 block discarded – undo
3292 3292
 
3293 3293
 		$routes_array = array();
3294 3294
 		$temp_array = array();
3295
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3295
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3296 3296
 		{
3297 3297
 			$temp_array['route'] = $row['route'];
3298 3298
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -3311,21 +3311,21 @@  discard block
 block discarded – undo
3311 3311
 	* @return String success or false
3312 3312
 	*
3313 3313
 	*/	
3314
-	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3314
+	public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL)
3315 3315
 	{
3316 3316
 		if (!is_numeric(substr($ident, 0, 3)))
3317 3317
 		{
3318 3318
 			if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3319
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3319
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3320 3320
 			} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3321
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3321
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3322 3322
 			} else {
3323 3323
 				$airline_array = $this->getAllAirlineInfo("NA");
3324 3324
 			}
3325 3325
 			if (count($airline_array) == 0) {
3326 3326
 				$airline_array = $this->getAllAirlineInfo("NA");
3327 3327
 			}
3328
-			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3328
+			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3329 3329
 				$airline_array = $this->getAllAirlineInfo("NA");
3330 3330
 			}
3331 3331
 		} else {
@@ -3338,7 +3338,7 @@  discard block
 block discarded – undo
3338 3338
 
3339 3339
 
3340 3340
 		$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';
3341
-                $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);
3341
+                $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);
3342 3342
 
3343 3343
 		try {
3344 3344
 			$sth = $this->db->prepare($query);
@@ -3359,11 +3359,11 @@  discard block
 block discarded – undo
3359 3359
 	* @return String success or false
3360 3360
 	*
3361 3361
 	*/	
3362
-	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3362
+	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '')
3363 3363
 	{
3364 3364
 		if ($groundspeed == '') $groundspeed = NULL;
3365 3365
 		$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';
3366
-                $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);
3366
+                $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);
3367 3367
 
3368 3368
 		try {
3369 3369
 			$sth = $this->db->prepare($query);
@@ -3403,7 +3403,7 @@  discard block
 block discarded – undo
3403 3403
 	* @param String $verticalrate vertival rate of flight
3404 3404
 	* @return String success or false
3405 3405
 	*/
3406
-	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 = '')
3406
+	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 = '')
3407 3407
 	{
3408 3408
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
3409 3409
 		
@@ -3427,13 +3427,13 @@  discard block
 block discarded – undo
3427 3427
 				if ($ModeS != '') {
3428 3428
 					$timeelapsed = microtime(true);
3429 3429
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3430
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3430
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3431 3431
 				} else {
3432
-					$myhex = explode('-',$flightaware_id);
3432
+					$myhex = explode('-', $flightaware_id);
3433 3433
 					if (count($myhex) > 0) {
3434 3434
 						$timeelapsed = microtime(true);
3435 3435
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3436
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3436
+						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3437 3437
 					}
3438 3438
 				}
3439 3439
 			}
@@ -3455,24 +3455,24 @@  discard block
 block discarded – undo
3455 3455
 				{
3456 3456
 					$timeelapsed = microtime(true);
3457 3457
 					if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3458
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3458
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3459 3459
 					} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3460
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3460
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3461 3461
 					} else {
3462 3462
 						$airline_array = $this->getAllAirlineInfo("NA");
3463 3463
 					}
3464 3464
 					if (count($airline_array) == 0) {
3465 3465
 						$airline_array = $this->getAllAirlineInfo("NA");
3466 3466
 					}
3467
-					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3467
+					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3468 3468
 						$airline_array = $this->getAllAirlineInfo("NA");
3469 3469
 					}
3470
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3470
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3471 3471
 
3472 3472
 				} else {
3473 3473
 					$timeelapsed = microtime(true);
3474 3474
 					$airline_array = $this->getAllAirlineInfo("NA");
3475
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3475
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3476 3476
 				}
3477 3477
 			}
3478 3478
 		} else $airline_array = array();
@@ -3489,27 +3489,27 @@  discard block
 block discarded – undo
3489 3489
 				{
3490 3490
 					$timeelapsed = microtime(true);
3491 3491
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3492
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3492
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3493 3493
 				} else {
3494 3494
 					$timeelapsed = microtime(true);
3495 3495
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3496
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3496
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3497 3497
 				}
3498 3498
 			}
3499 3499
 		} else {
3500 3500
 			if ($ModeS != '') {
3501 3501
 				$timeelapsed = microtime(true);
3502 3502
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3503
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3503
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3504 3504
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3505 3505
 				{
3506 3506
 					$timeelapsed = microtime(true);
3507 3507
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3508
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3508
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3509 3509
 				} else {
3510 3510
 					$timeelapsed = microtime(true);
3511 3511
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3512
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3512
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3513 3513
 				}
3514 3514
 			}
3515 3515
 		}
@@ -3525,7 +3525,7 @@  discard block
 block discarded – undo
3525 3525
 			} else {
3526 3526
 				$timeelapsed = microtime(true);
3527 3527
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3528
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3528
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3529 3529
 			}
3530 3530
 		}
3531 3531
 		
@@ -3540,7 +3540,7 @@  discard block
 block discarded – undo
3540 3540
 			} else {
3541 3541
 				$timeelapsed = microtime(true);
3542 3542
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3543
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3543
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3544 3544
 			}
3545 3545
 		}
3546 3546
 
@@ -3603,7 +3603,7 @@  discard block
 block discarded – undo
3603 3603
 		{
3604 3604
 			$timeelapsed = microtime(true);
3605 3605
 			$image_array = $Image->getSpotterImage($registration);
3606
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3606
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3607 3607
 			if (!isset($image_array[0]['registration']))
3608 3608
 			{
3609 3609
 				//echo "Add image !!!! \n";
@@ -3611,7 +3611,7 @@  discard block
 block discarded – undo
3611 3611
 			}
3612 3612
 			$timeelapsed = microtime(true);
3613 3613
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3614
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3614
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3615 3615
 			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3616 3616
 		}
3617 3617
     
@@ -3619,33 +3619,33 @@  discard block
 block discarded – undo
3619 3619
 		{
3620 3620
             		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3621 3621
             		else $airline_icao = '';
3622
-			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3622
+			$image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao);
3623 3623
 			if (!isset($image_array[0]['registration']))
3624 3624
 			{
3625 3625
 				//echo "Add image !!!! \n";
3626
-				$Image->addSpotterImage('',$aircraft_icao,$airline_icao);
3626
+				$Image->addSpotterImage('', $aircraft_icao, $airline_icao);
3627 3627
 			}
3628 3628
 		}
3629 3629
     
3630
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
3631
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
3632
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
3633
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3634
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
3635
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
3636
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3637
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3638
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
3639
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3640
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
3641
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3642
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
3643
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
3644
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
3645
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
3646
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
3647
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
3648
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
3630
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
3631
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
3632
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
3633
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3634
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
3635
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
3636
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3637
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3638
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
3639
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3640
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
3641
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3642
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
3643
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
3644
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
3645
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
3646
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
3647
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
3648
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
3649 3649
 	
3650 3650
 		if (count($airline_array) == 0) 
3651 3651
 		{
@@ -3673,7 +3673,7 @@  discard block
 block discarded – undo
3673 3673
                 if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3674 3674
                 if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3675 3675
                 if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3676
-                $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) 
3676
+                $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) 
3677 3677
                 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)";
3678 3678
 
3679 3679
                 $airline_name = $airline_array[0]['name'];
@@ -3683,7 +3683,7 @@  discard block
 block discarded – undo
3683 3683
 		if ($airline_type == '') {
3684 3684
 			$timeelapsed = microtime(true);
3685 3685
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3686
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3686
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3687 3687
 		}
3688 3688
 		if ($airline_type == null) $airline_type = '';
3689 3689
                 $aircraft_type = $aircraft_array[0]['type'];
@@ -3695,7 +3695,7 @@  discard block
 block discarded – undo
3695 3695
                 $arrival_airport_name = $arrival_airport_array[0]['name'];
3696 3696
                 $arrival_airport_city = $arrival_airport_array[0]['city'];
3697 3697
                 $arrival_airport_country = $arrival_airport_array[0]['country'];
3698
-                $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);
3698
+                $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);
3699 3699
 
3700 3700
 		try {
3701 3701
 		        
@@ -3721,13 +3721,13 @@  discard block
 block discarded – undo
3721 3721
 	{
3722 3722
 		global $globalDBdriver, $globalTimezone;
3723 3723
 		if ($globalDBdriver == 'mysql') {
3724
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3724
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3725 3725
 								WHERE spotter_output.ident = :ident 
3726 3726
 								AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
3727 3727
 								AND spotter_output.date < UTC_TIMESTAMP()";
3728 3728
 			$query_data = array(':ident' => $ident);
3729 3729
 		} else {
3730
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3730
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3731 3731
 								WHERE spotter_output.ident = :ident 
3732 3732
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3733 3733
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
@@ -3736,8 +3736,8 @@  discard block
 block discarded – undo
3736 3736
 		
3737 3737
 		$sth = $this->db->prepare($query);
3738 3738
 		$sth->execute($query_data);
3739
-    		$ident_result='';
3740
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3739
+    		$ident_result = '';
3740
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3741 3741
 		{
3742 3742
 			$ident_result = $row['ident'];
3743 3743
 		}
@@ -3763,8 +3763,8 @@  discard block
 block discarded – undo
3763 3763
 				return false;
3764 3764
 			} else {
3765 3765
 				$q_array = explode(" ", $q);
3766
-				foreach ($q_array as $q_item){
3767
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
3766
+				foreach ($q_array as $q_item) {
3767
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
3768 3768
 					$additional_query .= " AND (";
3769 3769
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
3770 3770
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
@@ -3779,11 +3779,11 @@  discard block
 block discarded – undo
3779 3779
 			}
3780 3780
 		}
3781 3781
 		if ($globalDBdriver == 'mysql') {
3782
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3782
+			$query = "SELECT spotter_output.* FROM spotter_output 
3783 3783
 				WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
3784 3784
 				AND spotter_output.date < UTC_TIMESTAMP()";
3785 3785
 		} else {
3786
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3786
+			$query = "SELECT spotter_output.* FROM spotter_output 
3787 3787
 				WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
3788 3788
 				AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
3789 3789
 		}
@@ -3800,11 +3800,11 @@  discard block
 block discarded – undo
3800 3800
 	* @return Array the airline list
3801 3801
 	*
3802 3802
 	*/
3803
-	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3803
+	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3804 3804
 	{
3805 3805
 		global $globalDBdriver;
3806
-		$filter_query = $this->getFilter($filters,true,true);
3807
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3806
+		$filter_query = $this->getFilter($filters, true, true);
3807
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3808 3808
 		 			FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA' ";
3809 3809
 		if ($olderthanmonths > 0) {
3810 3810
 			if ($globalDBdriver == 'mysql') {
@@ -3828,7 +3828,7 @@  discard block
 block discarded – undo
3828 3828
  
3829 3829
 		$airline_array = array();
3830 3830
 		$temp_array = array();
3831
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3831
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3832 3832
 		{
3833 3833
 			$temp_array['airline_name'] = $row['airline_name'];
3834 3834
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3845,11 +3845,11 @@  discard block
 block discarded – undo
3845 3845
 	* @return Array the pilots list
3846 3846
 	*
3847 3847
 	*/
3848
-	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3848
+	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3849 3849
 	{
3850 3850
 		global $globalDBdriver;
3851
-		$filter_query = $this->getFilter($filters,true,true);
3852
-		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3851
+		$filter_query = $this->getFilter($filters, true, true);
3852
+		$query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3853 3853
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3854 3854
                 if ($olderthanmonths > 0) {
3855 3855
             		if ($globalDBdriver == 'mysql') {
@@ -3875,7 +3875,7 @@  discard block
 block discarded – undo
3875 3875
 		$airline_array = array();
3876 3876
 		$temp_array = array();
3877 3877
         
3878
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3878
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3879 3879
 		{
3880 3880
 			$temp_array['pilot_name'] = $row['pilot_name'];
3881 3881
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -3895,7 +3895,7 @@  discard block
 block discarded – undo
3895 3895
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3896 3896
 	{
3897 3897
 		global $globalDBdriver;
3898
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3898
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3899 3899
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
3900 3900
                 if ($olderthanmonths > 0) {
3901 3901
             		if ($globalDBdriver == 'mysql') {
@@ -3921,7 +3921,7 @@  discard block
 block discarded – undo
3921 3921
 		$airline_array = array();
3922 3922
 		$temp_array = array();
3923 3923
         
3924
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3924
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3925 3925
 		{
3926 3926
 			$temp_array['pilot_name'] = $row['pilot_name'];
3927 3927
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -3939,11 +3939,11 @@  discard block
 block discarded – undo
3939 3939
 	* @return Array the pilots list
3940 3940
 	*
3941 3941
 	*/
3942
-	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3942
+	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3943 3943
 	{
3944 3944
 		global $globalDBdriver;
3945
-		$filter_query = $this->getFilter($filters,true,true);
3946
-		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3945
+		$filter_query = $this->getFilter($filters, true, true);
3946
+		$query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3947 3947
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3948 3948
                 if ($olderthanmonths > 0) {
3949 3949
             		if ($globalDBdriver == 'mysql') {
@@ -3969,7 +3969,7 @@  discard block
 block discarded – undo
3969 3969
 		$airline_array = array();
3970 3970
 		$temp_array = array();
3971 3971
         
3972
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3972
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3973 3973
 		{
3974 3974
 			$temp_array['owner_name'] = $row['owner_name'];
3975 3975
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -3984,11 +3984,11 @@  discard block
 block discarded – undo
3984 3984
 	* @return Array the pilots list
3985 3985
 	*
3986 3986
 	*/
3987
-	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3987
+	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3988 3988
 	{
3989 3989
 		global $globalDBdriver;
3990
-		$filter_query = $this->getFilter($filters,true,true);
3991
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3990
+		$filter_query = $this->getFilter($filters, true, true);
3991
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3992 3992
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3993 3993
                 if ($olderthanmonths > 0) {
3994 3994
             		if ($globalDBdriver == 'mysql') {
@@ -4014,7 +4014,7 @@  discard block
 block discarded – undo
4014 4014
 		$airline_array = array();
4015 4015
 		$temp_array = array();
4016 4016
         
4017
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4017
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4018 4018
 		{
4019 4019
 			$temp_array['owner_name'] = $row['owner_name'];
4020 4020
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -4030,11 +4030,11 @@  discard block
 block discarded – undo
4030 4030
 	* @return Array the airline list
4031 4031
 	*
4032 4032
 	*/
4033
-	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
4033
+	public function countAllAirlinesByAircraft($aircraft_icao, $filters = array())
4034 4034
 	{
4035
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4036
-		$filter_query = $this->getFilter($filters,true,true);
4037
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4035
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4036
+		$filter_query = $this->getFilter($filters, true, true);
4037
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4038 4038
 		 	    FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
4039 4039
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4040 4040
 			    ORDER BY airline_count DESC";
@@ -4046,7 +4046,7 @@  discard block
 block discarded – undo
4046 4046
 		$airline_array = array();
4047 4047
 		$temp_array = array();
4048 4048
         
4049
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4049
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4050 4050
 		{
4051 4051
 			$temp_array['airline_name'] = $row['airline_name'];
4052 4052
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4066,11 +4066,11 @@  discard block
 block discarded – undo
4066 4066
 	* @return Array the airline country list
4067 4067
 	*
4068 4068
 	*/
4069
-	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
4069
+	public function countAllAirlineCountriesByAircraft($aircraft_icao, $filters = array())
4070 4070
 	{
4071
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4072
-		$filter_query = $this->getFilter($filters,true,true);
4073
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4071
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4072
+		$filter_query = $this->getFilter($filters, true, true);
4073
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4074 4074
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
4075 4075
                     GROUP BY spotter_output.airline_country
4076 4076
 					ORDER BY airline_country_count DESC
@@ -4083,7 +4083,7 @@  discard block
 block discarded – undo
4083 4083
 		$airline_country_array = array();
4084 4084
 		$temp_array = array();
4085 4085
         
4086
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4086
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4087 4087
 		{
4088 4088
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4089 4089
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4102,11 +4102,11 @@  discard block
 block discarded – undo
4102 4102
 	* @return Array the airline list
4103 4103
 	*
4104 4104
 	*/
4105
-	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4105
+	public function countAllAirlinesByAirport($airport_icao, $filters = array())
4106 4106
 	{
4107
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4108
-		$filter_query = $this->getFilter($filters,true,true);
4109
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4107
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4108
+		$filter_query = $this->getFilter($filters, true, true);
4109
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4110 4110
 		    FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao ) 
4111 4111
                     GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country
4112 4112
 		    ORDER BY airline_count DESC";
@@ -4118,7 +4118,7 @@  discard block
 block discarded – undo
4118 4118
 		$airline_array = array();
4119 4119
 		$temp_array = array();
4120 4120
         
4121
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4121
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4122 4122
 		{
4123 4123
 			$temp_array['airline_name'] = $row['airline_name'];
4124 4124
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4137,11 +4137,11 @@  discard block
 block discarded – undo
4137 4137
 	* @return Array the airline country list
4138 4138
 	*
4139 4139
 	*/
4140
-	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4140
+	public function countAllAirlineCountriesByAirport($airport_icao, $filters = array())
4141 4141
 	{
4142
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4143
-		$filter_query = $this->getFilter($filters,true,true);
4144
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4142
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4143
+		$filter_query = $this->getFilter($filters, true, true);
4144
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4145 4145
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao )
4146 4146
 					GROUP BY spotter_output.airline_country
4147 4147
 					ORDER BY airline_country_count DESC
@@ -4154,7 +4154,7 @@  discard block
 block discarded – undo
4154 4154
 		$airline_country_array = array();
4155 4155
 		$temp_array = array();
4156 4156
         
4157
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4157
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4158 4158
 		{
4159 4159
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4160 4160
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4171,11 +4171,11 @@  discard block
 block discarded – undo
4171 4171
 	* @return Array the airline list
4172 4172
 	*
4173 4173
 	*/
4174
-	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4174
+	public function countAllAirlinesByManufacturer($aircraft_manufacturer, $filters = array())
4175 4175
 	{
4176
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4177
-		$filter_query = $this->getFilter($filters,true,true);
4178
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4176
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4177
+		$filter_query = $this->getFilter($filters, true, true);
4178
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4179 4179
 		 			FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4180 4180
 					GROUP BY spotter_output.airline_name
4181 4181
 					ORDER BY airline_count DESC";
@@ -4186,7 +4186,7 @@  discard block
 block discarded – undo
4186 4186
 		$airline_array = array();
4187 4187
 		$temp_array = array();
4188 4188
         
4189
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4189
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4190 4190
 		{
4191 4191
 			$temp_array['airline_name'] = $row['airline_name'];
4192 4192
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4206,11 +4206,11 @@  discard block
 block discarded – undo
4206 4206
 	* @return Array the airline country list
4207 4207
 	*
4208 4208
 	*/
4209
-	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4209
+	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer, $filters = array())
4210 4210
 	{
4211
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4212
-		$filter_query = $this->getFilter($filters,true,true);
4213
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4211
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4212
+		$filter_query = $this->getFilter($filters, true, true);
4213
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4214 4214
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4215 4215
 					GROUP BY spotter_output.airline_country
4216 4216
 					ORDER BY airline_country_count DESC
@@ -4223,7 +4223,7 @@  discard block
 block discarded – undo
4223 4223
 		$airline_country_array = array();
4224 4224
 		$temp_array = array();
4225 4225
         
4226
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4226
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4227 4227
 		{
4228 4228
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4229 4229
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4239,11 +4239,11 @@  discard block
 block discarded – undo
4239 4239
 	* @return Array the airline list
4240 4240
 	*
4241 4241
 	*/
4242
-	public function countAllAirlinesByDate($date,$filters = array())
4242
+	public function countAllAirlinesByDate($date, $filters = array())
4243 4243
 	{
4244 4244
 		global $globalTimezone, $globalDBdriver;
4245
-		$filter_query = $this->getFilter($filters,true,true);
4246
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4245
+		$filter_query = $this->getFilter($filters, true, true);
4246
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4247 4247
 		if ($globalTimezone != '') {
4248 4248
 			date_default_timezone_set($globalTimezone);
4249 4249
 			$datetime = new DateTime($date);
@@ -4251,12 +4251,12 @@  discard block
 block discarded – undo
4251 4251
 		} else $offset = '+00:00';
4252 4252
 
4253 4253
 		if ($globalDBdriver == 'mysql') {
4254
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4254
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4255 4255
 		 			FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4256 4256
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country 
4257 4257
 					ORDER BY airline_count DESC";
4258 4258
 		} else {
4259
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4259
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4260 4260
 		 			FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4261 4261
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country
4262 4262
 					ORDER BY airline_count DESC";
@@ -4267,7 +4267,7 @@  discard block
 block discarded – undo
4267 4267
 
4268 4268
 		$airline_array = array();
4269 4269
 		$temp_array = array();
4270
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4270
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4271 4271
 		{
4272 4272
 			$temp_array['airline_name'] = $row['airline_name'];
4273 4273
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4287,11 +4287,11 @@  discard block
 block discarded – undo
4287 4287
 	* @return Array the airline country list
4288 4288
 	*
4289 4289
 	*/
4290
-	public function countAllAirlineCountriesByDate($date,$filters = array())
4290
+	public function countAllAirlineCountriesByDate($date, $filters = array())
4291 4291
 	{
4292 4292
 		global $globalTimezone, $globalDBdriver;
4293
-		$filter_query = $this->getFilter($filters,true,true);
4294
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4293
+		$filter_query = $this->getFilter($filters, true, true);
4294
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4295 4295
 		if ($globalTimezone != '') {
4296 4296
 			date_default_timezone_set($globalTimezone);
4297 4297
 			$datetime = new DateTime($date);
@@ -4299,13 +4299,13 @@  discard block
 block discarded – undo
4299 4299
 		} else $offset = '+00:00';
4300 4300
 		
4301 4301
 		if ($globalDBdriver == 'mysql') {
4302
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4302
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4303 4303
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4304 4304
 					GROUP BY spotter_output.airline_country
4305 4305
 					ORDER BY airline_country_count DESC
4306 4306
 					LIMIT 10 OFFSET 0";
4307 4307
 		} else {
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".$filter_query." spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4310 4310
 					GROUP BY spotter_output.airline_country
4311 4311
 					ORDER BY airline_country_count DESC
@@ -4317,7 +4317,7 @@  discard block
 block discarded – undo
4317 4317
  
4318 4318
 		$airline_country_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'];
@@ -4334,11 +4334,11 @@  discard block
 block discarded – undo
4334 4334
 	* @return Array the airline list
4335 4335
 	*
4336 4336
 	*/
4337
-	public function countAllAirlinesByIdent($ident,$filters = array())
4337
+	public function countAllAirlinesByIdent($ident, $filters = array())
4338 4338
 	{
4339
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4340
-		$filter_query = $this->getFilter($filters,true,true);
4341
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4339
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4340
+		$filter_query = $this->getFilter($filters, true, true);
4341
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4342 4342
 		 		FROM spotter_output".$filter_query." spotter_output.ident = :ident  
4343 4343
 				GROUP BY spotter_output.airline_name
4344 4344
 				ORDER BY airline_count DESC";
@@ -4350,7 +4350,7 @@  discard block
 block discarded – undo
4350 4350
 		$airline_array = array();
4351 4351
 		$temp_array = array();
4352 4352
         
4353
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4353
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4354 4354
 		{
4355 4355
 			$temp_array['airline_name'] = $row['airline_name'];
4356 4356
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4368,25 +4368,25 @@  discard block
 block discarded – undo
4368 4368
 	* @return Array the airline list
4369 4369
 	*
4370 4370
 	*/
4371
-	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4371
+	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4372 4372
 	{
4373
-		$filter_query = $this->getFilter($filters,true,true);
4374
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4375
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4373
+		$filter_query = $this->getFilter($filters, true, true);
4374
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4375
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4376 4376
 
4377
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4377
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4378 4378
 		 			FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4379 4379
 					GROUP BY spotter_output.airline_name
4380 4380
 					ORDER BY airline_count DESC";
4381 4381
       
4382 4382
 		
4383 4383
 		$sth = $this->db->prepare($query);
4384
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4384
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4385 4385
       
4386 4386
 		$airline_array = array();
4387 4387
 		$temp_array = array();
4388 4388
         
4389
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4389
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4390 4390
 		{
4391 4391
 			$temp_array['airline_name'] = $row['airline_name'];
4392 4392
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4404,13 +4404,13 @@  discard block
 block discarded – undo
4404 4404
 	* @return Array the airline country list
4405 4405
 	*
4406 4406
 	*/
4407
-	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4407
+	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4408 4408
 	{
4409
-		$filter_query = $this->getFilter($filters,true,true);
4410
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4411
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4409
+		$filter_query = $this->getFilter($filters, true, true);
4410
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4411
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4412 4412
       
4413
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4413
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4414 4414
 		 		FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4415 4415
 				GROUP BY spotter_output.airline_country
4416 4416
 				ORDER BY airline_country_count DESC
@@ -4418,11 +4418,11 @@  discard block
 block discarded – undo
4418 4418
       
4419 4419
 		
4420 4420
 		$sth = $this->db->prepare($query);
4421
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4421
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4422 4422
       
4423 4423
 		$airline_country_array = array();
4424 4424
 		$temp_array = array();
4425
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4425
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4426 4426
 		{
4427 4427
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4428 4428
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4440,11 +4440,11 @@  discard block
 block discarded – undo
4440 4440
 	* @return Array the airline list
4441 4441
 	*
4442 4442
 	*/
4443
-	public function countAllAirlinesByCountry($country,$filters = array())
4443
+	public function countAllAirlinesByCountry($country, $filters = array())
4444 4444
 	{
4445
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4446
-		$filter_query = $this->getFilter($filters,true,true);
4447
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4445
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4446
+		$filter_query = $this->getFilter($filters, true, true);
4447
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4448 4448
 		 	    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
4449 4449
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4450 4450
 			    ORDER BY airline_count DESC";
@@ -4455,7 +4455,7 @@  discard block
 block discarded – undo
4455 4455
 
4456 4456
 		$airline_array = array();
4457 4457
 		$temp_array = array();
4458
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4458
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4459 4459
 		{
4460 4460
 			$temp_array['airline_name'] = $row['airline_name'];
4461 4461
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4474,11 +4474,11 @@  discard block
 block discarded – undo
4474 4474
 	* @return Array the airline country list
4475 4475
 	*
4476 4476
 	*/
4477
-	public function countAllAirlineCountriesByCountry($country,$filters = array())
4477
+	public function countAllAirlineCountriesByCountry($country, $filters = array())
4478 4478
 	{
4479
-		$filter_query = $this->getFilter($filters,true,true);
4480
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4481
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4479
+		$filter_query = $this->getFilter($filters, true, true);
4480
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4481
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4482 4482
 		 		FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
4483 4483
 				GROUP BY spotter_output.airline_country
4484 4484
 				ORDER BY airline_country_count DESC
@@ -4490,7 +4490,7 @@  discard block
 block discarded – undo
4490 4490
 
4491 4491
 		$airline_country_array = array();
4492 4492
 		$temp_array = array();
4493
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4493
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4494 4494
 		{
4495 4495
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4496 4496
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4509,8 +4509,8 @@  discard block
 block discarded – undo
4509 4509
 	*/
4510 4510
 	public function countAllAirlineCountries($limit = true, $filters = array())
4511 4511
 	{
4512
-		$filter_query = $this->getFilter($filters,true,true);
4513
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4512
+		$filter_query = $this->getFilter($filters, true, true);
4513
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4514 4514
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' 
4515 4515
 					GROUP BY spotter_output.airline_country
4516 4516
 					ORDER BY airline_country_count DESC";
@@ -4521,7 +4521,7 @@  discard block
 block discarded – undo
4521 4521
 
4522 4522
 		$airline_array = array();
4523 4523
 		$temp_array = array();
4524
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4524
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4525 4525
 		{
4526 4526
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4527 4527
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4537,11 +4537,11 @@  discard block
 block discarded – undo
4537 4537
 	* @return Array the airline country list
4538 4538
 	*
4539 4539
 	*/
4540
-	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4540
+	public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4541 4541
 	{
4542 4542
 		global $globalDBdriver;
4543 4543
 		//$filter_query = $this->getFilter($filters,true,true);
4544
-		$Connection= new Connection($this->db);
4544
+		$Connection = new Connection($this->db);
4545 4545
 		if (!$Connection->tableExists('countries')) return array();
4546 4546
 		/*
4547 4547
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -4556,7 +4556,7 @@  discard block
 block discarded – undo
4556 4556
 */
4557 4557
 		require_once('class.SpotterLive.php');
4558 4558
 		$SpotterLive = new SpotterLive();
4559
-		$filter_query = $SpotterLive->getFilter($filters,true,true);
4559
+		$filter_query = $SpotterLive->getFilter($filters, true, true);
4560 4560
 		$filter_query .= ' over_country IS NOT NULL';
4561 4561
                 if ($olderthanmonths > 0) {
4562 4562
 			if ($globalDBdriver == 'mysql') {
@@ -4583,7 +4583,7 @@  discard block
 block discarded – undo
4583 4583
 		$flight_array = array();
4584 4584
 		$temp_array = array();
4585 4585
         
4586
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4586
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4587 4587
 		{
4588 4588
 			$temp_array['flight_count'] = $row['nb'];
4589 4589
 			$temp_array['flight_country'] = $row['name'];
@@ -4601,12 +4601,12 @@  discard block
 block discarded – undo
4601 4601
 	* @return Array the aircraft list
4602 4602
 	*
4603 4603
 	*/
4604
-	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4604
+	public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4605 4605
 	{
4606 4606
 		global $globalDBdriver;
4607
-		$filter_query = $this->getFilter($filters,true,true);
4607
+		$filter_query = $this->getFilter($filters, true, true);
4608 4608
 
4609
-		$query  = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4609
+		$query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4610 4610
 		    FROM spotter_output ".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> ''";
4611 4611
 		if ($olderthanmonths > 0) {
4612 4612
 			if ($globalDBdriver == 'mysql') {
@@ -4631,7 +4631,7 @@  discard block
 block discarded – undo
4631 4631
 
4632 4632
 		$aircraft_array = array();
4633 4633
 		$temp_array = array();
4634
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4634
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4635 4635
 		{
4636 4636
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4637 4637
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4648,11 +4648,11 @@  discard block
 block discarded – undo
4648 4648
 	* @return Array the aircraft list
4649 4649
 	*
4650 4650
 	*/
4651
-	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4651
+	public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4652 4652
 	{
4653 4653
 		global $globalDBdriver;
4654
-		$filter_query = $this->getFilter($filters,true,true);
4655
-		$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 
4654
+		$filter_query = $this->getFilter($filters, true, true);
4655
+		$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 
4656 4656
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA' ";
4657 4657
 		if ($olderthanmonths > 0) {
4658 4658
 			if ($globalDBdriver == 'mysql') {
@@ -4677,7 +4677,7 @@  discard block
 block discarded – undo
4677 4677
 
4678 4678
 		$aircraft_array = array();
4679 4679
 		$temp_array = array();
4680
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4680
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4681 4681
 		{
4682 4682
 			$temp_array['airline_icao'] = $row['airline_icao'];
4683 4683
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -4695,11 +4695,11 @@  discard block
 block discarded – undo
4695 4695
 	* @return Array the aircraft list
4696 4696
 	*
4697 4697
 	*/
4698
-	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4698
+	public function countAllAircraftTypesByMonths($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4699 4699
 	{
4700 4700
 		global $globalDBdriver;
4701
-		$filter_query = $this->getFilter($filters,true,true);
4702
-		$query  = "SELECT EXTRACT(month from spotter_output.date) as month, EXTRACT(year from spotter_output.date) as year,spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4701
+		$filter_query = $this->getFilter($filters, true, true);
4702
+		$query = "SELECT EXTRACT(month from spotter_output.date) as month, EXTRACT(year from spotter_output.date) as year,spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4703 4703
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA' ";
4704 4704
 		if ($olderthanmonths > 0) {
4705 4705
 			if ($globalDBdriver == 'mysql') {
@@ -4724,7 +4724,7 @@  discard block
 block discarded – undo
4724 4724
 
4725 4725
 		$aircraft_array = array();
4726 4726
 		$temp_array = array();
4727
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4727
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4728 4728
 		{
4729 4729
 			//$temp_array['airline_icao'] = $row['airline_icao'];
4730 4730
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -4743,13 +4743,13 @@  discard block
 block discarded – undo
4743 4743
 	* @return Array the aircraft list
4744 4744
 	*
4745 4745
 	*/
4746
-	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
4746
+	public function countAllAircraftRegistrationByAircraft($aircraft_icao, $filters = array())
4747 4747
 	{
4748 4748
 		$Image = new Image($this->db);
4749
-		$filter_query = $this->getFilter($filters,true,true);
4750
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4749
+		$filter_query = $this->getFilter($filters, true, true);
4750
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4751 4751
 
4752
-		$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  
4752
+		$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  
4753 4753
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao  
4754 4754
 				GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4755 4755
 				ORDER BY registration_count DESC";
@@ -4760,14 +4760,14 @@  discard block
 block discarded – undo
4760 4760
 		$aircraft_array = array();
4761 4761
 		$temp_array = array();
4762 4762
         
4763
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4763
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4764 4764
 		{
4765 4765
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4766 4766
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4767 4767
 			$temp_array['registration'] = $row['registration'];
4768 4768
 			$temp_array['airline_name'] = $row['airline_name'];
4769 4769
 			$temp_array['image_thumbnail'] = "";
4770
-			if($row['registration'] != "")
4770
+			if ($row['registration'] != "")
4771 4771
 			{
4772 4772
 				$image_array = $Image->getSpotterImage($row['registration']);
4773 4773
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4786,11 +4786,11 @@  discard block
 block discarded – undo
4786 4786
 	* @return Array the aircraft list
4787 4787
 	*
4788 4788
 	*/
4789
-	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
4789
+	public function countAllAircraftTypesByAirline($airline_icao, $filters = array())
4790 4790
 	{
4791
-		$filter_query = $this->getFilter($filters,true,true);
4792
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4793
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4791
+		$filter_query = $this->getFilter($filters, true, true);
4792
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4793
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4794 4794
 			    FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao 
4795 4795
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
4796 4796
 			    ORDER BY aircraft_icao_count DESC";
@@ -4801,7 +4801,7 @@  discard block
 block discarded – undo
4801 4801
 		$aircraft_array = array();
4802 4802
 		$temp_array = array();
4803 4803
 
4804
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4804
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4805 4805
 		{
4806 4806
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4807 4807
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4819,13 +4819,13 @@  discard block
 block discarded – undo
4819 4819
 	* @return Array the aircraft list
4820 4820
 	*
4821 4821
 	*/
4822
-	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
4822
+	public function countAllAircraftRegistrationByAirline($airline_icao, $filters = array())
4823 4823
 	{
4824
-		$filter_query = $this->getFilter($filters,true,true);
4824
+		$filter_query = $this->getFilter($filters, true, true);
4825 4825
 		$Image = new Image($this->db);
4826
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4826
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4827 4827
 
4828
-		$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 
4828
+		$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 
4829 4829
 			    FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao 
4830 4830
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
4831 4831
 			    ORDER BY registration_count DESC";
@@ -4835,14 +4835,14 @@  discard block
 block discarded – undo
4835 4835
 
4836 4836
 		$aircraft_array = array();
4837 4837
 		$temp_array = array();
4838
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4838
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4839 4839
 		{
4840 4840
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4841 4841
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4842 4842
 			$temp_array['registration'] = $row['registration'];
4843 4843
 			$temp_array['airline_name'] = $row['airline_name'];
4844 4844
 			$temp_array['image_thumbnail'] = "";
4845
-			if($row['registration'] != "")
4845
+			if ($row['registration'] != "")
4846 4846
 			{
4847 4847
 				$image_array = $Image->getSpotterImage($row['registration']);
4848 4848
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4861,11 +4861,11 @@  discard block
 block discarded – undo
4861 4861
 	* @return Array the aircraft list
4862 4862
 	*
4863 4863
 	*/
4864
-	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
4864
+	public function countAllAircraftManufacturerByAirline($airline_icao, $filters = array())
4865 4865
 	{
4866
-		$filter_query = $this->getFilter($filters,true,true);
4867
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4868
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4866
+		$filter_query = $this->getFilter($filters, true, true);
4867
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4868
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4869 4869
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao 
4870 4870
 				GROUP BY spotter_output.aircraft_manufacturer 
4871 4871
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -4876,7 +4876,7 @@  discard block
 block discarded – undo
4876 4876
 		$aircraft_array = array();
4877 4877
 		$temp_array = array();
4878 4878
 
4879
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4879
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4880 4880
 		{
4881 4881
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4882 4882
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4893,12 +4893,12 @@  discard block
 block discarded – undo
4893 4893
 	* @return Array the aircraft list
4894 4894
 	*
4895 4895
 	*/
4896
-	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
4896
+	public function countAllAircraftTypesByAirport($airport_icao, $filters = array())
4897 4897
 	{
4898
-		$filter_query = $this->getFilter($filters,true,true);
4899
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4898
+		$filter_query = $this->getFilter($filters, true, true);
4899
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4900 4900
 
4901
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4901
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4902 4902
 				FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) 
4903 4903
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
4904 4904
 				ORDER BY aircraft_icao_count DESC";
@@ -4908,7 +4908,7 @@  discard block
 block discarded – undo
4908 4908
 
4909 4909
 		$aircraft_array = array();
4910 4910
 		$temp_array = array();
4911
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4911
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4912 4912
 		{
4913 4913
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4914 4914
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4926,13 +4926,13 @@  discard block
 block discarded – undo
4926 4926
 	* @return Array the aircraft list
4927 4927
 	*
4928 4928
 	*/
4929
-	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
4929
+	public function countAllAircraftRegistrationByAirport($airport_icao, $filters = array())
4930 4930
 	{
4931
-		$filter_query = $this->getFilter($filters,true,true);
4931
+		$filter_query = $this->getFilter($filters, true, true);
4932 4932
 		$Image = new Image($this->db);
4933
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4933
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4934 4934
 
4935
-		$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  
4935
+		$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  
4936 4936
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)   
4937 4937
                     GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
4938 4938
 		    ORDER BY registration_count DESC";
@@ -4942,14 +4942,14 @@  discard block
 block discarded – undo
4942 4942
 
4943 4943
 		$aircraft_array = array();
4944 4944
 		$temp_array = array();
4945
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4945
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4946 4946
 		{
4947 4947
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4948 4948
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4949 4949
 			$temp_array['registration'] = $row['registration'];
4950 4950
 			$temp_array['airline_name'] = $row['airline_name'];
4951 4951
 			$temp_array['image_thumbnail'] = "";
4952
-			if($row['registration'] != "")
4952
+			if ($row['registration'] != "")
4953 4953
 			{
4954 4954
 				$image_array = $Image->getSpotterImage($row['registration']);
4955 4955
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4967,11 +4967,11 @@  discard block
 block discarded – undo
4967 4967
 	* @return Array the aircraft list
4968 4968
 	*
4969 4969
 	*/
4970
-	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
4970
+	public function countAllAircraftManufacturerByAirport($airport_icao, $filters = array())
4971 4971
 	{
4972
-		$filter_query = $this->getFilter($filters,true,true);
4973
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4974
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4972
+		$filter_query = $this->getFilter($filters, true, true);
4973
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4974
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4975 4975
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)  
4976 4976
                     GROUP BY spotter_output.aircraft_manufacturer 
4977 4977
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -4982,7 +4982,7 @@  discard block
 block discarded – undo
4982 4982
 
4983 4983
 		$aircraft_array = array();
4984 4984
 		$temp_array = array();
4985
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4985
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4986 4986
 		{
4987 4987
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4988 4988
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4997,12 +4997,12 @@  discard block
 block discarded – undo
4997 4997
 	* @return Array the aircraft list
4998 4998
 	*
4999 4999
 	*/
5000
-	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
5000
+	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer, $filters = array())
5001 5001
 	{
5002
-		$filter_query = $this->getFilter($filters,true,true);
5003
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5002
+		$filter_query = $this->getFilter($filters, true, true);
5003
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5004 5004
 
5005
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5005
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5006 5006
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
5007 5007
                     GROUP BY spotter_output.aircraft_name 
5008 5008
 					ORDER BY aircraft_icao_count DESC";
@@ -5011,7 +5011,7 @@  discard block
 block discarded – undo
5011 5011
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
5012 5012
 		$aircraft_array = array();
5013 5013
 		$temp_array = array();
5014
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5014
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5015 5015
 		{
5016 5016
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5017 5017
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5030,11 +5030,11 @@  discard block
 block discarded – undo
5030 5030
 	*/
5031 5031
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
5032 5032
 	{
5033
-		$filter_query = $this->getFilter($filters,true,true);
5033
+		$filter_query = $this->getFilter($filters, true, true);
5034 5034
 		$Image = new Image($this->db);
5035
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5035
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5036 5036
 
5037
-		$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   
5037
+		$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   
5038 5038
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
5039 5039
                     GROUP BY spotter_output.registration 
5040 5040
 					ORDER BY registration_count DESC";
@@ -5044,14 +5044,14 @@  discard block
 block discarded – undo
5044 5044
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
5045 5045
 		$aircraft_array = array();
5046 5046
 		$temp_array = array();
5047
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5047
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5048 5048
 		{
5049 5049
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5050 5050
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5051 5051
 			$temp_array['registration'] = $row['registration'];
5052 5052
 			$temp_array['airline_name'] = $row['airline_name'];
5053 5053
 			$temp_array['image_thumbnail'] = "";
5054
-			if($row['registration'] != "")
5054
+			if ($row['registration'] != "")
5055 5055
 			{
5056 5056
 				$image_array = $Image->getSpotterImage($row['registration']);
5057 5057
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5068,11 +5068,11 @@  discard block
 block discarded – undo
5068 5068
 	* @return Array the aircraft list
5069 5069
 	*
5070 5070
 	*/
5071
-	public function countAllAircraftTypesByDate($date,$filters = array())
5071
+	public function countAllAircraftTypesByDate($date, $filters = array())
5072 5072
 	{
5073 5073
 		global $globalTimezone, $globalDBdriver;
5074
-		$filter_query = $this->getFilter($filters,true,true);
5075
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5074
+		$filter_query = $this->getFilter($filters, true, true);
5075
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5076 5076
 		if ($globalTimezone != '') {
5077 5077
 			date_default_timezone_set($globalTimezone);
5078 5078
 			$datetime = new DateTime($date);
@@ -5080,12 +5080,12 @@  discard block
 block discarded – undo
5080 5080
 		} else $offset = '+00:00';
5081 5081
 
5082 5082
 		if ($globalDBdriver == 'mysql') {
5083
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5083
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5084 5084
 					FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
5085 5085
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5086 5086
 					ORDER BY aircraft_icao_count DESC";
5087 5087
 		} else {
5088
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5088
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5089 5089
 					FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
5090 5090
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5091 5091
 					ORDER BY aircraft_icao_count DESC";
@@ -5096,7 +5096,7 @@  discard block
 block discarded – undo
5096 5096
 
5097 5097
 		$aircraft_array = array();
5098 5098
 		$temp_array = array();
5099
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5099
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5100 5100
 		{
5101 5101
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5102 5102
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5114,12 +5114,12 @@  discard block
 block discarded – undo
5114 5114
 	* @return Array the aircraft list
5115 5115
 	*
5116 5116
 	*/
5117
-	public function countAllAircraftRegistrationByDate($date,$filters = array())
5117
+	public function countAllAircraftRegistrationByDate($date, $filters = array())
5118 5118
 	{
5119 5119
 		global $globalTimezone, $globalDBdriver;
5120
-		$filter_query = $this->getFilter($filters,true,true);
5120
+		$filter_query = $this->getFilter($filters, true, true);
5121 5121
 		$Image = new Image($this->db);
5122
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5122
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5123 5123
 		if ($globalTimezone != '') {
5124 5124
 			date_default_timezone_set($globalTimezone);
5125 5125
 			$datetime = new DateTime($date);
@@ -5127,12 +5127,12 @@  discard block
 block discarded – undo
5127 5127
 		} else $offset = '+00:00';
5128 5128
 
5129 5129
 		if ($globalDBdriver == 'mysql') {
5130
-			$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 
5130
+			$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 
5131 5131
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
5132 5132
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5133 5133
 					ORDER BY registration_count DESC";
5134 5134
 		} else {
5135
-			$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    
5135
+			$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    
5136 5136
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5137 5137
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5138 5138
 					ORDER BY registration_count DESC";
@@ -5143,14 +5143,14 @@  discard block
 block discarded – undo
5143 5143
 
5144 5144
 		$aircraft_array = array();
5145 5145
 		$temp_array = array();
5146
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5146
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5147 5147
 		{
5148 5148
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5149 5149
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5150 5150
 			$temp_array['registration'] = $row['registration'];
5151 5151
 			$temp_array['airline_name'] = $row['airline_name'];
5152 5152
 			$temp_array['image_thumbnail'] = "";
5153
-			if($row['registration'] != "")
5153
+			if ($row['registration'] != "")
5154 5154
 			{
5155 5155
 				$image_array = $Image->getSpotterImage($row['registration']);
5156 5156
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5169,11 +5169,11 @@  discard block
 block discarded – undo
5169 5169
 	* @return Array the aircraft manufacturer list
5170 5170
 	*
5171 5171
 	*/
5172
-	public function countAllAircraftManufacturerByDate($date,$filters = array())
5172
+	public function countAllAircraftManufacturerByDate($date, $filters = array())
5173 5173
 	{
5174 5174
 		global $globalTimezone, $globalDBdriver;
5175
-		$filter_query = $this->getFilter($filters,true,true);
5176
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5175
+		$filter_query = $this->getFilter($filters, true, true);
5176
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5177 5177
 		if ($globalTimezone != '') {
5178 5178
 			date_default_timezone_set($globalTimezone);
5179 5179
 			$datetime = new DateTime($date);
@@ -5181,12 +5181,12 @@  discard block
 block discarded – undo
5181 5181
 		} else $offset = '+00:00';
5182 5182
 
5183 5183
 		if ($globalDBdriver == 'mysql') {
5184
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5184
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5185 5185
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
5186 5186
 				GROUP BY spotter_output.aircraft_manufacturer 
5187 5187
 				ORDER BY aircraft_manufacturer_count DESC";
5188 5188
 		} else {
5189
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5189
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5190 5190
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5191 5191
 				GROUP BY spotter_output.aircraft_manufacturer 
5192 5192
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -5198,7 +5198,7 @@  discard block
 block discarded – undo
5198 5198
 		$aircraft_array = array();
5199 5199
 		$temp_array = array();
5200 5200
 
5201
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5201
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5202 5202
 		{
5203 5203
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5204 5204
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5215,11 +5215,11 @@  discard block
 block discarded – undo
5215 5215
 	* @return Array the aircraft list
5216 5216
 	*
5217 5217
 	*/
5218
-	public function countAllAircraftTypesByIdent($ident,$filters = array())
5218
+	public function countAllAircraftTypesByIdent($ident, $filters = array())
5219 5219
 	{
5220
-		$filter_query = $this->getFilter($filters,true,true);
5221
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5222
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5220
+		$filter_query = $this->getFilter($filters, true, true);
5221
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5222
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5223 5223
 				FROM spotter_output".$filter_query." spotter_output.ident = :ident 
5224 5224
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
5225 5225
 				ORDER BY aircraft_icao_count DESC";
@@ -5230,7 +5230,7 @@  discard block
 block discarded – undo
5230 5230
 		$aircraft_array = array();
5231 5231
 		$temp_array = array();
5232 5232
 
5233
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5233
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5234 5234
 		{
5235 5235
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5236 5236
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5248,13 +5248,13 @@  discard block
 block discarded – undo
5248 5248
 	* @return Array the aircraft list
5249 5249
 	*
5250 5250
 	*/
5251
-	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5251
+	public function countAllAircraftRegistrationByIdent($ident, $filters = array())
5252 5252
 	{
5253
-		$filter_query = $this->getFilter($filters,true,true);
5253
+		$filter_query = $this->getFilter($filters, true, true);
5254 5254
 		$Image = new Image($this->db);
5255
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5255
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5256 5256
 
5257
-		$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  
5257
+		$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  
5258 5258
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.ident = :ident   
5259 5259
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
5260 5260
 		    ORDER BY registration_count DESC";
@@ -5266,14 +5266,14 @@  discard block
 block discarded – undo
5266 5266
 		$aircraft_array = array();
5267 5267
 		$temp_array = array();
5268 5268
         
5269
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5269
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5270 5270
 		{
5271 5271
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5272 5272
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5273 5273
 			$temp_array['registration'] = $row['registration'];
5274 5274
 			$temp_array['airline_name'] = $row['airline_name'];
5275 5275
 			$temp_array['image_thumbnail'] = "";
5276
-			if($row['registration'] != "")
5276
+			if ($row['registration'] != "")
5277 5277
 			{
5278 5278
 				$image_array = $Image->getSpotterImage($row['registration']);
5279 5279
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5292,11 +5292,11 @@  discard block
 block discarded – undo
5292 5292
 	* @return Array the aircraft manufacturer list
5293 5293
 	*
5294 5294
 	*/
5295
-	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5295
+	public function countAllAircraftManufacturerByIdent($ident, $filters = array())
5296 5296
 	{
5297
-		$filter_query = $this->getFilter($filters,true,true);
5298
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5299
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5297
+		$filter_query = $this->getFilter($filters, true, true);
5298
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5299
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5300 5300
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident  
5301 5301
                     GROUP BY spotter_output.aircraft_manufacturer 
5302 5302
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5306,7 +5306,7 @@  discard block
 block discarded – undo
5306 5306
 		$sth->execute(array(':ident' => $ident));
5307 5307
 		$aircraft_array = array();
5308 5308
 		$temp_array = array();
5309
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5309
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5310 5310
 		{
5311 5311
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5312 5312
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5322,24 +5322,24 @@  discard block
 block discarded – undo
5322 5322
 	* @return Array the aircraft list
5323 5323
 	*
5324 5324
 	*/
5325
-	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5325
+	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5326 5326
 	{
5327
-		$filter_query = $this->getFilter($filters,true,true);
5328
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5329
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5327
+		$filter_query = $this->getFilter($filters, true, true);
5328
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5329
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5330 5330
 		
5331 5331
 
5332
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5332
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5333 5333
                     FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
5334 5334
                     GROUP BY spotter_output.aircraft_name 
5335 5335
 					ORDER BY aircraft_icao_count DESC";
5336 5336
  
5337 5337
 		
5338 5338
 		$sth = $this->db->prepare($query);
5339
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5339
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5340 5340
 		$aircraft_array = array();
5341 5341
 		$temp_array = array();
5342
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5342
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5343 5343
 		{
5344 5344
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5345 5345
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5355,33 +5355,33 @@  discard block
 block discarded – undo
5355 5355
 	* @return Array the aircraft list
5356 5356
 	*
5357 5357
 	*/
5358
-	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5358
+	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5359 5359
 	{
5360
-		$filter_query = $this->getFilter($filters,true,true);
5360
+		$filter_query = $this->getFilter($filters, true, true);
5361 5361
 		$Image = new Image($this->db);
5362
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5363
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5362
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5363
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5364 5364
 
5365
-		$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   
5365
+		$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   
5366 5366
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)   
5367 5367
                     GROUP BY spotter_output.registration 
5368 5368
 					ORDER BY registration_count DESC";
5369 5369
 
5370 5370
 		
5371 5371
 		$sth = $this->db->prepare($query);
5372
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5372
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5373 5373
       
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['aircraft_icao'] = $row['aircraft_icao'];
5380 5380
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5381 5381
 			$temp_array['registration'] = $row['registration'];
5382 5382
 			$temp_array['airline_name'] = $row['airline_name'];
5383 5383
 			$temp_array['image_thumbnail'] = "";
5384
-			if($row['registration'] != "")
5384
+			if ($row['registration'] != "")
5385 5385
 			{
5386 5386
 				$image_array = $Image->getSpotterImage($row['registration']);
5387 5387
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5401,25 +5401,25 @@  discard block
 block discarded – undo
5401 5401
 	* @return Array the aircraft manufacturer list
5402 5402
 	*
5403 5403
 	*/
5404
-	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5404
+	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5405 5405
 	{
5406
-		$filter_query = $this->getFilter($filters,true,true);
5407
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5408
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5406
+		$filter_query = $this->getFilter($filters, true, true);
5407
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5408
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5409 5409
 
5410
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5410
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5411 5411
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
5412 5412
                     GROUP BY spotter_output.aircraft_manufacturer 
5413 5413
 					ORDER BY aircraft_manufacturer_count DESC";
5414 5414
 
5415 5415
 		
5416 5416
 		$sth = $this->db->prepare($query);
5417
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5417
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5418 5418
       
5419 5419
 		$aircraft_array = array();
5420 5420
 		$temp_array = array();
5421 5421
         
5422
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5422
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5423 5423
 		{
5424 5424
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5425 5425
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5439,11 +5439,11 @@  discard block
 block discarded – undo
5439 5439
 	* @return Array the aircraft list
5440 5440
 	*
5441 5441
 	*/
5442
-	public function countAllAircraftTypesByCountry($country,$filters = array())
5442
+	public function countAllAircraftTypesByCountry($country, $filters = array())
5443 5443
 	{
5444
-		$filter_query = $this->getFilter($filters,true,true);
5445
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5446
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5444
+		$filter_query = $this->getFilter($filters, true, true);
5445
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5446
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5447 5447
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
5448 5448
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5449 5449
 			    ORDER BY aircraft_icao_count DESC";
@@ -5455,7 +5455,7 @@  discard block
 block discarded – undo
5455 5455
 		$aircraft_array = array();
5456 5456
 		$temp_array = array();
5457 5457
         
5458
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5458
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5459 5459
 		{
5460 5460
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5461 5461
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5474,12 +5474,12 @@  discard block
 block discarded – undo
5474 5474
 	* @return Array the aircraft list
5475 5475
 	*
5476 5476
 	*/
5477
-	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5477
+	public function countAllAircraftRegistrationByCountry($country, $filters = array())
5478 5478
 	{
5479
-		$filter_query = $this->getFilter($filters,true,true);
5479
+		$filter_query = $this->getFilter($filters, true, true);
5480 5480
 		$Image = new Image($this->db);
5481
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5482
-		$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 
5481
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5482
+		$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 
5483 5483
 			    FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country)    
5484 5484
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5485 5485
 			    ORDER BY registration_count DESC";
@@ -5491,14 +5491,14 @@  discard block
 block discarded – undo
5491 5491
 		$aircraft_array = array();
5492 5492
 		$temp_array = array();
5493 5493
         
5494
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5494
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5495 5495
 		{
5496 5496
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5497 5497
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5498 5498
 			$temp_array['registration'] = $row['registration'];
5499 5499
 			$temp_array['airline_name'] = $row['airline_name'];
5500 5500
 			$temp_array['image_thumbnail'] = "";
5501
-			if($row['registration'] != "")
5501
+			if ($row['registration'] != "")
5502 5502
 			{
5503 5503
 				$image_array = $Image->getSpotterImage($row['registration']);
5504 5504
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5518,11 +5518,11 @@  discard block
 block discarded – undo
5518 5518
 	* @return Array the aircraft manufacturer list
5519 5519
 	*
5520 5520
 	*/
5521
-	public function countAllAircraftManufacturerByCountry($country,$filters = array())
5521
+	public function countAllAircraftManufacturerByCountry($country, $filters = array())
5522 5522
 	{
5523
-		$filter_query = $this->getFilter($filters,true,true);
5524
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5525
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5523
+		$filter_query = $this->getFilter($filters, true, true);
5524
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5525
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5526 5526
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country) 
5527 5527
                     GROUP BY spotter_output.aircraft_manufacturer 
5528 5528
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5534,7 +5534,7 @@  discard block
 block discarded – undo
5534 5534
 		$aircraft_array = array();
5535 5535
 		$temp_array = array();
5536 5536
         
5537
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5537
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5538 5538
 		{
5539 5539
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5540 5540
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5555,8 +5555,8 @@  discard block
 block discarded – undo
5555 5555
 	*/
5556 5556
 	public function countAllAircraftManufacturers($filters = array())
5557 5557
 	{
5558
-		$filter_query = $this->getFilter($filters,true,true);
5559
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5558
+		$filter_query = $this->getFilter($filters, true, true);
5559
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5560 5560
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5561 5561
                 $query .= " GROUP BY spotter_output.aircraft_manufacturer
5562 5562
 					ORDER BY aircraft_manufacturer_count DESC
@@ -5569,7 +5569,7 @@  discard block
 block discarded – undo
5569 5569
 		$manufacturer_array = array();
5570 5570
 		$temp_array = array();
5571 5571
         
5572
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5572
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5573 5573
 		{
5574 5574
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5575 5575
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5588,12 +5588,12 @@  discard block
 block discarded – undo
5588 5588
 	* @return Array the aircraft list
5589 5589
 	*
5590 5590
 	*/
5591
-	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5591
+	public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5592 5592
 	{
5593 5593
 		global $globalDBdriver;
5594 5594
 		$Image = new Image($this->db);
5595
-		$filter_query = $this->getFilter($filters,true,true);
5596
-		$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    
5595
+		$filter_query = $this->getFilter($filters, true, true);
5596
+		$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    
5597 5597
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5598 5598
                 if ($olderthanmonths > 0) {
5599 5599
             		if ($globalDBdriver == 'mysql') {
@@ -5621,7 +5621,7 @@  discard block
 block discarded – undo
5621 5621
 		$aircraft_array = array();
5622 5622
 		$temp_array = array();
5623 5623
         
5624
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5624
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5625 5625
 		{
5626 5626
 			$temp_array['registration'] = $row['registration'];
5627 5627
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -5629,7 +5629,7 @@  discard block
 block discarded – undo
5629 5629
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5630 5630
 			$temp_array['airline_name'] = $row['airline_name'];
5631 5631
 			$temp_array['image_thumbnail'] = "";
5632
-			if($row['registration'] != "")
5632
+			if ($row['registration'] != "")
5633 5633
 			{
5634 5634
 				$image_array = $Image->getSpotterImage($row['registration']);
5635 5635
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5648,12 +5648,12 @@  discard block
 block discarded – undo
5648 5648
 	* @return Array the aircraft list
5649 5649
 	*
5650 5650
 	*/
5651
-	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5651
+	public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5652 5652
 	{
5653 5653
 		global $globalDBdriver;
5654
-		$filter_query = $this->getFilter($filters,true,true);
5654
+		$filter_query = $this->getFilter($filters, true, true);
5655 5655
 		$Image = new Image($this->db);
5656
-		$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    
5656
+		$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    
5657 5657
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5658 5658
                 if ($olderthanmonths > 0) {
5659 5659
             		if ($globalDBdriver == 'mysql') {
@@ -5681,7 +5681,7 @@  discard block
 block discarded – undo
5681 5681
 		$aircraft_array = array();
5682 5682
 		$temp_array = array();
5683 5683
         
5684
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5684
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5685 5685
 		{
5686 5686
 			$temp_array['registration'] = $row['registration'];
5687 5687
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -5690,7 +5690,7 @@  discard block
 block discarded – undo
5690 5690
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5691 5691
 			$temp_array['airline_name'] = $row['airline_name'];
5692 5692
 			$temp_array['image_thumbnail'] = "";
5693
-			if($row['registration'] != "")
5693
+			if ($row['registration'] != "")
5694 5694
 			{
5695 5695
 				$image_array = $Image->getSpotterImage($row['registration']);
5696 5696
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5709,11 +5709,11 @@  discard block
 block discarded – undo
5709 5709
 	* @return Array the airport list
5710 5710
 	*
5711 5711
 	*/
5712
-	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5712
+	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5713 5713
 	{
5714 5714
 		global $globalDBdriver;
5715
-		$filter_query = $this->getFilter($filters,true,true);
5716
-		$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 
5715
+		$filter_query = $this->getFilter($filters, true, true);
5716
+		$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 
5717 5717
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
5718 5718
                 if ($olderthanmonths > 0) {
5719 5719
             		if ($globalDBdriver == 'mysql') {
@@ -5742,7 +5742,7 @@  discard block
 block discarded – undo
5742 5742
 		$airport_array = array();
5743 5743
 		$temp_array = array();
5744 5744
         
5745
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5745
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5746 5746
 		{
5747 5747
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5748 5748
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5761,11 +5761,11 @@  discard block
 block discarded – undo
5761 5761
 	* @return Array the airport list
5762 5762
 	*
5763 5763
 	*/
5764
-	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5764
+	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5765 5765
 	{
5766 5766
 		global $globalDBdriver;
5767
-		$filter_query = $this->getFilter($filters,true,true);
5768
-		$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 
5767
+		$filter_query = $this->getFilter($filters, true, true);
5768
+		$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 
5769 5769
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' ";
5770 5770
                 if ($olderthanmonths > 0) {
5771 5771
             		if ($globalDBdriver == 'mysql') {
@@ -5794,7 +5794,7 @@  discard block
 block discarded – undo
5794 5794
 		$airport_array = array();
5795 5795
 		$temp_array = array();
5796 5796
         
5797
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5797
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5798 5798
 		{
5799 5799
 			$temp_array['airline_icao'] = $row['airline_icao'];
5800 5800
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -5814,11 +5814,11 @@  discard block
 block discarded – undo
5814 5814
 	* @return Array the airport list
5815 5815
 	*
5816 5816
 	*/
5817
-	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5817
+	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5818 5818
 	{
5819 5819
 		global $globalDBdriver;
5820
-		$filter_query = $this->getFilter($filters,true,true);
5821
-		$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
5820
+		$filter_query = $this->getFilter($filters, true, true);
5821
+		$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
5822 5822
 				FROM airport, spotter_output".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao";
5823 5823
                 if ($olderthanmonths > 0) {
5824 5824
             		if ($globalDBdriver == 'mysql') {
@@ -5846,7 +5846,7 @@  discard block
 block discarded – undo
5846 5846
 		$airport_array = array();
5847 5847
 		$temp_array = array();
5848 5848
         
5849
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5849
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5850 5850
 		{
5851 5851
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5852 5852
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5865,11 +5865,11 @@  discard block
 block discarded – undo
5865 5865
 	* @return Array the airport list
5866 5866
 	*
5867 5867
 	*/
5868
-	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5868
+	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5869 5869
 	{
5870 5870
 		global $globalDBdriver;
5871
-		$filter_query = $this->getFilter($filters,true,true);
5872
-		$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
5871
+		$filter_query = $this->getFilter($filters, true, true);
5872
+		$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
5873 5873
 				FROM airport, spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao ";
5874 5874
                 if ($olderthanmonths > 0) {
5875 5875
             		if ($globalDBdriver == 'mysql') {
@@ -5898,7 +5898,7 @@  discard block
 block discarded – undo
5898 5898
 		$airport_array = array();
5899 5899
 		$temp_array = array();
5900 5900
         
5901
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5901
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5902 5902
 		{
5903 5903
 			$temp_array['airline_icao'] = $row['airline_icao'];
5904 5904
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -5918,11 +5918,11 @@  discard block
 block discarded – undo
5918 5918
 	* @return Array the airport list
5919 5919
 	*
5920 5920
 	*/
5921
-	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
5921
+	public function countAllDepartureAirportsByAirline($airline_icao, $filters = array())
5922 5922
 	{
5923
-		$filter_query = $this->getFilter($filters,true,true);
5924
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5925
-		$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 
5923
+		$filter_query = $this->getFilter($filters, true, true);
5924
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5925
+		$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 
5926 5926
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao AND spotter_output.departure_airport_icao <> '' 
5927 5927
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5928 5928
 			    ORDER BY airport_departure_icao_count DESC";
@@ -5934,7 +5934,7 @@  discard block
 block discarded – undo
5934 5934
 		$airport_array = array();
5935 5935
 		$temp_array = array();
5936 5936
         
5937
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5937
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5938 5938
 		{
5939 5939
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5940 5940
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5956,11 +5956,11 @@  discard block
 block discarded – undo
5956 5956
 	* @return Array the airport list
5957 5957
 	*
5958 5958
 	*/
5959
-	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
5959
+	public function countAllDepartureAirportCountriesByAirline($airline_icao, $filters = array())
5960 5960
 	{
5961
-		$filter_query = $this->getFilter($filters,true,true);
5962
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5963
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5961
+		$filter_query = $this->getFilter($filters, true, true);
5962
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5963
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5964 5964
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
5965 5965
                     GROUP BY spotter_output.departure_airport_country
5966 5966
 					ORDER BY airport_departure_country_count DESC";
@@ -5972,7 +5972,7 @@  discard block
 block discarded – undo
5972 5972
 		$airport_array = array();
5973 5973
 		$temp_array = array();
5974 5974
         
5975
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5975
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5976 5976
 		{
5977 5977
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5978 5978
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5991,11 +5991,11 @@  discard block
 block discarded – undo
5991 5991
 	* @return Array the airport list
5992 5992
 	*
5993 5993
 	*/
5994
-	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
5994
+	public function countAllDepartureAirportsByAircraft($aircraft_icao, $filters = array())
5995 5995
 	{
5996
-		$filter_query = $this->getFilter($filters,true,true);
5997
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5998
-		$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 
5996
+		$filter_query = $this->getFilter($filters, true, true);
5997
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5998
+		$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 
5999 5999
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao AND spotter_output.departure_airport_icao <> '' 
6000 6000
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6001 6001
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6007,7 +6007,7 @@  discard block
 block discarded – undo
6007 6007
 		$airport_array = array();
6008 6008
 		$temp_array = array();
6009 6009
         
6010
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6010
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6011 6011
 		{
6012 6012
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6013 6013
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6028,11 +6028,11 @@  discard block
 block discarded – undo
6028 6028
 	* @return Array the airport list
6029 6029
 	*
6030 6030
 	*/
6031
-	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
6031
+	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao, $filters = array())
6032 6032
 	{
6033
-		$filter_query = $this->getFilter($filters,true,true);
6034
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6035
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6033
+		$filter_query = $this->getFilter($filters, true, true);
6034
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6035
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6036 6036
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
6037 6037
                     GROUP BY spotter_output.departure_airport_country
6038 6038
 					ORDER BY airport_departure_country_count DESC";
@@ -6044,7 +6044,7 @@  discard block
 block discarded – undo
6044 6044
 		$airport_array = array();
6045 6045
 		$temp_array = array();
6046 6046
         
6047
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6047
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6048 6048
 		{
6049 6049
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6050 6050
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6062,11 +6062,11 @@  discard block
 block discarded – undo
6062 6062
 	* @return Array the airport list
6063 6063
 	*
6064 6064
 	*/
6065
-	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
6065
+	public function countAllDepartureAirportsByRegistration($registration, $filters = array())
6066 6066
 	{
6067
-		$filter_query = $this->getFilter($filters,true,true);
6068
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6069
-		$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 
6067
+		$filter_query = $this->getFilter($filters, true, true);
6068
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6069
+		$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 
6070 6070
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.registration = :registration AND spotter_output.departure_airport_icao <> '' 
6071 6071
                     GROUP BY spotter_output.departure_airport_icao
6072 6072
 					ORDER BY airport_departure_icao_count DESC";
@@ -6078,7 +6078,7 @@  discard block
 block discarded – undo
6078 6078
 		$airport_array = array();
6079 6079
 		$temp_array = array();
6080 6080
         
6081
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6081
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6082 6082
 		{
6083 6083
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6084 6084
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6099,11 +6099,11 @@  discard block
 block discarded – undo
6099 6099
 	* @return Array the airport list
6100 6100
 	*
6101 6101
 	*/
6102
-	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
6102
+	public function countAllDepartureAirportCountriesByRegistration($registration, $filters = array())
6103 6103
 	{
6104
-		$filter_query = $this->getFilter($filters,true,true);
6105
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6106
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6104
+		$filter_query = $this->getFilter($filters, true, true);
6105
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6106
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6107 6107
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration 
6108 6108
                     GROUP BY spotter_output.departure_airport_country
6109 6109
 					ORDER BY airport_departure_country_count DESC";
@@ -6115,7 +6115,7 @@  discard block
 block discarded – undo
6115 6115
 		$airport_array = array();
6116 6116
 		$temp_array = array();
6117 6117
         
6118
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6118
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6119 6119
 		{
6120 6120
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6121 6121
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6133,11 +6133,11 @@  discard block
 block discarded – undo
6133 6133
 	* @return Array the airport list
6134 6134
 	*
6135 6135
 	*/
6136
-	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
6136
+	public function countAllDepartureAirportsByAirport($airport_icao, $filters = array())
6137 6137
 	{
6138
-		$filter_query = $this->getFilter($filters,true,true);
6139
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6140
-		$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 
6138
+		$filter_query = $this->getFilter($filters, true, true);
6139
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6140
+		$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 
6141 6141
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao = :airport_icao AND spotter_output.departure_airport_icao <> '' 
6142 6142
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6143 6143
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6149,7 +6149,7 @@  discard block
 block discarded – undo
6149 6149
 		$airport_array = array();
6150 6150
 		$temp_array = array();
6151 6151
         
6152
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6152
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6153 6153
 		{
6154 6154
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6155 6155
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6170,11 +6170,11 @@  discard block
 block discarded – undo
6170 6170
 	* @return Array the airport list
6171 6171
 	*
6172 6172
 	*/
6173
-	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
6173
+	public function countAllDepartureAirportCountriesByAirport($airport_icao, $filters = array())
6174 6174
 	{
6175
-		$filter_query = $this->getFilter($filters,true,true);
6176
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6177
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6175
+		$filter_query = $this->getFilter($filters, true, true);
6176
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6177
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6178 6178
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao 
6179 6179
                     GROUP BY spotter_output.departure_airport_country
6180 6180
 					ORDER BY airport_departure_country_count DESC";
@@ -6186,7 +6186,7 @@  discard block
 block discarded – undo
6186 6186
 		$airport_array = array();
6187 6187
 		$temp_array = array();
6188 6188
         
6189
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6189
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6190 6190
 		{
6191 6191
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6192 6192
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6205,11 +6205,11 @@  discard block
 block discarded – undo
6205 6205
 	* @return Array the airport list
6206 6206
 	*
6207 6207
 	*/
6208
-	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6208
+	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer, $filters = array())
6209 6209
 	{
6210
-		$filter_query = $this->getFilter($filters,true,true);
6211
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6212
-		$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 
6210
+		$filter_query = $this->getFilter($filters, true, true);
6211
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6212
+		$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 
6213 6213
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer AND spotter_output.departure_airport_icao <> '' 
6214 6214
                     GROUP BY spotter_output.departure_airport_icao
6215 6215
 					ORDER BY airport_departure_icao_count DESC";
@@ -6221,7 +6221,7 @@  discard block
 block discarded – undo
6221 6221
 		$airport_array = array();
6222 6222
 		$temp_array = array();
6223 6223
         
6224
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6224
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6225 6225
 		{
6226 6226
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6227 6227
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6242,11 +6242,11 @@  discard block
 block discarded – undo
6242 6242
 	* @return Array the airport list
6243 6243
 	*
6244 6244
 	*/
6245
-	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6245
+	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
6246 6246
 	{
6247
-		$filter_query = $this->getFilter($filters,true,true);
6248
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6249
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6247
+		$filter_query = $this->getFilter($filters, true, true);
6248
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6249
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6250 6250
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6251 6251
                     GROUP BY spotter_output.departure_airport_country
6252 6252
 					ORDER BY airport_departure_country_count DESC";
@@ -6258,7 +6258,7 @@  discard block
 block discarded – undo
6258 6258
 		$airport_array = array();
6259 6259
 		$temp_array = array();
6260 6260
         
6261
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6261
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6262 6262
 		{
6263 6263
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6264 6264
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6276,11 +6276,11 @@  discard block
 block discarded – undo
6276 6276
 	* @return Array the airport list
6277 6277
 	*
6278 6278
 	*/
6279
-	public function countAllDepartureAirportsByDate($date,$filters = array())
6279
+	public function countAllDepartureAirportsByDate($date, $filters = array())
6280 6280
 	{
6281 6281
 		global $globalTimezone, $globalDBdriver;
6282
-		$filter_query = $this->getFilter($filters,true,true);
6283
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6282
+		$filter_query = $this->getFilter($filters, true, true);
6283
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6284 6284
 		if ($globalTimezone != '') {
6285 6285
 			date_default_timezone_set($globalTimezone);
6286 6286
 			$datetime = new DateTime($date);
@@ -6288,12 +6288,12 @@  discard block
 block discarded – undo
6288 6288
 		} else $offset = '+00:00';
6289 6289
 
6290 6290
 		if ($globalDBdriver == 'mysql') {
6291
-			$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 
6291
+			$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 
6292 6292
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
6293 6293
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6294 6294
 					ORDER BY airport_departure_icao_count DESC";
6295 6295
 		} else {
6296
-			$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 
6296
+			$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 
6297 6297
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
6298 6298
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6299 6299
 					ORDER BY airport_departure_icao_count DESC";
@@ -6305,7 +6305,7 @@  discard block
 block discarded – undo
6305 6305
 		$airport_array = array();
6306 6306
 		$temp_array = array();
6307 6307
         
6308
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6308
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6309 6309
 		{
6310 6310
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6311 6311
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6326,11 +6326,11 @@  discard block
 block discarded – undo
6326 6326
 	* @return Array the airport list
6327 6327
 	*
6328 6328
 	*/
6329
-	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6329
+	public function countAllDepartureAirportCountriesByDate($date, $filters = array())
6330 6330
 	{
6331 6331
 		global $globalTimezone, $globalDBdriver;
6332
-		$filter_query = $this->getFilter($filters,true,true);
6333
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6332
+		$filter_query = $this->getFilter($filters, true, true);
6333
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6334 6334
 		if ($globalTimezone != '') {
6335 6335
 			date_default_timezone_set($globalTimezone);
6336 6336
 			$datetime = new DateTime($date);
@@ -6338,12 +6338,12 @@  discard block
 block discarded – undo
6338 6338
 		} else $offset = '+00:00';
6339 6339
 
6340 6340
 		if ($globalDBdriver == 'mysql') {
6341
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6341
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6342 6342
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
6343 6343
 					GROUP BY spotter_output.departure_airport_country
6344 6344
 					ORDER BY airport_departure_country_count DESC";
6345 6345
 		} else {
6346
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6346
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6347 6347
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
6348 6348
 					GROUP BY spotter_output.departure_airport_country
6349 6349
 					ORDER BY airport_departure_country_count DESC";
@@ -6355,7 +6355,7 @@  discard block
 block discarded – undo
6355 6355
 		$airport_array = array();
6356 6356
 		$temp_array = array();
6357 6357
         
6358
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6358
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6359 6359
 		{
6360 6360
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6361 6361
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6373,11 +6373,11 @@  discard block
 block discarded – undo
6373 6373
 	* @return Array the airport list
6374 6374
 	*
6375 6375
 	*/
6376
-	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6376
+	public function countAllDepartureAirportsByIdent($ident, $filters = array())
6377 6377
 	{
6378
-		$filter_query = $this->getFilter($filters,true,true);
6379
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6380
-		$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 
6378
+		$filter_query = $this->getFilter($filters, true, true);
6379
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6380
+		$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 
6381 6381
 		    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND spotter_output.ident = :ident 
6382 6382
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6383 6383
 		    ORDER BY airport_departure_icao_count DESC";
@@ -6389,7 +6389,7 @@  discard block
 block discarded – undo
6389 6389
 		$airport_array = array();
6390 6390
 		$temp_array = array();
6391 6391
         
6392
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6392
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6393 6393
 		{
6394 6394
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6395 6395
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6411,11 +6411,11 @@  discard block
 block discarded – undo
6411 6411
 	* @return Array the airport list
6412 6412
 	*
6413 6413
 	*/
6414
-	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
6414
+	public function countAllDepartureAirportCountriesByIdent($ident, $filters = array())
6415 6415
 	{
6416
-		$filter_query = $this->getFilter($filters,true,true);
6417
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6418
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6416
+		$filter_query = $this->getFilter($filters, true, true);
6417
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6418
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6419 6419
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident 
6420 6420
                     GROUP BY spotter_output.departure_airport_country
6421 6421
 					ORDER BY airport_departure_country_count DESC";
@@ -6427,7 +6427,7 @@  discard block
 block discarded – undo
6427 6427
 		$airport_array = array();
6428 6428
 		$temp_array = array();
6429 6429
         
6430
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6430
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6431 6431
 		{
6432 6432
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6433 6433
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6446,12 +6446,12 @@  discard block
 block discarded – undo
6446 6446
 	* @return Array the airport list
6447 6447
 	*
6448 6448
 	*/
6449
-	public function countAllDepartureAirportsByCountry($country,$filters = array())
6449
+	public function countAllDepartureAirportsByCountry($country, $filters = array())
6450 6450
 	{
6451
-		$filter_query = $this->getFilter($filters,true,true);
6452
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6451
+		$filter_query = $this->getFilter($filters, true, true);
6452
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6453 6453
 
6454
-		$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 
6454
+		$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 
6455 6455
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
6456 6456
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6457 6457
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6463,7 +6463,7 @@  discard block
 block discarded – undo
6463 6463
 		$airport_array = array();
6464 6464
 		$temp_array = array();
6465 6465
         
6466
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6466
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6467 6467
 		{
6468 6468
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6469 6469
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6484,11 +6484,11 @@  discard block
 block discarded – undo
6484 6484
 	* @return Array the airport list
6485 6485
 	*
6486 6486
 	*/
6487
-	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
6487
+	public function countAllDepartureAirportCountriesByCountry($country, $filters = array())
6488 6488
 	{
6489
-		$filter_query = $this->getFilter($filters,true,true);
6490
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6491
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6489
+		$filter_query = $this->getFilter($filters, true, true);
6490
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6491
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6492 6492
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
6493 6493
                     GROUP BY spotter_output.departure_airport_country
6494 6494
 					ORDER BY airport_departure_country_count DESC";
@@ -6500,7 +6500,7 @@  discard block
 block discarded – undo
6500 6500
 		$airport_array = array();
6501 6501
 		$temp_array = array();
6502 6502
         
6503
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6503
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6504 6504
 		{
6505 6505
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6506 6506
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6523,11 +6523,11 @@  discard block
 block discarded – undo
6523 6523
 	* @return Array the airport list
6524 6524
 	*
6525 6525
 	*/
6526
-	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6526
+	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6527 6527
 	{
6528 6528
 		global $globalDBdriver;
6529
-		$filter_query = $this->getFilter($filters,true,true);
6530
-		$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 
6529
+		$filter_query = $this->getFilter($filters, true, true);
6530
+		$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 
6531 6531
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
6532 6532
                 if ($olderthanmonths > 0) {
6533 6533
             		if ($globalDBdriver == 'mysql') {
@@ -6557,7 +6557,7 @@  discard block
 block discarded – undo
6557 6557
 		$airport_array = array();
6558 6558
 		$temp_array = array();
6559 6559
         
6560
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6560
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6561 6561
 		{
6562 6562
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6563 6563
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6580,11 +6580,11 @@  discard block
 block discarded – undo
6580 6580
 	* @return Array the airport list
6581 6581
 	*
6582 6582
 	*/
6583
-	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6583
+	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6584 6584
 	{
6585 6585
 		global $globalDBdriver;
6586
-		$filter_query = $this->getFilter($filters,true,true);
6587
-		$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 
6586
+		$filter_query = $this->getFilter($filters, true, true);
6587
+		$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 
6588 6588
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' ";
6589 6589
                 if ($olderthanmonths > 0) {
6590 6590
             		if ($globalDBdriver == 'mysql') {
@@ -6614,7 +6614,7 @@  discard block
 block discarded – undo
6614 6614
 		$airport_array = array();
6615 6615
 		$temp_array = array();
6616 6616
         
6617
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6617
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6618 6618
 		{
6619 6619
 			$temp_array['airline_icao'] = $row['airline_icao'];
6620 6620
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
@@ -6639,11 +6639,11 @@  discard block
 block discarded – undo
6639 6639
 	* @return Array the airport list
6640 6640
 	*
6641 6641
 	*/
6642
-	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6642
+	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6643 6643
 	{
6644 6644
 		global $globalDBdriver;
6645
-		$filter_query = $this->getFilter($filters,true,true);
6646
-		$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 
6645
+		$filter_query = $this->getFilter($filters, true, true);
6646
+		$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 
6647 6647
 			FROM airport,spotter_output".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao";
6648 6648
                 if ($olderthanmonths > 0) {
6649 6649
             		if ($globalDBdriver == 'mysql') {
@@ -6672,7 +6672,7 @@  discard block
 block discarded – undo
6672 6672
 		$airport_array = array();
6673 6673
 		$temp_array = array();
6674 6674
         
6675
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6675
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6676 6676
 		{
6677 6677
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6678 6678
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6695,11 +6695,11 @@  discard block
 block discarded – undo
6695 6695
 	* @return Array the airport list
6696 6696
 	*
6697 6697
 	*/
6698
-	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6698
+	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6699 6699
 	{
6700 6700
 		global $globalDBdriver;
6701
-		$filter_query = $this->getFilter($filters,true,true);
6702
-		$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 
6701
+		$filter_query = $this->getFilter($filters, true, true);
6702
+		$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 
6703 6703
 			FROM airport,spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao ";
6704 6704
                 if ($olderthanmonths > 0) {
6705 6705
             		if ($globalDBdriver == 'mysql') {
@@ -6729,7 +6729,7 @@  discard block
 block discarded – undo
6729 6729
 		$airport_array = array();
6730 6730
 		$temp_array = array();
6731 6731
         
6732
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6732
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6733 6733
 		{
6734 6734
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6735 6735
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6755,9 +6755,9 @@  discard block
 block discarded – undo
6755 6755
 	*/
6756 6756
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
6757 6757
 	{
6758
-		$filter_query = $this->getFilter($filters,true,true);
6759
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6760
-		$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 
6758
+		$filter_query = $this->getFilter($filters, true, true);
6759
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6760
+		$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 
6761 6761
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.airline_icao = :airline_icao 
6762 6762
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6763 6763
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -6768,7 +6768,7 @@  discard block
 block discarded – undo
6768 6768
 		$airport_array = array();
6769 6769
 		$temp_array = array();
6770 6770
         
6771
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6771
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6772 6772
 		{
6773 6773
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6774 6774
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6789,12 +6789,12 @@  discard block
 block discarded – undo
6789 6789
 	* @return Array the airport list
6790 6790
 	*
6791 6791
 	*/
6792
-	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
6792
+	public function countAllArrivalAirportCountriesByAirline($airline_icao, $filters = array())
6793 6793
 	{
6794
-		$filter_query = $this->getFilter($filters,true,true);
6795
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6794
+		$filter_query = $this->getFilter($filters, true, true);
6795
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6796 6796
 					
6797
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6797
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6798 6798
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
6799 6799
                     GROUP BY spotter_output.arrival_airport_country
6800 6800
 					ORDER BY airport_arrival_country_count DESC";
@@ -6806,7 +6806,7 @@  discard block
 block discarded – undo
6806 6806
 		$airport_array = array();
6807 6807
 		$temp_array = array();
6808 6808
         
6809
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6809
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6810 6810
 		{
6811 6811
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6812 6812
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6824,11 +6824,11 @@  discard block
 block discarded – undo
6824 6824
 	* @return Array the airport list
6825 6825
 	*
6826 6826
 	*/
6827
-	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
6827
+	public function countAllArrivalAirportsByAircraft($aircraft_icao, $filters = array())
6828 6828
 	{
6829
-		$filter_query = $this->getFilter($filters,true,true);
6830
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6831
-		$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 
6829
+		$filter_query = $this->getFilter($filters, true, true);
6830
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6831
+		$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 
6832 6832
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
6833 6833
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6834 6834
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -6840,7 +6840,7 @@  discard block
 block discarded – undo
6840 6840
 		$airport_array = array();
6841 6841
 		$temp_array = array();
6842 6842
         
6843
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6843
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6844 6844
 		{
6845 6845
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6846 6846
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6862,11 +6862,11 @@  discard block
 block discarded – undo
6862 6862
 	* @return Array the airport list
6863 6863
 	*
6864 6864
 	*/
6865
-	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
6865
+	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao, $filters = array())
6866 6866
 	{
6867
-		$filter_query = $this->getFilter($filters,true,true);
6868
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6869
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6867
+		$filter_query = $this->getFilter($filters, true, true);
6868
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6869
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6870 6870
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
6871 6871
                     GROUP BY spotter_output.arrival_airport_country
6872 6872
 					ORDER BY airport_arrival_country_count DESC";
@@ -6878,7 +6878,7 @@  discard block
 block discarded – undo
6878 6878
 		$airport_array = array();
6879 6879
 		$temp_array = array();
6880 6880
         
6881
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6881
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6882 6882
 		{
6883 6883
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6884 6884
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6896,12 +6896,12 @@  discard block
 block discarded – undo
6896 6896
 	* @return Array the airport list
6897 6897
 	*
6898 6898
 	*/
6899
-	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
6899
+	public function countAllArrivalAirportsByRegistration($registration, $filters = array())
6900 6900
 	{
6901
-		$filter_query = $this->getFilter($filters,true,true);
6902
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6901
+		$filter_query = $this->getFilter($filters, true, true);
6902
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6903 6903
 
6904
-		$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 
6904
+		$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 
6905 6905
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.registration = :registration 
6906 6906
                     GROUP BY spotter_output.arrival_airport_icao
6907 6907
 					ORDER BY airport_arrival_icao_count DESC";
@@ -6913,7 +6913,7 @@  discard block
 block discarded – undo
6913 6913
 		$airport_array = array();
6914 6914
 		$temp_array = array();
6915 6915
         
6916
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6916
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6917 6917
 		{
6918 6918
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6919 6919
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6934,11 +6934,11 @@  discard block
 block discarded – undo
6934 6934
 	* @return Array the airport list
6935 6935
 	*
6936 6936
 	*/
6937
-	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
6937
+	public function countAllArrivalAirportCountriesByRegistration($registration, $filters = array())
6938 6938
 	{
6939
-		$filter_query = $this->getFilter($filters,true,true);
6940
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6941
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6939
+		$filter_query = $this->getFilter($filters, true, true);
6940
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6941
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6942 6942
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration 
6943 6943
                     GROUP BY spotter_output.arrival_airport_country
6944 6944
 					ORDER BY airport_arrival_country_count DESC";
@@ -6950,7 +6950,7 @@  discard block
 block discarded – undo
6950 6950
 		$airport_array = array();
6951 6951
 		$temp_array = array();
6952 6952
         
6953
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6953
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6954 6954
 		{
6955 6955
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6956 6956
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6969,11 +6969,11 @@  discard block
 block discarded – undo
6969 6969
 	* @return Array the airport list
6970 6970
 	*
6971 6971
 	*/
6972
-	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
6972
+	public function countAllArrivalAirportsByAirport($airport_icao, $filters = array())
6973 6973
 	{
6974
-		$filter_query = $this->getFilter($filters,true,true);
6975
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6976
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6974
+		$filter_query = $this->getFilter($filters, true, true);
6975
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6976
+		$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 
6977 6977
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.departure_airport_icao = :airport_icao 
6978 6978
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6979 6979
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -6985,7 +6985,7 @@  discard block
 block discarded – undo
6985 6985
 		$airport_array = array();
6986 6986
 		$temp_array = array();
6987 6987
         
6988
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6988
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6989 6989
 		{
6990 6990
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6991 6991
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7006,11 +7006,11 @@  discard block
 block discarded – undo
7006 7006
 	* @return Array the airport list
7007 7007
 	*
7008 7008
 	*/
7009
-	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
7009
+	public function countAllArrivalAirportCountriesByAirport($airport_icao, $filters = array())
7010 7010
 	{
7011
-		$filter_query = $this->getFilter($filters,true,true);
7012
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7013
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7011
+		$filter_query = $this->getFilter($filters, true, true);
7012
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7013
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7014 7014
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao 
7015 7015
                     GROUP BY spotter_output.arrival_airport_country
7016 7016
 					ORDER BY airport_arrival_country_count DESC";
@@ -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['arrival_airport_country'] = $row['arrival_airport_country'];
7028 7028
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7040,11 +7040,11 @@  discard block
 block discarded – undo
7040 7040
 	* @return Array the airport list
7041 7041
 	*
7042 7042
 	*/
7043
-	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
7043
+	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer, $filters = array())
7044 7044
 	{
7045
-		$filter_query = $this->getFilter($filters,true,true);
7046
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7047
-		$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 
7045
+		$filter_query = $this->getFilter($filters, true, true);
7046
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7047
+		$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 
7048 7048
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
7049 7049
                     GROUP BY spotter_output.arrival_airport_icao
7050 7050
 					ORDER BY airport_arrival_icao_count DESC";
@@ -7056,7 +7056,7 @@  discard block
 block discarded – undo
7056 7056
 		$airport_array = array();
7057 7057
 		$temp_array = array();
7058 7058
         
7059
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7059
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7060 7060
 		{
7061 7061
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7062 7062
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7078,11 +7078,11 @@  discard block
 block discarded – undo
7078 7078
 	* @return Array the airport list
7079 7079
 	*
7080 7080
 	*/
7081
-	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
7081
+	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
7082 7082
 	{
7083
-		$filter_query = $this->getFilter($filters,true,true);
7084
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7085
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7083
+		$filter_query = $this->getFilter($filters, true, true);
7084
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7085
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7086 7086
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
7087 7087
                     GROUP BY spotter_output.arrival_airport_country
7088 7088
 					ORDER BY airport_arrival_country_count DESC";
@@ -7094,7 +7094,7 @@  discard block
 block discarded – undo
7094 7094
 		$airport_array = array();
7095 7095
 		$temp_array = array();
7096 7096
         
7097
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7097
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7098 7098
 		{
7099 7099
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7100 7100
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7113,11 +7113,11 @@  discard block
 block discarded – undo
7113 7113
 	* @return Array the airport list
7114 7114
 	*
7115 7115
 	*/
7116
-	public function countAllArrivalAirportsByDate($date,$filters = array())
7116
+	public function countAllArrivalAirportsByDate($date, $filters = array())
7117 7117
 	{
7118 7118
 		global $globalTimezone, $globalDBdriver;
7119
-		$filter_query = $this->getFilter($filters,true,true);
7120
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7119
+		$filter_query = $this->getFilter($filters, true, true);
7120
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7121 7121
 		if ($globalTimezone != '') {
7122 7122
 			date_default_timezone_set($globalTimezone);
7123 7123
 			$datetime = new DateTime($date);
@@ -7125,12 +7125,12 @@  discard block
 block discarded – undo
7125 7125
 		} else $offset = '+00:00';
7126 7126
 
7127 7127
 		if ($globalDBdriver == 'mysql') {
7128
-			$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 
7128
+			$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 
7129 7129
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
7130 7130
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7131 7131
 					ORDER BY airport_arrival_icao_count DESC";
7132 7132
 		} else {
7133
-			$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 
7133
+			$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 
7134 7134
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
7135 7135
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7136 7136
 					ORDER BY airport_arrival_icao_count DESC";
@@ -7142,7 +7142,7 @@  discard block
 block discarded – undo
7142 7142
 		$airport_array = array();
7143 7143
 		$temp_array = array();
7144 7144
         
7145
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7145
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7146 7146
 		{
7147 7147
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7148 7148
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7166,8 +7166,8 @@  discard block
 block discarded – undo
7166 7166
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
7167 7167
 	{
7168 7168
 		global $globalTimezone, $globalDBdriver;
7169
-		$filter_query = $this->getFilter($filters,true,true);
7170
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7169
+		$filter_query = $this->getFilter($filters, true, true);
7170
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7171 7171
 		if ($globalTimezone != '') {
7172 7172
 			date_default_timezone_set($globalTimezone);
7173 7173
 			$datetime = new DateTime($date);
@@ -7175,12 +7175,12 @@  discard block
 block discarded – undo
7175 7175
 		} else $offset = '+00:00';
7176 7176
 
7177 7177
 		if ($globalDBdriver == 'mysql') {
7178
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7178
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7179 7179
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
7180 7180
 					GROUP BY spotter_output.arrival_airport_country
7181 7181
 					ORDER BY airport_arrival_country_count DESC";
7182 7182
 		} else {
7183
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7183
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7184 7184
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
7185 7185
 					GROUP BY spotter_output.arrival_airport_country
7186 7186
 					ORDER BY airport_arrival_country_count DESC";
@@ -7192,7 +7192,7 @@  discard block
 block discarded – undo
7192 7192
 		$airport_array = array();
7193 7193
 		$temp_array = array();
7194 7194
         
7195
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7195
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7196 7196
 		{
7197 7197
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7198 7198
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7210,11 +7210,11 @@  discard block
 block discarded – undo
7210 7210
 	* @return Array the airport list
7211 7211
 	*
7212 7212
 	*/
7213
-	public function countAllArrivalAirportsByIdent($ident,$filters = array())
7213
+	public function countAllArrivalAirportsByIdent($ident, $filters = array())
7214 7214
 	{
7215
-		$filter_query = $this->getFilter($filters,true,true);
7216
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7217
-		$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 
7215
+		$filter_query = $this->getFilter($filters, true, true);
7216
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7217
+		$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 
7218 7218
 		    FROM spotter_output".$filter_query." WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.ident = :ident  
7219 7219
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7220 7220
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -7226,7 +7226,7 @@  discard block
 block discarded – undo
7226 7226
 		$airport_array = array();
7227 7227
 		$temp_array = array();
7228 7228
         
7229
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7229
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7230 7230
 		{
7231 7231
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7232 7232
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7249,9 +7249,9 @@  discard block
 block discarded – undo
7249 7249
 	*/
7250 7250
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
7251 7251
 	{
7252
-		$filter_query = $this->getFilter($filters,true,true);
7253
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7254
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7252
+		$filter_query = $this->getFilter($filters, true, true);
7253
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7254
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7255 7255
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident 
7256 7256
                     GROUP BY spotter_output.arrival_airport_country
7257 7257
 					ORDER BY airport_arrival_country_count DESC";
@@ -7263,7 +7263,7 @@  discard block
 block discarded – undo
7263 7263
 		$airport_array = array();
7264 7264
 		$temp_array = array();
7265 7265
         
7266
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7266
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7267 7267
 		{
7268 7268
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7269 7269
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7282,11 +7282,11 @@  discard block
 block discarded – undo
7282 7282
 	* @return Array the airport list
7283 7283
 	*
7284 7284
 	*/
7285
-	public function countAllArrivalAirportsByCountry($country,$filters = array())
7285
+	public function countAllArrivalAirportsByCountry($country, $filters = array())
7286 7286
 	{
7287
-		$filter_query = $this->getFilter($filters,true,true);
7288
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7289
-		$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 
7287
+		$filter_query = $this->getFilter($filters, true, true);
7288
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7289
+		$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 
7290 7290
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
7291 7291
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7292 7292
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7298,7 +7298,7 @@  discard block
 block discarded – undo
7298 7298
 		$airport_array = array();
7299 7299
 		$temp_array = array();
7300 7300
         
7301
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7301
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7302 7302
 		{
7303 7303
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7304 7304
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7319,11 +7319,11 @@  discard block
 block discarded – undo
7319 7319
 	* @return Array the airport list
7320 7320
 	*
7321 7321
 	*/
7322
-	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
7322
+	public function countAllArrivalAirportCountriesByCountry($country, $filters = array())
7323 7323
 	{
7324
-		$filter_query = $this->getFilter($filters,true,true);
7325
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7326
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7324
+		$filter_query = $this->getFilter($filters, true, true);
7325
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7326
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7327 7327
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
7328 7328
                     GROUP BY spotter_output.arrival_airport_country
7329 7329
 					ORDER BY airport_arrival_country_count DESC";
@@ -7335,7 +7335,7 @@  discard block
 block discarded – undo
7335 7335
 		$airport_array = array();
7336 7336
 		$temp_array = array();
7337 7337
         
7338
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7338
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7339 7339
 		{
7340 7340
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7341 7341
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7356,7 +7356,7 @@  discard block
 block discarded – undo
7356 7356
 	*/
7357 7357
 	public function countAllDepartureCountries($filters = array())
7358 7358
 	{
7359
-		$filter_query = $this->getFilter($filters,true,true);
7359
+		$filter_query = $this->getFilter($filters, true, true);
7360 7360
 		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7361 7361
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
7362 7362
 		$query .= " GROUP BY spotter_output.departure_airport_country
@@ -7370,7 +7370,7 @@  discard block
 block discarded – undo
7370 7370
 		$airport_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['airport_departure_country_count'] = $row['airport_departure_country_count'];
7376 7376
 			$temp_array['airport_departure_country'] = $row['departure_airport_country'];
@@ -7388,9 +7388,9 @@  discard block
 block discarded – undo
7388 7388
 	* @return Array the airport arrival list
7389 7389
 	*
7390 7390
 	*/
7391
-	public function countAllArrivalCountries($limit = true,$filters = array())
7391
+	public function countAllArrivalCountries($limit = true, $filters = array())
7392 7392
 	{
7393
-		$filter_query = $this->getFilter($filters,true,true);
7393
+		$filter_query = $this->getFilter($filters, true, true);
7394 7394
 		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7395 7395
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
7396 7396
 		$query .= " GROUP BY spotter_output.arrival_airport_country
@@ -7404,7 +7404,7 @@  discard block
 block discarded – undo
7404 7404
 		$airport_array = array();
7405 7405
 		$temp_array = array();
7406 7406
         
7407
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7407
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7408 7408
 		{
7409 7409
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
7410 7410
 			$temp_array['airport_arrival_country'] = $row['arrival_airport_country'];
@@ -7427,8 +7427,8 @@  discard block
 block discarded – undo
7427 7427
 	*/
7428 7428
 	public function countAllRoutes($filters = array())
7429 7429
 	{
7430
-		$filter_query = $this->getFilter($filters,true,true);
7431
-		$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
7430
+		$filter_query = $this->getFilter($filters, true, true);
7431
+		$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
7432 7432
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''
7433 7433
                     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
7434 7434
                     ORDER BY route_count DESC
@@ -7441,7 +7441,7 @@  discard block
 block discarded – undo
7441 7441
 		$routes_array = array();
7442 7442
 		$temp_array = array();
7443 7443
         
7444
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7444
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7445 7445
 		{
7446 7446
 			$temp_array['route_count'] = $row['route_count'];
7447 7447
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7468,11 +7468,11 @@  discard block
 block discarded – undo
7468 7468
 	* @return Array the route list
7469 7469
 	*
7470 7470
 	*/
7471
-	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
7471
+	public function countAllRoutesByAircraft($aircraft_icao, $filters = array())
7472 7472
 	{
7473
-		$filter_query = $this->getFilter($filters,true,true);
7474
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7475
-		$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
7473
+		$filter_query = $this->getFilter($filters, true, true);
7474
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7475
+		$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
7476 7476
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
7477 7477
 			    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 
7478 7478
 			    ORDER BY route_count DESC";
@@ -7483,7 +7483,7 @@  discard block
 block discarded – undo
7483 7483
 		$routes_array = array();
7484 7484
 		$temp_array = array();
7485 7485
         
7486
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7486
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7487 7487
 		{
7488 7488
 			$temp_array['route_count'] = $row['route_count'];
7489 7489
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7510,9 +7510,9 @@  discard block
 block discarded – undo
7510 7510
 	*/
7511 7511
 	public function countAllRoutesByRegistration($registration, $filters = array())
7512 7512
 	{
7513
-		$filter_query = $this->getFilter($filters,true,true);
7513
+		$filter_query = $this->getFilter($filters, true, true);
7514 7514
 		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7515
-		$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
7515
+		$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
7516 7516
 			FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.registration = :registration 
7517 7517
                     GROUP BY route
7518 7518
                     ORDER BY route_count DESC";
@@ -7524,7 +7524,7 @@  discard block
 block discarded – undo
7524 7524
 		$routes_array = array();
7525 7525
 		$temp_array = array();
7526 7526
         
7527
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7527
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7528 7528
 		{
7529 7529
 			$temp_array['route_count'] = $row['route_count'];
7530 7530
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7552,9 +7552,9 @@  discard block
 block discarded – undo
7552 7552
 	*/
7553 7553
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
7554 7554
 	{
7555
-		$filter_query = $this->getFilter($filters,true,true);
7556
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7557
-		$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
7555
+		$filter_query = $this->getFilter($filters, true, true);
7556
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7557
+		$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
7558 7558
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao 
7559 7559
 			    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 
7560 7560
 			    ORDER BY route_count DESC";
@@ -7566,7 +7566,7 @@  discard block
 block discarded – undo
7566 7566
 		$routes_array = array();
7567 7567
 		$temp_array = array();
7568 7568
         
7569
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7569
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7570 7570
 		{
7571 7571
 			$temp_array['route_count'] = $row['route_count'];
7572 7572
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7594,9 +7594,9 @@  discard block
 block discarded – undo
7594 7594
 	*/
7595 7595
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
7596 7596
 	{
7597
-		$filter_query = $this->getFilter($filters,true,true);
7598
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7599
-		$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
7597
+		$filter_query = $this->getFilter($filters, true, true);
7598
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7599
+		$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
7600 7600
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
7601 7601
 			    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 
7602 7602
 			    ORDER BY route_count DESC";
@@ -7607,7 +7607,7 @@  discard block
 block discarded – undo
7607 7607
 		$routes_array = array();
7608 7608
 		$temp_array = array();
7609 7609
         
7610
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7610
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7611 7611
 		{
7612 7612
 			$temp_array['route_count'] = $row['route_count'];
7613 7613
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7635,9 +7635,9 @@  discard block
 block discarded – undo
7635 7635
 	*/
7636 7636
 	public function countAllRoutesByCountry($country, $filters = array())
7637 7637
 	{
7638
-		$filter_query = $this->getFilter($filters,true,true);
7639
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7640
-		$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
7638
+		$filter_query = $this->getFilter($filters, true, true);
7639
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7640
+		$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
7641 7641
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
7642 7642
 			    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 
7643 7643
 			    ORDER BY route_count DESC";
@@ -7648,7 +7648,7 @@  discard block
 block discarded – undo
7648 7648
 		$routes_array = array();
7649 7649
 		$temp_array = array();
7650 7650
         
7651
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7651
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7652 7652
 		{
7653 7653
 			$temp_array['route_count'] = $row['route_count'];
7654 7654
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7676,8 +7676,8 @@  discard block
 block discarded – undo
7676 7676
 	public function countAllRoutesByDate($date, $filters = array())
7677 7677
 	{
7678 7678
 		global $globalTimezone, $globalDBdriver;
7679
-		$filter_query = $this->getFilter($filters,true,true);
7680
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7679
+		$filter_query = $this->getFilter($filters, true, true);
7680
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7681 7681
 		if ($globalTimezone != '') {
7682 7682
 			date_default_timezone_set($globalTimezone);
7683 7683
 			$datetime = new DateTime($date);
@@ -7685,12 +7685,12 @@  discard block
 block discarded – undo
7685 7685
 		} else $offset = '+00:00';
7686 7686
 		
7687 7687
 		if ($globalDBdriver == 'mysql') {
7688
-			$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
7688
+			$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
7689 7689
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
7690 7690
 				    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
7691 7691
 				    ORDER BY route_count DESC";
7692 7692
 		} else {
7693
-			$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
7693
+			$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
7694 7694
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
7695 7695
 				    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
7696 7696
 				    ORDER BY route_count DESC";
@@ -7702,7 +7702,7 @@  discard block
 block discarded – undo
7702 7702
 		$routes_array = array();
7703 7703
 		$temp_array = array();
7704 7704
         
7705
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7705
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7706 7706
 		{
7707 7707
 			$temp_array['route_count'] = $row['route_count'];
7708 7708
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7729,9 +7729,9 @@  discard block
 block discarded – undo
7729 7729
 	*/
7730 7730
 	public function countAllRoutesByIdent($ident, $filters = array())
7731 7731
 	{
7732
-		$filter_query = $this->getFilter($filters,true,true);
7733
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7734
-		$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
7732
+		$filter_query = $this->getFilter($filters, true, true);
7733
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7734
+		$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
7735 7735
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.ident = :ident   
7736 7736
                     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
7737 7737
                     ORDER BY route_count DESC";
@@ -7743,7 +7743,7 @@  discard block
 block discarded – undo
7743 7743
 		$routes_array = array();
7744 7744
 		$temp_array = array();
7745 7745
         
7746
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7746
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7747 7747
 		{
7748 7748
 			$temp_array['route_count'] = $row['route_count'];
7749 7749
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7770,9 +7770,9 @@  discard block
 block discarded – undo
7770 7770
 	*/
7771 7771
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
7772 7772
 	{
7773
-		$filter_query = $this->getFilter($filters,true,true);
7774
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7775
-		$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
7773
+		$filter_query = $this->getFilter($filters, true, true);
7774
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7775
+		$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
7776 7776
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
7777 7777
                     GROUP BY route
7778 7778
                     ORDER BY route_count DESC";
@@ -7784,7 +7784,7 @@  discard block
 block discarded – undo
7784 7784
 		$routes_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['route_count'] = $row['route_count'];
7790 7790
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7812,8 +7812,8 @@  discard block
 block discarded – undo
7812 7812
 	*/
7813 7813
 	public function countAllRoutesWithWaypoints($filters = array())
7814 7814
 	{
7815
-		$filter_query = $this->getFilter($filters,true,true);
7816
-		$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
7815
+		$filter_query = $this->getFilter($filters, true, true);
7816
+		$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
7817 7817
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.waypoints <> '' 
7818 7818
                     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
7819 7819
                     ORDER BY route_count DESC
@@ -7826,7 +7826,7 @@  discard block
 block discarded – undo
7826 7826
 		$routes_array = array();
7827 7827
 		$temp_array = array();
7828 7828
         
7829
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7829
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7830 7830
 		{
7831 7831
 			$temp_array['spotter_id'] = $row['spotter_id'];
7832 7832
 			$temp_array['route_count'] = $row['route_count'];
@@ -7851,11 +7851,11 @@  discard block
 block discarded – undo
7851 7851
 	* @return Array the callsign list
7852 7852
 	*
7853 7853
 	*/
7854
-	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
7854
+	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7855 7855
 	{
7856 7856
 		global $globalDBdriver;
7857
-		$filter_query = $this->getFilter($filters,true,true);
7858
-		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7857
+		$filter_query = $this->getFilter($filters, true, true);
7858
+		$query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7859 7859
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
7860 7860
 		 if ($olderthanmonths > 0) {
7861 7861
 			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
@@ -7874,7 +7874,7 @@  discard block
 block discarded – undo
7874 7874
 		$callsign_array = array();
7875 7875
 		$temp_array = array();
7876 7876
         
7877
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7877
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7878 7878
 		{
7879 7879
 			$temp_array['callsign_icao'] = $row['ident'];
7880 7880
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -7896,8 +7896,8 @@  discard block
 block discarded – undo
7896 7896
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7897 7897
 	{
7898 7898
 		global $globalDBdriver;
7899
-		$filter_query = $this->getFilter($filters,true,true);
7900
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7899
+		$filter_query = $this->getFilter($filters, true, true);
7900
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7901 7901
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
7902 7902
 		 if ($olderthanmonths > 0) {
7903 7903
 			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
@@ -7916,7 +7916,7 @@  discard block
 block discarded – undo
7916 7916
 		$callsign_array = array();
7917 7917
 		$temp_array = array();
7918 7918
         
7919
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7919
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7920 7920
 		{
7921 7921
 			$temp_array['callsign_icao'] = $row['ident'];
7922 7922
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -7970,7 +7970,7 @@  discard block
 block discarded – undo
7970 7970
 		$date_array = array();
7971 7971
 		$temp_array = array();
7972 7972
         
7973
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7973
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7974 7974
 		{
7975 7975
 			$temp_array['date_name'] = $row['date_name'];
7976 7976
 			$temp_array['date_count'] = $row['date_count'];
@@ -7995,15 +7995,15 @@  discard block
 block discarded – undo
7995 7995
 			$datetime = new DateTime();
7996 7996
 			$offset = $datetime->format('P');
7997 7997
 		} else $offset = '+00:00';
7998
-		$filter_query = $this->getFilter($filters,true,true);
7998
+		$filter_query = $this->getFilter($filters, true, true);
7999 7999
 		if ($globalDBdriver == 'mysql') {
8000
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
8000
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
8001 8001
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8002 8002
 								GROUP BY spotter_output.airline_icao, date_name 
8003 8003
 								ORDER BY date_count DESC
8004 8004
 								LIMIT 10 OFFSET 0";
8005 8005
 		} else {
8006
-			$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
8006
+			$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
8007 8007
 								FROM spotter_output 
8008 8008
 								WHERE spotter_output.airline_icao <> '' 
8009 8009
 								GROUP BY spotter_output.airline_icao, date_name 
@@ -8018,7 +8018,7 @@  discard block
 block discarded – undo
8018 8018
 		$date_array = array();
8019 8019
 		$temp_array = array();
8020 8020
         
8021
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8021
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8022 8022
 		{
8023 8023
 			$temp_array['date_name'] = $row['date_name'];
8024 8024
 			$temp_array['date_count'] = $row['date_count'];
@@ -8044,7 +8044,7 @@  discard block
 block discarded – undo
8044 8044
 			$datetime = new DateTime();
8045 8045
 			$offset = $datetime->format('P');
8046 8046
 		} else $offset = '+00:00';
8047
-		$filter_query = $this->getFilter($filters,true,true);
8047
+		$filter_query = $this->getFilter($filters, true, true);
8048 8048
 		if ($globalDBdriver == 'mysql') {
8049 8049
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
8050 8050
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -8065,7 +8065,7 @@  discard block
 block discarded – undo
8065 8065
 		$date_array = array();
8066 8066
 		$temp_array = array();
8067 8067
         
8068
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8068
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8069 8069
 		{
8070 8070
 			$temp_array['date_name'] = $row['date_name'];
8071 8071
 			$temp_array['date_count'] = $row['date_count'];
@@ -8090,7 +8090,7 @@  discard block
 block discarded – undo
8090 8090
 			$datetime = new DateTime();
8091 8091
 			$offset = $datetime->format('P');
8092 8092
 		} else $offset = '+00:00';
8093
-		$filter_query = $this->getFilter($filters,true,true);
8093
+		$filter_query = $this->getFilter($filters, true, true);
8094 8094
 		if ($globalDBdriver == 'mysql') {
8095 8095
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
8096 8096
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)";
@@ -8111,7 +8111,7 @@  discard block
 block discarded – undo
8111 8111
 		$date_array = array();
8112 8112
 		$temp_array = array();
8113 8113
         
8114
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8114
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8115 8115
 		{
8116 8116
 			$temp_array['date_name'] = $row['date_name'];
8117 8117
 			$temp_array['date_count'] = $row['date_count'];
@@ -8132,7 +8132,7 @@  discard block
 block discarded – undo
8132 8132
 	public function countAllDatesLastMonthByAirlines($filters = array())
8133 8133
 	{
8134 8134
 		global $globalTimezone, $globalDBdriver;
8135
-		$filter_query = $this->getFilter($filters,true,true);
8135
+		$filter_query = $this->getFilter($filters, true, true);
8136 8136
 		if ($globalTimezone != '') {
8137 8137
 			date_default_timezone_set($globalTimezone);
8138 8138
 			$datetime = new DateTime();
@@ -8140,13 +8140,13 @@  discard block
 block discarded – undo
8140 8140
 		} else $offset = '+00:00';
8141 8141
 		
8142 8142
 		if ($globalDBdriver == 'mysql') {
8143
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
8143
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
8144 8144
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)
8145 8145
 								GROUP BY spotter_output.airline_icao, date_name 
8146 8146
 								ORDER BY spotter_output.date ASC";
8147 8147
 			$query_data = array(':offset' => $offset);
8148 8148
 		} else {
8149
-			$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
8149
+			$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
8150 8150
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS'
8151 8151
 								GROUP BY spotter_output.airline_icao, date_name 
8152 8152
 								ORDER BY date_name ASC";
@@ -8159,7 +8159,7 @@  discard block
 block discarded – undo
8159 8159
 		$date_array = array();
8160 8160
 		$temp_array = array();
8161 8161
         
8162
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8162
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8163 8163
 		{
8164 8164
 			$temp_array['date_name'] = $row['date_name'];
8165 8165
 			$temp_array['date_count'] = $row['date_count'];
@@ -8206,7 +8206,7 @@  discard block
 block discarded – undo
8206 8206
 		$date_array = array();
8207 8207
 		$temp_array = array();
8208 8208
         
8209
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8209
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8210 8210
 		{
8211 8211
 			$temp_array['month_name'] = $row['month_name'];
8212 8212
 			$temp_array['year_name'] = $row['year_name'];
@@ -8227,7 +8227,7 @@  discard block
 block discarded – undo
8227 8227
 	public function countAllMonthsByAirlines($filters = array())
8228 8228
 	{
8229 8229
 		global $globalTimezone, $globalDBdriver;
8230
-		$filter_query = $this->getFilter($filters,true,true);
8230
+		$filter_query = $this->getFilter($filters, true, true);
8231 8231
 		if ($globalTimezone != '') {
8232 8232
 			date_default_timezone_set($globalTimezone);
8233 8233
 			$datetime = new DateTime();
@@ -8235,12 +8235,12 @@  discard block
 block discarded – undo
8235 8235
 		} else $offset = '+00:00';
8236 8236
 
8237 8237
 		if ($globalDBdriver == 'mysql') {
8238
-			$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
8238
+			$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
8239 8239
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8240 8240
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
8241 8241
 								ORDER BY date_count DESC";
8242 8242
 		} else {
8243
-			$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
8243
+			$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
8244 8244
 								FROM spotter_output 
8245 8245
 								WHERE spotter_output.airline_icao <> '' 
8246 8246
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
@@ -8254,7 +8254,7 @@  discard block
 block discarded – undo
8254 8254
 		$date_array = array();
8255 8255
 		$temp_array = array();
8256 8256
         
8257
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8257
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8258 8258
 		{
8259 8259
 			$temp_array['month_name'] = $row['month_name'];
8260 8260
 			$temp_array['year_name'] = $row['year_name'];
@@ -8281,14 +8281,14 @@  discard block
 block discarded – undo
8281 8281
 			$datetime = new DateTime();
8282 8282
 			$offset = $datetime->format('P');
8283 8283
 		} else $offset = '+00:00';
8284
-		$filter_query = $this->getFilter($filters,true,true);
8284
+		$filter_query = $this->getFilter($filters, true, true);
8285 8285
 		if ($globalDBdriver == 'mysql') {
8286
-			$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
8286
+			$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
8287 8287
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
8288 8288
 								GROUP BY year_name, month_name 
8289 8289
 								ORDER BY date_count DESC";
8290 8290
 		} else {
8291
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
8291
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
8292 8292
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
8293 8293
 								GROUP BY year_name, month_name 
8294 8294
 								ORDER BY date_count DESC";
@@ -8300,7 +8300,7 @@  discard block
 block discarded – undo
8300 8300
 		$date_array = array();
8301 8301
 		$temp_array = array();
8302 8302
         
8303
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8303
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8304 8304
 		{
8305 8305
 			$temp_array['month_name'] = $row['month_name'];
8306 8306
 			$temp_array['year_name'] = $row['year_name'];
@@ -8326,15 +8326,15 @@  discard block
 block discarded – undo
8326 8326
 			$datetime = new DateTime();
8327 8327
 			$offset = $datetime->format('P');
8328 8328
 		} else $offset = '+00:00';
8329
-		$filter_query = $this->getFilter($filters,true,true);
8329
+		$filter_query = $this->getFilter($filters, true, true);
8330 8330
 
8331 8331
 		if ($globalDBdriver == 'mysql') {
8332
-			$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
8332
+			$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
8333 8333
 								FROM spotter_output".$filter_query." owner_name <> ''
8334 8334
 								GROUP BY year_name, month_name
8335 8335
 								ORDER BY date_count DESC";
8336 8336
 		} else {
8337
-			$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
8337
+			$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
8338 8338
 								FROM spotter_output".$filter_query." owner_name <> ''
8339 8339
 								GROUP BY year_name, month_name
8340 8340
 								ORDER BY date_count DESC";
@@ -8346,7 +8346,7 @@  discard block
 block discarded – undo
8346 8346
 		$date_array = array();
8347 8347
 		$temp_array = array();
8348 8348
         
8349
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8349
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8350 8350
 		{
8351 8351
 			$temp_array['month_name'] = $row['month_name'];
8352 8352
 			$temp_array['year_name'] = $row['year_name'];
@@ -8367,7 +8367,7 @@  discard block
 block discarded – undo
8367 8367
 	public function countAllMonthsOwnersByAirlines($filters = array())
8368 8368
 	{
8369 8369
 		global $globalTimezone, $globalDBdriver;
8370
-		$filter_query = $this->getFilter($filters,true,true);
8370
+		$filter_query = $this->getFilter($filters, true, true);
8371 8371
 		if ($globalTimezone != '') {
8372 8372
 			date_default_timezone_set($globalTimezone);
8373 8373
 			$datetime = new DateTime();
@@ -8375,12 +8375,12 @@  discard block
 block discarded – undo
8375 8375
 		} else $offset = '+00:00';
8376 8376
 
8377 8377
 		if ($globalDBdriver == 'mysql') {
8378
-			$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
8378
+			$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
8379 8379
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
8380 8380
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8381 8381
 								ORDER BY date_count DESC";
8382 8382
 		} else {
8383
-			$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
8383
+			$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
8384 8384
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
8385 8385
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8386 8386
 								ORDER BY date_count DESC";
@@ -8392,7 +8392,7 @@  discard block
 block discarded – undo
8392 8392
 		$date_array = array();
8393 8393
 		$temp_array = array();
8394 8394
         
8395
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8395
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8396 8396
 		{
8397 8397
 			$temp_array['month_name'] = $row['month_name'];
8398 8398
 			$temp_array['year_name'] = $row['year_name'];
@@ -8419,15 +8419,15 @@  discard block
 block discarded – undo
8419 8419
 			$datetime = new DateTime();
8420 8420
 			$offset = $datetime->format('P');
8421 8421
 		} else $offset = '+00:00';
8422
-		$filter_query = $this->getFilter($filters,true,true);
8422
+		$filter_query = $this->getFilter($filters, true, true);
8423 8423
 
8424 8424
 		if ($globalDBdriver == 'mysql') {
8425
-			$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
8425
+			$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
8426 8426
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
8427 8427
 								GROUP BY year_name, month_name
8428 8428
 								ORDER BY date_count DESC";
8429 8429
 		} else {
8430
-			$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
8430
+			$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
8431 8431
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
8432 8432
 								GROUP BY year_name, month_name
8433 8433
 								ORDER BY date_count DESC";
@@ -8439,7 +8439,7 @@  discard block
 block discarded – undo
8439 8439
 		$date_array = array();
8440 8440
 		$temp_array = array();
8441 8441
         
8442
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8442
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8443 8443
 		{
8444 8444
 			$temp_array['month_name'] = $row['month_name'];
8445 8445
 			$temp_array['year_name'] = $row['year_name'];
@@ -8460,7 +8460,7 @@  discard block
 block discarded – undo
8460 8460
 	public function countAllMonthsPilotsByAirlines($filters = array())
8461 8461
 	{
8462 8462
 		global $globalTimezone, $globalDBdriver;
8463
-		$filter_query = $this->getFilter($filters,true,true);
8463
+		$filter_query = $this->getFilter($filters, true, true);
8464 8464
 		if ($globalTimezone != '') {
8465 8465
 			date_default_timezone_set($globalTimezone);
8466 8466
 			$datetime = new DateTime();
@@ -8468,12 +8468,12 @@  discard block
 block discarded – undo
8468 8468
 		} else $offset = '+00:00';
8469 8469
 
8470 8470
 		if ($globalDBdriver == 'mysql') {
8471
-			$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
8471
+			$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
8472 8472
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
8473 8473
 								GROUP BY spotter_output.airline_icao,year_name, month_name
8474 8474
 								ORDER BY date_count DESC";
8475 8475
 		} else {
8476
-			$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
8476
+			$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
8477 8477
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
8478 8478
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8479 8479
 								ORDER BY date_count DESC";
@@ -8485,7 +8485,7 @@  discard block
 block discarded – undo
8485 8485
 		$date_array = array();
8486 8486
 		$temp_array = array();
8487 8487
         
8488
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8488
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8489 8489
 		{
8490 8490
 			$temp_array['month_name'] = $row['month_name'];
8491 8491
 			$temp_array['year_name'] = $row['year_name'];
@@ -8507,7 +8507,7 @@  discard block
 block discarded – undo
8507 8507
 	public function countAllMonthsAirlines($filters = array())
8508 8508
 	{
8509 8509
 		global $globalTimezone, $globalDBdriver;
8510
-		$filter_query = $this->getFilter($filters,true,true);
8510
+		$filter_query = $this->getFilter($filters, true, true);
8511 8511
 		if ($globalTimezone != '') {
8512 8512
 			date_default_timezone_set($globalTimezone);
8513 8513
 			$datetime = new DateTime();
@@ -8515,12 +8515,12 @@  discard block
 block discarded – undo
8515 8515
 		} else $offset = '+00:00';
8516 8516
 
8517 8517
 		if ($globalDBdriver == 'mysql') {
8518
-			$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
8518
+			$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
8519 8519
 								FROM spotter_output".$filter_query." airline_icao <> '' 
8520 8520
 								GROUP BY year_name, month_name
8521 8521
 								ORDER BY date_count DESC";
8522 8522
 		} else {
8523
-			$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
8523
+			$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
8524 8524
 								FROM spotter_output".$filter_query." airline_icao <> '' 
8525 8525
 								GROUP BY year_name, month_name
8526 8526
 								ORDER BY date_count DESC";
@@ -8532,7 +8532,7 @@  discard block
 block discarded – undo
8532 8532
 		$date_array = array();
8533 8533
 		$temp_array = array();
8534 8534
         
8535
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8535
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8536 8536
 		{
8537 8537
 			$temp_array['month_name'] = $row['month_name'];
8538 8538
 			$temp_array['year_name'] = $row['year_name'];
@@ -8558,15 +8558,15 @@  discard block
 block discarded – undo
8558 8558
 			$datetime = new DateTime();
8559 8559
 			$offset = $datetime->format('P');
8560 8560
 		} else $offset = '+00:00';
8561
-		$filter_query = $this->getFilter($filters,true,true);
8561
+		$filter_query = $this->getFilter($filters, true, true);
8562 8562
 
8563 8563
 		if ($globalDBdriver == 'mysql') {
8564
-			$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
8564
+			$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
8565 8565
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
8566 8566
 								GROUP BY year_name, month_name
8567 8567
 								ORDER BY date_count DESC";
8568 8568
 		} else {
8569
-			$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
8569
+			$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
8570 8570
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
8571 8571
 								GROUP BY year_name, month_name
8572 8572
 								ORDER BY date_count DESC";
@@ -8578,7 +8578,7 @@  discard block
 block discarded – undo
8578 8578
 		$date_array = array();
8579 8579
 		$temp_array = array();
8580 8580
         
8581
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8581
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8582 8582
 		{
8583 8583
 			$temp_array['month_name'] = $row['month_name'];
8584 8584
 			$temp_array['year_name'] = $row['year_name'];
@@ -8600,7 +8600,7 @@  discard block
 block discarded – undo
8600 8600
 	public function countAllMonthsAircraftsByAirlines($filters = array())
8601 8601
 	{
8602 8602
 		global $globalTimezone, $globalDBdriver;
8603
-		$filter_query = $this->getFilter($filters,true,true);
8603
+		$filter_query = $this->getFilter($filters, true, true);
8604 8604
 		if ($globalTimezone != '') {
8605 8605
 			date_default_timezone_set($globalTimezone);
8606 8606
 			$datetime = new DateTime();
@@ -8608,12 +8608,12 @@  discard block
 block discarded – undo
8608 8608
 		} else $offset = '+00:00';
8609 8609
 
8610 8610
 		if ($globalDBdriver == 'mysql') {
8611
-			$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
8611
+			$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
8612 8612
 								FROM spotter_output".$filter_query." aircraft_icao <> ''  AND spotter_output.airline_icao <> '' 
8613 8613
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8614 8614
 								ORDER BY date_count DESC";
8615 8615
 		} else {
8616
-			$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
8616
+			$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
8617 8617
 								FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' 
8618 8618
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8619 8619
 								ORDER BY date_count DESC";
@@ -8625,7 +8625,7 @@  discard block
 block discarded – undo
8625 8625
 		$date_array = array();
8626 8626
 		$temp_array = array();
8627 8627
         
8628
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8628
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8629 8629
 		{
8630 8630
 			$temp_array['month_name'] = $row['month_name'];
8631 8631
 			$temp_array['year_name'] = $row['year_name'];
@@ -8652,15 +8652,15 @@  discard block
 block discarded – undo
8652 8652
 			$datetime = new DateTime();
8653 8653
 			$offset = $datetime->format('P');
8654 8654
 		} else $offset = '+00:00';
8655
-		$filter_query = $this->getFilter($filters,true,true);
8655
+		$filter_query = $this->getFilter($filters, true, true);
8656 8656
 
8657 8657
 		if ($globalDBdriver == 'mysql') {
8658
-			$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
8658
+			$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
8659 8659
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
8660 8660
 								GROUP BY year_name, month_name
8661 8661
 								ORDER BY date_count DESC";
8662 8662
 		} else {
8663
-			$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
8663
+			$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
8664 8664
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
8665 8665
 								GROUP BY year_name, month_name
8666 8666
 								ORDER BY date_count DESC";
@@ -8672,7 +8672,7 @@  discard block
 block discarded – undo
8672 8672
 		$date_array = array();
8673 8673
 		$temp_array = array();
8674 8674
         
8675
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8675
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8676 8676
 		{
8677 8677
 			$temp_array['month_name'] = $row['month_name'];
8678 8678
 			$temp_array['year_name'] = $row['year_name'];
@@ -8694,7 +8694,7 @@  discard block
 block discarded – undo
8694 8694
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
8695 8695
 	{
8696 8696
 		global $globalTimezone, $globalDBdriver;
8697
-		$filter_query = $this->getFilter($filters,true,true);
8697
+		$filter_query = $this->getFilter($filters, true, true);
8698 8698
 		if ($globalTimezone != '') {
8699 8699
 			date_default_timezone_set($globalTimezone);
8700 8700
 			$datetime = new DateTime();
@@ -8702,12 +8702,12 @@  discard block
 block discarded – undo
8702 8702
 		} else $offset = '+00:00';
8703 8703
 
8704 8704
 		if ($globalDBdriver == 'mysql') {
8705
-			$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
8705
+			$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
8706 8706
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
8707 8707
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8708 8708
 								ORDER BY date_count DESC";
8709 8709
 		} else {
8710
-			$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
8710
+			$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
8711 8711
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
8712 8712
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8713 8713
 								ORDER BY date_count DESC";
@@ -8719,7 +8719,7 @@  discard block
 block discarded – undo
8719 8719
 		$date_array = array();
8720 8720
 		$temp_array = array();
8721 8721
         
8722
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8722
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8723 8723
 		{
8724 8724
 			$temp_array['month_name'] = $row['month_name'];
8725 8725
 			$temp_array['year_name'] = $row['year_name'];
@@ -8747,7 +8747,7 @@  discard block
 block discarded – undo
8747 8747
 			$datetime = new DateTime();
8748 8748
 			$offset = $datetime->format('P');
8749 8749
 		} else $offset = '+00:00';
8750
-		$filter_query = $this->getFilter($filters,true,true);
8750
+		$filter_query = $this->getFilter($filters, true, true);
8751 8751
 		if ($globalDBdriver == 'mysql') {
8752 8752
 			$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
8753 8753
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
@@ -8768,7 +8768,7 @@  discard block
 block discarded – undo
8768 8768
 		$date_array = array();
8769 8769
 		$temp_array = array();
8770 8770
         
8771
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8771
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8772 8772
 		{
8773 8773
 			$temp_array['year_name'] = $row['year_name'];
8774 8774
 			$temp_array['month_name'] = $row['month_name'];
@@ -8788,7 +8788,7 @@  discard block
 block discarded – undo
8788 8788
 	* @return Array the hour list
8789 8789
 	*
8790 8790
 	*/
8791
-	public function countAllHours($orderby,$filters = array())
8791
+	public function countAllHours($orderby, $filters = array())
8792 8792
 	{
8793 8793
 		global $globalTimezone, $globalDBdriver;
8794 8794
 		if ($globalTimezone != '') {
@@ -8836,7 +8836,7 @@  discard block
 block discarded – undo
8836 8836
 		$hour_array = array();
8837 8837
 		$temp_array = array();
8838 8838
         
8839
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8839
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8840 8840
 		{
8841 8841
 			$temp_array['hour_name'] = $row['hour_name'];
8842 8842
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8856,7 +8856,7 @@  discard block
 block discarded – undo
8856 8856
 	public function countAllHoursByAirlines($orderby, $filters = array())
8857 8857
 	{
8858 8858
 		global $globalTimezone, $globalDBdriver;
8859
-		$filter_query = $this->getFilter($filters,true,true);
8859
+		$filter_query = $this->getFilter($filters, true, true);
8860 8860
 		if ($globalTimezone != '') {
8861 8861
 			date_default_timezone_set($globalTimezone);
8862 8862
 			$datetime = new DateTime();
@@ -8874,7 +8874,7 @@  discard block
 block discarded – undo
8874 8874
 		}
8875 8875
 		
8876 8876
 		if ($globalDBdriver == 'mysql') {
8877
-			$query  = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8877
+			$query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8878 8878
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8879 8879
 								GROUP BY spotter_output.airline_icao, hour_name 
8880 8880
 								".$orderby_sql;
@@ -8887,7 +8887,7 @@  discard block
 block discarded – undo
8887 8887
   */    
8888 8888
 		$query_data = array(':offset' => $offset);
8889 8889
 		} else {
8890
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8890
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8891 8891
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8892 8892
 								GROUP BY spotter_output.airline_icao, hour_name 
8893 8893
 								".$orderby_sql;
@@ -8900,7 +8900,7 @@  discard block
 block discarded – undo
8900 8900
 		$hour_array = array();
8901 8901
 		$temp_array = array();
8902 8902
         
8903
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8903
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8904 8904
 		{
8905 8905
 			$temp_array['hour_name'] = $row['hour_name'];
8906 8906
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8923,34 +8923,34 @@  discard block
 block discarded – undo
8923 8923
 	public function countAllHoursByAirline($airline_icao, $filters = array())
8924 8924
 	{
8925 8925
 		global $globalTimezone, $globalDBdriver;
8926
-		$filter_query = $this->getFilter($filters,true,true);
8926
+		$filter_query = $this->getFilter($filters, true, true);
8927 8927
 		if ($globalTimezone != '') {
8928 8928
 			date_default_timezone_set($globalTimezone);
8929 8929
 			$datetime = new DateTime();
8930 8930
 			$offset = $datetime->format('P');
8931 8931
 		} else $offset = '+00:00';
8932 8932
 
8933
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8933
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
8934 8934
 
8935 8935
 		if ($globalDBdriver == 'mysql') {
8936
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8936
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8937 8937
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
8938 8938
 								GROUP BY hour_name 
8939 8939
 								ORDER BY hour_name ASC";
8940 8940
 		} else {
8941
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8941
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8942 8942
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
8943 8943
 								GROUP BY hour_name 
8944 8944
 								ORDER BY hour_name ASC";
8945 8945
 		}
8946 8946
 		
8947 8947
 		$sth = $this->db->prepare($query);
8948
-		$sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset));
8948
+		$sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset));
8949 8949
       
8950 8950
 		$hour_array = array();
8951 8951
 		$temp_array = array();
8952 8952
         
8953
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8953
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8954 8954
 		{
8955 8955
 			$temp_array['hour_name'] = $row['hour_name'];
8956 8956
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8973,8 +8973,8 @@  discard block
 block discarded – undo
8973 8973
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
8974 8974
 	{
8975 8975
 		global $globalTimezone, $globalDBdriver;
8976
-		$filter_query = $this->getFilter($filters,true,true);
8977
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
8976
+		$filter_query = $this->getFilter($filters, true, true);
8977
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
8978 8978
 		if ($globalTimezone != '') {
8979 8979
 			date_default_timezone_set($globalTimezone);
8980 8980
 			$datetime = new DateTime();
@@ -8982,24 +8982,24 @@  discard block
 block discarded – undo
8982 8982
 		} else $offset = '+00:00';
8983 8983
 
8984 8984
 		if ($globalDBdriver == 'mysql') {
8985
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8985
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8986 8986
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
8987 8987
 								GROUP BY hour_name 
8988 8988
 								ORDER BY hour_name ASC";
8989 8989
 		} else {
8990
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8990
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8991 8991
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
8992 8992
 								GROUP BY hour_name 
8993 8993
 								ORDER BY hour_name ASC";
8994 8994
 		}
8995 8995
 		
8996 8996
 		$sth = $this->db->prepare($query);
8997
-		$sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset));
8997
+		$sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset));
8998 8998
       
8999 8999
 		$hour_array = array();
9000 9000
 		$temp_array = array();
9001 9001
         
9002
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9002
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9003 9003
 		{
9004 9004
 			$temp_array['hour_name'] = $row['hour_name'];
9005 9005
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9020,8 +9020,8 @@  discard block
 block discarded – undo
9020 9020
 	public function countAllHoursByRegistration($registration, $filters = array())
9021 9021
 	{
9022 9022
 		global $globalTimezone, $globalDBdriver;
9023
-		$filter_query = $this->getFilter($filters,true,true);
9024
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9023
+		$filter_query = $this->getFilter($filters, true, true);
9024
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9025 9025
 		if ($globalTimezone != '') {
9026 9026
 			date_default_timezone_set($globalTimezone);
9027 9027
 			$datetime = new DateTime();
@@ -9029,24 +9029,24 @@  discard block
 block discarded – undo
9029 9029
 		} else $offset = '+00:00';
9030 9030
 
9031 9031
 		if ($globalDBdriver == 'mysql') {
9032
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9032
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9033 9033
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
9034 9034
 								GROUP BY hour_name 
9035 9035
 								ORDER BY hour_name ASC";
9036 9036
 		} else {
9037
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9037
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9038 9038
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
9039 9039
 								GROUP BY hour_name 
9040 9040
 								ORDER BY hour_name ASC";
9041 9041
 		}
9042 9042
 		
9043 9043
 		$sth = $this->db->prepare($query);
9044
-		$sth->execute(array(':registration' => $registration,':offset' => $offset));
9044
+		$sth->execute(array(':registration' => $registration, ':offset' => $offset));
9045 9045
       
9046 9046
 		$hour_array = array();
9047 9047
 		$temp_array = array();
9048 9048
         
9049
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9049
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9050 9050
 		{
9051 9051
 			$temp_array['hour_name'] = $row['hour_name'];
9052 9052
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9067,8 +9067,8 @@  discard block
 block discarded – undo
9067 9067
 	public function countAllHoursByAirport($airport_icao, $filters = array())
9068 9068
 	{
9069 9069
 		global $globalTimezone, $globalDBdriver;
9070
-		$filter_query = $this->getFilter($filters,true,true);
9071
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
9070
+		$filter_query = $this->getFilter($filters, true, true);
9071
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
9072 9072
 		if ($globalTimezone != '') {
9073 9073
 			date_default_timezone_set($globalTimezone);
9074 9074
 			$datetime = new DateTime();
@@ -9076,24 +9076,24 @@  discard block
 block discarded – undo
9076 9076
 		} else $offset = '+00:00';
9077 9077
 
9078 9078
 		if ($globalDBdriver == 'mysql') {
9079
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9079
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9080 9080
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
9081 9081
 								GROUP BY hour_name 
9082 9082
 								ORDER BY hour_name ASC";
9083 9083
 		} else {
9084
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9084
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9085 9085
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
9086 9086
 								GROUP BY hour_name 
9087 9087
 								ORDER BY hour_name ASC";
9088 9088
 		}
9089 9089
 		
9090 9090
 		$sth = $this->db->prepare($query);
9091
-		$sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset));
9091
+		$sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset));
9092 9092
       
9093 9093
 		$hour_array = array();
9094 9094
 		$temp_array = array();
9095 9095
         
9096
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9096
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9097 9097
 		{
9098 9098
 			$temp_array['hour_name'] = $row['hour_name'];
9099 9099
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9112,11 +9112,11 @@  discard block
 block discarded – undo
9112 9112
 	* @return Array the hour list
9113 9113
 	*
9114 9114
 	*/
9115
-	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
9115
+	public function countAllHoursByManufacturer($aircraft_manufacturer, $filters = array())
9116 9116
 	{
9117 9117
 		global $globalTimezone, $globalDBdriver;
9118
-		$filter_query = $this->getFilter($filters,true,true);
9119
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
9118
+		$filter_query = $this->getFilter($filters, true, true);
9119
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
9120 9120
 		if ($globalTimezone != '') {
9121 9121
 			date_default_timezone_set($globalTimezone);
9122 9122
 			$datetime = new DateTime();
@@ -9124,24 +9124,24 @@  discard block
 block discarded – undo
9124 9124
 		} else $offset = '+00:00';
9125 9125
 
9126 9126
 		if ($globalDBdriver == 'mysql') {
9127
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9127
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9128 9128
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
9129 9129
 								GROUP BY hour_name 
9130 9130
 								ORDER BY hour_name ASC";
9131 9131
 		} else {
9132
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9132
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9133 9133
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
9134 9134
 								GROUP BY hour_name 
9135 9135
 								ORDER BY hour_name ASC";
9136 9136
 		}
9137 9137
 		
9138 9138
 		$sth = $this->db->prepare($query);
9139
-		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset));
9139
+		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset));
9140 9140
       
9141 9141
 		$hour_array = array();
9142 9142
 		$temp_array = array();
9143 9143
         
9144
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9144
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9145 9145
 		{
9146 9146
 			$temp_array['hour_name'] = $row['hour_name'];
9147 9147
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9163,8 +9163,8 @@  discard block
 block discarded – undo
9163 9163
 	public function countAllHoursByDate($date, $filters = array())
9164 9164
 	{
9165 9165
 		global $globalTimezone, $globalDBdriver;
9166
-		$filter_query = $this->getFilter($filters,true,true);
9167
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
9166
+		$filter_query = $this->getFilter($filters, true, true);
9167
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
9168 9168
 		if ($globalTimezone != '') {
9169 9169
 			date_default_timezone_set($globalTimezone);
9170 9170
 			$datetime = new DateTime($date);
@@ -9172,12 +9172,12 @@  discard block
 block discarded – undo
9172 9172
 		} else $offset = '+00:00';
9173 9173
 
9174 9174
 		if ($globalDBdriver == 'mysql') {
9175
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9175
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9176 9176
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
9177 9177
 								GROUP BY hour_name 
9178 9178
 								ORDER BY hour_name ASC";
9179 9179
 		} else {
9180
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9180
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9181 9181
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date
9182 9182
 								GROUP BY hour_name 
9183 9183
 								ORDER BY hour_name ASC";
@@ -9189,7 +9189,7 @@  discard block
 block discarded – undo
9189 9189
 		$hour_array = array();
9190 9190
 		$temp_array = array();
9191 9191
         
9192
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9192
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9193 9193
 		{
9194 9194
 			$temp_array['hour_name'] = $row['hour_name'];
9195 9195
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9211,8 +9211,8 @@  discard block
 block discarded – undo
9211 9211
 	public function countAllHoursByIdent($ident, $filters = array())
9212 9212
 	{
9213 9213
 		global $globalTimezone, $globalDBdriver;
9214
-		$filter_query = $this->getFilter($filters,true,true);
9215
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
9214
+		$filter_query = $this->getFilter($filters, true, true);
9215
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
9216 9216
 		if ($globalTimezone != '') {
9217 9217
 			date_default_timezone_set($globalTimezone);
9218 9218
 			$datetime = new DateTime();
@@ -9220,12 +9220,12 @@  discard block
 block discarded – undo
9220 9220
 		} else $offset = '+00:00';
9221 9221
 
9222 9222
 		if ($globalDBdriver == 'mysql') {
9223
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9223
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9224 9224
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
9225 9225
 								GROUP BY hour_name 
9226 9226
 								ORDER BY hour_name ASC";
9227 9227
 		} else {
9228
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9228
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9229 9229
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
9230 9230
 								GROUP BY hour_name 
9231 9231
 								ORDER BY hour_name ASC";
@@ -9233,12 +9233,12 @@  discard block
 block discarded – undo
9233 9233
       
9234 9234
 		
9235 9235
 		$sth = $this->db->prepare($query);
9236
-		$sth->execute(array(':ident' => $ident,':offset' => $offset));
9236
+		$sth->execute(array(':ident' => $ident, ':offset' => $offset));
9237 9237
       
9238 9238
 		$hour_array = array();
9239 9239
 		$temp_array = array();
9240 9240
         
9241
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9241
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9242 9242
 		{
9243 9243
 			$temp_array['hour_name'] = $row['hour_name'];
9244 9244
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9257,12 +9257,12 @@  discard block
 block discarded – undo
9257 9257
 	* @return Array the hour list
9258 9258
 	*
9259 9259
 	*/
9260
-	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
9260
+	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
9261 9261
 	{
9262 9262
 		global $globalTimezone, $globalDBdriver;
9263
-		$filter_query = $this->getFilter($filters,true,true);
9264
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
9265
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
9263
+		$filter_query = $this->getFilter($filters, true, true);
9264
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
9265
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
9266 9266
 		if ($globalTimezone != '') {
9267 9267
 			date_default_timezone_set($globalTimezone);
9268 9268
 			$datetime = new DateTime();
@@ -9270,24 +9270,24 @@  discard block
 block discarded – undo
9270 9270
 		} else $offset = '+00:00';
9271 9271
 
9272 9272
 		if ($globalDBdriver == 'mysql') {
9273
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9273
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9274 9274
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
9275 9275
 								GROUP BY hour_name 
9276 9276
 								ORDER BY hour_name ASC";
9277 9277
 		} else {
9278
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9278
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9279 9279
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
9280 9280
 								GROUP BY hour_name 
9281 9281
 								ORDER BY hour_name ASC";
9282 9282
 		}
9283 9283
 		
9284 9284
 		$sth = $this->db->prepare($query);
9285
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset));
9285
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset));
9286 9286
       
9287 9287
 		$hour_array = array();
9288 9288
 		$temp_array = array();
9289 9289
         
9290
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9290
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9291 9291
 		{
9292 9292
 			$temp_array['hour_name'] = $row['hour_name'];
9293 9293
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9308,8 +9308,8 @@  discard block
 block discarded – undo
9308 9308
 	public function countAllHoursByCountry($country, $filters = array())
9309 9309
 	{
9310 9310
 		global $globalTimezone, $globalDBdriver;
9311
-		$filter_query = $this->getFilter($filters,true,true);
9312
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
9311
+		$filter_query = $this->getFilter($filters, true, true);
9312
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
9313 9313
 		if ($globalTimezone != '') {
9314 9314
 			date_default_timezone_set($globalTimezone);
9315 9315
 			$datetime = new DateTime();
@@ -9317,24 +9317,24 @@  discard block
 block discarded – undo
9317 9317
 		} else $offset = '+00:00';
9318 9318
 
9319 9319
 		if ($globalDBdriver == 'mysql') {
9320
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9320
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9321 9321
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
9322 9322
 								GROUP BY hour_name 
9323 9323
 								ORDER BY hour_name ASC";
9324 9324
 		} else {
9325
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9325
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9326 9326
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
9327 9327
 								GROUP BY hour_name 
9328 9328
 								ORDER BY hour_name ASC";
9329 9329
 		}
9330 9330
 		
9331 9331
 		$sth = $this->db->prepare($query);
9332
-		$sth->execute(array(':country' => $country,':offset' => $offset));
9332
+		$sth->execute(array(':country' => $country, ':offset' => $offset));
9333 9333
       
9334 9334
 		$hour_array = array();
9335 9335
 		$temp_array = array();
9336 9336
         
9337
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9337
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9338 9338
 		{
9339 9339
 			$temp_array['hour_name'] = $row['hour_name'];
9340 9340
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9356,8 +9356,8 @@  discard block
 block discarded – undo
9356 9356
 	*/
9357 9357
 	public function countOverallAircrafts($filters = array())
9358 9358
 	{
9359
-		$filter_query = $this->getFilter($filters,true,true);
9360
-		$query  = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
9359
+		$filter_query = $this->getFilter($filters, true, true);
9360
+		$query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
9361 9361
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
9362 9362
 		$sth = $this->db->prepare($query);
9363 9363
 		$sth->execute();
@@ -9372,8 +9372,8 @@  discard block
 block discarded – undo
9372 9372
 	*/
9373 9373
 	public function countOverallArrival($filters = array())
9374 9374
 	{
9375
-		$filter_query = $this->getFilter($filters,true,true);
9376
-		$query  = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
9375
+		$filter_query = $this->getFilter($filters, true, true);
9376
+		$query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
9377 9377
                     FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''";
9378 9378
 		
9379 9379
 		$sth = $this->db->prepare($query);
@@ -9389,8 +9389,8 @@  discard block
 block discarded – undo
9389 9389
 	*/
9390 9390
 	public function countOverallPilots($filters = array())
9391 9391
 	{
9392
-		$filter_query = $this->getFilter($filters,true,true);
9393
-		$query  = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
9392
+		$filter_query = $this->getFilter($filters, true, true);
9393
+		$query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
9394 9394
                     FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''";
9395 9395
 		$sth = $this->db->prepare($query);
9396 9396
 		$sth->execute();
@@ -9405,8 +9405,8 @@  discard block
 block discarded – undo
9405 9405
 	*/
9406 9406
 	public function countOverallOwners($filters = array())
9407 9407
 	{
9408
-		$filter_query = $this->getFilter($filters,true,true);
9409
-		$query  = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
9408
+		$filter_query = $this->getFilter($filters, true, true);
9409
+		$query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
9410 9410
                     FROM spotter_output".$filter_query." spotter_output.owner_name <> ''";
9411 9411
 		$sth = $this->db->prepare($query);
9412 9412
 		$sth->execute();
@@ -9439,8 +9439,8 @@  discard block
 block discarded – undo
9439 9439
 	*/
9440 9440
 	public function countOverallMilitaryFlights($filters = array())
9441 9441
 	{
9442
-		$filter_query = $this->getFilter($filters,true,true);
9443
-		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
9442
+		$filter_query = $this->getFilter($filters, true, true);
9443
+		$query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
9444 9444
                     FROM airlines,spotter_output".$filter_query." spotter_output.airline_icao = airlines.icao AND airlines.type = 'military'";
9445 9445
       
9446 9446
 		$sth = $this->db->prepare($query);
@@ -9477,7 +9477,7 @@  discard block
 block discarded – undo
9477 9477
 	public function countAllHoursFromToday($filters = array())
9478 9478
 	{
9479 9479
 		global $globalTimezone, $globalDBdriver;
9480
-		$filter_query = $this->getFilter($filters,true,true);
9480
+		$filter_query = $this->getFilter($filters, true, true);
9481 9481
 		if ($globalTimezone != '') {
9482 9482
 			date_default_timezone_set($globalTimezone);
9483 9483
 			$datetime = new DateTime();
@@ -9485,12 +9485,12 @@  discard block
 block discarded – undo
9485 9485
 		} else $offset = '+00:00';
9486 9486
 
9487 9487
 		if ($globalDBdriver == 'mysql') {
9488
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9488
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9489 9489
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE()
9490 9490
 								GROUP BY hour_name 
9491 9491
 								ORDER BY hour_name ASC";
9492 9492
 		} else {
9493
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9493
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9494 9494
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date)
9495 9495
 								GROUP BY hour_name 
9496 9496
 								ORDER BY hour_name ASC";
@@ -9502,7 +9502,7 @@  discard block
 block discarded – undo
9502 9502
 		$hour_array = array();
9503 9503
 		$temp_array = array();
9504 9504
         
9505
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9505
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9506 9506
 		{
9507 9507
 			$temp_array['hour_name'] = $row['hour_name'];
9508 9508
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9521,14 +9521,14 @@  discard block
 block discarded – undo
9521 9521
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
9522 9522
 	{
9523 9523
 		global $global_query, $globalDBdriver, $globalTimezone;
9524
-		$filter_query = $this->getFilter($filters,true,true);
9524
+		$filter_query = $this->getFilter($filters, true, true);
9525 9525
 		date_default_timezone_set('UTC');
9526 9526
 		$limit_query = '';
9527 9527
 		if ($limit != "")
9528 9528
 		{
9529 9529
 			$limit_array = explode(",", $limit);
9530
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
9531
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
9530
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
9531
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
9532 9532
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
9533 9533
 			{
9534 9534
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
@@ -9581,7 +9581,7 @@  discard block
 block discarded – undo
9581 9581
 			    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')
9582 9582
 			    HAVING count(spotter_output.ident) > 5$orderby_query";
9583 9583
 			//echo $query;
9584
-			$spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone));
9584
+			$spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone));
9585 9585
 			/*
9586 9586
 			$sth = $this->db->prepare($query);
9587 9587
 			$sth->execute(array(':timezone' => $globalTimezone));
@@ -9600,9 +9600,9 @@  discard block
 block discarded – undo
9600 9600
 	*/
9601 9601
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
9602 9602
 	{
9603
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
9603
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
9604 9604
 
9605
-		$query  = "SELECT spotter_output.spotter_id
9605
+		$query = "SELECT spotter_output.spotter_id
9606 9606
 								FROM spotter_output 
9607 9607
 								WHERE spotter_output.flightaware_id = '".$flightaware_id."'";
9608 9608
         
@@ -9610,7 +9610,7 @@  discard block
 block discarded – undo
9610 9610
 		$sth = $this->db->prepare($query);
9611 9611
 		$sth->execute();
9612 9612
 
9613
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9613
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9614 9614
 		{
9615 9615
 			return $row['spotter_id'];
9616 9616
 		}
@@ -9635,23 +9635,23 @@  discard block
 block discarded – undo
9635 9635
 		}
9636 9636
 		
9637 9637
 		$current_date = date("Y-m-d H:i:s");
9638
-		$date = date("Y-m-d H:i:s",strtotime($dateString." UTC"));
9638
+		$date = date("Y-m-d H:i:s", strtotime($dateString." UTC"));
9639 9639
 		
9640 9640
 		$diff = abs(strtotime($current_date) - strtotime($date));
9641 9641
 
9642
-		$time_array['years'] = floor($diff / (365*60*60*24)); 
9642
+		$time_array['years'] = floor($diff/(365*60*60*24)); 
9643 9643
 		$years = $time_array['years'];
9644 9644
 		
9645
-		$time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
9645
+		$time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24));
9646 9646
 		$months = $time_array['months'];
9647 9647
 		
9648
-		$time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
9648
+		$time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24));
9649 9649
 		$days = $time_array['days'];
9650
-		$time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60));
9650
+		$time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60));
9651 9651
 		$hours = $time_array['hours'];
9652
-		$time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60);
9652
+		$time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60);
9653 9653
 		$minutes = $time_array['minutes'];
9654
-		$time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
9654
+		$time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
9655 9655
 		
9656 9656
 		return $time_array;	
9657 9657
 	}	
@@ -9677,63 +9677,63 @@  discard block
 block discarded – undo
9677 9677
 			$temp_array['direction_degree'] = $direction;
9678 9678
 			$temp_array['direction_shortname'] = "N";
9679 9679
 			$temp_array['direction_fullname'] = "North";
9680
-		} elseif ($direction >= 22.5 && $direction < 45){
9680
+		} elseif ($direction >= 22.5 && $direction < 45) {
9681 9681
 			$temp_array['direction_degree'] = $direction;
9682 9682
 			$temp_array['direction_shortname'] = "NNE";
9683 9683
 			$temp_array['direction_fullname'] = "North-Northeast";
9684
-		} elseif ($direction >= 45 && $direction < 67.5){
9684
+		} elseif ($direction >= 45 && $direction < 67.5) {
9685 9685
 			$temp_array['direction_degree'] = $direction;
9686 9686
 			$temp_array['direction_shortname'] = "NE";
9687 9687
 			$temp_array['direction_fullname'] = "Northeast";
9688
-		} elseif ($direction >= 67.5 && $direction < 90){
9688
+		} elseif ($direction >= 67.5 && $direction < 90) {
9689 9689
 			$temp_array['direction_degree'] = $direction;
9690 9690
 			$temp_array['direction_shortname'] = "ENE";
9691 9691
 			$temp_array['direction_fullname'] = "East-Northeast";
9692
-		} elseif ($direction >= 90 && $direction < 112.5){
9692
+		} elseif ($direction >= 90 && $direction < 112.5) {
9693 9693
 			$temp_array['direction_degree'] = $direction;
9694 9694
 			$temp_array['direction_shortname'] = "E";
9695 9695
 			$temp_array['direction_fullname'] = "East";
9696
-		} elseif ($direction >= 112.5 && $direction < 135){
9696
+		} elseif ($direction >= 112.5 && $direction < 135) {
9697 9697
 			$temp_array['direction_degree'] = $direction;
9698 9698
 			$temp_array['direction_shortname'] = "ESE";
9699 9699
 			$temp_array['direction_fullname'] = "East-Southeast";
9700
-		} elseif ($direction >= 135 && $direction < 157.5){
9700
+		} elseif ($direction >= 135 && $direction < 157.5) {
9701 9701
 			$temp_array['direction_degree'] = $direction;
9702 9702
 			$temp_array['direction_shortname'] = "SE";
9703 9703
 			$temp_array['direction_fullname'] = "Southeast";
9704
-		} elseif ($direction >= 157.5 && $direction < 180){
9704
+		} elseif ($direction >= 157.5 && $direction < 180) {
9705 9705
 			$temp_array['direction_degree'] = $direction;
9706 9706
 			$temp_array['direction_shortname'] = "SSE";
9707 9707
 			$temp_array['direction_fullname'] = "South-Southeast";
9708
-		} elseif ($direction >= 180 && $direction < 202.5){
9708
+		} elseif ($direction >= 180 && $direction < 202.5) {
9709 9709
 			$temp_array['direction_degree'] = $direction;
9710 9710
 			$temp_array['direction_shortname'] = "S";
9711 9711
 			$temp_array['direction_fullname'] = "South";
9712
-		} elseif ($direction >= 202.5 && $direction < 225){
9712
+		} elseif ($direction >= 202.5 && $direction < 225) {
9713 9713
 			$temp_array['direction_degree'] = $direction;
9714 9714
 			$temp_array['direction_shortname'] = "SSW";
9715 9715
 			$temp_array['direction_fullname'] = "South-Southwest";
9716
-		} elseif ($direction >= 225 && $direction < 247.5){
9716
+		} elseif ($direction >= 225 && $direction < 247.5) {
9717 9717
 			$temp_array['direction_degree'] = $direction;
9718 9718
 			$temp_array['direction_shortname'] = "SW";
9719 9719
 			$temp_array['direction_fullname'] = "Southwest";
9720
-		} elseif ($direction >= 247.5 && $direction < 270){
9720
+		} elseif ($direction >= 247.5 && $direction < 270) {
9721 9721
 			$temp_array['direction_degree'] = $direction;
9722 9722
 			$temp_array['direction_shortname'] = "WSW";
9723 9723
 			$temp_array['direction_fullname'] = "West-Southwest";
9724
-		} elseif ($direction >= 270 && $direction < 292.5){
9724
+		} elseif ($direction >= 270 && $direction < 292.5) {
9725 9725
 			$temp_array['direction_degree'] = $direction;
9726 9726
 			$temp_array['direction_shortname'] = "W";
9727 9727
 			$temp_array['direction_fullname'] = "West";
9728
-		} elseif ($direction >= 292.5 && $direction < 315){
9728
+		} elseif ($direction >= 292.5 && $direction < 315) {
9729 9729
 			$temp_array['direction_degree'] = $direction;
9730 9730
 			$temp_array['direction_shortname'] = "WNW";
9731 9731
 			$temp_array['direction_fullname'] = "West-Northwest";
9732
-		} elseif ($direction >= 315 && $direction < 337.5){
9732
+		} elseif ($direction >= 315 && $direction < 337.5) {
9733 9733
 			$temp_array['direction_degree'] = $direction;
9734 9734
 			$temp_array['direction_shortname'] = "NW";
9735 9735
 			$temp_array['direction_fullname'] = "Northwest";
9736
-		} elseif ($direction >= 337.5 && $direction < 360){
9736
+		} elseif ($direction >= 337.5 && $direction < 360) {
9737 9737
 			$temp_array['direction_degree'] = $direction;
9738 9738
 			$temp_array['direction_shortname'] = "NNW";
9739 9739
 			$temp_array['direction_fullname'] = "North-Northwest";
@@ -9786,9 +9786,9 @@  discard block
 block discarded – undo
9786 9786
 	*/
9787 9787
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
9788 9788
 	{
9789
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
9789
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
9790 9790
 	
9791
-		$query  = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
9791
+		$query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
9792 9792
 		
9793 9793
 		$sth = $this->db->prepare($query);
9794 9794
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -9811,9 +9811,9 @@  discard block
 block discarded – undo
9811 9811
 	*/
9812 9812
 	public function getAircraftTypeBymodeS($aircraft_modes)
9813 9813
 	{
9814
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
9814
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
9815 9815
 	
9816
-		$query  = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
9816
+		$query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
9817 9817
 		
9818 9818
 		$sth = $this->db->prepare($query);
9819 9819
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -9834,11 +9834,11 @@  discard block
 block discarded – undo
9834 9834
 	* @param Float $longitude longitute of the flight
9835 9835
 	* @return String the countrie
9836 9836
 	*/
9837
-	public function getCountryFromLatitudeLongitude($latitude,$longitude)
9837
+	public function getCountryFromLatitudeLongitude($latitude, $longitude)
9838 9838
 	{
9839 9839
 		global $globalDBdriver, $globalDebug;
9840
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9841
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9840
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
9841
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
9842 9842
 	
9843 9843
 		$Connection = new Connection($this->db);
9844 9844
 		if (!$Connection->tableExists('countries')) return '';
@@ -9878,7 +9878,7 @@  discard block
 block discarded – undo
9878 9878
 	public function getCountryFromISO2($iso2)
9879 9879
 	{
9880 9880
 		global $globalDBdriver, $globalDebug;
9881
-		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
9881
+		$iso2 = filter_var($iso2, FILTER_SANITIZE_STRING);
9882 9882
 	
9883 9883
 		$Connection = new Connection($this->db);
9884 9884
 		if (!$Connection->tableExists('countries')) return '';
@@ -9910,19 +9910,19 @@  discard block
 block discarded – undo
9910 9910
 	*/
9911 9911
 	public function convertAircraftRegistration($registration)
9912 9912
 	{
9913
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9913
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9914 9914
 		$registration_prefix = '';
9915 9915
 		$registration_1 = substr($registration, 0, 1);
9916 9916
 		$registration_2 = substr($registration, 0, 2);
9917 9917
 
9918 9918
 		//first get the prefix based on two characters
9919
-		$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
9919
+		$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
9920 9920
       
9921 9921
 		
9922 9922
 		$sth = $this->db->prepare($query);
9923 9923
 		$sth->execute(array(':registration_2' => $registration_2));
9924 9924
         
9925
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9925
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9926 9926
 		{
9927 9927
 			$registration_prefix = $row['registration_prefix'];
9928 9928
 		}
@@ -9930,11 +9930,11 @@  discard block
 block discarded – undo
9930 9930
 		//if we didn't find a two chracter prefix lets just search the one with one character
9931 9931
 		if ($registration_prefix == '')
9932 9932
 		{
9933
-			$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
9933
+			$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
9934 9934
 			$sth = $this->db->prepare($query);
9935 9935
 			$sth->execute(array(':registration_1' => $registration_1));
9936 9936
 	        
9937
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9937
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9938 9938
 			{
9939 9939
 				$registration_prefix = $row['registration_prefix'];
9940 9940
 			}
@@ -9948,7 +9948,7 @@  discard block
 block discarded – undo
9948 9948
 			} else {
9949 9949
 				$registration = preg_replace("/^(.{1})/", "$1-", $registration);
9950 9950
 			}
9951
-		} else if(strlen($registration_prefix) == 2){
9951
+		} else if (strlen($registration_prefix) == 2) {
9952 9952
 			if (0 === strpos($registration, 'N')) {
9953 9953
 				$registration = preg_replace("/^(.{2})/", "$1", $registration);
9954 9954
 			} else {
@@ -9967,17 +9967,17 @@  discard block
 block discarded – undo
9967 9967
 	*/
9968 9968
 	public function countryFromAircraftRegistration($registration)
9969 9969
 	{
9970
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9970
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9971 9971
 		
9972 9972
 		$registration_prefix = '';
9973
-		$registration_test = explode('-',$registration);
9973
+		$registration_test = explode('-', $registration);
9974 9974
 		$country = '';
9975 9975
 		if ($registration_test[0] != $registration) {
9976 9976
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9977 9977
 	      
9978 9978
 			$sth = $this->db->prepare($query);
9979 9979
 			$sth->execute(array(':registration_1' => $registration_test[0]));
9980
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9980
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9981 9981
 			{
9982 9982
 				//$registration_prefix = $row['registration_prefix'];
9983 9983
 				$country = $row['country'];
@@ -9988,13 +9988,13 @@  discard block
 block discarded – undo
9988 9988
 
9989 9989
 			$country = '';
9990 9990
 			//first get the prefix based on two characters
9991
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
9991
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
9992 9992
       
9993 9993
 			
9994 9994
 			$sth = $this->db->prepare($query);
9995 9995
 			$sth->execute(array(':registration_2' => $registration_2));
9996 9996
         
9997
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9997
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9998 9998
 			{
9999 9999
 				$registration_prefix = $row['registration_prefix'];
10000 10000
 				$country = $row['country'];
@@ -10003,12 +10003,12 @@  discard block
 block discarded – undo
10003 10003
 			//if we didn't find a two chracter prefix lets just search the one with one character
10004 10004
 			if ($registration_prefix == "")
10005 10005
 			{
10006
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
10006
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
10007 10007
 	      
10008 10008
 				$sth = $this->db->prepare($query);
10009 10009
 				$sth->execute(array(':registration_1' => $registration_1));
10010 10010
 	        
10011
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
10011
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10012 10012
 				{
10013 10013
 					//$registration_prefix = $row['registration_prefix'];
10014 10014
 					$country = $row['country'];
@@ -10028,17 +10028,17 @@  discard block
 block discarded – undo
10028 10028
 	*/
10029 10029
 	public function registrationPrefixFromAircraftRegistration($registration)
10030 10030
 	{
10031
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
10031
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
10032 10032
 		
10033 10033
 		$registration_prefix = '';
10034
-		$registration_test = explode('-',$registration);
10034
+		$registration_test = explode('-', $registration);
10035 10035
 		//$country = '';
10036 10036
 		if ($registration_test[0] != $registration) {
10037
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
10037
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
10038 10038
 	      
10039 10039
 			$sth = $this->db->prepare($query);
10040 10040
 			$sth->execute(array(':registration_1' => $registration_test[0]));
10041
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
10041
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10042 10042
 			{
10043 10043
 				$registration_prefix = $row['registration_prefix'];
10044 10044
 				//$country = $row['country'];
@@ -10048,13 +10048,13 @@  discard block
 block discarded – undo
10048 10048
 		        $registration_2 = substr($registration, 0, 2);
10049 10049
 
10050 10050
 			//first get the prefix based on two characters
10051
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
10051
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
10052 10052
       
10053 10053
 			
10054 10054
 			$sth = $this->db->prepare($query);
10055 10055
 			$sth->execute(array(':registration_2' => $registration_2));
10056 10056
         
10057
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
10057
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10058 10058
 			{
10059 10059
 				$registration_prefix = $row['registration_prefix'];
10060 10060
 				//$country = $row['country'];
@@ -10063,12 +10063,12 @@  discard block
 block discarded – undo
10063 10063
 			//if we didn't find a two chracter prefix lets just search the one with one character
10064 10064
 			if ($registration_prefix == "")
10065 10065
 			{
10066
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
10066
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
10067 10067
 	      
10068 10068
 				$sth = $this->db->prepare($query);
10069 10069
 				$sth->execute(array(':registration_1' => $registration_1));
10070 10070
 	        
10071
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
10071
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10072 10072
 				{
10073 10073
 					$registration_prefix = $row['registration_prefix'];
10074 10074
 					//$country = $row['country'];
@@ -10089,13 +10089,13 @@  discard block
 block discarded – undo
10089 10089
 	*/
10090 10090
 	public function countryFromAircraftRegistrationCode($registration)
10091 10091
 	{
10092
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
10092
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
10093 10093
 		
10094 10094
 		$country = '';
10095
-		$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1";
10095
+		$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1";
10096 10096
 		$sth = $this->db->prepare($query);
10097 10097
 		$sth->execute(array(':registration' => $registration));
10098
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10098
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10099 10099
 		{
10100 10100
 			$country = $row['country'];
10101 10101
 		}
@@ -10108,9 +10108,9 @@  discard block
 block discarded – undo
10108 10108
 	* @param String $flightaware_id flightaware_id from spotter_output table
10109 10109
 	* @param String $highlight New highlight value
10110 10110
 	*/
10111
-	public function setHighlightFlight($flightaware_id,$highlight) {
10111
+	public function setHighlightFlight($flightaware_id, $highlight) {
10112 10112
 		
10113
-		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
10113
+		$query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
10114 10114
 		$sth = $this->db->prepare($query);
10115 10115
 		$sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight));
10116 10116
 	}
@@ -10122,13 +10122,13 @@  discard block
 block discarded – undo
10122 10122
 	* @param String $date Date of spotted aircraft
10123 10123
 	* @param String $highlight New highlight value
10124 10124
 	*/
10125
-	public function setHighlightFlightByRegistration($registration,$highlight, $date = '') {
10125
+	public function setHighlightFlightByRegistration($registration, $highlight, $date = '') {
10126 10126
 		if ($date == '') {
10127 10127
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)";
10128 10128
 			$query_values = array(':registration' => $registration, ':highlight' => $highlight);
10129 10129
 		} else {
10130 10130
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE registration = :registration AND date(date) = :date";
10131
-			$query_values = array(':registration' => $registration, ':highlight' => $highlight,':date' => $date);
10131
+			$query_values = array(':registration' => $registration, ':highlight' => $highlight, ':date' => $date);
10132 10132
 		}
10133 10133
 		$sth = $this->db->prepare($query);
10134 10134
 		$sth->execute($query_values);
@@ -10158,7 +10158,7 @@  discard block
 block discarded – undo
10158 10158
 		
10159 10159
 		$bitly_data = json_decode($bitly_data);
10160 10160
 		$bitly_url = '';
10161
-		if ($bitly_data->status_txt = "OK"){
10161
+		if ($bitly_data->status_txt = "OK") {
10162 10162
 			$bitly_url = $bitly_data->data->url;
10163 10163
 		}
10164 10164
 
@@ -10168,7 +10168,7 @@  discard block
 block discarded – undo
10168 10168
 
10169 10169
 	public function getOrderBy()
10170 10170
 	{
10171
-		$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"));
10171
+		$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"));
10172 10172
 		
10173 10173
 		return $orderby;
10174 10174
 		
@@ -10302,14 +10302,14 @@  discard block
 block discarded – undo
10302 10302
 		}
10303 10303
 		$sth = $this->db->prepare($query);
10304 10304
 		$sth->execute();
10305
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10305
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10306 10306
 		{
10307 10307
 			$departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']);
10308 10308
 			$arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']);
10309 10309
 			if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) {
10310
-				$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";
10310
+				$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";
10311 10311
 				$sthu = $this->db->prepare($update_query);
10312
-				$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']));
10312
+				$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']));
10313 10313
 			}
10314 10314
 		}
10315 10315
 		
@@ -10322,7 +10322,7 @@  discard block
 block discarded – undo
10322 10322
 		}
10323 10323
 		$sth = $this->db->prepare($query);
10324 10324
 		$sth->execute();
10325
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10325
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10326 10326
 		{
10327 10327
 			if (is_numeric(substr($row['ident'], -1, 1)))
10328 10328
 			{
@@ -10331,11 +10331,11 @@  discard block
 block discarded – undo
10331 10331
 				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
10332 10332
 				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
10333 10333
 				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
10334
-				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
10334
+				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
10335 10335
 				if (isset($airline_array[0]['name'])) {
10336
-					$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";
10336
+					$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";
10337 10337
 					$sthu = $this->db->prepare($update_query);
10338
-					$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']));
10338
+					$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']));
10339 10339
 				}
10340 10340
 			}
10341 10341
 		}
@@ -10355,18 +10355,18 @@  discard block
 block discarded – undo
10355 10355
 		}
10356 10356
 		$sth = $this->db->prepare($query);
10357 10357
 		$sth->execute();
10358
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10358
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10359 10359
 		{
10360 10360
 			if ($row['aircraft_icao'] != '') {
10361 10361
 				$aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']);
10362
-				if ($row['registration'] != ""){
10362
+				if ($row['registration'] != "") {
10363 10363
 					$image_array = $Image->getSpotterImage($row['registration']);
10364 10364
 					if (!isset($image_array[0]['registration'])) {
10365 10365
 						$Image->addSpotterImage($row['registration']);
10366 10366
 					}
10367 10367
 				}
10368 10368
 				if (count($aircraft_name) > 0) {
10369
-					$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";
10369
+					$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";
10370 10370
 					$sthu = $this->db->prepare($update_query);
10371 10371
 					$sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id']));
10372 10372
 				}
@@ -10381,10 +10381,10 @@  discard block
 block discarded – undo
10381 10381
 		$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";
10382 10382
 		$sth = $this->db->prepare($query);
10383 10383
 		$sth->execute();
10384
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10384
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10385 10385
 		{
10386 10386
 			if ($row['last_latitude'] != '' && $row['last_longitude'] != '') {
10387
-				$closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist);
10387
+				$closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist);
10388 10388
 				$airport_icao = '';
10389 10389
 				 if (isset($closestAirports[0])) {
10390 10390
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
@@ -10398,7 +10398,7 @@  discard block
 block discarded – undo
10398 10398
 								break;
10399 10399
 							}
10400 10400
 						}
10401
-					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
10401
+					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) {
10402 10402
 						$airport_icao = $closestAirports[0]['icao'];
10403 10403
 						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";
10404 10404
 					} else {
@@ -10409,28 +10409,28 @@  discard block
 block discarded – undo
10409 10409
 				}
10410 10410
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
10411 10411
 					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
10412
-					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10412
+					$update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10413 10413
 					$sthu = $this->db->prepare($update_query);
10414
-					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
10414
+					$sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id']));
10415 10415
 				}
10416 10416
 			}
10417 10417
 		}
10418 10418
 	}
10419 10419
 	
10420
-	public function closestAirports($origLat,$origLon,$dist = 10) {
10420
+	public function closestAirports($origLat, $origLon, $dist = 10) {
10421 10421
 		global $globalDBdriver;
10422
-		$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
10422
+		$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
10423 10423
 /*
10424 10424
 		$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 
10425 10425
                       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)) 
10426 10426
                       having distance < $dist ORDER BY distance limit 100;";
10427 10427
 */
10428 10428
 		if ($globalDBdriver == 'mysql') {
10429
-			$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 
10429
+			$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 
10430 10430
 	                      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)) 
10431 10431
 	                      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;";
10432 10432
                 } else {
10433
-			$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 
10433
+			$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 
10434 10434
 	                      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)) 
10435 10435
 	                      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;";
10436 10436
     		}
Please login to merge, or discard this patch.
require/class.Accident.php 2 patches
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -29,20 +29,20 @@  discard block
 block discarded – undo
29 29
 	* @param String $date get data for a date
30 30
 	* @return Array Return Accidents data in array
31 31
 	*/
32
-	public function getAccidentData($limit = '',$type = '',$date = '') {
32
+	public function getAccidentData($limit = '', $type = '', $date = '') {
33 33
 		global $globalURL, $globalDBdriver;
34 34
 		$Image = new Image($this->db);
35 35
 		$Spotter = new Spotter($this->db);
36 36
 		$Translation = new Translation($this->db);
37
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
37
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
38 38
 		date_default_timezone_set('UTC');
39 39
 		$result = array();
40 40
 		$limit_query = '';
41 41
 		if ($limit != "")
42 42
 		{
43 43
 			$limit_array = explode(",", $limit);
44
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
45
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
44
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
45
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
46 46
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
47 47
 			{
48 48
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
 		if ($type != '') {
53 53
 			if ($date != '') {
54
-				if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/",$date)) {
54
+				if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/", $date)) {
55 55
 					$query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND date = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
56 56
 					//$query = "SELECT accidents.registration, accidents.ident, accidents.date, accidents.url, accidents.country, accidents.place, accidents.title, accidents.fatalities, accidents.type, accidents.ident, accidents.aircraft_manufacturer, accidents.aircraft_name, accidents.airline_name, accidents.airline_icao, spotter_output.flightaware_id FROM accidents LEFT OUTER JOIN spotter_output ON accidents.registration = spotter_output.registration WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND date = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
57 57
 				} else {
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 					$query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND to_char(date,'YYYY-MM-DD') LIKE :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
60 60
 					//$query = "SELECT accidents.registration, accidents.ident, accidents.date, accidents.url, accidents.country, accidents.place, accidents.title, accidents.fatalities, accidents.type, accidents.ident, accidents.aircraft_manufacturer, accidents.aircraft_name, accidents.airline_name, accidents.airline_icao, spotter_output.flightaware_id FROM accidents LEFT OUTER JOIN spotter_output ON accidents.registration = spotter_output.registration WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND to_char(date,'YYYY-MM-DD') LIKE :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
61 61
 				}
62
-				$query_values = array(':type' => $type,':date' => $date);
62
+				$query_values = array(':type' => $type, ':date' => $date);
63 63
 			} else {
64 64
 				$query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
65 65
 				//$query = "SELECT accidents.registration, accidents.ident, accidents.date, accidents.url, accidents.country, accidents.place, accidents.title, accidents.fatalities, accidents.type, accidents.ident, accidents.aircraft_manufacturer, accidents.aircraft_name, accidents.airline_name, accidents.airline_icao, spotter_output.flightaware_id FROM accidents LEFT OUTER JOIN spotter_output ON accidents.registration = spotter_output.registration WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 			}
68 68
 		} else {
69 69
 			if ($date != '') {
70
-				if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/",$date)) {
70
+				if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/", $date)) {
71 71
 					$query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE date = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
72 72
 					//$query = "SELECT accidents.registration, accidents.ident, accidents.date, accidents.url, accidents.country, accidents.place, accidents.title, accidents.fatalities, accidents.type, accidents.ident, accidents.aircraft_manufacturer, accidents.aircraft_name, accidents.airline_name, accidents.airline_icao, spotter_output.flightaware_id FROM accidents LEFT OUTER JOIN spotter_output ON accidents.registration = spotter_output.registration WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE date = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
73 73
 				} else {
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 		try {
87 87
 			$sth = $this->db->prepare($query);
88 88
 			$sth->execute($query_values);
89
-		} catch(PDOException $e) {
89
+		} catch (PDOException $e) {
90 90
 			echo "error : ".$e->getMessage();
91 91
 		}
92 92
 		$i = 0;
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
 			$data = array();
97 97
 			if ($row['registration'] != '') {
98 98
 				$image_array = $Image->getSpotterImage($row['registration']);
99
-				if (count($image_array) > 0) $data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website']));
100
-				else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
99
+				if (count($image_array) > 0) $data = array_merge($data, array('image' => $image_array[0]['image'], 'image_thumbnail' => $image_array[0]['image_thumbnail'], 'image_copyright' => $image_array[0]['image_copyright'], 'image_source' => $image_array[0]['image_source'], 'image_source_website' => $image_array[0]['image_source_website']));
100
+				else $data = array_merge($data, array('image' => '', 'image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => ''));
101 101
 				$aircraft_type = $Spotter->getAllAircraftTypeByRegistration($row['registration']);
102 102
 				$aircraft_info = $Spotter->getAllAircraftInfo($aircraft_type);
103 103
 				if (!empty($aircraft_info)) {
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 					$data['aircraft_name'] = $aircraft_info[0]['type'];
106 106
 					$data['aircraft_manufacturer'] = $aircraft_info[0]['manufacturer'];
107 107
 				} else {
108
-					$data = array_merge($data,array('aircraft_type' => 'NA'));
108
+					$data = array_merge($data, array('aircraft_type' => 'NA'));
109 109
 				}
110 110
 				$owner_data = $Spotter->getAircraftOwnerByRegistration($row['registration']);
111 111
 				if (!empty($owner_data)) {
@@ -113,18 +113,18 @@  discard block
 block discarded – undo
113 113
 					$data['aircraft_base'] = $owner_data['base'];
114 114
 					$data['aircraft_date_first_reg'] = $owner_data['date_first_reg'];
115 115
 				}
116
-			} else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
116
+			} else $data = array_merge($data, array('image' => '', 'image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => ''));
117 117
 			if ($row['registration'] == '') $row['registration'] = 'NA';
118 118
 			if ($row['ident'] == '') $row['ident'] = 'NA';
119
-			$identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,3));
119
+			$identicao = $Spotter->getAllAirlineInfo(substr($row['ident'], 0, 3));
120 120
 			if (isset($identicao[0])) {
121
-				if (substr($row['ident'],0,2) == 'AF') {
122
-					if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident'];
123
-					else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0');
124
-				} else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0');
125
-				$data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name']));
121
+				if (substr($row['ident'], 0, 2) == 'AF') {
122
+					if (filter_var(substr($row['ident'], 2), FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident'];
123
+					else $icao = 'AFR'.ltrim(substr($row['ident'], 2), '0');
124
+				} else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'], 2), '0');
125
+				$data = array_merge($data, array('airline_icao' => $identicao[0]['icao'], 'airline_name' => $identicao[0]['name']));
126 126
 			} else $icao = $row['ident'];
127
-			$icao = $Translation->checkTranslation($icao,false);
127
+			$icao = $Translation->checkTranslation($icao, false);
128 128
 			//$data = array_merge($data,array('registration' => $row['registration'], 'date' => $row['date'], 'ident' => $icao,'url' => $row['url']));
129 129
 			if ($row['airline_name'] != '' && !isset($data['airline_name'])) {
130 130
 				//echo 'Check airline info... for '.$row['airline_name'].' ';
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
 				if (!empty($airline_info)) {
134 134
 					//echo 'data found !'."\n";
135 135
 					//print_r($airline_info);
136
-					$data = array_merge($data,$airline_info);
136
+					$data = array_merge($data, $airline_info);
137 137
 				} 
138 138
 				//else echo 'No data...'."\n";
139 139
 			}
140
-			$data = array_merge($row,$data);
140
+			$data = array_merge($row, $data);
141 141
 			if ($data['ident'] == null) $data['ident'] = $icao;
142 142
 			if ($data['title'] == null) {
143 143
 				$data['message'] = $row['type'].' of '.$row['registration'].' at '.$row['place'].','.$row['country'];
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 		try {
172 172
 			$sth = $this->db->prepare($query);
173 173
 			$sth->execute();
174
-		} catch(PDOException $e) {
174
+		} catch (PDOException $e) {
175 175
 			echo "Error : ".$e->getMessage();
176 176
 		}
177 177
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 		try {
187 187
 			$sth = $this->db->prepare($query);
188 188
 			$sth->execute();
189
-		} catch(PDOException $e) {
189
+		} catch (PDOException $e) {
190 190
 			echo "Error : ".$e->getMessage();
191 191
 		}
192 192
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -201,15 +201,15 @@  discard block
 block discarded – undo
201 201
 		if ($globalDebug) echo 'Import '.$file."\n";
202 202
 		$result = array();
203 203
 		if (file_exists($file)) {
204
-			if (($handle = fopen($file,'r')) !== FALSE) {
205
-				while (($data = fgetcsv($handle,2000,",")) !== FALSE) {
204
+			if (($handle = fopen($file, 'r')) !== FALSE) {
205
+				while (($data = fgetcsv($handle, 2000, ",")) !== FALSE) {
206 206
 					if (isset($data[1]) && $data[1] != '0000-00-00 00:00:00') {
207
-						$result[] = array('registration' => $data[0],'date' => strtotime($data[1]),'url' => $data[2],'country' => $data[3],'place' => $data[4],'title' => $data[5],'fatalities' => $data[6],'latitude' => $data[7],'longitude' => $data[8],'type' => $data[9],'ident' => $data[10],'aircraft_manufacturer' => $data[11],'aircraft_name' => $data[12],'operator' => $data[13],'source' => 'website_fam');
207
+						$result[] = array('registration' => $data[0], 'date' => strtotime($data[1]), 'url' => $data[2], 'country' => $data[3], 'place' => $data[4], 'title' => $data[5], 'fatalities' => $data[6], 'latitude' => $data[7], 'longitude' => $data[8], 'type' => $data[9], 'ident' => $data[10], 'aircraft_manufacturer' => $data[11], 'aircraft_name' => $data[12], 'operator' => $data[13], 'source' => 'website_fam');
208 208
 					}
209 209
 				}
210 210
 				fclose($handle);
211 211
 			}
212
-			if (!empty($result)) $this->add($result,true);
212
+			if (!empty($result)) $this->add($result, true);
213 213
 			elseif ($globalDebug) echo 'Nothing to import';
214 214
 		}
215 215
 	}
@@ -225,8 +225,8 @@  discard block
 block discarded – undo
225 225
 		$all_md5_new = array();
226 226
 		if (file_exists(dirname(__FILE__).'/../install/tmp/cr-all.md5')) {
227 227
 			if ($this->check_accidents_nb() > 0) {
228
-				if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5','r')) !== FALSE) {
229
-					while (($data = fgetcsv($handle,2000,"\t")) !== FALSE) {
228
+				if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5', 'r')) !== FALSE) {
229
+					while (($data = fgetcsv($handle, 2000, "\t")) !== FALSE) {
230 230
 						if (isset($data[1])) {
231 231
 							$year = $data[0];
232 232
 							$all_md5[$year] = $data[1];
@@ -236,10 +236,10 @@  discard block
 block discarded – undo
236 236
 				}
237 237
 			}
238 238
 		}
239
-		$Common->download('http://data.flightairmap.fr/data/cr/cr-all.md5',dirname(__FILE__).'/../install/tmp/cr-all.md5');
239
+		$Common->download('http://data.flightairmap.fr/data/cr/cr-all.md5', dirname(__FILE__).'/../install/tmp/cr-all.md5');
240 240
 		if (file_exists(dirname(__FILE__).'/../install/tmp/cr-all.md5')) {
241
-			if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5','r')) !== FALSE) {
242
-				while (($data = fgetcsv($handle,2000,"\t")) !== FALSE) {
241
+			if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5', 'r')) !== FALSE) {
242
+				while (($data = fgetcsv($handle, 2000, "\t")) !== FALSE) {
243 243
 					if (isset($data[1])) {
244 244
 						$year = $data[0];
245 245
 						$all_md5_new[$year] = $data[1];
@@ -248,10 +248,10 @@  discard block
 block discarded – undo
248 248
 				fclose($handle);
249 249
 			} elseif ($globalDebug) echo "Can't open ".dirname(__FILE__).'/../install/tmp/cr-all.md5';
250 250
 		} elseif ($globalDebug) echo 'Download cr-all.md5 failed. '.dirname(__FILE__).'/../install/tmp/cr-all.md5 not here.';
251
-		$result = $Common->arr_diff($all_md5_new,$all_md5);
251
+		$result = $Common->arr_diff($all_md5_new, $all_md5);
252 252
 		if (empty($result) && $globalDebug) echo 'Nothing to update';
253 253
 		foreach ($result as $file => $md5) {
254
-			$Common->download('http://data.flightairmap.fr/data/cr/'.$file,dirname(__FILE__).'/../install/tmp/'.$file);
254
+			$Common->download('http://data.flightairmap.fr/data/cr/'.$file, dirname(__FILE__).'/../install/tmp/'.$file);
255 255
 			if (file_exists(dirname(__FILE__).'/../install/tmp/'.$file)) $this->import(dirname(__FILE__).'/../install/tmp/'.$file);
256 256
 			elseif ($globalDebug) echo 'Download '.$file.' failed';
257 257
 		}
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 	* Add data to DB
262 262
 	* @param Array $crash An array with accidents/incidents data
263 263
 	*/
264
-	public function add($crash,$new = false) {
264
+	public function add($crash, $new = false) {
265 265
 		global $globalTransaction, $globalDebug;
266 266
 		require_once('class.Connection.php');
267 267
 		require_once('class.Image.php');
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 			$sthd->execute(array(':source' => $crash[0]['source']));
278 278
 		}
279 279
 		if ($globalTransaction) $Connection->db->beginTransaction();
280
-		$initial_array = array('ident' => null,'type' => 'accident','url' => null,'registration' => null, 'date' => null, 'place' => null,'country' => null, 'latitude' => null, 'longitude' => null, 'fatalities' => null, 'title' => '','source' => '','aircraft_manufacturer' => null,'aircraft_name' => null,'operator' => null);
280
+		$initial_array = array('ident' => null, 'type' => 'accident', 'url' => null, 'registration' => null, 'date' => null, 'place' => null, 'country' => null, 'latitude' => null, 'longitude' => null, 'fatalities' => null, 'title' => '', 'source' => '', 'aircraft_manufacturer' => null, 'aircraft_name' => null, 'operator' => null);
281 281
 		$query_check = 'SELECT COUNT(*) as nb FROM accidents WHERE registration = :registration AND date = :date AND type = :type AND source = :source';
282 282
 		$sth_check = $Connection->db->prepare($query_check);
283 283
 		$query = 'INSERT INTO accidents (aircraft_manufacturer,aircraft_name,ident,registration,date,url,country,place,title,fatalities,latitude,longitude,type,airline_name,source) VALUES (:aircraft_manufacturer,:aircraft_name,:ident,:registration,:date,:url,:country,:place,:title,:fatalities,:latitude,:longitude,:type,:airline_name,:source)';
@@ -290,31 +290,31 @@  discard block
 block discarded – undo
290 290
 				$cr = array_map(function($value) {
291 291
 					return $value === "" ? NULL : $value;
292 292
 				}, $cr);
293
-				if ($cr['date'] != '' && $cr['registration'] != null && $cr['registration'] != '' && $cr['registration'] != '?' && $cr['registration'] != '-' && strtolower($cr['registration']) != 'unknown' && $cr['date'] < time() && !preg_match('/\s/',$cr['registration'])) {
294
-					if (strpos($cr['registration'],'-') === FALSE) $cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']);
295
-					$query_check_values = array(':registration' => $cr['registration'],':date' => date('Y-m-d',$cr['date']),':type' => $cr['type'],':source' => $cr['source']);
293
+				if ($cr['date'] != '' && $cr['registration'] != null && $cr['registration'] != '' && $cr['registration'] != '?' && $cr['registration'] != '-' && strtolower($cr['registration']) != 'unknown' && $cr['date'] < time() && !preg_match('/\s/', $cr['registration'])) {
294
+					if (strpos($cr['registration'], '-') === FALSE) $cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']);
295
+					$query_check_values = array(':registration' => $cr['registration'], ':date' => date('Y-m-d', $cr['date']), ':type' => $cr['type'], ':source' => $cr['source']);
296 296
 					$sth_check->execute($query_check_values);
297 297
 					$result_check = $sth_check->fetch(PDO::FETCH_ASSOC);
298 298
 					if ($result_check['nb'] == 0) {
299
-						$query_values = array(':registration' => trim($cr['registration']),':date' => date('Y-m-d',$cr['date']),':url' => $cr['url'],':country' => $cr['country'],':place' => $cr['place'],':title' => $cr['title'],':fatalities' => $cr['fatalities'],':latitude' => $cr['latitude'],':longitude' => $cr['longitude'],':type' => $cr['type'],':source' => $cr['source'],':ident' => $cr['ident'],':aircraft_manufacturer' => $cr['aircraft_manufacturer'],':aircraft_name' => $cr['aircraft_name'],':airline_name' => $cr['operator']);
299
+						$query_values = array(':registration' => trim($cr['registration']), ':date' => date('Y-m-d', $cr['date']), ':url' => $cr['url'], ':country' => $cr['country'], ':place' => $cr['place'], ':title' => $cr['title'], ':fatalities' => $cr['fatalities'], ':latitude' => $cr['latitude'], ':longitude' => $cr['longitude'], ':type' => $cr['type'], ':source' => $cr['source'], ':ident' => $cr['ident'], ':aircraft_manufacturer' => $cr['aircraft_manufacturer'], ':aircraft_name' => $cr['aircraft_name'], ':airline_name' => $cr['operator']);
300 300
 						$sth->execute($query_values);
301
-						if ($cr['date'] > time()-(30*86400)) {
301
+						if ($cr['date'] > time() - (30*86400)) {
302 302
 							if (empty($Image->getSpotterImage($cr['registration']))) {
303 303
 								//if ($globalDebug) echo 'Get image...'."\n";
304 304
 								$Image->addSpotterImage($cr['registration']);
305 305
 							}
306 306
 							// elseif ($globalDebug) echo 'Image already in DB'."\n";
307 307
 						}
308
-						$Spotter->setHighlightFlightByRegistration($cr['registration'],$cr['title'],date('Y-m-d',$cr['date']));
308
+						$Spotter->setHighlightFlightByRegistration($cr['registration'], $cr['title'], date('Y-m-d', $cr['date']));
309 309
 					}
310 310
 				}
311
-				if ($globalTransaction && $j % 1000 == 0) {
311
+				if ($globalTransaction && $j%1000 == 0) {
312 312
 					$Connection->db->commit();
313 313
 					$Connection->db->beginTransaction();
314 314
 				}
315 315
 			}
316 316
 			if ($globalTransaction) $Connection->db->commit();
317
-		} catch(PDOException $e) {
317
+		} catch (PDOException $e) {
318 318
 			if ($globalTransaction) $Connection->db->rollBack();
319 319
 			echo $e->getMessage();
320 320
 		}
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 			$Connection = new Connection();
333 333
 			$sth = $Connection->db->prepare($query);
334 334
 			$sth->execute();
335
-		} catch(PDOException $e) {
335
+		} catch (PDOException $e) {
336 336
 			return "error : ".$e->getMessage();
337 337
 		}
338 338
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 			$Connection = new Connection();
351 351
 			$sth = $Connection->db->prepare($query);
352 352
 			$sth->execute();
353
-		} catch(PDOException $e) {
353
+		} catch (PDOException $e) {
354 354
 			return "error : ".$e->getMessage();
355 355
 		}
356 356
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 			$Connection = new Connection();
366 366
 			$sth = $Connection->db->prepare($query);
367 367
 			$sth->execute();
368
-		} catch(PDOException $e) {
368
+		} catch (PDOException $e) {
369 369
 			return "error : ".$e->getMessage();
370 370
 		}
371 371
 	}
Please login to merge, or discard this patch.
Braces   +75 added lines, -27 removed lines patch added patch discarded remove patch
@@ -96,8 +96,11 @@  discard block
 block discarded – undo
96 96
 			$data = array();
97 97
 			if ($row['registration'] != '') {
98 98
 				$image_array = $Image->getSpotterImage($row['registration']);
99
-				if (count($image_array) > 0) $data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website']));
100
-				else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
99
+				if (count($image_array) > 0) {
100
+					$data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website']));
101
+				} else {
102
+					$data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
103
+				}
101 104
 				$aircraft_type = $Spotter->getAllAircraftTypeByRegistration($row['registration']);
102 105
 				$aircraft_info = $Spotter->getAllAircraftInfo($aircraft_type);
103 106
 				if (!empty($aircraft_info)) {
@@ -113,17 +116,30 @@  discard block
 block discarded – undo
113 116
 					$data['aircraft_base'] = $owner_data['base'];
114 117
 					$data['aircraft_date_first_reg'] = $owner_data['date_first_reg'];
115 118
 				}
116
-			} else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
117
-			if ($row['registration'] == '') $row['registration'] = 'NA';
118
-			if ($row['ident'] == '') $row['ident'] = 'NA';
119
+			} else {
120
+				$data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
121
+			}
122
+			if ($row['registration'] == '') {
123
+				$row['registration'] = 'NA';
124
+			}
125
+			if ($row['ident'] == '') {
126
+				$row['ident'] = 'NA';
127
+			}
119 128
 			$identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,3));
120 129
 			if (isset($identicao[0])) {
121 130
 				if (substr($row['ident'],0,2) == 'AF') {
122
-					if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident'];
123
-					else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0');
124
-				} else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0');
131
+					if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) {
132
+						$icao = $row['ident'];
133
+					} else {
134
+						$icao = 'AFR'.ltrim(substr($row['ident'],2),'0');
135
+					}
136
+				} else {
137
+					$icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0');
138
+				}
125 139
 				$data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name']));
126
-			} else $icao = $row['ident'];
140
+			} else {
141
+				$icao = $row['ident'];
142
+			}
127 143
 			$icao = $Translation->checkTranslation($icao,false);
128 144
 			//$data = array_merge($data,array('registration' => $row['registration'], 'date' => $row['date'], 'ident' => $icao,'url' => $row['url']));
129 145
 			if ($row['airline_name'] != '' && !isset($data['airline_name'])) {
@@ -138,10 +154,14 @@  discard block
 block discarded – undo
138 154
 				//else echo 'No data...'."\n";
139 155
 			}
140 156
 			$data = array_merge($row,$data);
141
-			if ($data['ident'] == null) $data['ident'] = $icao;
157
+			if ($data['ident'] == null) {
158
+				$data['ident'] = $icao;
159
+			}
142 160
 			if ($data['title'] == null) {
143 161
 				$data['message'] = $row['type'].' of '.$row['registration'].' at '.$row['place'].','.$row['country'];
144
-			} else $data['message'] = strtolower($data['title']);
162
+			} else {
163
+				$data['message'] = strtolower($data['title']);
164
+			}
145 165
 			$ids = $Spotter->getAllIDByRegistration($data['registration']);
146 166
 			$date = $data['date'];
147 167
 			if (isset($ids[$date])) {
@@ -158,8 +178,9 @@  discard block
 block discarded – undo
158 178
 		if (isset($result)) {
159 179
 			$result[0]['query_number_rows'] = $i;
160 180
 			return $result;
181
+		} else {
182
+			return array();
161 183
 		}
162
-		else return array();
163 184
 	}
164 185
 	
165 186
 	/*
@@ -198,7 +219,9 @@  discard block
 block discarded – undo
198 219
 	*/
199 220
 	public function import($file) {
200 221
 		global $globalTransaction, $globalDebug;
201
-		if ($globalDebug) echo 'Import '.$file."\n";
222
+		if ($globalDebug) {
223
+			echo 'Import '.$file."\n";
224
+		}
202 225
 		$result = array();
203 226
 		if (file_exists($file)) {
204 227
 			if (($handle = fopen($file,'r')) !== FALSE) {
@@ -209,8 +232,11 @@  discard block
 block discarded – undo
209 232
 				}
210 233
 				fclose($handle);
211 234
 			}
212
-			if (!empty($result)) $this->add($result,true);
213
-			elseif ($globalDebug) echo 'Nothing to import';
235
+			if (!empty($result)) {
236
+				$this->add($result,true);
237
+			} elseif ($globalDebug) {
238
+				echo 'Nothing to import';
239
+			}
214 240
 		}
215 241
 	}
216 242
 
@@ -246,14 +272,23 @@  discard block
 block discarded – undo
246 272
 					}
247 273
 				}
248 274
 				fclose($handle);
249
-			} elseif ($globalDebug) echo "Can't open ".dirname(__FILE__).'/../install/tmp/cr-all.md5';
250
-		} elseif ($globalDebug) echo 'Download cr-all.md5 failed. '.dirname(__FILE__).'/../install/tmp/cr-all.md5 not here.';
275
+			} elseif ($globalDebug) {
276
+				echo "Can't open ".dirname(__FILE__).'/../install/tmp/cr-all.md5';
277
+			}
278
+		} elseif ($globalDebug) {
279
+			echo 'Download cr-all.md5 failed. '.dirname(__FILE__).'/../install/tmp/cr-all.md5 not here.';
280
+		}
251 281
 		$result = $Common->arr_diff($all_md5_new,$all_md5);
252
-		if (empty($result) && $globalDebug) echo 'Nothing to update';
282
+		if (empty($result) && $globalDebug) {
283
+			echo 'Nothing to update';
284
+		}
253 285
 		foreach ($result as $file => $md5) {
254 286
 			$Common->download('http://data.flightairmap.fr/data/cr/'.$file,dirname(__FILE__).'/../install/tmp/'.$file);
255
-			if (file_exists(dirname(__FILE__).'/../install/tmp/'.$file)) $this->import(dirname(__FILE__).'/../install/tmp/'.$file);
256
-			elseif ($globalDebug) echo 'Download '.$file.' failed';
287
+			if (file_exists(dirname(__FILE__).'/../install/tmp/'.$file)) {
288
+				$this->import(dirname(__FILE__).'/../install/tmp/'.$file);
289
+			} elseif ($globalDebug) {
290
+				echo 'Download '.$file.' failed';
291
+			}
257 292
 		}
258 293
 	}
259 294
 
@@ -270,13 +305,17 @@  discard block
 block discarded – undo
270 305
 		$Image = new Image();
271 306
 		$Spotter = new Spotter();
272 307
 
273
-		if (empty($crash)) return false;
308
+		if (empty($crash)) {
309
+			return false;
310
+		}
274 311
 		if (!$new) {
275 312
 			$query_delete = 'DELETE FROM accidents WHERE source = :source';
276 313
 			$sthd = $Connection->db->prepare($query_delete);
277 314
 			$sthd->execute(array(':source' => $crash[0]['source']));
278 315
 		}
279
-		if ($globalTransaction) $Connection->db->beginTransaction();
316
+		if ($globalTransaction) {
317
+			$Connection->db->beginTransaction();
318
+		}
280 319
 		$initial_array = array('ident' => null,'type' => 'accident','url' => null,'registration' => null, 'date' => null, 'place' => null,'country' => null, 'latitude' => null, 'longitude' => null, 'fatalities' => null, 'title' => '','source' => '','aircraft_manufacturer' => null,'aircraft_name' => null,'operator' => null);
281 320
 		$query_check = 'SELECT COUNT(*) as nb FROM accidents WHERE registration = :registration AND date = :date AND type = :type AND source = :source';
282 321
 		$sth_check = $Connection->db->prepare($query_check);
@@ -291,7 +330,9 @@  discard block
 block discarded – undo
291 330
 					return $value === "" ? NULL : $value;
292 331
 				}, $cr);
293 332
 				if ($cr['date'] != '' && $cr['registration'] != null && $cr['registration'] != '' && $cr['registration'] != '?' && $cr['registration'] != '-' && strtolower($cr['registration']) != 'unknown' && $cr['date'] < time() && !preg_match('/\s/',$cr['registration'])) {
294
-					if (strpos($cr['registration'],'-') === FALSE) $cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']);
333
+					if (strpos($cr['registration'],'-') === FALSE) {
334
+						$cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']);
335
+					}
295 336
 					$query_check_values = array(':registration' => $cr['registration'],':date' => date('Y-m-d',$cr['date']),':type' => $cr['type'],':source' => $cr['source']);
296 337
 					$sth_check->execute($query_check_values);
297 338
 					$result_check = $sth_check->fetch(PDO::FETCH_ASSOC);
@@ -313,9 +354,13 @@  discard block
 block discarded – undo
313 354
 					$Connection->db->beginTransaction();
314 355
 				}
315 356
 			}
316
-			if ($globalTransaction) $Connection->db->commit();
357
+			if ($globalTransaction) {
358
+				$Connection->db->commit();
359
+			}
317 360
 		} catch(PDOException $e) {
318
-			if ($globalTransaction) $Connection->db->rollBack();
361
+			if ($globalTransaction) {
362
+				$Connection->db->rollBack();
363
+			}
319 364
 			echo $e->getMessage();
320 365
 		}
321 366
 		$sth_check->closeCursor();
@@ -354,8 +399,11 @@  discard block
 block discarded – undo
354 399
 			return "error : ".$e->getMessage();
355 400
 		}
356 401
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
357
-		if ($row['nb'] > 0) return false;
358
-		else return true;
402
+		if ($row['nb'] > 0) {
403
+			return false;
404
+		} else {
405
+			return true;
406
+		}
359 407
 	}
360 408
 
361 409
 	public static function insert_last_accidents_update() {
Please login to merge, or discard this patch.
require/class.Stats.php 1 patch
Spacing   +312 added lines, -312 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
17 17
 		$this->db = $Connection->db();
18 18
         }
19 19
               
20
-	public function addLastStatsUpdate($type,$stats_date) {
20
+	public function addLastStatsUpdate($type, $stats_date) {
21 21
                 $query = "DELETE FROM config WHERE name = :type;
22 22
             		INSERT INTO config (name,value) VALUES (:type,:stats_date);";
23
-                $query_values = array('type' => $type,':stats_date' => $stats_date);
23
+                $query_values = array('type' => $type, ':stats_date' => $stats_date);
24 24
                  try {
25 25
                         $sth = $this->db->prepare($query);
26 26
                         $sth->execute($query_values);
27
-                } catch(PDOException $e) {
27
+                } catch (PDOException $e) {
28 28
                         return "error : ".$e->getMessage();
29 29
                 }
30 30
         }
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
                  try {
35 35
                         $sth = $this->db->prepare($query);
36 36
                         $sth->execute(array(':type' => $type));
37
-                } catch(PDOException $e) {
37
+                } catch (PDOException $e) {
38 38
                         echo "error : ".$e->getMessage();
39 39
                 }
40 40
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
                  try {
55 55
                         $sth = $this->db->prepare($query);
56 56
                         $sth->execute(array(':filter_name' => $filter_name));
57
-                } catch(PDOException $e) {
57
+                } catch (PDOException $e) {
58 58
                         return "error : ".$e->getMessage();
59 59
                 }
60 60
         }
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
                  try {
65 65
                         $sth = $this->db->prepare($query);
66 66
                         $sth->execute();
67
-                } catch(PDOException $e) {
67
+                } catch (PDOException $e) {
68 68
                         return "error : ".$e->getMessage();
69 69
                 }
70 70
                 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
                  try {
73 73
                         $sth = $this->db->prepare($query);
74 74
                         $sth->execute(array(':filter_name' => $filter_name));
75
-                } catch(PDOException $e) {
75
+                } catch (PDOException $e) {
76 76
                         return "error : ".$e->getMessage();
77 77
                 }
78 78
         }
@@ -82,43 +82,43 @@  discard block
 block discarded – undo
82 82
                  try {
83 83
                         $sth = $this->db->prepare($query);
84 84
                         $sth->execute(array(':filter_name' => $filter_name));
85
-                } catch(PDOException $e) {
85
+                } catch (PDOException $e) {
86 86
                         echo "error : ".$e->getMessage();
87 87
                 }
88 88
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
89 89
                 return $all;
90 90
         }
91
-	public function getAllAircraftTypes($stats_airline = '',$filter_name = '') {
91
+	public function getAllAircraftTypes($stats_airline = '', $filter_name = '') {
92 92
 		if ($filter_name == '') $filter_name = $this->filter_name;
93 93
                 $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
94 94
                  try {
95 95
                         $sth = $this->db->prepare($query);
96
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
97
-                } catch(PDOException $e) {
96
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
97
+                } catch (PDOException $e) {
98 98
                         echo "error : ".$e->getMessage();
99 99
                 }
100 100
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
101 101
                 return $all;
102 102
         }
103
-	public function getAllManufacturers($stats_airline = '',$filter_name = '') {
103
+	public function getAllManufacturers($stats_airline = '', $filter_name = '') {
104 104
 		if ($filter_name == '') $filter_name = $this->filter_name;
105 105
                 $query = "SELECT DISTINCT(aircraft_manufacturer) FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND aircraft_manufacturer <> '' ORDER BY aircraft_manufacturer ASC";
106 106
                  try {
107 107
                         $sth = $this->db->prepare($query);
108
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
109
-                } catch(PDOException $e) {
108
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
109
+                } catch (PDOException $e) {
110 110
                         echo "error : ".$e->getMessage();
111 111
                 }
112 112
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
113 113
                 return $all;
114 114
         }
115
-	public function getAllAirportNames($stats_airline = '',$filter_name = '') {
115
+	public function getAllAirportNames($stats_airline = '', $filter_name = '') {
116 116
 		if ($filter_name == '') $filter_name = $this->filter_name;
117 117
                 $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC";
118 118
                  try {
119 119
                         $sth = $this->db->prepare($query);
120
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
121
-                } catch(PDOException $e) {
120
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
121
+                } catch (PDOException $e) {
122 122
                         echo "error : ".$e->getMessage();
123 123
                 }
124 124
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -133,22 +133,22 @@  discard block
 block discarded – undo
133 133
 		else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC";
134 134
                  try {
135 135
                         $sth = $this->db->prepare($query);
136
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
137
-                } catch(PDOException $e) {
136
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
137
+                } catch (PDOException $e) {
138 138
                         echo "error : ".$e->getMessage();
139 139
                 }
140 140
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
141 141
                 if (empty($all)) {
142 142
             	    $filters = array('airlines' => array($stats_airline));
143 143
             	    if ($filter_name != '') {
144
-            		    $filters = array_merge($filters,$globalStatsFilters[$filter_name]);
144
+            		    $filters = array_merge($filters, $globalStatsFilters[$filter_name]);
145 145
             	    }
146 146
             	    $Spotter = new Spotter($this->db);
147
-            	    $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters);
147
+            	    $all = $Spotter->countAllAircraftTypes($limit, 0, '', $filters);
148 148
                 }
149 149
                 return $all;
150 150
 	}
151
-	public function countAllAirlineCountries($limit = true,$filter_name = '') {
151
+	public function countAllAirlineCountries($limit = true, $filter_name = '') {
152 152
 		global $globalStatsFilters;
153 153
 		if ($filter_name == '') $filter_name = $this->filter_name;
154 154
 		if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0";
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
                  try {
157 157
                         $sth = $this->db->prepare($query);
158 158
                         $sth->execute(array(':filter_name' => $filter_name));
159
-                } catch(PDOException $e) {
159
+                } catch (PDOException $e) {
160 160
                         echo "error : ".$e->getMessage();
161 161
                 }
162 162
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -164,28 +164,28 @@  discard block
 block discarded – undo
164 164
             		$Spotter = new Spotter($this->db);
165 165
             		$filters = array();
166 166
             		if ($filter_name != '') {
167
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
167
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
168 168
 			}
169
-            		$all = $Spotter->countAllAirlineCountries($limit,$filters);
169
+            		$all = $Spotter->countAllAirlineCountries($limit, $filters);
170 170
                 }
171 171
                 return $all;
172 172
 	}
173
-	public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '') {
173
+	public function countAllAircraftManufacturers($limit = true, $stats_airline = '', $filter_name = '') {
174 174
 		global $globalStatsFilters;
175 175
 		if ($filter_name == '') $filter_name = $this->filter_name;
176 176
 		if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0";
177 177
 		else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC";
178 178
                  try {
179 179
                         $sth = $this->db->prepare($query);
180
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
181
-                } catch(PDOException $e) {
180
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
181
+                } catch (PDOException $e) {
182 182
                         echo "error : ".$e->getMessage();
183 183
                 }
184 184
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
185 185
                 if (empty($all)) {
186 186
             		$filters = array('airlines' => array($stats_airline));
187 187
             		if ($filter_name != '') {
188
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
188
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
189 189
 			}
190 190
             		$Spotter = new Spotter($this->db);
191 191
 			$all = $Spotter->countAllAircraftManufacturers($filters);
@@ -200,18 +200,18 @@  discard block
 block discarded – undo
200 200
 		else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC";
201 201
                  try {
202 202
                         $sth = $this->db->prepare($query);
203
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
204
-                } catch(PDOException $e) {
203
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
204
+                } catch (PDOException $e) {
205 205
                         echo "error : ".$e->getMessage();
206 206
                 }
207 207
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
208 208
                 if (empty($all)) {
209 209
 			$filters = array('airlines' => array($stats_airline));
210 210
 			if ($filter_name != '') {
211
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
211
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
212 212
 			}
213 213
 			$Spotter = new Spotter($this->db);
214
-			$all = $Spotter->countAllArrivalCountries($limit,$filters);
214
+			$all = $Spotter->countAllArrivalCountries($limit, $filters);
215 215
                 }
216 216
                 return $all;
217 217
 	}
@@ -222,15 +222,15 @@  discard block
 block discarded – undo
222 222
 		else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC";
223 223
                  try {
224 224
                         $sth = $this->db->prepare($query);
225
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
226
-                } catch(PDOException $e) {
225
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
226
+                } catch (PDOException $e) {
227 227
                         echo "error : ".$e->getMessage();
228 228
                 }
229 229
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
230 230
                 if (empty($all)) {
231 231
 			$filters = array('airlines' => array($stats_airline));
232 232
 			if ($filter_name != '') {
233
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
233
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
234 234
 			}
235 235
 			$Spotter = new Spotter($this->db);
236 236
 			$all = $Spotter->countAllDepartureCountries($filters);
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
                 return $all;
239 239
 	}
240 240
 
241
-	public function countAllAirlines($limit = true,$filter_name = '') {
241
+	public function countAllAirlines($limit = true, $filter_name = '') {
242 242
 		global $globalStatsFilters;
243 243
 		if ($filter_name == '') $filter_name = $this->filter_name;
244 244
 		if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
                  try {
247 247
                         $sth = $this->db->prepare($query);
248 248
                         $sth->execute(array(':filter_name' => $filter_name));
249
-                } catch(PDOException $e) {
249
+                } catch (PDOException $e) {
250 250
                         echo "error : ".$e->getMessage();
251 251
                 }
252 252
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -254,58 +254,58 @@  discard block
 block discarded – undo
254 254
 	                $Spotter = new Spotter($this->db);
255 255
             		$filters = array();
256 256
             		if ($filter_name != '') {
257
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
257
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
258 258
 			}
259 259
 
260
-    		        $all = $Spotter->countAllAirlines($limit,0,'',$filters);
260
+    		        $all = $Spotter->countAllAirlines($limit, 0, '', $filters);
261 261
                 }
262 262
                 return $all;
263 263
 	}
264
-	public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '') {
264
+	public function countAllAircraftRegistrations($limit = true, $stats_airline = '', $filter_name = '') {
265 265
 		global $globalStatsFilters;
266 266
 		if ($filter_name == '') $filter_name = $this->filter_name;
267 267
 		if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0";
268 268
 		else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC";
269 269
                  try {
270 270
                         $sth = $this->db->prepare($query);
271
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
272
-                } catch(PDOException $e) {
271
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
272
+                } catch (PDOException $e) {
273 273
                         echo "error : ".$e->getMessage();
274 274
                 }
275 275
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
276 276
                 if (empty($all)) {
277 277
 			$filters = array('airlines' => array($stats_airline));
278 278
 			if ($filter_name != '') {
279
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
279
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
280 280
 			}
281 281
 	                $Spotter = new Spotter($this->db);
282
-    		        $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters);
282
+    		        $all = $Spotter->countAllAircraftRegistrations($limit, 0, '', $filters);
283 283
                 }
284 284
                 return $all;
285 285
 	}
286
-	public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '') {
286
+	public function countAllCallsigns($limit = true, $stats_airline = '', $filter_name = '') {
287 287
 		global $globalStatsFilters;
288 288
 		if ($filter_name == '') $filter_name = $this->filter_name;
289 289
 		if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0";
290 290
 		else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC";
291 291
 		 try {
292 292
 			$sth = $this->db->prepare($query);
293
-			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
294
-		} catch(PDOException $e) {
293
+			$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
294
+		} catch (PDOException $e) {
295 295
 			echo "error : ".$e->getMessage();
296 296
 		}
297 297
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
298 298
 		if (empty($all)) {
299 299
 			$filters = array('airlines' => array($stats_airline));
300 300
 			if ($filter_name != '') {
301
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
301
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
302 302
 			}
303 303
 			$Spotter = new Spotter($this->db);
304
-			$all = $Spotter->countAllCallsigns($limit,0,'',$filters);
304
+			$all = $Spotter->countAllCallsigns($limit, 0, '', $filters);
305 305
 		}
306 306
 		return $all;
307 307
 	}
308
-	public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '') {
308
+	public function countAllFlightOverCountries($limit = true, $stats_airline = '', $filter_name = '') {
309 309
 		$Connection = new Connection();
310 310
 		if ($filter_name == '') $filter_name = $this->filter_name;
311 311
 		if ($Connection->tableExists('countries')) {
@@ -313,8 +313,8 @@  discard block
 block discarded – undo
313 313
 			else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC";
314 314
 			 try {
315 315
 				$sth = $this->db->prepare($query);
316
-				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
317
-			} catch(PDOException $e) {
316
+				$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
317
+			} catch (PDOException $e) {
318 318
 				echo "error : ".$e->getMessage();
319 319
 			}
320 320
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -329,70 +329,70 @@  discard block
 block discarded – undo
329 329
 			return array();
330 330
 		}
331 331
 	}
332
-	public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '') {
332
+	public function countAllPilots($limit = true, $stats_airline = '', $filter_name = '') {
333 333
 		global $globalStatsFilters;
334 334
 		if ($filter_name == '') $filter_name = $this->filter_name;
335 335
 		if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0";
336 336
 		else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC";
337 337
                  try {
338 338
                         $sth = $this->db->prepare($query);
339
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
340
-                } catch(PDOException $e) {
339
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
340
+                } catch (PDOException $e) {
341 341
                         echo "error : ".$e->getMessage();
342 342
                 }
343 343
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
344 344
                 if (empty($all)) {
345 345
 			$filters = array('airlines' => array($stats_airline));
346 346
 			if ($filter_name != '') {
347
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
347
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
348 348
 			}
349 349
             		$Spotter = new Spotter($this->db);
350
-            		$all = $Spotter->countAllPilots($limit,0,'',$filters);
350
+            		$all = $Spotter->countAllPilots($limit, 0, '', $filters);
351 351
                 }
352 352
                 return $all;
353 353
 	}
354
-	public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '') {
354
+	public function countAllOwners($limit = true, $stats_airline = '', $filter_name = '') {
355 355
 		global $globalStatsFilters;
356 356
 		if ($filter_name == '') $filter_name = $this->filter_name;
357 357
 		if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0";
358 358
 		else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC";
359 359
                  try {
360 360
                         $sth = $this->db->prepare($query);
361
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
362
-                } catch(PDOException $e) {
361
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
362
+                } catch (PDOException $e) {
363 363
                         echo "error : ".$e->getMessage();
364 364
                 }
365 365
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
366 366
                 if (empty($all)) {
367 367
 			$filters = array('airlines' => array($stats_airline));
368 368
 			if ($filter_name != '') {
369
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
369
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
370 370
 			}
371 371
             		$Spotter = new Spotter($this->db);
372
-            		$all = $Spotter->countAllOwners($limit,0,'',$filters);
372
+            		$all = $Spotter->countAllOwners($limit, 0, '', $filters);
373 373
                 }
374 374
                 return $all;
375 375
 	}
376
-	public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '') {
376
+	public function countAllDepartureAirports($limit = true, $stats_airline = '', $filter_name = '') {
377 377
 		global $globalStatsFilters;
378 378
 		if ($filter_name == '') $filter_name = $this->filter_name;
379 379
 		if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
380 380
 		else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
381 381
                  try {
382 382
                         $sth = $this->db->prepare($query);
383
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
384
-                } catch(PDOException $e) {
383
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
384
+                } catch (PDOException $e) {
385 385
                         echo "error : ".$e->getMessage();
386 386
                 }
387 387
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
388 388
                 if (empty($all)) {
389 389
 			$filters = array('airlines' => array($stats_airline));
390 390
             		if ($filter_name != '') {
391
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
391
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
392 392
 			}
393 393
             		$Spotter = new Spotter($this->db);
394
-            		$pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters);
395
-        		$dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters);
394
+            		$pall = $Spotter->countAllDepartureAirports($limit, 0, '', $filters);
395
+        		$dall = $Spotter->countAllDetectedDepartureAirports($limit, 0, '', $filters);
396 396
         		$all = array();
397 397
         		foreach ($pall as $value) {
398 398
         			$icao = $value['airport_departure_icao'];
@@ -409,30 +409,30 @@  discard block
 block discarded – undo
409 409
         		foreach ($all as $key => $row) {
410 410
         			$count[$key] = $row['airport_departure_icao_count'];
411 411
         		}
412
-        		array_multisort($count,SORT_DESC,$all);
412
+        		array_multisort($count, SORT_DESC, $all);
413 413
                 }
414 414
                 return $all;
415 415
 	}
416
-	public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '') {
416
+	public function countAllArrivalAirports($limit = true, $stats_airline = '', $filter_name = '') {
417 417
 		global $globalStatsFilters;
418 418
 		if ($filter_name == '') $filter_name = $this->filter_name;
419 419
 		if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0";
420 420
 		else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
421 421
 		try {
422 422
 			$sth = $this->db->prepare($query);
423
-			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
424
-		} catch(PDOException $e) {
423
+			$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
424
+		} catch (PDOException $e) {
425 425
 			echo "error : ".$e->getMessage();
426 426
 		}
427 427
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
428 428
 		if (empty($all)) {
429 429
 			$filters = array('airlines' => array($stats_airline));
430 430
 			if ($filter_name != '') {
431
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
431
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
432 432
 			}
433 433
 			$Spotter = new Spotter($this->db);
434
-			$pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters);
435
-			$dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters);
434
+			$pall = $Spotter->countAllArrivalAirports($limit, 0, '', false, $filters);
435
+			$dall = $Spotter->countAllDetectedArrivalAirports($limit, 0, '', false, $filters);
436 436
         		$all = array();
437 437
         		foreach ($pall as $value) {
438 438
         			$icao = $value['airport_arrival_icao'];
@@ -449,12 +449,12 @@  discard block
 block discarded – undo
449 449
         		foreach ($all as $key => $row) {
450 450
         			$count[$key] = $row['airport_arrival_icao_count'];
451 451
         		}
452
-        		array_multisort($count,SORT_DESC,$all);
452
+        		array_multisort($count, SORT_DESC, $all);
453 453
                 }
454 454
  
455 455
                 return $all;
456 456
 	}
457
-	public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') {
457
+	public function countAllMonthsLastYear($limit = true, $stats_airline = '', $filter_name = '') {
458 458
 		global $globalDBdriver, $globalStatsFilters;
459 459
 		if ($filter_name == '') $filter_name = $this->filter_name;
460 460
 		if ($globalDBdriver == 'mysql') {
@@ -464,18 +464,18 @@  discard block
 block discarded – undo
464 464
 			if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
465 465
 			else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
466 466
 		}
467
-		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
467
+		$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
468 468
                  try {
469 469
                         $sth = $this->db->prepare($query);
470 470
                         $sth->execute($query_data);
471
-                } catch(PDOException $e) {
471
+                } catch (PDOException $e) {
472 472
                         echo "error : ".$e->getMessage();
473 473
                 }
474 474
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
475 475
                 if (empty($all)) {
476 476
 			$filters = array('airlines' => array($stats_airline));
477 477
 			if ($filter_name != '') {
478
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
478
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
479 479
 			}
480 480
             		$Spotter = new Spotter($this->db);
481 481
             		$all = $Spotter->countAllMonthsLastYear($filters);
@@ -484,29 +484,29 @@  discard block
 block discarded – undo
484 484
                 return $all;
485 485
 	}
486 486
 	
487
-	public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') {
487
+	public function countAllDatesLastMonth($stats_airline = '', $filter_name = '') {
488 488
 		global $globalStatsFilters;
489 489
 		if ($filter_name == '') $filter_name = $this->filter_name;
490 490
 		$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name";
491
-		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
491
+		$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
492 492
                  try {
493 493
                         $sth = $this->db->prepare($query);
494 494
                         $sth->execute($query_data);
495
-                } catch(PDOException $e) {
495
+                } catch (PDOException $e) {
496 496
                         echo "error : ".$e->getMessage();
497 497
                 }
498 498
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
499 499
                 if (empty($all)) {
500 500
 			$filters = array('airlines' => array($stats_airline));
501 501
 			if ($filter_name != '') {
502
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
502
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
503 503
 			}
504 504
             		$Spotter = new Spotter($this->db);
505 505
             		$all = $Spotter->countAllDatesLastMonth($filters);
506 506
                 }
507 507
                 return $all;
508 508
 	}
509
-	public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') {
509
+	public function countAllDatesLast7Days($stats_airline = '', $filter_name = '') {
510 510
 		global $globalDBdriver, $globalStatsFilters;
511 511
 		if ($filter_name == '') $filter_name = $this->filter_name;
512 512
 		if ($globalDBdriver == 'mysql') {
@@ -514,40 +514,40 @@  discard block
 block discarded – undo
514 514
 		} else {
515 515
 			$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '7 DAYS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
516 516
 		}
517
-		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
517
+		$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
518 518
                  try {
519 519
                         $sth = $this->db->prepare($query);
520 520
                         $sth->execute($query_data);
521
-                } catch(PDOException $e) {
521
+                } catch (PDOException $e) {
522 522
                         echo "error : ".$e->getMessage();
523 523
                 }
524 524
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
525 525
                 if (empty($all)) {
526 526
 			$filters = array('airlines' => array($stats_airline));
527 527
 			if ($filter_name != '') {
528
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
528
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
529 529
 			}
530 530
             		$Spotter = new Spotter($this->db);
531 531
             		$all = $Spotter->countAllDatesLast7Days($filters);
532 532
                 }
533 533
                 return $all;
534 534
 	}
535
-	public function countAllDates($stats_airline = '',$filter_name = '') {
535
+	public function countAllDates($stats_airline = '', $filter_name = '') {
536 536
 		global $globalStatsFilters;
537 537
 		if ($filter_name == '') $filter_name = $this->filter_name;
538 538
 		$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name";
539
-		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
539
+		$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
540 540
                  try {
541 541
                         $sth = $this->db->prepare($query);
542 542
                         $sth->execute($query_data);
543
-                } catch(PDOException $e) {
543
+                } catch (PDOException $e) {
544 544
                         echo "error : ".$e->getMessage();
545 545
                 }
546 546
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
547 547
                 if (empty($all)) {
548 548
 			$filters = array('airlines' => array($stats_airline));
549 549
 			if ($filter_name != '') {
550
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
550
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
551 551
 			}
552 552
             		$Spotter = new Spotter($this->db);
553 553
             		$all = $Spotter->countAllDates($filters);
@@ -562,35 +562,35 @@  discard block
 block discarded – undo
562 562
                  try {
563 563
                         $sth = $this->db->prepare($query);
564 564
                         $sth->execute($query_data);
565
-                } catch(PDOException $e) {
565
+                } catch (PDOException $e) {
566 566
                         echo "error : ".$e->getMessage();
567 567
                 }
568 568
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
569 569
                 if (empty($all)) {
570 570
             		$filters = array();
571 571
             		if ($filter_name != '') {
572
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
572
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
573 573
 			}
574 574
             		$Spotter = new Spotter($this->db);
575 575
             		$all = $Spotter->countAllDatesByAirlines($filters);
576 576
                 }
577 577
                 return $all;
578 578
 	}
579
-	public function countAllMonths($stats_airline = '',$filter_name = '') {
579
+	public function countAllMonths($stats_airline = '', $filter_name = '') {
580 580
 		global $globalStatsFilters;
581 581
 		if ($filter_name == '') $filter_name = $this->filter_name;
582 582
 	    	$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
583 583
                  try {
584 584
                         $sth = $this->db->prepare($query);
585 585
                         $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
586
-                } catch(PDOException $e) {
586
+                } catch (PDOException $e) {
587 587
                         echo "error : ".$e->getMessage();
588 588
                 }
589 589
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
590 590
                 if (empty($all)) {
591 591
 			$filters = array('airlines' => array($stats_airline));
592 592
 			if ($filter_name != '') {
593
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
593
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
594 594
 			}
595 595
             		$Spotter = new Spotter($this->db);
596 596
             		$all = $Spotter->countAllMonths($filters);
@@ -604,21 +604,21 @@  discard block
 block discarded – undo
604 604
                  try {
605 605
                         $sth = $this->db->prepare($query);
606 606
                         $sth->execute(array(':filter_name' => $filter_name));
607
-                } catch(PDOException $e) {
607
+                } catch (PDOException $e) {
608 608
                         echo "error : ".$e->getMessage();
609 609
                 }
610 610
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
611 611
                 if (empty($all)) {
612 612
             		$filters = array();
613 613
             		if ($filter_name != '') {
614
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
614
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
615 615
 			}
616 616
             		$Spotter = new Spotter($this->db);
617 617
             		$all = $Spotter->countAllMilitaryMonths($filters);
618 618
                 }
619 619
                 return $all;
620 620
 	}
621
-	public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') {
621
+	public function countAllHours($orderby = 'hour', $limit = true, $stats_airline = '', $filter_name = '') {
622 622
 		global $globalTimezone, $globalDBdriver, $globalStatsFilters;
623 623
 		if ($filter_name == '') $filter_name = $this->filter_name;
624 624
 		if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
@@ -635,17 +635,17 @@  discard block
 block discarded – undo
635 635
                  try {
636 636
                         $sth = $this->db->prepare($query);
637 637
                         $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
638
-                } catch(PDOException $e) {
638
+                } catch (PDOException $e) {
639 639
                         echo "error : ".$e->getMessage();
640 640
                 }
641 641
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
642 642
                 if (empty($all)) {
643 643
 			$filters = array('airlines' => array($stats_airline));
644 644
 			if ($filter_name != '') {
645
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
645
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
646 646
 			}
647 647
             		$Spotter = new Spotter($this->db);
648
-            		$all = $Spotter->countAllHours($orderby,$filters);
648
+            		$all = $Spotter->countAllHours($orderby, $filters);
649 649
                 }
650 650
                 return $all;
651 651
 	}
@@ -653,11 +653,11 @@  discard block
 block discarded – undo
653 653
 	public function countOverallFlights($stats_airline = '', $filter_name = '') {
654 654
 		global $globalStatsFilters;
655 655
 		if ($filter_name == '') $filter_name = $this->filter_name;
656
-		$all = $this->getSumStats('flights_bymonth',date('Y'),$stats_airline,$filter_name);
656
+		$all = $this->getSumStats('flights_bymonth', date('Y'), $stats_airline, $filter_name);
657 657
 		if (empty($all)) {
658 658
 			$filters = array('airlines' => array($stats_airline));
659 659
 			if ($filter_name != '') {
660
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
660
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
661 661
 			}
662 662
 			$Spotter = new Spotter($this->db);
663 663
 			$all = $Spotter->countOverallFlights($filters);
@@ -667,39 +667,39 @@  discard block
 block discarded – undo
667 667
 	public function countOverallMilitaryFlights($filter_name = '') {
668 668
 		global $globalStatsFilters;
669 669
 		if ($filter_name == '') $filter_name = $this->filter_name;
670
-		$all = $this->getSumStats('military_flights_bymonth',date('Y'),'',$filter_name);
670
+		$all = $this->getSumStats('military_flights_bymonth', date('Y'), '', $filter_name);
671 671
 		if (empty($all)) {
672 672
 		        $filters = array();
673 673
             		if ($filter_name != '') {
674
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
674
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
675 675
 			}
676 676
 			$Spotter = new Spotter($this->db);
677 677
 			$all = $Spotter->countOverallMilitaryFlights($filters);
678 678
 		}
679 679
 		return $all;
680 680
 	}
681
-	public function countOverallArrival($stats_airline = '',$filter_name = '') {
681
+	public function countOverallArrival($stats_airline = '', $filter_name = '') {
682 682
 		global $globalStatsFilters;
683 683
 		if ($filter_name == '') $filter_name = $this->filter_name;
684
-		$all = $this->getSumStats('realarrivals_bymonth',date('Y'),$stats_airline,$filter_name);
684
+		$all = $this->getSumStats('realarrivals_bymonth', date('Y'), $stats_airline, $filter_name);
685 685
 		if (empty($all)) {
686 686
 			$filters = array('airlines' => array($stats_airline));
687 687
 			if ($filter_name != '') {
688
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
688
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
689 689
 			}
690 690
 			$Spotter = new Spotter($this->db);
691 691
 			$all = $Spotter->countOverallArrival($filters);
692 692
 		}
693 693
 		return $all;
694 694
 	}
695
-	public function countOverallAircrafts($stats_airline = '',$filter_name = '') {
695
+	public function countOverallAircrafts($stats_airline = '', $filter_name = '') {
696 696
 		global $globalStatsFilters;
697 697
 		if ($filter_name == '') $filter_name = $this->filter_name;
698
-		$all = $this->getSumStats('aircrafts_bymonth',date('Y'),$stats_airline,$filter_name);
698
+		$all = $this->getSumStats('aircrafts_bymonth', date('Y'), $stats_airline, $filter_name);
699 699
 		if (empty($all)) {
700 700
 			$filters = array('airlines' => array($stats_airline));
701 701
 			if ($filter_name != '') {
702
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
702
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
703 703
 			}
704 704
 			$Spotter = new Spotter($this->db);
705 705
 			$all = $Spotter->countOverallAircrafts($filters);
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
                  try {
714 714
                         $sth = $this->db->prepare($query);
715 715
                         $sth->execute(array(':filter_name' => $filter_name));
716
-                } catch(PDOException $e) {
716
+                } catch (PDOException $e) {
717 717
                         echo "error : ".$e->getMessage();
718 718
                 }
719 719
                 $result = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -722,14 +722,14 @@  discard block
 block discarded – undo
722 722
 		if (empty($all)) {
723 723
             		$filters = array();
724 724
             		if ($filter_name != '') {
725
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
725
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
726 726
 			}
727 727
 			$Spotter = new Spotter($this->db);
728 728
 			$all = $Spotter->countOverallAirlines($filters);
729 729
 		}
730 730
 		return $all;
731 731
 	}
732
-	public function countOverallOwners($stats_airline = '',$filter_name = '') {
732
+	public function countOverallOwners($stats_airline = '', $filter_name = '') {
733 733
 		global $globalStatsFilters;
734 734
 		if ($filter_name == '') $filter_name = $this->filter_name;
735 735
 		/*
@@ -743,25 +743,25 @@  discard block
 block discarded – undo
743 743
                 $result = $sth->fetchAll(PDO::FETCH_ASSOC);
744 744
                 $all = $result[0]['nb_owner'];
745 745
                 */
746
-		$all = $this->getSumStats('owners_bymonth',date('Y'),$stats_airline,$filter_name);
746
+		$all = $this->getSumStats('owners_bymonth', date('Y'), $stats_airline, $filter_name);
747 747
 		if (empty($all)) {
748 748
 			$filters = array('airlines' => array($stats_airline));
749 749
 			if ($filter_name != '') {
750
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
750
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
751 751
 			}
752 752
 			$Spotter = new Spotter($this->db);
753 753
 			$all = $Spotter->countOverallOwners($filters);
754 754
 		}
755 755
 		return $all;
756 756
 	}
757
-	public function countOverallPilots($stats_airline = '',$filter_name = '') {
757
+	public function countOverallPilots($stats_airline = '', $filter_name = '') {
758 758
 		global $globalStatsFilters;
759 759
 		if ($filter_name == '') $filter_name = $this->filter_name;
760
-		$all = $this->getSumStats('pilots_bymonth',date('Y'),$stats_airline,$filter_name);
760
+		$all = $this->getSumStats('pilots_bymonth', date('Y'), $stats_airline, $filter_name);
761 761
 		if (empty($all)) {
762 762
 			$filters = array('airlines' => array($stats_airline));
763 763
 			if ($filter_name != '') {
764
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
764
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
765 765
 			}
766 766
 			$Spotter = new Spotter($this->db);
767 767
 			$all = $Spotter->countOverallPilots($filters);
@@ -769,33 +769,33 @@  discard block
 block discarded – undo
769 769
 		return $all;
770 770
 	}
771 771
 
772
-	public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') {
772
+	public function getLast7DaysAirports($airport_icao = '', $stats_airline = '', $filter_name = '') {
773 773
 		if ($filter_name == '') $filter_name = $this->filter_name;
774 774
 		$query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date";
775
-		$query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
775
+		$query_values = array(':airport_icao' => $airport_icao, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
776 776
                  try {
777 777
                         $sth = $this->db->prepare($query);
778 778
                         $sth->execute($query_values);
779
-                } catch(PDOException $e) {
779
+                } catch (PDOException $e) {
780 780
                         echo "error : ".$e->getMessage();
781 781
                 }
782 782
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
783 783
                 return $all;
784 784
 	}
785
-	public function getStats($type,$stats_airline = '', $filter_name = '') {
785
+	public function getStats($type, $stats_airline = '', $filter_name = '') {
786 786
 		if ($filter_name == '') $filter_name = $this->filter_name;
787 787
                 $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date";
788
-                $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
788
+                $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
789 789
                  try {
790 790
                         $sth = $this->db->prepare($query);
791 791
                         $sth->execute($query_values);
792
-                } catch(PDOException $e) {
792
+                } catch (PDOException $e) {
793 793
                         echo "error : ".$e->getMessage();
794 794
                 }
795 795
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
796 796
                 return $all;
797 797
         }
798
-	public function getSumStats($type,$year,$stats_airline = '',$filter_name = '') {
798
+	public function getSumStats($type, $year, $stats_airline = '', $filter_name = '') {
799 799
 		if ($filter_name == '') $filter_name = $this->filter_name;
800 800
     		global $globalArchiveMonths, $globalDBdriver;
801 801
     		if ($globalDBdriver == 'mysql') {
@@ -803,11 +803,11 @@  discard block
 block discarded – undo
803 803
 	        } else {
804 804
             		$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name";
805 805
                 }
806
-                $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
806
+                $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
807 807
                  try {
808 808
                         $sth = $this->db->prepare($query);
809 809
                         $sth->execute($query_values);
810
-                } catch(PDOException $e) {
810
+                } catch (PDOException $e) {
811 811
                         echo "error : ".$e->getMessage();
812 812
                 }
813 813
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
                  try {
826 826
                         $sth = $this->db->prepare($query);
827 827
                         $sth->execute($query_values);
828
-                } catch(PDOException $e) {
828
+                } catch (PDOException $e) {
829 829
                         echo "error : ".$e->getMessage();
830 830
                 }
831 831
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
                  try {
843 843
                         $sth = $this->db->prepare($query);
844 844
                         $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
845
-                } catch(PDOException $e) {
845
+                } catch (PDOException $e) {
846 846
                         echo "error : ".$e->getMessage();
847 847
                 }
848 848
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
                  try {
860 860
                         $sth = $this->db->prepare($query);
861 861
                         $sth->execute(array(':filter_name' => $filter_name));
862
-                } catch(PDOException $e) {
862
+                } catch (PDOException $e) {
863 863
                         echo "error : ".$e->getMessage();
864 864
                 }
865 865
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
                  try {
877 877
                         $sth = $this->db->prepare($query);
878 878
                         $sth->execute(array(':filter_name' => $filter_name));
879
-                } catch(PDOException $e) {
879
+                } catch (PDOException $e) {
880 880
                         echo "error : ".$e->getMessage();
881 881
                 }
882 882
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -893,14 +893,14 @@  discard block
 block discarded – undo
893 893
                  try {
894 894
                         $sth = $this->db->prepare($query);
895 895
                         $sth->execute(array(':filter_name' => $filter_name));
896
-                } catch(PDOException $e) {
896
+                } catch (PDOException $e) {
897 897
                         echo "error : ".$e->getMessage();
898 898
                 }
899 899
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
900 900
                 return $all[0]['total'];
901 901
         }
902 902
 
903
-	public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
903
+	public function addStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') {
904 904
 		global $globalDBdriver;
905 905
 		if ($filter_name == '') $filter_name = $this->filter_name;
906 906
 		if ($globalDBdriver == 'mysql') {
@@ -908,15 +908,15 @@  discard block
 block discarded – undo
908 908
                 } else {
909 909
 			$query = "UPDATE stats SET cnt = :cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE  stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
910 910
 		}
911
-                $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
911
+                $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
912 912
                  try {
913 913
                         $sth = $this->db->prepare($query);
914 914
                         $sth->execute($query_values);
915
-                } catch(PDOException $e) {
915
+                } catch (PDOException $e) {
916 916
                         return "error : ".$e->getMessage();
917 917
                 }
918 918
         }
919
-	public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
919
+	public function updateStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') {
920 920
 		global $globalDBdriver;
921 921
 		if ($filter_name == '') $filter_name = $this->filter_name;
922 922
 		if ($globalDBdriver == 'mysql') {
@@ -925,58 +925,58 @@  discard block
 block discarded – undo
925 925
             		//$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date";
926 926
 			$query = "UPDATE stats SET cnt = cnt+:cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE  stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
927 927
                 }
928
-                $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
928
+                $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
929 929
                  try {
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
         }
936
-	public function getStatsSource($date,$stats_type = '') {
936
+	public function getStatsSource($date, $stats_type = '') {
937 937
 		if ($stats_type == '') {
938 938
 			$query = "SELECT * FROM stats_source WHERE stats_date = :date ORDER BY source_name";
939 939
 			$query_values = array(':date' => $date);
940 940
 		} else {
941 941
 			$query = "SELECT * FROM stats_source WHERE stats_date = :date AND stats_type = :stats_type ORDER BY source_name";
942
-			$query_values = array(':date' => $date,':stats_type' => $stats_type);
942
+			$query_values = array(':date' => $date, ':stats_type' => $stats_type);
943 943
 		}
944 944
                  try {
945 945
                         $sth = $this->db->prepare($query);
946 946
                         $sth->execute($query_values);
947
-                } catch(PDOException $e) {
947
+                } catch (PDOException $e) {
948 948
                         echo "error : ".$e->getMessage();
949 949
                 }
950 950
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
951 951
                 return $all;
952 952
         }
953 953
 
954
-	public function addStatSource($data,$source_name,$stats_type,$date) {
954
+	public function addStatSource($data, $source_name, $stats_type, $date) {
955 955
 		global $globalDBdriver;
956 956
 		if ($globalDBdriver == 'mysql') {
957 957
 			$query = "INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) VALUES (:data,:source_name,:stats_type,:stats_date) ON DUPLICATE KEY UPDATE source_data = :data";
958 958
 		} else {
959 959
 			$query = "UPDATE stats_source SET source_data = :data WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type; INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) SELECT :data,:source_name,:stats_type,:stats_date WHERE NOT EXISTS (SELECT 1 FROM stats_source WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type);"; 
960 960
                 }
961
-                $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type);
961
+                $query_values = array(':data' => $data, ':stats_date' => $date, ':source_name' => $source_name, ':stats_type' => $stats_type);
962 962
                  try {
963 963
                         $sth = $this->db->prepare($query);
964 964
                         $sth->execute($query_values);
965
-                } catch(PDOException $e) {
965
+                } catch (PDOException $e) {
966 966
                         return "error : ".$e->getMessage();
967 967
                 }
968 968
         }
969
-	public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') {
969
+	public function addStatFlight($type, $date_name, $cnt, $stats_airline = '', $filter_name = '') {
970 970
                 $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)";
971
-                $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
971
+                $query_values = array(':type' => $type, ':flight_date' => $date_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
972 972
                  try {
973 973
                         $sth = $this->db->prepare($query);
974 974
                         $sth->execute($query_values);
975
-                } catch(PDOException $e) {
975
+                } catch (PDOException $e) {
976 976
                         return "error : ".$e->getMessage();
977 977
                 }
978 978
         }
979
-	public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '',$reset = false) {
979
+	public function addStatAircraftRegistration($registration, $cnt, $aircraft_icao = '', $airline_icao = '', $filter_name = '', $reset = false) {
980 980
 		global $globalDBdriver;
981 981
 		if ($globalDBdriver == 'mysql') {
982 982
 			if ($reset) {
@@ -991,15 +991,15 @@  discard block
 block discarded – undo
991 991
 				$query = "UPDATE stats_registration SET cnt = cnt+:cnt WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:registration,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_registration WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
992 992
 			}
993 993
 		}
994
-                $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
994
+                $query_values = array(':aircraft_icao' => $aircraft_icao, ':registration' => $registration, ':cnt' => $cnt, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
995 995
                  try {
996 996
                         $sth = $this->db->prepare($query);
997 997
                         $sth->execute($query_values);
998
-                } catch(PDOException $e) {
998
+                } catch (PDOException $e) {
999 999
                         return "error : ".$e->getMessage();
1000 1000
                 }
1001 1001
         }
1002
-	public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '', $reset = false) {
1002
+	public function addStatCallsign($callsign_icao, $cnt, $airline_icao = '', $filter_name = '', $reset = false) {
1003 1003
 		global $globalDBdriver;
1004 1004
 		if ($globalDBdriver == 'mysql') {
1005 1005
 			if ($reset) {
@@ -1014,15 +1014,15 @@  discard block
 block discarded – undo
1014 1014
 				$query = "UPDATE stats_callsign SET cnt = cnt+:cnt WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name; INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt,filter_name) SELECT :callsign_icao,:airline_icao,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_callsign WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name);"; 
1015 1015
 			}
1016 1016
 		}
1017
-                $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name);
1017
+                $query_values = array(':callsign_icao' => $callsign_icao, ':airline_icao' => $airline_icao, ':cnt' => $cnt, ':filter_name' => $filter_name);
1018 1018
                  try {
1019 1019
                         $sth = $this->db->prepare($query);
1020 1020
                         $sth->execute($query_values);
1021
-                } catch(PDOException $e) {
1021
+                } catch (PDOException $e) {
1022 1022
                         return "error : ".$e->getMessage();
1023 1023
                 }
1024 1024
         }
1025
-	public function addStatCountry($iso2,$iso3,$name,$cnt,$filter_name = '',$reset = false) {
1025
+	public function addStatCountry($iso2, $iso3, $name, $cnt, $filter_name = '', $reset = false) {
1026 1026
 		global $globalDBdriver;
1027 1027
 		if ($globalDBdriver == 'mysql') {
1028 1028
 			if ($reset) {
@@ -1037,15 +1037,15 @@  discard block
 block discarded – undo
1037 1037
 				$query = "UPDATE stats_country SET cnt = cnt+:cnt WHERE iso2 = :iso2 AND filter_name = :filter_name; INSERT INTO stats_country (iso2,iso3,name,cnt,filter_name) SELECT :iso2,:iso3,:name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_country WHERE iso2 = :iso2 AND filter_name = :filter_name);"; 
1038 1038
 			}
1039 1039
 		}
1040
-                $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name);
1040
+                $query_values = array(':iso2' => $iso2, ':iso3' => $iso3, ':name' => $name, ':cnt' => $cnt, ':filter_name' => $filter_name);
1041 1041
                  try {
1042 1042
                         $sth = $this->db->prepare($query);
1043 1043
                         $sth->execute($query_values);
1044
-                } catch(PDOException $e) {
1044
+                } catch (PDOException $e) {
1045 1045
                         return "error : ".$e->getMessage();
1046 1046
                 }
1047 1047
         }
1048
-	public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) {
1048
+	public function addStatAircraft($aircraft_icao, $cnt, $aircraft_name = '', $aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) {
1049 1049
 		global $globalDBdriver;
1050 1050
 		if ($globalDBdriver == 'mysql') {
1051 1051
 			if ($reset) {
@@ -1060,15 +1060,15 @@  discard block
 block discarded – undo
1060 1060
 				$query = "UPDATE stats_aircraft SET cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer, filter_name = :filter_name WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_aircraft WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1061 1061
 			}
1062 1062
 		}
1063
-                $query_values = array(':aircraft_icao' => $aircraft_icao,':aircraft_name' => $aircraft_name,':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer,':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1063
+                $query_values = array(':aircraft_icao' => $aircraft_icao, ':aircraft_name' => $aircraft_name, ':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1064 1064
                  try {
1065 1065
                         $sth = $this->db->prepare($query);
1066 1066
                         $sth->execute($query_values);
1067
-                } catch(PDOException $e) {
1067
+                } catch (PDOException $e) {
1068 1068
                         return "error : ".$e->getMessage();
1069 1069
                 }
1070 1070
         }
1071
-	public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '', $reset = false) {
1071
+	public function addStatAirline($airline_icao, $cnt, $airline_name = '', $filter_name = '', $reset = false) {
1072 1072
 		global $globalDBdriver;
1073 1073
 		if ($globalDBdriver == 'mysql') {
1074 1074
 			if ($reset) {
@@ -1083,15 +1083,15 @@  discard block
 block discarded – undo
1083 1083
 				$query = "UPDATE stats_airline SET cnt = cnt+:cnt WHERE airline_icao = :airline_icao AND filter_name = :filter_name; INSERT INTO stats_airline (airline_icao,airline_name,cnt,filter_name) SELECT :airline_icao,:airline_name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airline WHERE airline_icao = :airline_icao AND filter_name = :filter_name);"; 
1084 1084
 			}
1085 1085
 		}
1086
-                $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name);
1086
+                $query_values = array(':airline_icao' => $airline_icao, ':airline_name' => $airline_name, ':cnt' => $cnt, ':filter_name' => $filter_name);
1087 1087
                  try {
1088 1088
                         $sth = $this->db->prepare($query);
1089 1089
                         $sth->execute($query_values);
1090
-                } catch(PDOException $e) {
1090
+                } catch (PDOException $e) {
1091 1091
                         return "error : ".$e->getMessage();
1092 1092
                 }
1093 1093
         }
1094
-	public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '', $reset = false) {
1094
+	public function addStatOwner($owner_name, $cnt, $stats_airline = '', $filter_name = '', $reset = false) {
1095 1095
 		global $globalDBdriver;
1096 1096
 		if ($globalDBdriver == 'mysql') {
1097 1097
 			if ($reset) {
@@ -1106,15 +1106,15 @@  discard block
 block discarded – undo
1106 1106
 				$query = "UPDATE stats_owner SET cnt = cnt+:cnt WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_owner (owner_name,cnt,stats_airline,filter_name) SELECT :owner_name,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_owner WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1107 1107
 			}
1108 1108
 		}
1109
-                $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1109
+                $query_values = array(':owner_name' => $owner_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
1110 1110
                  try {
1111 1111
                         $sth = $this->db->prepare($query);
1112 1112
                         $sth->execute($query_values);
1113
-                } catch(PDOException $e) {
1113
+                } catch (PDOException $e) {
1114 1114
                         return "error : ".$e->getMessage();
1115 1115
                 }
1116 1116
         }
1117
-	public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '',$format_source = '',$reset = false) {
1117
+	public function addStatPilot($pilot_id, $cnt, $pilot_name, $stats_airline = '', $filter_name = '', $format_source = '', $reset = false) {
1118 1118
 		global $globalDBdriver;
1119 1119
 		if ($globalDBdriver == 'mysql') {
1120 1120
 			if ($reset) {
@@ -1129,15 +1129,15 @@  discard block
 block discarded – undo
1129 1129
 				$query = "UPDATE stats_pilot SET cnt = cnt+:cnt, pilot_name = :pilot_name WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source; INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name,format_source) SELECT :pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name,:format_source WHERE NOT EXISTS (SELECT 1 FROM stats_pilot WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source);"; 
1130 1130
 			}
1131 1131
 		}
1132
-                $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name,':format_source' => $format_source);
1132
+                $query_values = array(':pilot_id' => $pilot_id, ':cnt' => $cnt, ':pilot_name' => $pilot_name, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':format_source' => $format_source);
1133 1133
                  try {
1134 1134
                         $sth = $this->db->prepare($query);
1135 1135
                         $sth->execute($query_values);
1136
-                } catch(PDOException $e) {
1136
+                } catch (PDOException $e) {
1137 1137
                         return "error : ".$e->getMessage();
1138 1138
                 }
1139 1139
         }
1140
-	public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '',$reset = false) {
1140
+	public function addStatDepartureAirports($airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '', $reset = false) {
1141 1141
 		global $globalDBdriver;
1142 1142
 		if ($airport_icao != '') {
1143 1143
 			if ($globalDBdriver == 'mysql') {
@@ -1153,16 +1153,16 @@  discard block
 block discarded – undo
1153 1153
 					$query = "UPDATE stats_airport SET departure = departure+:departure WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; 
1154 1154
 				}
1155 1155
 			}
1156
-			$query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao,':filter_name' => $filter_name);
1156
+			$query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':departure' => $departure, ':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1157 1157
 			try {
1158 1158
 				$sth = $this->db->prepare($query);
1159 1159
 				$sth->execute($query_values);
1160
-			} catch(PDOException $e) {
1160
+			} catch (PDOException $e) {
1161 1161
 				return "error : ".$e->getMessage();
1162 1162
 			}
1163 1163
                 }
1164 1164
         }
1165
-	public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') {
1165
+	public function addStatDepartureAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') {
1166 1166
 		global $globalDBdriver;
1167 1167
 		if ($airport_icao != '') {
1168 1168
 			if ($globalDBdriver == 'mysql') {
@@ -1170,16 +1170,16 @@  discard block
 block discarded – undo
1170 1170
 			} else {
1171 1171
 				$query = "UPDATE stats_airport SET departure = :departure WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1172 1172
 			}
1173
-			$query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name);
1173
+			$query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':departure' => $departure, ':date' => $date, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1174 1174
 			 try {
1175 1175
 				$sth = $this->db->prepare($query);
1176 1176
 				$sth->execute($query_values);
1177
-			} catch(PDOException $e) {
1177
+			} catch (PDOException $e) {
1178 1178
 				return "error : ".$e->getMessage();
1179 1179
 			}
1180 1180
                 }
1181 1181
         }
1182
-	public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '',$reset = false) {
1182
+	public function addStatArrivalAirports($airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '', $reset = false) {
1183 1183
 		global $globalDBdriver;
1184 1184
 		if ($airport_icao != '') {
1185 1185
 			if ($globalDBdriver == 'mysql') {
@@ -1195,16 +1195,16 @@  discard block
 block discarded – undo
1195 1195
 					$query = "UPDATE stats_airport SET arrival = arrival+:arrival WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; 
1196 1196
 				}
1197 1197
 			}
1198
-	                $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival,':date' => date('Y').'-01-01 00:00:00',':stats_airline' => $airline_icao,':filter_name' => $filter_name);
1198
+	                $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':arrival' => $arrival, ':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1199 1199
 			 try {
1200 1200
                     		$sth = $this->db->prepare($query);
1201 1201
 	                        $sth->execute($query_values);
1202
-    		        } catch(PDOException $e) {
1202
+    		        } catch (PDOException $e) {
1203 1203
             		        return "error : ".$e->getMessage();
1204 1204
 	                }
1205 1205
 	        }
1206 1206
         }
1207
-	public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') {
1207
+	public function addStatArrivalAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') {
1208 1208
 		global $globalDBdriver;
1209 1209
 		if ($airport_icao != '') {
1210 1210
 			if ($globalDBdriver == 'mysql') {
@@ -1212,11 +1212,11 @@  discard block
 block discarded – undo
1212 1212
 			} else {
1213 1213
 				$query = "UPDATE stats_airport SET arrival = :arrival WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1214 1214
 			}
1215
-			$query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival, ':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name);
1215
+			$query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':arrival' => $arrival, ':date' => $date, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1216 1216
 			try {
1217 1217
 				$sth = $this->db->prepare($query);
1218 1218
 				$sth->execute($query_values);
1219
-			} catch(PDOException $e) {
1219
+			} catch (PDOException $e) {
1220 1220
 				return "error : ".$e->getMessage();
1221 1221
 			}
1222 1222
                 }
@@ -1228,7 +1228,7 @@  discard block
 block discarded – undo
1228 1228
                  try {
1229 1229
                         $sth = $this->db->prepare($query);
1230 1230
                         $sth->execute($query_values);
1231
-                } catch(PDOException $e) {
1231
+                } catch (PDOException $e) {
1232 1232
                         return "error : ".$e->getMessage();
1233 1233
                 }
1234 1234
         }
@@ -1238,7 +1238,7 @@  discard block
 block discarded – undo
1238 1238
                  try {
1239 1239
                         $sth = $this->db->prepare($query);
1240 1240
                         $sth->execute($query_values);
1241
-                } catch(PDOException $e) {
1241
+                } catch (PDOException $e) {
1242 1242
                         return "error : ".$e->getMessage();
1243 1243
                 }
1244 1244
         }
@@ -1248,13 +1248,13 @@  discard block
 block discarded – undo
1248 1248
                  try {
1249 1249
                         $sth = $this->db->prepare($query);
1250 1250
                         $sth->execute($query_values);
1251
-                } catch(PDOException $e) {
1251
+                } catch (PDOException $e) {
1252 1252
                         return "error : ".$e->getMessage();
1253 1253
                 }
1254 1254
         }
1255 1255
         
1256 1256
         public function addOldStats() {
1257
-    		global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats,$globalStatsReset,$globalStatsResetYear;
1257
+    		global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters, $globalDeleteLastYearStats, $globalStatsReset, $globalStatsResetYear;
1258 1258
     		$Common = new Common();
1259 1259
     		$Connection = new Connection();
1260 1260
     		date_default_timezone_set('UTC');
@@ -1271,40 +1271,40 @@  discard block
 block discarded – undo
1271 1271
 			$Spotter = new Spotter($this->db);
1272 1272
 
1273 1273
 			if ($globalDebug) echo 'Count all aircraft types...'."\n";
1274
-			$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day);
1274
+			$alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day);
1275 1275
 			foreach ($alldata as $number) {
1276
-				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'','',$reset);
1276
+				$this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', '', $reset);
1277 1277
 			}
1278 1278
 			if ($globalDebug) echo 'Count all airlines...'."\n";
1279
-			$alldata = $Spotter->countAllAirlines(false,0,$last_update_day);
1279
+			$alldata = $Spotter->countAllAirlines(false, 0, $last_update_day);
1280 1280
 			foreach ($alldata as $number) {
1281
-				$this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],'',$reset);
1281
+				$this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], '', $reset);
1282 1282
 			}
1283 1283
 			if ($globalDebug) echo 'Count all registrations...'."\n";
1284
-			$alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day);
1284
+			$alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day);
1285 1285
 			foreach ($alldata as $number) {
1286
-				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'','',$reset);
1286
+				$this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', '', $reset);
1287 1287
 			}
1288 1288
 			if ($globalDebug) echo 'Count all callsigns...'."\n";
1289
-			$alldata = $Spotter->countAllCallsigns(false,0,$last_update_day);
1289
+			$alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day);
1290 1290
 			foreach ($alldata as $number) {
1291
-				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset);
1291
+				$this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao'], '', $reset);
1292 1292
 			}
1293 1293
 			if ($globalDebug) echo 'Count all owners...'."\n";
1294
-			$alldata = $Spotter->countAllOwners(false,0,$last_update_day);
1294
+			$alldata = $Spotter->countAllOwners(false, 0, $last_update_day);
1295 1295
 			foreach ($alldata as $number) {
1296
-				$this->addStatOwner($number['owner_name'],$number['owner_count'],'','',$reset);
1296
+				$this->addStatOwner($number['owner_name'], $number['owner_count'], '', '', $reset);
1297 1297
 			}
1298 1298
 			if ($globalDebug) echo 'Count all pilots...'."\n";
1299
-			$alldata = $Spotter->countAllPilots(false,0,$last_update_day);
1299
+			$alldata = $Spotter->countAllPilots(false, 0, $last_update_day);
1300 1300
 			foreach ($alldata as $number) {
1301
-				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source'],$reset);
1301
+				$this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', '', $number['format_source'], $reset);
1302 1302
 			}
1303 1303
 			
1304 1304
 			if ($globalDebug) echo 'Count all departure airports...'."\n";
1305
-			$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day);
1305
+			$pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day);
1306 1306
 			if ($globalDebug) echo 'Count all detected departure airports...'."\n";
1307
-        		$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day);
1307
+        		$dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day);
1308 1308
 			if ($globalDebug) echo 'Order departure airports...'."\n";
1309 1309
 	        	$alldata = array();
1310 1310
 	        	
@@ -1322,14 +1322,14 @@  discard block
 block discarded – undo
1322 1322
     			foreach ($alldata as $key => $row) {
1323 1323
     				$count[$key] = $row['airport_departure_icao_count'];
1324 1324
         		}
1325
-			array_multisort($count,SORT_DESC,$alldata);
1325
+			array_multisort($count, SORT_DESC, $alldata);
1326 1326
 			foreach ($alldata as $number) {
1327
-				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'','',$reset);
1327
+				echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], '', '', $reset);
1328 1328
 			}
1329 1329
 			if ($globalDebug) echo 'Count all arrival airports...'."\n";
1330
-			$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day);
1330
+			$pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day);
1331 1331
 			if ($globalDebug) echo 'Count all detected arrival airports...'."\n";
1332
-        		$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day);
1332
+        		$dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day);
1333 1333
 			if ($globalDebug) echo 'Order arrival airports...'."\n";
1334 1334
 	        	$alldata = array();
1335 1335
     			foreach ($pall as $value) {
@@ -1346,16 +1346,16 @@  discard block
 block discarded – undo
1346 1346
         		foreach ($alldata as $key => $row) {
1347 1347
         			$count[$key] = $row['airport_arrival_icao_count'];
1348 1348
 	        	}
1349
-    			array_multisort($count,SORT_DESC,$alldata);
1349
+    			array_multisort($count, SORT_DESC, $alldata);
1350 1350
                         foreach ($alldata as $number) {
1351
-				echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'','',$reset);
1351
+				echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], '', '', $reset);
1352 1352
 			}
1353 1353
 			if ($Connection->tableExists('countries')) {
1354 1354
 				if ($globalDebug) echo 'Count all flights by countries...'."\n";
1355 1355
 				$SpotterArchive = new SpotterArchive();
1356
-				$alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day);
1356
+				$alldata = $SpotterArchive->countAllFlightOverCountries(false, 0, $last_update_day);
1357 1357
 				foreach ($alldata as $number) {
1358
-					$this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],'',$reset);
1358
+					$this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count'], '', $reset);
1359 1359
 				}
1360 1360
 			}
1361 1361
 			
@@ -1369,37 +1369,37 @@  discard block
 block discarded – undo
1369 1369
 			$lastyear = false;
1370 1370
 			foreach ($alldata as $number) {
1371 1371
 				if ($number['year_name'] != date('Y')) $lastyear = true;
1372
-				$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1372
+				$this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1373 1373
 			}
1374 1374
 			if ($globalDebug) echo 'Count all military flights by months...'."\n";
1375 1375
 			$alldata = $Spotter->countAllMilitaryMonths();
1376 1376
 			foreach ($alldata as $number) {
1377
-				$this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1377
+				$this->addStat('military_flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1378 1378
 			}
1379 1379
 			if ($globalDebug) echo 'Count all owners by months...'."\n";
1380 1380
 			$alldata = $Spotter->countAllMonthsOwners();
1381 1381
 			foreach ($alldata as $number) {
1382
-				$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1382
+				$this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1383 1383
 			}
1384 1384
 			if ($globalDebug) echo 'Count all pilots by months...'."\n";
1385 1385
 			$alldata = $Spotter->countAllMonthsPilots();
1386 1386
 			foreach ($alldata as $number) {
1387
-				$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1387
+				$this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1388 1388
 			}
1389 1389
 			if ($globalDebug) echo 'Count all airlines by months...'."\n";
1390 1390
 			$alldata = $Spotter->countAllMonthsAirlines();
1391 1391
 			foreach ($alldata as $number) {
1392
-				$this->addStat('airlines_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1392
+				$this->addStat('airlines_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1393 1393
 			}
1394 1394
 			if ($globalDebug) echo 'Count all aircrafts by months...'."\n";
1395 1395
 			$alldata = $Spotter->countAllMonthsAircrafts();
1396 1396
 			foreach ($alldata as $number) {
1397
-				$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1397
+				$this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1398 1398
 			}
1399 1399
 			if ($globalDebug) echo 'Count all real arrivals by months...'."\n";
1400 1400
 			$alldata = $Spotter->countAllMonthsRealArrivals();
1401 1401
 			foreach ($alldata as $number) {
1402
-				$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1402
+				$this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1403 1403
 			}
1404 1404
 			if ($globalDebug) echo 'Airports data...'."\n";
1405 1405
 			if ($globalDebug) echo '...Departure'."\n";
@@ -1444,7 +1444,7 @@  discard block
 block discarded – undo
1444 1444
     			}
1445 1445
     			$alldata = $pall;
1446 1446
 			foreach ($alldata as $number) {
1447
-				$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']);
1447
+				$this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count']);
1448 1448
 			}
1449 1449
 			echo '...Arrival'."\n";
1450 1450
 			$pall = $Spotter->getLast7DaysAirportsArrival();
@@ -1486,7 +1486,7 @@  discard block
 block discarded – undo
1486 1486
     			}
1487 1487
     			$alldata = $pall;
1488 1488
 			foreach ($alldata as $number) {
1489
-				$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']);
1489
+				$this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count']);
1490 1490
 			}
1491 1491
 
1492 1492
 			echo 'Flights data...'."\n";
@@ -1494,28 +1494,28 @@  discard block
 block discarded – undo
1494 1494
 			echo '-> countAllDatesLastMonth...'."\n";
1495 1495
 			$alldata = $Spotter->countAllDatesLastMonth();
1496 1496
 			foreach ($alldata as $number) {
1497
-				$this->addStatFlight('month',$number['date_name'],$number['date_count']);
1497
+				$this->addStatFlight('month', $number['date_name'], $number['date_count']);
1498 1498
 			}
1499 1499
 			echo '-> countAllDates...'."\n";
1500 1500
 			$previousdata = $this->countAllDates();
1501 1501
 			$previousdatabyairlines = $this->countAllDatesByAirlines();
1502 1502
 			$this->deleteStatFlight('date');
1503
-			$alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates());
1503
+			$alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates());
1504 1504
 			$values = array();
1505 1505
 			foreach ($alldata as $cnt) {
1506 1506
 				$values[] = $cnt['date_count'];
1507 1507
 			}
1508
-			array_multisort($values,SORT_DESC,$alldata);
1509
-			array_splice($alldata,11);
1508
+			array_multisort($values, SORT_DESC, $alldata);
1509
+			array_splice($alldata, 11);
1510 1510
 			foreach ($alldata as $number) {
1511
-				$this->addStatFlight('date',$number['date_name'],$number['date_count']);
1511
+				$this->addStatFlight('date', $number['date_name'], $number['date_count']);
1512 1512
 			}
1513 1513
 			
1514 1514
 			$this->deleteStatFlight('hour');
1515 1515
 			echo '-> countAllHours...'."\n";
1516 1516
 			$alldata = $Spotter->countAllHours('hour');
1517 1517
 			foreach ($alldata as $number) {
1518
-				$this->addStatFlight('hour',$number['hour_name'],$number['hour_count']);
1518
+				$this->addStatFlight('hour', $number['hour_name'], $number['hour_count']);
1519 1519
 			}
1520 1520
 
1521 1521
 
@@ -1524,34 +1524,34 @@  discard block
 block discarded – undo
1524 1524
 			echo '--- Stats by airlines ---'."\n";
1525 1525
 			if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n";
1526 1526
 			$Spotter = new Spotter($this->db);
1527
-			$alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day);
1527
+			$alldata = $Spotter->countAllAircraftTypesByAirlines(false, 0, $last_update_day);
1528 1528
 			foreach ($alldata as $number) {
1529
-				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao'],'',$reset);
1529
+				$this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], $number['airline_icao'], '', $reset);
1530 1530
 			}
1531 1531
 			if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n";
1532
-			$alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day);
1532
+			$alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false, 0, $last_update_day);
1533 1533
 			foreach ($alldata as $number) {
1534
-				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao'],'',$reset);
1534
+				$this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], $number['airline_icao'], '', $reset);
1535 1535
 			}
1536 1536
 			if ($globalDebug) echo 'Count all callsigns by airlines...'."\n";
1537
-			$alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day);
1537
+			$alldata = $Spotter->countAllCallsignsByAirlines(false, 0, $last_update_day);
1538 1538
 			foreach ($alldata as $number) {
1539
-				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset);
1539
+				$this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao'], '', $reset);
1540 1540
 			}
1541 1541
 			if ($globalDebug) echo 'Count all owners by airlines...'."\n";
1542
-			$alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day);
1542
+			$alldata = $Spotter->countAllOwnersByAirlines(false, 0, $last_update_day);
1543 1543
 			foreach ($alldata as $number) {
1544
-				$this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao'],'',$reset);
1544
+				$this->addStatOwner($number['owner_name'], $number['owner_count'], $number['airline_icao'], '', $reset);
1545 1545
 			}
1546 1546
 			if ($globalDebug) echo 'Count all pilots by airlines...'."\n";
1547
-			$alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day);
1547
+			$alldata = $Spotter->countAllPilotsByAirlines(false, 0, $last_update_day);
1548 1548
 			foreach ($alldata as $number) {
1549
-				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source'],$reset);
1549
+				$this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], $number['airline_icao'], '', $number['format_source'], $reset);
1550 1550
 			}
1551 1551
 			if ($globalDebug) echo 'Count all departure airports by airlines...'."\n";
1552
-			$pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day);
1552
+			$pall = $Spotter->countAllDepartureAirportsByAirlines(false, 0, $last_update_day);
1553 1553
 			if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n";
1554
-       			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day);
1554
+       			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false, 0, $last_update_day);
1555 1555
 			if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n";
1556 1556
 	        	//$alldata = array();
1557 1557
     			foreach ($dall as $value) {
@@ -1571,12 +1571,12 @@  discard block
 block discarded – undo
1571 1571
     			}
1572 1572
     			$alldata = $pall;
1573 1573
 			foreach ($alldata as $number) {
1574
-				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao'],'',$reset);
1574
+				echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], $number['airline_icao'], '', $reset);
1575 1575
 			}
1576 1576
 			if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n";
1577
-			$pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day);
1577
+			$pall = $Spotter->countAllArrivalAirportsByAirlines(false, 0, $last_update_day);
1578 1578
 			if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n";
1579
-        		$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day);
1579
+        		$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false, 0, $last_update_day);
1580 1580
 			if ($globalDebug) echo 'Order arrival airports by airlines...'."\n";
1581 1581
 	        	//$alldata = array();
1582 1582
     			foreach ($dall as $value) {
@@ -1596,7 +1596,7 @@  discard block
 block discarded – undo
1596 1596
     			}
1597 1597
     			$alldata = $pall;
1598 1598
                         foreach ($alldata as $number) {
1599
-				if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset);
1599
+				if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], $number['airline_icao'], '', $reset);
1600 1600
 			}
1601 1601
 			if ($globalDebug) echo 'Count all flights by months by airlines...'."\n";
1602 1602
 			$Spotter = new Spotter($this->db);
@@ -1604,27 +1604,27 @@  discard block
 block discarded – undo
1604 1604
 			$lastyear = false;
1605 1605
 			foreach ($alldata as $number) {
1606 1606
 				if ($number['year_name'] != date('Y')) $lastyear = true;
1607
-				$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1607
+				$this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
1608 1608
 			}
1609 1609
 			if ($globalDebug) echo 'Count all owners by months by airlines...'."\n";
1610 1610
 			$alldata = $Spotter->countAllMonthsOwnersByAirlines();
1611 1611
 			foreach ($alldata as $number) {
1612
-				$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1612
+				$this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
1613 1613
 			}
1614 1614
 			if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n";
1615 1615
 			$alldata = $Spotter->countAllMonthsPilotsByAirlines();
1616 1616
 			foreach ($alldata as $number) {
1617
-				$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1617
+				$this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
1618 1618
 			}
1619 1619
 			if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n";
1620 1620
 			$alldata = $Spotter->countAllMonthsAircraftsByAirlines();
1621 1621
 			foreach ($alldata as $number) {
1622
-				$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1622
+				$this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
1623 1623
 			}
1624 1624
 			if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n";
1625 1625
 			$alldata = $Spotter->countAllMonthsRealArrivalsByAirlines();
1626 1626
 			foreach ($alldata as $number) {
1627
-				$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1627
+				$this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
1628 1628
 			}
1629 1629
 			if ($globalDebug) echo '...Departure'."\n";
1630 1630
 			$pall = $Spotter->getLast7DaysAirportsDepartureByAirlines();
@@ -1647,7 +1647,7 @@  discard block
 block discarded – undo
1647 1647
     			}
1648 1648
     			$alldata = $pall;
1649 1649
 			foreach ($alldata as $number) {
1650
-				$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']);
1650
+				$this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count'], $number['airline_icao']);
1651 1651
 			}
1652 1652
 			if ($globalDebug) echo '...Arrival'."\n";
1653 1653
 			$pall = $Spotter->getLast7DaysAirportsArrivalByAirlines();
@@ -1670,32 +1670,32 @@  discard block
 block discarded – undo
1670 1670
     			}
1671 1671
     			$alldata = $pall;
1672 1672
 			foreach ($alldata as $number) {
1673
-				$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']);
1673
+				$this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count'], $number['airline_icao']);
1674 1674
 			}
1675 1675
 
1676 1676
 			if ($globalDebug) echo 'Flights data...'."\n";
1677 1677
 			if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n";
1678 1678
 			$alldata = $Spotter->countAllDatesLastMonthByAirlines();
1679 1679
 			foreach ($alldata as $number) {
1680
-				$this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']);
1680
+				$this->addStatFlight('month', $number['date_name'], $number['date_count'], $number['airline_icao']);
1681 1681
 			}
1682 1682
 			if ($globalDebug) echo '-> countAllDates...'."\n";
1683 1683
 			//$previousdata = $this->countAllDatesByAirlines();
1684
-			$alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines());
1684
+			$alldata = $Common->array_merge_noappend($previousdatabyairlines, $Spotter->countAllDatesByAirlines());
1685 1685
 			$values = array();
1686 1686
 			foreach ($alldata as $cnt) {
1687 1687
 				$values[] = $cnt['date_count'];
1688 1688
 			}
1689
-			array_multisort($values,SORT_DESC,$alldata);
1690
-			array_splice($alldata,11);
1689
+			array_multisort($values, SORT_DESC, $alldata);
1690
+			array_splice($alldata, 11);
1691 1691
 			foreach ($alldata as $number) {
1692
-				$this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']);
1692
+				$this->addStatFlight('date', $number['date_name'], $number['date_count'], $number['airline_icao']);
1693 1693
 			}
1694 1694
 			
1695 1695
 			if ($globalDebug) echo '-> countAllHours...'."\n";
1696 1696
 			$alldata = $Spotter->countAllHoursByAirlines('hour');
1697 1697
 			foreach ($alldata as $number) {
1698
-				$this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']);
1698
+				$this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], $number['airline_icao']);
1699 1699
 			}
1700 1700
 			
1701 1701
 
@@ -1714,32 +1714,32 @@  discard block
 block discarded – undo
1714 1714
 				// Count by filter
1715 1715
 				if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n";
1716 1716
 				$Spotter = new Spotter($this->db);
1717
-				$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter);
1717
+				$alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day, $filter);
1718 1718
 				foreach ($alldata as $number) {
1719
-					$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'',$filter_name,$reset);
1719
+					$this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', $filter_name, $reset);
1720 1720
 				}
1721
-				$alldata = $Spotter->countAllAirlines(false,0,$last_update_day,$filter);
1721
+				$alldata = $Spotter->countAllAirlines(false, 0, $last_update_day, $filter);
1722 1722
 				foreach ($alldata as $number) {
1723
-					$this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],$filter_name,$reset);
1723
+					$this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], $filter_name, $reset);
1724 1724
 				}
1725
-				$alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day,$filter);
1725
+				$alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day, $filter);
1726 1726
 				foreach ($alldata as $number) {
1727
-					$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'',$filter_name,$reset);
1727
+					$this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', $filter_name, $reset);
1728 1728
 				}
1729
-				$alldata = $Spotter->countAllCallsigns(false,0,$last_update_day,$filter);
1729
+				$alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day, $filter);
1730 1730
 				foreach ($alldata as $number) {
1731
-					$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],'',$filter_name,$reset);
1731
+					$this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], '', $filter_name, $reset);
1732 1732
 				}
1733
-				$alldata = $Spotter->countAllOwners(false,0,$last_update_day,$filter);
1733
+				$alldata = $Spotter->countAllOwners(false, 0, $last_update_day, $filter);
1734 1734
 				foreach ($alldata as $number) {
1735
-					$this->addStatOwner($number['owner_name'],$number['owner_count'],'',$filter_name,$reset);
1735
+					$this->addStatOwner($number['owner_name'], $number['owner_count'], '', $filter_name, $reset);
1736 1736
 				}
1737
-				$alldata = $Spotter->countAllPilots(false,0,$last_update_day,$filter);
1737
+				$alldata = $Spotter->countAllPilots(false, 0, $last_update_day, $filter);
1738 1738
 				foreach ($alldata as $number) {
1739
-					$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name,$number['format_source'],$reset);
1739
+					$this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', $filter_name, $number['format_source'], $reset);
1740 1740
 				}
1741
-				$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter);
1742
-	       			$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter);
1741
+				$pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day, $filter);
1742
+	       			$dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day, $filter);
1743 1743
 		        	$alldata = array();
1744 1744
 	    			foreach ($pall as $value) {
1745 1745
 		        		$icao = $value['airport_departure_icao'];
@@ -1755,12 +1755,12 @@  discard block
 block discarded – undo
1755 1755
     				foreach ($alldata as $key => $row) {
1756 1756
     					$count[$key] = $row['airport_departure_icao_count'];
1757 1757
     				}
1758
-				array_multisort($count,SORT_DESC,$alldata);
1758
+				array_multisort($count, SORT_DESC, $alldata);
1759 1759
 				foreach ($alldata as $number) {
1760
-    					echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'',$filter_name,$reset);
1760
+    					echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], '', $filter_name, $reset);
1761 1761
 				}
1762
-				$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,false,$filter);
1763
-    				$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter);
1762
+				$pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day, false, $filter);
1763
+    				$dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day, false, $filter);
1764 1764
 				$alldata = array();
1765 1765
     				foreach ($pall as $value) {
1766 1766
 		        		$icao = $value['airport_arrival_icao'];
@@ -1776,40 +1776,40 @@  discard block
 block discarded – undo
1776 1776
         			foreach ($alldata as $key => $row) {
1777 1777
     					$count[$key] = $row['airport_arrival_icao_count'];
1778 1778
 		        	}
1779
-        			array_multisort($count,SORT_DESC,$alldata);
1779
+        			array_multisort($count, SORT_DESC, $alldata);
1780 1780
 				foreach ($alldata as $number) {
1781
-					echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'',$filter_name,$reset);
1781
+					echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], '', $filter_name, $reset);
1782 1782
 				}
1783 1783
 				$Spotter = new Spotter($this->db);
1784 1784
 				$alldata = $Spotter->countAllMonths($filter);
1785 1785
 				$lastyear = false;
1786 1786
 				foreach ($alldata as $number) {
1787 1787
 					if ($number['year_name'] != date('Y')) $lastyear = true;
1788
-					$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1788
+					$this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
1789 1789
 				}
1790 1790
 				$alldata = $Spotter->countAllMonthsOwners($filter);
1791 1791
 				foreach ($alldata as $number) {
1792
-					$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1792
+					$this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
1793 1793
 				}
1794 1794
 				$alldata = $Spotter->countAllMonthsPilots($filter);
1795 1795
 				foreach ($alldata as $number) {
1796
-					$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1796
+					$this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
1797 1797
 				}
1798 1798
 				$alldata = $Spotter->countAllMilitaryMonths($filter);
1799 1799
 				foreach ($alldata as $number) {
1800
-					$this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1800
+					$this->addStat('military_flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
1801 1801
 				}
1802 1802
 				$alldata = $Spotter->countAllMonthsAircrafts($filter);
1803 1803
 				foreach ($alldata as $number) {
1804
-					$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1804
+					$this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
1805 1805
 				}
1806 1806
 				$alldata = $Spotter->countAllMonthsRealArrivals($filter);
1807 1807
 				foreach ($alldata as $number) {
1808
-					$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1808
+					$this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
1809 1809
 				}
1810 1810
 				echo '...Departure'."\n";
1811
-				$pall = $Spotter->getLast7DaysAirportsDeparture('',$filter);
1812
-        			$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter);
1811
+				$pall = $Spotter->getLast7DaysAirportsDeparture('', $filter);
1812
+        			$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('', $filter);
1813 1813
 				foreach ($dall as $value) {
1814 1814
     					$icao = $value['departure_airport_icao'];
1815 1815
     					$ddate = $value['date'];
@@ -1827,11 +1827,11 @@  discard block
 block discarded – undo
1827 1827
     				}
1828 1828
 	    			$alldata = $pall;
1829 1829
 				foreach ($alldata as $number) {
1830
-					$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],'',$filter_name);
1830
+					$this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count'], '', $filter_name);
1831 1831
 				}
1832 1832
 				echo '...Arrival'."\n";
1833
-				$pall = $Spotter->getLast7DaysAirportsArrival('',$filter);
1834
-    				$dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter);
1833
+				$pall = $Spotter->getLast7DaysAirportsArrival('', $filter);
1834
+    				$dall = $Spotter->getLast7DaysDetectedAirportsArrival('', $filter);
1835 1835
 				foreach ($dall as $value) {
1836 1836
 					$icao = $value['arrival_airport_icao'];
1837 1837
 					$ddate = $value['date'];
@@ -1849,40 +1849,40 @@  discard block
 block discarded – undo
1849 1849
     				}
1850 1850
     				$alldata = $pall;
1851 1851
 				foreach ($alldata as $number) {
1852
-					$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],'',$filter_name);
1852
+					$this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count'], '', $filter_name);
1853 1853
 				}
1854 1854
     
1855 1855
 				echo 'Flights data...'."\n";
1856 1856
 				echo '-> countAllDatesLastMonth...'."\n";
1857 1857
 				$alldata = $Spotter->countAllDatesLastMonth($filter);
1858 1858
 				foreach ($alldata as $number) {
1859
-					$this->addStatFlight('month',$number['date_name'],$number['date_count'], '',$filter_name);
1859
+					$this->addStatFlight('month', $number['date_name'], $number['date_count'], '', $filter_name);
1860 1860
 				}
1861 1861
 				echo '-> countAllDates...'."\n";
1862
-				$previousdata = $this->countAllDates('',$filter_name);
1863
-				$alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter));
1862
+				$previousdata = $this->countAllDates('', $filter_name);
1863
+				$alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter));
1864 1864
 				$values = array();
1865 1865
 				foreach ($alldata as $cnt) {
1866 1866
 					$values[] = $cnt['date_count'];
1867 1867
 				}
1868
-				array_multisort($values,SORT_DESC,$alldata);
1869
-				array_splice($alldata,11);
1868
+				array_multisort($values, SORT_DESC, $alldata);
1869
+				array_splice($alldata, 11);
1870 1870
 				foreach ($alldata as $number) {
1871
-					$this->addStatFlight('date',$number['date_name'],$number['date_count'],'',$filter_name);
1871
+					$this->addStatFlight('date', $number['date_name'], $number['date_count'], '', $filter_name);
1872 1872
 				}
1873 1873
 				
1874 1874
 				echo '-> countAllHours...'."\n";
1875
-				$alldata = $Spotter->countAllHours('hour',$filter);
1875
+				$alldata = $Spotter->countAllHours('hour', $filter);
1876 1876
 				foreach ($alldata as $number) {
1877
-					$this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],'',$filter_name);
1877
+					$this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], '', $filter_name);
1878 1878
 				}
1879 1879
 				echo 'Insert last stats update date...'."\n";
1880 1880
 				date_default_timezone_set('UTC');
1881
-				$this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y-m-d G:i:s'));
1881
+				$this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y-m-d G:i:s'));
1882 1882
 				if (isset($filter['DeleteLastYearStats']) && $filter['DeleteLastYearStats'] == true) {
1883
-					if (date('Y',strtotime($last_update_day)) != date('Y')) {
1883
+					if (date('Y', strtotime($last_update_day)) != date('Y')) {
1884 1884
 						$this->deleteOldStats($filter_name);
1885
-						$this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y').'-01-01 00:00:00');
1885
+						$this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y').'-01-01 00:00:00');
1886 1886
 					}
1887 1887
 				}
1888 1888
 
@@ -1895,16 +1895,16 @@  discard block
 block discarded – undo
1895 1895
 				// SUM all previous month to put as year
1896 1896
 				$previous_year = date('Y');
1897 1897
 				$previous_year--;
1898
-				$this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
1899
-				$this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
1900
-				$this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
1901
-				$this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
1898
+				$this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
1899
+				$this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
1900
+				$this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
1901
+				$this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
1902 1902
 				$allairlines = $this->getAllAirlineNames();
1903 1903
 				foreach ($allairlines as $data) {
1904
-					$this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
1905
-					$this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
1906
-					$this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
1907
-					$this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
1904
+					$this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
1905
+					$this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
1906
+					$this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
1907
+					$this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
1908 1908
 				}
1909 1909
 				
1910 1910
 				if (isset($globalArchiveYear) && $globalArchiveYear) {
@@ -1913,7 +1913,7 @@  discard block
 block discarded – undo
1913 1913
 						try {
1914 1914
 							$sth = $this->db->prepare($query);
1915 1915
 							$sth->execute();
1916
-						} catch(PDOException $e) {
1916
+						} catch (PDOException $e) {
1917 1917
 							return "error : ".$e->getMessage().' - query : '.$query."\n";
1918 1918
 						}
1919 1919
 					}
@@ -1922,15 +1922,15 @@  discard block
 block discarded – undo
1922 1922
 					try {
1923 1923
 						$sth = $this->db->prepare($query);
1924 1924
 						$sth->execute();
1925
-					} catch(PDOException $e) {
1925
+					} catch (PDOException $e) {
1926 1926
 						return "error : ".$e->getMessage().' - query : '.$query."\n";
1927 1927
 					}
1928 1928
 				}
1929 1929
 				if (isset($globalDeleteLastYearStats) && $globalDeleteLastYearStats) {
1930 1930
 					$last_update = $this->getLastStatsUpdate('last_update_stats');
1931
-					if (date('Y',strtotime($last_update[0]['value'])) != date('Y')) {
1931
+					if (date('Y', strtotime($last_update[0]['value'])) != date('Y')) {
1932 1932
 						$this->deleteOldStats();
1933
-						$this->addLastStatsUpdate('last_update_stats',date('Y').'-01-01 00:00:00');
1933
+						$this->addLastStatsUpdate('last_update_stats', date('Y').'-01-01 00:00:00');
1934 1934
 						$lastyearupdate = true;
1935 1935
 					}
1936 1936
 				}
@@ -1952,7 +1952,7 @@  discard block
 block discarded – undo
1952 1952
 					try {
1953 1953
 						$sth = $this->db->prepare($query);
1954 1954
 						$sth->execute();
1955
-					} catch(PDOException $e) {
1955
+					} catch (PDOException $e) {
1956 1956
 						return "error : ".$e->getMessage();
1957 1957
 					}
1958 1958
 				}
@@ -1966,14 +1966,14 @@  discard block
 block discarded – undo
1966 1966
 				try {
1967 1967
 					$sth = $this->db->prepare($query);
1968 1968
 					$sth->execute();
1969
-				} catch(PDOException $e) {
1969
+				} catch (PDOException $e) {
1970 1970
 					return "error : ".$e->getMessage();
1971 1971
 				}
1972 1972
 			}
1973 1973
 			if (!isset($lastyearupdate)) {
1974 1974
 				echo 'Insert last stats update date...'."\n";
1975 1975
 				date_default_timezone_set('UTC');
1976
-				$this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s'));
1976
+				$this->addLastStatsUpdate('last_update_stats', date('Y-m-d G:i:s'));
1977 1977
 			}
1978 1978
 			if ($globalStatsResetYear) {
1979 1979
 				require_once(dirname(__FILE__).'../install/class.settings.php');
Please login to merge, or discard this patch.
accident-latest.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 $page_url = $globalURL.'/accident-latest';
10 10
 
11
-if(!isset($_GET['limit']))
11
+if (!isset($_GET['limit']))
12 12
 {
13 13
 	$limit_start = 0;
14 14
 	$limit_end = 25;
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
 print '<div class="table column">';
35 35
 print '<p>'._("The table below shows the latest Accidents.").'</p>';
36
-$spotter_array = $Accident->getAccidentData($limit_start.",".$absolute_difference,'accident');
36
+$spotter_array = $Accident->getAccidentData($limit_start.",".$absolute_difference, 'accident');
37 37
 //print_r($spotter_array);
38 38
 if (!empty($spotter_array) && isset($spotter_array[0]['query_number_rows']) && $spotter_array[0]['query_number_rows'] != 0) {
39 39
 	include('table-output.php');
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,8 +58,12 @@
 block discarded – undo
58 58
 if (!empty($spotter_array) && isset($spotter_array[0]['query_number_rows']) && $spotter_array[0]['query_number_rows'] != 0) {
59 59
 	include('table-output.php');
60 60
 	print '<div class="pagination">';
61
-	if ($limit_previous_1 >= 0) print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'">&laquo;'._("Previous Page").'</a>';
62
-	if ($spotter_array[0]['query_number_rows'] == $absolute_difference) print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'">'._("Next Page").'&raquo;</a>';
61
+	if ($limit_previous_1 >= 0) {
62
+		print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'">&laquo;'._("Previous Page").'</a>';
63
+	}
64
+	if ($spotter_array[0]['query_number_rows'] == $absolute_difference) {
65
+		print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'">'._("Next Page").'&raquo;</a>';
66
+	}
63 67
 	print '</div>';
64 68
 }
65 69
 print '</div>';
Please login to merge, or discard this patch.