Completed
Push — master ( b8fcbd...e238bb )
by Yannick
05:29
created
require/libs/Predict/Predict/Vector.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@
 block discarded – undo
6 6
  */
7 7
 class Predict_Vector
8 8
 {
9
-    public $x = 0;
10
-    public $y = 0;
11
-    public $z = 0;
12
-    public $w = 0;
9
+	public $x = 0;
10
+	public $y = 0;
11
+	public $z = 0;
12
+	public $w = 0;
13 13
 }
Please login to merge, or discard this patch.
require/class.Satellite.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 		try {
20 20
 			$sth = $this->db->prepare($query);
21 21
 			$sth->execute(array(':name' => $name));
22
-		} catch(PDOException $e) {
22
+		} catch (PDOException $e) {
23 23
 			echo $e->getMessage();
24 24
 		}
25 25
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 		try {
32 32
 			$sth = $this->db->prepare($query);
33 33
 			$sth->execute();
34
-		} catch(PDOException $e) {
34
+		} catch (PDOException $e) {
35 35
 			echo $e->getMessage();
36 36
 		}
37 37
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 		try {
44 44
 			$sth = $this->db->prepare($query);
45 45
 			$sth->execute();
46
-		} catch(PDOException $e) {
46
+		} catch (PDOException $e) {
47 47
 			echo $e->getMessage();
48 48
 		}
49 49
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 		try {
56 56
 			$sth = $this->db->prepare($query);
57 57
 			$sth->execute(array(':type' => $type));
58
-		} catch(PDOException $e) {
58
+		} catch (PDOException $e) {
59 59
 			echo $e->getMessage();
60 60
 		}
61 61
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -63,27 +63,27 @@  discard block
 block discarded – undo
63 63
 		else return array();
64 64
 	}
65 65
 	
66
-	public function position_all($timestamp_begin = '',$timestamp_end = '',$second = 10) {
66
+	public function position_all($timestamp_begin = '', $timestamp_end = '', $second = 10) {
67 67
 		$all_sat = $this->get_tle_names();
68 68
 		$result = array();
69 69
 		foreach ($all_sat as $sat) {
70
-			$position = $this->position($sat['tle_name'],$timestamp_begin,$timestamp_end,$second);
71
-			$result = array_merge($position,$result);
70
+			$position = $this->position($sat['tle_name'], $timestamp_begin, $timestamp_end, $second);
71
+			$result = array_merge($position, $result);
72 72
 		}
73 73
 		return $result;
74 74
 	}
75 75
 
76
-	public function position_all_type($type,$timestamp_begin = '',$timestamp_end = '',$second = 10) {
76
+	public function position_all_type($type, $timestamp_begin = '', $timestamp_end = '', $second = 10) {
77 77
 		$all_sat = $this->get_tle_names_type($type);
78 78
 		$result = array();
79 79
 		foreach ($all_sat as $sat) {
80
-			$position = $this->position($sat['tle_name'],$timestamp_begin,$timestamp_end,$second);
81
-			$result = array_merge($position,$result);
80
+			$position = $this->position($sat['tle_name'], $timestamp_begin, $timestamp_end, $second);
81
+			$result = array_merge($position, $result);
82 82
 		}
83 83
 		return $result;
84 84
 	}
85 85
 	
86
-	public function position($name,$timestamp_begin = '',$timestamp_end = '',$second = 10) {
86
+	public function position($name, $timestamp_begin = '', $timestamp_end = '', $second = 10) {
87 87
 		$qth = new Predict_QTH();
88 88
 		$qth->lat = 37.790252;
89 89
 		$qth->lon = -122.419968;
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 		$tle_file = $this->get_tle($name);
92 92
 		//print_r($tle_file);
93 93
 		$type = $tle_file['tle_type'];
94
-		$tle = new Predict_TLE($tle_file['tle_name'],$tle_file['tle_tle1'],$tle_file['tle_tle2']);
94
+		$tle = new Predict_TLE($tle_file['tle_name'], $tle_file['tle_tle1'], $tle_file['tle_tle2']);
95 95
 		$sat = new Predict_Sat($tle);
96 96
 		$predict = new Predict();
97 97
 		//if ($timestamp == '') $now = Predict_Time::get_current_daynum();
@@ -99,15 +99,15 @@  discard block
 block discarded – undo
99 99
 		if ($timestamp_end == '') {
100 100
 			$now = Predict_Time::unix2daynum($timestamp_begin);
101 101
 			//echo $now;
102
-			$predict->predict_calc($sat,$qth,$now);
103
-			return array('name' => $name, 'latitude' => $sat->ssplat,'longitude' => $sat->ssplon, 'altitude' => $sat->alt,'speed' => $sat->velo*60*60,'timestamp' => $timestamp_begin,'type' => $type);
102
+			$predict->predict_calc($sat, $qth, $now);
103
+			return array('name' => $name, 'latitude' => $sat->ssplat, 'longitude' => $sat->ssplon, 'altitude' => $sat->alt, 'speed' => $sat->velo*60*60, 'timestamp' => $timestamp_begin, 'type' => $type);
104 104
 		} else {
105
-			for ($timestamp = $timestamp_begin; $timestamp <= $timestamp_end; $timestamp=$timestamp+$second) {
105
+			for ($timestamp = $timestamp_begin; $timestamp <= $timestamp_end; $timestamp = $timestamp + $second) {
106 106
 				//echo $timestamp."\n";
107 107
 				$now = Predict_Time::unix2daynum($timestamp);
108 108
 				//echo $now;
109
-				$predict->predict_calc($sat,$qth,$now);
110
-				$result[] = array('name' => $name,'latitude' => $sat->ssplat,'longitude' => $sat->ssplon, 'altitude' => $sat->alt,'speed' => $sat->velo*60*60,'timestamp' => $timestamp,'type' => $type);
109
+				$predict->predict_calc($sat, $qth, $now);
110
+				$result[] = array('name' => $name, 'latitude' => $sat->ssplat, 'longitude' => $sat->ssplon, 'altitude' => $sat->alt, 'speed' => $sat->velo*60*60, 'timestamp' => $timestamp, 'type' => $type);
111 111
 			}
112 112
 			return $result;
113 113
 		}
Please login to merge, or discard this patch.
Braces   +23 added lines, -9 removed lines patch added patch discarded remove patch
@@ -23,8 +23,11 @@  discard block
 block discarded – undo
23 23
 			echo $e->getMessage();
24 24
 		}
25 25
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
26
-		if (isset($result[0])) return $result[0];
27
-		else return array();
26
+		if (isset($result[0])) {
27
+			return $result[0];
28
+		} else {
29
+			return array();
30
+		}
28 31
 	}
29 32
 	public function get_tle_types() {
30 33
 		$query = 'SELECT DISTINCT tle_type FROM tle ORDER BY tle_type';
@@ -35,8 +38,11 @@  discard block
 block discarded – undo
35 38
 			echo $e->getMessage();
36 39
 		}
37 40
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
38
-		if (isset($result[0])) return $result;
39
-		else return array();
41
+		if (isset($result[0])) {
42
+			return $result;
43
+		} else {
44
+			return array();
45
+		}
40 46
 	}
41 47
 	public function get_tle_names() {
42 48
 		$query = 'SELECT DISTINCT tle_name, tle_type FROM tle';
@@ -47,8 +53,11 @@  discard block
 block discarded – undo
47 53
 			echo $e->getMessage();
48 54
 		}
49 55
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
50
-		if (isset($result[0])) return $result;
51
-		else return array();
56
+		if (isset($result[0])) {
57
+			return $result;
58
+		} else {
59
+			return array();
60
+		}
52 61
 	}
53 62
 	public function get_tle_names_type($type) {
54 63
 		$query = 'SELECT tle_name, tle_type FROM tle WHERE tle_type = :type ORDER BY tle_name';
@@ -59,8 +68,11 @@  discard block
 block discarded – undo
59 68
 			echo $e->getMessage();
60 69
 		}
61 70
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
62
-		if (isset($result[0])) return $result;
63
-		else return array();
71
+		if (isset($result[0])) {
72
+			return $result;
73
+		} else {
74
+			return array();
75
+		}
64 76
 	}
65 77
 	
66 78
 	public function position_all($timestamp_begin = '',$timestamp_end = '',$second = 10) {
@@ -95,7 +107,9 @@  discard block
 block discarded – undo
95 107
 		$sat = new Predict_Sat($tle);
96 108
 		$predict = new Predict();
97 109
 		//if ($timestamp == '') $now = Predict_Time::get_current_daynum();
98
-		if ($timestamp_begin == '') $timestamp_begin = time();
110
+		if ($timestamp_begin == '') {
111
+			$timestamp_begin = time();
112
+		}
99 113
 		if ($timestamp_end == '') {
100 114
 			$now = Predict_Time::unix2daynum($timestamp_begin);
101 115
 			//echo $now;
Please login to merge, or discard this patch.
install/populate_all.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -1,48 +1,48 @@
 block discarded – undo
1 1
 #!/usr/bin/php
2 2
 <?php
3
-    require_once('../require/settings.php');
4
-    if ($globalInstalled) {
5
-        echo '$globalInstalled must be set to FALSE in require/settings.php';
6
-        exit;
7
-    }
8
-    require('class.update_db.php');
9
-    echo "Populate all tables...\n";
10
-    update_db::update_all();
11
-    echo "\nInstall waypoints...(VERY slow!)";
12
-    update_db::update_waypoints();
13
-    echo "Done !\n";
14
-    echo "Install airspace...";
15
-    update_db::update_airspace();
16
-    echo "Done !\n";
17
-    echo "Install countries...";
18
-    update_db::update_countries();
19
-    echo "Done !\n";
20
-    if (isset($globalOwner) && $globalOwner) {
3
+	require_once('../require/settings.php');
4
+	if ($globalInstalled) {
5
+		echo '$globalInstalled must be set to FALSE in require/settings.php';
6
+		exit;
7
+	}
8
+	require('class.update_db.php');
9
+	echo "Populate all tables...\n";
10
+	update_db::update_all();
11
+	echo "\nInstall waypoints...(VERY slow!)";
12
+	update_db::update_waypoints();
13
+	echo "Done !\n";
14
+	echo "Install airspace...";
15
+	update_db::update_airspace();
16
+	echo "Done !\n";
17
+	echo "Install countries...";
18
+	update_db::update_countries();
19
+	echo "Done !\n";
20
+	if (isset($globalOwner) && $globalOwner) {
21 21
 	echo "Install private owners...";
22 22
 	update_db::update_owner();
23
-        echo "Done !\n";
24
-    }
25
-    /*
23
+		echo "Done !\n";
24
+	}
25
+	/*
26 26
     if (isset($globalIVAO) && $globalIVAO) {
27 27
         echo "Install IVAO airlines and logos...";
28 28
         update_db::update_IVAO();
29 29
 	echo "Done !\n";
30 30
     }
31 31
     */
32
-    if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') {
32
+	if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') {
33 33
 	echo "Install NOTAM from notaminfo.com...";
34
-        update_db:update_notam();
35
-        echo "Done !\n";
36
-    }
37
-    if (isset($globalMap3D) && $globalMap3D) {
34
+		update_db:update_notam();
35
+		echo "Done !\n";
36
+	}
37
+	if (isset($globalMap3D) && $globalMap3D) {
38 38
 	echo "Install 3D models...";
39 39
 	update_db::update_models();
40 40
 	echo "Done !\n";
41 41
 	if (isset($globalMapSatellites) && $globalMapSatellites) {
42
-	    echo "Install Space 3D models...";
43
-	    update_db::update_space_models();
44
-	    echo "Done !\n";
45
-        }
46
-    }
42
+		echo "Install Space 3D models...";
43
+		update_db::update_space_models();
44
+		echo "Done !\n";
45
+		}
46
+	}
47 47
 
48 48
 ?>
49 49
\ No newline at end of file
Please login to merge, or discard this patch.
header.php 3 patches
Braces   +32 added lines, -7 removed lines patch added patch discarded remove patch
@@ -5,8 +5,11 @@  discard block
 block discarded – undo
5 5
 $file_path = pathinfo($_SERVER['SCRIPT_NAME']);
6 6
 $current_page = $file_path['filename'];
7 7
 date_default_timezone_set($globalTimezone);
8
-if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') $MapType = $_COOKIE['MapType'];
9
-else $MapType = $globalMapProvider;
8
+if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') {
9
+	$MapType = $_COOKIE['MapType'];
10
+} else {
11
+	$MapType = $globalMapProvider;
12
+}
10 13
 ?>
11 14
 <!DOCTYPE html>
12 15
 <html>
@@ -181,7 +184,13 @@  discard block
 block discarded – undo
181 184
 <script src="<?php print $globalURL; ?>/js/Marker.Rotate.js"></script>
182 185
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
183 186
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
184
-<script src="<?php print $globalURL; ?>/js/map.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
187
+<script src="<?php print $globalURL; ?>/js/map.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) {
188
+	print '&latitude='.$latitude;
189
+}
190
+?><?php if(isset($longitude)) {
191
+	print '&longitude='.$longitude;
192
+}
193
+?>&<?php print time(); ?>"></script>
185 194
 <?php
186 195
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
187 196
 ?>
@@ -235,7 +244,13 @@  discard block
 block discarded – undo
235 244
 <script src="<?php print $globalURL; ?>/js/Marker.Rotate.js"></script>
236 245
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
237 246
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
238
-<script src="<?php print $globalURL; ?>/js/map.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
247
+<script src="<?php print $globalURL; ?>/js/map.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) {
248
+	print '&latitude='.$latitude;
249
+}
250
+?><?php if(isset($longitude)) {
251
+	print '&longitude='.$longitude;
252
+}
253
+?>&<?php print time(); ?>"></script>
239 254
 <?php
240 255
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
241 256
 ?>
@@ -308,7 +323,12 @@  discard block
 block discarded – undo
308 323
         <span class="icon-bar"></span>
309 324
       </button>
310 325
       <a href="<?php print $globalURL; ?>/search" class="navbar-toggle navbar-toggle-search"><i class="fa fa-search"></i></a>
311
-      <a class="navbar-brand" href="<?php if ($globalURL == '') print '/'; else print $globalURL; ?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
326
+      <a class="navbar-brand" href="<?php if ($globalURL == '') {
327
+	print '/';
328
+} else {
329
+	print $globalURL;
330
+}
331
+?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
312 332
     </div>
313 333
     <div class="collapse navbar-collapse">
314 334
       <ul class="nav navbar-nav">
@@ -386,7 +406,9 @@  discard block
 block discarded – undo
386 406
   		        $alllang = $Language->getLanguages();
387 407
   		        foreach ($alllang as $key => $lang) {
388 408
   		            print '<option value="'.$key.'"';
389
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
409
+  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) {
410
+  		            	print ' selected ';
411
+  		            }
390 412
   		            print '>'.$lang[0].'</option>';
391 413
   		        }
392 414
   		    ?>
@@ -533,4 +555,7 @@  discard block
 block discarded – undo
533 555
 
534 556
 ?>
535 557
 
536
-<section class="container main-content <?php if (strtolower($current_page) == 'index') print 'index '; ?>clear">
558
+<section class="container main-content <?php if (strtolower($current_page) == 'index') {
559
+	print 'index ';
560
+}
561
+?>clear">
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -8,31 +8,31 @@  discard block
 block discarded – undo
8 8
 if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') $MapType = $_COOKIE['MapType'];
9 9
 else $MapType = $globalMapProvider;
10 10
 if (isset($_GET['3d'])) {
11
-	setcookie('MapFormat','3d');
11
+	setcookie('MapFormat', '3d');
12 12
 } else if (isset($_GET['2d'])) {
13
-	setcookie('MapFormat','2d');
13
+	setcookie('MapFormat', '2d');
14 14
 }
15 15
 
16 16
 if (isset($_POST['archive'])) {
17
-	setcookie('archive','true');
18
-	setcookie('archive_begin',strtotime($_POST['start_date']));
19
-	setcookie('archive_end',strtotime($_POST['end_date']));
20
-	setcookie('archive_speed',$_POST['archivespeed']);
17
+	setcookie('archive', 'true');
18
+	setcookie('archive_begin', strtotime($_POST['start_date']));
19
+	setcookie('archive_end', strtotime($_POST['end_date']));
20
+	setcookie('archive_speed', $_POST['archivespeed']);
21 21
 }
22 22
 if (isset($_POST['noarchive'])) {
23
-	setcookie('archive','false',-1);
24
-	setcookie('archive_begin','',-1);
25
-	setcookie('archive_end','',-1);
26
-	setcookie('archive_speed','',-1);
23
+	setcookie('archive', 'false', -1);
24
+	setcookie('archive_begin', '', -1);
25
+	setcookie('archive_end', '', -1);
26
+	setcookie('archive_speed', '', -1);
27 27
 }
28 28
 // When button "Remove all filters" is clicked
29 29
 if (isset($_POST['removefilters'])) {
30
-	$allfilters = array_filter(array_keys($_COOKIE),function($key) {
31
-	    return strpos($key,'filter_') === 0;
30
+	$allfilters = array_filter(array_keys($_COOKIE), function($key) {
31
+	    return strpos($key, 'filter_') === 0;
32 32
 	});
33 33
 	foreach ($allfilters as $filt) {
34 34
 		unset($_COOKIE[$filt]);
35
-		setcookie($filt,null,-1);
35
+		setcookie($filt, null, -1);
36 36
 	}
37 37
 }
38 38
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 <script src="<?php print $globalURL; ?>/js/Marker.Rotate.js"></script>
217 217
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
218 218
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
219
-<script src="<?php print $globalURL; ?>/js/map.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
219
+<script src="<?php print $globalURL; ?>/js/map.js.php?ident=<?php print $ident; ?><?php if (isset($latitude)) print '&latitude='.$latitude; ?><?php if (isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
220 220
 <?php
221 221
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
222 222
 ?>
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 <script src="<?php print $globalURL; ?>/js/Marker.Rotate.js"></script>
271 271
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
272 272
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
273
-<script src="<?php print $globalURL; ?>/js/map.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
273
+<script src="<?php print $globalURL; ?>/js/map.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if (isset($latitude)) print '&latitude='.$latitude; ?><?php if (isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
274 274
 <?php
275 275
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
276 276
 ?>
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 ?>
434 434
       <div class="search">
435 435
       <form action="<?php print $globalURL; ?>/search" method="get">
436
-		<input type="text" name="q" value="<?php if (isset($GET['q'])) { if ($_GET['q'] != ""){ print $_GET['q']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button>
436
+		<input type="text" name="q" value="<?php if (isset($GET['q'])) { if ($_GET['q'] != "") { print $_GET['q']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button>
437 437
 	</form>
438 438
 	</div>
439 439
   	<div class="social">
@@ -451,14 +451,14 @@  discard block
 block discarded – undo
451 451
 	print '</div>';
452 452
 }
453 453
 
454
-if (strtolower($current_page) =='ident-detailed' || strtolower($current_page) == 'flightid-overview') {
454
+if (strtolower($current_page) == 'ident-detailed' || strtolower($current_page) == 'flightid-overview') {
455 455
 ?>
456 456
     <div class="top-header clear" role="main">
457 457
     <div id="archive-map"></div>
458 458
     </div>
459 459
 <?php
460 460
 }
461
-if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false))
461
+if ((strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false) || (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false))
462 462
 {
463 463
     ?>
464 464
     <div class="top-header clear" role="main">
@@ -471,15 +471,15 @@  discard block
 block discarded – undo
471 471
         var zoom = 13;
472 472
 //create the map
473 473
 <?php
474
-    if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
474
+    if (strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false && isset($airport_array[0]['latitude'])) {
475 475
 ?>
476 476
   map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom);
477 477
 <?php
478
-    } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
478
+    } elseif (strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false) {
479 479
 ?>
480 480
   map = L.map('map', { zoomControl:true });
481 481
 <?php
482
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
482
+    } elseif (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
483 483
 ?>
484 484
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]);
485 485
     var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map);
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
     var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
488 488
     var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
489 489
 <?php
490
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) {
490
+    } elseif (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) {
491 491
 ?>
492 492
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]);
493 493
 <?php
Please login to merge, or discard this patch.
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 // When button "Remove all filters" is clicked
29 29
 if (isset($_POST['removefilters'])) {
30 30
 	$allfilters = array_filter(array_keys($_COOKIE),function($key) {
31
-	    return strpos($key,'filter_') === 0;
31
+		return strpos($key,'filter_') === 0;
32 32
 	});
33 33
 	foreach ($allfilters as $filt) {
34 34
 		unset($_COOKIE[$filt]);
@@ -167,16 +167,16 @@  discard block
 block discarded – undo
167 167
 	}
168 168
 ?>
169 169
 <?php 
170
-    if (isset($_POST['archive'])) {
170
+	if (isset($_POST['archive'])) {
171 171
 ?>
172 172
 <?php 
173
-	    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
173
+		if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
174 174
 ?>
175 175
 
176 176
 <script src="<?php print $globalURL; ?>/js/map.js.php?<?php print time(); ?>&archive&begindate=<?php print strtotime($_POST['start_date']); ?>&enddate=<?php print strtotime($_POST['end_date']); ?>&archivespeed=<?php print $_POST['archivespeed']; ?>"></script>
177 177
 <?php    
178
-	    }
179
-    } else {
178
+		}
179
+	} else {
180 180
 ?>
181 181
 <?php
182 182
 /*	if (isset($globalBeta) && $globalBeta) {
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 */
189 189
 ?>
190 190
 <?php 
191
-	    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
191
+		if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
192 192
 ?>
193 193
 <?php
194 194
 //		if (isset($globalBeta) && $globalBeta) {
@@ -199,13 +199,13 @@  discard block
 block discarded – undo
199 199
 ?>
200 200
 <script src="<?php print $globalURL; ?>/js/map.js.php?<?php print time(); ?>"></script>
201 201
 <?php
202
-	    }
202
+		}
203 203
 ?>
204 204
 <?php
205 205
 //	}
206 206
 ?>
207 207
 <?php
208
-    }
208
+	}
209 209
 }
210 210
 ?>
211 211
 <?php
@@ -365,32 +365,32 @@  discard block
 block discarded – undo
365 365
             <li><a href="<?php print $globalURL; ?>/date/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Activity"); ?></a></li>
366 366
             <li><a href="<?php print $globalURL; ?>/newest"><?php echo _("Newest by Category"); ?></a></li>
367 367
             <?php
368
-        	if ($globalACARS) {
369
-        	    if (isset($globalDemo) && $globalDemo) {
370
-    	    ?>
368
+			if ($globalACARS) {
369
+				if (isset($globalDemo) && $globalDemo) {
370
+			?>
371 371
             <li><hr /></li>
372 372
             <li><i><?php echo _('ACARS data not available publicly'); ?></i></li>
373 373
             <li><a href=""><?php echo _('Latest ACARS messages'); ?></a></li>
374 374
             <li><a href=""><?php echo _('Archive ACARS messages'); ?></a></li>
375 375
             <?php
376
-        	    } else {
377
-    	    ?>
376
+				} else {
377
+			?>
378 378
             <li><hr /></li>
379 379
             <li><a href="<?php print $globalURL; ?>/acars-latest"><?php echo _("Latest ACARS messages"); ?></a></li>
380 380
             <li><a href="<?php print $globalURL; ?>/acars-archive"><?php echo _("Archive ACARS messages"); ?></a></li>
381 381
             <?php
382
-        	    }
383
-        	}
384
-    	    ?>
382
+				}
383
+			}
384
+			?>
385 385
     	    <?php
386
-    	        if (isset($globalAccidents) && $globalAccidents) {
387
-    	    ?>
386
+				if (isset($globalAccidents) && $globalAccidents) {
387
+			?>
388 388
             <li><hr /></li>
389 389
             <li><a href="<?php print $globalURL; ?>/accident-latest"><?php echo _("Latest accident messages"); ?></a></li>
390 390
             <li><a href="<?php print $globalURL; ?>/incident-latest"><?php echo _("Latest incident messages"); ?></a></li>
391 391
             <?php
392
-        	}
393
-    	    ?>
392
+			}
393
+			?>
394 394
             <li><hr /></li>
395 395
             <li><a href="<?php print $globalURL; ?>/highlights/table"><?php echo _("Special Highlights"); ?></a></li>
396 396
             <li><a href="<?php print $globalURL; ?>/upcoming"><?php echo _("Upcoming Flights"); ?></a></li>
@@ -432,14 +432,14 @@  discard block
 block discarded – undo
432 432
   	    <form>
433 433
   		<select class="selectpicker" data-width="120px" onchange="language(this);">
434 434
   		    <?php
435
-  		        $Language = new Language();
436
-  		        $alllang = $Language->getLanguages();
437
-  		        foreach ($alllang as $key => $lang) {
438
-  		            print '<option value="'.$key.'"';
439
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
440
-  		            print '>'.$lang[0].'</option>';
441
-  		        }
442
-  		    ?>
435
+  				$Language = new Language();
436
+  				$alllang = $Language->getLanguages();
437
+  				foreach ($alllang as $key => $lang) {
438
+  					print '<option value="'.$key.'"';
439
+  					if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
440
+  					print '>'.$lang[0].'</option>';
441
+  				}
442
+  			?>
443 443
   		</select>
444 444
   	    </form>
445 445
   	</div>
@@ -470,18 +470,18 @@  discard block
 block discarded – undo
470 470
 ?>
471 471
     <div class="top-header clear" role="main">
472 472
 <?php
473
-    if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) {
473
+	if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) {
474 474
 ?>
475 475
     <div id="archive-map"></div>
476 476
 <?php
477
-    }
477
+	}
478 478
 ?>
479 479
     </div>
480 480
 <?php
481 481
 }
482 482
 if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false))
483 483
 {
484
-    ?>
484
+	?>
485 485
     <div class="top-header clear" role="main">
486 486
         <div id="map"></div>
487 487
 	<link rel="stylesheet" href="<?php print $globalURL; ?>/css/leaflet.css" />
@@ -492,15 +492,15 @@  discard block
 block discarded – undo
492 492
         var zoom = 13;
493 493
 //create the map
494 494
 <?php
495
-    if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
495
+	if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
496 496
 ?>
497 497
   map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom);
498 498
 <?php
499
-    } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
499
+	} elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
500 500
 ?>
501 501
   map = L.map('map', { zoomControl:true });
502 502
 <?php
503
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
503
+	} elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
504 504
 ?>
505 505
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]);
506 506
     var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map);
@@ -508,22 +508,22 @@  discard block
 block discarded – undo
508 508
     var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
509 509
     var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
510 510
 <?php
511
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) {
511
+	} elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) {
512 512
 ?>
513 513
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]);
514 514
 <?php
515
-    } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) {
515
+	} elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) {
516 516
 ?>
517 517
   map = L.map('map', { zoomControl:true });
518 518
 <?php
519
-    }
519
+	}
520 520
 ?>
521 521
   //initialize the layer group for the aircrft markers
522 522
   var layer_data = L.layerGroup();
523 523
 
524 524
   //a few title layers
525 525
 <?php
526
-    if ($globalMapProvider == 'Mapbox') {
526
+	if ($globalMapProvider == 'Mapbox') {
527 527
 ?>
528 528
   L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', {
529 529
     maxZoom: 18,
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
     token : '<?php print $globalMapboxToken; ?>'
535 535
   }).addTo(map);
536 536
 <?php
537
-    } elseif ($globalMapProvider == 'OpenStreetMap') {
537
+	} elseif ($globalMapProvider == 'OpenStreetMap') {
538 538
 ?>
539 539
   L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
540 540
     maxZoom: 18,
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
       '<a href="http://www.openstreetmap.org/copyright">Open Database Licence</a>'
543 543
   }).addTo(map);
544 544
 <?php
545
-    } elseif ($globalMapProvider == 'MapQuest-OSM') {
545
+	} elseif ($globalMapProvider == 'MapQuest-OSM') {
546 546
 ?>
547 547
   L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', {
548 548
     maxZoom: 18,
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
       'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>'
552 552
   }).addTo(map);
553 553
 <?php
554
-    } elseif ($globalMapProvider == 'MapQuest-Aerial') {
554
+	} elseif ($globalMapProvider == 'MapQuest-Aerial') {
555 555
 ?>
556 556
   L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png', {
557 557
     maxZoom: 18,
@@ -560,27 +560,27 @@  discard block
 block discarded – undo
560 560
       'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>, Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency"'
561 561
   }).addTo(map);
562 562
 <?php
563
-    } elseif ($globalMapProvider == 'Google-Roadmap') {
563
+	} elseif ($globalMapProvider == 'Google-Roadmap') {
564 564
 ?>
565 565
     var googleLayer = new L.Google('ROADMAP');
566 566
     map.addLayer(googleLayer);
567 567
 <?php
568
-    } elseif ($globalMapProvider == 'Google-Satellite') {
568
+	} elseif ($globalMapProvider == 'Google-Satellite') {
569 569
 ?>
570 570
     var googleLayer = new L.Google('SATELLITE');
571 571
     map.addLayer(googleLayer);
572 572
 <?php
573
-    } elseif ($globalMapProvider == 'Google-Hybrid') {
573
+	} elseif ($globalMapProvider == 'Google-Hybrid') {
574 574
 ?>
575 575
     var googleLayer = new L.Google('HYBRID');
576 576
     map.addLayer(googleLayer);
577 577
 <?php
578
-    } elseif ($globalMapProvider == 'Google-Terrain') {
578
+	} elseif ($globalMapProvider == 'Google-Terrain') {
579 579
 ?>
580 580
     var googleLayer = new L.Google('Terrain');
581 581
     map.addLayer(googleLayer);
582 582
 <?php
583
-    }
583
+	}
584 584
 ?>
585 585
         </script>
586 586
     </div>
Please login to merge, or discard this patch.
live-sat-czml.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -20,17 +20,17 @@  discard block
 block discarded – undo
20 20
 
21 21
 $spotter_array = array();
22 22
 if (isset($_COOKIE['sattypes']) && $_COOKIE['sattypes'] != '') {
23
-	$sattypes = explode(',',$_COOKIE['sattypes']);
23
+	$sattypes = explode(',', $_COOKIE['sattypes']);
24 24
 	foreach ($sattypes as $sattype) {
25
-		$spotter_array = array_merge($Satellite->position_all_type($sattype,$timeb-$globalLiveInterval,$timeb),$spotter_array);
25
+		$spotter_array = array_merge($Satellite->position_all_type($sattype, $timeb - $globalLiveInterval, $timeb), $spotter_array);
26 26
 	}
27 27
 }
28 28
 if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss']) {
29
-	$spotter_array = array_merge($Satellite->position('ISS (ZARYA)',time()-$globalLiveInterval,time()),$spotter_array);
30
-	$spotter_array = array_merge($Satellite->position('TIANGONG 1',time()-$globalLiveInterval,time()),$spotter_array);
31
-	$spotter_array = array_merge($Satellite->position('TIANGONG-2',time()-$globalLiveInterval,time()),$spotter_array);
29
+	$spotter_array = array_merge($Satellite->position('ISS (ZARYA)', time() - $globalLiveInterval, time()), $spotter_array);
30
+	$spotter_array = array_merge($Satellite->position('TIANGONG 1', time() - $globalLiveInterval, time()), $spotter_array);
31
+	$spotter_array = array_merge($Satellite->position('TIANGONG-2', time() - $globalLiveInterval, time()), $spotter_array);
32 32
 }
33
-$spotter_array = array_unique($spotter_array,SORT_REGULAR);
33
+$spotter_array = array_unique($spotter_array, SORT_REGULAR);
34 34
 /*
35 35
 $modelsdb = array();
36 36
 if (file_exists('models/space/space_modelsdb')) {
@@ -54,14 +54,14 @@  discard block
 block discarded – undo
54 54
 //	$output .= ',"clock": {"interval" : "'.date("c",time()-$globalLiveInterval).'/'.date("c").'","currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"range" : "LOOP_STOP","step": "SYSTEM_CLOCK_MULTIPLIER"}';
55 55
 
56 56
 //	$output .= ',"clock": {"interval" : "'.date("c",time()-$globalLiveInterval).'/'.date("c").'","currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}';
57
-$output .= ',"clock": {"currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}';
57
+$output .= ',"clock": {"currentTime" : "'.date("c", time() - $globalLiveInterval).'","multiplier" : 1,"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}';
58 58
 //$output .= ',"clock": {"currentTime" : "%minitime%","multiplier" : 1,"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}';
59 59
 
60 60
 //	$output .= ',"clock": {"interval" : "'.date("c",time()-$globalLiveInterval).'/'.date("c").'","currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"step": "SYSTEM_CLOCK_MULTIPLIER"}';
61 61
 $output .= '},';
62 62
 if (!empty($spotter_array) && is_array($spotter_array))
63 63
 {
64
-	foreach($spotter_array as $spotter_item)
64
+	foreach ($spotter_array as $spotter_item)
65 65
 	{
66 66
 		$j++;
67 67
 		date_default_timezone_set('UTC');
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 			$orientation = '';
77 77
 			$prev_satname = $spotter_item['name'];
78 78
 			$output .= '{';
79
-			$output .= '"id": "'.trim(str_replace(array('[+]','[-]'),'',$spotter_item['name'])).'",';
79
+			$output .= '"id": "'.trim(str_replace(array('[+]', '[-]'), '', $spotter_item['name'])).'",';
80 80
 			$output .= '"properties": {';
81 81
 			// Not yet supported in CZML with Cesium
82 82
 			$output .= '},';
@@ -114,23 +114,23 @@  discard block
 block discarded – undo
114 114
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/cubiesat.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
115 115
 				} elseif ($spotter_item['name'] == 'TERRA') {
116 116
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/terra.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
117
-				} elseif (strpos($spotter_item['name'],'O3B') !== false) {
117
+				} elseif (strpos($spotter_item['name'], 'O3B') !== false) {
118 118
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/o3b.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
119
-				} elseif (strpos($spotter_item['name'],'GLOBALSTAR') !== false) {
119
+				} elseif (strpos($spotter_item['name'], 'GLOBALSTAR') !== false) {
120 120
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/globalstar.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
121
-				} elseif (strpos($spotter_item['name'],'GPS') !== false) {
121
+				} elseif (strpos($spotter_item['name'], 'GPS') !== false) {
122 122
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/gps.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
123
-				} elseif (strpos($spotter_item['name'],'GENESIS') !== false) {
123
+				} elseif (strpos($spotter_item['name'], 'GENESIS') !== false) {
124 124
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/genesis.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
125
-				} elseif (strpos($spotter_item['name'],'OSCAR 7') !== false) {
125
+				} elseif (strpos($spotter_item['name'], 'OSCAR 7') !== false) {
126 126
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/oscar7.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
127
-				} elseif (strpos($spotter_item['name'],'FLOCK') !== false) {
127
+				} elseif (strpos($spotter_item['name'], 'FLOCK') !== false) {
128 128
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/cubesat.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
129
-				} elseif (strpos($spotter_item['name'],'PLEIADES') !== false) {
129
+				} elseif (strpos($spotter_item['name'], 'PLEIADES') !== false) {
130 130
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/pleiades.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
131
-				} elseif (strpos($spotter_item['name'],'DUCHIFAT') !== false) {
131
+				} elseif (strpos($spotter_item['name'], 'DUCHIFAT') !== false) {
132 132
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/duchifat.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
133
-				} elseif (strpos($spotter_item['name'],'FORMOSAT-2') !== false) {
133
+				} elseif (strpos($spotter_item['name'], 'FORMOSAT-2') !== false) {
134 134
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/formosat2.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
135 135
 				} elseif ($spotter_item['type'] == 'iridium') {
136 136
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/iridium.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
@@ -151,14 +151,14 @@  discard block
 block discarded – undo
151 151
 	//		$output .= '"interpolationDegree" : 5,';
152 152
 	//		$output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", ';
153 153
 			$output .= '"cartographicDegrees": [';
154
-			$output .= '"'.date("c",$spotter_item['timestamp']).'", ';
154
+			$output .= '"'.date("c", $spotter_item['timestamp']).'", ';
155 155
 			$output .= $spotter_item['longitude'].', ';
156 156
 			$output .= $spotter_item['latitude'].', ';
157 157
 			$output .= $spotter_item['altitude']*1000;
158 158
 			$orientation = '"orientation" : { ';
159 159
 			$orientation .= '"unitQuaternion": [';
160 160
 		} else {
161
-			$output .= ',"'.date("c",$spotter_item['timestamp']).'", ';
161
+			$output .= ',"'.date("c", $spotter_item['timestamp']).'", ';
162 162
 			$output .= $spotter_item['longitude'].', ';
163 163
 			$output .= $spotter_item['latitude'].', ';
164 164
 			$output .= $spotter_item['altitude']*1000;
Please login to merge, or discard this patch.
require/class.Stats.php 4 patches
Doc Comments   +32 added lines patch added patch discarded remove patch
@@ -13,6 +13,10 @@  discard block
 block discarded – undo
13 13
 		$this->db = $Connection->db();
14 14
         }
15 15
               
16
+	/**
17
+	 * @param string $type
18
+	 * @param string $stats_date
19
+	 */
16 20
 	public function addLastStatsUpdate($type,$stats_date) {
17 21
                 $query = "DELETE FROM config WHERE name = :type;
18 22
             		INSERT INTO config (name,value) VALUES (:type,:stats_date);";
@@ -578,6 +582,11 @@  discard block
 block discarded – undo
578 582
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
579 583
                 return $all;
580 584
         }
585
+
586
+	/**
587
+	 * @param string $type
588
+	 * @param string $year
589
+	 */
581 590
 	public function getSumStats($type,$year,$stats_airline = '') {
582 591
     		global $globalArchiveMonths, $globalDBdriver;
583 592
     		if ($globalDBdriver == 'mysql') {
@@ -677,6 +686,10 @@  discard block
 block discarded – undo
677 686
                 return $all[0]['total'];
678 687
         }
679 688
 
689
+	/**
690
+	 * @param string $type
691
+	 * @param string $stats_date
692
+	 */
680 693
 	public function addStat($type,$cnt,$stats_date,$stats_airline = '') {
681 694
 		global $globalDBdriver;
682 695
 		if ($globalDBdriver == 'mysql') {
@@ -708,6 +721,10 @@  discard block
 block discarded – undo
708 721
                         return "error : ".$e->getMessage();
709 722
                 }
710 723
         }
724
+
725
+	/**
726
+	 * @param string $date
727
+	 */
711 728
 	public function getStatsSource($date,$stats_type = '') {
712 729
 		if ($stats_type == '') {
713 730
 			$query = "SELECT * FROM stats_source WHERE stats_date = :date ORDER BY source_name";
@@ -726,6 +743,9 @@  discard block
 block discarded – undo
726 743
                 return $all;
727 744
         }
728 745
 
746
+	/**
747
+	 * @param string $stats_type
748
+	 */
729 749
 	public function addStatSource($data,$source_name,$stats_type,$date) {
730 750
 		global $globalDBdriver;
731 751
 		if ($globalDBdriver == 'mysql') {
@@ -741,6 +761,10 @@  discard block
 block discarded – undo
741 761
                         return "error : ".$e->getMessage();
742 762
                 }
743 763
         }
764
+
765
+	/**
766
+	 * @param string $type
767
+	 */
744 768
 	public function addStatFlight($type,$date_name,$cnt,$stats_airline = '') {
745 769
                 $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline) VALUES (:type,:flight_date,:cnt,:stats_airline)";
746 770
                 $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline);
@@ -927,6 +951,10 @@  discard block
 block discarded – undo
927 951
                         return "error : ".$e->getMessage();
928 952
                 }
929 953
         }
954
+
955
+	/**
956
+	 * @param string $type
957
+	 */
930 958
 	public function deleteStatFlight($type) {
931 959
                 $query = "DELETE FROM stats_flight WHERE stats_type = :type";
932 960
                 $query_values = array(':type' => $type);
@@ -937,6 +965,10 @@  discard block
 block discarded – undo
937 965
                         return "error : ".$e->getMessage();
938 966
                 }
939 967
         }
968
+
969
+	/**
970
+	 * @param string $type
971
+	 */
940 972
 	public function deleteStatAirport($type) {
941 973
                 $query = "DELETE FROM stats_airport WHERE stats_type = :type";
942 974
                 $query_values = array(':type' => $type);
Please login to merge, or discard this patch.
Braces   +389 added lines, -135 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@  discard block
 block discarded – undo
12 12
 	
13 13
 	public function __construct($dbc = null) {
14 14
 		global $globalFilterName;
15
-		if (isset($globalFilterName)) $this->filter_name = $globalFilterName;
15
+		if (isset($globalFilterName)) {
16
+			$this->filter_name = $globalFilterName;
17
+		}
16 18
 		$Connection = new Connection($dbc);
17 19
 		$this->db = $Connection->db();
18 20
         }
@@ -77,7 +79,9 @@  discard block
 block discarded – undo
77 79
                 }
78 80
         }
79 81
 	public function getAllAirlineNames($filter_name = '') {
80
-		if ($filter_name == '') $filter_name = $this->filter_name;
82
+		if ($filter_name == '') {
83
+			$filter_name = $this->filter_name;
84
+		}
81 85
                 $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC";
82 86
                  try {
83 87
                         $sth = $this->db->prepare($query);
@@ -89,7 +93,9 @@  discard block
 block discarded – undo
89 93
                 return $all;
90 94
         }
91 95
 	public function getAllAircraftTypes($stats_airline = '',$filter_name = '') {
92
-		if ($filter_name == '') $filter_name = $this->filter_name;
96
+		if ($filter_name == '') {
97
+			$filter_name = $this->filter_name;
98
+		}
93 99
                 $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
94 100
                  try {
95 101
                         $sth = $this->db->prepare($query);
@@ -101,7 +107,9 @@  discard block
 block discarded – undo
101 107
                 return $all;
102 108
         }
103 109
 	public function getAllManufacturers($stats_airline = '',$filter_name = '') {
104
-		if ($filter_name == '') $filter_name = $this->filter_name;
110
+		if ($filter_name == '') {
111
+			$filter_name = $this->filter_name;
112
+		}
105 113
                 $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 114
                  try {
107 115
                         $sth = $this->db->prepare($query);
@@ -113,7 +121,9 @@  discard block
 block discarded – undo
113 121
                 return $all;
114 122
         }
115 123
 	public function getAllAirportNames($stats_airline = '',$filter_name = '') {
116
-		if ($filter_name == '') $filter_name = $this->filter_name;
124
+		if ($filter_name == '') {
125
+			$filter_name = $this->filter_name;
126
+		}
117 127
                 $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 128
                  try {
119 129
                         $sth = $this->db->prepare($query);
@@ -128,9 +138,14 @@  discard block
 block discarded – undo
128 138
 
129 139
 	public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '') {
130 140
 		global $globalStatsFilters;
131
-		if ($filter_name == '') $filter_name = $this->filter_name;
132
-		if ($limit) $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 LIMIT 10 OFFSET 0";
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";
141
+		if ($filter_name == '') {
142
+			$filter_name = $this->filter_name;
143
+		}
144
+		if ($limit) {
145
+			$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 LIMIT 10 OFFSET 0";
146
+		} else {
147
+			$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";
148
+		}
134 149
                  try {
135 150
                         $sth = $this->db->prepare($query);
136 151
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -150,9 +165,14 @@  discard block
 block discarded – undo
150 165
 	}
151 166
 	public function countAllAirlineCountries($limit = true,$filter_name = '') {
152 167
 		global $globalStatsFilters;
153
-		if ($filter_name == '') $filter_name = $this->filter_name;
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";
155
-		else $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";
168
+		if ($filter_name == '') {
169
+			$filter_name = $this->filter_name;
170
+		}
171
+		if ($limit) {
172
+			$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";
173
+		} else {
174
+			$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";
175
+		}
156 176
                  try {
157 177
                         $sth = $this->db->prepare($query);
158 178
                         $sth->execute(array(':filter_name' => $filter_name));
@@ -172,9 +192,14 @@  discard block
 block discarded – undo
172 192
 	}
173 193
 	public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '') {
174 194
 		global $globalStatsFilters;
175
-		if ($filter_name == '') $filter_name = $this->filter_name;
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
-		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";
195
+		if ($filter_name == '') {
196
+			$filter_name = $this->filter_name;
197
+		}
198
+		if ($limit) {
199
+			$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";
200
+		} else {
201
+			$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";
202
+		}
178 203
                  try {
179 204
                         $sth = $this->db->prepare($query);
180 205
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -195,9 +220,14 @@  discard block
 block discarded – undo
195 220
 
196 221
 	public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '') {
197 222
 		global $globalStatsFilters;
198
-		if ($filter_name == '') $filter_name = $this->filter_name;
199
-		if ($limit) $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 LIMIT 10 OFFSET 0";
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";
223
+		if ($filter_name == '') {
224
+			$filter_name = $this->filter_name;
225
+		}
226
+		if ($limit) {
227
+			$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 LIMIT 10 OFFSET 0";
228
+		} else {
229
+			$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";
230
+		}
201 231
                  try {
202 232
                         $sth = $this->db->prepare($query);
203 233
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -217,9 +247,14 @@  discard block
 block discarded – undo
217 247
 	}
218 248
 	public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '') {
219 249
 		global $globalStatsFilters;
220
-		if ($filter_name == '') $filter_name = $this->filter_name;
221
-		if ($limit) $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 LIMIT 10 OFFSET 0";
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";
250
+		if ($filter_name == '') {
251
+			$filter_name = $this->filter_name;
252
+		}
253
+		if ($limit) {
254
+			$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 LIMIT 10 OFFSET 0";
255
+		} else {
256
+			$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";
257
+		}
223 258
                  try {
224 259
                         $sth = $this->db->prepare($query);
225 260
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -240,9 +275,14 @@  discard block
 block discarded – undo
240 275
 
241 276
 	public function countAllAirlines($limit = true,$filter_name = '') {
242 277
 		global $globalStatsFilters;
243
-		if ($filter_name == '') $filter_name = $this->filter_name;
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";
245
-		else $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";
278
+		if ($filter_name == '') {
279
+			$filter_name = $this->filter_name;
280
+		}
281
+		if ($limit) {
282
+			$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";
283
+		} else {
284
+			$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";
285
+		}
246 286
                  try {
247 287
                         $sth = $this->db->prepare($query);
248 288
                         $sth->execute(array(':filter_name' => $filter_name));
@@ -263,9 +303,14 @@  discard block
 block discarded – undo
263 303
 	}
264 304
 	public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '') {
265 305
 		global $globalStatsFilters;
266
-		if ($filter_name == '') $filter_name = $this->filter_name;
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
-		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";
306
+		if ($filter_name == '') {
307
+			$filter_name = $this->filter_name;
308
+		}
309
+		if ($limit) {
310
+			$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";
311
+		} else {
312
+			$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";
313
+		}
269 314
                  try {
270 315
                         $sth = $this->db->prepare($query);
271 316
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -285,9 +330,14 @@  discard block
 block discarded – undo
285 330
 	}
286 331
 	public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '') {
287 332
 		global $globalStatsFilters;
288
-		if ($filter_name == '') $filter_name = $this->filter_name;
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
-		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";
333
+		if ($filter_name == '') {
334
+			$filter_name = $this->filter_name;
335
+		}
336
+		if ($limit) {
337
+			$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";
338
+		} else {
339
+			$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";
340
+		}
291 341
 		 try {
292 342
 			$sth = $this->db->prepare($query);
293 343
 			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -307,10 +357,15 @@  discard block
 block discarded – undo
307 357
 	}
308 358
 	public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '') {
309 359
 		$Connection = new Connection();
310
-		if ($filter_name == '') $filter_name = $this->filter_name;
360
+		if ($filter_name == '') {
361
+			$filter_name = $this->filter_name;
362
+		}
311 363
 		if ($Connection->tableExists('countries')) {
312
-			if ($limit) $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 LIMIT 20 OFFSET 0";
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";
364
+			if ($limit) {
365
+				$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 LIMIT 20 OFFSET 0";
366
+			} else {
367
+				$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";
368
+			}
314 369
 			 try {
315 370
 				$sth = $this->db->prepare($query);
316 371
 				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -331,9 +386,14 @@  discard block
 block discarded – undo
331 386
 	}
332 387
 	public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '') {
333 388
 		global $globalStatsFilters;
334
-		if ($filter_name == '') $filter_name = $this->filter_name;
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
-		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";
389
+		if ($filter_name == '') {
390
+			$filter_name = $this->filter_name;
391
+		}
392
+		if ($limit) {
393
+			$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";
394
+		} else {
395
+			$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";
396
+		}
337 397
                  try {
338 398
                         $sth = $this->db->prepare($query);
339 399
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -353,9 +413,14 @@  discard block
 block discarded – undo
353 413
 	}
354 414
 	public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '') {
355 415
 		global $globalStatsFilters;
356
-		if ($filter_name == '') $filter_name = $this->filter_name;
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
-		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";
416
+		if ($filter_name == '') {
417
+			$filter_name = $this->filter_name;
418
+		}
419
+		if ($limit) {
420
+			$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";
421
+		} else {
422
+			$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";
423
+		}
359 424
                  try {
360 425
                         $sth = $this->db->prepare($query);
361 426
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -375,9 +440,14 @@  discard block
 block discarded – undo
375 440
 	}
376 441
 	public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '') {
377 442
 		global $globalStatsFilters;
378
-		if ($filter_name == '') $filter_name = $this->filter_name;
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
-		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";
443
+		if ($filter_name == '') {
444
+			$filter_name = $this->filter_name;
445
+		}
446
+		if ($limit) {
447
+			$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";
448
+		} else {
449
+			$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";
450
+		}
381 451
                  try {
382 452
                         $sth = $this->db->prepare($query);
383 453
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -403,7 +473,9 @@  discard block
 block discarded – undo
403 473
         			$icao = $value['airport_departure_icao'];
404 474
         			if (isset($all[$icao])) {
405 475
         				$all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
406
-        			} else $all[$icao] = $value;
476
+        			} else {
477
+        				$all[$icao] = $value;
478
+        			}
407 479
         		}
408 480
         		$count = array();
409 481
         		foreach ($all as $key => $row) {
@@ -415,9 +487,14 @@  discard block
 block discarded – undo
415 487
 	}
416 488
 	public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '') {
417 489
 		global $globalStatsFilters;
418
-		if ($filter_name == '') $filter_name = $this->filter_name;
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
-		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";
490
+		if ($filter_name == '') {
491
+			$filter_name = $this->filter_name;
492
+		}
493
+		if ($limit) {
494
+			$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";
495
+		} else {
496
+			$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";
497
+		}
421 498
 		try {
422 499
 			$sth = $this->db->prepare($query);
423 500
 			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -443,7 +520,9 @@  discard block
 block discarded – undo
443 520
         			$icao = $value['airport_arrival_icao'];
444 521
         			if (isset($all[$icao])) {
445 522
         				$all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
446
-        			} else $all[$icao] = $value;
523
+        			} else {
524
+        				$all[$icao] = $value;
525
+        			}
447 526
         		}
448 527
         		$count = array();
449 528
         		foreach ($all as $key => $row) {
@@ -456,13 +535,21 @@  discard block
 block discarded – undo
456 535
 	}
457 536
 	public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') {
458 537
 		global $globalDBdriver, $globalStatsFilters;
459
-		if ($filter_name == '') $filter_name = $this->filter_name;
538
+		if ($filter_name == '') {
539
+			$filter_name = $this->filter_name;
540
+		}
460 541
 		if ($globalDBdriver == 'mysql') {
461
-			if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
462
-			else $query = "SELECT MONTH(stats_date) as month_name, YEAR(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";
542
+			if ($limit) {
543
+				$query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
544
+			} else {
545
+				$query = "SELECT MONTH(stats_date) as month_name, YEAR(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";
546
+			}
463 547
 		} else {
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
-			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";
548
+			if ($limit) {
549
+				$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";
550
+			} else {
551
+				$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";
552
+			}
466 553
 		}
467 554
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
468 555
                  try {
@@ -486,7 +573,9 @@  discard block
 block discarded – undo
486 573
 	
487 574
 	public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') {
488 575
 		global $globalStatsFilters;
489
-		if ($filter_name == '') $filter_name = $this->filter_name;
576
+		if ($filter_name == '') {
577
+			$filter_name = $this->filter_name;
578
+		}
490 579
 		$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 580
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
492 581
                  try {
@@ -508,7 +597,9 @@  discard block
 block discarded – undo
508 597
 	}
509 598
 	public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') {
510 599
 		global $globalDBdriver, $globalStatsFilters;
511
-		if ($filter_name == '') $filter_name = $this->filter_name;
600
+		if ($filter_name == '') {
601
+			$filter_name = $this->filter_name;
602
+		}
512 603
 		if ($globalDBdriver == 'mysql') {
513 604
 			$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND stats_airline = :stats_airline AND filter_name = :filter_name";
514 605
 		} else {
@@ -534,7 +625,9 @@  discard block
 block discarded – undo
534 625
 	}
535 626
 	public function countAllDates($stats_airline = '',$filter_name = '') {
536 627
 		global $globalStatsFilters;
537
-		if ($filter_name == '') $filter_name = $this->filter_name;
628
+		if ($filter_name == '') {
629
+			$filter_name = $this->filter_name;
630
+		}
538 631
 		$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 632
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
540 633
                  try {
@@ -556,7 +649,9 @@  discard block
 block discarded – undo
556 649
 	}
557 650
 	public function countAllDatesByAirlines($filter_name = '') {
558 651
 		global $globalStatsFilters;
559
-		if ($filter_name == '') $filter_name = $this->filter_name;
652
+		if ($filter_name == '') {
653
+			$filter_name = $this->filter_name;
654
+		}
560 655
 		$query = "SELECT stats_airline as airline_icao, flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND filter_name = :filter_name";
561 656
 		$query_data = array('filter_name' => $filter_name);
562 657
                  try {
@@ -578,7 +673,9 @@  discard block
 block discarded – undo
578 673
 	}
579 674
 	public function countAllMonths($stats_airline = '',$filter_name = '') {
580 675
 		global $globalStatsFilters;
581
-		if ($filter_name == '') $filter_name = $this->filter_name;
676
+		if ($filter_name == '') {
677
+			$filter_name = $this->filter_name;
678
+		}
582 679
 	    	$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 680
                  try {
584 681
                         $sth = $this->db->prepare($query);
@@ -599,7 +696,9 @@  discard block
 block discarded – undo
599 696
 	}
600 697
 	public function countAllMilitaryMonths($filter_name = '') {
601 698
 		global $globalStatsFilters;
602
-		if ($filter_name == '') $filter_name = $this->filter_name;
699
+		if ($filter_name == '') {
700
+			$filter_name = $this->filter_name;
701
+		}
603 702
 	    	$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name";
604 703
                  try {
605 704
                         $sth = $this->db->prepare($query);
@@ -620,9 +719,14 @@  discard block
 block discarded – undo
620 719
 	}
621 720
 	public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') {
622 721
 		global $globalTimezone, $globalDBdriver, $globalStatsFilters;
623
-		if ($filter_name == '') $filter_name = $this->filter_name;
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";
625
-		else $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";
722
+		if ($filter_name == '') {
723
+			$filter_name = $this->filter_name;
724
+		}
725
+		if ($limit) {
726
+			$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";
727
+		} else {
728
+			$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";
729
+		}
626 730
 		if ($orderby == 'hour') {
627 731
 			/*
628 732
 			if ($globalDBdriver == 'mysql') {
@@ -631,7 +735,9 @@  discard block
 block discarded – undo
631 735
 			*/
632 736
 			$query .= " ORDER BY CAST(flight_date AS integer) ASC";
633 737
 		}
634
-		if ($orderby == 'count') $query .= " ORDER BY hour_count DESC";
738
+		if ($orderby == 'count') {
739
+			$query .= " ORDER BY hour_count DESC";
740
+		}
635 741
                  try {
636 742
                         $sth = $this->db->prepare($query);
637 743
                         $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
@@ -652,7 +758,9 @@  discard block
 block discarded – undo
652 758
 	
653 759
 	public function countOverallFlights($stats_airline = '', $filter_name = '') {
654 760
 		global $globalStatsFilters;
655
-		if ($filter_name == '') $filter_name = $this->filter_name;
761
+		if ($filter_name == '') {
762
+			$filter_name = $this->filter_name;
763
+		}
656 764
 		$all = $this->getSumStats('flights_bymonth',date('Y'),$stats_airline,$filter_name);
657 765
 		if (empty($all)) {
658 766
 			$filters = array('airlines' => array($stats_airline));
@@ -666,7 +774,9 @@  discard block
 block discarded – undo
666 774
 	}
667 775
 	public function countOverallMilitaryFlights($filter_name = '') {
668 776
 		global $globalStatsFilters;
669
-		if ($filter_name == '') $filter_name = $this->filter_name;
777
+		if ($filter_name == '') {
778
+			$filter_name = $this->filter_name;
779
+		}
670 780
 		$all = $this->getSumStats('military_flights_bymonth',date('Y'),'',$filter_name);
671 781
 		if (empty($all)) {
672 782
 		        $filters = array();
@@ -680,7 +790,9 @@  discard block
 block discarded – undo
680 790
 	}
681 791
 	public function countOverallArrival($stats_airline = '',$filter_name = '') {
682 792
 		global $globalStatsFilters;
683
-		if ($filter_name == '') $filter_name = $this->filter_name;
793
+		if ($filter_name == '') {
794
+			$filter_name = $this->filter_name;
795
+		}
684 796
 		$all = $this->getSumStats('realarrivals_bymonth',date('Y'),$stats_airline,$filter_name);
685 797
 		if (empty($all)) {
686 798
 			$filters = array('airlines' => array($stats_airline));
@@ -694,7 +806,9 @@  discard block
 block discarded – undo
694 806
 	}
695 807
 	public function countOverallAircrafts($stats_airline = '',$filter_name = '') {
696 808
 		global $globalStatsFilters;
697
-		if ($filter_name == '') $filter_name = $this->filter_name;
809
+		if ($filter_name == '') {
810
+			$filter_name = $this->filter_name;
811
+		}
698 812
 		$all = $this->getSumStats('aircrafts_bymonth',date('Y'),$stats_airline,$filter_name);
699 813
 		if (empty($all)) {
700 814
 			$filters = array('airlines' => array($stats_airline));
@@ -708,7 +822,9 @@  discard block
 block discarded – undo
708 822
 	}
709 823
 	public function countOverallAirlines($filter_name = '') {
710 824
 		global $globalStatsFilters;
711
-		if ($filter_name == '') $filter_name = $this->filter_name;
825
+		if ($filter_name == '') {
826
+			$filter_name = $this->filter_name;
827
+		}
712 828
 		$query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name";
713 829
                  try {
714 830
                         $sth = $this->db->prepare($query);
@@ -731,7 +847,9 @@  discard block
 block discarded – undo
731 847
 	}
732 848
 	public function countOverallOwners($stats_airline = '',$filter_name = '') {
733 849
 		global $globalStatsFilters;
734
-		if ($filter_name == '') $filter_name = $this->filter_name;
850
+		if ($filter_name == '') {
851
+			$filter_name = $this->filter_name;
852
+		}
735 853
 		/*
736 854
 		$query = "SELECT COUNT(*) AS nb_owner FROM stats_owner";
737 855
                  try {
@@ -756,7 +874,9 @@  discard block
 block discarded – undo
756 874
 	}
757 875
 	public function countOverallPilots($stats_airline = '',$filter_name = '') {
758 876
 		global $globalStatsFilters;
759
-		if ($filter_name == '') $filter_name = $this->filter_name;
877
+		if ($filter_name == '') {
878
+			$filter_name = $this->filter_name;
879
+		}
760 880
 		$all = $this->getSumStats('pilots_bymonth',date('Y'),$stats_airline,$filter_name);
761 881
 		if (empty($all)) {
762 882
 			$filters = array('airlines' => array($stats_airline));
@@ -770,7 +890,9 @@  discard block
 block discarded – undo
770 890
 	}
771 891
 
772 892
 	public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') {
773
-		if ($filter_name == '') $filter_name = $this->filter_name;
893
+		if ($filter_name == '') {
894
+			$filter_name = $this->filter_name;
895
+		}
774 896
 		$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 897
 		$query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
776 898
                  try {
@@ -783,7 +905,9 @@  discard block
 block discarded – undo
783 905
                 return $all;
784 906
 	}
785 907
 	public function getStats($type,$stats_airline = '', $filter_name = '') {
786
-		if ($filter_name == '') $filter_name = $this->filter_name;
908
+		if ($filter_name == '') {
909
+			$filter_name = $this->filter_name;
910
+		}
787 911
                 $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date";
788 912
                 $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
789 913
                  try {
@@ -796,7 +920,9 @@  discard block
 block discarded – undo
796 920
                 return $all;
797 921
         }
798 922
 	public function getSumStats($type,$year,$stats_airline = '',$filter_name = '') {
799
-		if ($filter_name == '') $filter_name = $this->filter_name;
923
+		if ($filter_name == '') {
924
+			$filter_name = $this->filter_name;
925
+		}
800 926
     		global $globalArchiveMonths, $globalDBdriver;
801 927
     		if ($globalDBdriver == 'mysql') {
802 928
 	                $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name";
@@ -815,7 +941,9 @@  discard block
 block discarded – undo
815 941
         }
816 942
 	public function getStatsTotal($type, $stats_airline = '', $filter_name = '') {
817 943
     		global $globalArchiveMonths, $globalDBdriver;
818
-		if ($filter_name == '') $filter_name = $this->filter_name;
944
+		if ($filter_name == '') {
945
+			$filter_name = $this->filter_name;
946
+		}
819 947
     		if ($globalDBdriver == 'mysql') {
820 948
 			$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
821 949
 		} else {
@@ -833,7 +961,9 @@  discard block
 block discarded – undo
833 961
         }
834 962
 	public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') {
835 963
     		global $globalArchiveMonths, $globalDBdriver;
836
-		if ($filter_name == '') $filter_name = $this->filter_name;
964
+		if ($filter_name == '') {
965
+			$filter_name = $this->filter_name;
966
+		}
837 967
     		if ($globalDBdriver == 'mysql') {
838 968
 			$query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name";
839 969
                 } else {
@@ -850,7 +980,9 @@  discard block
 block discarded – undo
850 980
         }
851 981
 	public function getStatsAirlineTotal($filter_name = '') {
852 982
     		global $globalArchiveMonths, $globalDBdriver;
853
-		if ($filter_name == '') $filter_name = $this->filter_name;
983
+		if ($filter_name == '') {
984
+			$filter_name = $this->filter_name;
985
+		}
854 986
     		if ($globalDBdriver == 'mysql') {
855 987
 			$query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name";
856 988
                 } else {
@@ -867,7 +999,9 @@  discard block
 block discarded – undo
867 999
         }
868 1000
 	public function getStatsOwnerTotal($filter_name = '') {
869 1001
     		global $globalArchiveMonths, $globalDBdriver;
870
-		if ($filter_name == '') $filter_name = $this->filter_name;
1002
+		if ($filter_name == '') {
1003
+			$filter_name = $this->filter_name;
1004
+		}
871 1005
     		if ($globalDBdriver == 'mysql') {
872 1006
 			$query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name";
873 1007
 		} else {
@@ -884,7 +1018,9 @@  discard block
 block discarded – undo
884 1018
         }
885 1019
 	public function getStatsPilotTotal($filter_name = '') {
886 1020
     		global $globalArchiveMonths, $globalDBdriver;
887
-		if ($filter_name == '') $filter_name = $this->filter_name;
1021
+		if ($filter_name == '') {
1022
+			$filter_name = $this->filter_name;
1023
+		}
888 1024
     		if ($globalDBdriver == 'mysql') {
889 1025
             		$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
890 1026
             	} else {
@@ -902,7 +1038,9 @@  discard block
 block discarded – undo
902 1038
 
903 1039
 	public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
904 1040
 		global $globalDBdriver;
905
-		if ($filter_name == '') $filter_name = $this->filter_name;
1041
+		if ($filter_name == '') {
1042
+			$filter_name = $this->filter_name;
1043
+		}
906 1044
 		if ($globalDBdriver == 'mysql') {
907 1045
 			$query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = :cnt";
908 1046
                 } else {
@@ -918,7 +1056,9 @@  discard block
 block discarded – undo
918 1056
         }
919 1057
 	public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
920 1058
 		global $globalDBdriver;
921
-		if ($filter_name == '') $filter_name = $this->filter_name;
1059
+		if ($filter_name == '') {
1060
+			$filter_name = $this->filter_name;
1061
+		}
922 1062
 		if ($globalDBdriver == 'mysql') {
923 1063
 			$query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date";
924 1064
 		} else {
@@ -1401,47 +1541,69 @@  discard block
 block discarded – undo
1401 1541
 			$this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s'));
1402 1542
 		} else {
1403 1543
 		*/
1404
-			if ($globalDebug) echo 'Update stats !'."\n";
1405
-			if ($globalDebug) echo 'Count all aircraft types...'."\n";
1544
+			if ($globalDebug) {
1545
+				echo 'Update stats !'."\n";
1546
+			}
1547
+			if ($globalDebug) {
1548
+				echo 'Count all aircraft types...'."\n";
1549
+			}
1406 1550
 			if (isset($last_update[0]['value'])) {
1407 1551
 				$last_update_day = $last_update[0]['value'];
1408
-			} else $last_update_day = '2012-12-12 12:12:12';
1552
+			} else {
1553
+				$last_update_day = '2012-12-12 12:12:12';
1554
+			}
1409 1555
 			$Spotter = new Spotter($this->db);
1410 1556
 			$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day);
1411 1557
 			foreach ($alldata as $number) {
1412 1558
 				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer']);
1413 1559
 			}
1414
-			if ($globalDebug) echo 'Count all airlines...'."\n";
1560
+			if ($globalDebug) {
1561
+				echo 'Count all airlines...'."\n";
1562
+			}
1415 1563
 			$alldata = $Spotter->countAllAirlines(false,0,$last_update_day);
1416 1564
 			foreach ($alldata as $number) {
1417 1565
 				$this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name']);
1418 1566
 			}
1419
-			if ($globalDebug) echo 'Count all registrations...'."\n";
1567
+			if ($globalDebug) {
1568
+				echo 'Count all registrations...'."\n";
1569
+			}
1420 1570
 			$alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day);
1421 1571
 			foreach ($alldata as $number) {
1422 1572
 				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao']);
1423 1573
 			}
1424
-			if ($globalDebug) echo 'Count all callsigns...'."\n";
1574
+			if ($globalDebug) {
1575
+				echo 'Count all callsigns...'."\n";
1576
+			}
1425 1577
 			$alldata = $Spotter->countAllCallsigns(false,0,$last_update_day);
1426 1578
 			foreach ($alldata as $number) {
1427 1579
 				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']);
1428 1580
 			}
1429
-			if ($globalDebug) echo 'Count all owners...'."\n";
1581
+			if ($globalDebug) {
1582
+				echo 'Count all owners...'."\n";
1583
+			}
1430 1584
 			$alldata = $Spotter->countAllOwners(false,0,$last_update_day);
1431 1585
 			foreach ($alldata as $number) {
1432 1586
 				$this->addStatOwner($number['owner_name'],$number['owner_count']);
1433 1587
 			}
1434
-			if ($globalDebug) echo 'Count all pilots...'."\n";
1588
+			if ($globalDebug) {
1589
+				echo 'Count all pilots...'."\n";
1590
+			}
1435 1591
 			$alldata = $Spotter->countAllPilots(false,0,$last_update_day);
1436 1592
 			foreach ($alldata as $number) {
1437 1593
 				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source']);
1438 1594
 			}
1439 1595
 			
1440
-			if ($globalDebug) echo 'Count all departure airports...'."\n";
1596
+			if ($globalDebug) {
1597
+				echo 'Count all departure airports...'."\n";
1598
+			}
1441 1599
 			$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day);
1442
-			if ($globalDebug) echo 'Count all detected departure airports...'."\n";
1600
+			if ($globalDebug) {
1601
+				echo 'Count all detected departure airports...'."\n";
1602
+			}
1443 1603
         		$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day);
1444
-			if ($globalDebug) echo 'Order departure airports...'."\n";
1604
+			if ($globalDebug) {
1605
+				echo 'Order departure airports...'."\n";
1606
+			}
1445 1607
 	        	$alldata = array();
1446 1608
 	        	
1447 1609
     			foreach ($pall as $value) {
@@ -1452,7 +1614,9 @@  discard block
 block discarded – undo
1452 1614
     				$icao = $value['airport_departure_icao'];
1453 1615
         			if (isset($alldata[$icao])) {
1454 1616
     					$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1455
-        			} else $alldata[$icao] = $value;
1617
+        			} else {
1618
+        				$alldata[$icao] = $value;
1619
+        			}
1456 1620
 			}
1457 1621
     			$count = array();
1458 1622
     			foreach ($alldata as $key => $row) {
@@ -1462,11 +1626,17 @@  discard block
 block discarded – undo
1462 1626
 			foreach ($alldata as $number) {
1463 1627
 				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count']);
1464 1628
 			}
1465
-			if ($globalDebug) echo 'Count all arrival airports...'."\n";
1629
+			if ($globalDebug) {
1630
+				echo 'Count all arrival airports...'."\n";
1631
+			}
1466 1632
 			$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day);
1467
-			if ($globalDebug) echo 'Count all detected arrival airports...'."\n";
1633
+			if ($globalDebug) {
1634
+				echo 'Count all detected arrival airports...'."\n";
1635
+			}
1468 1636
         		$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day);
1469
-			if ($globalDebug) echo 'Order arrival airports...'."\n";
1637
+			if ($globalDebug) {
1638
+				echo 'Order arrival airports...'."\n";
1639
+			}
1470 1640
 	        	$alldata = array();
1471 1641
     			foreach ($pall as $value) {
1472 1642
 	        		$icao = $value['airport_arrival_icao'];
@@ -1476,7 +1646,9 @@  discard block
 block discarded – undo
1476 1646
     				$icao = $value['airport_arrival_icao'];
1477 1647
         			if (isset($alldata[$icao])) {
1478 1648
         				$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1479
-	        		} else $alldata[$icao] = $value;
1649
+	        		} else {
1650
+	        			$alldata[$icao] = $value;
1651
+	        		}
1480 1652
     			}
1481 1653
         		$count = array();
1482 1654
         		foreach ($alldata as $key => $row) {
@@ -1487,7 +1659,9 @@  discard block
 block discarded – undo
1487 1659
 				echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count']);
1488 1660
 			}
1489 1661
 			if ($Connection->tableExists('countries')) {
1490
-				if ($globalDebug) echo 'Count all flights by countries...'."\n";
1662
+				if ($globalDebug) {
1663
+					echo 'Count all flights by countries...'."\n";
1664
+				}
1491 1665
 				$SpotterArchive = new SpotterArchive();
1492 1666
 				$alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day);
1493 1667
 				foreach ($alldata as $number) {
@@ -1499,46 +1673,66 @@  discard block
 block discarded – undo
1499 1673
 			// Add by month using getstat if month finish...
1500 1674
 
1501 1675
 			//if (date('m',strtotime($last_update_day)) != date('m')) {
1502
-			if ($globalDebug) echo 'Count all flights by months...'."\n";
1676
+			if ($globalDebug) {
1677
+				echo 'Count all flights by months...'."\n";
1678
+			}
1503 1679
 			$Spotter = new Spotter($this->db);
1504 1680
 			$alldata = $Spotter->countAllMonths();
1505 1681
 			$lastyear = false;
1506 1682
 			foreach ($alldata as $number) {
1507
-				if ($number['year_name'] != date('Y')) $lastyear = true;
1683
+				if ($number['year_name'] != date('Y')) {
1684
+					$lastyear = true;
1685
+				}
1508 1686
 				$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'])));
1509 1687
 			}
1510
-			if ($globalDebug) echo 'Count all military flights by months...'."\n";
1688
+			if ($globalDebug) {
1689
+				echo 'Count all military flights by months...'."\n";
1690
+			}
1511 1691
 			$alldata = $Spotter->countAllMilitaryMonths();
1512 1692
 			foreach ($alldata as $number) {
1513 1693
 				$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'])));
1514 1694
 			}
1515
-			if ($globalDebug) echo 'Count all owners by months...'."\n";
1695
+			if ($globalDebug) {
1696
+				echo 'Count all owners by months...'."\n";
1697
+			}
1516 1698
 			$alldata = $Spotter->countAllMonthsOwners();
1517 1699
 			foreach ($alldata as $number) {
1518 1700
 				$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'])));
1519 1701
 			}
1520
-			if ($globalDebug) echo 'Count all pilots by months...'."\n";
1702
+			if ($globalDebug) {
1703
+				echo 'Count all pilots by months...'."\n";
1704
+			}
1521 1705
 			$alldata = $Spotter->countAllMonthsPilots();
1522 1706
 			foreach ($alldata as $number) {
1523 1707
 				$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'])));
1524 1708
 			}
1525
-			if ($globalDebug) echo 'Count all airlines by months...'."\n";
1709
+			if ($globalDebug) {
1710
+				echo 'Count all airlines by months...'."\n";
1711
+			}
1526 1712
 			$alldata = $Spotter->countAllMonthsAirlines();
1527 1713
 			foreach ($alldata as $number) {
1528 1714
 				$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'])));
1529 1715
 			}
1530
-			if ($globalDebug) echo 'Count all aircrafts by months...'."\n";
1716
+			if ($globalDebug) {
1717
+				echo 'Count all aircrafts by months...'."\n";
1718
+			}
1531 1719
 			$alldata = $Spotter->countAllMonthsAircrafts();
1532 1720
 			foreach ($alldata as $number) {
1533 1721
 				$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'])));
1534 1722
 			}
1535
-			if ($globalDebug) echo 'Count all real arrivals by months...'."\n";
1723
+			if ($globalDebug) {
1724
+				echo 'Count all real arrivals by months...'."\n";
1725
+			}
1536 1726
 			$alldata = $Spotter->countAllMonthsRealArrivals();
1537 1727
 			foreach ($alldata as $number) {
1538 1728
 				$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'])));
1539 1729
 			}
1540
-			if ($globalDebug) echo 'Airports data...'."\n";
1541
-			if ($globalDebug) echo '...Departure'."\n";
1730
+			if ($globalDebug) {
1731
+				echo 'Airports data...'."\n";
1732
+			}
1733
+			if ($globalDebug) {
1734
+				echo '...Departure'."\n";
1735
+			}
1542 1736
 			$this->deleteStatAirport('daily');
1543 1737
 //			$pall = $Spotter->getLast7DaysAirportsDeparture();
1544 1738
   //      		$dall = $Spotter->getLast7DaysDetectedAirportsDeparture();
@@ -1658,37 +1852,53 @@  discard block
 block discarded – undo
1658 1852
 
1659 1853
 			// Count by airlines
1660 1854
 			echo '--- Stats by airlines ---'."\n";
1661
-			if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n";
1855
+			if ($globalDebug) {
1856
+				echo 'Count all aircraft types by airlines...'."\n";
1857
+			}
1662 1858
 			$Spotter = new Spotter($this->db);
1663 1859
 			$alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day);
1664 1860
 			foreach ($alldata as $number) {
1665 1861
 				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao']);
1666 1862
 			}
1667
-			if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n";
1863
+			if ($globalDebug) {
1864
+				echo 'Count all aircraft registrations by airlines...'."\n";
1865
+			}
1668 1866
 			$alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day);
1669 1867
 			foreach ($alldata as $number) {
1670 1868
 				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao']);
1671 1869
 			}
1672
-			if ($globalDebug) echo 'Count all callsigns by airlines...'."\n";
1870
+			if ($globalDebug) {
1871
+				echo 'Count all callsigns by airlines...'."\n";
1872
+			}
1673 1873
 			$alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day);
1674 1874
 			foreach ($alldata as $number) {
1675 1875
 				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']);
1676 1876
 			}
1677
-			if ($globalDebug) echo 'Count all owners by airlines...'."\n";
1877
+			if ($globalDebug) {
1878
+				echo 'Count all owners by airlines...'."\n";
1879
+			}
1678 1880
 			$alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day);
1679 1881
 			foreach ($alldata as $number) {
1680 1882
 				$this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao']);
1681 1883
 			}
1682
-			if ($globalDebug) echo 'Count all pilots by airlines...'."\n";
1884
+			if ($globalDebug) {
1885
+				echo 'Count all pilots by airlines...'."\n";
1886
+			}
1683 1887
 			$alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day);
1684 1888
 			foreach ($alldata as $number) {
1685 1889
 				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source']);
1686 1890
 			}
1687
-			if ($globalDebug) echo 'Count all departure airports by airlines...'."\n";
1891
+			if ($globalDebug) {
1892
+				echo 'Count all departure airports by airlines...'."\n";
1893
+			}
1688 1894
 			$pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day);
1689
-			if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n";
1895
+			if ($globalDebug) {
1896
+				echo 'Count all detected departure airports by airlines...'."\n";
1897
+			}
1690 1898
        			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day);
1691
-			if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n";
1899
+			if ($globalDebug) {
1900
+				echo 'Order detected departure airports by airlines...'."\n";
1901
+			}
1692 1902
 	        	//$alldata = array();
1693 1903
     			foreach ($dall as $value) {
1694 1904
     				$icao = $value['airport_departure_icao'];
@@ -1709,11 +1919,17 @@  discard block
 block discarded – undo
1709 1919
 			foreach ($alldata as $number) {
1710 1920
 				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']);
1711 1921
 			}
1712
-			if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n";
1922
+			if ($globalDebug) {
1923
+				echo 'Count all arrival airports by airlines...'."\n";
1924
+			}
1713 1925
 			$pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day);
1714
-			if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n";
1926
+			if ($globalDebug) {
1927
+				echo 'Count all detected arrival airports by airlines...'."\n";
1928
+			}
1715 1929
         		$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day);
1716
-			if ($globalDebug) echo 'Order arrival airports by airlines...'."\n";
1930
+			if ($globalDebug) {
1931
+				echo 'Order arrival airports by airlines...'."\n";
1932
+			}
1717 1933
 	        	//$alldata = array();
1718 1934
     			foreach ($dall as $value) {
1719 1935
     				$icao = $value['airport_arrival_icao'];
@@ -1732,37 +1948,53 @@  discard block
 block discarded – undo
1732 1948
     			}
1733 1949
     			$alldata = $pall;
1734 1950
                         foreach ($alldata as $number) {
1735
-				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']);
1951
+				if ($number['airline_icao'] != '') {
1952
+					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']);
1953
+				}
1954
+			}
1955
+			if ($globalDebug) {
1956
+				echo 'Count all flights by months by airlines...'."\n";
1736 1957
 			}
1737
-			if ($globalDebug) echo 'Count all flights by months by airlines...'."\n";
1738 1958
 			$Spotter = new Spotter($this->db);
1739 1959
 			$alldata = $Spotter->countAllMonthsByAirlines();
1740 1960
 			$lastyear = false;
1741 1961
 			foreach ($alldata as $number) {
1742
-				if ($number['year_name'] != date('Y')) $lastyear = true;
1962
+				if ($number['year_name'] != date('Y')) {
1963
+					$lastyear = true;
1964
+				}
1743 1965
 				$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']);
1744 1966
 			}
1745
-			if ($globalDebug) echo 'Count all owners by months by airlines...'."\n";
1967
+			if ($globalDebug) {
1968
+				echo 'Count all owners by months by airlines...'."\n";
1969
+			}
1746 1970
 			$alldata = $Spotter->countAllMonthsOwnersByAirlines();
1747 1971
 			foreach ($alldata as $number) {
1748 1972
 				$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']);
1749 1973
 			}
1750
-			if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n";
1974
+			if ($globalDebug) {
1975
+				echo 'Count all pilots by months by airlines...'."\n";
1976
+			}
1751 1977
 			$alldata = $Spotter->countAllMonthsPilotsByAirlines();
1752 1978
 			foreach ($alldata as $number) {
1753 1979
 				$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']);
1754 1980
 			}
1755
-			if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n";
1981
+			if ($globalDebug) {
1982
+				echo 'Count all aircrafts by months by airlines...'."\n";
1983
+			}
1756 1984
 			$alldata = $Spotter->countAllMonthsAircraftsByAirlines();
1757 1985
 			foreach ($alldata as $number) {
1758 1986
 				$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']);
1759 1987
 			}
1760
-			if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n";
1988
+			if ($globalDebug) {
1989
+				echo 'Count all real arrivals by months by airlines...'."\n";
1990
+			}
1761 1991
 			$alldata = $Spotter->countAllMonthsRealArrivalsByAirlines();
1762 1992
 			foreach ($alldata as $number) {
1763 1993
 				$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']);
1764 1994
 			}
1765
-			if ($globalDebug) echo '...Departure'."\n";
1995
+			if ($globalDebug) {
1996
+				echo '...Departure'."\n";
1997
+			}
1766 1998
 			$pall = $Spotter->getLast7DaysAirportsDepartureByAirlines();
1767 1999
         		$dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines();
1768 2000
     			foreach ($dall as $value) {
@@ -1785,7 +2017,9 @@  discard block
 block discarded – undo
1785 2017
 			foreach ($alldata as $number) {
1786 2018
 				$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']);
1787 2019
 			}
1788
-			if ($globalDebug) echo '...Arrival'."\n";
2020
+			if ($globalDebug) {
2021
+				echo '...Arrival'."\n";
2022
+			}
1789 2023
 			$pall = $Spotter->getLast7DaysAirportsArrivalByAirlines();
1790 2024
         		$dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines();
1791 2025
     			foreach ($dall as $value) {
@@ -1809,13 +2043,19 @@  discard block
 block discarded – undo
1809 2043
 				$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']);
1810 2044
 			}
1811 2045
 
1812
-			if ($globalDebug) echo 'Flights data...'."\n";
1813
-			if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n";
2046
+			if ($globalDebug) {
2047
+				echo 'Flights data...'."\n";
2048
+			}
2049
+			if ($globalDebug) {
2050
+				echo '-> countAllDatesLastMonth...'."\n";
2051
+			}
1814 2052
 			$alldata = $Spotter->countAllDatesLastMonthByAirlines();
1815 2053
 			foreach ($alldata as $number) {
1816 2054
 				$this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']);
1817 2055
 			}
1818
-			if ($globalDebug) echo '-> countAllDates...'."\n";
2056
+			if ($globalDebug) {
2057
+				echo '-> countAllDates...'."\n";
2058
+			}
1819 2059
 			//$previousdata = $this->countAllDatesByAirlines();
1820 2060
 			$alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines());
1821 2061
 			$values = array();
@@ -1828,14 +2068,18 @@  discard block
 block discarded – undo
1828 2068
 				$this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']);
1829 2069
 			}
1830 2070
 			
1831
-			if ($globalDebug) echo '-> countAllHours...'."\n";
2071
+			if ($globalDebug) {
2072
+				echo '-> countAllHours...'."\n";
2073
+			}
1832 2074
 			$alldata = $Spotter->countAllHoursByAirlines('hour');
1833 2075
 			foreach ($alldata as $number) {
1834 2076
 				$this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']);
1835 2077
 			}
1836 2078
 			
1837 2079
 
1838
-			if (!isset($globalStatsFilters) || $globalStatsFilters == '') $globalStatsFilters = array();
2080
+			if (!isset($globalStatsFilters) || $globalStatsFilters == '') {
2081
+				$globalStatsFilters = array();
2082
+			}
1839 2083
 			foreach ($globalStatsFilters as $name => $filter) {
1840 2084
 				//$filter_name = $filter['name'];
1841 2085
 				$filter_name = $name;
@@ -1843,10 +2087,14 @@  discard block
 block discarded – undo
1843 2087
 				$last_update = $this->getLastStatsUpdate('last_update_stats_'.$filter_name);
1844 2088
 				if (isset($last_update[0]['value'])) {
1845 2089
 					$last_update_day = $last_update[0]['value'];
1846
-				} else $last_update_day = '2012-12-12 12:12:12';
2090
+				} else {
2091
+					$last_update_day = '2012-12-12 12:12:12';
2092
+				}
1847 2093
 
1848 2094
 				// Count by filter
1849
-				if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n";
2095
+				if ($globalDebug) {
2096
+					echo '--- Stats for filter '.$filter_name.' ---'."\n";
2097
+				}
1850 2098
 				$Spotter = new Spotter($this->db);
1851 2099
 				$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter);
1852 2100
 				foreach ($alldata as $number) {
@@ -1883,7 +2131,9 @@  discard block
 block discarded – undo
1883 2131
 	    				$icao = $value['airport_departure_icao'];
1884 2132
         				if (isset($alldata[$icao])) {
1885 2133
     						$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1886
-        				} else $alldata[$icao] = $value;
2134
+        				} else {
2135
+        					$alldata[$icao] = $value;
2136
+        				}
1887 2137
 				}
1888 2138
 	    			$count = array();
1889 2139
     				foreach ($alldata as $key => $row) {
@@ -1904,7 +2154,9 @@  discard block
 block discarded – undo
1904 2154
 	    				$icao = $value['airport_arrival_icao'];
1905 2155
         				if (isset($alldata[$icao])) {
1906 2156
         					$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1907
-		        		} else $alldata[$icao] = $value;
2157
+		        		} else {
2158
+		        			$alldata[$icao] = $value;
2159
+		        		}
1908 2160
 	    			}
1909 2161
         			$count = array();
1910 2162
         			foreach ($alldata as $key => $row) {
@@ -1918,7 +2170,9 @@  discard block
 block discarded – undo
1918 2170
 				$alldata = $Spotter->countAllMonths($filter);
1919 2171
 				$lastyear = false;
1920 2172
 				foreach ($alldata as $number) {
1921
-					if ($number['year_name'] != date('Y')) $lastyear = true;
2173
+					if ($number['year_name'] != date('Y')) {
2174
+						$lastyear = true;
2175
+					}
1922 2176
 					$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);
1923 2177
 				}
1924 2178
 				$alldata = $Spotter->countAllMonthsOwners($filter);
Please login to merge, or discard this patch.
Indentation   +833 added lines, -833 removed lines patch added patch discarded remove patch
@@ -15,33 +15,33 @@  discard block
 block discarded – undo
15 15
 		if (isset($globalFilterName)) $this->filter_name = $globalFilterName;
16 16
 		$Connection = new Connection($dbc);
17 17
 		$this->db = $Connection->db();
18
-        }
18
+		}
19 19
               
20 20
 	public function addLastStatsUpdate($type,$stats_date) {
21
-                $query = "DELETE FROM config WHERE name = :type;
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);
24
-                 try {
25
-                        $sth = $this->db->prepare($query);
26
-                        $sth->execute($query_values);
27
-                } catch(PDOException $e) {
28
-                        return "error : ".$e->getMessage();
29
-                }
30
-        }
23
+				$query_values = array('type' => $type,':stats_date' => $stats_date);
24
+				 try {
25
+						$sth = $this->db->prepare($query);
26
+						$sth->execute($query_values);
27
+				} catch(PDOException $e) {
28
+						return "error : ".$e->getMessage();
29
+				}
30
+		}
31 31
 
32 32
 	public function getLastStatsUpdate($type = 'last_update_stats') {
33
-                $query = "SELECT value FROM config WHERE name = :type";
34
-                 try {
35
-                        $sth = $this->db->prepare($query);
36
-                        $sth->execute(array(':type' => $type));
37
-                } catch(PDOException $e) {
38
-                        echo "error : ".$e->getMessage();
39
-                }
40
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
41
-                return $all;
42
-        }
43
-        public function deleteStats($filter_name = '') {
44
-        	/*
33
+				$query = "SELECT value FROM config WHERE name = :type";
34
+				 try {
35
+						$sth = $this->db->prepare($query);
36
+						$sth->execute(array(':type' => $type));
37
+				} catch(PDOException $e) {
38
+						echo "error : ".$e->getMessage();
39
+				}
40
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
41
+				return $all;
42
+		}
43
+		public function deleteStats($filter_name = '') {
44
+			/*
45 45
         	$query = "DELETE FROM config WHERE name = 'last_update_stats'";
46 46
                  try {
47 47
                         $sth = $this->db->prepare($query);
@@ -50,80 +50,80 @@  discard block
 block discarded – undo
50 50
                         return "error : ".$e->getMessage();
51 51
                 }
52 52
                 */
53
-        	$query = "DELETE FROM stats WHERE filter_name = :filter_name;DELETE FROM stats_aircraft WHERE filter_name = :filter_name;DELETE FROM stats_airline WHERE filter_name = :filter_name;DELETE FROM stats_airport WHERE filter_name = :filter_name;DELETE FROM stats_callsign WHERE filter_name = :filter_name;DELETE FROM stats_country WHERE filter_name = :filter_name;DELETE FROM stats_flight WHERE filter_name = :filter_name;DELETE FROM stats_owner WHERE filter_name = :filter_name;DELETE FROM stats_pilot WHERE filter_name = :filter_name;DELETE FROM stats_registration WHERE filter_name = :filter_name;";
54
-                 try {
55
-                        $sth = $this->db->prepare($query);
56
-                        $sth->execute(array(':filter_name' => $filter_name));
57
-                } catch(PDOException $e) {
58
-                        return "error : ".$e->getMessage();
59
-                }
60
-        }
61
-        public function deleteOldStats($filter_name = '') {
53
+			$query = "DELETE FROM stats WHERE filter_name = :filter_name;DELETE FROM stats_aircraft WHERE filter_name = :filter_name;DELETE FROM stats_airline WHERE filter_name = :filter_name;DELETE FROM stats_airport WHERE filter_name = :filter_name;DELETE FROM stats_callsign WHERE filter_name = :filter_name;DELETE FROM stats_country WHERE filter_name = :filter_name;DELETE FROM stats_flight WHERE filter_name = :filter_name;DELETE FROM stats_owner WHERE filter_name = :filter_name;DELETE FROM stats_pilot WHERE filter_name = :filter_name;DELETE FROM stats_registration WHERE filter_name = :filter_name;";
54
+				 try {
55
+						$sth = $this->db->prepare($query);
56
+						$sth->execute(array(':filter_name' => $filter_name));
57
+				} catch(PDOException $e) {
58
+						return "error : ".$e->getMessage();
59
+				}
60
+		}
61
+		public function deleteOldStats($filter_name = '') {
62 62
         	
63
-        	$query = "DELETE FROM config WHERE name = 'last_update_stats'";
64
-                 try {
65
-                        $sth = $this->db->prepare($query);
66
-                        $sth->execute();
67
-                } catch(PDOException $e) {
68
-                        return "error : ".$e->getMessage();
69
-                }
63
+			$query = "DELETE FROM config WHERE name = 'last_update_stats'";
64
+				 try {
65
+						$sth = $this->db->prepare($query);
66
+						$sth->execute();
67
+				} catch(PDOException $e) {
68
+						return "error : ".$e->getMessage();
69
+				}
70 70
                 
71
-        	$query = "DELETE FROM stats_aircraft WHERE filter_name = :filter_name;DELETE FROM stats_airline WHERE filter_name = :filter_name;DELETE FROM stats_callsign WHERE filter_name = :filter_name;DELETE FROM stats_country WHERE filter_name = :filter_name;DELETE FROM stats_owner WHERE filter_name = :filter_name;DELETE FROM stats_pilot WHERE filter_name = :filter_name;DELETE FROM stats_registration WHERE filter_name = :filter_name;";
72
-                 try {
73
-                        $sth = $this->db->prepare($query);
74
-                        $sth->execute(array(':filter_name' => $filter_name));
75
-                } catch(PDOException $e) {
76
-                        return "error : ".$e->getMessage();
77
-                }
78
-        }
71
+			$query = "DELETE FROM stats_aircraft WHERE filter_name = :filter_name;DELETE FROM stats_airline WHERE filter_name = :filter_name;DELETE FROM stats_callsign WHERE filter_name = :filter_name;DELETE FROM stats_country WHERE filter_name = :filter_name;DELETE FROM stats_owner WHERE filter_name = :filter_name;DELETE FROM stats_pilot WHERE filter_name = :filter_name;DELETE FROM stats_registration WHERE filter_name = :filter_name;";
72
+				 try {
73
+						$sth = $this->db->prepare($query);
74
+						$sth->execute(array(':filter_name' => $filter_name));
75
+				} catch(PDOException $e) {
76
+						return "error : ".$e->getMessage();
77
+				}
78
+		}
79 79
 	public function getAllAirlineNames($filter_name = '') {
80 80
 		if ($filter_name == '') $filter_name = $this->filter_name;
81
-                $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC";
82
-                 try {
83
-                        $sth = $this->db->prepare($query);
84
-                        $sth->execute(array(':filter_name' => $filter_name));
85
-                } catch(PDOException $e) {
86
-                        echo "error : ".$e->getMessage();
87
-                }
88
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
89
-                return $all;
90
-        }
81
+				$query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC";
82
+				 try {
83
+						$sth = $this->db->prepare($query);
84
+						$sth->execute(array(':filter_name' => $filter_name));
85
+				} catch(PDOException $e) {
86
+						echo "error : ".$e->getMessage();
87
+				}
88
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
89
+				return $all;
90
+		}
91 91
 	public function getAllAircraftTypes($stats_airline = '',$filter_name = '') {
92 92
 		if ($filter_name == '') $filter_name = $this->filter_name;
93
-                $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
94
-                 try {
95
-                        $sth = $this->db->prepare($query);
96
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
97
-                } catch(PDOException $e) {
98
-                        echo "error : ".$e->getMessage();
99
-                }
100
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
101
-                return $all;
102
-        }
93
+				$query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
94
+				 try {
95
+						$sth = $this->db->prepare($query);
96
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
97
+				} catch(PDOException $e) {
98
+						echo "error : ".$e->getMessage();
99
+				}
100
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
101
+				return $all;
102
+		}
103 103
 	public function getAllManufacturers($stats_airline = '',$filter_name = '') {
104 104
 		if ($filter_name == '') $filter_name = $this->filter_name;
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
-                 try {
107
-                        $sth = $this->db->prepare($query);
108
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
109
-                } catch(PDOException $e) {
110
-                        echo "error : ".$e->getMessage();
111
-                }
112
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
113
-                return $all;
114
-        }
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
+				 try {
107
+						$sth = $this->db->prepare($query);
108
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
109
+				} catch(PDOException $e) {
110
+						echo "error : ".$e->getMessage();
111
+				}
112
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
113
+				return $all;
114
+		}
115 115
 	public function getAllAirportNames($stats_airline = '',$filter_name = '') {
116 116
 		if ($filter_name == '') $filter_name = $this->filter_name;
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
-                 try {
119
-                        $sth = $this->db->prepare($query);
120
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
121
-                } catch(PDOException $e) {
122
-                        echo "error : ".$e->getMessage();
123
-                }
124
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
125
-                return $all;
126
-        }
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
+				 try {
119
+						$sth = $this->db->prepare($query);
120
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
121
+				} catch(PDOException $e) {
122
+						echo "error : ".$e->getMessage();
123
+				}
124
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
125
+				return $all;
126
+		}
127 127
 
128 128
 
129 129
 	public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '') {
@@ -131,66 +131,66 @@  discard block
 block discarded – undo
131 131
 		if ($filter_name == '') $filter_name = $this->filter_name;
132 132
 		if ($limit) $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 LIMIT 10 OFFSET 0";
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
-                 try {
135
-                        $sth = $this->db->prepare($query);
136
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
137
-                } catch(PDOException $e) {
138
-                        echo "error : ".$e->getMessage();
139
-                }
140
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
141
-                if (empty($all)) {
142
-            	    $filters = array('airlines' => array($stats_airline));
143
-            	    if ($filter_name != '') {
144
-            		    $filters = array_merge($filters,$globalStatsFilters[$filter_name]);
145
-            	    }
146
-            	    $Spotter = new Spotter($this->db);
147
-            	    $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters);
148
-                }
149
-                return $all;
134
+				 try {
135
+						$sth = $this->db->prepare($query);
136
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
137
+				} catch(PDOException $e) {
138
+						echo "error : ".$e->getMessage();
139
+				}
140
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
141
+				if (empty($all)) {
142
+					$filters = array('airlines' => array($stats_airline));
143
+					if ($filter_name != '') {
144
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
145
+					}
146
+					$Spotter = new Spotter($this->db);
147
+					$all = $Spotter->countAllAircraftTypes($limit,0,'',$filters);
148
+				}
149
+				return $all;
150 150
 	}
151 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";
155 155
 		else $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";
156
-                 try {
157
-                        $sth = $this->db->prepare($query);
158
-                        $sth->execute(array(':filter_name' => $filter_name));
159
-                } catch(PDOException $e) {
160
-                        echo "error : ".$e->getMessage();
161
-                }
162
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
163
-                if (empty($all)) {
164
-            		$Spotter = new Spotter($this->db);
165
-            		$filters = array();
166
-            		if ($filter_name != '') {
167
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
168
-			}
169
-            		$all = $Spotter->countAllAirlineCountries($limit,$filters);
170
-                }
171
-                return $all;
156
+				 try {
157
+						$sth = $this->db->prepare($query);
158
+						$sth->execute(array(':filter_name' => $filter_name));
159
+				} catch(PDOException $e) {
160
+						echo "error : ".$e->getMessage();
161
+				}
162
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
163
+				if (empty($all)) {
164
+					$Spotter = new Spotter($this->db);
165
+					$filters = array();
166
+					if ($filter_name != '') {
167
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
168
+			}
169
+					$all = $Spotter->countAllAirlineCountries($limit,$filters);
170
+				}
171
+				return $all;
172 172
 	}
173 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
-                 try {
179
-                        $sth = $this->db->prepare($query);
180
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
181
-                } catch(PDOException $e) {
182
-                        echo "error : ".$e->getMessage();
183
-                }
184
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
185
-                if (empty($all)) {
186
-            		$filters = array('airlines' => array($stats_airline));
187
-            		if ($filter_name != '') {
188
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
178
+				 try {
179
+						$sth = $this->db->prepare($query);
180
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
181
+				} catch(PDOException $e) {
182
+						echo "error : ".$e->getMessage();
183
+				}
184
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
185
+				if (empty($all)) {
186
+					$filters = array('airlines' => array($stats_airline));
187
+					if ($filter_name != '') {
188
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
189 189
 			}
190
-            		$Spotter = new Spotter($this->db);
190
+					$Spotter = new Spotter($this->db);
191 191
 			$all = $Spotter->countAllAircraftManufacturers($filters);
192
-                }
193
-                return $all;
192
+				}
193
+				return $all;
194 194
 	}
195 195
 
196 196
 	public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '') {
@@ -198,44 +198,44 @@  discard block
 block discarded – undo
198 198
 		if ($filter_name == '') $filter_name = $this->filter_name;
199 199
 		if ($limit) $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 LIMIT 10 OFFSET 0";
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
-                 try {
202
-                        $sth = $this->db->prepare($query);
203
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
204
-                } catch(PDOException $e) {
205
-                        echo "error : ".$e->getMessage();
206
-                }
207
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
208
-                if (empty($all)) {
201
+				 try {
202
+						$sth = $this->db->prepare($query);
203
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
204
+				} catch(PDOException $e) {
205
+						echo "error : ".$e->getMessage();
206
+				}
207
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
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 214
 			$all = $Spotter->countAllArrivalCountries($limit,$filters);
215
-                }
216
-                return $all;
215
+				}
216
+				return $all;
217 217
 	}
218 218
 	public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '') {
219 219
 		global $globalStatsFilters;
220 220
 		if ($filter_name == '') $filter_name = $this->filter_name;
221 221
 		if ($limit) $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 LIMIT 10 OFFSET 0";
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
-                 try {
224
-                        $sth = $this->db->prepare($query);
225
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
226
-                } catch(PDOException $e) {
227
-                        echo "error : ".$e->getMessage();
228
-                }
229
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
230
-                if (empty($all)) {
223
+				 try {
224
+						$sth = $this->db->prepare($query);
225
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
226
+				} catch(PDOException $e) {
227
+						echo "error : ".$e->getMessage();
228
+				}
229
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
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);
237
-                }
238
-                return $all;
237
+				}
238
+				return $all;
239 239
 	}
240 240
 
241 241
 	public function countAllAirlines($limit = true,$filter_name = '') {
@@ -243,45 +243,45 @@  discard block
 block discarded – undo
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";
245 245
 		else $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";
246
-                 try {
247
-                        $sth = $this->db->prepare($query);
248
-                        $sth->execute(array(':filter_name' => $filter_name));
249
-                } catch(PDOException $e) {
250
-                        echo "error : ".$e->getMessage();
251
-                }
252
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
253
-                if (empty($all)) {
254
-	                $Spotter = new Spotter($this->db);
255
-            		$filters = array();
256
-            		if ($filter_name != '') {
257
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
246
+				 try {
247
+						$sth = $this->db->prepare($query);
248
+						$sth->execute(array(':filter_name' => $filter_name));
249
+				} catch(PDOException $e) {
250
+						echo "error : ".$e->getMessage();
251
+				}
252
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
253
+				if (empty($all)) {
254
+					$Spotter = new Spotter($this->db);
255
+					$filters = array();
256
+					if ($filter_name != '') {
257
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
258 258
 			}
259 259
 
260
-    		        $all = $Spotter->countAllAirlines($limit,0,'',$filters);
261
-                }
262
-                return $all;
260
+					$all = $Spotter->countAllAirlines($limit,0,'',$filters);
261
+				}
262
+				return $all;
263 263
 	}
264 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
-                 try {
270
-                        $sth = $this->db->prepare($query);
271
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
272
-                } catch(PDOException $e) {
273
-                        echo "error : ".$e->getMessage();
274
-                }
275
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
276
-                if (empty($all)) {
269
+				 try {
270
+						$sth = $this->db->prepare($query);
271
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
272
+				} catch(PDOException $e) {
273
+						echo "error : ".$e->getMessage();
274
+				}
275
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
276
+				if (empty($all)) {
277 277
 			$filters = array('airlines' => array($stats_airline));
278 278
 			if ($filter_name != '') {
279 279
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
280 280
 			}
281
-	                $Spotter = new Spotter($this->db);
282
-    		        $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters);
283
-                }
284
-                return $all;
281
+					$Spotter = new Spotter($this->db);
282
+					$all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters);
283
+				}
284
+				return $all;
285 285
 	}
286 286
 	public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '') {
287 287
 		global $globalStatsFilters;
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 				echo "error : ".$e->getMessage();
319 319
 			}
320 320
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
321
-                /*
321
+				/*
322 322
                 if (empty($all)) {
323 323
 	                $Spotter = new Spotter($this->db);
324 324
     		        $all = $Spotter->countAllFlightOverCountries($limit);
@@ -334,84 +334,84 @@  discard block
 block discarded – undo
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
-                 try {
338
-                        $sth = $this->db->prepare($query);
339
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
340
-                } catch(PDOException $e) {
341
-                        echo "error : ".$e->getMessage();
342
-                }
343
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
344
-                if (empty($all)) {
337
+				 try {
338
+						$sth = $this->db->prepare($query);
339
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
340
+				} catch(PDOException $e) {
341
+						echo "error : ".$e->getMessage();
342
+				}
343
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
344
+				if (empty($all)) {
345 345
 			$filters = array('airlines' => array($stats_airline));
346 346
 			if ($filter_name != '') {
347 347
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
348 348
 			}
349
-            		$Spotter = new Spotter($this->db);
350
-            		$all = $Spotter->countAllPilots($limit,0,'',$filters);
351
-                }
352
-                return $all;
349
+					$Spotter = new Spotter($this->db);
350
+					$all = $Spotter->countAllPilots($limit,0,'',$filters);
351
+				}
352
+				return $all;
353 353
 	}
354 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
-                 try {
360
-                        $sth = $this->db->prepare($query);
361
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
362
-                } catch(PDOException $e) {
363
-                        echo "error : ".$e->getMessage();
364
-                }
365
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
366
-                if (empty($all)) {
359
+				 try {
360
+						$sth = $this->db->prepare($query);
361
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
362
+				} catch(PDOException $e) {
363
+						echo "error : ".$e->getMessage();
364
+				}
365
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
366
+				if (empty($all)) {
367 367
 			$filters = array('airlines' => array($stats_airline));
368 368
 			if ($filter_name != '') {
369 369
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
370 370
 			}
371
-            		$Spotter = new Spotter($this->db);
372
-            		$all = $Spotter->countAllOwners($limit,0,'',$filters);
373
-                }
374
-                return $all;
371
+					$Spotter = new Spotter($this->db);
372
+					$all = $Spotter->countAllOwners($limit,0,'',$filters);
373
+				}
374
+				return $all;
375 375
 	}
376 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
-                 try {
382
-                        $sth = $this->db->prepare($query);
383
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
384
-                } catch(PDOException $e) {
385
-                        echo "error : ".$e->getMessage();
386
-                }
387
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
388
-                if (empty($all)) {
381
+				 try {
382
+						$sth = $this->db->prepare($query);
383
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
384
+				} catch(PDOException $e) {
385
+						echo "error : ".$e->getMessage();
386
+				}
387
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
388
+				if (empty($all)) {
389 389
 			$filters = array('airlines' => array($stats_airline));
390
-            		if ($filter_name != '') {
391
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
392
-			}
393
-            		$Spotter = new Spotter($this->db);
394
-            		$pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters);
395
-        		$dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters);
396
-        		$all = array();
397
-        		foreach ($pall as $value) {
398
-        			$icao = $value['airport_departure_icao'];
399
-        			$all[$icao] = $value;
400
-        		}
390
+					if ($filter_name != '') {
391
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
392
+			}
393
+					$Spotter = new Spotter($this->db);
394
+					$pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters);
395
+				$dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters);
396
+				$all = array();
397
+				foreach ($pall as $value) {
398
+					$icao = $value['airport_departure_icao'];
399
+					$all[$icao] = $value;
400
+				}
401 401
         		
402
-        		foreach ($dall as $value) {
403
-        			$icao = $value['airport_departure_icao'];
404
-        			if (isset($all[$icao])) {
405
-        				$all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
406
-        			} else $all[$icao] = $value;
407
-        		}
408
-        		$count = array();
409
-        		foreach ($all as $key => $row) {
410
-        			$count[$key] = $row['airport_departure_icao_count'];
411
-        		}
412
-        		array_multisort($count,SORT_DESC,$all);
413
-                }
414
-                return $all;
402
+				foreach ($dall as $value) {
403
+					$icao = $value['airport_departure_icao'];
404
+					if (isset($all[$icao])) {
405
+						$all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
406
+					} else $all[$icao] = $value;
407
+				}
408
+				$count = array();
409
+				foreach ($all as $key => $row) {
410
+					$count[$key] = $row['airport_departure_icao_count'];
411
+				}
412
+				array_multisort($count,SORT_DESC,$all);
413
+				}
414
+				return $all;
415 415
 	}
416 416
 	public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '') {
417 417
 		global $globalStatsFilters;
@@ -433,26 +433,26 @@  discard block
 block discarded – undo
433 433
 			$Spotter = new Spotter($this->db);
434 434
 			$pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters);
435 435
 			$dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters);
436
-        		$all = array();
437
-        		foreach ($pall as $value) {
438
-        			$icao = $value['airport_arrival_icao'];
439
-        			$all[$icao] = $value;
440
-        		}
436
+				$all = array();
437
+				foreach ($pall as $value) {
438
+					$icao = $value['airport_arrival_icao'];
439
+					$all[$icao] = $value;
440
+				}
441 441
         		
442
-        		foreach ($dall as $value) {
443
-        			$icao = $value['airport_arrival_icao'];
444
-        			if (isset($all[$icao])) {
445
-        				$all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
446
-        			} else $all[$icao] = $value;
447
-        		}
448
-        		$count = array();
449
-        		foreach ($all as $key => $row) {
450
-        			$count[$key] = $row['airport_arrival_icao_count'];
451
-        		}
452
-        		array_multisort($count,SORT_DESC,$all);
453
-                }
442
+				foreach ($dall as $value) {
443
+					$icao = $value['airport_arrival_icao'];
444
+					if (isset($all[$icao])) {
445
+						$all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
446
+					} else $all[$icao] = $value;
447
+				}
448
+				$count = array();
449
+				foreach ($all as $key => $row) {
450
+					$count[$key] = $row['airport_arrival_icao_count'];
451
+				}
452
+				array_multisort($count,SORT_DESC,$all);
453
+				}
454 454
  
455
-                return $all;
455
+				return $all;
456 456
 	}
457 457
 	public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') {
458 458
 		global $globalDBdriver, $globalStatsFilters;
@@ -465,23 +465,23 @@  discard block
 block discarded – undo
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 467
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
468
-                 try {
469
-                        $sth = $this->db->prepare($query);
470
-                        $sth->execute($query_data);
471
-                } catch(PDOException $e) {
472
-                        echo "error : ".$e->getMessage();
473
-                }
474
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
475
-                if (empty($all)) {
468
+				 try {
469
+						$sth = $this->db->prepare($query);
470
+						$sth->execute($query_data);
471
+				} catch(PDOException $e) {
472
+						echo "error : ".$e->getMessage();
473
+				}
474
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
475
+				if (empty($all)) {
476 476
 			$filters = array('airlines' => array($stats_airline));
477 477
 			if ($filter_name != '') {
478 478
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
479 479
 			}
480
-            		$Spotter = new Spotter($this->db);
481
-            		$all = $Spotter->countAllMonthsLastYear($filters);
482
-                }
480
+					$Spotter = new Spotter($this->db);
481
+					$all = $Spotter->countAllMonthsLastYear($filters);
482
+				}
483 483
                 
484
-                return $all;
484
+				return $all;
485 485
 	}
486 486
 	
487 487
 	public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') {
@@ -489,22 +489,22 @@  discard block
 block discarded – undo
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 491
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
492
-                 try {
493
-                        $sth = $this->db->prepare($query);
494
-                        $sth->execute($query_data);
495
-                } catch(PDOException $e) {
496
-                        echo "error : ".$e->getMessage();
497
-                }
498
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
499
-                if (empty($all)) {
492
+				 try {
493
+						$sth = $this->db->prepare($query);
494
+						$sth->execute($query_data);
495
+				} catch(PDOException $e) {
496
+						echo "error : ".$e->getMessage();
497
+				}
498
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
499
+				if (empty($all)) {
500 500
 			$filters = array('airlines' => array($stats_airline));
501 501
 			if ($filter_name != '') {
502 502
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
503 503
 			}
504
-            		$Spotter = new Spotter($this->db);
505
-            		$all = $Spotter->countAllDatesLastMonth($filters);
506
-                }
507
-                return $all;
504
+					$Spotter = new Spotter($this->db);
505
+					$all = $Spotter->countAllDatesLastMonth($filters);
506
+				}
507
+				return $all;
508 508
 	}
509 509
 	public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') {
510 510
 		global $globalDBdriver, $globalStatsFilters;
@@ -515,108 +515,108 @@  discard block
 block discarded – undo
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 517
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
518
-                 try {
519
-                        $sth = $this->db->prepare($query);
520
-                        $sth->execute($query_data);
521
-                } catch(PDOException $e) {
522
-                        echo "error : ".$e->getMessage();
523
-                }
524
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
525
-                if (empty($all)) {
518
+				 try {
519
+						$sth = $this->db->prepare($query);
520
+						$sth->execute($query_data);
521
+				} catch(PDOException $e) {
522
+						echo "error : ".$e->getMessage();
523
+				}
524
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
525
+				if (empty($all)) {
526 526
 			$filters = array('airlines' => array($stats_airline));
527 527
 			if ($filter_name != '') {
528 528
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
529 529
 			}
530
-            		$Spotter = new Spotter($this->db);
531
-            		$all = $Spotter->countAllDatesLast7Days($filters);
532
-                }
533
-                return $all;
530
+					$Spotter = new Spotter($this->db);
531
+					$all = $Spotter->countAllDatesLast7Days($filters);
532
+				}
533
+				return $all;
534 534
 	}
535 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 539
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
540
-                 try {
541
-                        $sth = $this->db->prepare($query);
542
-                        $sth->execute($query_data);
543
-                } catch(PDOException $e) {
544
-                        echo "error : ".$e->getMessage();
545
-                }
546
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
547
-                if (empty($all)) {
540
+				 try {
541
+						$sth = $this->db->prepare($query);
542
+						$sth->execute($query_data);
543
+				} catch(PDOException $e) {
544
+						echo "error : ".$e->getMessage();
545
+				}
546
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
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
-            		$Spotter = new Spotter($this->db);
553
-            		$all = $Spotter->countAllDates($filters);
554
-                }
555
-                return $all;
552
+					$Spotter = new Spotter($this->db);
553
+					$all = $Spotter->countAllDates($filters);
554
+				}
555
+				return $all;
556 556
 	}
557 557
 	public function countAllDatesByAirlines($filter_name = '') {
558 558
 		global $globalStatsFilters;
559 559
 		if ($filter_name == '') $filter_name = $this->filter_name;
560 560
 		$query = "SELECT stats_airline as airline_icao, flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND filter_name = :filter_name";
561 561
 		$query_data = array('filter_name' => $filter_name);
562
-                 try {
563
-                        $sth = $this->db->prepare($query);
564
-                        $sth->execute($query_data);
565
-                } catch(PDOException $e) {
566
-                        echo "error : ".$e->getMessage();
567
-                }
568
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
569
-                if (empty($all)) {
570
-            		$filters = array();
571
-            		if ($filter_name != '') {
572
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
573
-			}
574
-            		$Spotter = new Spotter($this->db);
575
-            		$all = $Spotter->countAllDatesByAirlines($filters);
576
-                }
577
-                return $all;
562
+				 try {
563
+						$sth = $this->db->prepare($query);
564
+						$sth->execute($query_data);
565
+				} catch(PDOException $e) {
566
+						echo "error : ".$e->getMessage();
567
+				}
568
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
569
+				if (empty($all)) {
570
+					$filters = array();
571
+					if ($filter_name != '') {
572
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
573
+			}
574
+					$Spotter = new Spotter($this->db);
575
+					$all = $Spotter->countAllDatesByAirlines($filters);
576
+				}
577
+				return $all;
578 578
 	}
579 579
 	public function countAllMonths($stats_airline = '',$filter_name = '') {
580 580
 		global $globalStatsFilters;
581 581
 		if ($filter_name == '') $filter_name = $this->filter_name;
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
-                 try {
584
-                        $sth = $this->db->prepare($query);
585
-                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
586
-                } catch(PDOException $e) {
587
-                        echo "error : ".$e->getMessage();
588
-                }
589
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
590
-                if (empty($all)) {
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
+				 try {
584
+						$sth = $this->db->prepare($query);
585
+						$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
586
+				} catch(PDOException $e) {
587
+						echo "error : ".$e->getMessage();
588
+				}
589
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
590
+				if (empty($all)) {
591 591
 			$filters = array('airlines' => array($stats_airline));
592 592
 			if ($filter_name != '') {
593 593
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
594 594
 			}
595
-            		$Spotter = new Spotter($this->db);
596
-            		$all = $Spotter->countAllMonths($filters);
597
-                }
598
-                return $all;
595
+					$Spotter = new Spotter($this->db);
596
+					$all = $Spotter->countAllMonths($filters);
597
+				}
598
+				return $all;
599 599
 	}
600 600
 	public function countAllMilitaryMonths($filter_name = '') {
601 601
 		global $globalStatsFilters;
602 602
 		if ($filter_name == '') $filter_name = $this->filter_name;
603
-	    	$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name";
604
-                 try {
605
-                        $sth = $this->db->prepare($query);
606
-                        $sth->execute(array(':filter_name' => $filter_name));
607
-                } catch(PDOException $e) {
608
-                        echo "error : ".$e->getMessage();
609
-                }
610
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
611
-                if (empty($all)) {
612
-            		$filters = array();
613
-            		if ($filter_name != '') {
614
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
615
-			}
616
-            		$Spotter = new Spotter($this->db);
617
-            		$all = $Spotter->countAllMilitaryMonths($filters);
618
-                }
619
-                return $all;
603
+			$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name";
604
+				 try {
605
+						$sth = $this->db->prepare($query);
606
+						$sth->execute(array(':filter_name' => $filter_name));
607
+				} catch(PDOException $e) {
608
+						echo "error : ".$e->getMessage();
609
+				}
610
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
611
+				if (empty($all)) {
612
+					$filters = array();
613
+					if ($filter_name != '') {
614
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
615
+			}
616
+					$Spotter = new Spotter($this->db);
617
+					$all = $Spotter->countAllMilitaryMonths($filters);
618
+				}
619
+				return $all;
620 620
 	}
621 621
 	public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') {
622 622
 		global $globalTimezone, $globalDBdriver, $globalStatsFilters;
@@ -632,22 +632,22 @@  discard block
 block discarded – undo
632 632
 			$query .= " ORDER BY CAST(flight_date AS integer) ASC";
633 633
 		}
634 634
 		if ($orderby == 'count') $query .= " ORDER BY hour_count DESC";
635
-                 try {
636
-                        $sth = $this->db->prepare($query);
637
-                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
638
-                } catch(PDOException $e) {
639
-                        echo "error : ".$e->getMessage();
640
-                }
641
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
642
-                if (empty($all)) {
635
+				 try {
636
+						$sth = $this->db->prepare($query);
637
+						$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
638
+				} catch(PDOException $e) {
639
+						echo "error : ".$e->getMessage();
640
+				}
641
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
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
-            		$Spotter = new Spotter($this->db);
648
-            		$all = $Spotter->countAllHours($orderby,$filters);
649
-                }
650
-                return $all;
647
+					$Spotter = new Spotter($this->db);
648
+					$all = $Spotter->countAllHours($orderby,$filters);
649
+				}
650
+				return $all;
651 651
 	}
652 652
 	
653 653
 	public function countOverallFlights($stats_airline = '', $filter_name = '') {
@@ -669,9 +669,9 @@  discard block
 block discarded – undo
669 669
 		if ($filter_name == '') $filter_name = $this->filter_name;
670 670
 		$all = $this->getSumStats('military_flights_bymonth',date('Y'),'',$filter_name);
671 671
 		if (empty($all)) {
672
-		        $filters = array();
673
-            		if ($filter_name != '') {
674
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
672
+				$filters = array();
673
+					if ($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);
@@ -710,19 +710,19 @@  discard block
 block discarded – undo
710 710
 		global $globalStatsFilters;
711 711
 		if ($filter_name == '') $filter_name = $this->filter_name;
712 712
 		$query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name";
713
-                 try {
714
-                        $sth = $this->db->prepare($query);
715
-                        $sth->execute(array(':filter_name' => $filter_name));
716
-                } catch(PDOException $e) {
717
-                        echo "error : ".$e->getMessage();
718
-                }
719
-                $result = $sth->fetchAll(PDO::FETCH_ASSOC);
720
-                $all = $result[0]['nb_airline'];
713
+				 try {
714
+						$sth = $this->db->prepare($query);
715
+						$sth->execute(array(':filter_name' => $filter_name));
716
+				} catch(PDOException $e) {
717
+						echo "error : ".$e->getMessage();
718
+				}
719
+				$result = $sth->fetchAll(PDO::FETCH_ASSOC);
720
+				$all = $result[0]['nb_airline'];
721 721
 		//$all = $this->getSumStats('airlines_bymonth',date('Y'));
722 722
 		if (empty($all)) {
723
-            		$filters = array();
724
-            		if ($filter_name != '') {
725
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
723
+					$filters = array();
724
+					if ($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);
@@ -773,166 +773,166 @@  discard block
 block discarded – undo
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 775
 		$query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
776
-                 try {
777
-                        $sth = $this->db->prepare($query);
778
-                        $sth->execute($query_values);
779
-                } catch(PDOException $e) {
780
-                        echo "error : ".$e->getMessage();
781
-                }
782
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
783
-                return $all;
776
+				 try {
777
+						$sth = $this->db->prepare($query);
778
+						$sth->execute($query_values);
779
+				} catch(PDOException $e) {
780
+						echo "error : ".$e->getMessage();
781
+				}
782
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
783
+				return $all;
784 784
 	}
785 785
 	public function getStats($type,$stats_airline = '', $filter_name = '') {
786 786
 		if ($filter_name == '') $filter_name = $this->filter_name;
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);
789
-                 try {
790
-                        $sth = $this->db->prepare($query);
791
-                        $sth->execute($query_values);
792
-                } catch(PDOException $e) {
793
-                        echo "error : ".$e->getMessage();
794
-                }
795
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
796
-                return $all;
797
-        }
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);
789
+				 try {
790
+						$sth = $this->db->prepare($query);
791
+						$sth->execute($query_values);
792
+				} catch(PDOException $e) {
793
+						echo "error : ".$e->getMessage();
794
+				}
795
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
796
+				return $all;
797
+		}
798 798
 	public function getSumStats($type,$year,$stats_airline = '',$filter_name = '') {
799 799
 		if ($filter_name == '') $filter_name = $this->filter_name;
800
-    		global $globalArchiveMonths, $globalDBdriver;
801
-    		if ($globalDBdriver == 'mysql') {
802
-	                $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name";
803
-	        } else {
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
-                }
806
-                $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
807
-                 try {
808
-                        $sth = $this->db->prepare($query);
809
-                        $sth->execute($query_values);
810
-                } catch(PDOException $e) {
811
-                        echo "error : ".$e->getMessage();
812
-                }
813
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
814
-                return $all[0]['total'];
815
-        }
800
+			global $globalArchiveMonths, $globalDBdriver;
801
+			if ($globalDBdriver == 'mysql') {
802
+					$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name";
803
+			} else {
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
+				}
806
+				$query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
807
+				 try {
808
+						$sth = $this->db->prepare($query);
809
+						$sth->execute($query_values);
810
+				} catch(PDOException $e) {
811
+						echo "error : ".$e->getMessage();
812
+				}
813
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
814
+				return $all[0]['total'];
815
+		}
816 816
 	public function getStatsTotal($type, $stats_airline = '', $filter_name = '') {
817
-    		global $globalArchiveMonths, $globalDBdriver;
817
+			global $globalArchiveMonths, $globalDBdriver;
818 818
 		if ($filter_name == '') $filter_name = $this->filter_name;
819
-    		if ($globalDBdriver == 'mysql') {
819
+			if ($globalDBdriver == 'mysql') {
820 820
 			$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
821 821
 		} else {
822 822
 			$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveMonths." MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
823
-                }
824
-                $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
825
-                 try {
826
-                        $sth = $this->db->prepare($query);
827
-                        $sth->execute($query_values);
828
-                } catch(PDOException $e) {
829
-                        echo "error : ".$e->getMessage();
830
-                }
831
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
832
-                return $all[0]['total'];
833
-        }
823
+				}
824
+				$query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
825
+				 try {
826
+						$sth = $this->db->prepare($query);
827
+						$sth->execute($query_values);
828
+				} catch(PDOException $e) {
829
+						echo "error : ".$e->getMessage();
830
+				}
831
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
832
+				return $all[0]['total'];
833
+		}
834 834
 	public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') {
835
-    		global $globalArchiveMonths, $globalDBdriver;
835
+			global $globalArchiveMonths, $globalDBdriver;
836 836
 		if ($filter_name == '') $filter_name = $this->filter_name;
837
-    		if ($globalDBdriver == 'mysql') {
837
+			if ($globalDBdriver == 'mysql') {
838 838
 			$query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name";
839
-                } else {
839
+				} else {
840 840
 			$query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name";
841
-                }
842
-                 try {
843
-                        $sth = $this->db->prepare($query);
844
-                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
845
-                } catch(PDOException $e) {
846
-                        echo "error : ".$e->getMessage();
847
-                }
848
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
849
-                return $all[0]['total'];
850
-        }
841
+				}
842
+				 try {
843
+						$sth = $this->db->prepare($query);
844
+						$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
845
+				} catch(PDOException $e) {
846
+						echo "error : ".$e->getMessage();
847
+				}
848
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
849
+				return $all[0]['total'];
850
+		}
851 851
 	public function getStatsAirlineTotal($filter_name = '') {
852
-    		global $globalArchiveMonths, $globalDBdriver;
852
+			global $globalArchiveMonths, $globalDBdriver;
853 853
 		if ($filter_name == '') $filter_name = $this->filter_name;
854
-    		if ($globalDBdriver == 'mysql') {
854
+			if ($globalDBdriver == 'mysql') {
855 855
 			$query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name";
856
-                } else {
856
+				} else {
857 857
 			$query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name";
858
-                }
859
-                 try {
860
-                        $sth = $this->db->prepare($query);
861
-                        $sth->execute(array(':filter_name' => $filter_name));
862
-                } catch(PDOException $e) {
863
-                        echo "error : ".$e->getMessage();
864
-                }
865
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
866
-                return $all[0]['total'];
867
-        }
858
+				}
859
+				 try {
860
+						$sth = $this->db->prepare($query);
861
+						$sth->execute(array(':filter_name' => $filter_name));
862
+				} catch(PDOException $e) {
863
+						echo "error : ".$e->getMessage();
864
+				}
865
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
866
+				return $all[0]['total'];
867
+		}
868 868
 	public function getStatsOwnerTotal($filter_name = '') {
869
-    		global $globalArchiveMonths, $globalDBdriver;
869
+			global $globalArchiveMonths, $globalDBdriver;
870 870
 		if ($filter_name == '') $filter_name = $this->filter_name;
871
-    		if ($globalDBdriver == 'mysql') {
871
+			if ($globalDBdriver == 'mysql') {
872 872
 			$query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name";
873 873
 		} else {
874 874
 			$query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name";
875
-                }
876
-                 try {
877
-                        $sth = $this->db->prepare($query);
878
-                        $sth->execute(array(':filter_name' => $filter_name));
879
-                } catch(PDOException $e) {
880
-                        echo "error : ".$e->getMessage();
881
-                }
882
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
883
-                return $all[0]['total'];
884
-        }
875
+				}
876
+				 try {
877
+						$sth = $this->db->prepare($query);
878
+						$sth->execute(array(':filter_name' => $filter_name));
879
+				} catch(PDOException $e) {
880
+						echo "error : ".$e->getMessage();
881
+				}
882
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
883
+				return $all[0]['total'];
884
+		}
885 885
 	public function getStatsPilotTotal($filter_name = '') {
886
-    		global $globalArchiveMonths, $globalDBdriver;
886
+			global $globalArchiveMonths, $globalDBdriver;
887 887
 		if ($filter_name == '') $filter_name = $this->filter_name;
888
-    		if ($globalDBdriver == 'mysql') {
889
-            		$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
890
-            	} else {
891
-            		$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
892
-            	}
893
-                 try {
894
-                        $sth = $this->db->prepare($query);
895
-                        $sth->execute(array(':filter_name' => $filter_name));
896
-                } catch(PDOException $e) {
897
-                        echo "error : ".$e->getMessage();
898
-                }
899
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
900
-                return $all[0]['total'];
901
-        }
888
+			if ($globalDBdriver == 'mysql') {
889
+					$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
890
+				} else {
891
+					$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
892
+				}
893
+				 try {
894
+						$sth = $this->db->prepare($query);
895
+						$sth->execute(array(':filter_name' => $filter_name));
896
+				} catch(PDOException $e) {
897
+						echo "error : ".$e->getMessage();
898
+				}
899
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
900
+				return $all[0]['total'];
901
+		}
902 902
 
903 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') {
907 907
 			$query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = :cnt";
908
-                } else {
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);
912
-                 try {
913
-                        $sth = $this->db->prepare($query);
914
-                        $sth->execute($query_values);
915
-                } catch(PDOException $e) {
916
-                        return "error : ".$e->getMessage();
917
-                }
918
-        }
911
+				$query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
912
+				 try {
913
+						$sth = $this->db->prepare($query);
914
+						$sth->execute($query_values);
915
+				} catch(PDOException $e) {
916
+						return "error : ".$e->getMessage();
917
+				}
918
+		}
919 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') {
923 923
 			$query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date";
924 924
 		} else {
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";
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
-                }
928
-                $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
929
-                 try {
930
-                        $sth = $this->db->prepare($query);
931
-                        $sth->execute($query_values);
932
-                } catch(PDOException $e) {
933
-                        return "error : ".$e->getMessage();
934
-                }
935
-        }
927
+				}
928
+				$query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
929
+				 try {
930
+						$sth = $this->db->prepare($query);
931
+						$sth->execute($query_values);
932
+				} catch(PDOException $e) {
933
+						return "error : ".$e->getMessage();
934
+				}
935
+		}
936 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";
@@ -941,15 +941,15 @@  discard block
 block discarded – undo
941 941
 			$query = "SELECT * FROM stats_source WHERE stats_date = :date AND stats_type = :stats_type ORDER BY source_name";
942 942
 			$query_values = array(':date' => $date,':stats_type' => $stats_type);
943 943
 		}
944
-                 try {
945
-                        $sth = $this->db->prepare($query);
946
-                        $sth->execute($query_values);
947
-                } catch(PDOException $e) {
948
-                        echo "error : ".$e->getMessage();
949
-                }
950
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
951
-                return $all;
952
-        }
944
+				 try {
945
+						$sth = $this->db->prepare($query);
946
+						$sth->execute($query_values);
947
+				} catch(PDOException $e) {
948
+						echo "error : ".$e->getMessage();
949
+				}
950
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
951
+				return $all;
952
+		}
953 953
 
954 954
 	public function addStatSource($data,$source_name,$stats_type,$date) {
955 955
 		global $globalDBdriver;
@@ -957,25 +957,25 @@  discard block
 block discarded – undo
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
-                }
961
-                $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type);
962
-                 try {
963
-                        $sth = $this->db->prepare($query);
964
-                        $sth->execute($query_values);
965
-                } catch(PDOException $e) {
966
-                        return "error : ".$e->getMessage();
967
-                }
968
-        }
960
+				}
961
+				$query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type);
962
+				 try {
963
+						$sth = $this->db->prepare($query);
964
+						$sth->execute($query_values);
965
+				} catch(PDOException $e) {
966
+						return "error : ".$e->getMessage();
967
+				}
968
+		}
969 969
 	public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') {
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);
972
-                 try {
973
-                        $sth = $this->db->prepare($query);
974
-                        $sth->execute($query_values);
975
-                } catch(PDOException $e) {
976
-                        return "error : ".$e->getMessage();
977
-                }
978
-        }
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);
972
+				 try {
973
+						$sth = $this->db->prepare($query);
974
+						$sth->execute($query_values);
975
+				} catch(PDOException $e) {
976
+						return "error : ".$e->getMessage();
977
+				}
978
+		}
979 979
 	public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '') {
980 980
 		global $globalDBdriver;
981 981
 		if ($globalDBdriver == 'mysql') {
@@ -983,14 +983,14 @@  discard block
 block discarded – undo
983 983
 		} else {
984 984
 			$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);"; 
985 985
 		}
986
-                $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
987
-                 try {
988
-                        $sth = $this->db->prepare($query);
989
-                        $sth->execute($query_values);
990
-                } catch(PDOException $e) {
991
-                        return "error : ".$e->getMessage();
992
-                }
993
-        }
986
+				$query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
987
+				 try {
988
+						$sth = $this->db->prepare($query);
989
+						$sth->execute($query_values);
990
+				} catch(PDOException $e) {
991
+						return "error : ".$e->getMessage();
992
+				}
993
+		}
994 994
 	public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '') {
995 995
 		global $globalDBdriver;
996 996
 		if ($globalDBdriver == 'mysql') {
@@ -998,14 +998,14 @@  discard block
 block discarded – undo
998 998
 		} else {
999 999
 			$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);"; 
1000 1000
 		}
1001
-                $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name);
1002
-                 try {
1003
-                        $sth = $this->db->prepare($query);
1004
-                        $sth->execute($query_values);
1005
-                } catch(PDOException $e) {
1006
-                        return "error : ".$e->getMessage();
1007
-                }
1008
-        }
1001
+				$query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name);
1002
+				 try {
1003
+						$sth = $this->db->prepare($query);
1004
+						$sth->execute($query_values);
1005
+				} catch(PDOException $e) {
1006
+						return "error : ".$e->getMessage();
1007
+				}
1008
+		}
1009 1009
 	public function addStatCountry($iso2,$iso3,$name,$cnt,$filter_name = '') {
1010 1010
 		global $globalDBdriver;
1011 1011
 		if ($globalDBdriver == 'mysql') {
@@ -1013,14 +1013,14 @@  discard block
 block discarded – undo
1013 1013
 		} else {
1014 1014
 			$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);"; 
1015 1015
 		}
1016
-                $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name);
1017
-                 try {
1018
-                        $sth = $this->db->prepare($query);
1019
-                        $sth->execute($query_values);
1020
-                } catch(PDOException $e) {
1021
-                        return "error : ".$e->getMessage();
1022
-                }
1023
-        }
1016
+				$query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name);
1017
+				 try {
1018
+						$sth = $this->db->prepare($query);
1019
+						$sth->execute($query_values);
1020
+				} catch(PDOException $e) {
1021
+						return "error : ".$e->getMessage();
1022
+				}
1023
+		}
1024 1024
 	public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '') {
1025 1025
 		global $globalDBdriver;
1026 1026
 		if ($globalDBdriver == 'mysql') {
@@ -1028,14 +1028,14 @@  discard block
 block discarded – undo
1028 1028
 		} else {
1029 1029
 			$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);"; 
1030 1030
 		}
1031
-                $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);
1032
-                 try {
1033
-                        $sth = $this->db->prepare($query);
1034
-                        $sth->execute($query_values);
1035
-                } catch(PDOException $e) {
1036
-                        return "error : ".$e->getMessage();
1037
-                }
1038
-        }
1031
+				$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);
1032
+				 try {
1033
+						$sth = $this->db->prepare($query);
1034
+						$sth->execute($query_values);
1035
+				} catch(PDOException $e) {
1036
+						return "error : ".$e->getMessage();
1037
+				}
1038
+		}
1039 1039
 	public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '') {
1040 1040
 		global $globalDBdriver;
1041 1041
 		if ($globalDBdriver == 'mysql') {
@@ -1043,14 +1043,14 @@  discard block
 block discarded – undo
1043 1043
 		} else {
1044 1044
 			$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);"; 
1045 1045
 		}
1046
-                $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name);
1047
-                 try {
1048
-                        $sth = $this->db->prepare($query);
1049
-                        $sth->execute($query_values);
1050
-                } catch(PDOException $e) {
1051
-                        return "error : ".$e->getMessage();
1052
-                }
1053
-        }
1046
+				$query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name);
1047
+				 try {
1048
+						$sth = $this->db->prepare($query);
1049
+						$sth->execute($query_values);
1050
+				} catch(PDOException $e) {
1051
+						return "error : ".$e->getMessage();
1052
+				}
1053
+		}
1054 1054
 	public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '') {
1055 1055
 		global $globalDBdriver;
1056 1056
 		if ($globalDBdriver == 'mysql') {
@@ -1058,14 +1058,14 @@  discard block
 block discarded – undo
1058 1058
 		} else {
1059 1059
 			$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);"; 
1060 1060
 		}
1061
-                $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1062
-                 try {
1063
-                        $sth = $this->db->prepare($query);
1064
-                        $sth->execute($query_values);
1065
-                } catch(PDOException $e) {
1066
-                        return "error : ".$e->getMessage();
1067
-                }
1068
-        }
1061
+				$query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1062
+				 try {
1063
+						$sth = $this->db->prepare($query);
1064
+						$sth->execute($query_values);
1065
+				} catch(PDOException $e) {
1066
+						return "error : ".$e->getMessage();
1067
+				}
1068
+		}
1069 1069
 	public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '',$format_source = '') {
1070 1070
 		global $globalDBdriver;
1071 1071
 		if ($globalDBdriver == 'mysql') {
@@ -1073,14 +1073,14 @@  discard block
 block discarded – undo
1073 1073
 		} else {
1074 1074
 			$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);"; 
1075 1075
 		}
1076
-                $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);
1077
-                 try {
1078
-                        $sth = $this->db->prepare($query);
1079
-                        $sth->execute($query_values);
1080
-                } catch(PDOException $e) {
1081
-                        return "error : ".$e->getMessage();
1082
-                }
1083
-        }
1076
+				$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);
1077
+				 try {
1078
+						$sth = $this->db->prepare($query);
1079
+						$sth->execute($query_values);
1080
+				} catch(PDOException $e) {
1081
+						return "error : ".$e->getMessage();
1082
+				}
1083
+		}
1084 1084
 	public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') {
1085 1085
 		global $globalDBdriver;
1086 1086
 		if ($airport_icao != '') {
@@ -1096,8 +1096,8 @@  discard block
 block discarded – undo
1096 1096
 			} catch(PDOException $e) {
1097 1097
 				return "error : ".$e->getMessage();
1098 1098
 			}
1099
-                }
1100
-        }
1099
+				}
1100
+		}
1101 1101
 	public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') {
1102 1102
 		global $globalDBdriver;
1103 1103
 		if ($airport_icao != '') {
@@ -1113,8 +1113,8 @@  discard block
 block discarded – undo
1113 1113
 			} catch(PDOException $e) {
1114 1114
 				return "error : ".$e->getMessage();
1115 1115
 			}
1116
-                }
1117
-        }
1116
+				}
1117
+		}
1118 1118
 	public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') {
1119 1119
 		global $globalDBdriver;
1120 1120
 		if ($airport_icao != '') {
@@ -1123,15 +1123,15 @@  discard block
 block discarded – undo
1123 1123
 			} else {
1124 1124
 				$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);"; 
1125 1125
 			}
1126
-	                $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);
1126
+					$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);
1127 1127
 			 try {
1128
-                    		$sth = $this->db->prepare($query);
1129
-	                        $sth->execute($query_values);
1130
-    		        } catch(PDOException $e) {
1131
-            		        return "error : ".$e->getMessage();
1132
-	                }
1133
-	        }
1134
-        }
1128
+							$sth = $this->db->prepare($query);
1129
+							$sth->execute($query_values);
1130
+					} catch(PDOException $e) {
1131
+							return "error : ".$e->getMessage();
1132
+					}
1133
+			}
1134
+		}
1135 1135
 	public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') {
1136 1136
 		global $globalDBdriver;
1137 1137
 		if ($airport_icao != '') {
@@ -1147,46 +1147,46 @@  discard block
 block discarded – undo
1147 1147
 			} catch(PDOException $e) {
1148 1148
 				return "error : ".$e->getMessage();
1149 1149
 			}
1150
-                }
1151
-        }
1150
+				}
1151
+		}
1152 1152
 
1153 1153
 	public function deleteStat($id) {
1154
-                $query = "DELETE FROM stats WHERE stats_id = :id";
1155
-                $query_values = array(':id' => $id);
1156
-                 try {
1157
-                        $sth = $this->db->prepare($query);
1158
-                        $sth->execute($query_values);
1159
-                } catch(PDOException $e) {
1160
-                        return "error : ".$e->getMessage();
1161
-                }
1162
-        }
1154
+				$query = "DELETE FROM stats WHERE stats_id = :id";
1155
+				$query_values = array(':id' => $id);
1156
+				 try {
1157
+						$sth = $this->db->prepare($query);
1158
+						$sth->execute($query_values);
1159
+				} catch(PDOException $e) {
1160
+						return "error : ".$e->getMessage();
1161
+				}
1162
+		}
1163 1163
 	public function deleteStatFlight($type) {
1164
-                $query = "DELETE FROM stats_flight WHERE stats_type = :type";
1165
-                $query_values = array(':type' => $type);
1166
-                 try {
1167
-                        $sth = $this->db->prepare($query);
1168
-                        $sth->execute($query_values);
1169
-                } catch(PDOException $e) {
1170
-                        return "error : ".$e->getMessage();
1171
-                }
1172
-        }
1164
+				$query = "DELETE FROM stats_flight WHERE stats_type = :type";
1165
+				$query_values = array(':type' => $type);
1166
+				 try {
1167
+						$sth = $this->db->prepare($query);
1168
+						$sth->execute($query_values);
1169
+				} catch(PDOException $e) {
1170
+						return "error : ".$e->getMessage();
1171
+				}
1172
+		}
1173 1173
 	public function deleteStatAirport($type) {
1174
-                $query = "DELETE FROM stats_airport WHERE stats_type = :type";
1175
-                $query_values = array(':type' => $type);
1176
-                 try {
1177
-                        $sth = $this->db->prepare($query);
1178
-                        $sth->execute($query_values);
1179
-                } catch(PDOException $e) {
1180
-                        return "error : ".$e->getMessage();
1181
-                }
1182
-        }
1174
+				$query = "DELETE FROM stats_airport WHERE stats_type = :type";
1175
+				$query_values = array(':type' => $type);
1176
+				 try {
1177
+						$sth = $this->db->prepare($query);
1178
+						$sth->execute($query_values);
1179
+				} catch(PDOException $e) {
1180
+						return "error : ".$e->getMessage();
1181
+				}
1182
+		}
1183 1183
         
1184
-        public function addOldStats() {
1185
-    		global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats;
1186
-    		$Common = new Common();
1187
-    		$Connection = new Connection();
1188
-    		date_default_timezone_set('UTC');
1189
-    		$last_update = $this->getLastStatsUpdate('last_update_stats');
1184
+		public function addOldStats() {
1185
+			global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats;
1186
+			$Common = new Common();
1187
+			$Connection = new Connection();
1188
+			date_default_timezone_set('UTC');
1189
+			$last_update = $this->getLastStatsUpdate('last_update_stats');
1190 1190
 		//print_r($last_update);
1191 1191
 		/*
1192 1192
 		$flightsbymonth = $this->getStats('flights_by_month');
@@ -1448,24 +1448,24 @@  discard block
 block discarded – undo
1448 1448
 			if ($globalDebug) echo 'Count all departure airports...'."\n";
1449 1449
 			$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day);
1450 1450
 			if ($globalDebug) echo 'Count all detected departure airports...'."\n";
1451
-        		$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day);
1451
+				$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day);
1452 1452
 			if ($globalDebug) echo 'Order departure airports...'."\n";
1453
-	        	$alldata = array();
1453
+				$alldata = array();
1454 1454
 	        	
1455
-    			foreach ($pall as $value) {
1456
-	        		$icao = $value['airport_departure_icao'];
1457
-    				$alldata[$icao] = $value;
1458
-	        	}
1459
-	        	foreach ($dall as $value) {
1460
-    				$icao = $value['airport_departure_icao'];
1461
-        			if (isset($alldata[$icao])) {
1462
-    					$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1463
-        			} else $alldata[$icao] = $value;
1464
-			}
1465
-    			$count = array();
1466
-    			foreach ($alldata as $key => $row) {
1467
-    				$count[$key] = $row['airport_departure_icao_count'];
1468
-        		}
1455
+				foreach ($pall as $value) {
1456
+					$icao = $value['airport_departure_icao'];
1457
+					$alldata[$icao] = $value;
1458
+				}
1459
+				foreach ($dall as $value) {
1460
+					$icao = $value['airport_departure_icao'];
1461
+					if (isset($alldata[$icao])) {
1462
+						$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1463
+					} else $alldata[$icao] = $value;
1464
+			}
1465
+				$count = array();
1466
+				foreach ($alldata as $key => $row) {
1467
+					$count[$key] = $row['airport_departure_icao_count'];
1468
+				}
1469 1469
 			array_multisort($count,SORT_DESC,$alldata);
1470 1470
 			foreach ($alldata as $number) {
1471 1471
 				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count']);
@@ -1473,25 +1473,25 @@  discard block
 block discarded – undo
1473 1473
 			if ($globalDebug) echo 'Count all arrival airports...'."\n";
1474 1474
 			$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day);
1475 1475
 			if ($globalDebug) echo 'Count all detected arrival airports...'."\n";
1476
-        		$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day);
1476
+				$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day);
1477 1477
 			if ($globalDebug) echo 'Order arrival airports...'."\n";
1478
-	        	$alldata = array();
1479
-    			foreach ($pall as $value) {
1480
-	        		$icao = $value['airport_arrival_icao'];
1481
-    				$alldata[$icao] = $value;
1482
-	        	}
1483
-	        	foreach ($dall as $value) {
1484
-    				$icao = $value['airport_arrival_icao'];
1485
-        			if (isset($alldata[$icao])) {
1486
-        				$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1487
-	        		} else $alldata[$icao] = $value;
1488
-    			}
1489
-        		$count = array();
1490
-        		foreach ($alldata as $key => $row) {
1491
-        			$count[$key] = $row['airport_arrival_icao_count'];
1492
-	        	}
1493
-    			array_multisort($count,SORT_DESC,$alldata);
1494
-                        foreach ($alldata as $number) {
1478
+				$alldata = array();
1479
+				foreach ($pall as $value) {
1480
+					$icao = $value['airport_arrival_icao'];
1481
+					$alldata[$icao] = $value;
1482
+				}
1483
+				foreach ($dall as $value) {
1484
+					$icao = $value['airport_arrival_icao'];
1485
+					if (isset($alldata[$icao])) {
1486
+						$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1487
+					} else $alldata[$icao] = $value;
1488
+				}
1489
+				$count = array();
1490
+				foreach ($alldata as $key => $row) {
1491
+					$count[$key] = $row['airport_arrival_icao_count'];
1492
+				}
1493
+				array_multisort($count,SORT_DESC,$alldata);
1494
+						foreach ($alldata as $number) {
1495 1495
 				echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count']);
1496 1496
 			}
1497 1497
 			if ($Connection->tableExists('countries')) {
@@ -1551,8 +1551,8 @@  discard block
 block discarded – undo
1551 1551
 //			$pall = $Spotter->getLast7DaysAirportsDeparture();
1552 1552
   //      		$dall = $Spotter->getLast7DaysDetectedAirportsDeparture();
1553 1553
 			$pall = $Spotter->getLast7DaysAirportsDeparture();
1554
-        		$dall = $Spotter->getLast7DaysDetectedAirportsDeparture();
1555
-        		/*
1554
+				$dall = $Spotter->getLast7DaysDetectedAirportsDeparture();
1555
+				/*
1556 1556
 	        	$alldata = array();
1557 1557
     			foreach ($pall as $value) {
1558 1558
 	        		$icao = $value['departure_airport_icao'];
@@ -1571,29 +1571,29 @@  discard block
 block discarded – undo
1571 1571
 	        	}
1572 1572
     			array_multisort($count,SORT_DESC,$alldata);
1573 1573
     			*/
1574
-    			foreach ($dall as $value) {
1575
-    				$icao = $value['departure_airport_icao'];
1576
-    				$ddate = $value['date'];
1577
-    				$find = false;
1578
-    				foreach ($pall as $pvalue) {
1579
-    					if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1580
-    						$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1581
-    						$find = true;
1582
-    						break;
1583
-    					}
1584
-    				}
1585
-    				if ($find === false) {
1586
-    					$pall[] = $value;
1587
-    				}
1588
-    			}
1589
-    			$alldata = $pall;
1574
+				foreach ($dall as $value) {
1575
+					$icao = $value['departure_airport_icao'];
1576
+					$ddate = $value['date'];
1577
+					$find = false;
1578
+					foreach ($pall as $pvalue) {
1579
+						if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1580
+							$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1581
+							$find = true;
1582
+							break;
1583
+						}
1584
+					}
1585
+					if ($find === false) {
1586
+						$pall[] = $value;
1587
+					}
1588
+				}
1589
+				$alldata = $pall;
1590 1590
 			foreach ($alldata as $number) {
1591 1591
 				$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']);
1592 1592
 			}
1593 1593
 			echo '...Arrival'."\n";
1594 1594
 			$pall = $Spotter->getLast7DaysAirportsArrival();
1595
-        		$dall = $Spotter->getLast7DaysDetectedAirportsArrival();
1596
-        		/*
1595
+				$dall = $Spotter->getLast7DaysDetectedAirportsArrival();
1596
+				/*
1597 1597
 	        	$alldata = array();
1598 1598
     			foreach ($pall as $value) {
1599 1599
 	        		$icao = $value['arrival_airport_icao'];
@@ -1613,22 +1613,22 @@  discard block
 block discarded – undo
1613 1613
     			*/
1614 1614
 
1615 1615
 
1616
-    			foreach ($dall as $value) {
1617
-    				$icao = $value['arrival_airport_icao'];
1618
-    				$ddate = $value['date'];
1619
-    				$find = false;
1620
-    				foreach ($pall as $pvalue) {
1621
-    					if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1622
-    						$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1623
-    						$find = true;
1624
-    						break;
1625
-    					}
1626
-    				}
1627
-    				if ($find === false) {
1628
-    					$pall[] = $value;
1629
-    				}
1630
-    			}
1631
-    			$alldata = $pall;
1616
+				foreach ($dall as $value) {
1617
+					$icao = $value['arrival_airport_icao'];
1618
+					$ddate = $value['date'];
1619
+					$find = false;
1620
+					foreach ($pall as $pvalue) {
1621
+						if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1622
+							$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1623
+							$find = true;
1624
+							break;
1625
+						}
1626
+					}
1627
+					if ($find === false) {
1628
+						$pall[] = $value;
1629
+					}
1630
+				}
1631
+				$alldata = $pall;
1632 1632
 			foreach ($alldata as $number) {
1633 1633
 				$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']);
1634 1634
 			}
@@ -1695,51 +1695,51 @@  discard block
 block discarded – undo
1695 1695
 			if ($globalDebug) echo 'Count all departure airports by airlines...'."\n";
1696 1696
 			$pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day);
1697 1697
 			if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n";
1698
-       			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day);
1698
+	   			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day);
1699 1699
 			if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n";
1700
-	        	//$alldata = array();
1701
-    			foreach ($dall as $value) {
1702
-    				$icao = $value['airport_departure_icao'];
1703
-    				$dicao = $value['airline_icao'];
1704
-    				$find = false;
1705
-    				foreach ($pall as $pvalue) {
1706
-    					if ($pvalue['airport_departure_icao'] == $icao && $pvalue['airline_icao'] = $dicao) {
1707
-    						$pvalue['airport_departure_icao_count'] = $pvalue['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1708
-    						$find = true;
1709
-    						break;
1710
-    					}
1711
-    				}
1712
-    				if ($find === false) {
1713
-    					$pall[] = $value;
1714
-    				}
1715
-    			}
1716
-    			$alldata = $pall;
1700
+				//$alldata = array();
1701
+				foreach ($dall as $value) {
1702
+					$icao = $value['airport_departure_icao'];
1703
+					$dicao = $value['airline_icao'];
1704
+					$find = false;
1705
+					foreach ($pall as $pvalue) {
1706
+						if ($pvalue['airport_departure_icao'] == $icao && $pvalue['airline_icao'] = $dicao) {
1707
+							$pvalue['airport_departure_icao_count'] = $pvalue['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1708
+							$find = true;
1709
+							break;
1710
+						}
1711
+					}
1712
+					if ($find === false) {
1713
+						$pall[] = $value;
1714
+					}
1715
+				}
1716
+				$alldata = $pall;
1717 1717
 			foreach ($alldata as $number) {
1718 1718
 				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']);
1719 1719
 			}
1720 1720
 			if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n";
1721 1721
 			$pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day);
1722 1722
 			if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n";
1723
-        		$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day);
1723
+				$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day);
1724 1724
 			if ($globalDebug) echo 'Order arrival airports by airlines...'."\n";
1725
-	        	//$alldata = array();
1726
-    			foreach ($dall as $value) {
1727
-    				$icao = $value['airport_arrival_icao'];
1728
-    				$dicao = $value['airline_icao'];
1729
-    				$find = false;
1730
-    				foreach ($pall as $pvalue) {
1731
-    					if ($pvalue['airport_arrival_icao'] == $icao && $pvalue['airline_icao'] = $dicao) {
1732
-    						$pvalue['airport_arrival_icao_count'] = $pvalue['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1733
-    						$find = true;
1734
-    						break;
1735
-    					}
1736
-    				}
1737
-    				if ($find === false) {
1738
-    					$pall[] = $value;
1739
-    				}
1740
-    			}
1741
-    			$alldata = $pall;
1742
-                        foreach ($alldata as $number) {
1725
+				//$alldata = array();
1726
+				foreach ($dall as $value) {
1727
+					$icao = $value['airport_arrival_icao'];
1728
+					$dicao = $value['airline_icao'];
1729
+					$find = false;
1730
+					foreach ($pall as $pvalue) {
1731
+						if ($pvalue['airport_arrival_icao'] == $icao && $pvalue['airline_icao'] = $dicao) {
1732
+							$pvalue['airport_arrival_icao_count'] = $pvalue['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1733
+							$find = true;
1734
+							break;
1735
+						}
1736
+					}
1737
+					if ($find === false) {
1738
+						$pall[] = $value;
1739
+					}
1740
+				}
1741
+				$alldata = $pall;
1742
+						foreach ($alldata as $number) {
1743 1743
 				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']);
1744 1744
 			}
1745 1745
 			if ($globalDebug) echo 'Count all flights by months by airlines...'."\n";
@@ -1772,47 +1772,47 @@  discard block
 block discarded – undo
1772 1772
 			}
1773 1773
 			if ($globalDebug) echo '...Departure'."\n";
1774 1774
 			$pall = $Spotter->getLast7DaysAirportsDepartureByAirlines();
1775
-        		$dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines();
1776
-    			foreach ($dall as $value) {
1777
-    				$icao = $value['departure_airport_icao'];
1778
-    				$airline = $value['airline_icao'];
1779
-    				$ddate = $value['date'];
1780
-    				$find = false;
1781
-    				foreach ($pall as $pvalue) {
1782
-    					if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] = $airline) {
1783
-    						$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1784
-    						$find = true;
1785
-    						break;
1786
-    					}
1787
-    				}
1788
-    				if ($find === false) {
1789
-    					$pall[] = $value;
1790
-    				}
1791
-    			}
1792
-    			$alldata = $pall;
1775
+				$dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines();
1776
+				foreach ($dall as $value) {
1777
+					$icao = $value['departure_airport_icao'];
1778
+					$airline = $value['airline_icao'];
1779
+					$ddate = $value['date'];
1780
+					$find = false;
1781
+					foreach ($pall as $pvalue) {
1782
+						if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] = $airline) {
1783
+							$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1784
+							$find = true;
1785
+							break;
1786
+						}
1787
+					}
1788
+					if ($find === false) {
1789
+						$pall[] = $value;
1790
+					}
1791
+				}
1792
+				$alldata = $pall;
1793 1793
 			foreach ($alldata as $number) {
1794 1794
 				$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']);
1795 1795
 			}
1796 1796
 			if ($globalDebug) echo '...Arrival'."\n";
1797 1797
 			$pall = $Spotter->getLast7DaysAirportsArrivalByAirlines();
1798
-        		$dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines();
1799
-    			foreach ($dall as $value) {
1800
-    				$icao = $value['arrival_airport_icao'];
1801
-    				$airline = $value['airline_icao'];
1802
-    				$ddate = $value['date'];
1803
-    				$find = false;
1804
-    				foreach ($pall as $pvalue) {
1805
-    					if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] == $airline) {
1806
-    						$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1807
-    						$find = true;
1808
-    						break;
1809
-    					}
1810
-    				}
1811
-    				if ($find === false) {
1812
-    					$pall[] = $value;
1813
-    				}
1814
-    			}
1815
-    			$alldata = $pall;
1798
+				$dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines();
1799
+				foreach ($dall as $value) {
1800
+					$icao = $value['arrival_airport_icao'];
1801
+					$airline = $value['airline_icao'];
1802
+					$ddate = $value['date'];
1803
+					$find = false;
1804
+					foreach ($pall as $pvalue) {
1805
+						if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] == $airline) {
1806
+							$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1807
+							$find = true;
1808
+							break;
1809
+						}
1810
+					}
1811
+					if ($find === false) {
1812
+						$pall[] = $value;
1813
+					}
1814
+				}
1815
+				$alldata = $pall;
1816 1816
 			foreach ($alldata as $number) {
1817 1817
 				$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']);
1818 1818
 			}
@@ -1881,44 +1881,44 @@  discard block
 block discarded – undo
1881 1881
 					$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name,$number['format_source']);
1882 1882
 				}
1883 1883
 				$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter);
1884
-	       			$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter);
1885
-		        	$alldata = array();
1886
-	    			foreach ($pall as $value) {
1887
-		        		$icao = $value['airport_departure_icao'];
1888
-    					$alldata[$icao] = $value;
1889
-	    			}
1890
-		        	foreach ($dall as $value) {
1891
-	    				$icao = $value['airport_departure_icao'];
1892
-        				if (isset($alldata[$icao])) {
1893
-    						$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1894
-        				} else $alldata[$icao] = $value;
1895
-				}
1896
-	    			$count = array();
1897
-    				foreach ($alldata as $key => $row) {
1898
-    					$count[$key] = $row['airport_departure_icao_count'];
1899
-    				}
1884
+		   			$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter);
1885
+					$alldata = array();
1886
+					foreach ($pall as $value) {
1887
+						$icao = $value['airport_departure_icao'];
1888
+						$alldata[$icao] = $value;
1889
+					}
1890
+					foreach ($dall as $value) {
1891
+						$icao = $value['airport_departure_icao'];
1892
+						if (isset($alldata[$icao])) {
1893
+							$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1894
+						} else $alldata[$icao] = $value;
1895
+				}
1896
+					$count = array();
1897
+					foreach ($alldata as $key => $row) {
1898
+						$count[$key] = $row['airport_departure_icao_count'];
1899
+					}
1900 1900
 				array_multisort($count,SORT_DESC,$alldata);
1901 1901
 				foreach ($alldata as $number) {
1902
-    					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);
1902
+						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);
1903 1903
 				}
1904 1904
 				$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,false,$filter);
1905
-    				$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter);
1905
+					$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter);
1906 1906
 				$alldata = array();
1907
-    				foreach ($pall as $value) {
1908
-		        		$icao = $value['airport_arrival_icao'];
1909
-    					$alldata[$icao] = $value;
1910
-	    			}
1911
-		        	foreach ($dall as $value) {
1912
-	    				$icao = $value['airport_arrival_icao'];
1913
-        				if (isset($alldata[$icao])) {
1914
-        					$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1915
-		        		} else $alldata[$icao] = $value;
1916
-	    			}
1917
-        			$count = array();
1918
-        			foreach ($alldata as $key => $row) {
1919
-    					$count[$key] = $row['airport_arrival_icao_count'];
1920
-		        	}
1921
-        			array_multisort($count,SORT_DESC,$alldata);
1907
+					foreach ($pall as $value) {
1908
+						$icao = $value['airport_arrival_icao'];
1909
+						$alldata[$icao] = $value;
1910
+					}
1911
+					foreach ($dall as $value) {
1912
+						$icao = $value['airport_arrival_icao'];
1913
+						if (isset($alldata[$icao])) {
1914
+							$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1915
+						} else $alldata[$icao] = $value;
1916
+					}
1917
+					$count = array();
1918
+					foreach ($alldata as $key => $row) {
1919
+						$count[$key] = $row['airport_arrival_icao_count'];
1920
+					}
1921
+					array_multisort($count,SORT_DESC,$alldata);
1922 1922
 				foreach ($alldata as $number) {
1923 1923
 					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);
1924 1924
 				}
@@ -1951,45 +1951,45 @@  discard block
 block discarded – undo
1951 1951
 				}
1952 1952
 				echo '...Departure'."\n";
1953 1953
 				$pall = $Spotter->getLast7DaysAirportsDeparture('',$filter);
1954
-        			$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter);
1954
+					$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter);
1955 1955
 				foreach ($dall as $value) {
1956
-    					$icao = $value['departure_airport_icao'];
1957
-    					$ddate = $value['date'];
1958
-    					$find = false;
1959
-    					foreach ($pall as $pvalue) {
1960
-    						if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1961
-    							$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1962
-	    						$find = true;
1963
-    							break;
1964
-    						}
1965
-    					}
1966
-    					if ($find === false) {
1967
-    						$pall[] = $value;
1968
-	    				}
1969
-    				}
1970
-	    			$alldata = $pall;
1956
+						$icao = $value['departure_airport_icao'];
1957
+						$ddate = $value['date'];
1958
+						$find = false;
1959
+						foreach ($pall as $pvalue) {
1960
+							if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1961
+								$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1962
+								$find = true;
1963
+								break;
1964
+							}
1965
+						}
1966
+						if ($find === false) {
1967
+							$pall[] = $value;
1968
+						}
1969
+					}
1970
+					$alldata = $pall;
1971 1971
 				foreach ($alldata as $number) {
1972 1972
 					$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);
1973 1973
 				}
1974 1974
 				echo '...Arrival'."\n";
1975 1975
 				$pall = $Spotter->getLast7DaysAirportsArrival('',$filter);
1976
-    				$dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter);
1976
+					$dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter);
1977 1977
 				foreach ($dall as $value) {
1978 1978
 					$icao = $value['arrival_airport_icao'];
1979 1979
 					$ddate = $value['date'];
1980
-    					$find = false;
1980
+						$find = false;
1981 1981
 					foreach ($pall as $pvalue) {
1982
-    						if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1983
-    							$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1984
-    							$find = true;
1985
-    							break;
1986
-	    					}
1987
-    					}
1988
-    					if ($find === false) {
1989
-    						$pall[] = $value;
1990
-	    				}
1991
-    				}
1992
-    				$alldata = $pall;
1982
+							if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1983
+								$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1984
+								$find = true;
1985
+								break;
1986
+							}
1987
+						}
1988
+						if ($find === false) {
1989
+							$pall[] = $value;
1990
+						}
1991
+					}
1992
+					$alldata = $pall;
1993 1993
 				foreach ($alldata as $number) {
1994 1994
 					$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);
1995 1995
 				}
Please login to merge, or discard this 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,163 +925,163 @@  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 = '') {
979
+	public function addStatAircraftRegistration($registration, $cnt, $aircraft_icao = '', $airline_icao = '', $filter_name = '') {
980 980
 		global $globalDBdriver;
981 981
 		if ($globalDBdriver == 'mysql') {
982 982
 			$query = "INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline,filter_name) VALUES (:aircraft_icao,:registration,:cnt,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt";
983 983
 		} else {
984 984
 			$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);"; 
985 985
 		}
986
-                $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
986
+                $query_values = array(':aircraft_icao' => $aircraft_icao, ':registration' => $registration, ':cnt' => $cnt, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
987 987
                  try {
988 988
                         $sth = $this->db->prepare($query);
989 989
                         $sth->execute($query_values);
990
-                } catch(PDOException $e) {
990
+                } catch (PDOException $e) {
991 991
                         return "error : ".$e->getMessage();
992 992
                 }
993 993
         }
994
-	public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '') {
994
+	public function addStatCallsign($callsign_icao, $cnt, $airline_icao = '', $filter_name = '') {
995 995
 		global $globalDBdriver;
996 996
 		if ($globalDBdriver == 'mysql') {
997 997
 			$query = "INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt,filter_name) VALUES (:callsign_icao,:airline_icao,:cnt,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt";
998 998
 		} else {
999 999
 			$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);"; 
1000 1000
 		}
1001
-                $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name);
1001
+                $query_values = array(':callsign_icao' => $callsign_icao, ':airline_icao' => $airline_icao, ':cnt' => $cnt, ':filter_name' => $filter_name);
1002 1002
                  try {
1003 1003
                         $sth = $this->db->prepare($query);
1004 1004
                         $sth->execute($query_values);
1005
-                } catch(PDOException $e) {
1005
+                } catch (PDOException $e) {
1006 1006
                         return "error : ".$e->getMessage();
1007 1007
                 }
1008 1008
         }
1009
-	public function addStatCountry($iso2,$iso3,$name,$cnt,$filter_name = '') {
1009
+	public function addStatCountry($iso2, $iso3, $name, $cnt, $filter_name = '') {
1010 1010
 		global $globalDBdriver;
1011 1011
 		if ($globalDBdriver == 'mysql') {
1012 1012
 			$query = "INSERT INTO stats_country (iso2,iso3,name,cnt,filter_name) VALUES (:iso2,:iso3,:name,:cnt,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt";
1013 1013
 		} else {
1014 1014
 			$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);"; 
1015 1015
 		}
1016
-                $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name);
1016
+                $query_values = array(':iso2' => $iso2, ':iso3' => $iso3, ':name' => $name, ':cnt' => $cnt, ':filter_name' => $filter_name);
1017 1017
                  try {
1018 1018
                         $sth = $this->db->prepare($query);
1019 1019
                         $sth->execute($query_values);
1020
-                } catch(PDOException $e) {
1020
+                } catch (PDOException $e) {
1021 1021
                         return "error : ".$e->getMessage();
1022 1022
                 }
1023 1023
         }
1024
-	public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '') {
1024
+	public function addStatAircraft($aircraft_icao, $cnt, $aircraft_name = '', $aircraft_manufacturer = '', $airline_icao = '', $filter_name = '') {
1025 1025
 		global $globalDBdriver;
1026 1026
 		if ($globalDBdriver == 'mysql') {
1027 1027
 			$query = "INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline, filter_name) VALUES (:aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer, stats_airline = :stats_airline";
1028 1028
 		} else {
1029 1029
 			$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);"; 
1030 1030
 		}
1031
-                $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);
1031
+                $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);
1032 1032
                  try {
1033 1033
                         $sth = $this->db->prepare($query);
1034 1034
                         $sth->execute($query_values);
1035
-                } catch(PDOException $e) {
1035
+                } catch (PDOException $e) {
1036 1036
                         return "error : ".$e->getMessage();
1037 1037
                 }
1038 1038
         }
1039
-	public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '') {
1039
+	public function addStatAirline($airline_icao, $cnt, $airline_name = '', $filter_name = '') {
1040 1040
 		global $globalDBdriver;
1041 1041
 		if ($globalDBdriver == 'mysql') {
1042 1042
 			$query = "INSERT INTO stats_airline (airline_icao,airline_name,cnt,filter_name) VALUES (:airline_icao,:airline_name,:cnt,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt,airline_name = :airline_name";
1043 1043
 		} else {
1044 1044
 			$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);"; 
1045 1045
 		}
1046
-                $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name);
1046
+                $query_values = array(':airline_icao' => $airline_icao, ':airline_name' => $airline_name, ':cnt' => $cnt, ':filter_name' => $filter_name);
1047 1047
                  try {
1048 1048
                         $sth = $this->db->prepare($query);
1049 1049
                         $sth->execute($query_values);
1050
-                } catch(PDOException $e) {
1050
+                } catch (PDOException $e) {
1051 1051
                         return "error : ".$e->getMessage();
1052 1052
                 }
1053 1053
         }
1054
-	public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '') {
1054
+	public function addStatOwner($owner_name, $cnt, $stats_airline = '', $filter_name = '') {
1055 1055
 		global $globalDBdriver;
1056 1056
 		if ($globalDBdriver == 'mysql') {
1057 1057
 			$query = "INSERT INTO stats_owner (owner_name,cnt,stats_airline,filter_name) VALUES (:owner_name,:cnt,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt";
1058 1058
 		} else {
1059 1059
 			$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);"; 
1060 1060
 		}
1061
-                $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1061
+                $query_values = array(':owner_name' => $owner_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
1062 1062
                  try {
1063 1063
                         $sth = $this->db->prepare($query);
1064 1064
                         $sth->execute($query_values);
1065
-                } catch(PDOException $e) {
1065
+                } catch (PDOException $e) {
1066 1066
                         return "error : ".$e->getMessage();
1067 1067
                 }
1068 1068
         }
1069
-	public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '',$format_source = '') {
1069
+	public function addStatPilot($pilot_id, $cnt, $pilot_name, $stats_airline = '', $filter_name = '', $format_source = '') {
1070 1070
 		global $globalDBdriver;
1071 1071
 		if ($globalDBdriver == 'mysql') {
1072 1072
 			$query = "INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name,format_source) VALUES (:pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name,:format_source) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, pilot_name = :pilot_name";
1073 1073
 		} else {
1074 1074
 			$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);"; 
1075 1075
 		}
1076
-                $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);
1076
+                $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);
1077 1077
                  try {
1078 1078
                         $sth = $this->db->prepare($query);
1079 1079
                         $sth->execute($query_values);
1080
-                } catch(PDOException $e) {
1080
+                } catch (PDOException $e) {
1081 1081
                         return "error : ".$e->getMessage();
1082 1082
                 }
1083 1083
         }
1084
-	public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') {
1084
+	public function addStatDepartureAirports($airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') {
1085 1085
 		global $globalDBdriver;
1086 1086
 		if ($airport_icao != '') {
1087 1087
 			if ($globalDBdriver == 'mysql') {
@@ -1089,16 +1089,16 @@  discard block
 block discarded – undo
1089 1089
 			} else {
1090 1090
 				$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);"; 
1091 1091
 			}
1092
-			$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);
1092
+			$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);
1093 1093
 			try {
1094 1094
 				$sth = $this->db->prepare($query);
1095 1095
 				$sth->execute($query_values);
1096
-			} catch(PDOException $e) {
1096
+			} catch (PDOException $e) {
1097 1097
 				return "error : ".$e->getMessage();
1098 1098
 			}
1099 1099
                 }
1100 1100
         }
1101
-	public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') {
1101
+	public function addStatDepartureAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') {
1102 1102
 		global $globalDBdriver;
1103 1103
 		if ($airport_icao != '') {
1104 1104
 			if ($globalDBdriver == 'mysql') {
@@ -1106,16 +1106,16 @@  discard block
 block discarded – undo
1106 1106
 			} else {
1107 1107
 				$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);"; 
1108 1108
 			}
1109
-			$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);
1109
+			$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);
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 1117
         }
1118
-	public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') {
1118
+	public function addStatArrivalAirports($airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') {
1119 1119
 		global $globalDBdriver;
1120 1120
 		if ($airport_icao != '') {
1121 1121
 			if ($globalDBdriver == 'mysql') {
@@ -1123,16 +1123,16 @@  discard block
 block discarded – undo
1123 1123
 			} else {
1124 1124
 				$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);"; 
1125 1125
 			}
1126
-	                $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);
1126
+	                $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);
1127 1127
 			 try {
1128 1128
                     		$sth = $this->db->prepare($query);
1129 1129
 	                        $sth->execute($query_values);
1130
-    		        } catch(PDOException $e) {
1130
+    		        } catch (PDOException $e) {
1131 1131
             		        return "error : ".$e->getMessage();
1132 1132
 	                }
1133 1133
 	        }
1134 1134
         }
1135
-	public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') {
1135
+	public function addStatArrivalAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') {
1136 1136
 		global $globalDBdriver;
1137 1137
 		if ($airport_icao != '') {
1138 1138
 			if ($globalDBdriver == 'mysql') {
@@ -1140,11 +1140,11 @@  discard block
 block discarded – undo
1140 1140
 			} else {
1141 1141
 				$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);"; 
1142 1142
 			}
1143
-			$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);
1143
+			$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);
1144 1144
 			try {
1145 1145
 				$sth = $this->db->prepare($query);
1146 1146
 				$sth->execute($query_values);
1147
-			} catch(PDOException $e) {
1147
+			} catch (PDOException $e) {
1148 1148
 				return "error : ".$e->getMessage();
1149 1149
 			}
1150 1150
                 }
@@ -1156,7 +1156,7 @@  discard block
 block discarded – undo
1156 1156
                  try {
1157 1157
                         $sth = $this->db->prepare($query);
1158 1158
                         $sth->execute($query_values);
1159
-                } catch(PDOException $e) {
1159
+                } catch (PDOException $e) {
1160 1160
                         return "error : ".$e->getMessage();
1161 1161
                 }
1162 1162
         }
@@ -1166,7 +1166,7 @@  discard block
 block discarded – undo
1166 1166
                  try {
1167 1167
                         $sth = $this->db->prepare($query);
1168 1168
                         $sth->execute($query_values);
1169
-                } catch(PDOException $e) {
1169
+                } catch (PDOException $e) {
1170 1170
                         return "error : ".$e->getMessage();
1171 1171
                 }
1172 1172
         }
@@ -1176,13 +1176,13 @@  discard block
 block discarded – undo
1176 1176
                  try {
1177 1177
                         $sth = $this->db->prepare($query);
1178 1178
                         $sth->execute($query_values);
1179
-                } catch(PDOException $e) {
1179
+                } catch (PDOException $e) {
1180 1180
                         return "error : ".$e->getMessage();
1181 1181
                 }
1182 1182
         }
1183 1183
         
1184 1184
         public function addOldStats() {
1185
-    		global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats;
1185
+    		global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters, $globalDeleteLastYearStats;
1186 1186
     		$Common = new Common();
1187 1187
     		$Connection = new Connection();
1188 1188
     		date_default_timezone_set('UTC');
@@ -1415,40 +1415,40 @@  discard block
 block discarded – undo
1415 1415
 				$last_update_day = $last_update[0]['value'];
1416 1416
 			} else $last_update_day = '2012-12-12 12:12:12';
1417 1417
 			$Spotter = new Spotter($this->db);
1418
-			$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day);
1418
+			$alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day);
1419 1419
 			foreach ($alldata as $number) {
1420
-				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer']);
1420
+				$this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer']);
1421 1421
 			}
1422 1422
 			if ($globalDebug) echo 'Count all airlines...'."\n";
1423
-			$alldata = $Spotter->countAllAirlines(false,0,$last_update_day);
1423
+			$alldata = $Spotter->countAllAirlines(false, 0, $last_update_day);
1424 1424
 			foreach ($alldata as $number) {
1425
-				$this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name']);
1425
+				$this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name']);
1426 1426
 			}
1427 1427
 			if ($globalDebug) echo 'Count all registrations...'."\n";
1428
-			$alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day);
1428
+			$alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day);
1429 1429
 			foreach ($alldata as $number) {
1430
-				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao']);
1430
+				$this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao']);
1431 1431
 			}
1432 1432
 			if ($globalDebug) echo 'Count all callsigns...'."\n";
1433
-			$alldata = $Spotter->countAllCallsigns(false,0,$last_update_day);
1433
+			$alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day);
1434 1434
 			foreach ($alldata as $number) {
1435
-				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']);
1435
+				$this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao']);
1436 1436
 			}
1437 1437
 			if ($globalDebug) echo 'Count all owners...'."\n";
1438
-			$alldata = $Spotter->countAllOwners(false,0,$last_update_day);
1438
+			$alldata = $Spotter->countAllOwners(false, 0, $last_update_day);
1439 1439
 			foreach ($alldata as $number) {
1440
-				$this->addStatOwner($number['owner_name'],$number['owner_count']);
1440
+				$this->addStatOwner($number['owner_name'], $number['owner_count']);
1441 1441
 			}
1442 1442
 			if ($globalDebug) echo 'Count all pilots...'."\n";
1443
-			$alldata = $Spotter->countAllPilots(false,0,$last_update_day);
1443
+			$alldata = $Spotter->countAllPilots(false, 0, $last_update_day);
1444 1444
 			foreach ($alldata as $number) {
1445
-				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source']);
1445
+				$this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', '', $number['format_source']);
1446 1446
 			}
1447 1447
 			
1448 1448
 			if ($globalDebug) echo 'Count all departure airports...'."\n";
1449
-			$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day);
1449
+			$pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day);
1450 1450
 			if ($globalDebug) echo 'Count all detected departure airports...'."\n";
1451
-        		$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day);
1451
+        		$dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day);
1452 1452
 			if ($globalDebug) echo 'Order departure airports...'."\n";
1453 1453
 	        	$alldata = array();
1454 1454
 	        	
@@ -1466,14 +1466,14 @@  discard block
 block discarded – undo
1466 1466
     			foreach ($alldata as $key => $row) {
1467 1467
     				$count[$key] = $row['airport_departure_icao_count'];
1468 1468
         		}
1469
-			array_multisort($count,SORT_DESC,$alldata);
1469
+			array_multisort($count, SORT_DESC, $alldata);
1470 1470
 			foreach ($alldata as $number) {
1471
-				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count']);
1471
+				echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count']);
1472 1472
 			}
1473 1473
 			if ($globalDebug) echo 'Count all arrival airports...'."\n";
1474
-			$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day);
1474
+			$pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day);
1475 1475
 			if ($globalDebug) echo 'Count all detected arrival airports...'."\n";
1476
-        		$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day);
1476
+        		$dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day);
1477 1477
 			if ($globalDebug) echo 'Order arrival airports...'."\n";
1478 1478
 	        	$alldata = array();
1479 1479
     			foreach ($pall as $value) {
@@ -1490,16 +1490,16 @@  discard block
 block discarded – undo
1490 1490
         		foreach ($alldata as $key => $row) {
1491 1491
         			$count[$key] = $row['airport_arrival_icao_count'];
1492 1492
 	        	}
1493
-    			array_multisort($count,SORT_DESC,$alldata);
1493
+    			array_multisort($count, SORT_DESC, $alldata);
1494 1494
                         foreach ($alldata as $number) {
1495
-				echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count']);
1495
+				echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count']);
1496 1496
 			}
1497 1497
 			if ($Connection->tableExists('countries')) {
1498 1498
 				if ($globalDebug) echo 'Count all flights by countries...'."\n";
1499 1499
 				$SpotterArchive = new SpotterArchive();
1500
-				$alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day);
1500
+				$alldata = $SpotterArchive->countAllFlightOverCountries(false, 0, $last_update_day);
1501 1501
 				foreach ($alldata as $number) {
1502
-					$this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count']);
1502
+					$this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count']);
1503 1503
 				}
1504 1504
 			}
1505 1505
 			
@@ -1513,37 +1513,37 @@  discard block
 block discarded – undo
1513 1513
 			$lastyear = false;
1514 1514
 			foreach ($alldata as $number) {
1515 1515
 				if ($number['year_name'] != date('Y')) $lastyear = true;
1516
-				$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'])));
1516
+				$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'])));
1517 1517
 			}
1518 1518
 			if ($globalDebug) echo 'Count all military flights by months...'."\n";
1519 1519
 			$alldata = $Spotter->countAllMilitaryMonths();
1520 1520
 			foreach ($alldata as $number) {
1521
-				$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'])));
1521
+				$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'])));
1522 1522
 			}
1523 1523
 			if ($globalDebug) echo 'Count all owners by months...'."\n";
1524 1524
 			$alldata = $Spotter->countAllMonthsOwners();
1525 1525
 			foreach ($alldata as $number) {
1526
-				$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'])));
1526
+				$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'])));
1527 1527
 			}
1528 1528
 			if ($globalDebug) echo 'Count all pilots by months...'."\n";
1529 1529
 			$alldata = $Spotter->countAllMonthsPilots();
1530 1530
 			foreach ($alldata as $number) {
1531
-				$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'])));
1531
+				$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'])));
1532 1532
 			}
1533 1533
 			if ($globalDebug) echo 'Count all airlines by months...'."\n";
1534 1534
 			$alldata = $Spotter->countAllMonthsAirlines();
1535 1535
 			foreach ($alldata as $number) {
1536
-				$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'])));
1536
+				$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'])));
1537 1537
 			}
1538 1538
 			if ($globalDebug) echo 'Count all aircrafts by months...'."\n";
1539 1539
 			$alldata = $Spotter->countAllMonthsAircrafts();
1540 1540
 			foreach ($alldata as $number) {
1541
-				$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'])));
1541
+				$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'])));
1542 1542
 			}
1543 1543
 			if ($globalDebug) echo 'Count all real arrivals by months...'."\n";
1544 1544
 			$alldata = $Spotter->countAllMonthsRealArrivals();
1545 1545
 			foreach ($alldata as $number) {
1546
-				$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'])));
1546
+				$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'])));
1547 1547
 			}
1548 1548
 			if ($globalDebug) echo 'Airports data...'."\n";
1549 1549
 			if ($globalDebug) echo '...Departure'."\n";
@@ -1588,7 +1588,7 @@  discard block
 block discarded – undo
1588 1588
     			}
1589 1589
     			$alldata = $pall;
1590 1590
 			foreach ($alldata as $number) {
1591
-				$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']);
1591
+				$this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count']);
1592 1592
 			}
1593 1593
 			echo '...Arrival'."\n";
1594 1594
 			$pall = $Spotter->getLast7DaysAirportsArrival();
@@ -1630,7 +1630,7 @@  discard block
 block discarded – undo
1630 1630
     			}
1631 1631
     			$alldata = $pall;
1632 1632
 			foreach ($alldata as $number) {
1633
-				$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']);
1633
+				$this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count']);
1634 1634
 			}
1635 1635
 
1636 1636
 			echo 'Flights data...'."\n";
@@ -1638,28 +1638,28 @@  discard block
 block discarded – undo
1638 1638
 			echo '-> countAllDatesLastMonth...'."\n";
1639 1639
 			$alldata = $Spotter->countAllDatesLastMonth();
1640 1640
 			foreach ($alldata as $number) {
1641
-				$this->addStatFlight('month',$number['date_name'],$number['date_count']);
1641
+				$this->addStatFlight('month', $number['date_name'], $number['date_count']);
1642 1642
 			}
1643 1643
 			echo '-> countAllDates...'."\n";
1644 1644
 			$previousdata = $this->countAllDates();
1645 1645
 			$previousdatabyairlines = $this->countAllDatesByAirlines();
1646 1646
 			$this->deleteStatFlight('date');
1647
-			$alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates());
1647
+			$alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates());
1648 1648
 			$values = array();
1649 1649
 			foreach ($alldata as $cnt) {
1650 1650
 				$values[] = $cnt['date_count'];
1651 1651
 			}
1652
-			array_multisort($values,SORT_DESC,$alldata);
1653
-			array_splice($alldata,11);
1652
+			array_multisort($values, SORT_DESC, $alldata);
1653
+			array_splice($alldata, 11);
1654 1654
 			foreach ($alldata as $number) {
1655
-				$this->addStatFlight('date',$number['date_name'],$number['date_count']);
1655
+				$this->addStatFlight('date', $number['date_name'], $number['date_count']);
1656 1656
 			}
1657 1657
 			
1658 1658
 			$this->deleteStatFlight('hour');
1659 1659
 			echo '-> countAllHours...'."\n";
1660 1660
 			$alldata = $Spotter->countAllHours('hour');
1661 1661
 			foreach ($alldata as $number) {
1662
-				$this->addStatFlight('hour',$number['hour_name'],$number['hour_count']);
1662
+				$this->addStatFlight('hour', $number['hour_name'], $number['hour_count']);
1663 1663
 			}
1664 1664
 
1665 1665
 
@@ -1668,34 +1668,34 @@  discard block
 block discarded – undo
1668 1668
 			echo '--- Stats by airlines ---'."\n";
1669 1669
 			if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n";
1670 1670
 			$Spotter = new Spotter($this->db);
1671
-			$alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day);
1671
+			$alldata = $Spotter->countAllAircraftTypesByAirlines(false, 0, $last_update_day);
1672 1672
 			foreach ($alldata as $number) {
1673
-				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao']);
1673
+				$this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], $number['airline_icao']);
1674 1674
 			}
1675 1675
 			if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n";
1676
-			$alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day);
1676
+			$alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false, 0, $last_update_day);
1677 1677
 			foreach ($alldata as $number) {
1678
-				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao']);
1678
+				$this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], $number['airline_icao']);
1679 1679
 			}
1680 1680
 			if ($globalDebug) echo 'Count all callsigns by airlines...'."\n";
1681
-			$alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day);
1681
+			$alldata = $Spotter->countAllCallsignsByAirlines(false, 0, $last_update_day);
1682 1682
 			foreach ($alldata as $number) {
1683
-				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']);
1683
+				$this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao']);
1684 1684
 			}
1685 1685
 			if ($globalDebug) echo 'Count all owners by airlines...'."\n";
1686
-			$alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day);
1686
+			$alldata = $Spotter->countAllOwnersByAirlines(false, 0, $last_update_day);
1687 1687
 			foreach ($alldata as $number) {
1688
-				$this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao']);
1688
+				$this->addStatOwner($number['owner_name'], $number['owner_count'], $number['airline_icao']);
1689 1689
 			}
1690 1690
 			if ($globalDebug) echo 'Count all pilots by airlines...'."\n";
1691
-			$alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day);
1691
+			$alldata = $Spotter->countAllPilotsByAirlines(false, 0, $last_update_day);
1692 1692
 			foreach ($alldata as $number) {
1693
-				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source']);
1693
+				$this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], $number['airline_icao'], '', $number['format_source']);
1694 1694
 			}
1695 1695
 			if ($globalDebug) echo 'Count all departure airports by airlines...'."\n";
1696
-			$pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day);
1696
+			$pall = $Spotter->countAllDepartureAirportsByAirlines(false, 0, $last_update_day);
1697 1697
 			if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n";
1698
-       			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day);
1698
+       			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false, 0, $last_update_day);
1699 1699
 			if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n";
1700 1700
 	        	//$alldata = array();
1701 1701
     			foreach ($dall as $value) {
@@ -1715,12 +1715,12 @@  discard block
 block discarded – undo
1715 1715
     			}
1716 1716
     			$alldata = $pall;
1717 1717
 			foreach ($alldata as $number) {
1718
-				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']);
1718
+				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']);
1719 1719
 			}
1720 1720
 			if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n";
1721
-			$pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day);
1721
+			$pall = $Spotter->countAllArrivalAirportsByAirlines(false, 0, $last_update_day);
1722 1722
 			if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n";
1723
-        		$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day);
1723
+        		$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false, 0, $last_update_day);
1724 1724
 			if ($globalDebug) echo 'Order arrival airports by airlines...'."\n";
1725 1725
 	        	//$alldata = array();
1726 1726
     			foreach ($dall as $value) {
@@ -1740,7 +1740,7 @@  discard block
 block discarded – undo
1740 1740
     			}
1741 1741
     			$alldata = $pall;
1742 1742
                         foreach ($alldata as $number) {
1743
-				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']);
1743
+				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']);
1744 1744
 			}
1745 1745
 			if ($globalDebug) echo 'Count all flights by months by airlines...'."\n";
1746 1746
 			$Spotter = new Spotter($this->db);
@@ -1748,27 +1748,27 @@  discard block
 block discarded – undo
1748 1748
 			$lastyear = false;
1749 1749
 			foreach ($alldata as $number) {
1750 1750
 				if ($number['year_name'] != date('Y')) $lastyear = true;
1751
-				$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']);
1751
+				$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']);
1752 1752
 			}
1753 1753
 			if ($globalDebug) echo 'Count all owners by months by airlines...'."\n";
1754 1754
 			$alldata = $Spotter->countAllMonthsOwnersByAirlines();
1755 1755
 			foreach ($alldata as $number) {
1756
-				$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']);
1756
+				$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']);
1757 1757
 			}
1758 1758
 			if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n";
1759 1759
 			$alldata = $Spotter->countAllMonthsPilotsByAirlines();
1760 1760
 			foreach ($alldata as $number) {
1761
-				$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']);
1761
+				$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']);
1762 1762
 			}
1763 1763
 			if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n";
1764 1764
 			$alldata = $Spotter->countAllMonthsAircraftsByAirlines();
1765 1765
 			foreach ($alldata as $number) {
1766
-				$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']);
1766
+				$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']);
1767 1767
 			}
1768 1768
 			if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n";
1769 1769
 			$alldata = $Spotter->countAllMonthsRealArrivalsByAirlines();
1770 1770
 			foreach ($alldata as $number) {
1771
-				$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']);
1771
+				$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']);
1772 1772
 			}
1773 1773
 			if ($globalDebug) echo '...Departure'."\n";
1774 1774
 			$pall = $Spotter->getLast7DaysAirportsDepartureByAirlines();
@@ -1791,7 +1791,7 @@  discard block
 block discarded – undo
1791 1791
     			}
1792 1792
     			$alldata = $pall;
1793 1793
 			foreach ($alldata as $number) {
1794
-				$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']);
1794
+				$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']);
1795 1795
 			}
1796 1796
 			if ($globalDebug) echo '...Arrival'."\n";
1797 1797
 			$pall = $Spotter->getLast7DaysAirportsArrivalByAirlines();
@@ -1814,32 +1814,32 @@  discard block
 block discarded – undo
1814 1814
     			}
1815 1815
     			$alldata = $pall;
1816 1816
 			foreach ($alldata as $number) {
1817
-				$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']);
1817
+				$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']);
1818 1818
 			}
1819 1819
 
1820 1820
 			if ($globalDebug) echo 'Flights data...'."\n";
1821 1821
 			if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n";
1822 1822
 			$alldata = $Spotter->countAllDatesLastMonthByAirlines();
1823 1823
 			foreach ($alldata as $number) {
1824
-				$this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']);
1824
+				$this->addStatFlight('month', $number['date_name'], $number['date_count'], $number['airline_icao']);
1825 1825
 			}
1826 1826
 			if ($globalDebug) echo '-> countAllDates...'."\n";
1827 1827
 			//$previousdata = $this->countAllDatesByAirlines();
1828
-			$alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines());
1828
+			$alldata = $Common->array_merge_noappend($previousdatabyairlines, $Spotter->countAllDatesByAirlines());
1829 1829
 			$values = array();
1830 1830
 			foreach ($alldata as $cnt) {
1831 1831
 				$values[] = $cnt['date_count'];
1832 1832
 			}
1833
-			array_multisort($values,SORT_DESC,$alldata);
1834
-			array_splice($alldata,11);
1833
+			array_multisort($values, SORT_DESC, $alldata);
1834
+			array_splice($alldata, 11);
1835 1835
 			foreach ($alldata as $number) {
1836
-				$this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']);
1836
+				$this->addStatFlight('date', $number['date_name'], $number['date_count'], $number['airline_icao']);
1837 1837
 			}
1838 1838
 			
1839 1839
 			if ($globalDebug) echo '-> countAllHours...'."\n";
1840 1840
 			$alldata = $Spotter->countAllHoursByAirlines('hour');
1841 1841
 			foreach ($alldata as $number) {
1842
-				$this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']);
1842
+				$this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], $number['airline_icao']);
1843 1843
 			}
1844 1844
 			
1845 1845
 
@@ -1856,32 +1856,32 @@  discard block
 block discarded – undo
1856 1856
 				// Count by filter
1857 1857
 				if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n";
1858 1858
 				$Spotter = new Spotter($this->db);
1859
-				$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter);
1859
+				$alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day, $filter);
1860 1860
 				foreach ($alldata as $number) {
1861
-					$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'',$filter_name);
1861
+					$this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', $filter_name);
1862 1862
 				}
1863
-				$alldata = $Spotter->countAllAirlines(false,0,$last_update_day,$filter);
1863
+				$alldata = $Spotter->countAllAirlines(false, 0, $last_update_day, $filter);
1864 1864
 				foreach ($alldata as $number) {
1865
-					$this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],$filter_name);
1865
+					$this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], $filter_name);
1866 1866
 				}
1867
-				$alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day,$filter);
1867
+				$alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day, $filter);
1868 1868
 				foreach ($alldata as $number) {
1869
-					$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'',$filter_name);
1869
+					$this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', $filter_name);
1870 1870
 				}
1871
-				$alldata = $Spotter->countAllCallsigns(false,0,$last_update_day,$filter);
1871
+				$alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day, $filter);
1872 1872
 				foreach ($alldata as $number) {
1873
-					$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],'',$filter_name);
1873
+					$this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], '', $filter_name);
1874 1874
 				}
1875
-				$alldata = $Spotter->countAllOwners(false,0,$last_update_day,$filter);
1875
+				$alldata = $Spotter->countAllOwners(false, 0, $last_update_day, $filter);
1876 1876
 				foreach ($alldata as $number) {
1877
-					$this->addStatOwner($number['owner_name'],$number['owner_count'],'',$filter_name);
1877
+					$this->addStatOwner($number['owner_name'], $number['owner_count'], '', $filter_name);
1878 1878
 				}
1879
-				$alldata = $Spotter->countAllPilots(false,0,$last_update_day,$filter);
1879
+				$alldata = $Spotter->countAllPilots(false, 0, $last_update_day, $filter);
1880 1880
 				foreach ($alldata as $number) {
1881
-					$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name,$number['format_source']);
1881
+					$this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', $filter_name, $number['format_source']);
1882 1882
 				}
1883
-				$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter);
1884
-	       			$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter);
1883
+				$pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day, $filter);
1884
+	       			$dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day, $filter);
1885 1885
 		        	$alldata = array();
1886 1886
 	    			foreach ($pall as $value) {
1887 1887
 		        		$icao = $value['airport_departure_icao'];
@@ -1897,12 +1897,12 @@  discard block
 block discarded – undo
1897 1897
     				foreach ($alldata as $key => $row) {
1898 1898
     					$count[$key] = $row['airport_departure_icao_count'];
1899 1899
     				}
1900
-				array_multisort($count,SORT_DESC,$alldata);
1900
+				array_multisort($count, SORT_DESC, $alldata);
1901 1901
 				foreach ($alldata as $number) {
1902
-    					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);
1902
+    					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);
1903 1903
 				}
1904
-				$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,false,$filter);
1905
-    				$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter);
1904
+				$pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day, false, $filter);
1905
+    				$dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day, false, $filter);
1906 1906
 				$alldata = array();
1907 1907
     				foreach ($pall as $value) {
1908 1908
 		        		$icao = $value['airport_arrival_icao'];
@@ -1918,40 +1918,40 @@  discard block
 block discarded – undo
1918 1918
         			foreach ($alldata as $key => $row) {
1919 1919
     					$count[$key] = $row['airport_arrival_icao_count'];
1920 1920
 		        	}
1921
-        			array_multisort($count,SORT_DESC,$alldata);
1921
+        			array_multisort($count, SORT_DESC, $alldata);
1922 1922
 				foreach ($alldata as $number) {
1923
-					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);
1923
+					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);
1924 1924
 				}
1925 1925
 				$Spotter = new Spotter($this->db);
1926 1926
 				$alldata = $Spotter->countAllMonths($filter);
1927 1927
 				$lastyear = false;
1928 1928
 				foreach ($alldata as $number) {
1929 1929
 					if ($number['year_name'] != date('Y')) $lastyear = true;
1930
-					$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);
1930
+					$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);
1931 1931
 				}
1932 1932
 				$alldata = $Spotter->countAllMonthsOwners($filter);
1933 1933
 				foreach ($alldata as $number) {
1934
-					$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);
1934
+					$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);
1935 1935
 				}
1936 1936
 				$alldata = $Spotter->countAllMonthsPilots($filter);
1937 1937
 				foreach ($alldata as $number) {
1938
-					$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);
1938
+					$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);
1939 1939
 				}
1940 1940
 				$alldata = $Spotter->countAllMilitaryMonths($filter);
1941 1941
 				foreach ($alldata as $number) {
1942
-					$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);
1942
+					$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);
1943 1943
 				}
1944 1944
 				$alldata = $Spotter->countAllMonthsAircrafts($filter);
1945 1945
 				foreach ($alldata as $number) {
1946
-					$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);
1946
+					$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);
1947 1947
 				}
1948 1948
 				$alldata = $Spotter->countAllMonthsRealArrivals($filter);
1949 1949
 				foreach ($alldata as $number) {
1950
-					$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);
1950
+					$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);
1951 1951
 				}
1952 1952
 				echo '...Departure'."\n";
1953
-				$pall = $Spotter->getLast7DaysAirportsDeparture('',$filter);
1954
-        			$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter);
1953
+				$pall = $Spotter->getLast7DaysAirportsDeparture('', $filter);
1954
+        			$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('', $filter);
1955 1955
 				foreach ($dall as $value) {
1956 1956
     					$icao = $value['departure_airport_icao'];
1957 1957
     					$ddate = $value['date'];
@@ -1969,11 +1969,11 @@  discard block
 block discarded – undo
1969 1969
     				}
1970 1970
 	    			$alldata = $pall;
1971 1971
 				foreach ($alldata as $number) {
1972
-					$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);
1972
+					$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);
1973 1973
 				}
1974 1974
 				echo '...Arrival'."\n";
1975
-				$pall = $Spotter->getLast7DaysAirportsArrival('',$filter);
1976
-    				$dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter);
1975
+				$pall = $Spotter->getLast7DaysAirportsArrival('', $filter);
1976
+    				$dall = $Spotter->getLast7DaysDetectedAirportsArrival('', $filter);
1977 1977
 				foreach ($dall as $value) {
1978 1978
 					$icao = $value['arrival_airport_icao'];
1979 1979
 					$ddate = $value['date'];
@@ -1991,40 +1991,40 @@  discard block
 block discarded – undo
1991 1991
     				}
1992 1992
     				$alldata = $pall;
1993 1993
 				foreach ($alldata as $number) {
1994
-					$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);
1994
+					$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);
1995 1995
 				}
1996 1996
     
1997 1997
 				echo 'Flights data...'."\n";
1998 1998
 				echo '-> countAllDatesLastMonth...'."\n";
1999 1999
 				$alldata = $Spotter->countAllDatesLastMonth($filter);
2000 2000
 				foreach ($alldata as $number) {
2001
-					$this->addStatFlight('month',$number['date_name'],$number['date_count'], '',$filter_name);
2001
+					$this->addStatFlight('month', $number['date_name'], $number['date_count'], '', $filter_name);
2002 2002
 				}
2003 2003
 				echo '-> countAllDates...'."\n";
2004
-				$previousdata = $this->countAllDates('',$filter_name);
2005
-				$alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter));
2004
+				$previousdata = $this->countAllDates('', $filter_name);
2005
+				$alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter));
2006 2006
 				$values = array();
2007 2007
 				foreach ($alldata as $cnt) {
2008 2008
 					$values[] = $cnt['date_count'];
2009 2009
 				}
2010
-				array_multisort($values,SORT_DESC,$alldata);
2011
-				array_splice($alldata,11);
2010
+				array_multisort($values, SORT_DESC, $alldata);
2011
+				array_splice($alldata, 11);
2012 2012
 				foreach ($alldata as $number) {
2013
-					$this->addStatFlight('date',$number['date_name'],$number['date_count'],'',$filter_name);
2013
+					$this->addStatFlight('date', $number['date_name'], $number['date_count'], '', $filter_name);
2014 2014
 				}
2015 2015
 				
2016 2016
 				echo '-> countAllHours...'."\n";
2017
-				$alldata = $Spotter->countAllHours('hour',$filter);
2017
+				$alldata = $Spotter->countAllHours('hour', $filter);
2018 2018
 				foreach ($alldata as $number) {
2019
-					$this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],'',$filter_name);
2019
+					$this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], '', $filter_name);
2020 2020
 				}
2021 2021
 				echo 'Insert last stats update date...'."\n";
2022 2022
 				date_default_timezone_set('UTC');
2023
-				$this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y-m-d G:i:s'));
2023
+				$this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y-m-d G:i:s'));
2024 2024
 				if (isset($filter['DeleteLastYearStats']) && $filter['DeleteLastYearStats'] == true) {
2025
-					if (date('Y',strtotime($last_update_day)) != date('Y')) {
2025
+					if (date('Y', strtotime($last_update_day)) != date('Y')) {
2026 2026
 						$this->deleteOldStats($filter_name);
2027
-						$this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y').'-01-01 00:00:00');
2027
+						$this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y').'-01-01 00:00:00');
2028 2028
 					}
2029 2029
 				}
2030 2030
 
@@ -2037,16 +2037,16 @@  discard block
 block discarded – undo
2037 2037
 				// SUM all previous month to put as year
2038 2038
 				$previous_year = date('Y');
2039 2039
 				$previous_year--;
2040
-				$this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
2041
-				$this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
2042
-				$this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
2043
-				$this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
2040
+				$this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
2041
+				$this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
2042
+				$this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
2043
+				$this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
2044 2044
 				$allairlines = $this->getAllAirlineNames();
2045 2045
 				foreach ($allairlines as $data) {
2046
-					$this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
2047
-					$this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
2048
-					$this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
2049
-					$this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
2046
+					$this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
2047
+					$this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
2048
+					$this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
2049
+					$this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
2050 2050
 				}
2051 2051
 				
2052 2052
 				if (isset($globalArchiveYear) && $globalArchiveYear) {
@@ -2055,7 +2055,7 @@  discard block
 block discarded – undo
2055 2055
 						try {
2056 2056
 							$sth = $this->db->prepare($query);
2057 2057
 							$sth->execute();
2058
-						} catch(PDOException $e) {
2058
+						} catch (PDOException $e) {
2059 2059
 							return "error : ".$e->getMessage().' - query : '.$query."\n";
2060 2060
 						}
2061 2061
 					}
@@ -2064,15 +2064,15 @@  discard block
 block discarded – undo
2064 2064
 					try {
2065 2065
 						$sth = $this->db->prepare($query);
2066 2066
 						$sth->execute();
2067
-					} catch(PDOException $e) {
2067
+					} catch (PDOException $e) {
2068 2068
 						return "error : ".$e->getMessage().' - query : '.$query."\n";
2069 2069
 					}
2070 2070
 				}
2071 2071
 				if (isset($globalDeleteLastYearStats) && $globalDeleteLastYearStats) {
2072 2072
 					$last_update = $this->getLastStatsUpdate('last_update_stats');
2073
-					if (date('Y',strtotime($last_update[0]['value'])) != date('Y')) {
2073
+					if (date('Y', strtotime($last_update[0]['value'])) != date('Y')) {
2074 2074
 						$this->deleteOldStats();
2075
-						$this->addLastStatsUpdate('last_update_stats',date('Y').'-01-01 00:00:00');
2075
+						$this->addLastStatsUpdate('last_update_stats', date('Y').'-01-01 00:00:00');
2076 2076
 						$lastyearupdate = true;
2077 2077
 					}
2078 2078
 				}
@@ -2094,7 +2094,7 @@  discard block
 block discarded – undo
2094 2094
 					try {
2095 2095
 						$sth = $this->db->prepare($query);
2096 2096
 						$sth->execute();
2097
-					} catch(PDOException $e) {
2097
+					} catch (PDOException $e) {
2098 2098
 						return "error : ".$e->getMessage();
2099 2099
 					}
2100 2100
 				}
@@ -2108,14 +2108,14 @@  discard block
 block discarded – undo
2108 2108
 				try {
2109 2109
 					$sth = $this->db->prepare($query);
2110 2110
 					$sth->execute();
2111
-				} catch(PDOException $e) {
2111
+				} catch (PDOException $e) {
2112 2112
 					return "error : ".$e->getMessage();
2113 2113
 				}
2114 2114
 			}
2115 2115
 			if (!isset($lastyearupdate)) {
2116 2116
 				echo 'Insert last stats update date...'."\n";
2117 2117
 				date_default_timezone_set('UTC');
2118
-				$this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s'));
2118
+				$this->addLastStatsUpdate('last_update_stats', date('Y-m-d G:i:s'));
2119 2119
 			}
2120 2120
 		//}
2121 2121
 	}
Please login to merge, or discard this patch.
require/class.SpotterLive.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 	/**
15 15
 	* Get SQL query part for filter used
16 16
 	* @param Array $filter the filter
17
-	* @return Array the SQL part
17
+	* @return string the SQL part
18 18
 	*/
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter;
Please login to merge, or discard this patch.
Braces   +71 added lines, -24 removed lines patch added patch discarded remove patch
@@ -26,7 +26,9 @@  discard block
 block discarded – undo
26 26
 				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
27 27
 			}
28 28
 		}
29
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
29
+		if (is_array($globalFilter)) {
30
+			$filter = array_merge($filter,$globalFilter);
31
+		}
30 32
 		$filter_query_join = '';
31 33
 		$filter_query_where = '';
32 34
 		foreach($filters as $flt) {
@@ -71,8 +73,11 @@  discard block
 block discarded – undo
71 73
 				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
72 74
 			}
73 75
 		}
74
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
75
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
76
+		if ($filter_query_where == '' && $where) {
77
+			$filter_query_where = ' WHERE';
78
+		} elseif ($filter_query_where != '' && $and) {
79
+			$filter_query_where .= ' AND';
80
+		}
76 81
 		$filter_query = $filter_query_join.$filter_query_where;
77 82
 		return $filter_query;
78 83
 	}
@@ -108,7 +113,9 @@  discard block
 block discarded – undo
108 113
 			$orderby_query = ' '.$search_orderby_array[$sort]['sql'];
109 114
 		}
110 115
 
111
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
116
+		if (!isset($globalLiveInterval)) {
117
+			$globalLiveInterval = '200';
118
+		}
112 119
 		if ($globalDBdriver == 'mysql') {
113 120
 			//$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
114 121
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query.$orderby_query;
@@ -133,7 +140,9 @@  discard block
 block discarded – undo
133 140
 
134 141
 		$filter_query = $this->getFilter($filter,true,true);
135 142
 
136
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
143
+		if (!isset($globalLiveInterval)) {
144
+			$globalLiveInterval = '200';
145
+		}
137 146
 		if ($globalDBdriver == 'mysql') {
138 147
 //			$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate$orderby_query";
139 148
 //			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, a.aircraft_shadow FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate INNER JOIN (SELECT * FROM aircraft) a on spotter_live.aircraft_icao = a.icao';
@@ -180,7 +189,9 @@  discard block
 block discarded – undo
180 189
 
181 190
 		$filter_query = $this->getFilter($filter,true,true);
182 191
 
183
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
192
+		if (!isset($globalLiveInterval)) {
193
+			$globalLiveInterval = '200';
194
+		}
184 195
 		if ($globalDBdriver == 'mysql') {
185 196
 
186 197
 			$query  = 'SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
@@ -220,7 +231,9 @@  discard block
 block discarded – undo
220 231
 		global $globalDBdriver, $globalLiveInterval;
221 232
 		$filter_query = $this->getFilter($filter,true,true);
222 233
 
223
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
234
+		if (!isset($globalLiveInterval)) {
235
+			$globalLiveInterval = '200';
236
+		}
224 237
 		if ($globalDBdriver == 'mysql') {
225 238
 			//$query  = 'SELECT COUNT(*) as nb FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query;
226 239
 			$query = 'SELECT COUNT(DISTINCT spotter_live.flightaware_id) as nb FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
@@ -250,7 +263,9 @@  discard block
 block discarded – undo
250 263
 	{
251 264
 		global $globalDBdriver, $globalLiveInterval;
252 265
 		$Spotter = new Spotter($this->db);
253
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
266
+		if (!isset($globalLiveInterval)) {
267
+			$globalLiveInterval = '200';
268
+		}
254 269
 		$filter_query = $this->getFilter($filter);
255 270
 
256 271
 		if (is_array($coord)) {
@@ -258,7 +273,9 @@  discard block
 block discarded – undo
258 273
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
259 274
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
260 275
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
261
-		} else return array();
276
+		} else {
277
+			return array();
278
+		}
262 279
 		if ($globalDBdriver == 'mysql') {
263 280
 			//$query  = "SELECT spotter_output.* FROM spotter_output WHERE spotter_output.flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
264 281
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query;
@@ -449,11 +466,15 @@  discard block
 block discarded – undo
449 466
 		//$query  = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date';
450 467
 		if ($globalDBdriver == 'mysql') {
451 468
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
452
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
469
+			if ($liveinterval) {
470
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
471
+			}
453 472
 			$query .= ' ORDER BY date';
454 473
 		} else {
455 474
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
456
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
475
+			if ($liveinterval) {
476
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
477
+			}
457 478
 			$query .= ' ORDER BY date';
458 479
 		}
459 480
 
@@ -548,7 +569,9 @@  discard block
 block discarded – undo
548 569
 				$i++;
549 570
 				$j++;
550 571
 				if ($j == 30) {
551
-					if ($globalDebug) echo ".";
572
+					if ($globalDebug) {
573
+						echo ".";
574
+					}
552 575
 				    	try {
553 576
 						
554 577
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -856,7 +879,9 @@  discard block
 block discarded – undo
856 879
 			{
857 880
 				return false;
858 881
 			}
859
-		} else return '';
882
+		} else {
883
+			return '';
884
+		}
860 885
 
861 886
 		if ($longitude != '')
862 887
 		{
@@ -864,7 +889,9 @@  discard block
 block discarded – undo
864 889
 			{
865 890
 				return false;
866 891
 			}
867
-		} else return '';
892
+		} else {
893
+			return '';
894
+		}
868 895
 
869 896
 		if ($waypoints != '')
870 897
 		{
@@ -880,7 +907,9 @@  discard block
 block discarded – undo
880 907
 			{
881 908
 				return false;
882 909
 			}
883
-		} else $altitude = 0;
910
+		} else {
911
+			$altitude = 0;
912
+		}
884 913
 
885 914
 		if ($heading != '')
886 915
 		{
@@ -888,7 +917,9 @@  discard block
 block discarded – undo
888 917
 			{
889 918
 				return false;
890 919
 			}
891
-		} else $heading = 0;
920
+		} else {
921
+			$heading = 0;
922
+		}
892 923
 
893 924
 		if ($groundspeed != '')
894 925
 		{
@@ -896,9 +927,13 @@  discard block
 block discarded – undo
896 927
 			{
897 928
 				return false;
898 929
 			}
899
-		} else $groundspeed = 0;
930
+		} else {
931
+			$groundspeed = 0;
932
+		}
900 933
 		date_default_timezone_set('UTC');
901
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
934
+		if ($date == '') {
935
+			$date = date("Y-m-d H:i:s", time());
936
+		}
902 937
 
903 938
         
904 939
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -942,10 +977,18 @@  discard block
 block discarded – undo
942 977
 		$arrival_airport_country = '';
943 978
 		
944 979
             	
945
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
946
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
947
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
948
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
980
+            	if ($squawk == '' || $Common->isInteger($squawk) === false ) {
981
+            		$squawk = NULL;
982
+            	}
983
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) {
984
+            		$verticalrate = NULL;
985
+            	}
986
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
987
+            		$groundspeed = 0;
988
+            	}
989
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
990
+            		$heading = 0;
991
+            	}
949 992
             	
950 993
 		$query  = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) 
951 994
 		VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)';
@@ -960,9 +1003,13 @@  discard block
 block discarded – undo
960 1003
                 	return "error : ".$e->getMessage();
961 1004
                 }
962 1005
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
963
-		    if ($globalDebug) echo '(Add to SBS archive : ';
1006
+		    if ($globalDebug) {
1007
+		    	echo '(Add to SBS archive : ';
1008
+		    }
964 1009
 		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
965
-		    if ($globalDebug) echo $result.')';
1010
+		    if ($globalDebug) {
1011
+		    	echo $result.')';
1012
+		    }
966 1013
 		}
967 1014
 		return "success";
968 1015
 
Please login to merge, or discard this patch.
Indentation   +204 added lines, -204 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 
13 13
 
14 14
 	/**
15
-	* Get SQL query part for filter used
16
-	* @param Array $filter the filter
17
-	* @return Array the SQL part
18
-	*/
15
+	 * Get SQL query part for filter used
16
+	 * @param Array $filter the filter
17
+	 * @return Array the SQL part
18
+	 */
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
21 21
 		$filters = array();
@@ -83,11 +83,11 @@  discard block
 block discarded – undo
83 83
 	}
84 84
 
85 85
 	/**
86
-	* Gets all the spotter information based on the latest data entry
87
-	*
88
-	* @return Array the spotter information
89
-	*
90
-	*/
86
+	 * Gets all the spotter information based on the latest data entry
87
+	 *
88
+	 * @return Array the spotter information
89
+	 *
90
+	 */
91 91
 	public function getLiveSpotterData($limit = '', $sort = '', $filter = array())
92 92
 	{
93 93
 		global $globalDBdriver, $globalLiveInterval;
@@ -126,11 +126,11 @@  discard block
 block discarded – undo
126 126
 	}
127 127
 
128 128
 	/**
129
-	* Gets Minimal Live Spotter data
130
-	*
131
-	* @return Array the spotter information
132
-	*
133
-	*/
129
+	 * Gets Minimal Live Spotter data
130
+	 *
131
+	 * @return Array the spotter information
132
+	 *
133
+	 */
134 134
 	public function getMinLiveSpotterData($filter = array())
135 135
 	{
136 136
 		global $globalDBdriver, $globalLiveInterval;
@@ -181,11 +181,11 @@  discard block
 block discarded – undo
181 181
 	}
182 182
 
183 183
 	/**
184
-	* Gets Minimal Live Spotter data since xx seconds
185
-	*
186
-	* @return Array the spotter information
187
-	*
188
-	*/
184
+	 * Gets Minimal Live Spotter data since xx seconds
185
+	 *
186
+	 * @return Array the spotter information
187
+	 *
188
+	 */
189 189
 	public function getMinLastLiveSpotterData($filter = array())
190 190
 	{
191 191
 		global $globalDBdriver, $globalLiveInterval;
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 			$query  = 'SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
200 200
 			FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
201 201
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
202
-                } else {
202
+				} else {
203 203
 /*
204 204
 			$query  = "SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
205 205
 			FROM spotter_live WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 //			echo $query;
212 212
 		}
213 213
 
214
-    		try {
214
+			try {
215 215
 			$sth = $this->db->prepare($query);
216 216
 			$sth->execute();
217 217
 		} catch(PDOException $e) {
@@ -223,11 +223,11 @@  discard block
 block discarded – undo
223 223
 	}
224 224
 
225 225
 	/**
226
-	* Gets number of latest data entry
227
-	*
228
-	* @return String number of entry
229
-	*
230
-	*/
226
+	 * Gets number of latest data entry
227
+	 *
228
+	 * @return String number of entry
229
+	 *
230
+	 */
231 231
 	public function getLiveSpotterCount($filter = array())
232 232
 	{
233 233
 		global $globalDBdriver, $globalLiveInterval;
@@ -254,11 +254,11 @@  discard block
 block discarded – undo
254 254
 	}
255 255
 
256 256
 	/**
257
-	* Gets all the spotter information based on the latest data entry and coord
258
-	*
259
-	* @return Array the spotter information
260
-	*
261
-	*/
257
+	 * Gets all the spotter information based on the latest data entry and coord
258
+	 *
259
+	 * @return Array the spotter information
260
+	 *
261
+	 */
262 262
 	public function getLiveSpotterDatabyCoord($coord, $filter = array())
263 263
 	{
264 264
 		global $globalDBdriver, $globalLiveInterval;
@@ -283,11 +283,11 @@  discard block
 block discarded – undo
283 283
 	}
284 284
 
285 285
 	/**
286
-	* Gets all the spotter information based on a user's latitude and longitude
287
-	*
288
-	* @return Array the spotter information
289
-	*
290
-	*/
286
+	 * Gets all the spotter information based on a user's latitude and longitude
287
+	 *
288
+	 * @return Array the spotter information
289
+	 *
290
+	 */
291 291
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
292 292
 	{
293 293
 		$Spotter = new Spotter($this->db);
@@ -297,145 +297,145 @@  discard block
 block discarded – undo
297 297
 				return false;
298 298
 			}
299 299
 		}
300
-        if ($lng != '')
301
-                {
302
-                        if (!is_numeric($lng))
303
-                        {
304
-                                return false;
305
-                        }
306
-                }
307
-
308
-                if ($radius != '')
309
-                {
310
-                        if (!is_numeric($radius))
311
-                        {
312
-                                return false;
313
-                        }
314
-                }
300
+		if ($lng != '')
301
+				{
302
+						if (!is_numeric($lng))
303
+						{
304
+								return false;
305
+						}
306
+				}
307
+
308
+				if ($radius != '')
309
+				{
310
+						if (!is_numeric($radius))
311
+						{
312
+								return false;
313
+						}
314
+				}
315 315
 		$additional_query = '';
316
-        if ($interval != '')
317
-                {
318
-                        if (!is_string($interval))
319
-                        {
320
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
321
-			        return false;
322
-                        } else {
323
-                if ($interval == '1m')
324
-                {
325
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
326
-                } else if ($interval == '15m'){
327
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
328
-                } 
329
-            }
330
-                } else {
331
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
332
-        }
333
-
334
-                $query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
316
+		if ($interval != '')
317
+				{
318
+						if (!is_string($interval))
319
+						{
320
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
321
+					return false;
322
+						} else {
323
+				if ($interval == '1m')
324
+				{
325
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
326
+				} else if ($interval == '15m'){
327
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
328
+				} 
329
+			}
330
+				} else {
331
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
332
+		}
333
+
334
+				$query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
335 335
                    WHERE spotter_live.latitude <> '' 
336 336
                                    AND spotter_live.longitude <> '' 
337 337
                    ".$additional_query."
338 338
                    HAVING distance < :radius  
339 339
                                    ORDER BY distance";
340 340
 
341
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
341
+				$spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
342 342
 
343
-                return $spotter_array;
344
-        }
343
+				return $spotter_array;
344
+		}
345 345
 
346 346
     
347
-        /**
348
-	* Gets all the spotter information based on a particular callsign
349
-	*
350
-	* @return Array the spotter information
351
-	*
352
-	*/
347
+		/**
348
+		 * Gets all the spotter information based on a particular callsign
349
+		 *
350
+		 * @return Array the spotter information
351
+		 *
352
+		 */
353 353
 	public function getLastLiveSpotterDataByIdent($ident)
354 354
 	{
355 355
 		$Spotter = new Spotter($this->db);
356 356
 		date_default_timezone_set('UTC');
357 357
 
358 358
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
359
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
359
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
360 360
 
361 361
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
362 362
 
363 363
 		return $spotter_array;
364 364
 	}
365 365
 
366
-        /**
367
-	* Gets all the spotter information based on a particular callsign
368
-	*
369
-	* @return Array the spotter information
370
-	*
371
-	*/
366
+		/**
367
+		 * Gets all the spotter information based on a particular callsign
368
+		 *
369
+		 * @return Array the spotter information
370
+		 *
371
+		 */
372 372
 	public function getDateLiveSpotterDataByIdent($ident,$date)
373 373
 	{
374 374
 		$Spotter = new Spotter($this->db);
375 375
 		date_default_timezone_set('UTC');
376 376
 
377 377
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
378
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
378
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
379 379
 
380
-                $date = date('c',$date);
380
+				$date = date('c',$date);
381 381
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
382 382
 
383 383
 		return $spotter_array;
384 384
 	}
385 385
 
386
-        /**
387
-	* Gets last spotter information based on a particular callsign
388
-	*
389
-	* @return Array the spotter information
390
-	*
391
-	*/
386
+		/**
387
+		 * Gets last spotter information based on a particular callsign
388
+		 *
389
+		 * @return Array the spotter information
390
+		 *
391
+		 */
392 392
 	public function getLastLiveSpotterDataById($id)
393 393
 	{
394 394
 		$Spotter = new Spotter($this->db);
395 395
 		date_default_timezone_set('UTC');
396 396
 
397 397
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
398
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
398
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
399 399
 
400 400
 		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true);
401 401
 
402 402
 		return $spotter_array;
403 403
 	}
404 404
 
405
-        /**
406
-	* Gets last spotter information based on a particular callsign
407
-	*
408
-	* @return Array the spotter information
409
-	*
410
-	*/
405
+		/**
406
+		 * Gets last spotter information based on a particular callsign
407
+		 *
408
+		 * @return Array the spotter information
409
+		 *
410
+		 */
411 411
 	public function getDateLiveSpotterDataById($id,$date)
412 412
 	{
413 413
 		$Spotter = new Spotter($this->db);
414 414
 		date_default_timezone_set('UTC');
415 415
 
416 416
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
417
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
418
-                $date = date('c',$date);
417
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
418
+				$date = date('c',$date);
419 419
 		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
420 420
 
421 421
 		return $spotter_array;
422 422
 	}
423 423
 
424
-        /**
425
-	* Gets altitude information based on a particular callsign
426
-	*
427
-	* @return Array the spotter information
428
-	*
429
-	*/
424
+		/**
425
+		 * Gets altitude information based on a particular callsign
426
+		 *
427
+		 * @return Array the spotter information
428
+		 *
429
+		 */
430 430
 	public function getAltitudeLiveSpotterDataByIdent($ident)
431 431
 	{
432 432
 
433 433
 		date_default_timezone_set('UTC');
434 434
 
435 435
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
436
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
436
+				$query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
437 437
 
438
-    		try {
438
+			try {
439 439
 			
440 440
 			$sth = $this->db->prepare($query);
441 441
 			$sth->execute(array(':ident' => $ident));
@@ -448,12 +448,12 @@  discard block
 block discarded – undo
448 448
 		return $spotter_array;
449 449
 	}
450 450
 
451
-        /**
452
-	* Gets all the spotter information based on a particular id
453
-	*
454
-	* @return Array the spotter information
455
-	*
456
-	*/
451
+		/**
452
+		 * Gets all the spotter information based on a particular id
453
+		 *
454
+		 * @return Array the spotter information
455
+		 *
456
+		 */
457 457
 	public function getAllLiveSpotterDataById($id,$liveinterval = false)
458 458
 	{
459 459
 		global $globalDBdriver, $globalLiveInterval;
@@ -481,18 +481,18 @@  discard block
 block discarded – undo
481 481
 		return $spotter_array;
482 482
 	}
483 483
 
484
-        /**
485
-	* Gets all the spotter information based on a particular ident
486
-	*
487
-	* @return Array the spotter information
488
-	*
489
-	*/
484
+		/**
485
+		 * Gets all the spotter information based on a particular ident
486
+		 *
487
+		 * @return Array the spotter information
488
+		 *
489
+		 */
490 490
 	public function getAllLiveSpotterDataByIdent($ident)
491 491
 	{
492 492
 		date_default_timezone_set('UTC');
493 493
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
494 494
 		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
495
-    		try {
495
+			try {
496 496
 			
497 497
 			$sth = $this->db->prepare($query);
498 498
 			$sth->execute(array(':ident' => $ident));
@@ -506,23 +506,23 @@  discard block
 block discarded – undo
506 506
 
507 507
 
508 508
 	/**
509
-	* Deletes all info in the table
510
-	*
511
-	* @return String success or false
512
-	*
513
-	*/
509
+	 * Deletes all info in the table
510
+	 *
511
+	 * @return String success or false
512
+	 *
513
+	 */
514 514
 	public function deleteLiveSpotterData()
515 515
 	{
516 516
 		global $globalDBdriver;
517 517
 		if ($globalDBdriver == 'mysql') {
518 518
 			//$query  = "DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= spotter_live.date";
519 519
 			$query  = 'DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= spotter_live.date';
520
-            		//$query  = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)";
520
+					//$query  = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)";
521 521
 		} else {
522 522
 			$query  = "DELETE FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date";
523 523
 		}
524 524
         
525
-    		try {
525
+			try {
526 526
 			
527 527
 			$sth = $this->db->prepare($query);
528 528
 			$sth->execute();
@@ -534,18 +534,18 @@  discard block
 block discarded – undo
534 534
 	}
535 535
 
536 536
 	/**
537
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
538
-	*
539
-	* @return String success or false
540
-	*
541
-	*/
537
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
538
+	 *
539
+	 * @return String success or false
540
+	 *
541
+	 */
542 542
 	public function deleteLiveSpotterDataNotUpdated()
543 543
 	{
544 544
 		global $globalDBdriver, $globalDebug;
545 545
 		if ($globalDBdriver == 'mysql') {
546 546
 			//$query = 'SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < spotter_live.date) LIMIT 800 OFFSET 0';
547
-    			$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
548
-    			try {
547
+				$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
548
+				try {
549 549
 				
550 550
 				$sth = $this->db->prepare($query);
551 551
 				$sth->execute();
@@ -553,8 +553,8 @@  discard block
 block discarded – undo
553 553
 				return "error";
554 554
 			}
555 555
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
556
-                        $i = 0;
557
-                        $j =0;
556
+						$i = 0;
557
+						$j =0;
558 558
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
559 559
 			foreach($all as $row)
560 560
 			{
@@ -562,20 +562,20 @@  discard block
 block discarded – undo
562 562
 				$j++;
563 563
 				if ($j == 30) {
564 564
 					if ($globalDebug) echo ".";
565
-				    	try {
565
+						try {
566 566
 						
567 567
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
568 568
 						$sth->execute();
569 569
 					} catch(PDOException $e) {
570 570
 						return "error";
571 571
 					}
572
-                                	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
573
-                                	$j = 0;
572
+									$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
573
+									$j = 0;
574 574
 				}
575 575
 				$query_delete .= "'".$row['flightaware_id']."',";
576 576
 			}
577 577
 			if ($i > 0) {
578
-    				try {
578
+					try {
579 579
 					
580 580
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
581 581
 					$sth->execute();
@@ -586,9 +586,9 @@  discard block
 block discarded – undo
586 586
 			return "success";
587 587
 		} elseif ($globalDBdriver == 'pgsql') {
588 588
 			//$query = "SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < spotter_live.date) LIMIT 800 OFFSET 0";
589
-    			//$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
590
-    			$query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
591
-    			try {
589
+				//$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
590
+				$query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
591
+				try {
592 592
 				
593 593
 				$sth = $this->db->prepare($query);
594 594
 				$sth->execute();
@@ -632,17 +632,17 @@  discard block
 block discarded – undo
632 632
 	}
633 633
 
634 634
 	/**
635
-	* Deletes all info in the table for an ident
636
-	*
637
-	* @return String success or false
638
-	*
639
-	*/
635
+	 * Deletes all info in the table for an ident
636
+	 *
637
+	 * @return String success or false
638
+	 *
639
+	 */
640 640
 	public function deleteLiveSpotterDataByIdent($ident)
641 641
 	{
642 642
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
643 643
 		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
644 644
         
645
-    		try {
645
+			try {
646 646
 			
647 647
 			$sth = $this->db->prepare($query);
648 648
 			$sth->execute(array(':ident' => $ident));
@@ -654,17 +654,17 @@  discard block
 block discarded – undo
654 654
 	}
655 655
 
656 656
 	/**
657
-	* Deletes all info in the table for an id
658
-	*
659
-	* @return String success or false
660
-	*
661
-	*/
657
+	 * Deletes all info in the table for an id
658
+	 *
659
+	 * @return String success or false
660
+	 *
661
+	 */
662 662
 	public function deleteLiveSpotterDataById($id)
663 663
 	{
664 664
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
665 665
 		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
666 666
         
667
-    		try {
667
+			try {
668 668
 			
669 669
 			$sth = $this->db->prepare($query);
670 670
 			$sth->execute(array(':id' => $id));
@@ -677,11 +677,11 @@  discard block
 block discarded – undo
677 677
 
678 678
 
679 679
 	/**
680
-	* Gets the aircraft ident within the last hour
681
-	*
682
-	* @return String the ident
683
-	*
684
-	*/
680
+	 * Gets the aircraft ident within the last hour
681
+	 *
682
+	 * @return String the ident
683
+	 *
684
+	 */
685 685
 	public function getIdentFromLastHour($ident)
686 686
 	{
687 687
 		global $globalDBdriver, $globalTimezone;
@@ -707,14 +707,14 @@  discard block
 block discarded – undo
707 707
 			$ident_result = $row['ident'];
708 708
 		}
709 709
 		return $ident_result;
710
-        }
710
+		}
711 711
 
712 712
 	/**
713
-	* Check recent aircraft
714
-	*
715
-	* @return String the ident
716
-	*
717
-	*/
713
+	 * Check recent aircraft
714
+	 *
715
+	 * @return String the ident
716
+	 *
717
+	 */
718 718
 	public function checkIdentRecent($ident)
719 719
 	{
720 720
 		global $globalDBdriver, $globalTimezone;
@@ -740,14 +740,14 @@  discard block
 block discarded – undo
740 740
 			$ident_result = $row['flightaware_id'];
741 741
 		}
742 742
 		return $ident_result;
743
-        }
743
+		}
744 744
 
745 745
 	/**
746
-	* Check recent aircraft by id
747
-	*
748
-	* @return String the ident
749
-	*
750
-	*/
746
+	 * Check recent aircraft by id
747
+	 *
748
+	 * @return String the ident
749
+	 *
750
+	 */
751 751
 	public function checkIdRecent($id)
752 752
 	{
753 753
 		global $globalDBdriver, $globalTimezone;
@@ -773,14 +773,14 @@  discard block
 block discarded – undo
773 773
 			$ident_result = $row['flightaware_id'];
774 774
 		}
775 775
 		return $ident_result;
776
-        }
776
+		}
777 777
 
778 778
 	/**
779
-	* Check recent aircraft by ModeS
780
-	*
781
-	* @return String the ModeS
782
-	*
783
-	*/
779
+	 * Check recent aircraft by ModeS
780
+	 *
781
+	 * @return String the ModeS
782
+	 *
783
+	 */
784 784
 	public function checkModeSRecent($modes)
785 785
 	{
786 786
 		global $globalDBdriver, $globalTimezone;
@@ -807,19 +807,19 @@  discard block
 block discarded – undo
807 807
 			$ident_result = $row['flightaware_id'];
808 808
 		}
809 809
 		return $ident_result;
810
-        }
810
+		}
811 811
 
812 812
 	/**
813
-	* Adds a new spotter data
814
-	*
815
-	* @param String $flightaware_id the ID from flightaware
816
-	* @param String $ident the flight ident
817
-	* @param String $aircraft_icao the aircraft type
818
-	* @param String $departure_airport_icao the departure airport
819
-	* @param String $arrival_airport_icao the arrival airport
820
-	* @return String success or false
821
-	*
822
-	*/
813
+	 * Adds a new spotter data
814
+	 *
815
+	 * @param String $flightaware_id the ID from flightaware
816
+	 * @param String $ident the flight ident
817
+	 * @param String $aircraft_icao the aircraft type
818
+	 * @param String $departure_airport_icao the departure airport
819
+	 * @param String $arrival_airport_icao the arrival airport
820
+	 * @return String success or false
821
+	 *
822
+	 */
823 823
 	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '')
824 824
 	{
825 825
 		global $globalURL, $globalArchive, $globalDebug;
@@ -954,10 +954,10 @@  discard block
 block discarded – undo
954 954
 		$arrival_airport_country = '';
955 955
 		
956 956
             	
957
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
958
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
959
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
960
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
957
+				if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
958
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
959
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
960
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
961 961
             	
962 962
 		$query  = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) 
963 963
 		VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)';
@@ -967,14 +967,14 @@  discard block
 block discarded – undo
967 967
 			
968 968
 			$sth = $this->db->prepare($query);
969 969
 			$sth->execute($query_values);
970
-                } catch(PDOException $e) {
971
-                	return "error : ".$e->getMessage();
972
-                }
970
+				} catch(PDOException $e) {
971
+					return "error : ".$e->getMessage();
972
+				}
973 973
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
974
-		    if ($globalDebug) echo '(Add to SBS archive : ';
975
-		    $SpotterArchive = new SpotterArchive($this->db);
976
-		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
977
-		    if ($globalDebug) echo $result.')';
974
+			if ($globalDebug) echo '(Add to SBS archive : ';
975
+			$SpotterArchive = new SpotterArchive($this->db);
976
+			$result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
977
+			if ($globalDebug) echo $result.')';
978 978
 		}
979 979
 		return "success";
980 980
 
Please login to merge, or discard this patch.
Spacing   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -16,64 +16,64 @@  discard block
 block discarded – undo
16 16
 	* @param Array $filter the filter
17 17
 	* @return Array the SQL part
18 18
 	*/
19
-	public function getFilter($filter = array(),$where = false,$and = false) {
19
+	public function getFilter($filter = array(), $where = false, $and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
21 21
 		$filters = array();
22 22
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
23 23
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
24 24
 				$filters = $globalStatsFilters[$globalFilterName];
25 25
 			} else {
26
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
26
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
27 27
 			}
28 28
 		}
29
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
29
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
30 30
 		$filter_query_join = '';
31 31
 		$filter_query_where = '';
32
-		foreach($filters as $flt) {
32
+		foreach ($filters as $flt) {
33 33
 			if (isset($flt['airlines']) && !empty($flt['airlines'])) {
34 34
 				if ($flt['airlines'][0] != '') {
35 35
 					if (isset($flt['source'])) {
36
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
36
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
37 37
 					} else {
38
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
38
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
39 39
 					}
40 40
 				}
41 41
 			}
42 42
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
43 43
 				if (isset($flt['source'])) {
44
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
44
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
45 45
 				} else {
46
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
46
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
47 47
 				}
48 48
 			}
49 49
 			if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']))) {
50 50
 				if (isset($flt['source'])) {
51
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
51
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
52 52
 				}
53 53
 			}
54 54
 		}
55 55
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
56 56
 			if ($filter['airlines'][0] != '') {
57
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
57
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
58 58
 			}
59 59
 		}
60 60
 		if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
61 61
 			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id ";
62 62
 		}
63 63
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
64
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
64
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
65 65
 		}
66 66
 		if (isset($filter['source']) && !empty($filter['source'])) {
67
-			$filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
67
+			$filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')";
68 68
 		}
69 69
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
70 70
 			$filter_query_where = " WHERE ident = '".$filter['ident']."'";
71 71
 		}
72 72
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
73 73
 			if ($filter_query_where == '') {
74
-				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
74
+				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
75 75
 			} else {
76
-				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
76
+				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
77 77
 			}
78 78
 		}
79 79
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
 		if ($limit != '')
100 100
 		{
101 101
 			$limit_array = explode(',', $limit);
102
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
103
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
102
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
103
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
104 104
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
105 105
 			{
106 106
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 		} else {
121 121
 			$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query.$orderby_query;
122 122
 		}
123
-		$spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true);
123
+		$spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true);
124 124
 
125 125
 		return $spotter_array;
126 126
 	}
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 		global $globalDBdriver, $globalLiveInterval;
137 137
 		date_default_timezone_set('UTC');
138 138
 
139
-		$filter_query = $this->getFilter($filter,true,true);
139
+		$filter_query = $this->getFilter($filter, true, true);
140 140
 
141 141
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
142 142
 		if ($globalDBdriver == 'mysql') {
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 			$query  = 'SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
148 148
 			FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao'.$filter_query." spotter_live.latitude <> 0 AND spotter_live.longitude <> 0";
149 149
 */
150
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
150
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
151 151
 			FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query." spotter_live.latitude <> 0 AND spotter_live.longitude <> 0";
152 152
 
153 153
 //			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date ORDER BY spotter_live.date GROUP BY spotter_live.flightaware_id'.$filter_query;
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 			FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao".$filter_query." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'";
163 163
 */
164 164
 
165
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
165
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
166 166
 			FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'";
167 167
 
168 168
 
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 		try {
174 174
 			$sth = $this->db->prepare($query);
175 175
 			$sth->execute();
176
-		} catch(PDOException $e) {
176
+		} catch (PDOException $e) {
177 177
 			echo $e->getMessage();
178 178
 			die;
179 179
 		}
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 		global $globalDBdriver, $globalLiveInterval;
194 194
 		date_default_timezone_set('UTC');
195 195
 
196
-		$filter_query = $this->getFilter($filter,true,true);
196
+		$filter_query = $this->getFilter($filter, true, true);
197 197
 
198 198
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
199 199
 		if ($globalDBdriver == 'mysql') {
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 			FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
203 203
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
204 204
 */
205
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
205
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
206 206
 			FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
207 207
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
208 208
                 } else {
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 			FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category, icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
212 212
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
213 213
 */
214
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
214
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
215 215
 			FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
216 216
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
217 217
 //			echo $query;
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
     		try {
221 221
 			$sth = $this->db->prepare($query);
222 222
 			$sth->execute();
223
-		} catch(PDOException $e) {
223
+		} catch (PDOException $e) {
224 224
 			echo $e->getMessage();
225 225
 			die;
226 226
 		}
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 	public function getLiveSpotterCount($filter = array())
238 238
 	{
239 239
 		global $globalDBdriver, $globalLiveInterval;
240
-		$filter_query = $this->getFilter($filter,true,true);
240
+		$filter_query = $this->getFilter($filter, true, true);
241 241
 
242 242
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
243 243
 		if ($globalDBdriver == 'mysql') {
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 		try {
251 251
 			$sth = $this->db->prepare($query);
252 252
 			$sth->execute();
253
-		} catch(PDOException $e) {
253
+		} catch (PDOException $e) {
254 254
 			echo $e->getMessage();
255 255
 			die;
256 256
 		}
@@ -273,10 +273,10 @@  discard block
 block discarded – undo
273 273
 		$filter_query = $this->getFilter($filter);
274 274
 
275 275
 		if (is_array($coord)) {
276
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
277
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
278
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
279
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
276
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
277
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
278
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
279
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
280 280
 		} else return array();
281 281
 		if ($globalDBdriver == 'mysql') {
282 282
 			//$query  = "SELECT spotter_output.* FROM spotter_output WHERE spotter_output.flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
                 if ($interval == '1m')
330 330
                 {
331 331
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
332
-                } else if ($interval == '15m'){
332
+                } else if ($interval == '15m') {
333 333
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
334 334
                 } 
335 335
             }
@@ -337,14 +337,14 @@  discard block
 block discarded – undo
337 337
          $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
338 338
         }
339 339
 
340
-                $query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
340
+                $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
341 341
                    WHERE spotter_live.latitude <> '' 
342 342
                                    AND spotter_live.longitude <> '' 
343 343
                    ".$additional_query."
344 344
                    HAVING distance < :radius  
345 345
                                    ORDER BY distance";
346 346
 
347
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
347
+                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius));
348 348
 
349 349
                 return $spotter_array;
350 350
         }
@@ -362,9 +362,9 @@  discard block
 block discarded – undo
362 362
 		date_default_timezone_set('UTC');
363 363
 
364 364
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
365
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
365
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
366 366
 
367
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
367
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true);
368 368
 
369 369
 		return $spotter_array;
370 370
 	}
@@ -375,16 +375,16 @@  discard block
 block discarded – undo
375 375
 	* @return Array the spotter information
376 376
 	*
377 377
 	*/
378
-	public function getDateLiveSpotterDataByIdent($ident,$date)
378
+	public function getDateLiveSpotterDataByIdent($ident, $date)
379 379
 	{
380 380
 		$Spotter = new Spotter($this->db);
381 381
 		date_default_timezone_set('UTC');
382 382
 
383 383
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
384
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
384
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
385 385
 
386
-                $date = date('c',$date);
387
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
386
+                $date = date('c', $date);
387
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
388 388
 
389 389
 		return $spotter_array;
390 390
 	}
@@ -401,9 +401,9 @@  discard block
 block discarded – undo
401 401
 		date_default_timezone_set('UTC');
402 402
 
403 403
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
404
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
404
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
405 405
 
406
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true);
406
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true);
407 407
 
408 408
 		return $spotter_array;
409 409
 	}
@@ -414,15 +414,15 @@  discard block
 block discarded – undo
414 414
 	* @return Array the spotter information
415 415
 	*
416 416
 	*/
417
-	public function getDateLiveSpotterDataById($id,$date)
417
+	public function getDateLiveSpotterDataById($id, $date)
418 418
 	{
419 419
 		$Spotter = new Spotter($this->db);
420 420
 		date_default_timezone_set('UTC');
421 421
 
422 422
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
423
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
424
-                $date = date('c',$date);
425
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
423
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
424
+                $date = date('c', $date);
425
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true);
426 426
 
427 427
 		return $spotter_array;
428 428
 	}
@@ -439,13 +439,13 @@  discard block
 block discarded – undo
439 439
 		date_default_timezone_set('UTC');
440 440
 
441 441
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
442
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
442
+                $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
443 443
 
444 444
     		try {
445 445
 			
446 446
 			$sth = $this->db->prepare($query);
447 447
 			$sth->execute(array(':ident' => $ident));
448
-		} catch(PDOException $e) {
448
+		} catch (PDOException $e) {
449 449
 			echo $e->getMessage();
450 450
 			die;
451 451
 		}
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 	* @return Array the spotter information
461 461
 	*
462 462
 	*/
463
-	public function getAllLiveSpotterDataById($id,$liveinterval = false)
463
+	public function getAllLiveSpotterDataById($id, $liveinterval = false)
464 464
 	{
465 465
 		global $globalDBdriver, $globalLiveInterval;
466 466
 		date_default_timezone_set('UTC');
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 		try {
480 480
 			$sth = $this->db->prepare($query);
481 481
 			$sth->execute(array(':id' => $id));
482
-		} catch(PDOException $e) {
482
+		} catch (PDOException $e) {
483 483
 			echo $e->getMessage();
484 484
 			die;
485 485
 		}
@@ -497,12 +497,12 @@  discard block
 block discarded – undo
497 497
 	{
498 498
 		date_default_timezone_set('UTC');
499 499
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
500
-		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
500
+		$query = self::$global_query.' WHERE spotter_live.ident = :ident';
501 501
     		try {
502 502
 			
503 503
 			$sth = $this->db->prepare($query);
504 504
 			$sth->execute(array(':ident' => $ident));
505
-		} catch(PDOException $e) {
505
+		} catch (PDOException $e) {
506 506
 			echo $e->getMessage();
507 507
 			die;
508 508
 		}
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 			
533 533
 			$sth = $this->db->prepare($query);
534 534
 			$sth->execute();
535
-		} catch(PDOException $e) {
535
+		} catch (PDOException $e) {
536 536
 			return "error";
537 537
 		}
538 538
 
@@ -555,14 +555,14 @@  discard block
 block discarded – undo
555 555
 				
556 556
 				$sth = $this->db->prepare($query);
557 557
 				$sth->execute();
558
-			} catch(PDOException $e) {
558
+			} catch (PDOException $e) {
559 559
 				return "error";
560 560
 			}
561 561
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
562 562
                         $i = 0;
563
-                        $j =0;
563
+                        $j = 0;
564 564
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
565
-			foreach($all as $row)
565
+			foreach ($all as $row)
566 566
 			{
567 567
 				$i++;
568 568
 				$j++;
@@ -570,9 +570,9 @@  discard block
 block discarded – undo
570 570
 					if ($globalDebug) echo ".";
571 571
 				    	try {
572 572
 						
573
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
573
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
574 574
 						$sth->execute();
575
-					} catch(PDOException $e) {
575
+					} catch (PDOException $e) {
576 576
 						return "error";
577 577
 					}
578 578
                                 	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
@@ -583,9 +583,9 @@  discard block
 block discarded – undo
583 583
 			if ($i > 0) {
584 584
     				try {
585 585
 					
586
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
586
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
587 587
 					$sth->execute();
588
-				} catch(PDOException $e) {
588
+				} catch (PDOException $e) {
589 589
 					return "error";
590 590
 				}
591 591
 			}
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
 				
599 599
 				$sth = $this->db->prepare($query);
600 600
 				$sth->execute();
601
-			} catch(PDOException $e) {
601
+			} catch (PDOException $e) {
602 602
 				return "error";
603 603
 			}
604 604
 /*			$query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN (";
@@ -646,13 +646,13 @@  discard block
 block discarded – undo
646 646
 	public function deleteLiveSpotterDataByIdent($ident)
647 647
 	{
648 648
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
649
-		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
649
+		$query = 'DELETE FROM spotter_live WHERE ident = :ident';
650 650
         
651 651
     		try {
652 652
 			
653 653
 			$sth = $this->db->prepare($query);
654 654
 			$sth->execute(array(':ident' => $ident));
655
-		} catch(PDOException $e) {
655
+		} catch (PDOException $e) {
656 656
 			return "error";
657 657
 		}
658 658
 
@@ -668,13 +668,13 @@  discard block
 block discarded – undo
668 668
 	public function deleteLiveSpotterDataById($id)
669 669
 	{
670 670
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
671
-		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
671
+		$query = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
672 672
         
673 673
     		try {
674 674
 			
675 675
 			$sth = $this->db->prepare($query);
676 676
 			$sth->execute(array(':id' => $id));
677
-		} catch(PDOException $e) {
677
+		} catch (PDOException $e) {
678 678
 			return "error";
679 679
 		}
680 680
 
@@ -692,13 +692,13 @@  discard block
 block discarded – undo
692 692
 	{
693 693
 		global $globalDBdriver, $globalTimezone;
694 694
 		if ($globalDBdriver == 'mysql') {
695
-			$query  = 'SELECT spotter_live.ident FROM spotter_live 
695
+			$query = 'SELECT spotter_live.ident FROM spotter_live 
696 696
 				WHERE spotter_live.ident = :ident 
697 697
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
698 698
 				AND spotter_live.date < UTC_TIMESTAMP()';
699 699
 			$query_data = array(':ident' => $ident);
700 700
 		} else {
701
-			$query  = "SELECT spotter_live.ident FROM spotter_live 
701
+			$query = "SELECT spotter_live.ident FROM spotter_live 
702 702
 				WHERE spotter_live.ident = :ident 
703 703
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
704 704
 				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -707,8 +707,8 @@  discard block
 block discarded – undo
707 707
 		
708 708
 		$sth = $this->db->prepare($query);
709 709
 		$sth->execute($query_data);
710
-		$ident_result='';
711
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
710
+		$ident_result = '';
711
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
712 712
 		{
713 713
 			$ident_result = $row['ident'];
714 714
 		}
@@ -725,13 +725,13 @@  discard block
 block discarded – undo
725 725
 	{
726 726
 		global $globalDBdriver, $globalTimezone;
727 727
 		if ($globalDBdriver == 'mysql') {
728
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
728
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
729 729
 				WHERE spotter_live.ident = :ident 
730 730
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
731 731
 //				AND spotter_live.date < UTC_TIMESTAMP()";
732 732
 			$query_data = array(':ident' => $ident);
733 733
 		} else {
734
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
734
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
735 735
 				WHERE spotter_live.ident = :ident 
736 736
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'";
737 737
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -740,8 +740,8 @@  discard block
 block discarded – undo
740 740
 		
741 741
 		$sth = $this->db->prepare($query);
742 742
 		$sth->execute($query_data);
743
-		$ident_result='';
744
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
743
+		$ident_result = '';
744
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
745 745
 		{
746 746
 			$ident_result = $row['flightaware_id'];
747 747
 		}
@@ -758,13 +758,13 @@  discard block
 block discarded – undo
758 758
 	{
759 759
 		global $globalDBdriver, $globalTimezone;
760 760
 		if ($globalDBdriver == 'mysql') {
761
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
761
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
762 762
 				WHERE spotter_live.flightaware_id = :id 
763 763
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
764 764
 //				AND spotter_live.date < UTC_TIMESTAMP()";
765 765
 			$query_data = array(':id' => $id);
766 766
 		} else {
767
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
767
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
768 768
 				WHERE spotter_live.flightaware_id = :id 
769 769
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
770 770
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -773,8 +773,8 @@  discard block
 block discarded – undo
773 773
 		
774 774
 		$sth = $this->db->prepare($query);
775 775
 		$sth->execute($query_data);
776
-		$ident_result='';
777
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
776
+		$ident_result = '';
777
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
778 778
 		{
779 779
 			$ident_result = $row['flightaware_id'];
780 780
 		}
@@ -791,13 +791,13 @@  discard block
 block discarded – undo
791 791
 	{
792 792
 		global $globalDBdriver, $globalTimezone;
793 793
 		if ($globalDBdriver == 'mysql') {
794
-			$query  = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
794
+			$query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
795 795
 				WHERE spotter_live.ModeS = :modes 
796 796
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
797 797
 //				AND spotter_live.date < UTC_TIMESTAMP()";
798 798
 			$query_data = array(':modes' => $modes);
799 799
 		} else {
800
-			$query  = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
800
+			$query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
801 801
 				WHERE spotter_live.ModeS = :modes 
802 802
 				AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '30 MINUTE'";
803 803
 //			//	AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
@@ -806,8 +806,8 @@  discard block
 block discarded – undo
806 806
 		
807 807
 		$sth = $this->db->prepare($query);
808 808
 		$sth->execute($query_data);
809
-		$ident_result='';
810
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
809
+		$ident_result = '';
810
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
811 811
 		{
812 812
 			//$ident_result = $row['spotter_live_id'];
813 813
 			$ident_result = $row['flightaware_id'];
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
 	* @return String success or false
827 827
 	*
828 828
 	*/
829
-	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '')
829
+	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false, $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false, $format_source = '', $source_name = '', $over_country = '')
830 830
 	{
831 831
 		global $globalURL, $globalArchive, $globalDebug;
832 832
 		$Common = new Common();
@@ -919,26 +919,26 @@  discard block
 block discarded – undo
919 919
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
920 920
 
921 921
         
922
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
923
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
924
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
925
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
926
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
927
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
928
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
929
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
930
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
931
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
932
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
933
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
934
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
935
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
936
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
937
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
938
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
939
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
940
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
941
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
922
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
923
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
924
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
925
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
926
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
927
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
928
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
929
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
930
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
931
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
932
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
933
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
934
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
935
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
936
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
937
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
938
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
939
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
940
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
941
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
942 942
 
943 943
 		$airline_name = '';
944 944
 		$airline_icao = '';
@@ -960,26 +960,26 @@  discard block
 block discarded – undo
960 960
 		$arrival_airport_country = '';
961 961
 		
962 962
             	
963
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
964
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
965
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
966
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
963
+            	if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
964
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
965
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
966
+            	if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
967 967
             	
968
-		$query  = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) 
968
+		$query = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) 
969 969
 		VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)';
970 970
 
971
-		$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_shadow' => $aircraft_shadow,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk,':route_stop' => $route_stop,':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source,':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country);
971
+		$query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country);
972 972
 		try {
973 973
 			
974 974
 			$sth = $this->db->prepare($query);
975 975
 			$sth->execute($query_values);
976
-                } catch(PDOException $e) {
976
+                } catch (PDOException $e) {
977 977
                 	return "error : ".$e->getMessage();
978 978
                 }
979 979
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
980 980
 		    if ($globalDebug) echo '(Add to SBS archive : ';
981 981
 		    $SpotterArchive = new SpotterArchive($this->db);
982
-		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
982
+		    $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time, $arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country);
983 983
 		    if ($globalDebug) echo $result.')';
984 984
 		}
985 985
 		return "success";
@@ -988,7 +988,7 @@  discard block
 block discarded – undo
988 988
 
989 989
 	public function getOrderBy()
990 990
 	{
991
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC"));
991
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC"));
992 992
 		return $orderby;
993 993
 	}
994 994
 
Please login to merge, or discard this patch.
require/class.Spotter.php 4 patches
Doc Comments   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	/**
16 16
 	* Get SQL query part for filter used
17 17
 	* @param Array $filter the filter
18
-	* @return Array the SQL part
18
+	* @return string the SQL part
19 19
 	*/
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter;
@@ -8612,6 +8612,7 @@  discard block
 block discarded – undo
8612 8612
 	/**
8613 8613
 	* Counts all hours
8614 8614
 	*
8615
+	* @param string $orderby
8615 8616
 	* @return Array the hour list
8616 8617
 	*
8617 8618
 	*/
@@ -8677,6 +8678,7 @@  discard block
 block discarded – undo
8677 8678
 	/**
8678 8679
 	* Counts all hours
8679 8680
 	*
8681
+	* @param string $orderby
8680 8682
 	* @return Array the hour list
8681 8683
 	*
8682 8684
 	*/
@@ -9501,7 +9503,7 @@  discard block
 block discarded – undo
9501 9503
 	/**
9502 9504
 	* Parses the direction degrees to working
9503 9505
 	*
9504
-	* @param Float $direction the direction in degrees
9506
+	* @param integer $direction the direction in degrees
9505 9507
 	* @return Array the direction information
9506 9508
 	*
9507 9509
 	*/
Please login to merge, or discard this patch.
Indentation   +1299 added lines, -1299 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 	}
14 14
 
15 15
 	/**
16
-	* Get SQL query part for filter used
17
-	* @param Array $filter the filter
18
-	* @return Array the SQL part
19
-	*/
16
+	 * Get SQL query part for filter used
17
+	 * @param Array $filter the filter
18
+	 * @return Array the SQL part
19
+	 */
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
22 22
 		$filters = array();
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
 	}
85 85
 
86 86
 	/**
87
-	* Executes the SQL statements to get the spotter information
88
-	*
89
-	* @param String $query the SQL query
90
-	* @param Array $params parameter of the query
91
-	* @param String $limitQuery the limit query
92
-	* @return Array the spotter information
93
-	*
94
-	*/
87
+	 * Executes the SQL statements to get the spotter information
88
+	 *
89
+	 * @param String $query the SQL query
90
+	 * @param Array $params parameter of the query
91
+	 * @param String $limitQuery the limit query
92
+	 * @return Array the spotter information
93
+	 *
94
+	 */
95 95
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
96 96
 	{
97 97
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
@@ -255,11 +255,11 @@  discard block
 block discarded – undo
255 255
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
256 256
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
257 257
 					} else $temp_array['aircraft_shadow'] = 'default.png';
258
-                                } else {
259
-                            		$temp_array['aircraft_shadow'] = 'default.png';
258
+								} else {
259
+									$temp_array['aircraft_shadow'] = 'default.png';
260 260
 					$temp_array['aircraft_name'] = 'N/A';
261 261
 					$temp_array['aircraft_manufacturer'] = 'N/A';
262
-                            	}
262
+								}
263 263
 			}
264 264
 			$fromsource = NULL;
265 265
 			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
@@ -455,11 +455,11 @@  discard block
 block discarded – undo
455 455
 	
456 456
 	
457 457
 	/**
458
-	* Gets all the spotter information
459
-	*
460
-	* @return Array the spotter information
461
-	*
462
-	*/
458
+	 * Gets all the spotter information
459
+	 *
460
+	 * @return Array the spotter information
461
+	 *
462
+	 */
463 463
 	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())
464 464
 	{
465 465
 		global $globalTimezone, $globalDBdriver;
@@ -806,11 +806,11 @@  discard block
 block discarded – undo
806 806
 	
807 807
 	
808 808
 	/**
809
-	* Gets all the spotter information based on the latest data entry
810
-	*
811
-	* @return Array the spotter information
812
-	*
813
-	*/
809
+	 * Gets all the spotter information based on the latest data entry
810
+	 *
811
+	 * @return Array the spotter information
812
+	 *
813
+	 */
814 814
 	public function getLatestSpotterData($limit = '', $sort = '', $filter = array())
815 815
 	{
816 816
 		global $global_query;
@@ -849,12 +849,12 @@  discard block
 block discarded – undo
849 849
 	}
850 850
     
851 851
     
852
-    /**
853
-	* Gets all the spotter information based on a user's latitude and longitude
854
-	*
855
-	* @return Array the spotter information
856
-	*
857
-	*/
852
+	/**
853
+	 * Gets all the spotter information based on a user's latitude and longitude
854
+	 *
855
+	 * @return Array the spotter information
856
+	 *
857
+	 */
858 858
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
859 859
 	{
860 860
 		date_default_timezone_set('UTC');
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
 				return false;
883 883
 			}
884 884
 		}
885
-    		$additional_query = '';
885
+			$additional_query = '';
886 886
 		if ($interval != "")
887 887
 		{
888 888
 			if (!is_string($interval))
@@ -922,12 +922,12 @@  discard block
 block discarded – undo
922 922
 	}
923 923
     
924 924
     
925
-    /**
926
-	* Gets all the spotter information sorted by the newest aircraft type
927
-	*
928
-	* @return Array the spotter information
929
-	*
930
-	*/
925
+	/**
926
+	 * Gets all the spotter information sorted by the newest aircraft type
927
+	 *
928
+	 * @return Array the spotter information
929
+	 *
930
+	 */
931 931
 	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
932 932
 	{
933 933
 		global $global_query;
@@ -968,11 +968,11 @@  discard block
 block discarded – undo
968 968
     
969 969
     
970 970
 	/**
971
-	* Gets all the spotter information sorted by the newest aircraft registration
972
-	*
973
-	* @return Array the spotter information
974
-	*
975
-	*/
971
+	 * Gets all the spotter information sorted by the newest aircraft registration
972
+	 *
973
+	 * @return Array the spotter information
974
+	 *
975
+	 */
976 976
 	public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array())
977 977
 	{
978 978
 		global $global_query;
@@ -1012,11 +1012,11 @@  discard block
 block discarded – undo
1012 1012
 
1013 1013
 
1014 1014
 	/**
1015
-	* Gets all the spotter information sorted by the newest airline
1016
-	*
1017
-	* @return Array the spotter information
1018
-	*
1019
-	*/
1015
+	 * Gets all the spotter information sorted by the newest airline
1016
+	 *
1017
+	 * @return Array the spotter information
1018
+	 *
1019
+	 */
1020 1020
 	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1021 1021
 	{
1022 1022
 		global $global_query;
@@ -1055,12 +1055,12 @@  discard block
 block discarded – undo
1055 1055
 	}
1056 1056
     
1057 1057
     
1058
-    /**
1059
-	* Gets all the spotter information sorted by the newest departure airport
1060
-	*
1061
-	* @return Array the spotter information
1062
-	*
1063
-	*/
1058
+	/**
1059
+	 * Gets all the spotter information sorted by the newest departure airport
1060
+	 *
1061
+	 * @return Array the spotter information
1062
+	 *
1063
+	 */
1064 1064
 	public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array())
1065 1065
 	{
1066 1066
 		global $global_query;
@@ -1102,11 +1102,11 @@  discard block
 block discarded – undo
1102 1102
 
1103 1103
 
1104 1104
 	/**
1105
-	* Gets all the spotter information sorted by the newest arrival airport
1106
-	*
1107
-	* @return Array the spotter information
1108
-	*
1109
-	*/
1105
+	 * Gets all the spotter information sorted by the newest arrival airport
1106
+	 *
1107
+	 * @return Array the spotter information
1108
+	 *
1109
+	 */
1110 1110
 	public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array())
1111 1111
 	{
1112 1112
 		global $global_query;
@@ -1145,11 +1145,11 @@  discard block
 block discarded – undo
1145 1145
 	
1146 1146
 
1147 1147
 	/**
1148
-	* Gets all the spotter information based on the spotter id
1149
-	*
1150
-	* @return Array the spotter information
1151
-	*
1152
-	*/
1148
+	 * Gets all the spotter information based on the spotter id
1149
+	 *
1150
+	 * @return Array the spotter information
1151
+	 *
1152
+	 */
1153 1153
 	public function getSpotterDataByID($id = '')
1154 1154
 	{
1155 1155
 		global $global_query;
@@ -1171,11 +1171,11 @@  discard block
 block discarded – undo
1171 1171
 	
1172 1172
 	
1173 1173
 	/**
1174
-	* Gets all the spotter information based on the callsign
1175
-	*
1176
-	* @return Array the spotter information
1177
-	*
1178
-	*/
1174
+	 * Gets all the spotter information based on the callsign
1175
+	 *
1176
+	 * @return Array the spotter information
1177
+	 *
1178
+	 */
1179 1179
 	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
1180 1180
 	{
1181 1181
 		global $global_query;
@@ -1228,11 +1228,11 @@  discard block
 block discarded – undo
1228 1228
 	
1229 1229
 	
1230 1230
 	/**
1231
-	* Gets all the spotter information based on the aircraft type
1232
-	*
1233
-	* @return Array the spotter information
1234
-	*
1235
-	*/
1231
+	 * Gets all the spotter information based on the aircraft type
1232
+	 *
1233
+	 * @return Array the spotter information
1234
+	 *
1235
+	 */
1236 1236
 	public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array())
1237 1237
 	{
1238 1238
 		global $global_query;
@@ -1286,11 +1286,11 @@  discard block
 block discarded – undo
1286 1286
 	
1287 1287
 	
1288 1288
 	/**
1289
-	* Gets all the spotter information based on the aircraft registration
1290
-	*
1291
-	* @return Array the spotter information
1292
-	*
1293
-	*/
1289
+	 * Gets all the spotter information based on the aircraft registration
1290
+	 *
1291
+	 * @return Array the spotter information
1292
+	 *
1293
+	 */
1294 1294
 	public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array())
1295 1295
 	{
1296 1296
 		global $global_query;
@@ -1347,11 +1347,11 @@  discard block
 block discarded – undo
1347 1347
 	
1348 1348
 	
1349 1349
 	/**
1350
-	* Gets all the spotter information based on the airline
1351
-	*
1352
-	* @return Array the spotter information
1353
-	*
1354
-	*/
1350
+	 * Gets all the spotter information based on the airline
1351
+	 *
1352
+	 * @return Array the spotter information
1353
+	 *
1354
+	 */
1355 1355
 	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1356 1356
 	{
1357 1357
 		global $global_query;
@@ -1404,11 +1404,11 @@  discard block
 block discarded – undo
1404 1404
 	
1405 1405
 	
1406 1406
 	/**
1407
-	* Gets all the spotter information based on the airport
1408
-	*
1409
-	* @return Array the spotter information
1410
-	*
1411
-	*/
1407
+	 * Gets all the spotter information based on the airport
1408
+	 *
1409
+	 * @return Array the spotter information
1410
+	 *
1411
+	 */
1412 1412
 	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1413 1413
 	{
1414 1414
 		global $global_query;
@@ -1462,11 +1462,11 @@  discard block
 block discarded – undo
1462 1462
 
1463 1463
 
1464 1464
 	/**
1465
-	* Gets all the spotter information based on the date
1466
-	*
1467
-	* @return Array the spotter information
1468
-	*
1469
-	*/
1465
+	 * Gets all the spotter information based on the date
1466
+	 *
1467
+	 * @return Array the spotter information
1468
+	 *
1469
+	 */
1470 1470
 	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1471 1471
 	{
1472 1472
 		global $global_query, $globalTimezone, $globalDBdriver;
@@ -1530,11 +1530,11 @@  discard block
 block discarded – undo
1530 1530
 
1531 1531
 
1532 1532
 	/**
1533
-	* Gets all the spotter information based on the country name
1534
-	*
1535
-	* @return Array the spotter information
1536
-	*
1537
-	*/
1533
+	 * Gets all the spotter information based on the country name
1534
+	 *
1535
+	 * @return Array the spotter information
1536
+	 *
1537
+	 */
1538 1538
 	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1539 1539
 	{
1540 1540
 		global $global_query;
@@ -1588,11 +1588,11 @@  discard block
 block discarded – undo
1588 1588
 	
1589 1589
 	
1590 1590
 	/**
1591
-	* Gets all the spotter information based on the manufacturer name
1592
-	*
1593
-	* @return Array the spotter information
1594
-	*
1595
-	*/
1591
+	 * Gets all the spotter information based on the manufacturer name
1592
+	 *
1593
+	 * @return Array the spotter information
1594
+	 *
1595
+	 */
1596 1596
 	public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array())
1597 1597
 	{
1598 1598
 		global $global_query;
@@ -1648,13 +1648,13 @@  discard block
 block discarded – undo
1648 1648
   
1649 1649
   
1650 1650
 	/**
1651
-	* Gets a list of all aircraft that take a route
1652
-	*
1653
-	* @param String $departure_airport_icao ICAO code of departure airport
1654
-	* @param String $arrival_airport_icao ICAO code of arrival airport
1655
-	* @return Array the spotter information
1656
-	*
1657
-	*/
1651
+	 * Gets a list of all aircraft that take a route
1652
+	 *
1653
+	 * @param String $departure_airport_icao ICAO code of departure airport
1654
+	 * @param String $arrival_airport_icao ICAO code of arrival airport
1655
+	 * @return Array the spotter information
1656
+	 *
1657
+	 */
1658 1658
 	public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array())
1659 1659
 	{
1660 1660
 		global $global_query;
@@ -1723,11 +1723,11 @@  discard block
 block discarded – undo
1723 1723
 	
1724 1724
 	
1725 1725
 	/**
1726
-	* Gets all the spotter information based on the special column in the table
1727
-	*
1728
-	* @return Array the spotter information
1729
-	*
1730
-	*/
1726
+	 * Gets all the spotter information based on the special column in the table
1727
+	 *
1728
+	 * @return Array the spotter information
1729
+	 *
1730
+	 */
1731 1731
 	public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array())
1732 1732
 	{
1733 1733
 		global $global_query;
@@ -1766,11 +1766,11 @@  discard block
 block discarded – undo
1766 1766
 	}
1767 1767
 
1768 1768
 	/**
1769
-	* Gets all the highlight based on a aircraft registration
1770
-	*
1771
-	* @return String the highlight text
1772
-	*
1773
-	*/
1769
+	 * Gets all the highlight based on a aircraft registration
1770
+	 *
1771
+	 * @return String the highlight text
1772
+	 *
1773
+	 */
1774 1774
 	public function getHighlightByRegistration($registration,$filter = array())
1775 1775
 	{
1776 1776
 		global $global_query;
@@ -1792,13 +1792,13 @@  discard block
 block discarded – undo
1792 1792
 
1793 1793
 	
1794 1794
 	/**
1795
-	* Gets the squawk usage from squawk code
1796
-	*
1797
-	* @param String $squawk squawk code
1798
-	* @param String $country country
1799
-	* @return String usage
1800
-	*
1801
-	*/
1795
+	 * Gets the squawk usage from squawk code
1796
+	 *
1797
+	 * @param String $squawk squawk code
1798
+	 * @param String $country country
1799
+	 * @return String usage
1800
+	 *
1801
+	 */
1802 1802
 	public function getSquawkUsage($squawk = '',$country = 'FR')
1803 1803
 	{
1804 1804
 		
@@ -1819,12 +1819,12 @@  discard block
 block discarded – undo
1819 1819
 	}
1820 1820
 
1821 1821
 	/**
1822
-	* Gets the airport icao from the iata
1823
-	*
1824
-	* @param String $airport_iata the iata code of the airport
1825
-	* @return String airport iata
1826
-	*
1827
-	*/
1822
+	 * Gets the airport icao from the iata
1823
+	 *
1824
+	 * @param String $airport_iata the iata code of the airport
1825
+	 * @return String airport iata
1826
+	 *
1827
+	 */
1828 1828
 	public function getAirportIcao($airport_iata = '')
1829 1829
 	{
1830 1830
 		
@@ -1844,14 +1844,14 @@  discard block
 block discarded – undo
1844 1844
 	}
1845 1845
 
1846 1846
 	/**
1847
-	* Gets the airport distance
1848
-	*
1849
-	* @param String $airport_icao the icao code of the airport
1850
-	* @param Float $latitude the latitude
1851
-	* @param Float $longitude the longitude
1852
-	* @return Float distance to the airport
1853
-	*
1854
-	*/
1847
+	 * Gets the airport distance
1848
+	 *
1849
+	 * @param String $airport_icao the icao code of the airport
1850
+	 * @param Float $latitude the latitude
1851
+	 * @param Float $longitude the longitude
1852
+	 * @return Float distance to the airport
1853
+	 *
1854
+	 */
1855 1855
 	public function getAirportDistance($airport_icao,$latitude,$longitude)
1856 1856
 	{
1857 1857
 		
@@ -1872,12 +1872,12 @@  discard block
 block discarded – undo
1872 1872
 	}
1873 1873
 	
1874 1874
 	/**
1875
-	* Gets the airport info based on the icao
1876
-	*
1877
-	* @param String $airport the icao code of the airport
1878
-	* @return Array airport information
1879
-	*
1880
-	*/
1875
+	 * Gets the airport info based on the icao
1876
+	 *
1877
+	 * @param String $airport the icao code of the airport
1878
+	 * @return Array airport information
1879
+	 *
1880
+	 */
1881 1881
 	public function getAllAirportInfo($airport = '')
1882 1882
 	{
1883 1883
 		
@@ -1923,12 +1923,12 @@  discard block
 block discarded – undo
1923 1923
 	}
1924 1924
 	
1925 1925
 	/**
1926
-	* Gets the airport info based on the country
1927
-	*
1928
-	* @param Array $countries Airports countries
1929
-	* @return Array airport information
1930
-	*
1931
-	*/
1926
+	 * Gets the airport info based on the country
1927
+	 *
1928
+	 * @param Array $countries Airports countries
1929
+	 * @return Array airport information
1930
+	 *
1931
+	 */
1932 1932
 	public function getAllAirportInfobyCountry($countries)
1933 1933
 	{
1934 1934
 		$lst_countries = '';
@@ -1966,12 +1966,12 @@  discard block
 block discarded – undo
1966 1966
 	}
1967 1967
 	
1968 1968
 	/**
1969
-	* Gets airports info based on the coord
1970
-	*
1971
-	* @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1972
-	* @return Array airport information
1973
-	*
1974
-	*/
1969
+	 * Gets airports info based on the coord
1970
+	 *
1971
+	 * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1972
+	 * @return Array airport information
1973
+	 *
1974
+	 */
1975 1975
 	public function getAllAirportInfobyCoord($coord)
1976 1976
 	{
1977 1977
 		global $globalDBdriver;
@@ -2002,12 +2002,12 @@  discard block
 block discarded – undo
2002 2002
 	}
2003 2003
 
2004 2004
 	/**
2005
-	* Gets waypoints info based on the coord
2006
-	*
2007
-	* @param Array $coord waypoints coord
2008
-	* @return Array airport information
2009
-	*
2010
-	*/
2005
+	 * Gets waypoints info based on the coord
2006
+	 *
2007
+	 * @param Array $coord waypoints coord
2008
+	 * @return Array airport information
2009
+	 *
2010
+	 */
2011 2011
 	public function getAllWaypointsInfobyCoord($coord)
2012 2012
 	{
2013 2013
 		if (is_array($coord)) {
@@ -2041,12 +2041,12 @@  discard block
 block discarded – undo
2041 2041
 	
2042 2042
 	
2043 2043
 	/**
2044
-	* Gets the airline info based on the icao code or iata code
2045
-	*
2046
-	* @param String $airline_icao the iata code of the airport
2047
-	* @return Array airport information
2048
-	*
2049
-	*/
2044
+	 * Gets the airline info based on the icao code or iata code
2045
+	 *
2046
+	 * @param String $airline_icao the iata code of the airport
2047
+	 * @return Array airport information
2048
+	 *
2049
+	 */
2050 2050
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2051 2051
 	{
2052 2052
 		global $globalUseRealAirlines;
@@ -2077,7 +2077,7 @@  discard block
 block discarded – undo
2077 2077
 			} else {
2078 2078
 				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2079 2079
 			}
2080
-                        /*
2080
+						/*
2081 2081
 			$airline_array = array();
2082 2082
 			$temp_array = array();
2083 2083
 		
@@ -2107,12 +2107,12 @@  discard block
 block discarded – undo
2107 2107
 	}
2108 2108
 	
2109 2109
 	/**
2110
-	* Gets the airline info based on the airline name
2111
-	*
2112
-	* @param String $airline_name the name of the airline
2113
-	* @return Array airline information
2114
-	*
2115
-	*/
2110
+	 * Gets the airline info based on the airline name
2111
+	 *
2112
+	 * @param String $airline_name the name of the airline
2113
+	 * @return Array airline information
2114
+	 *
2115
+	 */
2116 2116
 	public function getAllAirlineInfoByName($airline_name, $fromsource = NULL)
2117 2117
 	{
2118 2118
 		global $globalUseRealAirlines;
@@ -2140,12 +2140,12 @@  discard block
 block discarded – undo
2140 2140
 	
2141 2141
 	
2142 2142
 	/**
2143
-	* Gets the aircraft info based on the aircraft type
2144
-	*
2145
-	* @param String $aircraft_type the aircraft type
2146
-	* @return Array aircraft information
2147
-	*
2148
-	*/
2143
+	 * Gets the aircraft info based on the aircraft type
2144
+	 *
2145
+	 * @param String $aircraft_type the aircraft type
2146
+	 * @return Array aircraft information
2147
+	 *
2148
+	 */
2149 2149
 	public function getAllAircraftInfo($aircraft_type)
2150 2150
 	{
2151 2151
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2177,12 +2177,12 @@  discard block
 block discarded – undo
2177 2177
 	}
2178 2178
 
2179 2179
 	/**
2180
-	* Gets the aircraft icao based on the aircraft name/type
2181
-	*
2182
-	* @param String $aircraft_type the aircraft type
2183
-	* @return String aircraft information
2184
-	*
2185
-	*/
2180
+	 * Gets the aircraft icao based on the aircraft name/type
2181
+	 *
2182
+	 * @param String $aircraft_type the aircraft type
2183
+	 * @return String aircraft information
2184
+	 *
2185
+	 */
2186 2186
 	public function getAircraftIcao($aircraft_type)
2187 2187
 	{
2188 2188
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2207,12 +2207,12 @@  discard block
 block discarded – undo
2207 2207
 	}
2208 2208
 	
2209 2209
 	/**
2210
-	* Gets the aircraft info based on the aircraft modes
2211
-	*
2212
-	* @param String $aircraft_modes the aircraft ident (hex)
2213
-	* @return String aircraft type
2214
-	*
2215
-	*/
2210
+	 * Gets the aircraft info based on the aircraft modes
2211
+	 *
2212
+	 * @param String $aircraft_modes the aircraft ident (hex)
2213
+	 * @return String aircraft type
2214
+	 *
2215
+	 */
2216 2216
 	public function getAllAircraftType($aircraft_modes)
2217 2217
 	{
2218 2218
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -2230,12 +2230,12 @@  discard block
 block discarded – undo
2230 2230
 	}
2231 2231
 
2232 2232
 	/**
2233
-	* Gets the aircraft info based on the aircraft registration
2234
-	*
2235
-	* @param String $registration the aircraft registration
2236
-	* @return String aircraft type
2237
-	*
2238
-	*/
2233
+	 * Gets the aircraft info based on the aircraft registration
2234
+	 *
2235
+	 * @param String $registration the aircraft registration
2236
+	 * @return String aircraft type
2237
+	 *
2238
+	 */
2239 2239
 	public function getAllAircraftTypeByRegistration($registration)
2240 2240
 	{
2241 2241
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2253,12 +2253,12 @@  discard block
 block discarded – undo
2253 2253
 	}
2254 2254
 
2255 2255
 	/**
2256
-	* Gets correct aircraft operator corde
2257
-	*
2258
-	* @param String $operator the aircraft operator code (callsign)
2259
-	* @return String aircraft operator code
2260
-	*
2261
-	*/
2256
+	 * Gets correct aircraft operator corde
2257
+	 *
2258
+	 * @param String $operator the aircraft operator code (callsign)
2259
+	 * @return String aircraft operator code
2260
+	 *
2261
+	 */
2262 2262
 	public function getOperator($operator)
2263 2263
 	{
2264 2264
 		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
@@ -2275,16 +2275,16 @@  discard block
 block discarded – undo
2275 2275
 	}
2276 2276
 
2277 2277
 	/**
2278
-	* Gets the aircraft route based on the aircraft callsign
2279
-	*
2280
-	* @param String $callsign the aircraft callsign
2281
-	* @return Array aircraft type
2282
-	*
2283
-	*/
2278
+	 * Gets the aircraft route based on the aircraft callsign
2279
+	 *
2280
+	 * @param String $callsign the aircraft callsign
2281
+	 * @return Array aircraft type
2282
+	 *
2283
+	 */
2284 2284
 	public function getRouteInfo($callsign)
2285 2285
 	{
2286 2286
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2287
-                if ($callsign == '') return array();
2287
+				if ($callsign == '') return array();
2288 2288
 		$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";
2289 2289
 		
2290 2290
 		$sth = $this->db->prepare($query);
@@ -2298,12 +2298,12 @@  discard block
 block discarded – undo
2298 2298
 	}
2299 2299
 	
2300 2300
 	/**
2301
-	* Gets the aircraft info based on the aircraft registration
2302
-	*
2303
-	* @param String $registration the aircraft registration
2304
-	* @return Array aircraft information
2305
-	*
2306
-	*/
2301
+	 * Gets the aircraft info based on the aircraft registration
2302
+	 *
2303
+	 * @param String $registration the aircraft registration
2304
+	 * @return Array aircraft information
2305
+	 *
2306
+	 */
2307 2307
 	public function getAircraftInfoByRegistration($registration)
2308 2308
 	{
2309 2309
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2330,12 +2330,12 @@  discard block
 block discarded – undo
2330 2330
 	}
2331 2331
 	
2332 2332
 	/**
2333
-	* Gets the aircraft owner & base based on the aircraft registration
2334
-	*
2335
-	* @param String $registration the aircraft registration
2336
-	* @return Array aircraft information
2337
-	*
2338
-	*/
2333
+	 * Gets the aircraft owner & base based on the aircraft registration
2334
+	 *
2335
+	 * @param String $registration the aircraft registration
2336
+	 * @return Array aircraft information
2337
+	 *
2338
+	 */
2339 2339
 	public function getAircraftOwnerByRegistration($registration)
2340 2340
 	{
2341 2341
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2352,11 +2352,11 @@  discard block
 block discarded – undo
2352 2352
 	
2353 2353
   
2354 2354
   /**
2355
-	* Gets all flights (but with only little info)
2356
-	*
2357
-	* @return Array basic flight information
2358
-	*
2359
-	*/
2355
+   * Gets all flights (but with only little info)
2356
+   *
2357
+   * @return Array basic flight information
2358
+   *
2359
+   */
2360 2360
 	public function getAllFlightsforSitemap()
2361 2361
 	{
2362 2362
 		//$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 ";
@@ -2364,7 +2364,7 @@  discard block
 block discarded – undo
2364 2364
 		
2365 2365
 		$sth = $this->db->prepare($query);
2366 2366
 		$sth->execute();
2367
-                  /*
2367
+				  /*
2368 2368
 		$flight_array = array();
2369 2369
 		$temp_array = array();
2370 2370
 		
@@ -2386,11 +2386,11 @@  discard block
 block discarded – undo
2386 2386
 	}
2387 2387
   
2388 2388
 	/**
2389
-	* Gets a list of all aircraft manufacturers
2390
-	*
2391
-	* @return Array list of aircraft types
2392
-	*
2393
-	*/
2389
+	 * Gets a list of all aircraft manufacturers
2390
+	 *
2391
+	 * @return Array list of aircraft types
2392
+	 *
2393
+	 */
2394 2394
 	public function getAllManufacturers()
2395 2395
 	{
2396 2396
 		/*
@@ -2419,11 +2419,11 @@  discard block
 block discarded – undo
2419 2419
   
2420 2420
   
2421 2421
   /**
2422
-	* Gets a list of all aircraft types
2423
-	*
2424
-	* @return Array list of aircraft types
2425
-	*
2426
-	*/
2422
+   * Gets a list of all aircraft types
2423
+   *
2424
+   * @return Array list of aircraft types
2425
+   *
2426
+   */
2427 2427
 	public function getAllAircraftTypes($filters = array())
2428 2428
 	{
2429 2429
 		/*
@@ -2458,11 +2458,11 @@  discard block
 block discarded – undo
2458 2458
 	
2459 2459
 	
2460 2460
 	/**
2461
-	* Gets a list of all aircraft registrations
2462
-	*
2463
-	* @return Array list of aircraft registrations
2464
-	*
2465
-	*/
2461
+	 * Gets a list of all aircraft registrations
2462
+	 *
2463
+	 * @return Array list of aircraft registrations
2464
+	 *
2465
+	 */
2466 2466
 	public function getAllAircraftRegistrations($filters = array())
2467 2467
 	{
2468 2468
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2487,12 +2487,12 @@  discard block
 block discarded – undo
2487 2487
 	}
2488 2488
 
2489 2489
 	/**
2490
-	* Gets all source name
2491
-	*
2492
-	* @param String type format of source
2493
-	* @return Array list of source name
2494
-	*
2495
-	*/
2490
+	 * Gets all source name
2491
+	 *
2492
+	 * @param String type format of source
2493
+	 * @return Array list of source name
2494
+	 *
2495
+	 */
2496 2496
 	public function getAllSourceName($type = '',$filters = array())
2497 2497
 	{
2498 2498
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2523,11 +2523,11 @@  discard block
 block discarded – undo
2523 2523
 
2524 2524
 
2525 2525
 	/**
2526
-	* Gets a list of all airline names
2527
-	*
2528
-	* @return Array list of airline names
2529
-	*
2530
-	*/
2526
+	 * Gets a list of all airline names
2527
+	 *
2528
+	 * @return Array list of airline names
2529
+	 *
2530
+	 */
2531 2531
 	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2532 2532
 	{
2533 2533
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2577,11 +2577,11 @@  discard block
 block discarded – undo
2577 2577
 	
2578 2578
 	
2579 2579
 	/**
2580
-	* Gets a list of all airline countries
2581
-	*
2582
-	* @return Array list of airline countries
2583
-	*
2584
-	*/
2580
+	 * Gets a list of all airline countries
2581
+	 *
2582
+	 * @return Array list of airline countries
2583
+	 *
2584
+	 */
2585 2585
 	public function getAllAirlineCountries($filters = array())
2586 2586
 	{
2587 2587
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2609,11 +2609,11 @@  discard block
 block discarded – undo
2609 2609
 	
2610 2610
 	
2611 2611
 	/**
2612
-	* Gets a list of all departure & arrival names
2613
-	*
2614
-	* @return Array list of airport names
2615
-	*
2616
-	*/
2612
+	 * Gets a list of all departure & arrival names
2613
+	 *
2614
+	 * @return Array list of airport names
2615
+	 *
2616
+	 */
2617 2617
 	public function getAllAirportNames($filters = array())
2618 2618
 	{
2619 2619
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2662,11 +2662,11 @@  discard block
 block discarded – undo
2662 2662
 	
2663 2663
 	
2664 2664
 	/**
2665
-	* Gets a list of all departure & arrival airport countries
2666
-	*
2667
-	* @return Array list of airport countries
2668
-	*
2669
-	*/
2665
+	 * Gets a list of all departure & arrival airport countries
2666
+	 *
2667
+	 * @return Array list of airport countries
2668
+	 *
2669
+	 */
2670 2670
 	public function getAllAirportCountries($filters = array())
2671 2671
 	{
2672 2672
 		$airport_array = array();
@@ -2714,11 +2714,11 @@  discard block
 block discarded – undo
2714 2714
 	
2715 2715
 	
2716 2716
 	/**
2717
-	* Gets a list of all countries (airline, departure airport & arrival airport)
2718
-	*
2719
-	* @return Array list of countries
2720
-	*
2721
-	*/
2717
+	 * Gets a list of all countries (airline, departure airport & arrival airport)
2718
+	 *
2719
+	 * @return Array list of countries
2720
+	 *
2721
+	 */
2722 2722
 	public function getAllCountries($filters = array())
2723 2723
 	{
2724 2724
 		$Connection= new Connection($this->db);
@@ -2795,11 +2795,11 @@  discard block
 block discarded – undo
2795 2795
 	
2796 2796
 	
2797 2797
 	/**
2798
-	* Gets a list of all idents/callsigns
2799
-	*
2800
-	* @return Array list of ident/callsign names
2801
-	*
2802
-	*/
2798
+	 * Gets a list of all idents/callsigns
2799
+	 *
2800
+	 * @return Array list of ident/callsign names
2801
+	 *
2802
+	 */
2803 2803
 	public function getAllIdents($filters = array())
2804 2804
 	{
2805 2805
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2823,9 +2823,9 @@  discard block
 block discarded – undo
2823 2823
 	}
2824 2824
 
2825 2825
 	/**
2826
-	* Get a list of flights from airport since 7 days
2827
-	* @return Array number, icao, name and city of airports
2828
-	*/
2826
+	 * Get a list of flights from airport since 7 days
2827
+	 * @return Array number, icao, name and city of airports
2828
+	 */
2829 2829
 
2830 2830
 	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
2831 2831
 		global $globalTimezone, $globalDBdriver;
@@ -2856,9 +2856,9 @@  discard block
 block discarded – undo
2856 2856
 	}
2857 2857
 
2858 2858
 	/**
2859
-	* Get a list of flights from airport since 7 days
2860
-	* @return Array number, icao, name and city of airports
2861
-	*/
2859
+	 * Get a list of flights from airport since 7 days
2860
+	 * @return Array number, icao, name and city of airports
2861
+	 */
2862 2862
 
2863 2863
 	public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') {
2864 2864
 		global $globalTimezone, $globalDBdriver;
@@ -2888,9 +2888,9 @@  discard block
 block discarded – undo
2888 2888
 	}
2889 2889
 
2890 2890
 	/**
2891
-	* Get a list of flights from detected airport since 7 days
2892
-	* @return Array number, icao, name and city of airports
2893
-	*/
2891
+	 * Get a list of flights from detected airport since 7 days
2892
+	 * @return Array number, icao, name and city of airports
2893
+	 */
2894 2894
 
2895 2895
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
2896 2896
 		global $globalTimezone, $globalDBdriver;
@@ -2928,9 +2928,9 @@  discard block
 block discarded – undo
2928 2928
 	}
2929 2929
 
2930 2930
 	/**
2931
-	* Get a list of flights from detected airport since 7 days
2932
-	* @return Array number, icao, name and city of airports
2933
-	*/
2931
+	 * Get a list of flights from detected airport since 7 days
2932
+	 * @return Array number, icao, name and city of airports
2933
+	 */
2934 2934
 
2935 2935
 	public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') {
2936 2936
 		global $globalTimezone, $globalDBdriver;
@@ -2972,9 +2972,9 @@  discard block
 block discarded – undo
2972 2972
 
2973 2973
 
2974 2974
 	/**
2975
-	* Get a list of flights to airport since 7 days
2976
-	* @return Array number, icao, name and city of airports
2977
-	*/
2975
+	 * Get a list of flights to airport since 7 days
2976
+	 * @return Array number, icao, name and city of airports
2977
+	 */
2978 2978
 
2979 2979
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
2980 2980
 		global $globalTimezone, $globalDBdriver;
@@ -3007,9 +3007,9 @@  discard block
 block discarded – undo
3007 3007
 
3008 3008
 
3009 3009
 	/**
3010
-	* Get a list of flights detected to airport since 7 days
3011
-	* @return Array number, icao, name and city of airports
3012
-	*/
3010
+	 * Get a list of flights detected to airport since 7 days
3011
+	 * @return Array number, icao, name and city of airports
3012
+	 */
3013 3013
 
3014 3014
 	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3015 3015
 		global $globalTimezone, $globalDBdriver;
@@ -3050,9 +3050,9 @@  discard block
 block discarded – undo
3050 3050
 
3051 3051
 
3052 3052
 	/**
3053
-	* Get a list of flights to airport since 7 days
3054
-	* @return Array number, icao, name and city of airports
3055
-	*/
3053
+	 * Get a list of flights to airport since 7 days
3054
+	 * @return Array number, icao, name and city of airports
3055
+	 */
3056 3056
 
3057 3057
 	public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') {
3058 3058
 		global $globalTimezone, $globalDBdriver;
@@ -3084,9 +3084,9 @@  discard block
 block discarded – undo
3084 3084
 
3085 3085
 
3086 3086
 	/**
3087
-	* Get a list of flights detected to airport since 7 days
3088
-	* @return Array number, icao, name and city of airports
3089
-	*/
3087
+	 * Get a list of flights detected to airport since 7 days
3088
+	 * @return Array number, icao, name and city of airports
3089
+	 */
3090 3090
 
3091 3091
 	public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') {
3092 3092
 		global $globalTimezone, $globalDBdriver;
@@ -3130,11 +3130,11 @@  discard block
 block discarded – undo
3130 3130
 
3131 3131
 
3132 3132
 	/**
3133
-	* Gets a list of all dates
3134
-	*
3135
-	* @return Array list of date names
3136
-	*
3137
-	*/
3133
+	 * Gets a list of all dates
3134
+	 *
3135
+	 * @return Array list of date names
3136
+	 *
3137
+	 */
3138 3138
 	public function getAllDates()
3139 3139
 	{
3140 3140
 		global $globalTimezone, $globalDBdriver;
@@ -3175,11 +3175,11 @@  discard block
 block discarded – undo
3175 3175
 	
3176 3176
 	
3177 3177
 	/**
3178
-	* Gets all route combinations
3179
-	*
3180
-	* @return Array the route list
3181
-	*
3182
-	*/
3178
+	 * Gets all route combinations
3179
+	 *
3180
+	 * @return Array the route list
3181
+	 *
3182
+	 */
3183 3183
 	public function getAllRoutes()
3184 3184
 	{
3185 3185
 		$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 
@@ -3205,13 +3205,13 @@  discard block
 block discarded – undo
3205 3205
 	}
3206 3206
 
3207 3207
 	/**
3208
-	* Update ident spotter data
3209
-	*
3210
-	* @param String $flightaware_id the ID from flightaware
3211
-	* @param String $ident the flight ident
3212
-	* @return String success or false
3213
-	*
3214
-	*/	
3208
+	 * Update ident spotter data
3209
+	 *
3210
+	 * @param String $flightaware_id the ID from flightaware
3211
+	 * @param String $ident the flight ident
3212
+	 * @return String success or false
3213
+	 *
3214
+	 */	
3215 3215
 	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3216 3216
 	{
3217 3217
 		if (!is_numeric(substr($ident, 0, 3)))
@@ -3232,14 +3232,14 @@  discard block
 block discarded – undo
3232 3232
 		} else {
3233 3233
 			$airline_array = $this->getAllAirlineInfo("NA");
3234 3234
 		}
3235
-                $airline_name = $airline_array[0]['name'];
3236
-                $airline_icao = $airline_array[0]['icao'];
3237
-                $airline_country = $airline_array[0]['country'];
3238
-                $airline_type = $airline_array[0]['type'];
3235
+				$airline_name = $airline_array[0]['name'];
3236
+				$airline_icao = $airline_array[0]['icao'];
3237
+				$airline_country = $airline_array[0]['country'];
3238
+				$airline_type = $airline_array[0]['type'];
3239 3239
 
3240 3240
 
3241 3241
 		$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';
3242
-                $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);
3242
+				$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);
3243 3243
 
3244 3244
 		try {
3245 3245
 			$sth = $this->db->prepare($query);
@@ -3252,19 +3252,19 @@  discard block
 block discarded – undo
3252 3252
 
3253 3253
 	}
3254 3254
 	/**
3255
-	* Update latest spotter data
3256
-	*
3257
-	* @param String $flightaware_id the ID from flightaware
3258
-	* @param String $ident the flight ident
3259
-	* @param String $arrival_airport_icao the arrival airport
3260
-	* @return String success or false
3261
-	*
3262
-	*/	
3255
+	 * Update latest spotter data
3256
+	 *
3257
+	 * @param String $flightaware_id the ID from flightaware
3258
+	 * @param String $ident the flight ident
3259
+	 * @param String $arrival_airport_icao the arrival airport
3260
+	 * @return String success or false
3261
+	 *
3262
+	 */	
3263 3263
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3264 3264
 	{
3265 3265
 		if ($groundspeed == '') $groundspeed = NULL;
3266 3266
 		$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';
3267
-                $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);
3267
+				$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);
3268 3268
 
3269 3269
 		try {
3270 3270
 			$sth = $this->db->prepare($query);
@@ -3278,32 +3278,32 @@  discard block
 block discarded – undo
3278 3278
 	}
3279 3279
 
3280 3280
 	/**
3281
-	* Adds a new spotter data
3282
-	*
3283
-	* @param String $flightaware_id the ID from flightaware
3284
-	* @param String $ident the flight ident
3285
-	* @param String $aircraft_icao the aircraft type
3286
-	* @param String $departure_airport_icao the departure airport
3287
-	* @param String $arrival_airport_icao the arrival airport
3288
-	* @param String $latitude latitude of flight
3289
-	* @param String $longitude latitude of flight
3290
-	* @param String $waypoints waypoints of flight
3291
-	* @param String $altitude altitude of flight
3292
-	* @param String $heading heading of flight
3293
-	* @param String $groundspeed speed of flight
3294
-	* @param String $date date of flight
3295
-	* @param String $departure_airport_time departure time of flight
3296
-	* @param String $arrival_airport_time arrival time of flight
3297
-	* @param String $squawk squawk code of flight
3298
-	* @param String $route_stop route stop of flight
3299
-	* @param String $highlight highlight or not
3300
-	* @param String $ModeS ModesS code of flight
3301
-	* @param String $registration registration code of flight
3302
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
3303
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
3304
-	* @param String $verticalrate vertival rate of flight
3305
-	* @return String success or false
3306
-	*/
3281
+	 * Adds a new spotter data
3282
+	 *
3283
+	 * @param String $flightaware_id the ID from flightaware
3284
+	 * @param String $ident the flight ident
3285
+	 * @param String $aircraft_icao the aircraft type
3286
+	 * @param String $departure_airport_icao the departure airport
3287
+	 * @param String $arrival_airport_icao the arrival airport
3288
+	 * @param String $latitude latitude of flight
3289
+	 * @param String $longitude latitude of flight
3290
+	 * @param String $waypoints waypoints of flight
3291
+	 * @param String $altitude altitude of flight
3292
+	 * @param String $heading heading of flight
3293
+	 * @param String $groundspeed speed of flight
3294
+	 * @param String $date date of flight
3295
+	 * @param String $departure_airport_time departure time of flight
3296
+	 * @param String $arrival_airport_time arrival time of flight
3297
+	 * @param String $squawk squawk code of flight
3298
+	 * @param String $route_stop route stop of flight
3299
+	 * @param String $highlight highlight or not
3300
+	 * @param String $ModeS ModesS code of flight
3301
+	 * @param String $registration registration code of flight
3302
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
3303
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
3304
+	 * @param String $verticalrate vertival rate of flight
3305
+	 * @return String success or false
3306
+	 */
3307 3307
 	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 = '')
3308 3308
 	{
3309 3309
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
@@ -3518,8 +3518,8 @@  discard block
 block discarded – undo
3518 3518
     
3519 3519
 		if ($globalIVAO && $aircraft_icao != '')
3520 3520
 		{
3521
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3522
-            		else $airline_icao = '';
3521
+					if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3522
+					else $airline_icao = '';
3523 3523
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3524 3524
 			if (!isset($image_array[0]['registration']))
3525 3525
 			{
@@ -3550,53 +3550,53 @@  discard block
 block discarded – undo
3550 3550
 	
3551 3551
 		if (count($airline_array) == 0) 
3552 3552
 		{
3553
-                        $airline_array = $this->getAllAirlineInfo('NA');
3554
-                }
3555
-                if (count($aircraft_array) == 0) 
3556
-                {
3557
-                        $aircraft_array = $this->getAllAircraftInfo('NA');
3558
-                }
3559
-                if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3560
-                {
3561
-                        $departure_airport_array = $this->getAllAirportInfo('NA');
3562
-                }
3563
-                if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3564
-                {
3565
-                        $arrival_airport_array = $this->getAllAirportInfo('NA');
3566
-                }
3567
-                if ($registration == '') $registration = 'NA';
3568
-                if ($latitude == '' && $longitude == '') {
3569
-            		$latitude = 0;
3570
-            		$longitude = 0;
3571
-            	}
3572
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3573
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3574
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3575
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3576
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3577
-                $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) 
3553
+						$airline_array = $this->getAllAirlineInfo('NA');
3554
+				}
3555
+				if (count($aircraft_array) == 0) 
3556
+				{
3557
+						$aircraft_array = $this->getAllAircraftInfo('NA');
3558
+				}
3559
+				if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3560
+				{
3561
+						$departure_airport_array = $this->getAllAirportInfo('NA');
3562
+				}
3563
+				if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3564
+				{
3565
+						$arrival_airport_array = $this->getAllAirportInfo('NA');
3566
+				}
3567
+				if ($registration == '') $registration = 'NA';
3568
+				if ($latitude == '' && $longitude == '') {
3569
+					$latitude = 0;
3570
+					$longitude = 0;
3571
+				}
3572
+				if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3573
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3574
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3575
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3576
+				if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3577
+				$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) 
3578 3578
                 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)";
3579 3579
 
3580
-                $airline_name = $airline_array[0]['name'];
3581
-                $airline_icao = $airline_array[0]['icao'];
3582
-                $airline_country = $airline_array[0]['country'];
3583
-                $airline_type = $airline_array[0]['type'];
3580
+				$airline_name = $airline_array[0]['name'];
3581
+				$airline_icao = $airline_array[0]['icao'];
3582
+				$airline_country = $airline_array[0]['country'];
3583
+				$airline_type = $airline_array[0]['type'];
3584 3584
 		if ($airline_type == '') {
3585 3585
 			$timeelapsed = microtime(true);
3586 3586
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3587 3587
 			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3588 3588
 		}
3589 3589
 		if ($airline_type == null) $airline_type = '';
3590
-                $aircraft_type = $aircraft_array[0]['type'];
3591
-                $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3592
-                $departure_airport_name = $departure_airport_array[0]['name'];
3593
-	        $departure_airport_city = $departure_airport_array[0]['city'];
3594
-            	$departure_airport_country = $departure_airport_array[0]['country'];
3590
+				$aircraft_type = $aircraft_array[0]['type'];
3591
+				$aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3592
+				$departure_airport_name = $departure_airport_array[0]['name'];
3593
+			$departure_airport_city = $departure_airport_array[0]['city'];
3594
+				$departure_airport_country = $departure_airport_array[0]['country'];
3595 3595
                 
3596
-                $arrival_airport_name = $arrival_airport_array[0]['name'];
3597
-                $arrival_airport_city = $arrival_airport_array[0]['city'];
3598
-                $arrival_airport_country = $arrival_airport_array[0]['country'];
3599
-                $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);
3596
+				$arrival_airport_name = $arrival_airport_array[0]['name'];
3597
+				$arrival_airport_city = $arrival_airport_array[0]['city'];
3598
+				$arrival_airport_country = $arrival_airport_array[0]['country'];
3599
+				$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);
3600 3600
 
3601 3601
 		try {
3602 3602
 		        
@@ -3604,7 +3604,7 @@  discard block
 block discarded – undo
3604 3604
 			$sth->execute($query_values);
3605 3605
 			$this->db = null;
3606 3606
 		} catch (PDOException $e) {
3607
-		    return "error : ".$e->getMessage();
3607
+			return "error : ".$e->getMessage();
3608 3608
 		}
3609 3609
 		
3610 3610
 		return "success";
@@ -3613,11 +3613,11 @@  discard block
 block discarded – undo
3613 3613
 	
3614 3614
   
3615 3615
 	/**
3616
-	* Gets the aircraft ident within the last hour
3617
-	*
3618
-	* @return String the ident
3619
-	*
3620
-	*/
3616
+	 * Gets the aircraft ident within the last hour
3617
+	 *
3618
+	 * @return String the ident
3619
+	 *
3620
+	 */
3621 3621
 	public function getIdentFromLastHour($ident)
3622 3622
 	{
3623 3623
 		global $globalDBdriver, $globalTimezone;
@@ -3633,11 +3633,11 @@  discard block
 block discarded – undo
3633 3633
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3634 3634
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
3635 3635
 			$query_data = array(':ident' => $ident);
3636
-    		}
3636
+			}
3637 3637
 		
3638 3638
 		$sth = $this->db->prepare($query);
3639 3639
 		$sth->execute($query_data);
3640
-    		$ident_result='';
3640
+			$ident_result='';
3641 3641
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3642 3642
 		{
3643 3643
 			$ident_result = $row['ident'];
@@ -3648,11 +3648,11 @@  discard block
 block discarded – undo
3648 3648
 	
3649 3649
 	
3650 3650
 	/**
3651
-	* Gets the aircraft data from the last 20 seconds
3652
-	*
3653
-	* @return Array the spotter data
3654
-	*
3655
-	*/
3651
+	 * Gets the aircraft data from the last 20 seconds
3652
+	 *
3653
+	 * @return Array the spotter data
3654
+	 *
3655
+	 */
3656 3656
 	public function getRealTimeData($q = '')
3657 3657
 	{
3658 3658
 		global $globalDBdriver;
@@ -3696,11 +3696,11 @@  discard block
 block discarded – undo
3696 3696
 	
3697 3697
 	
3698 3698
 	 /**
3699
-	* Gets all airlines that have flown over
3700
-	*
3701
-	* @return Array the airline list
3702
-	*
3703
-	*/
3699
+	  * Gets all airlines that have flown over
3700
+	  *
3701
+	  * @return Array the airline list
3702
+	  *
3703
+	  */
3704 3704
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3705 3705
 	{
3706 3706
 		global $globalDBdriver;
@@ -3714,7 +3714,7 @@  discard block
 block discarded – undo
3714 3714
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3715 3715
 			}
3716 3716
 		}
3717
-                if ($sincedate != '') {
3717
+				if ($sincedate != '') {
3718 3718
 			if ($globalDBdriver == 'mysql') {
3719 3719
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3720 3720
 			} else {
@@ -3741,26 +3741,26 @@  discard block
 block discarded – undo
3741 3741
 	}
3742 3742
 
3743 3743
 	 /**
3744
-	* Gets all pilots that have flown over
3745
-	*
3746
-	* @return Array the pilots list
3747
-	*
3748
-	*/
3744
+	  * Gets all pilots that have flown over
3745
+	  *
3746
+	  * @return Array the pilots list
3747
+	  *
3748
+	  */
3749 3749
 	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3750 3750
 	{
3751 3751
 		global $globalDBdriver;
3752 3752
 		$filter_query = $this->getFilter($filters,true,true);
3753 3753
 		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3754 3754
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3755
-                if ($olderthanmonths > 0) {
3756
-            		if ($globalDBdriver == 'mysql') {
3755
+				if ($olderthanmonths > 0) {
3756
+					if ($globalDBdriver == 'mysql') {
3757 3757
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3758 3758
 			} else {
3759 3759
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3760 3760
 			}
3761 3761
 		}
3762
-                if ($sincedate != '') {
3763
-            		if ($globalDBdriver == 'mysql') {
3762
+				if ($sincedate != '') {
3763
+					if ($globalDBdriver == 'mysql') {
3764 3764
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3765 3765
 			} else {
3766 3766
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3788,25 +3788,25 @@  discard block
 block discarded – undo
3788 3788
 	}
3789 3789
 	
3790 3790
 		 /**
3791
-	* Gets all pilots that have flown over
3792
-	*
3793
-	* @return Array the pilots list
3794
-	*
3795
-	*/
3791
+		  * Gets all pilots that have flown over
3792
+		  *
3793
+		  * @return Array the pilots list
3794
+		  *
3795
+		  */
3796 3796
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3797 3797
 	{
3798 3798
 		global $globalDBdriver;
3799 3799
 		$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
3800 3800
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
3801
-                if ($olderthanmonths > 0) {
3802
-            		if ($globalDBdriver == 'mysql') {
3801
+				if ($olderthanmonths > 0) {
3802
+					if ($globalDBdriver == 'mysql') {
3803 3803
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3804 3804
 			} else {
3805 3805
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3806 3806
 			}
3807 3807
 		}
3808
-                if ($sincedate != '') {
3809
-            		if ($globalDBdriver == 'mysql') {
3808
+				if ($sincedate != '') {
3809
+					if ($globalDBdriver == 'mysql') {
3810 3810
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3811 3811
 			} else {
3812 3812
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3835,26 +3835,26 @@  discard block
 block discarded – undo
3835 3835
 	}
3836 3836
 	
3837 3837
 	 /**
3838
-	* Gets all owner that have flown over
3839
-	*
3840
-	* @return Array the pilots list
3841
-	*
3842
-	*/
3838
+	  * Gets all owner that have flown over
3839
+	  *
3840
+	  * @return Array the pilots list
3841
+	  *
3842
+	  */
3843 3843
 	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3844 3844
 	{
3845 3845
 		global $globalDBdriver;
3846 3846
 		$filter_query = $this->getFilter($filters,true,true);
3847 3847
 		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3848 3848
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3849
-                if ($olderthanmonths > 0) {
3850
-            		if ($globalDBdriver == 'mysql') {
3849
+				if ($olderthanmonths > 0) {
3850
+					if ($globalDBdriver == 'mysql') {
3851 3851
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3852 3852
 			} else {
3853 3853
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3854 3854
 			}
3855 3855
 		}
3856
-                if ($sincedate != '') {
3857
-            		if ($globalDBdriver == 'mysql') {
3856
+				if ($sincedate != '') {
3857
+					if ($globalDBdriver == 'mysql') {
3858 3858
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3859 3859
 			} else {
3860 3860
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3880,26 +3880,26 @@  discard block
 block discarded – undo
3880 3880
 	}
3881 3881
 	
3882 3882
 	 /**
3883
-	* Gets all owner that have flown over
3884
-	*
3885
-	* @return Array the pilots list
3886
-	*
3887
-	*/
3883
+	  * Gets all owner that have flown over
3884
+	  *
3885
+	  * @return Array the pilots list
3886
+	  *
3887
+	  */
3888 3888
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3889 3889
 	{
3890 3890
 		global $globalDBdriver;
3891 3891
 		$filter_query = $this->getFilter($filters,true,true);
3892 3892
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3893 3893
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3894
-                if ($olderthanmonths > 0) {
3895
-            		if ($globalDBdriver == 'mysql') {
3894
+				if ($olderthanmonths > 0) {
3895
+					if ($globalDBdriver == 'mysql') {
3896 3896
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3897 3897
 			} else {
3898 3898
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3899 3899
 			}
3900 3900
 		}
3901
-                if ($sincedate != '') {
3902
-            		if ($globalDBdriver == 'mysql') {
3901
+				if ($sincedate != '') {
3902
+					if ($globalDBdriver == 'mysql') {
3903 3903
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3904 3904
 			} else {
3905 3905
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3926,11 +3926,11 @@  discard block
 block discarded – undo
3926 3926
 	}
3927 3927
 
3928 3928
 	/**
3929
-	* Gets all airlines that have flown over by aircraft
3930
-	*
3931
-	* @return Array the airline list
3932
-	*
3933
-	*/
3929
+	 * Gets all airlines that have flown over by aircraft
3930
+	 *
3931
+	 * @return Array the airline list
3932
+	 *
3933
+	 */
3934 3934
 	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
3935 3935
 	{
3936 3936
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3962,11 +3962,11 @@  discard block
 block discarded – undo
3962 3962
 
3963 3963
 
3964 3964
 	/**
3965
-	* Gets all airline countries that have flown over by aircraft
3966
-	*
3967
-	* @return Array the airline country list
3968
-	*
3969
-	*/
3965
+	 * Gets all airline countries that have flown over by aircraft
3966
+	 *
3967
+	 * @return Array the airline country list
3968
+	 *
3969
+	 */
3970 3970
 	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
3971 3971
 	{
3972 3972
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3998,11 +3998,11 @@  discard block
 block discarded – undo
3998 3998
 	
3999 3999
 	
4000 4000
 	/**
4001
-	* Gets all airlines that have flown over by airport
4002
-	*
4003
-	* @return Array the airline list
4004
-	*
4005
-	*/
4001
+	 * Gets all airlines that have flown over by airport
4002
+	 *
4003
+	 * @return Array the airline list
4004
+	 *
4005
+	 */
4006 4006
 	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4007 4007
 	{
4008 4008
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4033,11 +4033,11 @@  discard block
 block discarded – undo
4033 4033
 
4034 4034
 
4035 4035
 	/**
4036
-	* Gets all airline countries that have flown over by airport icao
4037
-	*
4038
-	* @return Array the airline country list
4039
-	*
4040
-	*/
4036
+	 * Gets all airline countries that have flown over by airport icao
4037
+	 *
4038
+	 * @return Array the airline country list
4039
+	 *
4040
+	 */
4041 4041
 	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4042 4042
 	{
4043 4043
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4067,11 +4067,11 @@  discard block
 block discarded – undo
4067 4067
 
4068 4068
 
4069 4069
 	/**
4070
-	* Gets all airlines that have flown over by aircraft manufacturer
4071
-	*
4072
-	* @return Array the airline list
4073
-	*
4074
-	*/
4070
+	 * Gets all airlines that have flown over by aircraft manufacturer
4071
+	 *
4072
+	 * @return Array the airline list
4073
+	 *
4074
+	 */
4075 4075
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4076 4076
 	{
4077 4077
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4102,11 +4102,11 @@  discard block
 block discarded – undo
4102 4102
 
4103 4103
 
4104 4104
 	/**
4105
-	* Gets all airline countries that have flown over by aircraft manufacturer
4106
-	*
4107
-	* @return Array the airline country list
4108
-	*
4109
-	*/
4105
+	 * Gets all airline countries that have flown over by aircraft manufacturer
4106
+	 *
4107
+	 * @return Array the airline country list
4108
+	 *
4109
+	 */
4110 4110
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4111 4111
 	{
4112 4112
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4135,11 +4135,11 @@  discard block
 block discarded – undo
4135 4135
 
4136 4136
 
4137 4137
 	/**
4138
-	* Gets all airlines that have flown over by date
4139
-	*
4140
-	* @return Array the airline list
4141
-	*
4142
-	*/
4138
+	 * Gets all airlines that have flown over by date
4139
+	 *
4140
+	 * @return Array the airline list
4141
+	 *
4142
+	 */
4143 4143
 	public function countAllAirlinesByDate($date,$filters = array())
4144 4144
 	{
4145 4145
 		global $globalTimezone, $globalDBdriver;
@@ -4183,11 +4183,11 @@  discard block
 block discarded – undo
4183 4183
 	
4184 4184
 	
4185 4185
 	/**
4186
-	* Gets all airline countries that have flown over by date
4187
-	*
4188
-	* @return Array the airline country list
4189
-	*
4190
-	*/
4186
+	 * Gets all airline countries that have flown over by date
4187
+	 *
4188
+	 * @return Array the airline country list
4189
+	 *
4190
+	 */
4191 4191
 	public function countAllAirlineCountriesByDate($date,$filters = array())
4192 4192
 	{
4193 4193
 		global $globalTimezone, $globalDBdriver;
@@ -4230,11 +4230,11 @@  discard block
 block discarded – undo
4230 4230
 
4231 4231
 
4232 4232
 	/**
4233
-	* Gets all airlines that have flown over by ident/callsign
4234
-	*
4235
-	* @return Array the airline list
4236
-	*
4237
-	*/
4233
+	 * Gets all airlines that have flown over by ident/callsign
4234
+	 *
4235
+	 * @return Array the airline list
4236
+	 *
4237
+	 */
4238 4238
 	public function countAllAirlinesByIdent($ident,$filters = array())
4239 4239
 	{
4240 4240
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4264,11 +4264,11 @@  discard block
 block discarded – undo
4264 4264
 	}
4265 4265
 
4266 4266
 	/**
4267
-	* Gets all airlines that have flown over by route
4268
-	*
4269
-	* @return Array the airline list
4270
-	*
4271
-	*/
4267
+	 * Gets all airlines that have flown over by route
4268
+	 *
4269
+	 * @return Array the airline list
4270
+	 *
4271
+	 */
4272 4272
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4273 4273
 	{
4274 4274
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4300,11 +4300,11 @@  discard block
 block discarded – undo
4300 4300
 	}
4301 4301
 
4302 4302
 	/**
4303
-	* Gets all airline countries that have flown over by route
4304
-	*
4305
-	* @return Array the airline country list
4306
-	*
4307
-	*/
4303
+	 * Gets all airline countries that have flown over by route
4304
+	 *
4305
+	 * @return Array the airline country list
4306
+	 *
4307
+	 */
4308 4308
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4309 4309
 	{
4310 4310
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4336,11 +4336,11 @@  discard block
 block discarded – undo
4336 4336
 
4337 4337
 
4338 4338
 	/**
4339
-	* Gets all airlines that have flown over by country
4340
-	*
4341
-	* @return Array the airline list
4342
-	*
4343
-	*/
4339
+	 * Gets all airlines that have flown over by country
4340
+	 *
4341
+	 * @return Array the airline list
4342
+	 *
4343
+	 */
4344 4344
 	public function countAllAirlinesByCountry($country,$filters = array())
4345 4345
 	{
4346 4346
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4370,11 +4370,11 @@  discard block
 block discarded – undo
4370 4370
 
4371 4371
 
4372 4372
 	/**
4373
-	* Gets all airline countries that have flown over by country
4374
-	*
4375
-	* @return Array the airline country list
4376
-	*
4377
-	*/
4373
+	 * Gets all airline countries that have flown over by country
4374
+	 *
4375
+	 * @return Array the airline country list
4376
+	 *
4377
+	 */
4378 4378
 	public function countAllAirlineCountriesByCountry($country,$filters = array())
4379 4379
 	{
4380 4380
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4403,11 +4403,11 @@  discard block
 block discarded – undo
4403 4403
 
4404 4404
 
4405 4405
 	/**
4406
-	* Gets all airlines countries
4407
-	*
4408
-	* @return Array the airline country list
4409
-	*
4410
-	*/
4406
+	 * Gets all airlines countries
4407
+	 *
4408
+	 * @return Array the airline country list
4409
+	 *
4410
+	 */
4411 4411
 	public function countAllAirlineCountries($limit = true, $filters = array())
4412 4412
 	{
4413 4413
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4433,11 +4433,11 @@  discard block
 block discarded – undo
4433 4433
 	}
4434 4434
 
4435 4435
 	/**
4436
-	* Gets all number of flight over countries
4437
-	*
4438
-	* @return Array the airline country list
4439
-	*
4440
-	*/
4436
+	 * Gets all number of flight over countries
4437
+	 *
4438
+	 * @return Array the airline country list
4439
+	 *
4440
+	 */
4441 4441
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4442 4442
 	{
4443 4443
 		global $globalDBdriver;
@@ -4459,15 +4459,15 @@  discard block
 block discarded – undo
4459 4459
 		$SpotterLive = new SpotterLive();
4460 4460
 		$filter_query = $SpotterLive->getFilter($filters,true,true);
4461 4461
 		$filter_query .= ' over_country IS NOT NULL';
4462
-                if ($olderthanmonths > 0) {
4462
+				if ($olderthanmonths > 0) {
4463 4463
 			if ($globalDBdriver == 'mysql') {
4464 4464
 				$filter_query .= ' AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
4465 4465
 			} else {
4466 4466
 				$filter_query .= " AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4467 4467
 			}
4468 4468
 		}
4469
-                if ($sincedate != '') {
4470
-            		if ($globalDBdriver == 'mysql') {
4469
+				if ($sincedate != '') {
4470
+					if ($globalDBdriver == 'mysql') {
4471 4471
 				$filter_query .= " AND spotter_live.date > '".$sincedate."' ";
4472 4472
 			} else {
4473 4473
 				$filter_query .= " AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4497,11 +4497,11 @@  discard block
 block discarded – undo
4497 4497
 	
4498 4498
 	
4499 4499
 	/**
4500
-	* Gets all aircraft types that have flown over
4501
-	*
4502
-	* @return Array the aircraft list
4503
-	*
4504
-	*/
4500
+	 * Gets all aircraft types that have flown over
4501
+	 *
4502
+	 * @return Array the aircraft list
4503
+	 *
4504
+	 */
4505 4505
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4506 4506
 	{
4507 4507
 		global $globalDBdriver;
@@ -4544,11 +4544,11 @@  discard block
 block discarded – undo
4544 4544
 	}
4545 4545
 
4546 4546
 	/**
4547
-	* Gets all aircraft types that have flown over by airline
4548
-	*
4549
-	* @return Array the aircraft list
4550
-	*
4551
-	*/
4547
+	 * Gets all aircraft types that have flown over by airline
4548
+	 *
4549
+	 * @return Array the aircraft list
4550
+	 *
4551
+	 */
4552 4552
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4553 4553
 	{
4554 4554
 		global $globalDBdriver;
@@ -4591,11 +4591,11 @@  discard block
 block discarded – undo
4591 4591
 	}
4592 4592
 
4593 4593
 	/**
4594
-	* Gets all aircraft types that have flown over by months
4595
-	*
4596
-	* @return Array the aircraft list
4597
-	*
4598
-	*/
4594
+	 * Gets all aircraft types that have flown over by months
4595
+	 *
4596
+	 * @return Array the aircraft list
4597
+	 *
4598
+	 */
4599 4599
 	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4600 4600
 	{
4601 4601
 		global $globalDBdriver;
@@ -4639,11 +4639,11 @@  discard block
 block discarded – undo
4639 4639
 
4640 4640
 
4641 4641
 	/**
4642
-	* Gets all aircraft registration that have flown over by aircaft icao
4643
-	*
4644
-	* @return Array the aircraft list
4645
-	*
4646
-	*/
4642
+	 * Gets all aircraft registration that have flown over by aircaft icao
4643
+	 *
4644
+	 * @return Array the aircraft list
4645
+	 *
4646
+	 */
4647 4647
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
4648 4648
 	{
4649 4649
 		$Image = new Image($this->db);
@@ -4682,11 +4682,11 @@  discard block
 block discarded – undo
4682 4682
 
4683 4683
 
4684 4684
 	/**
4685
-	* Gets all aircraft types that have flown over by airline icao
4686
-	*
4687
-	* @return Array the aircraft list
4688
-	*
4689
-	*/
4685
+	 * Gets all aircraft types that have flown over by airline icao
4686
+	 *
4687
+	 * @return Array the aircraft list
4688
+	 *
4689
+	 */
4690 4690
 	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
4691 4691
 	{
4692 4692
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4715,11 +4715,11 @@  discard block
 block discarded – undo
4715 4715
 
4716 4716
 
4717 4717
 	/**
4718
-	* Gets all aircraft registration that have flown over by airline icao
4719
-	*
4720
-	* @return Array the aircraft list
4721
-	*
4722
-	*/
4718
+	 * Gets all aircraft registration that have flown over by airline icao
4719
+	 *
4720
+	 * @return Array the aircraft list
4721
+	 *
4722
+	 */
4723 4723
 	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
4724 4724
 	{
4725 4725
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4757,11 +4757,11 @@  discard block
 block discarded – undo
4757 4757
 
4758 4758
 
4759 4759
 	/**
4760
-	* Gets all aircraft manufacturer that have flown over by airline icao
4761
-	*
4762
-	* @return Array the aircraft list
4763
-	*
4764
-	*/
4760
+	 * Gets all aircraft manufacturer that have flown over by airline icao
4761
+	 *
4762
+	 * @return Array the aircraft list
4763
+	 *
4764
+	 */
4765 4765
 	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
4766 4766
 	{
4767 4767
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4789,11 +4789,11 @@  discard block
 block discarded – undo
4789 4789
 
4790 4790
 
4791 4791
 	/**
4792
-	* Gets all aircraft types that have flown over by airline icao
4793
-	*
4794
-	* @return Array the aircraft list
4795
-	*
4796
-	*/
4792
+	 * Gets all aircraft types that have flown over by airline icao
4793
+	 *
4794
+	 * @return Array the aircraft list
4795
+	 *
4796
+	 */
4797 4797
 	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
4798 4798
 	{
4799 4799
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4822,11 +4822,11 @@  discard block
 block discarded – undo
4822 4822
 
4823 4823
 
4824 4824
 	/**
4825
-	* Gets all aircraft registration that have flown over by airport icao
4826
-	*
4827
-	* @return Array the aircraft list
4828
-	*
4829
-	*/
4825
+	 * Gets all aircraft registration that have flown over by airport icao
4826
+	 *
4827
+	 * @return Array the aircraft list
4828
+	 *
4829
+	 */
4830 4830
 	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
4831 4831
 	{
4832 4832
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4863,11 +4863,11 @@  discard block
 block discarded – undo
4863 4863
 	
4864 4864
 	
4865 4865
 	/**
4866
-	* Gets all aircraft manufacturer that have flown over by airport icao
4867
-	*
4868
-	* @return Array the aircraft list
4869
-	*
4870
-	*/
4866
+	 * Gets all aircraft manufacturer that have flown over by airport icao
4867
+	 *
4868
+	 * @return Array the aircraft list
4869
+	 *
4870
+	 */
4871 4871
 	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
4872 4872
 	{
4873 4873
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4893,11 +4893,11 @@  discard block
 block discarded – undo
4893 4893
 	}
4894 4894
 
4895 4895
 	/**
4896
-	* Gets all aircraft types that have flown over by aircraft manufacturer
4897
-	*
4898
-	* @return Array the aircraft list
4899
-	*
4900
-	*/
4896
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
4897
+	 *
4898
+	 * @return Array the aircraft list
4899
+	 *
4900
+	 */
4901 4901
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
4902 4902
 	{
4903 4903
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4924,11 +4924,11 @@  discard block
 block discarded – undo
4924 4924
 
4925 4925
 
4926 4926
 	/**
4927
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
4928
-	*
4929
-	* @return Array the aircraft list
4930
-	*
4931
-	*/
4927
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
4928
+	 *
4929
+	 * @return Array the aircraft list
4930
+	 *
4931
+	 */
4932 4932
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
4933 4933
 	{
4934 4934
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4964,11 +4964,11 @@  discard block
 block discarded – undo
4964 4964
 	}
4965 4965
 
4966 4966
 	/**
4967
-	* Gets all aircraft types that have flown over by date
4968
-	*
4969
-	* @return Array the aircraft list
4970
-	*
4971
-	*/
4967
+	 * Gets all aircraft types that have flown over by date
4968
+	 *
4969
+	 * @return Array the aircraft list
4970
+	 *
4971
+	 */
4972 4972
 	public function countAllAircraftTypesByDate($date,$filters = array())
4973 4973
 	{
4974 4974
 		global $globalTimezone, $globalDBdriver;
@@ -5010,11 +5010,11 @@  discard block
 block discarded – undo
5010 5010
 
5011 5011
 
5012 5012
 	/**
5013
-	* Gets all aircraft registration that have flown over by date
5014
-	*
5015
-	* @return Array the aircraft list
5016
-	*
5017
-	*/
5013
+	 * Gets all aircraft registration that have flown over by date
5014
+	 *
5015
+	 * @return Array the aircraft list
5016
+	 *
5017
+	 */
5018 5018
 	public function countAllAircraftRegistrationByDate($date,$filters = array())
5019 5019
 	{
5020 5020
 		global $globalTimezone, $globalDBdriver;
@@ -5065,11 +5065,11 @@  discard block
 block discarded – undo
5065 5065
 
5066 5066
 
5067 5067
 	/**
5068
-	* Gets all aircraft manufacturer that have flown over by date
5069
-	*
5070
-	* @return Array the aircraft manufacturer list
5071
-	*
5072
-	*/
5068
+	 * Gets all aircraft manufacturer that have flown over by date
5069
+	 *
5070
+	 * @return Array the aircraft manufacturer list
5071
+	 *
5072
+	 */
5073 5073
 	public function countAllAircraftManufacturerByDate($date,$filters = array())
5074 5074
 	{
5075 5075
 		global $globalTimezone, $globalDBdriver;
@@ -5111,11 +5111,11 @@  discard block
 block discarded – undo
5111 5111
 
5112 5112
 
5113 5113
 	/**
5114
-	* Gets all aircraft types that have flown over by ident/callsign
5115
-	*
5116
-	* @return Array the aircraft list
5117
-	*
5118
-	*/
5114
+	 * Gets all aircraft types that have flown over by ident/callsign
5115
+	 *
5116
+	 * @return Array the aircraft list
5117
+	 *
5118
+	 */
5119 5119
 	public function countAllAircraftTypesByIdent($ident,$filters = array())
5120 5120
 	{
5121 5121
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5144,11 +5144,11 @@  discard block
 block discarded – undo
5144 5144
 
5145 5145
 
5146 5146
 	/**
5147
-	* Gets all aircraft registration that have flown over by ident/callsign
5148
-	*
5149
-	* @return Array the aircraft list
5150
-	*
5151
-	*/
5147
+	 * Gets all aircraft registration that have flown over by ident/callsign
5148
+	 *
5149
+	 * @return Array the aircraft list
5150
+	 *
5151
+	 */
5152 5152
 	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5153 5153
 	{
5154 5154
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5188,11 +5188,11 @@  discard block
 block discarded – undo
5188 5188
 
5189 5189
 
5190 5190
 	/**
5191
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
5192
-	*
5193
-	* @return Array the aircraft manufacturer list
5194
-	*
5195
-	*/
5191
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
5192
+	 *
5193
+	 * @return Array the aircraft manufacturer list
5194
+	 *
5195
+	 */
5196 5196
 	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5197 5197
 	{
5198 5198
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5218,11 +5218,11 @@  discard block
 block discarded – undo
5218 5218
 
5219 5219
 
5220 5220
 	/**
5221
-	* Gets all aircraft types that have flown over by route
5222
-	*
5223
-	* @return Array the aircraft list
5224
-	*
5225
-	*/
5221
+	 * Gets all aircraft types that have flown over by route
5222
+	 *
5223
+	 * @return Array the aircraft list
5224
+	 *
5225
+	 */
5226 5226
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5227 5227
 	{
5228 5228
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5251,11 +5251,11 @@  discard block
 block discarded – undo
5251 5251
 	}
5252 5252
 
5253 5253
 	/**
5254
-	* Gets all aircraft registration that have flown over by route
5255
-	*
5256
-	* @return Array the aircraft list
5257
-	*
5258
-	*/
5254
+	 * Gets all aircraft registration that have flown over by route
5255
+	 *
5256
+	 * @return Array the aircraft list
5257
+	 *
5258
+	 */
5259 5259
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5260 5260
 	{
5261 5261
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5297,11 +5297,11 @@  discard block
 block discarded – undo
5297 5297
 	
5298 5298
 	
5299 5299
 	/**
5300
-	* Gets all aircraft manufacturer that have flown over by route
5301
-	*
5302
-	* @return Array the aircraft manufacturer list
5303
-	*
5304
-	*/
5300
+	 * Gets all aircraft manufacturer that have flown over by route
5301
+	 *
5302
+	 * @return Array the aircraft manufacturer list
5303
+	 *
5304
+	 */
5305 5305
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5306 5306
 	{
5307 5307
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5335,11 +5335,11 @@  discard block
 block discarded – undo
5335 5335
 	
5336 5336
 	
5337 5337
 	/**
5338
-	* Gets all aircraft types that have flown over by country
5339
-	*
5340
-	* @return Array the aircraft list
5341
-	*
5342
-	*/
5338
+	 * Gets all aircraft types that have flown over by country
5339
+	 *
5340
+	 * @return Array the aircraft list
5341
+	 *
5342
+	 */
5343 5343
 	public function countAllAircraftTypesByCountry($country,$filters = array())
5344 5344
 	{
5345 5345
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5370,11 +5370,11 @@  discard block
 block discarded – undo
5370 5370
 
5371 5371
 
5372 5372
 	/**
5373
-	* Gets all aircraft registration that have flown over by country
5374
-	*
5375
-	* @return Array the aircraft list
5376
-	*
5377
-	*/
5373
+	 * Gets all aircraft registration that have flown over by country
5374
+	 *
5375
+	 * @return Array the aircraft list
5376
+	 *
5377
+	 */
5378 5378
 	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5379 5379
 	{
5380 5380
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5414,11 +5414,11 @@  discard block
 block discarded – undo
5414 5414
 	
5415 5415
 	
5416 5416
 	/**
5417
-	* Gets all aircraft manufacturer that have flown over by country
5418
-	*
5419
-	* @return Array the aircraft manufacturer list
5420
-	*
5421
-	*/
5417
+	 * Gets all aircraft manufacturer that have flown over by country
5418
+	 *
5419
+	 * @return Array the aircraft manufacturer list
5420
+	 *
5421
+	 */
5422 5422
 	public function countAllAircraftManufacturerByCountry($country,$filters = array())
5423 5423
 	{
5424 5424
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5449,17 +5449,17 @@  discard block
 block discarded – undo
5449 5449
 	
5450 5450
 	
5451 5451
 	/**
5452
-	* Gets all aircraft manufacturers that have flown over
5453
-	*
5454
-	* @return Array the aircraft list
5455
-	*
5456
-	*/
5452
+	 * Gets all aircraft manufacturers that have flown over
5453
+	 *
5454
+	 * @return Array the aircraft list
5455
+	 *
5456
+	 */
5457 5457
 	public function countAllAircraftManufacturers($filters = array())
5458 5458
 	{
5459 5459
 		$filter_query = $this->getFilter($filters,true,true);
5460 5460
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5461 5461
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5462
-                $query .= " GROUP BY spotter_output.aircraft_manufacturer
5462
+				$query .= " GROUP BY spotter_output.aircraft_manufacturer
5463 5463
 					ORDER BY aircraft_manufacturer_count DESC
5464 5464
 					LIMIT 10";
5465 5465
       
@@ -5484,11 +5484,11 @@  discard block
 block discarded – undo
5484 5484
 	
5485 5485
 	
5486 5486
 	/**
5487
-	* Gets all aircraft registrations that have flown over
5488
-	*
5489
-	* @return Array the aircraft list
5490
-	*
5491
-	*/
5487
+	 * Gets all aircraft registrations that have flown over
5488
+	 *
5489
+	 * @return Array the aircraft list
5490
+	 *
5491
+	 */
5492 5492
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5493 5493
 	{
5494 5494
 		global $globalDBdriver;
@@ -5496,15 +5496,15 @@  discard block
 block discarded – undo
5496 5496
 		$filter_query = $this->getFilter($filters,true,true);
5497 5497
 		$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    
5498 5498
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5499
-                if ($olderthanmonths > 0) {
5500
-            		if ($globalDBdriver == 'mysql') {
5499
+				if ($olderthanmonths > 0) {
5500
+					if ($globalDBdriver == 'mysql') {
5501 5501
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5502 5502
 			} else {
5503 5503
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5504 5504
 			}
5505 5505
 		}
5506
-                if ($sincedate != '') {
5507
-            		if ($globalDBdriver == 'mysql') {
5506
+				if ($sincedate != '') {
5507
+					if ($globalDBdriver == 'mysql') {
5508 5508
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5509 5509
 			} else {
5510 5510
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5513,7 +5513,7 @@  discard block
 block discarded – undo
5513 5513
 
5514 5514
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5515 5515
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5516
-                $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5516
+				$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5517 5517
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5518 5518
 		
5519 5519
 		$sth = $this->db->prepare($query);
@@ -5544,11 +5544,11 @@  discard block
 block discarded – undo
5544 5544
 
5545 5545
 
5546 5546
 	/**
5547
-	* Gets all aircraft registrations that have flown over
5548
-	*
5549
-	* @return Array the aircraft list
5550
-	*
5551
-	*/
5547
+	 * Gets all aircraft registrations that have flown over
5548
+	 *
5549
+	 * @return Array the aircraft list
5550
+	 *
5551
+	 */
5552 5552
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5553 5553
 	{
5554 5554
 		global $globalDBdriver;
@@ -5556,15 +5556,15 @@  discard block
 block discarded – undo
5556 5556
 		$Image = new Image($this->db);
5557 5557
 		$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    
5558 5558
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5559
-                if ($olderthanmonths > 0) {
5560
-            		if ($globalDBdriver == 'mysql') {
5559
+				if ($olderthanmonths > 0) {
5560
+					if ($globalDBdriver == 'mysql') {
5561 5561
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5562 5562
 			} else {
5563 5563
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5564 5564
 			}
5565 5565
 		}
5566
-                if ($sincedate != '') {
5567
-            		if ($globalDBdriver == 'mysql') {
5566
+				if ($sincedate != '') {
5567
+					if ($globalDBdriver == 'mysql') {
5568 5568
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5569 5569
 			} else {
5570 5570
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5573,7 +5573,7 @@  discard block
 block discarded – undo
5573 5573
 
5574 5574
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5575 5575
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5576
-                $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";
5576
+				$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";
5577 5577
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5578 5578
 		
5579 5579
 		$sth = $this->db->prepare($query);
@@ -5605,35 +5605,35 @@  discard block
 block discarded – undo
5605 5605
 	
5606 5606
 	
5607 5607
 	/**
5608
-	* Gets all departure airports of the airplanes that have flown over
5609
-	*
5610
-	* @return Array the airport list
5611
-	*
5612
-	*/
5608
+	 * Gets all departure airports of the airplanes that have flown over
5609
+	 *
5610
+	 * @return Array the airport list
5611
+	 *
5612
+	 */
5613 5613
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5614 5614
 	{
5615 5615
 		global $globalDBdriver;
5616 5616
 		$filter_query = $this->getFilter($filters,true,true);
5617 5617
 		$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 
5618 5618
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
5619
-                if ($olderthanmonths > 0) {
5620
-            		if ($globalDBdriver == 'mysql') {
5619
+				if ($olderthanmonths > 0) {
5620
+					if ($globalDBdriver == 'mysql') {
5621 5621
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5622 5622
 			} else {
5623 5623
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5624 5624
 			}
5625
-                }
5626
-                if ($sincedate != '') {
5627
-            		if ($globalDBdriver == 'mysql') {
5625
+				}
5626
+				if ($sincedate != '') {
5627
+					if ($globalDBdriver == 'mysql') {
5628 5628
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5629 5629
 			} else {
5630 5630
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5631 5631
 			}
5632 5632
 		}
5633 5633
 
5634
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5635
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5636
-                $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5634
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5635
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5636
+				$query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5637 5637
 				ORDER BY airport_departure_icao_count DESC";
5638 5638
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5639 5639
       
@@ -5657,35 +5657,35 @@  discard block
 block discarded – undo
5657 5657
 	}
5658 5658
 
5659 5659
 	/**
5660
-	* Gets all departure airports of the airplanes that have flown over
5661
-	*
5662
-	* @return Array the airport list
5663
-	*
5664
-	*/
5660
+	 * Gets all departure airports of the airplanes that have flown over
5661
+	 *
5662
+	 * @return Array the airport list
5663
+	 *
5664
+	 */
5665 5665
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5666 5666
 	{
5667 5667
 		global $globalDBdriver;
5668 5668
 		$filter_query = $this->getFilter($filters,true,true);
5669 5669
 		$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 
5670 5670
 			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 <> '' ";
5671
-                if ($olderthanmonths > 0) {
5672
-            		if ($globalDBdriver == 'mysql') {
5671
+				if ($olderthanmonths > 0) {
5672
+					if ($globalDBdriver == 'mysql') {
5673 5673
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5674 5674
 			} else {
5675 5675
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5676 5676
 			}
5677
-                }
5678
-                if ($sincedate != '') {
5679
-            		if ($globalDBdriver == 'mysql') {
5677
+				}
5678
+				if ($sincedate != '') {
5679
+					if ($globalDBdriver == 'mysql') {
5680 5680
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5681 5681
 			} else {
5682 5682
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5683 5683
 			}
5684 5684
 		}
5685 5685
 
5686
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5687
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5688
-                $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
5686
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5687
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5688
+				$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
5689 5689
 				ORDER BY airport_departure_icao_count DESC";
5690 5690
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5691 5691
       
@@ -5710,37 +5710,37 @@  discard block
 block discarded – undo
5710 5710
 	}
5711 5711
 
5712 5712
 	/**
5713
-	* Gets all detected departure airports of the airplanes that have flown over
5714
-	*
5715
-	* @return Array the airport list
5716
-	*
5717
-	*/
5713
+	 * Gets all detected departure airports of the airplanes that have flown over
5714
+	 *
5715
+	 * @return Array the airport list
5716
+	 *
5717
+	 */
5718 5718
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5719 5719
 	{
5720 5720
 		global $globalDBdriver;
5721 5721
 		$filter_query = $this->getFilter($filters,true,true);
5722 5722
 		$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
5723 5723
 				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";
5724
-                if ($olderthanmonths > 0) {
5725
-            		if ($globalDBdriver == 'mysql') {
5724
+				if ($olderthanmonths > 0) {
5725
+					if ($globalDBdriver == 'mysql') {
5726 5726
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5727 5727
 			} else {
5728 5728
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5729 5729
 			}
5730
-                }
5731
-                if ($sincedate != '') {
5732
-            		if ($globalDBdriver == 'mysql') {
5730
+				}
5731
+				if ($sincedate != '') {
5732
+					if ($globalDBdriver == 'mysql') {
5733 5733
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5734 5734
 			} else {
5735 5735
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5736 5736
 			}
5737 5737
 		}
5738
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5739
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5740
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5738
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5739
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5740
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5741 5741
 				ORDER BY airport_departure_icao_count DESC";
5742 5742
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5743
-    		//echo $query;
5743
+			//echo $query;
5744 5744
 		$sth = $this->db->prepare($query);
5745 5745
 		$sth->execute();
5746 5746
       
@@ -5761,35 +5761,35 @@  discard block
 block discarded – undo
5761 5761
 	}
5762 5762
 	
5763 5763
 	/**
5764
-	* Gets all detected departure airports of the airplanes that have flown over
5765
-	*
5766
-	* @return Array the airport list
5767
-	*
5768
-	*/
5764
+	 * Gets all detected departure airports of the airplanes that have flown over
5765
+	 *
5766
+	 * @return Array the airport list
5767
+	 *
5768
+	 */
5769 5769
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5770 5770
 	{
5771 5771
 		global $globalDBdriver;
5772 5772
 		$filter_query = $this->getFilter($filters,true,true);
5773 5773
 		$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
5774 5774
 				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 ";
5775
-                if ($olderthanmonths > 0) {
5776
-            		if ($globalDBdriver == 'mysql') {
5775
+				if ($olderthanmonths > 0) {
5776
+					if ($globalDBdriver == 'mysql') {
5777 5777
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5778 5778
 			} else {
5779 5779
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5780 5780
 			}
5781
-                }
5782
-                if ($sincedate != '') {
5783
-            		if ($globalDBdriver == 'mysql') {
5781
+				}
5782
+				if ($sincedate != '') {
5783
+					if ($globalDBdriver == 'mysql') {
5784 5784
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5785 5785
 			} else {
5786 5786
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
5787 5787
 			}
5788 5788
 		}
5789 5789
 
5790
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5791
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5792
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5790
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5791
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5792
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5793 5793
 				ORDER BY airport_departure_icao_count DESC";
5794 5794
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5795 5795
       
@@ -5814,11 +5814,11 @@  discard block
 block discarded – undo
5814 5814
 	}	
5815 5815
 	
5816 5816
 	/**
5817
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
5818
-	*
5819
-	* @return Array the airport list
5820
-	*
5821
-	*/
5817
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
5818
+	 *
5819
+	 * @return Array the airport list
5820
+	 *
5821
+	 */
5822 5822
 	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
5823 5823
 	{
5824 5824
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5852,11 +5852,11 @@  discard block
 block discarded – undo
5852 5852
 	
5853 5853
 	
5854 5854
 	/**
5855
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5856
-	*
5857
-	* @return Array the airport list
5858
-	*
5859
-	*/
5855
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5856
+	 *
5857
+	 * @return Array the airport list
5858
+	 *
5859
+	 */
5860 5860
 	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
5861 5861
 	{
5862 5862
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5887,11 +5887,11 @@  discard block
 block discarded – undo
5887 5887
 	
5888 5888
 	
5889 5889
 	/**
5890
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5891
-	*
5892
-	* @return Array the airport list
5893
-	*
5894
-	*/
5890
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5891
+	 *
5892
+	 * @return Array the airport list
5893
+	 *
5894
+	 */
5895 5895
 	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
5896 5896
 	{
5897 5897
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5924,11 +5924,11 @@  discard block
 block discarded – undo
5924 5924
 	
5925 5925
 	
5926 5926
 	/**
5927
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5928
-	*
5929
-	* @return Array the airport list
5930
-	*
5931
-	*/
5927
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5928
+	 *
5929
+	 * @return Array the airport list
5930
+	 *
5931
+	 */
5932 5932
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
5933 5933
 	{
5934 5934
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5958,11 +5958,11 @@  discard block
 block discarded – undo
5958 5958
 	
5959 5959
 	
5960 5960
 	/**
5961
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5962
-	*
5963
-	* @return Array the airport list
5964
-	*
5965
-	*/
5961
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5962
+	 *
5963
+	 * @return Array the airport list
5964
+	 *
5965
+	 */
5966 5966
 	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
5967 5967
 	{
5968 5968
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5995,11 +5995,11 @@  discard block
 block discarded – undo
5995 5995
 	
5996 5996
 	
5997 5997
 	/**
5998
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
5999
-	*
6000
-	* @return Array the airport list
6001
-	*
6002
-	*/
5998
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
5999
+	 *
6000
+	 * @return Array the airport list
6001
+	 *
6002
+	 */
6003 6003
 	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
6004 6004
 	{
6005 6005
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6029,11 +6029,11 @@  discard block
 block discarded – undo
6029 6029
 	
6030 6030
 	
6031 6031
 	/**
6032
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
6033
-	*
6034
-	* @return Array the airport list
6035
-	*
6036
-	*/
6032
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
6033
+	 *
6034
+	 * @return Array the airport list
6035
+	 *
6036
+	 */
6037 6037
 	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
6038 6038
 	{
6039 6039
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6066,11 +6066,11 @@  discard block
 block discarded – undo
6066 6066
 	
6067 6067
 	
6068 6068
 	/**
6069
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
6070
-	*
6071
-	* @return Array the airport list
6072
-	*
6073
-	*/
6069
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
6070
+	 *
6071
+	 * @return Array the airport list
6072
+	 *
6073
+	 */
6074 6074
 	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
6075 6075
 	{
6076 6076
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6101,11 +6101,11 @@  discard block
 block discarded – undo
6101 6101
 	
6102 6102
 	
6103 6103
 	/**
6104
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
6105
-	*
6106
-	* @return Array the airport list
6107
-	*
6108
-	*/
6104
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
6105
+	 *
6106
+	 * @return Array the airport list
6107
+	 *
6108
+	 */
6109 6109
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6110 6110
 	{
6111 6111
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6138,11 +6138,11 @@  discard block
 block discarded – undo
6138 6138
 	
6139 6139
 	
6140 6140
 	/**
6141
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
6142
-	*
6143
-	* @return Array the airport list
6144
-	*
6145
-	*/
6141
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
6142
+	 *
6143
+	 * @return Array the airport list
6144
+	 *
6145
+	 */
6146 6146
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6147 6147
 	{
6148 6148
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6172,11 +6172,11 @@  discard block
 block discarded – undo
6172 6172
 	
6173 6173
 	
6174 6174
 	/**
6175
-	* Gets all departure airports of the airplanes that have flown over based on a date
6176
-	*
6177
-	* @return Array the airport list
6178
-	*
6179
-	*/
6175
+	 * Gets all departure airports of the airplanes that have flown over based on a date
6176
+	 *
6177
+	 * @return Array the airport list
6178
+	 *
6179
+	 */
6180 6180
 	public function countAllDepartureAirportsByDate($date,$filters = array())
6181 6181
 	{
6182 6182
 		global $globalTimezone, $globalDBdriver;
@@ -6222,11 +6222,11 @@  discard block
 block discarded – undo
6222 6222
 	
6223 6223
 	
6224 6224
 	/**
6225
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
6226
-	*
6227
-	* @return Array the airport list
6228
-	*
6229
-	*/
6225
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
6226
+	 *
6227
+	 * @return Array the airport list
6228
+	 *
6229
+	 */
6230 6230
 	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6231 6231
 	{
6232 6232
 		global $globalTimezone, $globalDBdriver;
@@ -6269,11 +6269,11 @@  discard block
 block discarded – undo
6269 6269
 	
6270 6270
 	
6271 6271
 	/**
6272
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6273
-	*
6274
-	* @return Array the airport list
6275
-	*
6276
-	*/
6272
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6273
+	 *
6274
+	 * @return Array the airport list
6275
+	 *
6276
+	 */
6277 6277
 	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6278 6278
 	{
6279 6279
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6307,11 +6307,11 @@  discard block
 block discarded – undo
6307 6307
 	
6308 6308
 	
6309 6309
 	/**
6310
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6311
-	*
6312
-	* @return Array the airport list
6313
-	*
6314
-	*/
6310
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6311
+	 *
6312
+	 * @return Array the airport list
6313
+	 *
6314
+	 */
6315 6315
 	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
6316 6316
 	{
6317 6317
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6342,11 +6342,11 @@  discard block
 block discarded – undo
6342 6342
 	
6343 6343
 	
6344 6344
 	/**
6345
-	* Gets all departure airports of the airplanes that have flown over based on a country
6346
-	*
6347
-	* @return Array the airport list
6348
-	*
6349
-	*/
6345
+	 * Gets all departure airports of the airplanes that have flown over based on a country
6346
+	 *
6347
+	 * @return Array the airport list
6348
+	 *
6349
+	 */
6350 6350
 	public function countAllDepartureAirportsByCountry($country,$filters = array())
6351 6351
 	{
6352 6352
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6380,11 +6380,11 @@  discard block
 block discarded – undo
6380 6380
 
6381 6381
 
6382 6382
 	/**
6383
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6384
-	*
6385
-	* @return Array the airport list
6386
-	*
6387
-	*/
6383
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6384
+	 *
6385
+	 * @return Array the airport list
6386
+	 *
6387
+	 */
6388 6388
 	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
6389 6389
 	{
6390 6390
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6414,40 +6414,40 @@  discard block
 block discarded – undo
6414 6414
 	
6415 6415
 
6416 6416
 	/**
6417
-	* Gets all arrival airports of the airplanes that have flown over
6418
-	*
6419
-	* @param Boolean $limit Limit result to 10 or not
6420
-	* @param Integer $olderthanmonths Only show result older than x months
6421
-	* @param String $sincedate Only show result since x date
6422
-	* @param Boolean $icaoaskey Show result by ICAO
6423
-	* @param Array $filters Filter used here
6424
-	* @return Array the airport list
6425
-	*
6426
-	*/
6417
+	 * Gets all arrival airports of the airplanes that have flown over
6418
+	 *
6419
+	 * @param Boolean $limit Limit result to 10 or not
6420
+	 * @param Integer $olderthanmonths Only show result older than x months
6421
+	 * @param String $sincedate Only show result since x date
6422
+	 * @param Boolean $icaoaskey Show result by ICAO
6423
+	 * @param Array $filters Filter used here
6424
+	 * @return Array the airport list
6425
+	 *
6426
+	 */
6427 6427
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6428 6428
 	{
6429 6429
 		global $globalDBdriver;
6430 6430
 		$filter_query = $this->getFilter($filters,true,true);
6431 6431
 		$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 
6432 6432
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
6433
-                if ($olderthanmonths > 0) {
6434
-            		if ($globalDBdriver == 'mysql') {
6433
+				if ($olderthanmonths > 0) {
6434
+					if ($globalDBdriver == 'mysql') {
6435 6435
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6436 6436
 			} else {
6437 6437
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6438 6438
 			}
6439 6439
 		}
6440
-                if ($sincedate != '') {
6441
-            		if ($globalDBdriver == 'mysql') {
6440
+				if ($sincedate != '') {
6441
+					if ($globalDBdriver == 'mysql') {
6442 6442
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6443 6443
 			} else {
6444 6444
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6445 6445
 			}
6446 6446
 		}
6447 6447
 
6448
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6449
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6450
-                $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6448
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6449
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6450
+				$query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6451 6451
 					ORDER BY airport_arrival_icao_count DESC";
6452 6452
 		if ($limit) $query .= " LIMIT 10";
6453 6453
       
@@ -6476,35 +6476,35 @@  discard block
 block discarded – undo
6476 6476
 	}
6477 6477
 
6478 6478
 	/**
6479
-	* Gets all arrival airports of the airplanes that have flown over
6480
-	*
6481
-	* @return Array the airport list
6482
-	*
6483
-	*/
6479
+	 * Gets all arrival airports of the airplanes that have flown over
6480
+	 *
6481
+	 * @return Array the airport list
6482
+	 *
6483
+	 */
6484 6484
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6485 6485
 	{
6486 6486
 		global $globalDBdriver;
6487 6487
 		$filter_query = $this->getFilter($filters,true,true);
6488 6488
 		$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 
6489 6489
 			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 <> '' ";
6490
-                if ($olderthanmonths > 0) {
6491
-            		if ($globalDBdriver == 'mysql') {
6490
+				if ($olderthanmonths > 0) {
6491
+					if ($globalDBdriver == 'mysql') {
6492 6492
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6493 6493
 			} else {
6494 6494
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6495 6495
 			}
6496 6496
 		}
6497
-                if ($sincedate != '') {
6498
-            		if ($globalDBdriver == 'mysql') {
6497
+				if ($sincedate != '') {
6498
+					if ($globalDBdriver == 'mysql') {
6499 6499
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6500 6500
 			} else {
6501 6501
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6502 6502
 			}
6503 6503
 		}
6504 6504
 
6505
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6506
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6507
-                $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
6505
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6506
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6507
+				$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
6508 6508
 					ORDER BY airport_arrival_icao_count DESC";
6509 6509
 		if ($limit) $query .= " LIMIT 10";
6510 6510
       
@@ -6535,34 +6535,34 @@  discard block
 block discarded – undo
6535 6535
 
6536 6536
 
6537 6537
 	/**
6538
-	* Gets all detected arrival airports of the airplanes that have flown over
6539
-	*
6540
-	* @return Array the airport list
6541
-	*
6542
-	*/
6538
+	 * Gets all detected arrival airports of the airplanes that have flown over
6539
+	 *
6540
+	 * @return Array the airport list
6541
+	 *
6542
+	 */
6543 6543
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6544 6544
 	{
6545 6545
 		global $globalDBdriver;
6546 6546
 		$filter_query = $this->getFilter($filters,true,true);
6547 6547
 		$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 
6548 6548
 			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";
6549
-                if ($olderthanmonths > 0) {
6550
-            		if ($globalDBdriver == 'mysql') {
6549
+				if ($olderthanmonths > 0) {
6550
+					if ($globalDBdriver == 'mysql') {
6551 6551
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6552 6552
 			} else {
6553 6553
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6554 6554
 			}
6555 6555
 		}
6556
-                if ($sincedate != '') {
6557
-            		if ($globalDBdriver == 'mysql') {
6556
+				if ($sincedate != '') {
6557
+					if ($globalDBdriver == 'mysql') {
6558 6558
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6559 6559
 			} else {
6560 6560
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6561 6561
 			}
6562 6562
 		}
6563
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6564
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6565
-                $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6563
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6564
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6565
+				$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6566 6566
 					ORDER BY airport_arrival_icao_count DESC";
6567 6567
 		if ($limit) $query .= " LIMIT 10";
6568 6568
       
@@ -6591,35 +6591,35 @@  discard block
 block discarded – undo
6591 6591
 	}
6592 6592
 	
6593 6593
 	/**
6594
-	* Gets all detected arrival airports of the airplanes that have flown over
6595
-	*
6596
-	* @return Array the airport list
6597
-	*
6598
-	*/
6594
+	 * Gets all detected arrival airports of the airplanes that have flown over
6595
+	 *
6596
+	 * @return Array the airport list
6597
+	 *
6598
+	 */
6599 6599
 	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6600 6600
 	{
6601 6601
 		global $globalDBdriver;
6602 6602
 		$filter_query = $this->getFilter($filters,true,true);
6603 6603
 		$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 
6604 6604
 			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 ";
6605
-                if ($olderthanmonths > 0) {
6606
-            		if ($globalDBdriver == 'mysql') {
6605
+				if ($olderthanmonths > 0) {
6606
+					if ($globalDBdriver == 'mysql') {
6607 6607
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6608 6608
 			} else {
6609 6609
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6610 6610
 			}
6611 6611
 		}
6612
-                if ($sincedate != '') {
6613
-            		if ($globalDBdriver == 'mysql') {
6612
+				if ($sincedate != '') {
6613
+					if ($globalDBdriver == 'mysql') {
6614 6614
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6615 6615
 			} else {
6616 6616
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6617 6617
 			}
6618 6618
 		}
6619 6619
 
6620
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6621
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6622
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6620
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6621
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6622
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6623 6623
 					ORDER BY airport_arrival_icao_count DESC";
6624 6624
 		if ($limit) $query .= " LIMIT 10";
6625 6625
       
@@ -6649,11 +6649,11 @@  discard block
 block discarded – undo
6649 6649
 	}	
6650 6650
 	
6651 6651
 	/**
6652
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
6653
-	*
6654
-	* @return Array the airport list
6655
-	*
6656
-	*/
6652
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
6653
+	 *
6654
+	 * @return Array the airport list
6655
+	 *
6656
+	 */
6657 6657
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
6658 6658
 	{
6659 6659
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6685,11 +6685,11 @@  discard block
 block discarded – undo
6685 6685
 	
6686 6686
 	
6687 6687
 	/**
6688
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6689
-	*
6690
-	* @return Array the airport list
6691
-	*
6692
-	*/
6688
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6689
+	 *
6690
+	 * @return Array the airport list
6691
+	 *
6692
+	 */
6693 6693
 	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
6694 6694
 	{
6695 6695
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6720,11 +6720,11 @@  discard block
 block discarded – undo
6720 6720
 	
6721 6721
 	
6722 6722
 	/**
6723
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6724
-	*
6725
-	* @return Array the airport list
6726
-	*
6727
-	*/
6723
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6724
+	 *
6725
+	 * @return Array the airport list
6726
+	 *
6727
+	 */
6728 6728
 	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
6729 6729
 	{
6730 6730
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6758,11 +6758,11 @@  discard block
 block discarded – undo
6758 6758
 	
6759 6759
 	
6760 6760
 	/**
6761
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6762
-	*
6763
-	* @return Array the airport list
6764
-	*
6765
-	*/
6761
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6762
+	 *
6763
+	 * @return Array the airport list
6764
+	 *
6765
+	 */
6766 6766
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
6767 6767
 	{
6768 6768
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6792,11 +6792,11 @@  discard block
 block discarded – undo
6792 6792
 	
6793 6793
 	
6794 6794
 	/**
6795
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6796
-	*
6797
-	* @return Array the airport list
6798
-	*
6799
-	*/
6795
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6796
+	 *
6797
+	 * @return Array the airport list
6798
+	 *
6799
+	 */
6800 6800
 	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
6801 6801
 	{
6802 6802
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6830,11 +6830,11 @@  discard block
 block discarded – undo
6830 6830
 	
6831 6831
 	
6832 6832
 	/**
6833
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6834
-	*
6835
-	* @return Array the airport list
6836
-	*
6837
-	*/
6833
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6834
+	 *
6835
+	 * @return Array the airport list
6836
+	 *
6837
+	 */
6838 6838
 	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
6839 6839
 	{
6840 6840
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6865,11 +6865,11 @@  discard block
 block discarded – undo
6865 6865
 	
6866 6866
 	
6867 6867
 	/**
6868
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
6869
-	*
6870
-	* @return Array the airport list
6871
-	*
6872
-	*/
6868
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
6869
+	 *
6870
+	 * @return Array the airport list
6871
+	 *
6872
+	 */
6873 6873
 	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
6874 6874
 	{
6875 6875
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6902,11 +6902,11 @@  discard block
 block discarded – undo
6902 6902
 	
6903 6903
 	
6904 6904
 	/**
6905
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6906
-	*
6907
-	* @return Array the airport list
6908
-	*
6909
-	*/
6905
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6906
+	 *
6907
+	 * @return Array the airport list
6908
+	 *
6909
+	 */
6910 6910
 	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
6911 6911
 	{
6912 6912
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6936,11 +6936,11 @@  discard block
 block discarded – undo
6936 6936
 	
6937 6937
 	
6938 6938
 	/**
6939
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6940
-	*
6941
-	* @return Array the airport list
6942
-	*
6943
-	*/
6939
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6940
+	 *
6941
+	 * @return Array the airport list
6942
+	 *
6943
+	 */
6944 6944
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6945 6945
 	{
6946 6946
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6974,11 +6974,11 @@  discard block
 block discarded – undo
6974 6974
 	
6975 6975
 	
6976 6976
 	/**
6977
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
6978
-	*
6979
-	* @return Array the airport list
6980
-	*
6981
-	*/
6977
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
6978
+	 *
6979
+	 * @return Array the airport list
6980
+	 *
6981
+	 */
6982 6982
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6983 6983
 	{
6984 6984
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7009,11 +7009,11 @@  discard block
 block discarded – undo
7009 7009
 	
7010 7010
 	
7011 7011
 	/**
7012
-	* Gets all arrival airports of the airplanes that have flown over based on a date
7013
-	*
7014
-	* @return Array the airport list
7015
-	*
7016
-	*/
7012
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
7013
+	 *
7014
+	 * @return Array the airport list
7015
+	 *
7016
+	 */
7017 7017
 	public function countAllArrivalAirportsByDate($date,$filters = array())
7018 7018
 	{
7019 7019
 		global $globalTimezone, $globalDBdriver;
@@ -7059,11 +7059,11 @@  discard block
 block discarded – undo
7059 7059
 	
7060 7060
 	
7061 7061
 	/**
7062
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
7063
-	*
7064
-	* @return Array the airport list
7065
-	*
7066
-	*/
7062
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
7063
+	 *
7064
+	 * @return Array the airport list
7065
+	 *
7066
+	 */
7067 7067
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
7068 7068
 	{
7069 7069
 		global $globalTimezone, $globalDBdriver;
@@ -7106,11 +7106,11 @@  discard block
 block discarded – undo
7106 7106
 	
7107 7107
 	
7108 7108
 	/**
7109
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
7110
-	*
7111
-	* @return Array the airport list
7112
-	*
7113
-	*/
7109
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
7110
+	 *
7111
+	 * @return Array the airport list
7112
+	 *
7113
+	 */
7114 7114
 	public function countAllArrivalAirportsByIdent($ident,$filters = array())
7115 7115
 	{
7116 7116
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7143,11 +7143,11 @@  discard block
 block discarded – undo
7143 7143
 	
7144 7144
 	
7145 7145
 	/**
7146
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7147
-	*
7148
-	* @return Array the airport list
7149
-	*
7150
-	*/
7146
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7147
+	 *
7148
+	 * @return Array the airport list
7149
+	 *
7150
+	 */
7151 7151
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
7152 7152
 	{
7153 7153
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7178,11 +7178,11 @@  discard block
 block discarded – undo
7178 7178
 	
7179 7179
 	
7180 7180
 	/**
7181
-	* Gets all arrival airports of the airplanes that have flown over based on a country
7182
-	*
7183
-	* @return Array the airport list
7184
-	*
7185
-	*/
7181
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
7182
+	 *
7183
+	 * @return Array the airport list
7184
+	 *
7185
+	 */
7186 7186
 	public function countAllArrivalAirportsByCountry($country,$filters = array())
7187 7187
 	{
7188 7188
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7215,11 +7215,11 @@  discard block
 block discarded – undo
7215 7215
 	
7216 7216
 	
7217 7217
 	/**
7218
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
7219
-	*
7220
-	* @return Array the airport list
7221
-	*
7222
-	*/
7218
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
7219
+	 *
7220
+	 * @return Array the airport list
7221
+	 *
7222
+	 */
7223 7223
 	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
7224 7224
 	{
7225 7225
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7250,11 +7250,11 @@  discard block
 block discarded – undo
7250 7250
 
7251 7251
 
7252 7252
 	/**
7253
-	* Counts all airport departure countries
7254
-	*
7255
-	* @return Array the airport departure list
7256
-	*
7257
-	*/
7253
+	 * Counts all airport departure countries
7254
+	 *
7255
+	 * @return Array the airport departure list
7256
+	 *
7257
+	 */
7258 7258
 	public function countAllDepartureCountries($filters = array())
7259 7259
 	{
7260 7260
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7284,11 +7284,11 @@  discard block
 block discarded – undo
7284 7284
 	
7285 7285
 	
7286 7286
 	/**
7287
-	* Counts all airport arrival countries
7288
-	*
7289
-	* @return Array the airport arrival list
7290
-	*
7291
-	*/
7287
+	 * Counts all airport arrival countries
7288
+	 *
7289
+	 * @return Array the airport arrival list
7290
+	 *
7291
+	 */
7292 7292
 	public function countAllArrivalCountries($limit = true,$filters = array())
7293 7293
 	{
7294 7294
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7321,11 +7321,11 @@  discard block
 block discarded – undo
7321 7321
 
7322 7322
 
7323 7323
 	/**
7324
-	* Gets all route combinations
7325
-	*
7326
-	* @return Array the route list
7327
-	*
7328
-	*/
7324
+	 * Gets all route combinations
7325
+	 *
7326
+	 * @return Array the route list
7327
+	 *
7328
+	 */
7329 7329
 	public function countAllRoutes($filters = array())
7330 7330
 	{
7331 7331
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7364,11 +7364,11 @@  discard block
 block discarded – undo
7364 7364
 	
7365 7365
 	
7366 7366
 	/**
7367
-	* Gets all route combinations based on an aircraft
7368
-	*
7369
-	* @return Array the route list
7370
-	*
7371
-	*/
7367
+	 * Gets all route combinations based on an aircraft
7368
+	 *
7369
+	 * @return Array the route list
7370
+	 *
7371
+	 */
7372 7372
 	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
7373 7373
 	{
7374 7374
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7404,11 +7404,11 @@  discard block
 block discarded – undo
7404 7404
 	
7405 7405
 	
7406 7406
 	/**
7407
-	* Gets all route combinations based on an aircraft registration
7408
-	*
7409
-	* @return Array the route list
7410
-	*
7411
-	*/
7407
+	 * Gets all route combinations based on an aircraft registration
7408
+	 *
7409
+	 * @return Array the route list
7410
+	 *
7411
+	 */
7412 7412
 	public function countAllRoutesByRegistration($registration, $filters = array())
7413 7413
 	{
7414 7414
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7446,11 +7446,11 @@  discard block
 block discarded – undo
7446 7446
 	
7447 7447
 	
7448 7448
 	/**
7449
-	* Gets all route combinations based on an airline
7450
-	*
7451
-	* @return Array the route list
7452
-	*
7453
-	*/
7449
+	 * Gets all route combinations based on an airline
7450
+	 *
7451
+	 * @return Array the route list
7452
+	 *
7453
+	 */
7454 7454
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
7455 7455
 	{
7456 7456
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7488,11 +7488,11 @@  discard block
 block discarded – undo
7488 7488
 	
7489 7489
 	
7490 7490
 	/**
7491
-	* Gets all route combinations based on an airport
7492
-	*
7493
-	* @return Array the route list
7494
-	*
7495
-	*/
7491
+	 * Gets all route combinations based on an airport
7492
+	 *
7493
+	 * @return Array the route list
7494
+	 *
7495
+	 */
7496 7496
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
7497 7497
 	{
7498 7498
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7529,11 +7529,11 @@  discard block
 block discarded – undo
7529 7529
 	
7530 7530
 	
7531 7531
 	/**
7532
-	* Gets all route combinations based on an country
7533
-	*
7534
-	* @return Array the route list
7535
-	*
7536
-	*/
7532
+	 * Gets all route combinations based on an country
7533
+	 *
7534
+	 * @return Array the route list
7535
+	 *
7536
+	 */
7537 7537
 	public function countAllRoutesByCountry($country, $filters = array())
7538 7538
 	{
7539 7539
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7569,11 +7569,11 @@  discard block
 block discarded – undo
7569 7569
 
7570 7570
 
7571 7571
 	/**
7572
-	* Gets all route combinations based on an date
7573
-	*
7574
-	* @return Array the route list
7575
-	*
7576
-	*/
7572
+	 * Gets all route combinations based on an date
7573
+	 *
7574
+	 * @return Array the route list
7575
+	 *
7576
+	 */
7577 7577
 	public function countAllRoutesByDate($date, $filters = array())
7578 7578
 	{
7579 7579
 		global $globalTimezone, $globalDBdriver;
@@ -7623,11 +7623,11 @@  discard block
 block discarded – undo
7623 7623
 	
7624 7624
 	
7625 7625
 	/**
7626
-	* Gets all route combinations based on an ident/callsign
7627
-	*
7628
-	* @return Array the route list
7629
-	*
7630
-	*/
7626
+	 * Gets all route combinations based on an ident/callsign
7627
+	 *
7628
+	 * @return Array the route list
7629
+	 *
7630
+	 */
7631 7631
 	public function countAllRoutesByIdent($ident, $filters = array())
7632 7632
 	{
7633 7633
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7664,11 +7664,11 @@  discard block
 block discarded – undo
7664 7664
 	
7665 7665
 	
7666 7666
 	/**
7667
-	* Gets all route combinations based on an manufacturer
7668
-	*
7669
-	* @return Array the route list
7670
-	*
7671
-	*/
7667
+	 * Gets all route combinations based on an manufacturer
7668
+	 *
7669
+	 * @return Array the route list
7670
+	 *
7671
+	 */
7672 7672
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
7673 7673
 	{
7674 7674
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7706,11 +7706,11 @@  discard block
 block discarded – undo
7706 7706
 	
7707 7707
 	
7708 7708
 	/**
7709
-	* Gets all route combinations with waypoints
7710
-	*
7711
-	* @return Array the route list
7712
-	*
7713
-	*/
7709
+	 * Gets all route combinations with waypoints
7710
+	 *
7711
+	 * @return Array the route list
7712
+	 *
7713
+	 */
7714 7714
 	public function countAllRoutesWithWaypoints($filters = array())
7715 7715
 	{
7716 7716
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7747,11 +7747,11 @@  discard block
 block discarded – undo
7747 7747
 	}
7748 7748
 	
7749 7749
 	/**
7750
-	* Gets all callsigns that have flown over
7751
-	*
7752
-	* @return Array the callsign list
7753
-	*
7754
-	*/
7750
+	 * Gets all callsigns that have flown over
7751
+	 *
7752
+	 * @return Array the callsign list
7753
+	 *
7754
+	 */
7755 7755
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
7756 7756
 	{
7757 7757
 		global $globalDBdriver;
@@ -7789,11 +7789,11 @@  discard block
 block discarded – undo
7789 7789
 	}
7790 7790
 
7791 7791
 	/**
7792
-	* Gets all callsigns that have flown over
7793
-	*
7794
-	* @return Array the callsign list
7795
-	*
7796
-	*/
7792
+	 * Gets all callsigns that have flown over
7793
+	 *
7794
+	 * @return Array the callsign list
7795
+	 *
7796
+	 */
7797 7797
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7798 7798
 	{
7799 7799
 		global $globalDBdriver;
@@ -7834,11 +7834,11 @@  discard block
 block discarded – undo
7834 7834
 
7835 7835
 
7836 7836
 	/**
7837
-	* Counts all dates
7838
-	*
7839
-	* @return Array the date list
7840
-	*
7841
-	*/
7837
+	 * Counts all dates
7838
+	 *
7839
+	 * @return Array the date list
7840
+	 *
7841
+	 */
7842 7842
 	public function countAllDates($filters = array())
7843 7843
 	{
7844 7844
 		global $globalTimezone, $globalDBdriver;
@@ -7883,11 +7883,11 @@  discard block
 block discarded – undo
7883 7883
 	}
7884 7884
 	
7885 7885
 	/**
7886
-	* Counts all dates
7887
-	*
7888
-	* @return Array the date list
7889
-	*
7890
-	*/
7886
+	 * Counts all dates
7887
+	 *
7888
+	 * @return Array the date list
7889
+	 *
7890
+	 */
7891 7891
 	public function countAllDatesByAirlines($filters = array())
7892 7892
 	{
7893 7893
 		global $globalTimezone, $globalDBdriver;
@@ -7932,11 +7932,11 @@  discard block
 block discarded – undo
7932 7932
 	}	
7933 7933
 	
7934 7934
 	/**
7935
-	* Counts all dates during the last 7 days
7936
-	*
7937
-	* @return Array the date list
7938
-	*
7939
-	*/
7935
+	 * Counts all dates during the last 7 days
7936
+	 *
7937
+	 * @return Array the date list
7938
+	 *
7939
+	 */
7940 7940
 	public function countAllDatesLast7Days($filters = array())
7941 7941
 	{
7942 7942
 		global $globalTimezone, $globalDBdriver;
@@ -7958,7 +7958,7 @@  discard block
 block discarded – undo
7958 7958
 			$query .= " GROUP BY date_name 
7959 7959
 								ORDER BY date_name ASC";
7960 7960
 			$query_data = array(':offset' => $offset);
7961
-    		}
7961
+			}
7962 7962
 		
7963 7963
 		$sth = $this->db->prepare($query);
7964 7964
 		$sth->execute($query_data);
@@ -7978,11 +7978,11 @@  discard block
 block discarded – undo
7978 7978
 	}
7979 7979
 
7980 7980
 	/**
7981
-	* Counts all dates during the last month
7982
-	*
7983
-	* @return Array the date list
7984
-	*
7985
-	*/
7981
+	 * Counts all dates during the last month
7982
+	 *
7983
+	 * @return Array the date list
7984
+	 *
7985
+	 */
7986 7986
 	public function countAllDatesLastMonth($filters = array())
7987 7987
 	{
7988 7988
 		global $globalTimezone, $globalDBdriver;
@@ -8004,7 +8004,7 @@  discard block
 block discarded – undo
8004 8004
 			$query .= " GROUP BY date_name 
8005 8005
 								ORDER BY date_name ASC";
8006 8006
 			$query_data = array(':offset' => $offset);
8007
-    		}
8007
+			}
8008 8008
 		
8009 8009
 		$sth = $this->db->prepare($query);
8010 8010
 		$sth->execute($query_data);
@@ -8025,11 +8025,11 @@  discard block
 block discarded – undo
8025 8025
 
8026 8026
 
8027 8027
 	/**
8028
-	* Counts all dates during the last month
8029
-	*
8030
-	* @return Array the date list
8031
-	*
8032
-	*/
8028
+	 * Counts all dates during the last month
8029
+	 *
8030
+	 * @return Array the date list
8031
+	 *
8032
+	 */
8033 8033
 	public function countAllDatesLastMonthByAirlines($filters = array())
8034 8034
 	{
8035 8035
 		global $globalTimezone, $globalDBdriver;
@@ -8052,7 +8052,7 @@  discard block
 block discarded – undo
8052 8052
 								GROUP BY spotter_output.airline_icao, date_name 
8053 8053
 								ORDER BY date_name ASC";
8054 8054
 			$query_data = array(':offset' => $offset);
8055
-    		}
8055
+			}
8056 8056
 		
8057 8057
 		$sth = $this->db->prepare($query);
8058 8058
 		$sth->execute($query_data);
@@ -8074,11 +8074,11 @@  discard block
 block discarded – undo
8074 8074
 	
8075 8075
 
8076 8076
 	/**
8077
-	* Counts all month
8078
-	*
8079
-	* @return Array the month list
8080
-	*
8081
-	*/
8077
+	 * Counts all month
8078
+	 *
8079
+	 * @return Array the month list
8080
+	 *
8081
+	 */
8082 8082
 	public function countAllMonths($filters = array())
8083 8083
 	{
8084 8084
 		global $globalTimezone, $globalDBdriver;
@@ -8120,11 +8120,11 @@  discard block
 block discarded – undo
8120 8120
 	}
8121 8121
 
8122 8122
 	/**
8123
-	* Counts all month
8124
-	*
8125
-	* @return Array the month list
8126
-	*
8127
-	*/
8123
+	 * Counts all month
8124
+	 *
8125
+	 * @return Array the month list
8126
+	 *
8127
+	 */
8128 8128
 	public function countAllMonthsByAirlines($filters = array())
8129 8129
 	{
8130 8130
 		global $globalTimezone, $globalDBdriver;
@@ -8169,11 +8169,11 @@  discard block
 block discarded – undo
8169 8169
 	}
8170 8170
 
8171 8171
 	/**
8172
-	* Counts all military month
8173
-	*
8174
-	* @return Array the month list
8175
-	*
8176
-	*/
8172
+	 * Counts all military month
8173
+	 *
8174
+	 * @return Array the month list
8175
+	 *
8176
+	 */
8177 8177
 	public function countAllMilitaryMonths($filters = array())
8178 8178
 	{
8179 8179
 		global $globalTimezone, $globalDBdriver;
@@ -8214,11 +8214,11 @@  discard block
 block discarded – undo
8214 8214
 	}
8215 8215
 	
8216 8216
 	/**
8217
-	* Counts all month owners
8218
-	*
8219
-	* @return Array the month list
8220
-	*
8221
-	*/
8217
+	 * Counts all month owners
8218
+	 *
8219
+	 * @return Array the month list
8220
+	 *
8221
+	 */
8222 8222
 	public function countAllMonthsOwners($filters = array())
8223 8223
 	{
8224 8224
 		global $globalTimezone, $globalDBdriver;
@@ -8260,11 +8260,11 @@  discard block
 block discarded – undo
8260 8260
 	}
8261 8261
 	
8262 8262
 	/**
8263
-	* Counts all month owners
8264
-	*
8265
-	* @return Array the month list
8266
-	*
8267
-	*/
8263
+	 * Counts all month owners
8264
+	 *
8265
+	 * @return Array the month list
8266
+	 *
8267
+	 */
8268 8268
 	public function countAllMonthsOwnersByAirlines($filters = array())
8269 8269
 	{
8270 8270
 		global $globalTimezone, $globalDBdriver;
@@ -8307,11 +8307,11 @@  discard block
 block discarded – undo
8307 8307
 	}
8308 8308
 
8309 8309
 	/**
8310
-	* Counts all month pilot
8311
-	*
8312
-	* @return Array the month list
8313
-	*
8314
-	*/
8310
+	 * Counts all month pilot
8311
+	 *
8312
+	 * @return Array the month list
8313
+	 *
8314
+	 */
8315 8315
 	public function countAllMonthsPilots($filters = array())
8316 8316
 	{
8317 8317
 		global $globalTimezone, $globalDBdriver;
@@ -8353,11 +8353,11 @@  discard block
 block discarded – undo
8353 8353
 	}
8354 8354
 	
8355 8355
 	/**
8356
-	* Counts all month pilot
8357
-	*
8358
-	* @return Array the month list
8359
-	*
8360
-	*/
8356
+	 * Counts all month pilot
8357
+	 *
8358
+	 * @return Array the month list
8359
+	 *
8360
+	 */
8361 8361
 	public function countAllMonthsPilotsByAirlines($filters = array())
8362 8362
 	{
8363 8363
 		global $globalTimezone, $globalDBdriver;
@@ -8400,11 +8400,11 @@  discard block
 block discarded – undo
8400 8400
 	}
8401 8401
 
8402 8402
 	/**
8403
-	* Counts all month airline
8404
-	*
8405
-	* @return Array the month list
8406
-	*
8407
-	*/
8403
+	 * Counts all month airline
8404
+	 *
8405
+	 * @return Array the month list
8406
+	 *
8407
+	 */
8408 8408
 	public function countAllMonthsAirlines($filters = array())
8409 8409
 	{
8410 8410
 		global $globalTimezone, $globalDBdriver;
@@ -8446,11 +8446,11 @@  discard block
 block discarded – undo
8446 8446
 	}
8447 8447
 	
8448 8448
 	/**
8449
-	* Counts all month aircraft
8450
-	*
8451
-	* @return Array the month list
8452
-	*
8453
-	*/
8449
+	 * Counts all month aircraft
8450
+	 *
8451
+	 * @return Array the month list
8452
+	 *
8453
+	 */
8454 8454
 	public function countAllMonthsAircrafts($filters = array())
8455 8455
 	{
8456 8456
 		global $globalTimezone, $globalDBdriver;
@@ -8493,11 +8493,11 @@  discard block
 block discarded – undo
8493 8493
 	
8494 8494
 
8495 8495
 	/**
8496
-	* Counts all month aircraft
8497
-	*
8498
-	* @return Array the month list
8499
-	*
8500
-	*/
8496
+	 * Counts all month aircraft
8497
+	 *
8498
+	 * @return Array the month list
8499
+	 *
8500
+	 */
8501 8501
 	public function countAllMonthsAircraftsByAirlines($filters = array())
8502 8502
 	{
8503 8503
 		global $globalTimezone, $globalDBdriver;
@@ -8540,11 +8540,11 @@  discard block
 block discarded – undo
8540 8540
 	}
8541 8541
 
8542 8542
 	/**
8543
-	* Counts all month real arrival
8544
-	*
8545
-	* @return Array the month list
8546
-	*
8547
-	*/
8543
+	 * Counts all month real arrival
8544
+	 *
8545
+	 * @return Array the month list
8546
+	 *
8547
+	 */
8548 8548
 	public function countAllMonthsRealArrivals($filters = array())
8549 8549
 	{
8550 8550
 		global $globalTimezone, $globalDBdriver;
@@ -8587,11 +8587,11 @@  discard block
 block discarded – undo
8587 8587
 	
8588 8588
 
8589 8589
 	/**
8590
-	* Counts all month real arrival
8591
-	*
8592
-	* @return Array the month list
8593
-	*
8594
-	*/
8590
+	 * Counts all month real arrival
8591
+	 *
8592
+	 * @return Array the month list
8593
+	 *
8594
+	 */
8595 8595
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
8596 8596
 	{
8597 8597
 		global $globalTimezone, $globalDBdriver;
@@ -8635,11 +8635,11 @@  discard block
 block discarded – undo
8635 8635
 	
8636 8636
 
8637 8637
 	/**
8638
-	* Counts all dates during the last year
8639
-	*
8640
-	* @return Array the date list
8641
-	*
8642
-	*/
8638
+	 * Counts all dates during the last year
8639
+	 *
8640
+	 * @return Array the date list
8641
+	 *
8642
+	 */
8643 8643
 	public function countAllMonthsLastYear($filters)
8644 8644
 	{
8645 8645
 		global $globalTimezone, $globalDBdriver;
@@ -8661,7 +8661,7 @@  discard block
 block discarded – undo
8661 8661
 			$query .= " GROUP BY year_name, month_name
8662 8662
 								ORDER BY year_name, month_name ASC";
8663 8663
 			$query_data = array(':offset' => $offset);
8664
-    		}
8664
+			}
8665 8665
 		
8666 8666
 		$sth = $this->db->prepare($query);
8667 8667
 		$sth->execute($query_data);
@@ -8684,11 +8684,11 @@  discard block
 block discarded – undo
8684 8684
 	
8685 8685
 	
8686 8686
 	/**
8687
-	* Counts all hours
8688
-	*
8689
-	* @return Array the hour list
8690
-	*
8691
-	*/
8687
+	 * Counts all hours
8688
+	 *
8689
+	 * @return Array the hour list
8690
+	 *
8691
+	 */
8692 8692
 	public function countAllHours($orderby,$filters = array())
8693 8693
 	{
8694 8694
 		global $globalTimezone, $globalDBdriver;
@@ -8749,11 +8749,11 @@  discard block
 block discarded – undo
8749 8749
 	}
8750 8750
 	
8751 8751
 	/**
8752
-	* Counts all hours
8753
-	*
8754
-	* @return Array the hour list
8755
-	*
8756
-	*/
8752
+	 * Counts all hours
8753
+	 *
8754
+	 * @return Array the hour list
8755
+	 *
8756
+	 */
8757 8757
 	public function countAllHoursByAirlines($orderby, $filters = array())
8758 8758
 	{
8759 8759
 		global $globalTimezone, $globalDBdriver;
@@ -8816,11 +8816,11 @@  discard block
 block discarded – undo
8816 8816
 
8817 8817
 
8818 8818
 	/**
8819
-	* Counts all hours by airline
8820
-	*
8821
-	* @return Array the hour list
8822
-	*
8823
-	*/
8819
+	 * Counts all hours by airline
8820
+	 *
8821
+	 * @return Array the hour list
8822
+	 *
8823
+	 */
8824 8824
 	public function countAllHoursByAirline($airline_icao, $filters = array())
8825 8825
 	{
8826 8826
 		global $globalTimezone, $globalDBdriver;
@@ -8866,11 +8866,11 @@  discard block
 block discarded – undo
8866 8866
 	
8867 8867
 	
8868 8868
 	/**
8869
-	* Counts all hours by aircraft
8870
-	*
8871
-	* @return Array the hour list
8872
-	*
8873
-	*/
8869
+	 * Counts all hours by aircraft
8870
+	 *
8871
+	 * @return Array the hour list
8872
+	 *
8873
+	 */
8874 8874
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
8875 8875
 	{
8876 8876
 		global $globalTimezone, $globalDBdriver;
@@ -8913,11 +8913,11 @@  discard block
 block discarded – undo
8913 8913
 	
8914 8914
 	
8915 8915
 	/**
8916
-	* Counts all hours by aircraft registration
8917
-	*
8918
-	* @return Array the hour list
8919
-	*
8920
-	*/
8916
+	 * Counts all hours by aircraft registration
8917
+	 *
8918
+	 * @return Array the hour list
8919
+	 *
8920
+	 */
8921 8921
 	public function countAllHoursByRegistration($registration, $filters = array())
8922 8922
 	{
8923 8923
 		global $globalTimezone, $globalDBdriver;
@@ -8960,11 +8960,11 @@  discard block
 block discarded – undo
8960 8960
 	
8961 8961
 	
8962 8962
 	/**
8963
-	* Counts all hours by airport
8964
-	*
8965
-	* @return Array the hour list
8966
-	*
8967
-	*/
8963
+	 * Counts all hours by airport
8964
+	 *
8965
+	 * @return Array the hour list
8966
+	 *
8967
+	 */
8968 8968
 	public function countAllHoursByAirport($airport_icao, $filters = array())
8969 8969
 	{
8970 8970
 		global $globalTimezone, $globalDBdriver;
@@ -9008,11 +9008,11 @@  discard block
 block discarded – undo
9008 9008
 	
9009 9009
 	
9010 9010
 	/**
9011
-	* Counts all hours by manufacturer
9012
-	*
9013
-	* @return Array the hour list
9014
-	*
9015
-	*/
9011
+	 * Counts all hours by manufacturer
9012
+	 *
9013
+	 * @return Array the hour list
9014
+	 *
9015
+	 */
9016 9016
 	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
9017 9017
 	{
9018 9018
 		global $globalTimezone, $globalDBdriver;
@@ -9056,11 +9056,11 @@  discard block
 block discarded – undo
9056 9056
 	
9057 9057
 	
9058 9058
 	/**
9059
-	* Counts all hours by date
9060
-	*
9061
-	* @return Array the hour list
9062
-	*
9063
-	*/
9059
+	 * Counts all hours by date
9060
+	 *
9061
+	 * @return Array the hour list
9062
+	 *
9063
+	 */
9064 9064
 	public function countAllHoursByDate($date, $filters = array())
9065 9065
 	{
9066 9066
 		global $globalTimezone, $globalDBdriver;
@@ -9104,11 +9104,11 @@  discard block
 block discarded – undo
9104 9104
 	
9105 9105
 	
9106 9106
 	/**
9107
-	* Counts all hours by a ident/callsign
9108
-	*
9109
-	* @return Array the hour list
9110
-	*
9111
-	*/
9107
+	 * Counts all hours by a ident/callsign
9108
+	 *
9109
+	 * @return Array the hour list
9110
+	 *
9111
+	 */
9112 9112
 	public function countAllHoursByIdent($ident, $filters = array())
9113 9113
 	{
9114 9114
 		global $globalTimezone, $globalDBdriver;
@@ -9153,11 +9153,11 @@  discard block
 block discarded – undo
9153 9153
 	
9154 9154
 	
9155 9155
 	/**
9156
-	* Counts all hours by route
9157
-	*
9158
-	* @return Array the hour list
9159
-	*
9160
-	*/
9156
+	 * Counts all hours by route
9157
+	 *
9158
+	 * @return Array the hour list
9159
+	 *
9160
+	 */
9161 9161
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
9162 9162
 	{
9163 9163
 		global $globalTimezone, $globalDBdriver;
@@ -9201,11 +9201,11 @@  discard block
 block discarded – undo
9201 9201
 	
9202 9202
 	
9203 9203
 	/**
9204
-	* Counts all hours by country
9205
-	*
9206
-	* @return Array the hour list
9207
-	*
9208
-	*/
9204
+	 * Counts all hours by country
9205
+	 *
9206
+	 * @return Array the hour list
9207
+	 *
9208
+	 */
9209 9209
 	public function countAllHoursByCountry($country, $filters = array())
9210 9210
 	{
9211 9211
 		global $globalTimezone, $globalDBdriver;
@@ -9250,11 +9250,11 @@  discard block
 block discarded – undo
9250 9250
 
9251 9251
 
9252 9252
 	/**
9253
-	* Counts all aircraft that have flown over
9254
-	*
9255
-	* @return Integer the number of aircrafts
9256
-	*
9257
-	*/
9253
+	 * Counts all aircraft that have flown over
9254
+	 *
9255
+	 * @return Integer the number of aircrafts
9256
+	 *
9257
+	 */
9258 9258
 	public function countOverallAircrafts($filters = array())
9259 9259
 	{
9260 9260
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9266,11 +9266,11 @@  discard block
 block discarded – undo
9266 9266
 	}
9267 9267
 
9268 9268
 	/**
9269
-	* Counts all flight that really arrival
9270
-	*
9271
-	* @return Integer the number of aircrafts
9272
-	*
9273
-	*/
9269
+	 * Counts all flight that really arrival
9270
+	 *
9271
+	 * @return Integer the number of aircrafts
9272
+	 *
9273
+	 */
9274 9274
 	public function countOverallArrival($filters = array())
9275 9275
 	{
9276 9276
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9283,11 +9283,11 @@  discard block
 block discarded – undo
9283 9283
 	}
9284 9284
 
9285 9285
 	/**
9286
-	* Counts all pilots that have flown over
9287
-	*
9288
-	* @return Integer the number of pilots
9289
-	*
9290
-	*/
9286
+	 * Counts all pilots that have flown over
9287
+	 *
9288
+	 * @return Integer the number of pilots
9289
+	 *
9290
+	 */
9291 9291
 	public function countOverallPilots($filters = array())
9292 9292
 	{
9293 9293
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9299,11 +9299,11 @@  discard block
 block discarded – undo
9299 9299
 	}
9300 9300
 
9301 9301
 	/**
9302
-	* Counts all owners that have flown over
9303
-	*
9304
-	* @return Integer the number of owners
9305
-	*
9306
-	*/
9302
+	 * Counts all owners that have flown over
9303
+	 *
9304
+	 * @return Integer the number of owners
9305
+	 *
9306
+	 */
9307 9307
 	public function countOverallOwners($filters = array())
9308 9308
 	{
9309 9309
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9316,11 +9316,11 @@  discard block
 block discarded – undo
9316 9316
 	
9317 9317
 	
9318 9318
 	/**
9319
-	* Counts all flights that have flown over
9320
-	*
9321
-	* @return Integer the number of flights
9322
-	*
9323
-	*/
9319
+	 * Counts all flights that have flown over
9320
+	 *
9321
+	 * @return Integer the number of flights
9322
+	 *
9323
+	 */
9324 9324
 	public function countOverallFlights($filters = array())
9325 9325
 	{
9326 9326
 		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
@@ -9333,11 +9333,11 @@  discard block
 block discarded – undo
9333 9333
 	}
9334 9334
 	
9335 9335
 	/**
9336
-	* Counts all military flights that have flown over
9337
-	*
9338
-	* @return Integer the number of flights
9339
-	*
9340
-	*/
9336
+	 * Counts all military flights that have flown over
9337
+	 *
9338
+	 * @return Integer the number of flights
9339
+	 *
9340
+	 */
9341 9341
 	public function countOverallMilitaryFlights($filters = array())
9342 9342
 	{
9343 9343
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9352,11 +9352,11 @@  discard block
 block discarded – undo
9352 9352
 	
9353 9353
 	
9354 9354
 	/**
9355
-	* Counts all airlines that have flown over
9356
-	*
9357
-	* @return Integer the number of airlines
9358
-	*
9359
-	*/
9355
+	 * Counts all airlines that have flown over
9356
+	 *
9357
+	 * @return Integer the number of airlines
9358
+	 *
9359
+	 */
9360 9360
 	public function countOverallAirlines($filters = array())
9361 9361
 	{
9362 9362
 		$query  = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
@@ -9370,11 +9370,11 @@  discard block
 block discarded – undo
9370 9370
 
9371 9371
   
9372 9372
 	/**
9373
-	* Counts all hours of today
9374
-	*
9375
-	* @return Array the hour list
9376
-	*
9377
-	*/
9373
+	 * Counts all hours of today
9374
+	 *
9375
+	 * @return Array the hour list
9376
+	 *
9377
+	 */
9378 9378
 	public function countAllHoursFromToday($filters = array())
9379 9379
 	{
9380 9380
 		global $globalTimezone, $globalDBdriver;
@@ -9414,11 +9414,11 @@  discard block
 block discarded – undo
9414 9414
 	}
9415 9415
     
9416 9416
 	/**
9417
-	* Gets all the spotter information based on calculated upcoming flights
9418
-	*
9419
-	* @return Array the spotter information
9420
-	*
9421
-	*/
9417
+	 * Gets all the spotter information based on calculated upcoming flights
9418
+	 *
9419
+	 * @return Array the spotter information
9420
+	 *
9421
+	 */
9422 9422
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
9423 9423
 	{
9424 9424
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -9493,12 +9493,12 @@  discard block
 block discarded – undo
9493 9493
 	}
9494 9494
     
9495 9495
     
9496
-     /**
9497
-	* Gets the Barrie Spotter ID based on the FlightAware ID
9498
-	*
9499
-	* @return Integer the Barrie Spotter ID
9496
+	 /**
9497
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
9498
+	  *
9499
+	  * @return Integer the Barrie Spotter ID
9500 9500
 q	*
9501
-	*/
9501
+	  */
9502 9502
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
9503 9503
 	{
9504 9504
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -9519,13 +9519,13 @@  discard block
 block discarded – undo
9519 9519
   
9520 9520
  
9521 9521
 	/**
9522
-	* Parses a date string
9523
-	*
9524
-	* @param String $dateString the date string
9525
-	* @param String $timezone the timezone of a user
9526
-	* @return Array the time information
9527
-	*
9528
-	*/
9522
+	 * Parses a date string
9523
+	 *
9524
+	 * @param String $dateString the date string
9525
+	 * @param String $timezone the timezone of a user
9526
+	 * @return Array the time information
9527
+	 *
9528
+	 */
9529 9529
 	public function parseDateString($dateString, $timezone = '')
9530 9530
 	{
9531 9531
 		$time_array = array();
@@ -9561,12 +9561,12 @@  discard block
 block discarded – undo
9561 9561
 	
9562 9562
 	
9563 9563
 	/**
9564
-	* Parses the direction degrees to working
9565
-	*
9566
-	* @param Float $direction the direction in degrees
9567
-	* @return Array the direction information
9568
-	*
9569
-	*/
9564
+	 * Parses the direction degrees to working
9565
+	 *
9566
+	 * @param Float $direction the direction in degrees
9567
+	 * @return Array the direction information
9568
+	 *
9569
+	 */
9570 9570
 	public function parseDirection($direction = 0)
9571 9571
 	{
9572 9572
 		if ($direction == '') $direction = 0;
@@ -9645,12 +9645,12 @@  discard block
 block discarded – undo
9645 9645
 	
9646 9646
 	
9647 9647
 	/**
9648
-	* Gets the aircraft registration
9649
-	*
9650
-	* @param String $flightaware_id the flight aware id
9651
-	* @return String the aircraft registration
9652
-	*
9653
-	*/
9648
+	 * Gets the aircraft registration
9649
+	 *
9650
+	 * @param String $flightaware_id the flight aware id
9651
+	 * @return String the aircraft registration
9652
+	 *
9653
+	 */
9654 9654
 	
9655 9655
 	public function getAircraftRegistration($flightaware_id)
9656 9656
 	{
@@ -9679,12 +9679,12 @@  discard block
 block discarded – undo
9679 9679
 
9680 9680
 
9681 9681
 	/**
9682
-	* Gets the aircraft registration from ModeS
9683
-	*
9684
-	* @param String $aircraft_modes the flight ModeS in hex
9685
-	* @return String the aircraft registration
9686
-	*
9687
-	*/
9682
+	 * Gets the aircraft registration from ModeS
9683
+	 *
9684
+	 * @param String $aircraft_modes the flight ModeS in hex
9685
+	 * @return String the aircraft registration
9686
+	 *
9687
+	 */
9688 9688
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
9689 9689
 	{
9690 9690
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9697,19 +9697,19 @@  discard block
 block discarded – undo
9697 9697
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9698 9698
 		$sth->closeCursor();
9699 9699
 		if (count($row) > 0) {
9700
-		    //return $row['Registration'];
9701
-		    return $row['registration'];
9700
+			//return $row['Registration'];
9701
+			return $row['registration'];
9702 9702
 		} else return '';
9703 9703
 	
9704 9704
 	}
9705 9705
 
9706 9706
 	/**
9707
-	* Gets the aircraft type from ModeS
9708
-	*
9709
-	* @param String $aircraft_modes the flight ModeS in hex
9710
-	* @return String the aircraft type
9711
-	*
9712
-	*/
9707
+	 * Gets the aircraft type from ModeS
9708
+	 *
9709
+	 * @param String $aircraft_modes the flight ModeS in hex
9710
+	 * @return String the aircraft type
9711
+	 *
9712
+	 */
9713 9713
 	public function getAircraftTypeBymodeS($aircraft_modes)
9714 9714
 	{
9715 9715
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9722,19 +9722,19 @@  discard block
 block discarded – undo
9722 9722
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9723 9723
 		$sth->closeCursor();
9724 9724
 		if (count($row) > 0) {
9725
-		    if ($row['type_flight'] == null) return '';
9726
-		    else return $row['type_flight'];
9725
+			if ($row['type_flight'] == null) return '';
9726
+			else return $row['type_flight'];
9727 9727
 		} else return '';
9728 9728
 	
9729 9729
 	}
9730 9730
 
9731 9731
 	/**
9732
-	* Gets Country from latitude/longitude
9733
-	*
9734
-	* @param Float $latitude latitute of the flight
9735
-	* @param Float $longitude longitute of the flight
9736
-	* @return String the countrie
9737
-	*/
9732
+	 * Gets Country from latitude/longitude
9733
+	 *
9734
+	 * @param Float $latitude latitute of the flight
9735
+	 * @param Float $longitude longitute of the flight
9736
+	 * @return String the countrie
9737
+	 */
9738 9738
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
9739 9739
 	{
9740 9740
 		global $globalDBdriver, $globalDebug;
@@ -9771,11 +9771,11 @@  discard block
 block discarded – undo
9771 9771
 	}
9772 9772
 
9773 9773
 	/**
9774
-	* Gets Country from iso2
9775
-	*
9776
-	* @param String $iso2 ISO2 country code
9777
-	* @return String the countrie
9778
-	*/
9774
+	 * Gets Country from iso2
9775
+	 *
9776
+	 * @param String $iso2 ISO2 country code
9777
+	 * @return String the countrie
9778
+	 */
9779 9779
 	public function getCountryFromISO2($iso2)
9780 9780
 	{
9781 9781
 		global $globalDBdriver, $globalDebug;
@@ -9803,12 +9803,12 @@  discard block
 block discarded – undo
9803 9803
 	}
9804 9804
 
9805 9805
 	/**
9806
-	* converts the registration code using the country prefix
9807
-	*
9808
-	* @param String $registration the aircraft registration
9809
-	* @return String the aircraft registration
9810
-	*
9811
-	*/
9806
+	 * converts the registration code using the country prefix
9807
+	 *
9808
+	 * @param String $registration the aircraft registration
9809
+	 * @return String the aircraft registration
9810
+	 *
9811
+	 */
9812 9812
 	public function convertAircraftRegistration($registration)
9813 9813
 	{
9814 9814
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9860,12 +9860,12 @@  discard block
 block discarded – undo
9860 9860
 	}
9861 9861
 
9862 9862
 	/**
9863
-	* Country from the registration code
9864
-	*
9865
-	* @param String $registration the aircraft registration
9866
-	* @return String the country
9867
-	*
9868
-	*/
9863
+	 * Country from the registration code
9864
+	 *
9865
+	 * @param String $registration the aircraft registration
9866
+	 * @return String the country
9867
+	 *
9868
+	 */
9869 9869
 	public function countryFromAircraftRegistration($registration)
9870 9870
 	{
9871 9871
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9884,8 +9884,8 @@  discard block
 block discarded – undo
9884 9884
 				$country = $row['country'];
9885 9885
 			}
9886 9886
 		} else {
9887
-    			$registration_1 = substr($registration, 0, 1);
9888
-		        $registration_2 = substr($registration, 0, 2);
9887
+				$registration_1 = substr($registration, 0, 1);
9888
+				$registration_2 = substr($registration, 0, 2);
9889 9889
 
9890 9890
 			$country = '';
9891 9891
 			//first get the prefix based on two characters
@@ -9921,12 +9921,12 @@  discard block
 block discarded – undo
9921 9921
 	}
9922 9922
 
9923 9923
 	/**
9924
-	* Country from the registration code
9925
-	*
9926
-	* @param String $registration the aircraft registration
9927
-	* @return String the country
9928
-	*
9929
-	*/
9924
+	 * Country from the registration code
9925
+	 *
9926
+	 * @param String $registration the aircraft registration
9927
+	 * @return String the country
9928
+	 *
9929
+	 */
9930 9930
 	public function countryFromAircraftRegistrationCode($registration)
9931 9931
 	{
9932 9932
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9943,11 +9943,11 @@  discard block
 block discarded – undo
9943 9943
 	}
9944 9944
 	
9945 9945
 	/**
9946
-	* Set a new highlight value for a flight
9947
-	*
9948
-	* @param String $flightaware_id flightaware_id from spotter_output table
9949
-	* @param String $highlight New highlight value
9950
-	*/
9946
+	 * Set a new highlight value for a flight
9947
+	 *
9948
+	 * @param String $flightaware_id flightaware_id from spotter_output table
9949
+	 * @param String $highlight New highlight value
9950
+	 */
9951 9951
 	public function setHighlightFlight($flightaware_id,$highlight) {
9952 9952
 		
9953 9953
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -9956,12 +9956,12 @@  discard block
 block discarded – undo
9956 9956
 	}
9957 9957
 	
9958 9958
 	/**
9959
-	* Gets the short url from bit.ly
9960
-	*
9961
-	* @param String $url the full url
9962
-	* @return String the bit.ly url
9963
-	*
9964
-	*/
9959
+	 * Gets the short url from bit.ly
9960
+	 *
9961
+	 * @param String $url the full url
9962
+	 * @return String the bit.ly url
9963
+	 *
9964
+	 */
9965 9965
 	public function getBitlyURL($url)
9966 9966
 	{
9967 9967
 		global $globalBitlyAccessToken;
@@ -10250,11 +10250,11 @@  discard block
 block discarded – undo
10250 10250
 			$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 
10251 10251
 	                      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)) 
10252 10252
 	                      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;";
10253
-                } else {
10253
+				} else {
10254 10254
 			$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 
10255 10255
 	                      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)) 
10256 10256
 	                      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;";
10257
-    		}
10257
+			}
10258 10258
 		$sth = $this->db->prepare($query);
10259 10259
 		$sth->execute();
10260 10260
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
Spacing   +1013 added lines, -1013 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 require_once(dirname(__FILE__).'/class.Image.php');
5 5
 $global_query = "SELECT spotter_output.* FROM spotter_output";
6 6
 
7
-class Spotter{
7
+class Spotter {
8 8
 	public $db;
9 9
 	
10 10
 	public function __construct($dbc = null) {
@@ -17,64 +17,64 @@  discard block
 block discarded – undo
17 17
 	* @param Array $filter the filter
18 18
 	* @return Array the SQL part
19 19
 	*/
20
-	public function getFilter($filter = array(),$where = false,$and = false) {
20
+	public function getFilter($filter = array(), $where = false, $and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
22 22
 		$filters = array();
23 23
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
24 24
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
25 25
 				$filters = $globalStatsFilters[$globalFilterName];
26 26
 			} else {
27
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
27
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
28 28
 			}
29 29
 		}
30
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
30
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
31 31
 		$filter_query_join = '';
32 32
 		$filter_query_where = '';
33
-		foreach($filters as $flt) {
33
+		foreach ($filters as $flt) {
34 34
 			if (isset($flt['airlines']) && !empty($flt['airlines'])) {
35 35
 				if ($flt['airlines'][0] != '') {
36 36
 					if (isset($flt['source'])) {
37
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
37
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
38 38
 					} else {
39
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
39
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
40 40
 					}
41 41
 				}
42 42
 			}
43 43
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
44 44
 				if (isset($flt['source'])) {
45
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
45
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
46 46
 				} else {
47
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
47
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
48 48
 				}
49 49
 			}
50 50
 			if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']))) {
51 51
 				if (isset($flt['source'])) {
52
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
52
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
53 53
 				}
54 54
 			}
55 55
 		}
56 56
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
57 57
 			if ($filter['airlines'][0] != '') {
58
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
58
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
59 59
 			}
60 60
 		}
61 61
 		if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
62 62
 			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_output.flightaware_id ";
63 63
 		}
64 64
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
65
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
65
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
66 66
 			}
67 67
 		if (isset($filter['source']) && !empty($filter['source'])) {
68
-			$filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
68
+			$filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')";
69 69
 		}
70 70
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
71 71
 			$filter_query_where = " WHERE ident = '".$filter['ident']."'";
72 72
 		}
73 73
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
74 74
 			if ($filter_query_where == '') {
75
-				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
75
+				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
76 76
 			} else {
77
-				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
77
+				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
78 78
 			}
79 79
 		}
80 80
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	* @return Array the spotter information
93 93
 	*
94 94
 	*/
95
-	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
95
+	public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false)
96 96
 	{
97 97
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
98 98
 		$Image = new Image($this->db);
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 			$sth = $this->db->prepare($query.$limitQuery);
123 123
 			$sth->execute($params);
124 124
 		} catch (PDOException $e) {
125
-			printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery);
125
+			printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery);
126 126
 			exit();
127 127
 		}
128 128
 		
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 		$spotter_array = array();
133 133
 		
134 134
 
135
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
135
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
136 136
 		{
137 137
 			$num_rows++;
138 138
 			$temp_array = array();
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 			if (isset($row['route_stop'])) {
178 178
 				$temp_array['route_stop'] = $row['route_stop'];
179 179
 				if ($row['route_stop'] != '') {
180
-					$allroute = explode(' ',$row['route_stop']);
180
+					$allroute = explode(' ', $row['route_stop']);
181 181
 			
182 182
 					foreach ($allroute as $route) {
183 183
 						$route_airport_array = $this->getAllAirportInfo($route);
@@ -232,11 +232,11 @@  discard block
 block discarded – undo
232 232
 				{
233 233
 					$temp_array['date'] = "about ".$dateArray['hours']." hours ago";
234 234
 				} else {
235
-					$temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC"));
235
+					$temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC"));
236 236
 				}
237 237
 				$temp_array['date_minutes_past'] = $dateArray['minutes'];
238
-				$temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC"));
239
-				$temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC"));
238
+				$temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC"));
239
+				$temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC"));
240 240
 				$temp_array['date_unix'] = strtotime($row['date']." UTC");
241 241
 			}
242 242
 			
@@ -270,9 +270,9 @@  discard block
 block discarded – undo
270 270
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
271 271
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
272 272
 					if (is_numeric(substr($row['ident'], 2, 1))) {
273
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2),$fromsource);
273
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2), $fromsource);
274 274
 					} elseif (is_numeric(substr($row['ident'], 3, 1))) {
275
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
275
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
276 276
 					} else {
277 277
 						$airline_array = $this->getAllAirlineInfo('NA');
278 278
 					}
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 				}
310 310
 			}
311 311
 			if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') {
312
-				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'],3));
312
+				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'], 3));
313 313
 				//$acars_array = ACARS->getLiveAcarsData('BA40YL');
314 314
 				if (count($acars_array) > 0) {
315 315
 					$temp_array['acars'] = $acars_array;
@@ -326,11 +326,11 @@  discard block
 block discarded – undo
326 326
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
327 327
 			}
328 328
 
329
-			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
329
+			if ($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
330 330
 			{
331 331
 				if ($globalIVAO) {
332
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
333
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
332
+					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('', $temp_array['aircraft_type'], $temp_array['airline_icao']);
333
+					else $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type']);
334 334
 				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
335 335
 				if (count($image_array) > 0) {
336 336
 					$temp_array['image'] = $image_array[0]['image'];
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
355 355
 			}
356 356
 			
357
-			if ((!isset($globalIVAO) || ! $globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
357
+			if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
358 358
 				if ($schedules === true) {
359 359
 					$schedule_array = $Schedule->getSchedule($temp_array['ident']);
360 360
 					//print_r($schedule_array);
@@ -436,12 +436,12 @@  discard block
 block discarded – undo
436 436
 			if (isset($row['squawk'])) {
437 437
 				$temp_array['squawk'] = $row['squawk'];
438 438
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
439
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
440
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
439
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['country_iso2']);
440
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
441 441
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
442
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
443
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
444
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
442
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['over_country']);
443
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
444
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
445 445
 			}
446 446
     			
447 447
 			$temp_array['query_number_rows'] = $num_rows;
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 	* @return Array the spotter information
461 461
 	*
462 462
 	*/
463
-	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
463
+	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())
464 464
 	{
465 465
 		global $globalTimezone, $globalDBdriver;
466 466
 		require_once(dirname(__FILE__).'/class.Translation.php');
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 
471 471
 		$query_values = array();
472 472
 		$additional_query = '';
473
-		$filter_query = $this->getFilter($filters,true,true);
473
+		$filter_query = $this->getFilter($filters, true, true);
474 474
 		if ($q != "")
475 475
 		{
476 476
 			if (!is_string($q))
@@ -478,8 +478,8 @@  discard block
 block discarded – undo
478 478
 				return false;
479 479
 			} else {
480 480
 				$q_array = explode(" ", $q);
481
-				foreach ($q_array as $q_item){
482
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
481
+				foreach ($q_array as $q_item) {
482
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
483 483
 					$additional_query .= " AND (";
484 484
 					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
485 485
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
@@ -511,37 +511,37 @@  discard block
 block discarded – undo
511 511
 
512 512
 		if ($registration != "")
513 513
 		{
514
-			$registration = filter_var($registration,FILTER_SANITIZE_STRING);
514
+			$registration = filter_var($registration, FILTER_SANITIZE_STRING);
515 515
 			if (!is_string($registration))
516 516
 			{
517 517
 				return false;
518 518
 			} else {
519 519
 				$additional_query .= " AND spotter_output.registration = :registration";
520
-				$query_values = array_merge($query_values,array(':registration' => $registration));
520
+				$query_values = array_merge($query_values, array(':registration' => $registration));
521 521
 			}
522 522
 		}
523 523
 
524 524
 		if ($aircraft_icao != "")
525 525
 		{
526
-			$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
526
+			$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
527 527
 			if (!is_string($aircraft_icao))
528 528
 			{
529 529
 				return false;
530 530
 			} else {
531 531
 				$additional_query .= " AND spotter_output.aircraft_icao = :aircraft_icao";
532
-				$query_values = array_merge($query_values,array(':aircraft_icao' => $aircraft_icao));
532
+				$query_values = array_merge($query_values, array(':aircraft_icao' => $aircraft_icao));
533 533
 			}
534 534
 		}
535 535
 
536 536
 		if ($aircraft_manufacturer != "")
537 537
 		{
538
-			$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
538
+			$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
539 539
 			if (!is_string($aircraft_manufacturer))
540 540
 			{
541 541
 				return false;
542 542
 			} else {
543 543
 				$additional_query .= " AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer";
544
-				$query_values = array_merge($query_values,array(':aircraft_manufacturer' => $aircraft_manufacturer));
544
+				$query_values = array_merge($query_values, array(':aircraft_manufacturer' => $aircraft_manufacturer));
545 545
 			}
546 546
 		}
547 547
 
@@ -557,25 +557,25 @@  discard block
 block discarded – undo
557 557
 
558 558
 		if ($airline_icao != "")
559 559
 		{
560
-			$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
560
+			$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
561 561
 			if (!is_string($airline_icao))
562 562
 			{
563 563
 				return false;
564 564
 			} else {
565 565
 				$additional_query .= " AND spotter_output.airline_icao = :airline_icao";
566
-				$query_values = array_merge($query_values,array(':airline_icao' => $airline_icao));
566
+				$query_values = array_merge($query_values, array(':airline_icao' => $airline_icao));
567 567
 			}
568 568
 		}
569 569
 
570 570
 		if ($airline_country != "")
571 571
 		{
572
-			$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
572
+			$airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING);
573 573
 			if (!is_string($airline_country))
574 574
 			{
575 575
 				return false;
576 576
 			} else {
577 577
 				$additional_query .= " AND spotter_output.airline_country = :airline_country";
578
-				$query_values = array_merge($query_values,array(':airline_country' => $airline_country));
578
+				$query_values = array_merge($query_values, array(':airline_country' => $airline_country));
579 579
 			}
580 580
 		}
581 581
 
@@ -602,31 +602,31 @@  discard block
 block discarded – undo
602 602
 
603 603
 		if ($airport != "")
604 604
 		{
605
-			$airport = filter_var($airport,FILTER_SANITIZE_STRING);
605
+			$airport = filter_var($airport, FILTER_SANITIZE_STRING);
606 606
 			if (!is_string($airport))
607 607
 			{
608 608
 				return false;
609 609
 			} else {
610 610
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :airport OR spotter_output.arrival_airport_icao = :airport)";
611
-				$query_values = array_merge($query_values,array(':airport' => $airport));
611
+				$query_values = array_merge($query_values, array(':airport' => $airport));
612 612
 			}
613 613
 		}
614 614
 
615 615
 		if ($airport_country != "")
616 616
 		{
617
-			$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
617
+			$airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING);
618 618
 			if (!is_string($airport_country))
619 619
 			{
620 620
 				return false;
621 621
 			} else {
622 622
 				$additional_query .= " AND (spotter_output.departure_airport_country = :airport_country OR spotter_output.arrival_airport_country = :airport_country)";
623
-				$query_values = array_merge($query_values,array(':airport_country' => $airport_country));
623
+				$query_values = array_merge($query_values, array(':airport_country' => $airport_country));
624 624
 			}
625 625
 		}
626 626
     
627 627
 		if ($callsign != "")
628 628
 		{
629
-			$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
629
+			$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
630 630
 			if (!is_string($callsign))
631 631
 			{
632 632
 				return false;
@@ -634,79 +634,79 @@  discard block
 block discarded – undo
634 634
 				$translate = $Translation->ident2icao($callsign);
635 635
 				if ($translate != $callsign) {
636 636
 					$additional_query .= " AND (spotter_output.ident = :callsign OR spotter_output.ident = :translate)";
637
-					$query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate));
637
+					$query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate));
638 638
 				} else {
639 639
 					$additional_query .= " AND spotter_output.ident = :callsign";
640
-					$query_values = array_merge($query_values,array(':callsign' => $callsign));
640
+					$query_values = array_merge($query_values, array(':callsign' => $callsign));
641 641
 				}
642 642
 			}
643 643
 		}
644 644
 
645 645
 		if ($owner != "")
646 646
 		{
647
-			$owner = filter_var($owner,FILTER_SANITIZE_STRING);
647
+			$owner = filter_var($owner, FILTER_SANITIZE_STRING);
648 648
 			if (!is_string($owner))
649 649
 			{
650 650
 				return false;
651 651
 			} else {
652 652
 				$additional_query .= " AND spotter_output.owner_name = :owner";
653
-				$query_values = array_merge($query_values,array(':owner' => $owner));
653
+				$query_values = array_merge($query_values, array(':owner' => $owner));
654 654
 			}
655 655
 		}
656 656
 
657 657
 		if ($pilot_name != "")
658 658
 		{
659
-			$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
659
+			$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
660 660
 			if (!is_string($pilot_name))
661 661
 			{
662 662
 				return false;
663 663
 			} else {
664 664
 				$additional_query .= " AND spotter_output.pilot_name = :pilot_name";
665
-				$query_values = array_merge($query_values,array(':pilot_name' => $pilot_name));
665
+				$query_values = array_merge($query_values, array(':pilot_name' => $pilot_name));
666 666
 			}
667 667
 		}
668 668
 
669 669
 		if ($pilot_id != "")
670 670
 		{
671
-			$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
671
+			$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT);
672 672
 			if (!is_string($pilot_id))
673 673
 			{
674 674
 				return false;
675 675
 			} else {
676 676
 				$additional_query .= " AND spotter_output.pilot_id = :pilot_id";
677
-				$query_values = array_merge($query_values,array(':pilot_id' => $pilot_id));
677
+				$query_values = array_merge($query_values, array(':pilot_id' => $pilot_id));
678 678
 			}
679 679
 		}
680 680
 
681 681
 		if ($departure_airport_route != "")
682 682
 		{
683
-			$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
683
+			$departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING);
684 684
 			if (!is_string($departure_airport_route))
685 685
 			{
686 686
 				return false;
687 687
 			} else {
688 688
 				$additional_query .= " AND spotter_output.departure_airport_icao = :departure_airport_route";
689
-				$query_values = array_merge($query_values,array(':departure_airport_route' => $departure_airport_route));
689
+				$query_values = array_merge($query_values, array(':departure_airport_route' => $departure_airport_route));
690 690
 			}
691 691
 		}
692 692
 
693 693
 		if ($arrival_airport_route != "")
694 694
 		{
695
-			$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
695
+			$arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING);
696 696
 			if (!is_string($arrival_airport_route))
697 697
 			{
698 698
 				return false;
699 699
 			} else {
700 700
 				$additional_query .= " AND spotter_output.arrival_airport_icao = :arrival_airport_route";
701
-				$query_values = array_merge($query_values,array(':arrival_airport_route' => $arrival_airport_route));
701
+				$query_values = array_merge($query_values, array(':arrival_airport_route' => $arrival_airport_route));
702 702
 			}
703 703
 		}
704 704
 
705 705
 		if ($altitude != "")
706 706
 		{
707 707
 			$altitude_array = explode(",", $altitude);
708
-			$altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
709
-			$altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
708
+			$altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
709
+			$altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
710 710
 
711 711
 			if ($altitude_array[1] != "")
712 712
 			{                
@@ -722,8 +722,8 @@  discard block
 block discarded – undo
722 722
 		if ($date_posted != "")
723 723
 		{
724 724
 			$date_array = explode(",", $date_posted);
725
-			$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
726
-			$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
725
+			$date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
726
+			$date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
727 727
 
728 728
 			if ($globalTimezone != '') {
729 729
 				date_default_timezone_set($globalTimezone);
@@ -754,8 +754,8 @@  discard block
 block discarded – undo
754 754
 		{
755 755
 			$limit_array = explode(",", $limit);
756 756
 			
757
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
758
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
757
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
758
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
759 759
 			
760 760
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
761 761
 			{
@@ -784,23 +784,23 @@  discard block
 block discarded – undo
784 784
 
785 785
 
786 786
 		if ($origLat != "" && $origLon != "" && $dist != "") {
787
-			$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
787
+			$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
788 788
 
789 789
 			if ($globalDBdriver == 'mysql') {
790
-				$query="SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance 
790
+				$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 
791 791
 						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)) 
792 792
 						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;
793 793
 			} else {
794
-				$query="SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
794
+				$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 
795 795
 						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)) 
796 796
 						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;
797 797
 			}
798 798
 		} else {		
799
-			$query  = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' 
799
+			$query = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' 
800 800
 					".$additional_query."
801 801
 					".$orderby_query;
802 802
 		}
803
-		$spotter_array = $this->getDataFromDB($query, $query_values,$limit_query);
803
+		$spotter_array = $this->getDataFromDB($query, $query_values, $limit_query);
804 804
 		return $spotter_array;
805 805
 	}
806 806
 	
@@ -823,8 +823,8 @@  discard block
 block discarded – undo
823 823
 		{
824 824
 			$limit_array = explode(",", $limit);
825 825
 			
826
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
827
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
826
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
827
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
828 828
 			
829 829
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
830 830
 			{
@@ -841,9 +841,9 @@  discard block
 block discarded – undo
841 841
 			$orderby_query = " ORDER BY spotter_output.date DESC";
842 842
 		}
843 843
 
844
-		$query  = $global_query.$filter_query." ".$orderby_query;
844
+		$query = $global_query.$filter_query." ".$orderby_query;
845 845
 
846
-		$spotter_array = $this->getDataFromDB($query, array(),$limit_query,true);
846
+		$spotter_array = $this->getDataFromDB($query, array(), $limit_query, true);
847 847
 
848 848
 		return $spotter_array;
849 849
 	}
@@ -889,34 +889,34 @@  discard block
 block discarded – undo
889 889
 			{
890 890
 				return false;
891 891
 			} else {
892
-				if ($interval == "30m"){
892
+				if ($interval == "30m") {
893 893
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) <= $this_output.date ';
894
-				} else if ($interval == "1h"){
894
+				} else if ($interval == "1h") {
895 895
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) <= $this_output.date ';
896
-				} else if ($interval == "3h"){
896
+				} else if ($interval == "3h") {
897 897
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 3 HOUR) <= $this_output.date ';
898
-				} else if ($interval == "6h"){
898
+				} else if ($interval == "6h") {
899 899
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 6 HOUR) <= $this_output.date ';
900
-				} else if ($interval == "12h"){
900
+				} else if ($interval == "12h") {
901 901
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 HOUR) <= $this_output.date ';
902
-				} else if ($interval == "24h"){
902
+				} else if ($interval == "24h") {
903 903
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 24 HOUR) <= $this_output.date ';
904
-				} else if ($interval == "7d"){
904
+				} else if ($interval == "7d") {
905 905
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) <= $this_output.date ';
906
-				} else if ($interval == "30d"){
906
+				} else if ($interval == "30d") {
907 907
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 DAY) <= $this_output.date ';
908 908
 				} 
909 909
 			}
910 910
 		}
911 911
 
912
-		$query  = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output 
912
+		$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 
913 913
                    WHERE spotter_output.latitude <> '' 
914 914
 				   AND spotter_output.longitude <> '' 
915 915
                    ".$additional_query."
916 916
                    HAVING distance < :radius  
917 917
 				   ORDER BY distance";
918 918
 
919
-		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius),$limit_query);
919
+		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius), $limit_query);
920 920
 
921 921
 		return $spotter_array;
922 922
 	}
@@ -928,21 +928,21 @@  discard block
 block discarded – undo
928 928
 	* @return Array the spotter information
929 929
 	*
930 930
 	*/
931
-	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
931
+	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '', $filter = array())
932 932
 	{
933 933
 		global $global_query;
934 934
 		
935 935
 		date_default_timezone_set('UTC');
936 936
 
937
-		$filter_query = $this->getFilter($filter,true,true);
937
+		$filter_query = $this->getFilter($filter, true, true);
938 938
 
939 939
 		$limit_query = '';
940 940
 		if ($limit != "")
941 941
 		{
942 942
 			$limit_array = explode(",", $limit);
943 943
 			
944
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
945
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
944
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
945
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
946 946
 			
947 947
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
948 948
 			{
@@ -959,7 +959,7 @@  discard block
 block discarded – undo
959 959
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
960 960
 		}
961 961
 
962
-		$query  = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
962
+		$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;
963 963
 
964 964
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
965 965
 
@@ -978,15 +978,15 @@  discard block
 block discarded – undo
978 978
 		global $global_query;
979 979
 		
980 980
 		date_default_timezone_set('UTC');
981
-		$filter_query = $this->getFilter($filter,true,true);
981
+		$filter_query = $this->getFilter($filter, true, true);
982 982
 
983 983
 		$limit_query = '';
984 984
 		if ($limit != "")
985 985
 		{
986 986
 			$limit_array = explode(",", $limit);
987 987
 			
988
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
989
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
988
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
989
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
990 990
 			
991 991
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
992 992
 			{
@@ -1003,7 +1003,7 @@  discard block
 block discarded – undo
1003 1003
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1004 1004
 		}
1005 1005
 
1006
-		$query  = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1006
+		$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;
1007 1007
 
1008 1008
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1009 1009
 
@@ -1017,20 +1017,20 @@  discard block
 block discarded – undo
1017 1017
 	* @return Array the spotter information
1018 1018
 	*
1019 1019
 	*/
1020
-	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1020
+	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '', $filter = array())
1021 1021
 	{
1022 1022
 		global $global_query;
1023 1023
 		
1024 1024
 		date_default_timezone_set('UTC');
1025
-		$filter_query = $this->getFilter($filter,true,true);
1025
+		$filter_query = $this->getFilter($filter, true, true);
1026 1026
 		
1027 1027
 		$limit_query = '';
1028 1028
 		if ($limit != "")
1029 1029
 		{
1030 1030
 			$limit_array = explode(",", $limit);
1031 1031
 			
1032
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1033
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1032
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1033
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1034 1034
 			
1035 1035
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1036 1036
 			{
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1048 1048
 		}
1049 1049
 
1050
-		$query  = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1050
+		$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;
1051 1051
 
1052 1052
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1053 1053
 
@@ -1067,7 +1067,7 @@  discard block
 block discarded – undo
1067 1067
 		
1068 1068
 		date_default_timezone_set('UTC');
1069 1069
 		
1070
-		$filter_query = $this->getFilter($filter,true,true);
1070
+		$filter_query = $this->getFilter($filter, true, true);
1071 1071
 		
1072 1072
 		$limit_query = '';
1073 1073
 		
@@ -1075,8 +1075,8 @@  discard block
 block discarded – undo
1075 1075
 		{
1076 1076
 			$limit_array = explode(",", $limit);
1077 1077
 			
1078
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1079
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1078
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1079
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1080 1080
 			
1081 1081
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1082 1082
 			{
@@ -1093,7 +1093,7 @@  discard block
 block discarded – undo
1093 1093
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1094 1094
 		}
1095 1095
 
1096
-		$query  = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1096
+		$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;
1097 1097
 
1098 1098
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1099 1099
 
@@ -1112,14 +1112,14 @@  discard block
 block discarded – undo
1112 1112
 		global $global_query;
1113 1113
 		
1114 1114
 		date_default_timezone_set('UTC');
1115
-		$filter_query = $this->getFilter($filter,true,true);
1115
+		$filter_query = $this->getFilter($filter, true, true);
1116 1116
 		$limit_query = '';
1117 1117
 		if ($limit != "")
1118 1118
 		{
1119 1119
 			$limit_array = explode(",", $limit);
1120 1120
 			
1121
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1122
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1121
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1122
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1123 1123
 			
1124 1124
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1125 1125
 			{
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1137 1137
 		}
1138 1138
 
1139
-		$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;
1139
+		$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;
1140 1140
 
1141 1141
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1142 1142
 
@@ -1160,9 +1160,9 @@  discard block
 block discarded – undo
1160 1160
 		$query_values = array(':id' => $id);
1161 1161
 
1162 1162
 		//$query  = $global_query." WHERE spotter_output.ident <> '' ".$additional_query." ";
1163
-		$query  = $global_query." WHERE ".$additional_query." ";
1163
+		$query = $global_query." WHERE ".$additional_query." ";
1164 1164
 
1165
-		$spotter_array = $this->getDataFromDB($query,$query_values);
1165
+		$spotter_array = $this->getDataFromDB($query, $query_values);
1166 1166
 
1167 1167
 		return $spotter_array;
1168 1168
 	}
@@ -1200,8 +1200,8 @@  discard block
 block discarded – undo
1200 1200
 		{
1201 1201
 			$limit_array = explode(",", $limit);
1202 1202
 			
1203
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1204
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1203
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1204
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1205 1205
 			
1206 1206
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1207 1207
 			{
@@ -1242,7 +1242,7 @@  discard block
 block discarded – undo
1242 1242
 		$query_values = array();
1243 1243
 		$limit_query = '';
1244 1244
 		$additional_query = '';
1245
-		$filter_query = $this->getFilter($filter,true,true);
1245
+		$filter_query = $this->getFilter($filter, true, true);
1246 1246
 		
1247 1247
 		if ($aircraft_type != "")
1248 1248
 		{
@@ -1259,8 +1259,8 @@  discard block
 block discarded – undo
1259 1259
 		{
1260 1260
 			$limit_array = explode(",", $limit);
1261 1261
 			
1262
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1263
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1262
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1263
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1264 1264
 			
1265 1265
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1266 1266
 			{
@@ -1316,8 +1316,8 @@  discard block
 block discarded – undo
1316 1316
 		{
1317 1317
 			$limit_array = explode(",", $limit);
1318 1318
 			
1319
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1320
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1319
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1320
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1321 1321
 			
1322 1322
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1323 1323
 			{
@@ -1333,7 +1333,7 @@  discard block
 block discarded – undo
1333 1333
 		} else {
1334 1334
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1335 1335
 		}
1336
-		$filter_query = $this->getFilter($filter,true,true);
1336
+		$filter_query = $this->getFilter($filter, true, true);
1337 1337
 
1338 1338
 		//$query = $global_query.$filter_query." spotter_output.ident <> '' ".$additional_query." ".$orderby_query;
1339 1339
 		$query = $global_query.$filter_query." ".$additional_query." ".$orderby_query;
@@ -1352,7 +1352,7 @@  discard block
 block discarded – undo
1352 1352
 	* @return Array the spotter information
1353 1353
 	*
1354 1354
 	*/
1355
-	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1355
+	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '', $filters = array())
1356 1356
 	{
1357 1357
 		global $global_query;
1358 1358
 		
@@ -1361,7 +1361,7 @@  discard block
 block discarded – undo
1361 1361
 		$query_values = array();
1362 1362
 		$limit_query = '';
1363 1363
 		$additional_query = '';
1364
-		$filter_query = $this->getFilter($filters,true,true);
1364
+		$filter_query = $this->getFilter($filters, true, true);
1365 1365
 		
1366 1366
 		if ($airline != "")
1367 1367
 		{
@@ -1378,8 +1378,8 @@  discard block
 block discarded – undo
1378 1378
 		{
1379 1379
 			$limit_array = explode(",", $limit);
1380 1380
 			
1381
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1382
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1381
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1382
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1383 1383
 			
1384 1384
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1385 1385
 			{
@@ -1409,7 +1409,7 @@  discard block
 block discarded – undo
1409 1409
 	* @return Array the spotter information
1410 1410
 	*
1411 1411
 	*/
1412
-	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1412
+	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array())
1413 1413
 	{
1414 1414
 		global $global_query;
1415 1415
 		
@@ -1417,7 +1417,7 @@  discard block
 block discarded – undo
1417 1417
 		$query_values = array();
1418 1418
 		$limit_query = '';
1419 1419
 		$additional_query = '';
1420
-		$filter_query = $this->getFilter($filters,true,true);
1420
+		$filter_query = $this->getFilter($filters, true, true);
1421 1421
 		
1422 1422
 		if ($airport != "")
1423 1423
 		{
@@ -1434,8 +1434,8 @@  discard block
 block discarded – undo
1434 1434
 		{
1435 1435
 			$limit_array = explode(",", $limit);
1436 1436
 			
1437
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1438
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1437
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1438
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1439 1439
 			
1440 1440
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1441 1441
 			{
@@ -1467,7 +1467,7 @@  discard block
 block discarded – undo
1467 1467
 	* @return Array the spotter information
1468 1468
 	*
1469 1469
 	*/
1470
-	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1470
+	public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array())
1471 1471
 	{
1472 1472
 		global $global_query, $globalTimezone, $globalDBdriver;
1473 1473
 		
@@ -1475,7 +1475,7 @@  discard block
 block discarded – undo
1475 1475
 		$limit_query = '';
1476 1476
 		$additional_query = '';
1477 1477
 
1478
-		$filter_query = $this->getFilter($filter,true,true);
1478
+		$filter_query = $this->getFilter($filter, true, true);
1479 1479
 		
1480 1480
 		if ($date != "")
1481 1481
 		{
@@ -1504,8 +1504,8 @@  discard block
 block discarded – undo
1504 1504
 		{
1505 1505
 			$limit_array = explode(",", $limit);
1506 1506
 			
1507
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1508
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1507
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1508
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1509 1509
 			
1510 1510
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1511 1511
 			{
@@ -1535,7 +1535,7 @@  discard block
 block discarded – undo
1535 1535
 	* @return Array the spotter information
1536 1536
 	*
1537 1537
 	*/
1538
-	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1538
+	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '', $filters = array())
1539 1539
 	{
1540 1540
 		global $global_query;
1541 1541
 		
@@ -1544,7 +1544,7 @@  discard block
 block discarded – undo
1544 1544
 		$query_values = array();
1545 1545
 		$limit_query = '';
1546 1546
 		$additional_query = '';
1547
-		$filter_query = $this->getFilter($filters,true,true);
1547
+		$filter_query = $this->getFilter($filters, true, true);
1548 1548
 		if ($country != "")
1549 1549
 		{
1550 1550
 			if (!is_string($country))
@@ -1561,8 +1561,8 @@  discard block
 block discarded – undo
1561 1561
 		{
1562 1562
 			$limit_array = explode(",", $limit);
1563 1563
 			
1564
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1565
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1564
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1565
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1566 1566
 			
1567 1567
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1568 1568
 			{
@@ -1602,7 +1602,7 @@  discard block
 block discarded – undo
1602 1602
 		$query_values = array();
1603 1603
 		$additional_query = '';
1604 1604
 		$limit_query = '';
1605
-		$filter_query = $this->getFilter($filters,true,true);
1605
+		$filter_query = $this->getFilter($filters, true, true);
1606 1606
 		
1607 1607
 		if ($aircraft_manufacturer != "")
1608 1608
 		{
@@ -1619,8 +1619,8 @@  discard block
 block discarded – undo
1619 1619
 		{
1620 1620
 			$limit_array = explode(",", $limit);
1621 1621
 			
1622
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1623
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1622
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1623
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1624 1624
 			
1625 1625
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1626 1626
 			{
@@ -1662,14 +1662,14 @@  discard block
 block discarded – undo
1662 1662
 		$query_values = array();
1663 1663
 		$additional_query = '';
1664 1664
 		$limit_query = '';
1665
-		$filter_query = $this->getFilter($filters,true,true);
1665
+		$filter_query = $this->getFilter($filters, true, true);
1666 1666
 		if ($departure_airport_icao != "")
1667 1667
 		{
1668 1668
 			if (!is_string($departure_airport_icao))
1669 1669
 			{
1670 1670
 				return false;
1671 1671
 			} else {
1672
-				$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1672
+				$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1673 1673
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)";
1674 1674
 				//$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";
1675 1675
 				$query_values = array(':departure_airport_icao' => $departure_airport_icao);
@@ -1682,10 +1682,10 @@  discard block
 block discarded – undo
1682 1682
 			{
1683 1683
 				return false;
1684 1684
 			} else {
1685
-				$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1685
+				$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1686 1686
 				$additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)";
1687 1687
 				//$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)";
1688
-				$query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao));
1688
+				$query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao));
1689 1689
 			}
1690 1690
 		}
1691 1691
 		
@@ -1693,8 +1693,8 @@  discard block
 block discarded – undo
1693 1693
 		{
1694 1694
 			$limit_array = explode(",", $limit);
1695 1695
 			
1696
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1697
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1696
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1697
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1698 1698
 			
1699 1699
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1700 1700
 			{
@@ -1733,15 +1733,15 @@  discard block
 block discarded – undo
1733 1733
 		global $global_query;
1734 1734
 		
1735 1735
 		date_default_timezone_set('UTC');
1736
-		$filter_query = $this->getFilter($filter,true,true);
1736
+		$filter_query = $this->getFilter($filter, true, true);
1737 1737
 		$limit_query = '';
1738 1738
 		
1739 1739
 		if ($limit != "")
1740 1740
 		{
1741 1741
 			$limit_array = explode(",", $limit);
1742 1742
 			
1743
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1744
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1743
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1744
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1745 1745
 			
1746 1746
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1747 1747
 			{
@@ -1758,7 +1758,7 @@  discard block
 block discarded – undo
1758 1758
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1759 1759
 		}
1760 1760
 
1761
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1761
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1762 1762
 
1763 1763
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1764 1764
 
@@ -1771,19 +1771,19 @@  discard block
 block discarded – undo
1771 1771
 	* @return String the highlight text
1772 1772
 	*
1773 1773
 	*/
1774
-	public function getHighlightByRegistration($registration,$filter = array())
1774
+	public function getHighlightByRegistration($registration, $filter = array())
1775 1775
 	{
1776 1776
 		global $global_query;
1777 1777
 		
1778 1778
 		date_default_timezone_set('UTC');
1779
-		$filter_query = $this->getFilter($filter,true,true);
1780
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
1779
+		$filter_query = $this->getFilter($filter, true, true);
1780
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
1781 1781
 		
1782
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1782
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1783 1783
 		$sth = $this->db->prepare($query);
1784 1784
 		$sth->execute(array(':registration' => $registration));
1785 1785
 
1786
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1786
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1787 1787
 		{
1788 1788
 			$highlight = $row['highlight'];
1789 1789
 		}
@@ -1799,14 +1799,14 @@  discard block
 block discarded – undo
1799 1799
 	* @return String usage
1800 1800
 	*
1801 1801
 	*/
1802
-	public function getSquawkUsage($squawk = '',$country = 'FR')
1802
+	public function getSquawkUsage($squawk = '', $country = 'FR')
1803 1803
 	{
1804 1804
 		
1805
-		$squawk = filter_var($squawk,FILTER_SANITIZE_STRING);
1806
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
1805
+		$squawk = filter_var($squawk, FILTER_SANITIZE_STRING);
1806
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
1807 1807
 
1808 1808
 		$query  = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1";
1809
-		$query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country);
1809
+		$query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country);
1810 1810
 		
1811 1811
 		$sth = $this->db->prepare($query);
1812 1812
 		$sth->execute($query_values);
@@ -1828,9 +1828,9 @@  discard block
 block discarded – undo
1828 1828
 	public function getAirportIcao($airport_iata = '')
1829 1829
 	{
1830 1830
 		
1831
-		$airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING);
1831
+		$airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING);
1832 1832
 
1833
-		$query  = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1833
+		$query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1834 1834
 		$query_values = array(':airport' => $airport_iata);
1835 1835
 		
1836 1836
 		$sth = $this->db->prepare($query);
@@ -1852,12 +1852,12 @@  discard block
 block discarded – undo
1852 1852
 	* @return Float distance to the airport
1853 1853
 	*
1854 1854
 	*/
1855
-	public function getAirportDistance($airport_icao,$latitude,$longitude)
1855
+	public function getAirportDistance($airport_icao, $latitude, $longitude)
1856 1856
 	{
1857 1857
 		
1858
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
1858
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
1859 1859
 
1860
-		$query  = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
1860
+		$query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
1861 1861
 		$query_values = array(':airport' => $airport_icao);
1862 1862
 		$sth = $this->db->prepare($query);
1863 1863
 		$sth->execute($query_values);
@@ -1867,7 +1867,7 @@  discard block
 block discarded – undo
1867 1867
 			$airport_latitude = $row['latitude'];
1868 1868
 			$airport_longitude = $row['longitude'];
1869 1869
 			$Common = new Common();
1870
-			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
1870
+			return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude);
1871 1871
 		} else return '';
1872 1872
 	}
1873 1873
 	
@@ -1881,11 +1881,11 @@  discard block
 block discarded – undo
1881 1881
 	public function getAllAirportInfo($airport = '')
1882 1882
 	{
1883 1883
 		
1884
-		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
1884
+		$airport = filter_var($airport, FILTER_SANITIZE_STRING);
1885 1885
 
1886 1886
 		$query_values = array();
1887 1887
 		if ($airport == 'NA') {
1888
-			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' => ''));
1888
+			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' => ''));
1889 1889
 		} elseif ($airport == '') {
1890 1890
 			$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";
1891 1891
 		} else {
@@ -1933,14 +1933,14 @@  discard block
 block discarded – undo
1933 1933
 	{
1934 1934
 		$lst_countries = '';
1935 1935
 		foreach ($countries as $country) {
1936
-			$country = filter_var($country,FILTER_SANITIZE_STRING);
1936
+			$country = filter_var($country, FILTER_SANITIZE_STRING);
1937 1937
 			if ($lst_countries == '') {
1938 1938
 				$lst_countries = "'".$country."'";
1939 1939
 			} else {
1940 1940
 				$lst_countries .= ",'".$country."'";
1941 1941
 			}
1942 1942
 		}
1943
-		$query  = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
1943
+		$query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
1944 1944
 		
1945 1945
 		$sth = $this->db->prepare($query);
1946 1946
 		$sth->execute();
@@ -1948,7 +1948,7 @@  discard block
 block discarded – undo
1948 1948
 		$airport_array = array();
1949 1949
 		$temp_array = array();
1950 1950
 		
1951
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1951
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1952 1952
 		{
1953 1953
 			$temp_array['name'] = $row['name'];
1954 1954
 			$temp_array['city'] = $row['city'];
@@ -1976,10 +1976,10 @@  discard block
 block discarded – undo
1976 1976
 	{
1977 1977
 		global $globalDBdriver;
1978 1978
 		if (is_array($coord)) {
1979
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1980
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1981
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1982
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1979
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1980
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1981
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1982
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1983 1983
 		} else return array();
1984 1984
 		if ($globalDBdriver == 'mysql') {
1985 1985
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
@@ -1991,7 +1991,7 @@  discard block
 block discarded – undo
1991 1991
     
1992 1992
 		$airport_array = array();
1993 1993
 		
1994
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1994
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1995 1995
 		{
1996 1996
 			$temp_array = $row;
1997 1997
 
@@ -2011,13 +2011,13 @@  discard block
 block discarded – undo
2011 2011
 	public function getAllWaypointsInfobyCoord($coord)
2012 2012
 	{
2013 2013
 		if (is_array($coord)) {
2014
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2015
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2016
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2017
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2014
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2015
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2016
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2017
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2018 2018
 		} else return array();
2019 2019
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2020
-		$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.")";
2020
+		$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.")";
2021 2021
 		//$query  = "SELECT waypoints.* FROM waypoints";
2022 2022
 		//$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";
2023 2023
 		//$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;
@@ -2029,7 +2029,7 @@  discard block
 block discarded – undo
2029 2029
     
2030 2030
 		$waypoints_array = array();
2031 2031
 		
2032
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2032
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2033 2033
 		{
2034 2034
 			$temp_array = $row;
2035 2035
 
@@ -2051,10 +2051,10 @@  discard block
 block discarded – undo
2051 2051
 	{
2052 2052
 		global $globalUseRealAirlines;
2053 2053
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2054
-		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2054
+		$airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING));
2055 2055
 		if ($airline_icao == 'NA') {
2056 2056
 			$airline_array = array();
2057
-			$airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2057
+			$airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2058 2058
 			return $airline_array;
2059 2059
 		} else {
2060 2060
 			if (strlen($airline_icao) == 2) {
@@ -2075,7 +2075,7 @@  discard block
 block discarded – undo
2075 2075
 			if ($fromsource === NULL) {
2076 2076
 				$sth->execute(array(':airline_icao' => $airline_icao));
2077 2077
 			} else {
2078
-				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2078
+				$sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource));
2079 2079
 			}
2080 2080
                         /*
2081 2081
 			$airline_array = array();
@@ -2117,13 +2117,13 @@  discard block
 block discarded – undo
2117 2117
 	{
2118 2118
 		global $globalUseRealAirlines;
2119 2119
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2120
-		$airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING));
2121
-		$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";
2120
+		$airline_name = strtolower(filter_var($airline_name, FILTER_SANITIZE_STRING));
2121
+		$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";
2122 2122
 		$sth = $this->db->prepare($query);
2123 2123
 		if ($fromsource === NULL) {
2124 2124
 			$sth->execute(array(':airline_name' => $airline_name));
2125 2125
 		} else {
2126
-			$sth->execute(array(':airline_name' => $airline_name,':fromsource' => $fromsource));
2126
+			$sth->execute(array(':airline_name' => $airline_name, ':fromsource' => $fromsource));
2127 2127
 		}
2128 2128
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2129 2129
 		if (empty($result) && $fromsource !== NULL) {
@@ -2148,12 +2148,12 @@  discard block
 block discarded – undo
2148 2148
 	*/
2149 2149
 	public function getAllAircraftInfo($aircraft_type)
2150 2150
 	{
2151
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2151
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2152 2152
 
2153 2153
 		if ($aircraft_type == 'NA') {
2154
-			return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2154
+			return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2155 2155
 		}
2156
-		$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";
2156
+		$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";
2157 2157
 		
2158 2158
 		$sth = $this->db->prepare($query);
2159 2159
 		$sth->execute(array(':aircraft_type' => $aircraft_type));
@@ -2185,7 +2185,7 @@  discard block
 block discarded – undo
2185 2185
 	*/
2186 2186
 	public function getAircraftIcao($aircraft_type)
2187 2187
 	{
2188
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2188
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2189 2189
 		$all_aircraft = array('737-300' => 'B733',
2190 2190
 				'777-200' => 'B772',
2191 2191
 				'777-200ER' => 'B772',
@@ -2197,10 +2197,10 @@  discard block
 block discarded – undo
2197 2197
 				'A380' => 'A388');
2198 2198
 		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2199 2199
 
2200
-		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2200
+		$query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2201 2201
 		$aircraft_type = strtoupper($aircraft_type);
2202 2202
 		$sth = $this->db->prepare($query);
2203
-		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2203
+		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,));
2204 2204
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2205 2205
 		if (isset($result[0]['icao'])) return $result[0]['icao'];
2206 2206
 		else return '';
@@ -2215,9 +2215,9 @@  discard block
 block discarded – undo
2215 2215
 	*/
2216 2216
 	public function getAllAircraftType($aircraft_modes)
2217 2217
 	{
2218
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
2218
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
2219 2219
 
2220
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
2220
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
2221 2221
 		
2222 2222
 		$sth = $this->db->prepare($query);
2223 2223
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -2238,9 +2238,9 @@  discard block
 block discarded – undo
2238 2238
 	*/
2239 2239
 	public function getAllAircraftTypeByRegistration($registration)
2240 2240
 	{
2241
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2241
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2242 2242
 
2243
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1";
2243
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1";
2244 2244
 		
2245 2245
 		$sth = $this->db->prepare($query);
2246 2246
 		$sth->execute(array(':registration' => $registration));
@@ -2261,8 +2261,8 @@  discard block
 block discarded – undo
2261 2261
 	*/
2262 2262
 	public function getOperator($operator)
2263 2263
 	{
2264
-		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
2265
-		$query  = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2264
+		$operator = filter_var($operator, FILTER_SANITIZE_STRING);
2265
+		$query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2266 2266
 		
2267 2267
 		$sth = $this->db->prepare($query);
2268 2268
 		$sth->execute(array(':operator' => $operator));
@@ -2283,9 +2283,9 @@  discard block
 block discarded – undo
2283 2283
 	*/
2284 2284
 	public function getRouteInfo($callsign)
2285 2285
 	{
2286
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2286
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
2287 2287
                 if ($callsign == '') return array();
2288
-		$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";
2288
+		$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";
2289 2289
 		
2290 2290
 		$sth = $this->db->prepare($query);
2291 2291
 		$sth->execute(array(':callsign' => $callsign));
@@ -2306,9 +2306,9 @@  discard block
 block discarded – undo
2306 2306
 	*/
2307 2307
 	public function getAircraftInfoByRegistration($registration)
2308 2308
 	{
2309
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2309
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2310 2310
 
2311
-		$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";
2311
+		$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";
2312 2312
 		
2313 2313
 		$sth = $this->db->prepare($query);
2314 2314
 		$sth->execute(array(':registration' => $registration));
@@ -2316,7 +2316,7 @@  discard block
 block discarded – undo
2316 2316
 		$aircraft_array = array();
2317 2317
 		$temp_array = array();
2318 2318
 		
2319
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2319
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2320 2320
 		{
2321 2321
 			$temp_array['airline_icao'] = $row['airline_icao'];
2322 2322
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -2338,7 +2338,7 @@  discard block
 block discarded – undo
2338 2338
 	*/
2339 2339
 	public function getAircraftOwnerByRegistration($registration)
2340 2340
 	{
2341
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2341
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2342 2342
 		$Connection = new Connection($this->db);
2343 2343
 		if ($Connection->tableExists('aircraft_owner')) {
2344 2344
 			$query  = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1";
@@ -2360,7 +2360,7 @@  discard block
 block discarded – undo
2360 2360
 	public function getAllFlightsforSitemap()
2361 2361
 	{
2362 2362
 		//$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 ";
2363
-		$query  = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2363
+		$query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2364 2364
 		
2365 2365
 		$sth = $this->db->prepare($query);
2366 2366
 		$sth->execute();
@@ -2407,7 +2407,7 @@  discard block
 block discarded – undo
2407 2407
 		$manufacturer_array = array();
2408 2408
 		$temp_array = array();
2409 2409
 		
2410
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2410
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2411 2411
 		{
2412 2412
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
2413 2413
 
@@ -2444,7 +2444,7 @@  discard block
 block discarded – undo
2444 2444
 		$aircraft_array = array();
2445 2445
 		$temp_array = array();
2446 2446
 		
2447
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2447
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2448 2448
 		{
2449 2449
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
2450 2450
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
@@ -2465,8 +2465,8 @@  discard block
 block discarded – undo
2465 2465
 	*/
2466 2466
 	public function getAllAircraftRegistrations($filters = array())
2467 2467
 	{
2468
-		$filter_query = $this->getFilter($filters,true,true);
2469
-		$query  = "SELECT DISTINCT spotter_output.registration 
2468
+		$filter_query = $this->getFilter($filters, true, true);
2469
+		$query = "SELECT DISTINCT spotter_output.registration 
2470 2470
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' 
2471 2471
 				ORDER BY spotter_output.registration ASC";
2472 2472
 
@@ -2476,7 +2476,7 @@  discard block
 block discarded – undo
2476 2476
 		$aircraft_array = array();
2477 2477
 		$temp_array = array();
2478 2478
 		
2479
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2479
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2480 2480
 		{
2481 2481
 			$temp_array['registration'] = $row['registration'];
2482 2482
 
@@ -2493,11 +2493,11 @@  discard block
 block discarded – undo
2493 2493
 	* @return Array list of source name
2494 2494
 	*
2495 2495
 	*/
2496
-	public function getAllSourceName($type = '',$filters = array())
2496
+	public function getAllSourceName($type = '', $filters = array())
2497 2497
 	{
2498
-		$filter_query = $this->getFilter($filters,true,true);
2498
+		$filter_query = $this->getFilter($filters, true, true);
2499 2499
 		$query_values = array();
2500
-		$query  = "SELECT DISTINCT spotter_output.source_name 
2500
+		$query = "SELECT DISTINCT spotter_output.source_name 
2501 2501
 				FROM spotter_output".$filter_query." spotter_output.source_name <> ''";
2502 2502
 		if ($type != '') {
2503 2503
 			$query_values = array(':type' => $type);
@@ -2512,7 +2512,7 @@  discard block
 block discarded – undo
2512 2512
 		$source_array = array();
2513 2513
 		$temp_array = array();
2514 2514
 		
2515
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2515
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2516 2516
 		{
2517 2517
 			$temp_array['source_name'] = $row['source_name'];
2518 2518
 			$source_array[] = $temp_array;
@@ -2528,11 +2528,11 @@  discard block
 block discarded – undo
2528 2528
 	* @return Array list of airline names
2529 2529
 	*
2530 2530
 	*/
2531
-	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2531
+	public function getAllAirlineNames($airline_type = '', $forsource = NULL, $filters = array())
2532 2532
 	{
2533
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2534
-		$filter_query = $this->getFilter($filters,true,true);
2535
-		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
2533
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2534
+		$filter_query = $this->getFilter($filters, true, true);
2535
+		$airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
2536 2536
 		if ($airline_type == '' || $airline_type == 'all') {
2537 2537
 			/*
2538 2538
 			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
@@ -2551,7 +2551,7 @@  discard block
 block discarded – undo
2551 2551
 				$query_data = array(':forsource' => $forsource);
2552 2552
 			}
2553 2553
 		} else {
2554
-			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2554
+			$query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2555 2555
 					FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
2556 2556
 					AND spotter_output.airline_type = :airline_type 
2557 2557
 					ORDER BY spotter_output.airline_icao ASC";
@@ -2564,7 +2564,7 @@  discard block
 block discarded – undo
2564 2564
 		$airline_array = array();
2565 2565
 		$temp_array = array();
2566 2566
 		
2567
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2567
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2568 2568
 		{
2569 2569
 			$temp_array['airline_icao'] = $row['airline_icao'];
2570 2570
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -2584,8 +2584,8 @@  discard block
 block discarded – undo
2584 2584
 	*/
2585 2585
 	public function getAllAirlineCountries($filters = array())
2586 2586
 	{
2587
-		$filter_query = $this->getFilter($filters,true,true);
2588
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2587
+		$filter_query = $this->getFilter($filters, true, true);
2588
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2589 2589
 				FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2590 2590
 				ORDER BY spotter_output.airline_country ASC";
2591 2591
 		
@@ -2596,7 +2596,7 @@  discard block
 block discarded – undo
2596 2596
 		$airline_array = array();
2597 2597
 		$temp_array = array();
2598 2598
 		
2599
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2599
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2600 2600
 		{
2601 2601
 			$temp_array['airline_country'] = $row['airline_country'];
2602 2602
 
@@ -2616,9 +2616,9 @@  discard block
 block discarded – undo
2616 2616
 	*/
2617 2617
 	public function getAllAirportNames($filters = array())
2618 2618
 	{
2619
-		$filter_query = $this->getFilter($filters,true,true);
2619
+		$filter_query = $this->getFilter($filters, true, true);
2620 2620
 		$airport_array = array();
2621
-		$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
2621
+		$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
2622 2622
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' 
2623 2623
 				ORDER BY spotter_output.departure_airport_city ASC";
2624 2624
 		
@@ -2627,7 +2627,7 @@  discard block
 block discarded – undo
2627 2627
 		$sth->execute();
2628 2628
 
2629 2629
 		$temp_array = array();
2630
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2630
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2631 2631
 		{
2632 2632
 			$temp_array['airport_icao'] = $row['airport_icao'];
2633 2633
 			$temp_array['airport_name'] = $row['airport_name'];
@@ -2637,14 +2637,14 @@  discard block
 block discarded – undo
2637 2637
 			$airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array;
2638 2638
 		}
2639 2639
 
2640
-		$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
2640
+		$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
2641 2641
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' 
2642 2642
 								ORDER BY spotter_output.arrival_airport_city ASC";
2643 2643
 					
2644 2644
 		$sth = $this->db->prepare($query);
2645 2645
 		$sth->execute();
2646 2646
 
2647
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2647
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2648 2648
 			{
2649 2649
 		//	if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao'])
2650 2650
 		//	{
@@ -2684,21 +2684,21 @@  discard block
 block discarded – undo
2684 2684
    
2685 2685
 		$temp_array = array();
2686 2686
 		
2687
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2687
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2688 2688
 		{
2689 2689
 			$temp_array['airport_country'] = $row['airport_country'];
2690 2690
 
2691 2691
 			$airport_array[$row['airport_country']] = $temp_array;
2692 2692
 		}
2693
-		$filter_query = $this->getFilter($filters,true,true);
2694
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2693
+		$filter_query = $this->getFilter($filters, true, true);
2694
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2695 2695
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2696 2696
 								ORDER BY spotter_output.arrival_airport_country ASC";
2697 2697
 					
2698 2698
 		$sth = $this->db->prepare($query);
2699 2699
 		$sth->execute();
2700 2700
 		
2701
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2701
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2702 2702
 		{
2703 2703
 			if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country'])
2704 2704
 			{
@@ -2721,9 +2721,9 @@  discard block
 block discarded – undo
2721 2721
 	*/
2722 2722
 	public function getAllCountries($filters = array())
2723 2723
 	{
2724
-		$Connection= new Connection($this->db);
2724
+		$Connection = new Connection($this->db);
2725 2725
 		if ($Connection->tableExists('countries')) {
2726
-			$query  = "SELECT countries.name AS airport_country
2726
+			$query = "SELECT countries.name AS airport_country
2727 2727
 				FROM countries
2728 2728
 				ORDER BY countries.name ASC";
2729 2729
 			$sth = $this->db->prepare($query);
@@ -2732,14 +2732,14 @@  discard block
 block discarded – undo
2732 2732
 			$temp_array = array();
2733 2733
 			$country_array = array();
2734 2734
 		
2735
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2735
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2736 2736
 			{
2737 2737
 				$temp_array['country'] = $row['airport_country'];
2738 2738
 				$country_array[$row['airport_country']] = $temp_array;
2739 2739
 			}
2740 2740
 		} else {
2741
-			$filter_query = $this->getFilter($filters,true,true);
2742
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2741
+			$filter_query = $this->getFilter($filters, true, true);
2742
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2743 2743
 								FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' 
2744 2744
 								ORDER BY spotter_output.departure_airport_country ASC";
2745 2745
 
@@ -2748,20 +2748,20 @@  discard block
 block discarded – undo
2748 2748
    
2749 2749
 			$temp_array = array();
2750 2750
 			$country_array = array();
2751
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2751
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2752 2752
 			{
2753 2753
 				$temp_array['country'] = $row['airport_country'];
2754 2754
 				$country_array[$row['airport_country']] = $temp_array;
2755 2755
 			}
2756 2756
 
2757
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2757
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2758 2758
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2759 2759
 								ORDER BY spotter_output.arrival_airport_country ASC";
2760 2760
 					
2761 2761
 		$sth = $this->db->prepare($query);
2762 2762
 		$sth->execute();
2763 2763
 		
2764
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2764
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2765 2765
 		{
2766 2766
 			if ($country_array[$row['airport_country']]['country'] != $row['airport_country'])
2767 2767
 			{
@@ -2771,14 +2771,14 @@  discard block
 block discarded – undo
2771 2771
 			}
2772 2772
 		}
2773 2773
 		
2774
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2774
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2775 2775
 								FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2776 2776
 								ORDER BY spotter_output.airline_country ASC";
2777 2777
 					
2778 2778
 		$sth = $this->db->prepare($query);
2779 2779
 		$sth->execute();
2780 2780
 		
2781
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2781
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2782 2782
 		{
2783 2783
 			if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country'])
2784 2784
 			{
@@ -2802,8 +2802,8 @@  discard block
 block discarded – undo
2802 2802
 	*/
2803 2803
 	public function getAllIdents($filters = array())
2804 2804
 	{
2805
-		$filter_query = $this->getFilter($filters,true,true);
2806
-		$query  = "SELECT DISTINCT spotter_output.ident
2805
+		$filter_query = $this->getFilter($filters, true, true);
2806
+		$query = "SELECT DISTINCT spotter_output.ident
2807 2807
 								FROM spotter_output".$filter_query." spotter_output.ident <> '' 
2808 2808
 								ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0";
2809 2809
 
@@ -2813,7 +2813,7 @@  discard block
 block discarded – undo
2813 2813
 		$ident_array = array();
2814 2814
 		$temp_array = array();
2815 2815
 		
2816
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2816
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2817 2817
 		{
2818 2818
 			$temp_array['ident'] = $row['ident'];
2819 2819
 			$ident_array[] = $temp_array;
@@ -2827,9 +2827,9 @@  discard block
 block discarded – undo
2827 2827
 	* @return Array number, icao, name and city of airports
2828 2828
 	*/
2829 2829
 
2830
-	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
2830
+	public function getLast7DaysAirportsDeparture($airport_icao = '', $filters = array()) {
2831 2831
 		global $globalTimezone, $globalDBdriver;
2832
-		$filter_query = $this->getFilter($filters,true,true);
2832
+		$filter_query = $this->getFilter($filters, true, true);
2833 2833
 		if ($globalTimezone != '') {
2834 2834
 			date_default_timezone_set($globalTimezone);
2835 2835
 			$datetime = new DateTime();
@@ -2894,7 +2894,7 @@  discard block
 block discarded – undo
2894 2894
 
2895 2895
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
2896 2896
 		global $globalTimezone, $globalDBdriver;
2897
-		$filter_query = $this->getFilter($filters,true,true);
2897
+		$filter_query = $this->getFilter($filters, true, true);
2898 2898
 		if ($globalTimezone != '') {
2899 2899
 			date_default_timezone_set($globalTimezone);
2900 2900
 			$datetime = new DateTime();
@@ -2978,7 +2978,7 @@  discard block
 block discarded – undo
2978 2978
 
2979 2979
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
2980 2980
 		global $globalTimezone, $globalDBdriver;
2981
-		$filter_query = $this->getFilter($filters,true,true);
2981
+		$filter_query = $this->getFilter($filters, true, true);
2982 2982
 		if ($globalTimezone != '') {
2983 2983
 			date_default_timezone_set($globalTimezone);
2984 2984
 			$datetime = new DateTime();
@@ -3011,9 +3011,9 @@  discard block
 block discarded – undo
3011 3011
 	* @return Array number, icao, name and city of airports
3012 3012
 	*/
3013 3013
 
3014
-	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3014
+	public function getLast7DaysDetectedAirportsArrival($airport_icao = '', $filters = array()) {
3015 3015
 		global $globalTimezone, $globalDBdriver;
3016
-		$filter_query = $this->getFilter($filters,true,true);
3016
+		$filter_query = $this->getFilter($filters, true, true);
3017 3017
 		if ($globalTimezone != '') {
3018 3018
 			date_default_timezone_set($globalTimezone);
3019 3019
 			$datetime = new DateTime();
@@ -3145,12 +3145,12 @@  discard block
 block discarded – undo
3145 3145
 		} else $offset = '+00:00';
3146 3146
 
3147 3147
 		if ($globalDBdriver == 'mysql') {
3148
-			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3148
+			$query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3149 3149
 								FROM spotter_output
3150 3150
 								WHERE spotter_output.date <> '' 
3151 3151
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
3152 3152
 		} else {
3153
-			$query  = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3153
+			$query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3154 3154
 								FROM spotter_output
3155 3155
 								WHERE spotter_output.date <> '' 
3156 3156
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
@@ -3162,7 +3162,7 @@  discard block
 block discarded – undo
3162 3162
 		$date_array = array();
3163 3163
 		$temp_array = array();
3164 3164
 		
3165
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3165
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3166 3166
 		{
3167 3167
 			$temp_array['date'] = $row['date'];
3168 3168
 
@@ -3182,7 +3182,7 @@  discard block
 block discarded – undo
3182 3182
 	*/
3183 3183
 	public function getAllRoutes()
3184 3184
 	{
3185
-		$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 
3185
+		$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 
3186 3186
 				FROM spotter_output
3187 3187
 				WHERE spotter_output.ident <> '' 
3188 3188
 				GROUP BY route
@@ -3193,7 +3193,7 @@  discard block
 block discarded – undo
3193 3193
 
3194 3194
 		$routes_array = array();
3195 3195
 		$temp_array = array();
3196
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3196
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3197 3197
 		{
3198 3198
 			$temp_array['route'] = $row['route'];
3199 3199
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -3212,21 +3212,21 @@  discard block
 block discarded – undo
3212 3212
 	* @return String success or false
3213 3213
 	*
3214 3214
 	*/	
3215
-	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3215
+	public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL)
3216 3216
 	{
3217 3217
 		if (!is_numeric(substr($ident, 0, 3)))
3218 3218
 		{
3219 3219
 			if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3220
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3220
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3221 3221
 			} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3222
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3222
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3223 3223
 			} else {
3224 3224
 				$airline_array = $this->getAllAirlineInfo("NA");
3225 3225
 			}
3226 3226
 			if (count($airline_array) == 0) {
3227 3227
 				$airline_array = $this->getAllAirlineInfo("NA");
3228 3228
 			}
3229
-			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3229
+			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3230 3230
 				$airline_array = $this->getAllAirlineInfo("NA");
3231 3231
 			}
3232 3232
 		} else {
@@ -3239,7 +3239,7 @@  discard block
 block discarded – undo
3239 3239
 
3240 3240
 
3241 3241
 		$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';
3242
-                $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);
3242
+                $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);
3243 3243
 
3244 3244
 		try {
3245 3245
 			$sth = $this->db->prepare($query);
@@ -3260,11 +3260,11 @@  discard block
 block discarded – undo
3260 3260
 	* @return String success or false
3261 3261
 	*
3262 3262
 	*/	
3263
-	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3263
+	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '')
3264 3264
 	{
3265 3265
 		if ($groundspeed == '') $groundspeed = NULL;
3266 3266
 		$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';
3267
-                $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);
3267
+                $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);
3268 3268
 
3269 3269
 		try {
3270 3270
 			$sth = $this->db->prepare($query);
@@ -3304,7 +3304,7 @@  discard block
 block discarded – undo
3304 3304
 	* @param String $verticalrate vertival rate of flight
3305 3305
 	* @return String success or false
3306 3306
 	*/
3307
-	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 = '')
3307
+	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 = '')
3308 3308
 	{
3309 3309
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
3310 3310
 		
@@ -3328,13 +3328,13 @@  discard block
 block discarded – undo
3328 3328
 				if ($ModeS != '') {
3329 3329
 					$timeelapsed = microtime(true);
3330 3330
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3331
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3331
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3332 3332
 				} else {
3333
-					$myhex = explode('-',$flightaware_id);
3333
+					$myhex = explode('-', $flightaware_id);
3334 3334
 					if (count($myhex) > 0) {
3335 3335
 						$timeelapsed = microtime(true);
3336 3336
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3337
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3337
+						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3338 3338
 					}
3339 3339
 				}
3340 3340
 			}
@@ -3356,24 +3356,24 @@  discard block
 block discarded – undo
3356 3356
 				{
3357 3357
 					$timeelapsed = microtime(true);
3358 3358
 					if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3359
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3359
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3360 3360
 					} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3361
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3361
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3362 3362
 					} else {
3363 3363
 						$airline_array = $this->getAllAirlineInfo("NA");
3364 3364
 					}
3365 3365
 					if (count($airline_array) == 0) {
3366 3366
 						$airline_array = $this->getAllAirlineInfo("NA");
3367 3367
 					}
3368
-					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3368
+					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3369 3369
 						$airline_array = $this->getAllAirlineInfo("NA");
3370 3370
 					}
3371
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3371
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3372 3372
 
3373 3373
 				} else {
3374 3374
 					$timeelapsed = microtime(true);
3375 3375
 					$airline_array = $this->getAllAirlineInfo("NA");
3376
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3376
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3377 3377
 				}
3378 3378
 			}
3379 3379
 		} else $airline_array = array();
@@ -3390,27 +3390,27 @@  discard block
 block discarded – undo
3390 3390
 				{
3391 3391
 					$timeelapsed = microtime(true);
3392 3392
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3393
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3393
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3394 3394
 				} else {
3395 3395
 					$timeelapsed = microtime(true);
3396 3396
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3397
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3397
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3398 3398
 				}
3399 3399
 			}
3400 3400
 		} else {
3401 3401
 			if ($ModeS != '') {
3402 3402
 				$timeelapsed = microtime(true);
3403 3403
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3404
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3404
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3405 3405
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3406 3406
 				{
3407 3407
 					$timeelapsed = microtime(true);
3408 3408
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3409
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3409
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3410 3410
 				} else {
3411 3411
 					$timeelapsed = microtime(true);
3412 3412
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3413
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3413
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3414 3414
 				}
3415 3415
 			}
3416 3416
 		}
@@ -3426,7 +3426,7 @@  discard block
 block discarded – undo
3426 3426
 			} else {
3427 3427
 				$timeelapsed = microtime(true);
3428 3428
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3429
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3429
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3430 3430
 			}
3431 3431
 		}
3432 3432
 		
@@ -3441,7 +3441,7 @@  discard block
 block discarded – undo
3441 3441
 			} else {
3442 3442
 				$timeelapsed = microtime(true);
3443 3443
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3444
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3444
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3445 3445
 			}
3446 3446
 		}
3447 3447
 
@@ -3504,7 +3504,7 @@  discard block
 block discarded – undo
3504 3504
 		{
3505 3505
 			$timeelapsed = microtime(true);
3506 3506
 			$image_array = $Image->getSpotterImage($registration);
3507
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3507
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3508 3508
 			if (!isset($image_array[0]['registration']))
3509 3509
 			{
3510 3510
 				//echo "Add image !!!! \n";
@@ -3512,7 +3512,7 @@  discard block
 block discarded – undo
3512 3512
 			}
3513 3513
 			$timeelapsed = microtime(true);
3514 3514
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3515
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3515
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3516 3516
 			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3517 3517
 		}
3518 3518
     
@@ -3520,33 +3520,33 @@  discard block
 block discarded – undo
3520 3520
 		{
3521 3521
             		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3522 3522
             		else $airline_icao = '';
3523
-			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3523
+			$image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao);
3524 3524
 			if (!isset($image_array[0]['registration']))
3525 3525
 			{
3526 3526
 				//echo "Add image !!!! \n";
3527
-				$Image->addSpotterImage('',$aircraft_icao,$airline_icao);
3527
+				$Image->addSpotterImage('', $aircraft_icao, $airline_icao);
3528 3528
 			}
3529 3529
 		}
3530 3530
     
3531
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
3532
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
3533
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
3534
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3535
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
3536
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
3537
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3538
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3539
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
3540
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3541
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
3542
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3543
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
3544
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
3545
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
3546
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
3547
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
3548
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
3549
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
3531
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
3532
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
3533
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
3534
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3535
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
3536
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
3537
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3538
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3539
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
3540
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3541
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
3542
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3543
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
3544
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
3545
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
3546
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
3547
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
3548
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
3549
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
3550 3550
 	
3551 3551
 		if (count($airline_array) == 0) 
3552 3552
 		{
@@ -3574,7 +3574,7 @@  discard block
 block discarded – undo
3574 3574
                 if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3575 3575
                 if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3576 3576
                 if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3577
-                $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) 
3577
+                $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) 
3578 3578
                 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)";
3579 3579
 
3580 3580
                 $airline_name = $airline_array[0]['name'];
@@ -3584,7 +3584,7 @@  discard block
 block discarded – undo
3584 3584
 		if ($airline_type == '') {
3585 3585
 			$timeelapsed = microtime(true);
3586 3586
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3587
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3587
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3588 3588
 		}
3589 3589
 		if ($airline_type == null) $airline_type = '';
3590 3590
                 $aircraft_type = $aircraft_array[0]['type'];
@@ -3596,7 +3596,7 @@  discard block
 block discarded – undo
3596 3596
                 $arrival_airport_name = $arrival_airport_array[0]['name'];
3597 3597
                 $arrival_airport_city = $arrival_airport_array[0]['city'];
3598 3598
                 $arrival_airport_country = $arrival_airport_array[0]['country'];
3599
-                $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);
3599
+                $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);
3600 3600
 
3601 3601
 		try {
3602 3602
 		        
@@ -3622,13 +3622,13 @@  discard block
 block discarded – undo
3622 3622
 	{
3623 3623
 		global $globalDBdriver, $globalTimezone;
3624 3624
 		if ($globalDBdriver == 'mysql') {
3625
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3625
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3626 3626
 								WHERE spotter_output.ident = :ident 
3627 3627
 								AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
3628 3628
 								AND spotter_output.date < UTC_TIMESTAMP()";
3629 3629
 			$query_data = array(':ident' => $ident);
3630 3630
 		} else {
3631
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3631
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3632 3632
 								WHERE spotter_output.ident = :ident 
3633 3633
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3634 3634
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
@@ -3637,8 +3637,8 @@  discard block
 block discarded – undo
3637 3637
 		
3638 3638
 		$sth = $this->db->prepare($query);
3639 3639
 		$sth->execute($query_data);
3640
-    		$ident_result='';
3641
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3640
+    		$ident_result = '';
3641
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3642 3642
 		{
3643 3643
 			$ident_result = $row['ident'];
3644 3644
 		}
@@ -3664,8 +3664,8 @@  discard block
 block discarded – undo
3664 3664
 				return false;
3665 3665
 			} else {
3666 3666
 				$q_array = explode(" ", $q);
3667
-				foreach ($q_array as $q_item){
3668
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
3667
+				foreach ($q_array as $q_item) {
3668
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
3669 3669
 					$additional_query .= " AND (";
3670 3670
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
3671 3671
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
@@ -3680,11 +3680,11 @@  discard block
 block discarded – undo
3680 3680
 			}
3681 3681
 		}
3682 3682
 		if ($globalDBdriver == 'mysql') {
3683
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3683
+			$query = "SELECT spotter_output.* FROM spotter_output 
3684 3684
 				WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
3685 3685
 				AND spotter_output.date < UTC_TIMESTAMP()";
3686 3686
 		} else {
3687
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3687
+			$query = "SELECT spotter_output.* FROM spotter_output 
3688 3688
 				WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
3689 3689
 				AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
3690 3690
 		}
@@ -3701,11 +3701,11 @@  discard block
 block discarded – undo
3701 3701
 	* @return Array the airline list
3702 3702
 	*
3703 3703
 	*/
3704
-	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3704
+	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3705 3705
 	{
3706 3706
 		global $globalDBdriver;
3707
-		$filter_query = $this->getFilter($filters,true,true);
3708
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3707
+		$filter_query = $this->getFilter($filters, true, true);
3708
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3709 3709
 		 			FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA' ";
3710 3710
 		if ($olderthanmonths > 0) {
3711 3711
 			if ($globalDBdriver == 'mysql') {
@@ -3729,7 +3729,7 @@  discard block
 block discarded – undo
3729 3729
  
3730 3730
 		$airline_array = array();
3731 3731
 		$temp_array = array();
3732
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3732
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3733 3733
 		{
3734 3734
 			$temp_array['airline_name'] = $row['airline_name'];
3735 3735
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3746,11 +3746,11 @@  discard block
 block discarded – undo
3746 3746
 	* @return Array the pilots list
3747 3747
 	*
3748 3748
 	*/
3749
-	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3749
+	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3750 3750
 	{
3751 3751
 		global $globalDBdriver;
3752
-		$filter_query = $this->getFilter($filters,true,true);
3753
-		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3752
+		$filter_query = $this->getFilter($filters, true, true);
3753
+		$query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3754 3754
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3755 3755
                 if ($olderthanmonths > 0) {
3756 3756
             		if ($globalDBdriver == 'mysql') {
@@ -3776,7 +3776,7 @@  discard block
 block discarded – undo
3776 3776
 		$airline_array = array();
3777 3777
 		$temp_array = array();
3778 3778
         
3779
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3779
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3780 3780
 		{
3781 3781
 			$temp_array['pilot_name'] = $row['pilot_name'];
3782 3782
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -3796,7 +3796,7 @@  discard block
 block discarded – undo
3796 3796
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3797 3797
 	{
3798 3798
 		global $globalDBdriver;
3799
-		$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
3799
+		$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
3800 3800
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
3801 3801
                 if ($olderthanmonths > 0) {
3802 3802
             		if ($globalDBdriver == 'mysql') {
@@ -3822,7 +3822,7 @@  discard block
 block discarded – undo
3822 3822
 		$airline_array = array();
3823 3823
 		$temp_array = array();
3824 3824
         
3825
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3825
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3826 3826
 		{
3827 3827
 			$temp_array['pilot_name'] = $row['pilot_name'];
3828 3828
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -3840,11 +3840,11 @@  discard block
 block discarded – undo
3840 3840
 	* @return Array the pilots list
3841 3841
 	*
3842 3842
 	*/
3843
-	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3843
+	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3844 3844
 	{
3845 3845
 		global $globalDBdriver;
3846
-		$filter_query = $this->getFilter($filters,true,true);
3847
-		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3846
+		$filter_query = $this->getFilter($filters, true, true);
3847
+		$query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3848 3848
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3849 3849
                 if ($olderthanmonths > 0) {
3850 3850
             		if ($globalDBdriver == 'mysql') {
@@ -3870,7 +3870,7 @@  discard block
 block discarded – undo
3870 3870
 		$airline_array = array();
3871 3871
 		$temp_array = array();
3872 3872
         
3873
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3873
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3874 3874
 		{
3875 3875
 			$temp_array['owner_name'] = $row['owner_name'];
3876 3876
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -3885,11 +3885,11 @@  discard block
 block discarded – undo
3885 3885
 	* @return Array the pilots list
3886 3886
 	*
3887 3887
 	*/
3888
-	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3888
+	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3889 3889
 	{
3890 3890
 		global $globalDBdriver;
3891
-		$filter_query = $this->getFilter($filters,true,true);
3892
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3891
+		$filter_query = $this->getFilter($filters, true, true);
3892
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3893 3893
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3894 3894
                 if ($olderthanmonths > 0) {
3895 3895
             		if ($globalDBdriver == 'mysql') {
@@ -3915,7 +3915,7 @@  discard block
 block discarded – undo
3915 3915
 		$airline_array = array();
3916 3916
 		$temp_array = array();
3917 3917
         
3918
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3918
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3919 3919
 		{
3920 3920
 			$temp_array['owner_name'] = $row['owner_name'];
3921 3921
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -3931,11 +3931,11 @@  discard block
 block discarded – undo
3931 3931
 	* @return Array the airline list
3932 3932
 	*
3933 3933
 	*/
3934
-	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
3934
+	public function countAllAirlinesByAircraft($aircraft_icao, $filters = array())
3935 3935
 	{
3936
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3937
-		$filter_query = $this->getFilter($filters,true,true);
3938
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3936
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3937
+		$filter_query = $this->getFilter($filters, true, true);
3938
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3939 3939
 		 	    FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
3940 3940
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
3941 3941
 			    ORDER BY airline_count DESC";
@@ -3947,7 +3947,7 @@  discard block
 block discarded – undo
3947 3947
 		$airline_array = array();
3948 3948
 		$temp_array = array();
3949 3949
         
3950
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3950
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3951 3951
 		{
3952 3952
 			$temp_array['airline_name'] = $row['airline_name'];
3953 3953
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3967,11 +3967,11 @@  discard block
 block discarded – undo
3967 3967
 	* @return Array the airline country list
3968 3968
 	*
3969 3969
 	*/
3970
-	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
3970
+	public function countAllAirlineCountriesByAircraft($aircraft_icao, $filters = array())
3971 3971
 	{
3972
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3973
-		$filter_query = $this->getFilter($filters,true,true);
3974
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3972
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3973
+		$filter_query = $this->getFilter($filters, true, true);
3974
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3975 3975
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
3976 3976
                     GROUP BY spotter_output.airline_country
3977 3977
 					ORDER BY airline_country_count DESC
@@ -3984,7 +3984,7 @@  discard block
 block discarded – undo
3984 3984
 		$airline_country_array = array();
3985 3985
 		$temp_array = array();
3986 3986
         
3987
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3987
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3988 3988
 		{
3989 3989
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
3990 3990
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4003,11 +4003,11 @@  discard block
 block discarded – undo
4003 4003
 	* @return Array the airline list
4004 4004
 	*
4005 4005
 	*/
4006
-	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4006
+	public function countAllAirlinesByAirport($airport_icao, $filters = array())
4007 4007
 	{
4008
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4009
-		$filter_query = $this->getFilter($filters,true,true);
4010
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4008
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4009
+		$filter_query = $this->getFilter($filters, true, true);
4010
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4011 4011
 		    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 ) 
4012 4012
                     GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country
4013 4013
 		    ORDER BY airline_count DESC";
@@ -4019,7 +4019,7 @@  discard block
 block discarded – undo
4019 4019
 		$airline_array = array();
4020 4020
 		$temp_array = array();
4021 4021
         
4022
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4022
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4023 4023
 		{
4024 4024
 			$temp_array['airline_name'] = $row['airline_name'];
4025 4025
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4038,11 +4038,11 @@  discard block
 block discarded – undo
4038 4038
 	* @return Array the airline country list
4039 4039
 	*
4040 4040
 	*/
4041
-	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4041
+	public function countAllAirlineCountriesByAirport($airport_icao, $filters = array())
4042 4042
 	{
4043
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4044
-		$filter_query = $this->getFilter($filters,true,true);
4045
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4043
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4044
+		$filter_query = $this->getFilter($filters, true, true);
4045
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4046 4046
 		 			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 )
4047 4047
 					GROUP BY spotter_output.airline_country
4048 4048
 					ORDER BY airline_country_count DESC
@@ -4055,7 +4055,7 @@  discard block
 block discarded – undo
4055 4055
 		$airline_country_array = array();
4056 4056
 		$temp_array = array();
4057 4057
         
4058
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4058
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4059 4059
 		{
4060 4060
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4061 4061
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4072,11 +4072,11 @@  discard block
 block discarded – undo
4072 4072
 	* @return Array the airline list
4073 4073
 	*
4074 4074
 	*/
4075
-	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4075
+	public function countAllAirlinesByManufacturer($aircraft_manufacturer, $filters = array())
4076 4076
 	{
4077
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4078
-		$filter_query = $this->getFilter($filters,true,true);
4079
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4077
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4078
+		$filter_query = $this->getFilter($filters, true, true);
4079
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4080 4080
 		 			FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4081 4081
 					GROUP BY spotter_output.airline_name
4082 4082
 					ORDER BY airline_count DESC";
@@ -4087,7 +4087,7 @@  discard block
 block discarded – undo
4087 4087
 		$airline_array = array();
4088 4088
 		$temp_array = array();
4089 4089
         
4090
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4090
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4091 4091
 		{
4092 4092
 			$temp_array['airline_name'] = $row['airline_name'];
4093 4093
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4107,11 +4107,11 @@  discard block
 block discarded – undo
4107 4107
 	* @return Array the airline country list
4108 4108
 	*
4109 4109
 	*/
4110
-	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4110
+	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer, $filters = array())
4111 4111
 	{
4112
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4113
-		$filter_query = $this->getFilter($filters,true,true);
4114
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4112
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4113
+		$filter_query = $this->getFilter($filters, true, true);
4114
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4115 4115
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4116 4116
 					GROUP BY spotter_output.airline_country
4117 4117
 					ORDER BY airline_country_count DESC
@@ -4124,7 +4124,7 @@  discard block
 block discarded – undo
4124 4124
 		$airline_country_array = array();
4125 4125
 		$temp_array = array();
4126 4126
         
4127
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4127
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4128 4128
 		{
4129 4129
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4130 4130
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4140,11 +4140,11 @@  discard block
 block discarded – undo
4140 4140
 	* @return Array the airline list
4141 4141
 	*
4142 4142
 	*/
4143
-	public function countAllAirlinesByDate($date,$filters = array())
4143
+	public function countAllAirlinesByDate($date, $filters = array())
4144 4144
 	{
4145 4145
 		global $globalTimezone, $globalDBdriver;
4146
-		$filter_query = $this->getFilter($filters,true,true);
4147
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4146
+		$filter_query = $this->getFilter($filters, true, true);
4147
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4148 4148
 		if ($globalTimezone != '') {
4149 4149
 			date_default_timezone_set($globalTimezone);
4150 4150
 			$datetime = new DateTime($date);
@@ -4152,12 +4152,12 @@  discard block
 block discarded – undo
4152 4152
 		} else $offset = '+00:00';
4153 4153
 
4154 4154
 		if ($globalDBdriver == 'mysql') {
4155
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4155
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4156 4156
 		 			FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4157 4157
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country 
4158 4158
 					ORDER BY airline_count DESC";
4159 4159
 		} else {
4160
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4160
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4161 4161
 		 			FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4162 4162
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country
4163 4163
 					ORDER BY airline_count DESC";
@@ -4168,7 +4168,7 @@  discard block
 block discarded – undo
4168 4168
 
4169 4169
 		$airline_array = array();
4170 4170
 		$temp_array = array();
4171
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4171
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4172 4172
 		{
4173 4173
 			$temp_array['airline_name'] = $row['airline_name'];
4174 4174
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4188,11 +4188,11 @@  discard block
 block discarded – undo
4188 4188
 	* @return Array the airline country list
4189 4189
 	*
4190 4190
 	*/
4191
-	public function countAllAirlineCountriesByDate($date,$filters = array())
4191
+	public function countAllAirlineCountriesByDate($date, $filters = array())
4192 4192
 	{
4193 4193
 		global $globalTimezone, $globalDBdriver;
4194
-		$filter_query = $this->getFilter($filters,true,true);
4195
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4194
+		$filter_query = $this->getFilter($filters, true, true);
4195
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4196 4196
 		if ($globalTimezone != '') {
4197 4197
 			date_default_timezone_set($globalTimezone);
4198 4198
 			$datetime = new DateTime($date);
@@ -4200,13 +4200,13 @@  discard block
 block discarded – undo
4200 4200
 		} else $offset = '+00:00';
4201 4201
 		
4202 4202
 		if ($globalDBdriver == 'mysql') {
4203
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4203
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4204 4204
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4205 4205
 					GROUP BY spotter_output.airline_country
4206 4206
 					ORDER BY airline_country_count DESC
4207 4207
 					LIMIT 10 OFFSET 0";
4208 4208
 		} else {
4209
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4209
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4210 4210
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4211 4211
 					GROUP BY spotter_output.airline_country
4212 4212
 					ORDER BY airline_country_count DESC
@@ -4218,7 +4218,7 @@  discard block
 block discarded – undo
4218 4218
  
4219 4219
 		$airline_country_array = array();
4220 4220
 		$temp_array = array();
4221
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4221
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4222 4222
 		{
4223 4223
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4224 4224
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4235,11 +4235,11 @@  discard block
 block discarded – undo
4235 4235
 	* @return Array the airline list
4236 4236
 	*
4237 4237
 	*/
4238
-	public function countAllAirlinesByIdent($ident,$filters = array())
4238
+	public function countAllAirlinesByIdent($ident, $filters = array())
4239 4239
 	{
4240
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4241
-		$filter_query = $this->getFilter($filters,true,true);
4242
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4240
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4241
+		$filter_query = $this->getFilter($filters, true, true);
4242
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4243 4243
 		 		FROM spotter_output".$filter_query." spotter_output.ident = :ident  
4244 4244
 				GROUP BY spotter_output.airline_name
4245 4245
 				ORDER BY airline_count DESC";
@@ -4251,7 +4251,7 @@  discard block
 block discarded – undo
4251 4251
 		$airline_array = array();
4252 4252
 		$temp_array = array();
4253 4253
         
4254
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4254
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4255 4255
 		{
4256 4256
 			$temp_array['airline_name'] = $row['airline_name'];
4257 4257
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4269,25 +4269,25 @@  discard block
 block discarded – undo
4269 4269
 	* @return Array the airline list
4270 4270
 	*
4271 4271
 	*/
4272
-	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4272
+	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4273 4273
 	{
4274
-		$filter_query = $this->getFilter($filters,true,true);
4275
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4276
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4274
+		$filter_query = $this->getFilter($filters, true, true);
4275
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4276
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4277 4277
 
4278
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4278
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4279 4279
 		 			FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4280 4280
 					GROUP BY spotter_output.airline_name
4281 4281
 					ORDER BY airline_count DESC";
4282 4282
       
4283 4283
 		
4284 4284
 		$sth = $this->db->prepare($query);
4285
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4285
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4286 4286
       
4287 4287
 		$airline_array = array();
4288 4288
 		$temp_array = array();
4289 4289
         
4290
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4290
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4291 4291
 		{
4292 4292
 			$temp_array['airline_name'] = $row['airline_name'];
4293 4293
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4305,13 +4305,13 @@  discard block
 block discarded – undo
4305 4305
 	* @return Array the airline country list
4306 4306
 	*
4307 4307
 	*/
4308
-	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4308
+	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4309 4309
 	{
4310
-		$filter_query = $this->getFilter($filters,true,true);
4311
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4312
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4310
+		$filter_query = $this->getFilter($filters, true, true);
4311
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4312
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4313 4313
       
4314
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4314
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4315 4315
 		 		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) 
4316 4316
 				GROUP BY spotter_output.airline_country
4317 4317
 				ORDER BY airline_country_count DESC
@@ -4319,11 +4319,11 @@  discard block
 block discarded – undo
4319 4319
       
4320 4320
 		
4321 4321
 		$sth = $this->db->prepare($query);
4322
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4322
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4323 4323
       
4324 4324
 		$airline_country_array = array();
4325 4325
 		$temp_array = array();
4326
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4326
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4327 4327
 		{
4328 4328
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4329 4329
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4341,11 +4341,11 @@  discard block
 block discarded – undo
4341 4341
 	* @return Array the airline list
4342 4342
 	*
4343 4343
 	*/
4344
-	public function countAllAirlinesByCountry($country,$filters = array())
4344
+	public function countAllAirlinesByCountry($country, $filters = array())
4345 4345
 	{
4346
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4347
-		$filter_query = $this->getFilter($filters,true,true);
4348
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4346
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4347
+		$filter_query = $this->getFilter($filters, true, true);
4348
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4349 4349
 		 	    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
4350 4350
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4351 4351
 			    ORDER BY airline_count DESC";
@@ -4356,7 +4356,7 @@  discard block
 block discarded – undo
4356 4356
 
4357 4357
 		$airline_array = array();
4358 4358
 		$temp_array = array();
4359
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4359
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4360 4360
 		{
4361 4361
 			$temp_array['airline_name'] = $row['airline_name'];
4362 4362
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4375,11 +4375,11 @@  discard block
 block discarded – undo
4375 4375
 	* @return Array the airline country list
4376 4376
 	*
4377 4377
 	*/
4378
-	public function countAllAirlineCountriesByCountry($country,$filters = array())
4378
+	public function countAllAirlineCountriesByCountry($country, $filters = array())
4379 4379
 	{
4380
-		$filter_query = $this->getFilter($filters,true,true);
4381
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4382
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4380
+		$filter_query = $this->getFilter($filters, true, true);
4381
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4382
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4383 4383
 		 		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 
4384 4384
 				GROUP BY spotter_output.airline_country
4385 4385
 				ORDER BY airline_country_count DESC
@@ -4391,7 +4391,7 @@  discard block
 block discarded – undo
4391 4391
 
4392 4392
 		$airline_country_array = array();
4393 4393
 		$temp_array = array();
4394
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4394
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4395 4395
 		{
4396 4396
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4397 4397
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4410,8 +4410,8 @@  discard block
 block discarded – undo
4410 4410
 	*/
4411 4411
 	public function countAllAirlineCountries($limit = true, $filters = array())
4412 4412
 	{
4413
-		$filter_query = $this->getFilter($filters,true,true);
4414
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4413
+		$filter_query = $this->getFilter($filters, true, true);
4414
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4415 4415
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' 
4416 4416
 					GROUP BY spotter_output.airline_country
4417 4417
 					ORDER BY airline_country_count DESC";
@@ -4422,7 +4422,7 @@  discard block
 block discarded – undo
4422 4422
 
4423 4423
 		$airline_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'];
@@ -4438,11 +4438,11 @@  discard block
 block discarded – undo
4438 4438
 	* @return Array the airline country list
4439 4439
 	*
4440 4440
 	*/
4441
-	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4441
+	public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4442 4442
 	{
4443 4443
 		global $globalDBdriver;
4444 4444
 		//$filter_query = $this->getFilter($filters,true,true);
4445
-		$Connection= new Connection($this->db);
4445
+		$Connection = new Connection($this->db);
4446 4446
 		if (!$Connection->tableExists('countries')) return array();
4447 4447
 		/*
4448 4448
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -4457,7 +4457,7 @@  discard block
 block discarded – undo
4457 4457
 */
4458 4458
 		require_once('class.SpotterLive.php');
4459 4459
 		$SpotterLive = new SpotterLive();
4460
-		$filter_query = $SpotterLive->getFilter($filters,true,true);
4460
+		$filter_query = $SpotterLive->getFilter($filters, true, true);
4461 4461
 		$filter_query .= ' over_country IS NOT NULL';
4462 4462
                 if ($olderthanmonths > 0) {
4463 4463
 			if ($globalDBdriver == 'mysql') {
@@ -4484,7 +4484,7 @@  discard block
 block discarded – undo
4484 4484
 		$flight_array = array();
4485 4485
 		$temp_array = array();
4486 4486
         
4487
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4487
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4488 4488
 		{
4489 4489
 			$temp_array['flight_count'] = $row['nb'];
4490 4490
 			$temp_array['flight_country'] = $row['name'];
@@ -4502,12 +4502,12 @@  discard block
 block discarded – undo
4502 4502
 	* @return Array the aircraft list
4503 4503
 	*
4504 4504
 	*/
4505
-	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4505
+	public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4506 4506
 	{
4507 4507
 		global $globalDBdriver;
4508
-		$filter_query = $this->getFilter($filters,true,true);
4508
+		$filter_query = $this->getFilter($filters, true, true);
4509 4509
 
4510
-		$query  = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4510
+		$query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4511 4511
 		    FROM spotter_output ".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> ''";
4512 4512
 		if ($olderthanmonths > 0) {
4513 4513
 			if ($globalDBdriver == 'mysql') {
@@ -4532,7 +4532,7 @@  discard block
 block discarded – undo
4532 4532
 
4533 4533
 		$aircraft_array = array();
4534 4534
 		$temp_array = array();
4535
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4535
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4536 4536
 		{
4537 4537
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4538 4538
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4549,11 +4549,11 @@  discard block
 block discarded – undo
4549 4549
 	* @return Array the aircraft list
4550 4550
 	*
4551 4551
 	*/
4552
-	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4552
+	public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4553 4553
 	{
4554 4554
 		global $globalDBdriver;
4555
-		$filter_query = $this->getFilter($filters,true,true);
4556
-		$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 
4555
+		$filter_query = $this->getFilter($filters, true, true);
4556
+		$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 
4557 4557
 		    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' ";
4558 4558
 		if ($olderthanmonths > 0) {
4559 4559
 			if ($globalDBdriver == 'mysql') {
@@ -4578,7 +4578,7 @@  discard block
 block discarded – undo
4578 4578
 
4579 4579
 		$aircraft_array = array();
4580 4580
 		$temp_array = array();
4581
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4581
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4582 4582
 		{
4583 4583
 			$temp_array['airline_icao'] = $row['airline_icao'];
4584 4584
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -4596,11 +4596,11 @@  discard block
 block discarded – undo
4596 4596
 	* @return Array the aircraft list
4597 4597
 	*
4598 4598
 	*/
4599
-	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4599
+	public function countAllAircraftTypesByMonths($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4600 4600
 	{
4601 4601
 		global $globalDBdriver;
4602
-		$filter_query = $this->getFilter($filters,true,true);
4603
-		$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 
4602
+		$filter_query = $this->getFilter($filters, true, true);
4603
+		$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 
4604 4604
 		    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' ";
4605 4605
 		if ($olderthanmonths > 0) {
4606 4606
 			if ($globalDBdriver == 'mysql') {
@@ -4625,7 +4625,7 @@  discard block
 block discarded – undo
4625 4625
 
4626 4626
 		$aircraft_array = array();
4627 4627
 		$temp_array = array();
4628
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4628
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4629 4629
 		{
4630 4630
 			//$temp_array['airline_icao'] = $row['airline_icao'];
4631 4631
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -4644,13 +4644,13 @@  discard block
 block discarded – undo
4644 4644
 	* @return Array the aircraft list
4645 4645
 	*
4646 4646
 	*/
4647
-	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
4647
+	public function countAllAircraftRegistrationByAircraft($aircraft_icao, $filters = array())
4648 4648
 	{
4649 4649
 		$Image = new Image($this->db);
4650
-		$filter_query = $this->getFilter($filters,true,true);
4651
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4650
+		$filter_query = $this->getFilter($filters, true, true);
4651
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4652 4652
 
4653
-		$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  
4653
+		$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  
4654 4654
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao  
4655 4655
 				GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4656 4656
 				ORDER BY registration_count DESC";
@@ -4661,14 +4661,14 @@  discard block
 block discarded – undo
4661 4661
 		$aircraft_array = array();
4662 4662
 		$temp_array = array();
4663 4663
         
4664
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4664
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4665 4665
 		{
4666 4666
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4667 4667
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4668 4668
 			$temp_array['registration'] = $row['registration'];
4669 4669
 			$temp_array['airline_name'] = $row['airline_name'];
4670 4670
 			$temp_array['image_thumbnail'] = "";
4671
-			if($row['registration'] != "")
4671
+			if ($row['registration'] != "")
4672 4672
 			{
4673 4673
 				$image_array = $Image->getSpotterImage($row['registration']);
4674 4674
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4687,11 +4687,11 @@  discard block
 block discarded – undo
4687 4687
 	* @return Array the aircraft list
4688 4688
 	*
4689 4689
 	*/
4690
-	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
4690
+	public function countAllAircraftTypesByAirline($airline_icao, $filters = array())
4691 4691
 	{
4692
-		$filter_query = $this->getFilter($filters,true,true);
4693
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4694
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4692
+		$filter_query = $this->getFilter($filters, true, true);
4693
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4694
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4695 4695
 			    FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao 
4696 4696
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
4697 4697
 			    ORDER BY aircraft_icao_count DESC";
@@ -4702,7 +4702,7 @@  discard block
 block discarded – undo
4702 4702
 		$aircraft_array = array();
4703 4703
 		$temp_array = array();
4704 4704
 
4705
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4705
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4706 4706
 		{
4707 4707
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4708 4708
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4720,13 +4720,13 @@  discard block
 block discarded – undo
4720 4720
 	* @return Array the aircraft list
4721 4721
 	*
4722 4722
 	*/
4723
-	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
4723
+	public function countAllAircraftRegistrationByAirline($airline_icao, $filters = array())
4724 4724
 	{
4725
-		$filter_query = $this->getFilter($filters,true,true);
4725
+		$filter_query = $this->getFilter($filters, true, true);
4726 4726
 		$Image = new Image($this->db);
4727
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4727
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4728 4728
 
4729
-		$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 
4729
+		$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 
4730 4730
 			    FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao 
4731 4731
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
4732 4732
 			    ORDER BY registration_count DESC";
@@ -4736,14 +4736,14 @@  discard block
 block discarded – undo
4736 4736
 
4737 4737
 		$aircraft_array = array();
4738 4738
 		$temp_array = array();
4739
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4739
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4740 4740
 		{
4741 4741
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4742 4742
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4743 4743
 			$temp_array['registration'] = $row['registration'];
4744 4744
 			$temp_array['airline_name'] = $row['airline_name'];
4745 4745
 			$temp_array['image_thumbnail'] = "";
4746
-			if($row['registration'] != "")
4746
+			if ($row['registration'] != "")
4747 4747
 			{
4748 4748
 				$image_array = $Image->getSpotterImage($row['registration']);
4749 4749
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4762,11 +4762,11 @@  discard block
 block discarded – undo
4762 4762
 	* @return Array the aircraft list
4763 4763
 	*
4764 4764
 	*/
4765
-	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
4765
+	public function countAllAircraftManufacturerByAirline($airline_icao, $filters = array())
4766 4766
 	{
4767
-		$filter_query = $this->getFilter($filters,true,true);
4768
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4769
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4767
+		$filter_query = $this->getFilter($filters, true, true);
4768
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4769
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4770 4770
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao 
4771 4771
 				GROUP BY spotter_output.aircraft_manufacturer 
4772 4772
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -4777,7 +4777,7 @@  discard block
 block discarded – undo
4777 4777
 		$aircraft_array = array();
4778 4778
 		$temp_array = array();
4779 4779
 
4780
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4780
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4781 4781
 		{
4782 4782
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4783 4783
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4794,12 +4794,12 @@  discard block
 block discarded – undo
4794 4794
 	* @return Array the aircraft list
4795 4795
 	*
4796 4796
 	*/
4797
-	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
4797
+	public function countAllAircraftTypesByAirport($airport_icao, $filters = array())
4798 4798
 	{
4799
-		$filter_query = $this->getFilter($filters,true,true);
4800
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4799
+		$filter_query = $this->getFilter($filters, true, true);
4800
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4801 4801
 
4802
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4802
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4803 4803
 				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) 
4804 4804
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
4805 4805
 				ORDER BY aircraft_icao_count DESC";
@@ -4809,7 +4809,7 @@  discard block
 block discarded – undo
4809 4809
 
4810 4810
 		$aircraft_array = array();
4811 4811
 		$temp_array = array();
4812
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4812
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4813 4813
 		{
4814 4814
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4815 4815
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4827,13 +4827,13 @@  discard block
 block discarded – undo
4827 4827
 	* @return Array the aircraft list
4828 4828
 	*
4829 4829
 	*/
4830
-	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
4830
+	public function countAllAircraftRegistrationByAirport($airport_icao, $filters = array())
4831 4831
 	{
4832
-		$filter_query = $this->getFilter($filters,true,true);
4832
+		$filter_query = $this->getFilter($filters, true, true);
4833 4833
 		$Image = new Image($this->db);
4834
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4834
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4835 4835
 
4836
-		$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  
4836
+		$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  
4837 4837
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)   
4838 4838
                     GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
4839 4839
 		    ORDER BY registration_count DESC";
@@ -4843,14 +4843,14 @@  discard block
 block discarded – undo
4843 4843
 
4844 4844
 		$aircraft_array = array();
4845 4845
 		$temp_array = array();
4846
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4846
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4847 4847
 		{
4848 4848
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4849 4849
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4850 4850
 			$temp_array['registration'] = $row['registration'];
4851 4851
 			$temp_array['airline_name'] = $row['airline_name'];
4852 4852
 			$temp_array['image_thumbnail'] = "";
4853
-			if($row['registration'] != "")
4853
+			if ($row['registration'] != "")
4854 4854
 			{
4855 4855
 				$image_array = $Image->getSpotterImage($row['registration']);
4856 4856
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4868,11 +4868,11 @@  discard block
 block discarded – undo
4868 4868
 	* @return Array the aircraft list
4869 4869
 	*
4870 4870
 	*/
4871
-	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
4871
+	public function countAllAircraftManufacturerByAirport($airport_icao, $filters = array())
4872 4872
 	{
4873
-		$filter_query = $this->getFilter($filters,true,true);
4874
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4875
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4873
+		$filter_query = $this->getFilter($filters, true, true);
4874
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4875
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4876 4876
                     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)  
4877 4877
                     GROUP BY spotter_output.aircraft_manufacturer 
4878 4878
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -4883,7 +4883,7 @@  discard block
 block discarded – undo
4883 4883
 
4884 4884
 		$aircraft_array = array();
4885 4885
 		$temp_array = array();
4886
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4886
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4887 4887
 		{
4888 4888
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4889 4889
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4898,12 +4898,12 @@  discard block
 block discarded – undo
4898 4898
 	* @return Array the aircraft list
4899 4899
 	*
4900 4900
 	*/
4901
-	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
4901
+	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer, $filters = array())
4902 4902
 	{
4903
-		$filter_query = $this->getFilter($filters,true,true);
4904
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4903
+		$filter_query = $this->getFilter($filters, true, true);
4904
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4905 4905
 
4906
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4906
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4907 4907
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
4908 4908
                     GROUP BY spotter_output.aircraft_name 
4909 4909
 					ORDER BY aircraft_icao_count DESC";
@@ -4912,7 +4912,7 @@  discard block
 block discarded – undo
4912 4912
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
4913 4913
 		$aircraft_array = array();
4914 4914
 		$temp_array = array();
4915
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4915
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4916 4916
 		{
4917 4917
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4918 4918
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4931,11 +4931,11 @@  discard block
 block discarded – undo
4931 4931
 	*/
4932 4932
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
4933 4933
 	{
4934
-		$filter_query = $this->getFilter($filters,true,true);
4934
+		$filter_query = $this->getFilter($filters, true, true);
4935 4935
 		$Image = new Image($this->db);
4936
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4936
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4937 4937
 
4938
-		$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   
4938
+		$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   
4939 4939
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
4940 4940
                     GROUP BY spotter_output.registration 
4941 4941
 					ORDER BY registration_count DESC";
@@ -4945,14 +4945,14 @@  discard block
 block discarded – undo
4945 4945
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
4946 4946
 		$aircraft_array = array();
4947 4947
 		$temp_array = array();
4948
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4948
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4949 4949
 		{
4950 4950
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4951 4951
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4952 4952
 			$temp_array['registration'] = $row['registration'];
4953 4953
 			$temp_array['airline_name'] = $row['airline_name'];
4954 4954
 			$temp_array['image_thumbnail'] = "";
4955
-			if($row['registration'] != "")
4955
+			if ($row['registration'] != "")
4956 4956
 			{
4957 4957
 				$image_array = $Image->getSpotterImage($row['registration']);
4958 4958
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4969,11 +4969,11 @@  discard block
 block discarded – undo
4969 4969
 	* @return Array the aircraft list
4970 4970
 	*
4971 4971
 	*/
4972
-	public function countAllAircraftTypesByDate($date,$filters = array())
4972
+	public function countAllAircraftTypesByDate($date, $filters = array())
4973 4973
 	{
4974 4974
 		global $globalTimezone, $globalDBdriver;
4975
-		$filter_query = $this->getFilter($filters,true,true);
4976
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4975
+		$filter_query = $this->getFilter($filters, true, true);
4976
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4977 4977
 		if ($globalTimezone != '') {
4978 4978
 			date_default_timezone_set($globalTimezone);
4979 4979
 			$datetime = new DateTime($date);
@@ -4981,12 +4981,12 @@  discard block
 block discarded – undo
4981 4981
 		} else $offset = '+00:00';
4982 4982
 
4983 4983
 		if ($globalDBdriver == 'mysql') {
4984
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4984
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4985 4985
 					FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
4986 4986
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
4987 4987
 					ORDER BY aircraft_icao_count DESC";
4988 4988
 		} else {
4989
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4989
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4990 4990
 					FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
4991 4991
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
4992 4992
 					ORDER BY aircraft_icao_count DESC";
@@ -4997,7 +4997,7 @@  discard block
 block discarded – undo
4997 4997
 
4998 4998
 		$aircraft_array = array();
4999 4999
 		$temp_array = array();
5000
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5000
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5001 5001
 		{
5002 5002
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5003 5003
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5015,12 +5015,12 @@  discard block
 block discarded – undo
5015 5015
 	* @return Array the aircraft list
5016 5016
 	*
5017 5017
 	*/
5018
-	public function countAllAircraftRegistrationByDate($date,$filters = array())
5018
+	public function countAllAircraftRegistrationByDate($date, $filters = array())
5019 5019
 	{
5020 5020
 		global $globalTimezone, $globalDBdriver;
5021
-		$filter_query = $this->getFilter($filters,true,true);
5021
+		$filter_query = $this->getFilter($filters, true, true);
5022 5022
 		$Image = new Image($this->db);
5023
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5023
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5024 5024
 		if ($globalTimezone != '') {
5025 5025
 			date_default_timezone_set($globalTimezone);
5026 5026
 			$datetime = new DateTime($date);
@@ -5028,12 +5028,12 @@  discard block
 block discarded – undo
5028 5028
 		} else $offset = '+00:00';
5029 5029
 
5030 5030
 		if ($globalDBdriver == 'mysql') {
5031
-			$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 
5031
+			$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 
5032 5032
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
5033 5033
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5034 5034
 					ORDER BY registration_count DESC";
5035 5035
 		} else {
5036
-			$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    
5036
+			$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 5037
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5038 5038
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5039 5039
 					ORDER BY registration_count DESC";
@@ -5044,14 +5044,14 @@  discard block
 block discarded – undo
5044 5044
 
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
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5070,11 +5070,11 @@  discard block
 block discarded – undo
5070 5070
 	* @return Array the aircraft manufacturer list
5071 5071
 	*
5072 5072
 	*/
5073
-	public function countAllAircraftManufacturerByDate($date,$filters = array())
5073
+	public function countAllAircraftManufacturerByDate($date, $filters = array())
5074 5074
 	{
5075 5075
 		global $globalTimezone, $globalDBdriver;
5076
-		$filter_query = $this->getFilter($filters,true,true);
5077
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5076
+		$filter_query = $this->getFilter($filters, true, true);
5077
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5078 5078
 		if ($globalTimezone != '') {
5079 5079
 			date_default_timezone_set($globalTimezone);
5080 5080
 			$datetime = new DateTime($date);
@@ -5082,12 +5082,12 @@  discard block
 block discarded – undo
5082 5082
 		} else $offset = '+00:00';
5083 5083
 
5084 5084
 		if ($globalDBdriver == 'mysql') {
5085
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5085
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5086 5086
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
5087 5087
 				GROUP BY spotter_output.aircraft_manufacturer 
5088 5088
 				ORDER BY aircraft_manufacturer_count DESC";
5089 5089
 		} else {
5090
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5090
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5091 5091
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5092 5092
 				GROUP BY spotter_output.aircraft_manufacturer 
5093 5093
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -5099,7 +5099,7 @@  discard block
 block discarded – undo
5099 5099
 		$aircraft_array = array();
5100 5100
 		$temp_array = array();
5101 5101
 
5102
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5102
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5103 5103
 		{
5104 5104
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5105 5105
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5116,11 +5116,11 @@  discard block
 block discarded – undo
5116 5116
 	* @return Array the aircraft list
5117 5117
 	*
5118 5118
 	*/
5119
-	public function countAllAircraftTypesByIdent($ident,$filters = array())
5119
+	public function countAllAircraftTypesByIdent($ident, $filters = array())
5120 5120
 	{
5121
-		$filter_query = $this->getFilter($filters,true,true);
5122
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5123
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5121
+		$filter_query = $this->getFilter($filters, true, true);
5122
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5123
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5124 5124
 				FROM spotter_output".$filter_query." spotter_output.ident = :ident 
5125 5125
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
5126 5126
 				ORDER BY aircraft_icao_count DESC";
@@ -5131,7 +5131,7 @@  discard block
 block discarded – undo
5131 5131
 		$aircraft_array = array();
5132 5132
 		$temp_array = array();
5133 5133
 
5134
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5134
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5135 5135
 		{
5136 5136
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5137 5137
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5149,13 +5149,13 @@  discard block
 block discarded – undo
5149 5149
 	* @return Array the aircraft list
5150 5150
 	*
5151 5151
 	*/
5152
-	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5152
+	public function countAllAircraftRegistrationByIdent($ident, $filters = array())
5153 5153
 	{
5154
-		$filter_query = $this->getFilter($filters,true,true);
5154
+		$filter_query = $this->getFilter($filters, true, true);
5155 5155
 		$Image = new Image($this->db);
5156
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5156
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5157 5157
 
5158
-		$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  
5158
+		$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  
5159 5159
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.ident = :ident   
5160 5160
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
5161 5161
 		    ORDER BY registration_count DESC";
@@ -5167,14 +5167,14 @@  discard block
 block discarded – undo
5167 5167
 		$aircraft_array = array();
5168 5168
 		$temp_array = array();
5169 5169
         
5170
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5170
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5171 5171
 		{
5172 5172
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5173 5173
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5174 5174
 			$temp_array['registration'] = $row['registration'];
5175 5175
 			$temp_array['airline_name'] = $row['airline_name'];
5176 5176
 			$temp_array['image_thumbnail'] = "";
5177
-			if($row['registration'] != "")
5177
+			if ($row['registration'] != "")
5178 5178
 			{
5179 5179
 				$image_array = $Image->getSpotterImage($row['registration']);
5180 5180
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5193,11 +5193,11 @@  discard block
 block discarded – undo
5193 5193
 	* @return Array the aircraft manufacturer list
5194 5194
 	*
5195 5195
 	*/
5196
-	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5196
+	public function countAllAircraftManufacturerByIdent($ident, $filters = array())
5197 5197
 	{
5198
-		$filter_query = $this->getFilter($filters,true,true);
5199
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5200
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5198
+		$filter_query = $this->getFilter($filters, true, true);
5199
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5200
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5201 5201
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident  
5202 5202
                     GROUP BY spotter_output.aircraft_manufacturer 
5203 5203
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5207,7 +5207,7 @@  discard block
 block discarded – undo
5207 5207
 		$sth->execute(array(':ident' => $ident));
5208 5208
 		$aircraft_array = array();
5209 5209
 		$temp_array = array();
5210
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5210
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5211 5211
 		{
5212 5212
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5213 5213
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5223,24 +5223,24 @@  discard block
 block discarded – undo
5223 5223
 	* @return Array the aircraft list
5224 5224
 	*
5225 5225
 	*/
5226
-	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5226
+	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5227 5227
 	{
5228
-		$filter_query = $this->getFilter($filters,true,true);
5229
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5230
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5228
+		$filter_query = $this->getFilter($filters, true, true);
5229
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5230
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5231 5231
 		
5232 5232
 
5233
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5233
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5234 5234
                     FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
5235 5235
                     GROUP BY spotter_output.aircraft_name 
5236 5236
 					ORDER BY aircraft_icao_count DESC";
5237 5237
  
5238 5238
 		
5239 5239
 		$sth = $this->db->prepare($query);
5240
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5240
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5241 5241
 		$aircraft_array = array();
5242 5242
 		$temp_array = array();
5243
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5243
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5244 5244
 		{
5245 5245
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5246 5246
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5256,33 +5256,33 @@  discard block
 block discarded – undo
5256 5256
 	* @return Array the aircraft list
5257 5257
 	*
5258 5258
 	*/
5259
-	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5259
+	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5260 5260
 	{
5261
-		$filter_query = $this->getFilter($filters,true,true);
5261
+		$filter_query = $this->getFilter($filters, true, true);
5262 5262
 		$Image = new Image($this->db);
5263
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5264
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5263
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5264
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5265 5265
 
5266
-		$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   
5266
+		$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   
5267 5267
                     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)   
5268 5268
                     GROUP BY spotter_output.registration 
5269 5269
 					ORDER BY registration_count DESC";
5270 5270
 
5271 5271
 		
5272 5272
 		$sth = $this->db->prepare($query);
5273
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5273
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5274 5274
       
5275 5275
 		$aircraft_array = array();
5276 5276
 		$temp_array = array();
5277 5277
         
5278
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5278
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5279 5279
 		{
5280 5280
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5281 5281
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5282 5282
 			$temp_array['registration'] = $row['registration'];
5283 5283
 			$temp_array['airline_name'] = $row['airline_name'];
5284 5284
 			$temp_array['image_thumbnail'] = "";
5285
-			if($row['registration'] != "")
5285
+			if ($row['registration'] != "")
5286 5286
 			{
5287 5287
 				$image_array = $Image->getSpotterImage($row['registration']);
5288 5288
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5302,25 +5302,25 @@  discard block
 block discarded – undo
5302 5302
 	* @return Array the aircraft manufacturer list
5303 5303
 	*
5304 5304
 	*/
5305
-	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5305
+	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5306 5306
 	{
5307
-		$filter_query = $this->getFilter($filters,true,true);
5308
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5309
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5307
+		$filter_query = $this->getFilter($filters, true, true);
5308
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5309
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5310 5310
 
5311
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5311
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5312 5312
                     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) 
5313 5313
                     GROUP BY spotter_output.aircraft_manufacturer 
5314 5314
 					ORDER BY aircraft_manufacturer_count DESC";
5315 5315
 
5316 5316
 		
5317 5317
 		$sth = $this->db->prepare($query);
5318
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5318
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5319 5319
       
5320 5320
 		$aircraft_array = array();
5321 5321
 		$temp_array = array();
5322 5322
         
5323
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5323
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5324 5324
 		{
5325 5325
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5326 5326
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5340,11 +5340,11 @@  discard block
 block discarded – undo
5340 5340
 	* @return Array the aircraft list
5341 5341
 	*
5342 5342
 	*/
5343
-	public function countAllAircraftTypesByCountry($country,$filters = array())
5343
+	public function countAllAircraftTypesByCountry($country, $filters = array())
5344 5344
 	{
5345
-		$filter_query = $this->getFilter($filters,true,true);
5346
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5347
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5345
+		$filter_query = $this->getFilter($filters, true, true);
5346
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5347
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5348 5348
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
5349 5349
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5350 5350
 			    ORDER BY aircraft_icao_count DESC";
@@ -5356,7 +5356,7 @@  discard block
 block discarded – undo
5356 5356
 		$aircraft_array = array();
5357 5357
 		$temp_array = array();
5358 5358
         
5359
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5359
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5360 5360
 		{
5361 5361
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5362 5362
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5375,12 +5375,12 @@  discard block
 block discarded – undo
5375 5375
 	* @return Array the aircraft list
5376 5376
 	*
5377 5377
 	*/
5378
-	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5378
+	public function countAllAircraftRegistrationByCountry($country, $filters = array())
5379 5379
 	{
5380
-		$filter_query = $this->getFilter($filters,true,true);
5380
+		$filter_query = $this->getFilter($filters, true, true);
5381 5381
 		$Image = new Image($this->db);
5382
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5383
-		$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 
5382
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5383
+		$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 
5384 5384
 			    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)    
5385 5385
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5386 5386
 			    ORDER BY registration_count DESC";
@@ -5392,14 +5392,14 @@  discard block
 block discarded – undo
5392 5392
 		$aircraft_array = array();
5393 5393
 		$temp_array = array();
5394 5394
         
5395
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5395
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5396 5396
 		{
5397 5397
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5398 5398
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5399 5399
 			$temp_array['registration'] = $row['registration'];
5400 5400
 			$temp_array['airline_name'] = $row['airline_name'];
5401 5401
 			$temp_array['image_thumbnail'] = "";
5402
-			if($row['registration'] != "")
5402
+			if ($row['registration'] != "")
5403 5403
 			{
5404 5404
 				$image_array = $Image->getSpotterImage($row['registration']);
5405 5405
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5419,11 +5419,11 @@  discard block
 block discarded – undo
5419 5419
 	* @return Array the aircraft manufacturer list
5420 5420
 	*
5421 5421
 	*/
5422
-	public function countAllAircraftManufacturerByCountry($country,$filters = array())
5422
+	public function countAllAircraftManufacturerByCountry($country, $filters = array())
5423 5423
 	{
5424
-		$filter_query = $this->getFilter($filters,true,true);
5425
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5426
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5424
+		$filter_query = $this->getFilter($filters, true, true);
5425
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5426
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5427 5427
                     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) 
5428 5428
                     GROUP BY spotter_output.aircraft_manufacturer 
5429 5429
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5435,7 +5435,7 @@  discard block
 block discarded – undo
5435 5435
 		$aircraft_array = array();
5436 5436
 		$temp_array = array();
5437 5437
         
5438
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5438
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5439 5439
 		{
5440 5440
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5441 5441
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5456,8 +5456,8 @@  discard block
 block discarded – undo
5456 5456
 	*/
5457 5457
 	public function countAllAircraftManufacturers($filters = array())
5458 5458
 	{
5459
-		$filter_query = $this->getFilter($filters,true,true);
5460
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5459
+		$filter_query = $this->getFilter($filters, true, true);
5460
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5461 5461
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5462 5462
                 $query .= " GROUP BY spotter_output.aircraft_manufacturer
5463 5463
 					ORDER BY aircraft_manufacturer_count DESC
@@ -5470,7 +5470,7 @@  discard block
 block discarded – undo
5470 5470
 		$manufacturer_array = array();
5471 5471
 		$temp_array = array();
5472 5472
         
5473
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5473
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5474 5474
 		{
5475 5475
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5476 5476
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5489,12 +5489,12 @@  discard block
 block discarded – undo
5489 5489
 	* @return Array the aircraft list
5490 5490
 	*
5491 5491
 	*/
5492
-	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5492
+	public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5493 5493
 	{
5494 5494
 		global $globalDBdriver;
5495 5495
 		$Image = new Image($this->db);
5496
-		$filter_query = $this->getFilter($filters,true,true);
5497
-		$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    
5496
+		$filter_query = $this->getFilter($filters, true, true);
5497
+		$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    
5498 5498
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5499 5499
                 if ($olderthanmonths > 0) {
5500 5500
             		if ($globalDBdriver == 'mysql') {
@@ -5522,7 +5522,7 @@  discard block
 block discarded – undo
5522 5522
 		$aircraft_array = array();
5523 5523
 		$temp_array = array();
5524 5524
         
5525
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5525
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5526 5526
 		{
5527 5527
 			$temp_array['registration'] = $row['registration'];
5528 5528
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -5530,7 +5530,7 @@  discard block
 block discarded – undo
5530 5530
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5531 5531
 			$temp_array['airline_name'] = $row['airline_name'];
5532 5532
 			$temp_array['image_thumbnail'] = "";
5533
-			if($row['registration'] != "")
5533
+			if ($row['registration'] != "")
5534 5534
 			{
5535 5535
 				$image_array = $Image->getSpotterImage($row['registration']);
5536 5536
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5549,12 +5549,12 @@  discard block
 block discarded – undo
5549 5549
 	* @return Array the aircraft list
5550 5550
 	*
5551 5551
 	*/
5552
-	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5552
+	public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5553 5553
 	{
5554 5554
 		global $globalDBdriver;
5555
-		$filter_query = $this->getFilter($filters,true,true);
5555
+		$filter_query = $this->getFilter($filters, true, true);
5556 5556
 		$Image = new Image($this->db);
5557
-		$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    
5557
+		$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    
5558 5558
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5559 5559
                 if ($olderthanmonths > 0) {
5560 5560
             		if ($globalDBdriver == 'mysql') {
@@ -5582,7 +5582,7 @@  discard block
 block discarded – undo
5582 5582
 		$aircraft_array = array();
5583 5583
 		$temp_array = array();
5584 5584
         
5585
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5585
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5586 5586
 		{
5587 5587
 			$temp_array['registration'] = $row['registration'];
5588 5588
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -5591,7 +5591,7 @@  discard block
 block discarded – undo
5591 5591
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5592 5592
 			$temp_array['airline_name'] = $row['airline_name'];
5593 5593
 			$temp_array['image_thumbnail'] = "";
5594
-			if($row['registration'] != "")
5594
+			if ($row['registration'] != "")
5595 5595
 			{
5596 5596
 				$image_array = $Image->getSpotterImage($row['registration']);
5597 5597
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5610,11 +5610,11 @@  discard block
 block discarded – undo
5610 5610
 	* @return Array the airport list
5611 5611
 	*
5612 5612
 	*/
5613
-	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5613
+	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5614 5614
 	{
5615 5615
 		global $globalDBdriver;
5616
-		$filter_query = $this->getFilter($filters,true,true);
5617
-		$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 
5616
+		$filter_query = $this->getFilter($filters, true, true);
5617
+		$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 
5618 5618
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
5619 5619
                 if ($olderthanmonths > 0) {
5620 5620
             		if ($globalDBdriver == 'mysql') {
@@ -5643,7 +5643,7 @@  discard block
 block discarded – undo
5643 5643
 		$airport_array = array();
5644 5644
 		$temp_array = array();
5645 5645
         
5646
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5646
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5647 5647
 		{
5648 5648
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5649 5649
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5662,11 +5662,11 @@  discard block
 block discarded – undo
5662 5662
 	* @return Array the airport list
5663 5663
 	*
5664 5664
 	*/
5665
-	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5665
+	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5666 5666
 	{
5667 5667
 		global $globalDBdriver;
5668
-		$filter_query = $this->getFilter($filters,true,true);
5669
-		$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 
5668
+		$filter_query = $this->getFilter($filters, true, true);
5669
+		$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 
5670 5670
 			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 <> '' ";
5671 5671
                 if ($olderthanmonths > 0) {
5672 5672
             		if ($globalDBdriver == 'mysql') {
@@ -5695,7 +5695,7 @@  discard block
 block discarded – undo
5695 5695
 		$airport_array = array();
5696 5696
 		$temp_array = array();
5697 5697
         
5698
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5698
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5699 5699
 		{
5700 5700
 			$temp_array['airline_icao'] = $row['airline_icao'];
5701 5701
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -5715,11 +5715,11 @@  discard block
 block discarded – undo
5715 5715
 	* @return Array the airport list
5716 5716
 	*
5717 5717
 	*/
5718
-	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5718
+	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5719 5719
 	{
5720 5720
 		global $globalDBdriver;
5721
-		$filter_query = $this->getFilter($filters,true,true);
5722
-		$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
5721
+		$filter_query = $this->getFilter($filters, true, true);
5722
+		$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
5723 5723
 				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";
5724 5724
                 if ($olderthanmonths > 0) {
5725 5725
             		if ($globalDBdriver == 'mysql') {
@@ -5747,7 +5747,7 @@  discard block
 block discarded – undo
5747 5747
 		$airport_array = array();
5748 5748
 		$temp_array = array();
5749 5749
         
5750
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5750
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5751 5751
 		{
5752 5752
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5753 5753
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5766,11 +5766,11 @@  discard block
 block discarded – undo
5766 5766
 	* @return Array the airport list
5767 5767
 	*
5768 5768
 	*/
5769
-	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5769
+	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5770 5770
 	{
5771 5771
 		global $globalDBdriver;
5772
-		$filter_query = $this->getFilter($filters,true,true);
5773
-		$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
5772
+		$filter_query = $this->getFilter($filters, true, true);
5773
+		$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
5774 5774
 				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 ";
5775 5775
                 if ($olderthanmonths > 0) {
5776 5776
             		if ($globalDBdriver == 'mysql') {
@@ -5799,7 +5799,7 @@  discard block
 block discarded – undo
5799 5799
 		$airport_array = array();
5800 5800
 		$temp_array = array();
5801 5801
         
5802
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5802
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5803 5803
 		{
5804 5804
 			$temp_array['airline_icao'] = $row['airline_icao'];
5805 5805
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -5819,11 +5819,11 @@  discard block
 block discarded – undo
5819 5819
 	* @return Array the airport list
5820 5820
 	*
5821 5821
 	*/
5822
-	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
5822
+	public function countAllDepartureAirportsByAirline($airline_icao, $filters = array())
5823 5823
 	{
5824
-		$filter_query = $this->getFilter($filters,true,true);
5825
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5826
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5824
+		$filter_query = $this->getFilter($filters, true, true);
5825
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5826
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5827 5827
 			    FROM spotter_output".$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 <> '' 
5828 5828
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5829 5829
 			    ORDER BY airport_departure_icao_count DESC";
@@ -5835,7 +5835,7 @@  discard block
 block discarded – undo
5835 5835
 		$airport_array = array();
5836 5836
 		$temp_array = array();
5837 5837
         
5838
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5838
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5839 5839
 		{
5840 5840
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5841 5841
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5857,11 +5857,11 @@  discard block
 block discarded – undo
5857 5857
 	* @return Array the airport list
5858 5858
 	*
5859 5859
 	*/
5860
-	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
5860
+	public function countAllDepartureAirportCountriesByAirline($airline_icao, $filters = array())
5861 5861
 	{
5862
-		$filter_query = $this->getFilter($filters,true,true);
5863
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5864
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5862
+		$filter_query = $this->getFilter($filters, true, true);
5863
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5864
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5865 5865
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
5866 5866
                     GROUP BY spotter_output.departure_airport_country
5867 5867
 					ORDER BY airport_departure_country_count DESC";
@@ -5873,7 +5873,7 @@  discard block
 block discarded – undo
5873 5873
 		$airport_array = array();
5874 5874
 		$temp_array = array();
5875 5875
         
5876
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5876
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5877 5877
 		{
5878 5878
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5879 5879
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5892,11 +5892,11 @@  discard block
 block discarded – undo
5892 5892
 	* @return Array the airport list
5893 5893
 	*
5894 5894
 	*/
5895
-	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
5895
+	public function countAllDepartureAirportsByAircraft($aircraft_icao, $filters = array())
5896 5896
 	{
5897
-		$filter_query = $this->getFilter($filters,true,true);
5898
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5899
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5897
+		$filter_query = $this->getFilter($filters, true, true);
5898
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5899
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5900 5900
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao AND spotter_output.departure_airport_icao <> '' 
5901 5901
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5902 5902
 			    ORDER BY airport_departure_icao_count DESC";
@@ -5908,7 +5908,7 @@  discard block
 block discarded – undo
5908 5908
 		$airport_array = array();
5909 5909
 		$temp_array = array();
5910 5910
         
5911
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5911
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5912 5912
 		{
5913 5913
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5914 5914
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5929,11 +5929,11 @@  discard block
 block discarded – undo
5929 5929
 	* @return Array the airport list
5930 5930
 	*
5931 5931
 	*/
5932
-	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
5932
+	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao, $filters = array())
5933 5933
 	{
5934
-		$filter_query = $this->getFilter($filters,true,true);
5935
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5936
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5934
+		$filter_query = $this->getFilter($filters, true, true);
5935
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5936
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5937 5937
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
5938 5938
                     GROUP BY spotter_output.departure_airport_country
5939 5939
 					ORDER BY airport_departure_country_count DESC";
@@ -5945,7 +5945,7 @@  discard block
 block discarded – undo
5945 5945
 		$airport_array = array();
5946 5946
 		$temp_array = array();
5947 5947
         
5948
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5948
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5949 5949
 		{
5950 5950
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5951 5951
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5963,11 +5963,11 @@  discard block
 block discarded – undo
5963 5963
 	* @return Array the airport list
5964 5964
 	*
5965 5965
 	*/
5966
-	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
5966
+	public function countAllDepartureAirportsByRegistration($registration, $filters = array())
5967 5967
 	{
5968
-		$filter_query = $this->getFilter($filters,true,true);
5969
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
5970
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5968
+		$filter_query = $this->getFilter($filters, true, true);
5969
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
5970
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5971 5971
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.registration = :registration AND spotter_output.departure_airport_icao <> '' 
5972 5972
                     GROUP BY spotter_output.departure_airport_icao
5973 5973
 					ORDER BY airport_departure_icao_count DESC";
@@ -5979,7 +5979,7 @@  discard block
 block discarded – undo
5979 5979
 		$airport_array = array();
5980 5980
 		$temp_array = array();
5981 5981
         
5982
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5982
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5983 5983
 		{
5984 5984
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5985 5985
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6000,11 +6000,11 @@  discard block
 block discarded – undo
6000 6000
 	* @return Array the airport list
6001 6001
 	*
6002 6002
 	*/
6003
-	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
6003
+	public function countAllDepartureAirportCountriesByRegistration($registration, $filters = array())
6004 6004
 	{
6005
-		$filter_query = $this->getFilter($filters,true,true);
6006
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6007
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6005
+		$filter_query = $this->getFilter($filters, true, true);
6006
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6007
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6008 6008
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration 
6009 6009
                     GROUP BY spotter_output.departure_airport_country
6010 6010
 					ORDER BY airport_departure_country_count DESC";
@@ -6016,7 +6016,7 @@  discard block
 block discarded – undo
6016 6016
 		$airport_array = array();
6017 6017
 		$temp_array = array();
6018 6018
         
6019
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6019
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6020 6020
 		{
6021 6021
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6022 6022
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6034,11 +6034,11 @@  discard block
 block discarded – undo
6034 6034
 	* @return Array the airport list
6035 6035
 	*
6036 6036
 	*/
6037
-	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
6037
+	public function countAllDepartureAirportsByAirport($airport_icao, $filters = array())
6038 6038
 	{
6039
-		$filter_query = $this->getFilter($filters,true,true);
6040
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6041
-		$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 
6039
+		$filter_query = $this->getFilter($filters, true, true);
6040
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6041
+		$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 
6042 6042
 			    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 <> '' 
6043 6043
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6044 6044
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6050,7 +6050,7 @@  discard block
 block discarded – undo
6050 6050
 		$airport_array = array();
6051 6051
 		$temp_array = array();
6052 6052
         
6053
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6053
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6054 6054
 		{
6055 6055
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6056 6056
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6071,11 +6071,11 @@  discard block
 block discarded – undo
6071 6071
 	* @return Array the airport list
6072 6072
 	*
6073 6073
 	*/
6074
-	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
6074
+	public function countAllDepartureAirportCountriesByAirport($airport_icao, $filters = array())
6075 6075
 	{
6076
-		$filter_query = $this->getFilter($filters,true,true);
6077
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6078
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6076
+		$filter_query = $this->getFilter($filters, true, true);
6077
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6078
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6079 6079
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao 
6080 6080
                     GROUP BY spotter_output.departure_airport_country
6081 6081
 					ORDER BY airport_departure_country_count DESC";
@@ -6087,7 +6087,7 @@  discard block
 block discarded – undo
6087 6087
 		$airport_array = array();
6088 6088
 		$temp_array = array();
6089 6089
         
6090
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6090
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6091 6091
 		{
6092 6092
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6093 6093
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6106,11 +6106,11 @@  discard block
 block discarded – undo
6106 6106
 	* @return Array the airport list
6107 6107
 	*
6108 6108
 	*/
6109
-	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6109
+	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer, $filters = array())
6110 6110
 	{
6111
-		$filter_query = $this->getFilter($filters,true,true);
6112
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6113
-		$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 
6111
+		$filter_query = $this->getFilter($filters, true, true);
6112
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6113
+		$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 
6114 6114
 			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 <> '' 
6115 6115
                     GROUP BY spotter_output.departure_airport_icao
6116 6116
 					ORDER BY airport_departure_icao_count DESC";
@@ -6122,7 +6122,7 @@  discard block
 block discarded – undo
6122 6122
 		$airport_array = array();
6123 6123
 		$temp_array = array();
6124 6124
         
6125
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6125
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6126 6126
 		{
6127 6127
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6128 6128
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6143,11 +6143,11 @@  discard block
 block discarded – undo
6143 6143
 	* @return Array the airport list
6144 6144
 	*
6145 6145
 	*/
6146
-	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6146
+	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
6147 6147
 	{
6148
-		$filter_query = $this->getFilter($filters,true,true);
6149
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6150
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6148
+		$filter_query = $this->getFilter($filters, true, true);
6149
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6150
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6151 6151
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6152 6152
                     GROUP BY spotter_output.departure_airport_country
6153 6153
 					ORDER BY airport_departure_country_count DESC";
@@ -6159,7 +6159,7 @@  discard block
 block discarded – undo
6159 6159
 		$airport_array = array();
6160 6160
 		$temp_array = array();
6161 6161
         
6162
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6162
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6163 6163
 		{
6164 6164
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6165 6165
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6177,11 +6177,11 @@  discard block
 block discarded – undo
6177 6177
 	* @return Array the airport list
6178 6178
 	*
6179 6179
 	*/
6180
-	public function countAllDepartureAirportsByDate($date,$filters = array())
6180
+	public function countAllDepartureAirportsByDate($date, $filters = array())
6181 6181
 	{
6182 6182
 		global $globalTimezone, $globalDBdriver;
6183
-		$filter_query = $this->getFilter($filters,true,true);
6184
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6183
+		$filter_query = $this->getFilter($filters, true, true);
6184
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6185 6185
 		if ($globalTimezone != '') {
6186 6186
 			date_default_timezone_set($globalTimezone);
6187 6187
 			$datetime = new DateTime($date);
@@ -6189,12 +6189,12 @@  discard block
 block discarded – undo
6189 6189
 		} else $offset = '+00:00';
6190 6190
 
6191 6191
 		if ($globalDBdriver == 'mysql') {
6192
-			$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 
6192
+			$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 
6193 6193
 					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
6194 6194
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6195 6195
 					ORDER BY airport_departure_icao_count DESC";
6196 6196
 		} else {
6197
-			$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 
6197
+			$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 
6198 6198
 					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
6199 6199
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6200 6200
 					ORDER BY airport_departure_icao_count DESC";
@@ -6206,7 +6206,7 @@  discard block
 block discarded – undo
6206 6206
 		$airport_array = array();
6207 6207
 		$temp_array = array();
6208 6208
         
6209
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6209
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6210 6210
 		{
6211 6211
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6212 6212
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6227,11 +6227,11 @@  discard block
 block discarded – undo
6227 6227
 	* @return Array the airport list
6228 6228
 	*
6229 6229
 	*/
6230
-	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6230
+	public function countAllDepartureAirportCountriesByDate($date, $filters = array())
6231 6231
 	{
6232 6232
 		global $globalTimezone, $globalDBdriver;
6233
-		$filter_query = $this->getFilter($filters,true,true);
6234
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6233
+		$filter_query = $this->getFilter($filters, true, true);
6234
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6235 6235
 		if ($globalTimezone != '') {
6236 6236
 			date_default_timezone_set($globalTimezone);
6237 6237
 			$datetime = new DateTime($date);
@@ -6239,12 +6239,12 @@  discard block
 block discarded – undo
6239 6239
 		} else $offset = '+00:00';
6240 6240
 
6241 6241
 		if ($globalDBdriver == 'mysql') {
6242
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6242
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6243 6243
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
6244 6244
 					GROUP BY spotter_output.departure_airport_country
6245 6245
 					ORDER BY airport_departure_country_count DESC";
6246 6246
 		} else {
6247
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6247
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6248 6248
 					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 
6249 6249
 					GROUP BY spotter_output.departure_airport_country
6250 6250
 					ORDER BY airport_departure_country_count DESC";
@@ -6256,7 +6256,7 @@  discard block
 block discarded – undo
6256 6256
 		$airport_array = array();
6257 6257
 		$temp_array = array();
6258 6258
         
6259
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6259
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6260 6260
 		{
6261 6261
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6262 6262
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6274,11 +6274,11 @@  discard block
 block discarded – undo
6274 6274
 	* @return Array the airport list
6275 6275
 	*
6276 6276
 	*/
6277
-	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6277
+	public function countAllDepartureAirportsByIdent($ident, $filters = array())
6278 6278
 	{
6279
-		$filter_query = $this->getFilter($filters,true,true);
6280
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6281
-		$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 
6279
+		$filter_query = $this->getFilter($filters, true, true);
6280
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6281
+		$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 
6282 6282
 		    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 
6283 6283
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6284 6284
 		    ORDER BY airport_departure_icao_count DESC";
@@ -6290,7 +6290,7 @@  discard block
 block discarded – undo
6290 6290
 		$airport_array = array();
6291 6291
 		$temp_array = array();
6292 6292
         
6293
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6293
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6294 6294
 		{
6295 6295
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6296 6296
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6312,11 +6312,11 @@  discard block
 block discarded – undo
6312 6312
 	* @return Array the airport list
6313 6313
 	*
6314 6314
 	*/
6315
-	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
6315
+	public function countAllDepartureAirportCountriesByIdent($ident, $filters = array())
6316 6316
 	{
6317
-		$filter_query = $this->getFilter($filters,true,true);
6318
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6319
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6317
+		$filter_query = $this->getFilter($filters, true, true);
6318
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6319
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6320 6320
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident 
6321 6321
                     GROUP BY spotter_output.departure_airport_country
6322 6322
 					ORDER BY airport_departure_country_count DESC";
@@ -6328,7 +6328,7 @@  discard block
 block discarded – undo
6328 6328
 		$airport_array = array();
6329 6329
 		$temp_array = array();
6330 6330
         
6331
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6331
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6332 6332
 		{
6333 6333
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6334 6334
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6347,12 +6347,12 @@  discard block
 block discarded – undo
6347 6347
 	* @return Array the airport list
6348 6348
 	*
6349 6349
 	*/
6350
-	public function countAllDepartureAirportsByCountry($country,$filters = array())
6350
+	public function countAllDepartureAirportsByCountry($country, $filters = array())
6351 6351
 	{
6352
-		$filter_query = $this->getFilter($filters,true,true);
6353
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6352
+		$filter_query = $this->getFilter($filters, true, true);
6353
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6354 6354
 
6355
-		$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 
6355
+		$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 
6356 6356
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
6357 6357
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6358 6358
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6364,7 +6364,7 @@  discard block
 block discarded – undo
6364 6364
 		$airport_array = array();
6365 6365
 		$temp_array = array();
6366 6366
         
6367
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6367
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6368 6368
 		{
6369 6369
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6370 6370
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6385,11 +6385,11 @@  discard block
 block discarded – undo
6385 6385
 	* @return Array the airport list
6386 6386
 	*
6387 6387
 	*/
6388
-	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
6388
+	public function countAllDepartureAirportCountriesByCountry($country, $filters = array())
6389 6389
 	{
6390
-		$filter_query = $this->getFilter($filters,true,true);
6391
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6392
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6390
+		$filter_query = $this->getFilter($filters, true, true);
6391
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6392
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6393 6393
 			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 
6394 6394
                     GROUP BY spotter_output.departure_airport_country
6395 6395
 					ORDER BY airport_departure_country_count DESC";
@@ -6401,7 +6401,7 @@  discard block
 block discarded – undo
6401 6401
 		$airport_array = array();
6402 6402
 		$temp_array = array();
6403 6403
         
6404
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6404
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6405 6405
 		{
6406 6406
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6407 6407
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6424,11 +6424,11 @@  discard block
 block discarded – undo
6424 6424
 	* @return Array the airport list
6425 6425
 	*
6426 6426
 	*/
6427
-	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6427
+	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6428 6428
 	{
6429 6429
 		global $globalDBdriver;
6430
-		$filter_query = $this->getFilter($filters,true,true);
6431
-		$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 
6430
+		$filter_query = $this->getFilter($filters, true, true);
6431
+		$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 
6432 6432
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
6433 6433
                 if ($olderthanmonths > 0) {
6434 6434
             		if ($globalDBdriver == 'mysql') {
@@ -6458,7 +6458,7 @@  discard block
 block discarded – undo
6458 6458
 		$airport_array = array();
6459 6459
 		$temp_array = array();
6460 6460
         
6461
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6461
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6462 6462
 		{
6463 6463
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6464 6464
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6481,11 +6481,11 @@  discard block
 block discarded – undo
6481 6481
 	* @return Array the airport list
6482 6482
 	*
6483 6483
 	*/
6484
-	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6484
+	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6485 6485
 	{
6486 6486
 		global $globalDBdriver;
6487
-		$filter_query = $this->getFilter($filters,true,true);
6488
-		$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 
6487
+		$filter_query = $this->getFilter($filters, true, true);
6488
+		$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 
6489 6489
 			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 <> '' ";
6490 6490
                 if ($olderthanmonths > 0) {
6491 6491
             		if ($globalDBdriver == 'mysql') {
@@ -6515,7 +6515,7 @@  discard block
 block discarded – undo
6515 6515
 		$airport_array = array();
6516 6516
 		$temp_array = array();
6517 6517
         
6518
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6518
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6519 6519
 		{
6520 6520
 			$temp_array['airline_icao'] = $row['airline_icao'];
6521 6521
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
@@ -6540,11 +6540,11 @@  discard block
 block discarded – undo
6540 6540
 	* @return Array the airport list
6541 6541
 	*
6542 6542
 	*/
6543
-	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6543
+	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6544 6544
 	{
6545 6545
 		global $globalDBdriver;
6546
-		$filter_query = $this->getFilter($filters,true,true);
6547
-		$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 
6546
+		$filter_query = $this->getFilter($filters, true, true);
6547
+		$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 
6548 6548
 			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";
6549 6549
                 if ($olderthanmonths > 0) {
6550 6550
             		if ($globalDBdriver == 'mysql') {
@@ -6573,7 +6573,7 @@  discard block
 block discarded – undo
6573 6573
 		$airport_array = array();
6574 6574
 		$temp_array = array();
6575 6575
         
6576
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6576
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6577 6577
 		{
6578 6578
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6579 6579
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6596,11 +6596,11 @@  discard block
 block discarded – undo
6596 6596
 	* @return Array the airport list
6597 6597
 	*
6598 6598
 	*/
6599
-	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6599
+	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6600 6600
 	{
6601 6601
 		global $globalDBdriver;
6602
-		$filter_query = $this->getFilter($filters,true,true);
6603
-		$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 
6602
+		$filter_query = $this->getFilter($filters, true, true);
6603
+		$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 
6604 6604
 			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 ";
6605 6605
                 if ($olderthanmonths > 0) {
6606 6606
             		if ($globalDBdriver == 'mysql') {
@@ -6630,7 +6630,7 @@  discard block
 block discarded – undo
6630 6630
 		$airport_array = array();
6631 6631
 		$temp_array = array();
6632 6632
         
6633
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6633
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6634 6634
 		{
6635 6635
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6636 6636
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6656,9 +6656,9 @@  discard block
 block discarded – undo
6656 6656
 	*/
6657 6657
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
6658 6658
 	{
6659
-		$filter_query = $this->getFilter($filters,true,true);
6660
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6661
-		$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 
6659
+		$filter_query = $this->getFilter($filters, true, true);
6660
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6661
+		$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 
6662 6662
 			    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 
6663 6663
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6664 6664
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -6669,7 +6669,7 @@  discard block
 block discarded – undo
6669 6669
 		$airport_array = array();
6670 6670
 		$temp_array = array();
6671 6671
         
6672
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6672
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6673 6673
 		{
6674 6674
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6675 6675
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6690,12 +6690,12 @@  discard block
 block discarded – undo
6690 6690
 	* @return Array the airport list
6691 6691
 	*
6692 6692
 	*/
6693
-	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
6693
+	public function countAllArrivalAirportCountriesByAirline($airline_icao, $filters = array())
6694 6694
 	{
6695
-		$filter_query = $this->getFilter($filters,true,true);
6696
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6695
+		$filter_query = $this->getFilter($filters, true, true);
6696
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6697 6697
 					
6698
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6698
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6699 6699
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
6700 6700
                     GROUP BY spotter_output.arrival_airport_country
6701 6701
 					ORDER BY airport_arrival_country_count DESC";
@@ -6707,7 +6707,7 @@  discard block
 block discarded – undo
6707 6707
 		$airport_array = array();
6708 6708
 		$temp_array = array();
6709 6709
         
6710
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6710
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6711 6711
 		{
6712 6712
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6713 6713
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6725,11 +6725,11 @@  discard block
 block discarded – undo
6725 6725
 	* @return Array the airport list
6726 6726
 	*
6727 6727
 	*/
6728
-	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
6728
+	public function countAllArrivalAirportsByAircraft($aircraft_icao, $filters = array())
6729 6729
 	{
6730
-		$filter_query = $this->getFilter($filters,true,true);
6731
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6732
-		$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 
6730
+		$filter_query = $this->getFilter($filters, true, true);
6731
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6732
+		$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 
6733 6733
 			    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 
6734 6734
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6735 6735
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -6741,7 +6741,7 @@  discard block
 block discarded – undo
6741 6741
 		$airport_array = array();
6742 6742
 		$temp_array = array();
6743 6743
         
6744
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6744
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6745 6745
 		{
6746 6746
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6747 6747
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6763,11 +6763,11 @@  discard block
 block discarded – undo
6763 6763
 	* @return Array the airport list
6764 6764
 	*
6765 6765
 	*/
6766
-	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
6766
+	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao, $filters = array())
6767 6767
 	{
6768
-		$filter_query = $this->getFilter($filters,true,true);
6769
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6770
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6768
+		$filter_query = $this->getFilter($filters, true, true);
6769
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6770
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6771 6771
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
6772 6772
                     GROUP BY spotter_output.arrival_airport_country
6773 6773
 					ORDER BY airport_arrival_country_count DESC";
@@ -6779,7 +6779,7 @@  discard block
 block discarded – undo
6779 6779
 		$airport_array = array();
6780 6780
 		$temp_array = array();
6781 6781
         
6782
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6782
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6783 6783
 		{
6784 6784
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6785 6785
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6797,12 +6797,12 @@  discard block
 block discarded – undo
6797 6797
 	* @return Array the airport list
6798 6798
 	*
6799 6799
 	*/
6800
-	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
6800
+	public function countAllArrivalAirportsByRegistration($registration, $filters = array())
6801 6801
 	{
6802
-		$filter_query = $this->getFilter($filters,true,true);
6803
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6802
+		$filter_query = $this->getFilter($filters, true, true);
6803
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6804 6804
 
6805
-		$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 
6805
+		$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 
6806 6806
 			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 
6807 6807
                     GROUP BY spotter_output.arrival_airport_icao
6808 6808
 					ORDER BY airport_arrival_icao_count DESC";
@@ -6814,7 +6814,7 @@  discard block
 block discarded – undo
6814 6814
 		$airport_array = array();
6815 6815
 		$temp_array = array();
6816 6816
         
6817
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6817
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6818 6818
 		{
6819 6819
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6820 6820
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6835,11 +6835,11 @@  discard block
 block discarded – undo
6835 6835
 	* @return Array the airport list
6836 6836
 	*
6837 6837
 	*/
6838
-	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
6838
+	public function countAllArrivalAirportCountriesByRegistration($registration, $filters = array())
6839 6839
 	{
6840
-		$filter_query = $this->getFilter($filters,true,true);
6841
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6842
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6840
+		$filter_query = $this->getFilter($filters, true, true);
6841
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6842
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6843 6843
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration 
6844 6844
                     GROUP BY spotter_output.arrival_airport_country
6845 6845
 					ORDER BY airport_arrival_country_count DESC";
@@ -6851,7 +6851,7 @@  discard block
 block discarded – undo
6851 6851
 		$airport_array = array();
6852 6852
 		$temp_array = array();
6853 6853
         
6854
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6854
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6855 6855
 		{
6856 6856
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6857 6857
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6870,11 +6870,11 @@  discard block
 block discarded – undo
6870 6870
 	* @return Array the airport list
6871 6871
 	*
6872 6872
 	*/
6873
-	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
6873
+	public function countAllArrivalAirportsByAirport($airport_icao, $filters = array())
6874 6874
 	{
6875
-		$filter_query = $this->getFilter($filters,true,true);
6876
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6877
-		$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 
6875
+		$filter_query = $this->getFilter($filters, true, true);
6876
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6877
+		$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 
6878 6878
 			    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 
6879 6879
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6880 6880
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -6886,7 +6886,7 @@  discard block
 block discarded – undo
6886 6886
 		$airport_array = array();
6887 6887
 		$temp_array = array();
6888 6888
         
6889
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6889
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6890 6890
 		{
6891 6891
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6892 6892
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6907,11 +6907,11 @@  discard block
 block discarded – undo
6907 6907
 	* @return Array the airport list
6908 6908
 	*
6909 6909
 	*/
6910
-	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
6910
+	public function countAllArrivalAirportCountriesByAirport($airport_icao, $filters = array())
6911 6911
 	{
6912
-		$filter_query = $this->getFilter($filters,true,true);
6913
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6914
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6912
+		$filter_query = $this->getFilter($filters, true, true);
6913
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6914
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6915 6915
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao 
6916 6916
                     GROUP BY spotter_output.arrival_airport_country
6917 6917
 					ORDER BY airport_arrival_country_count DESC";
@@ -6923,7 +6923,7 @@  discard block
 block discarded – undo
6923 6923
 		$airport_array = array();
6924 6924
 		$temp_array = array();
6925 6925
         
6926
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6926
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6927 6927
 		{
6928 6928
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6929 6929
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6941,11 +6941,11 @@  discard block
 block discarded – undo
6941 6941
 	* @return Array the airport list
6942 6942
 	*
6943 6943
 	*/
6944
-	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6944
+	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer, $filters = array())
6945 6945
 	{
6946
-		$filter_query = $this->getFilter($filters,true,true);
6947
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6948
-		$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 
6946
+		$filter_query = $this->getFilter($filters, true, true);
6947
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6948
+		$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 
6949 6949
 			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 
6950 6950
                     GROUP BY spotter_output.arrival_airport_icao
6951 6951
 					ORDER BY airport_arrival_icao_count DESC";
@@ -6957,7 +6957,7 @@  discard block
 block discarded – undo
6957 6957
 		$airport_array = array();
6958 6958
 		$temp_array = array();
6959 6959
         
6960
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6960
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6961 6961
 		{
6962 6962
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6963 6963
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6979,11 +6979,11 @@  discard block
 block discarded – undo
6979 6979
 	* @return Array the airport list
6980 6980
 	*
6981 6981
 	*/
6982
-	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6982
+	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
6983 6983
 	{
6984
-		$filter_query = $this->getFilter($filters,true,true);
6985
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6986
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6984
+		$filter_query = $this->getFilter($filters, true, true);
6985
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6986
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6987 6987
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6988 6988
                     GROUP BY spotter_output.arrival_airport_country
6989 6989
 					ORDER BY airport_arrival_country_count DESC";
@@ -6995,7 +6995,7 @@  discard block
 block discarded – undo
6995 6995
 		$airport_array = array();
6996 6996
 		$temp_array = array();
6997 6997
         
6998
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6998
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6999 6999
 		{
7000 7000
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7001 7001
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7014,11 +7014,11 @@  discard block
 block discarded – undo
7014 7014
 	* @return Array the airport list
7015 7015
 	*
7016 7016
 	*/
7017
-	public function countAllArrivalAirportsByDate($date,$filters = array())
7017
+	public function countAllArrivalAirportsByDate($date, $filters = array())
7018 7018
 	{
7019 7019
 		global $globalTimezone, $globalDBdriver;
7020
-		$filter_query = $this->getFilter($filters,true,true);
7021
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7020
+		$filter_query = $this->getFilter($filters, true, true);
7021
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7022 7022
 		if ($globalTimezone != '') {
7023 7023
 			date_default_timezone_set($globalTimezone);
7024 7024
 			$datetime = new DateTime($date);
@@ -7026,12 +7026,12 @@  discard block
 block discarded – undo
7026 7026
 		} else $offset = '+00:00';
7027 7027
 
7028 7028
 		if ($globalDBdriver == 'mysql') {
7029
-			$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 
7029
+			$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 
7030 7030
 					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  
7031 7031
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7032 7032
 					ORDER BY airport_arrival_icao_count DESC";
7033 7033
 		} else {
7034
-			$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 
7034
+			$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 
7035 7035
 					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  
7036 7036
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7037 7037
 					ORDER BY airport_arrival_icao_count DESC";
@@ -7043,7 +7043,7 @@  discard block
 block discarded – undo
7043 7043
 		$airport_array = array();
7044 7044
 		$temp_array = array();
7045 7045
         
7046
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7046
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7047 7047
 		{
7048 7048
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7049 7049
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7067,8 +7067,8 @@  discard block
 block discarded – undo
7067 7067
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
7068 7068
 	{
7069 7069
 		global $globalTimezone, $globalDBdriver;
7070
-		$filter_query = $this->getFilter($filters,true,true);
7071
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7070
+		$filter_query = $this->getFilter($filters, true, true);
7071
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7072 7072
 		if ($globalTimezone != '') {
7073 7073
 			date_default_timezone_set($globalTimezone);
7074 7074
 			$datetime = new DateTime($date);
@@ -7076,12 +7076,12 @@  discard block
 block discarded – undo
7076 7076
 		} else $offset = '+00:00';
7077 7077
 
7078 7078
 		if ($globalDBdriver == 'mysql') {
7079
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7079
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7080 7080
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
7081 7081
 					GROUP BY spotter_output.arrival_airport_country
7082 7082
 					ORDER BY airport_arrival_country_count DESC";
7083 7083
 		} else {
7084
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7084
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7085 7085
 					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 
7086 7086
 					GROUP BY spotter_output.arrival_airport_country
7087 7087
 					ORDER BY airport_arrival_country_count DESC";
@@ -7093,7 +7093,7 @@  discard block
 block discarded – undo
7093 7093
 		$airport_array = array();
7094 7094
 		$temp_array = array();
7095 7095
         
7096
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7096
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7097 7097
 		{
7098 7098
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7099 7099
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7111,11 +7111,11 @@  discard block
 block discarded – undo
7111 7111
 	* @return Array the airport list
7112 7112
 	*
7113 7113
 	*/
7114
-	public function countAllArrivalAirportsByIdent($ident,$filters = array())
7114
+	public function countAllArrivalAirportsByIdent($ident, $filters = array())
7115 7115
 	{
7116
-		$filter_query = $this->getFilter($filters,true,true);
7117
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7118
-		$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 
7116
+		$filter_query = $this->getFilter($filters, true, true);
7117
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7118
+		$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 
7119 7119
 		    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  
7120 7120
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7121 7121
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -7127,7 +7127,7 @@  discard block
 block discarded – undo
7127 7127
 		$airport_array = array();
7128 7128
 		$temp_array = array();
7129 7129
         
7130
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7130
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7131 7131
 		{
7132 7132
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7133 7133
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7150,9 +7150,9 @@  discard block
 block discarded – undo
7150 7150
 	*/
7151 7151
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
7152 7152
 	{
7153
-		$filter_query = $this->getFilter($filters,true,true);
7154
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7155
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7153
+		$filter_query = $this->getFilter($filters, true, true);
7154
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7155
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7156 7156
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident 
7157 7157
                     GROUP BY spotter_output.arrival_airport_country
7158 7158
 					ORDER BY airport_arrival_country_count DESC";
@@ -7164,7 +7164,7 @@  discard block
 block discarded – undo
7164 7164
 		$airport_array = array();
7165 7165
 		$temp_array = array();
7166 7166
         
7167
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7167
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7168 7168
 		{
7169 7169
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7170 7170
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7183,11 +7183,11 @@  discard block
 block discarded – undo
7183 7183
 	* @return Array the airport list
7184 7184
 	*
7185 7185
 	*/
7186
-	public function countAllArrivalAirportsByCountry($country,$filters = array())
7186
+	public function countAllArrivalAirportsByCountry($country, $filters = array())
7187 7187
 	{
7188
-		$filter_query = $this->getFilter($filters,true,true);
7189
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7190
-		$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 
7188
+		$filter_query = $this->getFilter($filters, true, true);
7189
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7190
+		$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 
7191 7191
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
7192 7192
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7193 7193
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7199,7 +7199,7 @@  discard block
 block discarded – undo
7199 7199
 		$airport_array = array();
7200 7200
 		$temp_array = array();
7201 7201
         
7202
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7202
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7203 7203
 		{
7204 7204
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7205 7205
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7220,11 +7220,11 @@  discard block
 block discarded – undo
7220 7220
 	* @return Array the airport list
7221 7221
 	*
7222 7222
 	*/
7223
-	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
7223
+	public function countAllArrivalAirportCountriesByCountry($country, $filters = array())
7224 7224
 	{
7225
-		$filter_query = $this->getFilter($filters,true,true);
7226
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7227
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7225
+		$filter_query = $this->getFilter($filters, true, true);
7226
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7227
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7228 7228
 			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 
7229 7229
                     GROUP BY spotter_output.arrival_airport_country
7230 7230
 					ORDER BY airport_arrival_country_count DESC";
@@ -7236,7 +7236,7 @@  discard block
 block discarded – undo
7236 7236
 		$airport_array = array();
7237 7237
 		$temp_array = array();
7238 7238
         
7239
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7239
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7240 7240
 		{
7241 7241
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7242 7242
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7257,7 +7257,7 @@  discard block
 block discarded – undo
7257 7257
 	*/
7258 7258
 	public function countAllDepartureCountries($filters = array())
7259 7259
 	{
7260
-		$filter_query = $this->getFilter($filters,true,true);
7260
+		$filter_query = $this->getFilter($filters, true, true);
7261 7261
 		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7262 7262
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
7263 7263
 		$query .= " GROUP BY spotter_output.departure_airport_country
@@ -7271,7 +7271,7 @@  discard block
 block discarded – undo
7271 7271
 		$airport_array = array();
7272 7272
 		$temp_array = array();
7273 7273
         
7274
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7274
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7275 7275
 		{
7276 7276
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
7277 7277
 			$temp_array['airport_departure_country'] = $row['departure_airport_country'];
@@ -7289,9 +7289,9 @@  discard block
 block discarded – undo
7289 7289
 	* @return Array the airport arrival list
7290 7290
 	*
7291 7291
 	*/
7292
-	public function countAllArrivalCountries($limit = true,$filters = array())
7292
+	public function countAllArrivalCountries($limit = true, $filters = array())
7293 7293
 	{
7294
-		$filter_query = $this->getFilter($filters,true,true);
7294
+		$filter_query = $this->getFilter($filters, true, true);
7295 7295
 		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7296 7296
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
7297 7297
 		$query .= " GROUP BY spotter_output.arrival_airport_country
@@ -7305,7 +7305,7 @@  discard block
 block discarded – undo
7305 7305
 		$airport_array = array();
7306 7306
 		$temp_array = array();
7307 7307
         
7308
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7308
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7309 7309
 		{
7310 7310
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
7311 7311
 			$temp_array['airport_arrival_country'] = $row['arrival_airport_country'];
@@ -7328,8 +7328,8 @@  discard block
 block discarded – undo
7328 7328
 	*/
7329 7329
 	public function countAllRoutes($filters = array())
7330 7330
 	{
7331
-		$filter_query = $this->getFilter($filters,true,true);
7332
-		$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
7331
+		$filter_query = $this->getFilter($filters, true, true);
7332
+		$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
7333 7333
 		    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 <> ''
7334 7334
                     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
7335 7335
                     ORDER BY route_count DESC
@@ -7342,7 +7342,7 @@  discard block
 block discarded – undo
7342 7342
 		$routes_array = array();
7343 7343
 		$temp_array = array();
7344 7344
         
7345
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7345
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7346 7346
 		{
7347 7347
 			$temp_array['route_count'] = $row['route_count'];
7348 7348
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7369,11 +7369,11 @@  discard block
 block discarded – undo
7369 7369
 	* @return Array the route list
7370 7370
 	*
7371 7371
 	*/
7372
-	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
7372
+	public function countAllRoutesByAircraft($aircraft_icao, $filters = array())
7373 7373
 	{
7374
-		$filter_query = $this->getFilter($filters,true,true);
7375
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7376
-		$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
7374
+		$filter_query = $this->getFilter($filters, true, true);
7375
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7376
+		$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
7377 7377
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
7378 7378
 			    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 
7379 7379
 			    ORDER BY route_count DESC";
@@ -7384,7 +7384,7 @@  discard block
 block discarded – undo
7384 7384
 		$routes_array = array();
7385 7385
 		$temp_array = array();
7386 7386
         
7387
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7387
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7388 7388
 		{
7389 7389
 			$temp_array['route_count'] = $row['route_count'];
7390 7390
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7411,9 +7411,9 @@  discard block
 block discarded – undo
7411 7411
 	*/
7412 7412
 	public function countAllRoutesByRegistration($registration, $filters = array())
7413 7413
 	{
7414
-		$filter_query = $this->getFilter($filters,true,true);
7414
+		$filter_query = $this->getFilter($filters, true, true);
7415 7415
 		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7416
-		$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
7416
+		$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
7417 7417
 			FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.registration = :registration 
7418 7418
                     GROUP BY route
7419 7419
                     ORDER BY route_count DESC";
@@ -7425,7 +7425,7 @@  discard block
 block discarded – undo
7425 7425
 		$routes_array = array();
7426 7426
 		$temp_array = array();
7427 7427
         
7428
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7428
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7429 7429
 		{
7430 7430
 			$temp_array['route_count'] = $row['route_count'];
7431 7431
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7453,9 +7453,9 @@  discard block
 block discarded – undo
7453 7453
 	*/
7454 7454
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
7455 7455
 	{
7456
-		$filter_query = $this->getFilter($filters,true,true);
7457
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7458
-		$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
7456
+		$filter_query = $this->getFilter($filters, true, true);
7457
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7458
+		$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
7459 7459
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao 
7460 7460
 			    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 
7461 7461
 			    ORDER BY route_count DESC";
@@ -7467,7 +7467,7 @@  discard block
 block discarded – undo
7467 7467
 		$routes_array = array();
7468 7468
 		$temp_array = array();
7469 7469
         
7470
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7470
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7471 7471
 		{
7472 7472
 			$temp_array['route_count'] = $row['route_count'];
7473 7473
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7495,9 +7495,9 @@  discard block
 block discarded – undo
7495 7495
 	*/
7496 7496
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
7497 7497
 	{
7498
-		$filter_query = $this->getFilter($filters,true,true);
7499
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7500
-		$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
7498
+		$filter_query = $this->getFilter($filters, true, true);
7499
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7500
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7501 7501
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
7502 7502
 			    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 
7503 7503
 			    ORDER BY route_count DESC";
@@ -7508,7 +7508,7 @@  discard block
 block discarded – undo
7508 7508
 		$routes_array = array();
7509 7509
 		$temp_array = array();
7510 7510
         
7511
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7511
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7512 7512
 		{
7513 7513
 			$temp_array['route_count'] = $row['route_count'];
7514 7514
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7536,9 +7536,9 @@  discard block
 block discarded – undo
7536 7536
 	*/
7537 7537
 	public function countAllRoutesByCountry($country, $filters = array())
7538 7538
 	{
7539
-		$filter_query = $this->getFilter($filters,true,true);
7540
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7541
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7539
+		$filter_query = $this->getFilter($filters, true, true);
7540
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7541
+		$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
7542 7542
 			    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 
7543 7543
 			    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 
7544 7544
 			    ORDER BY route_count DESC";
@@ -7549,7 +7549,7 @@  discard block
 block discarded – undo
7549 7549
 		$routes_array = array();
7550 7550
 		$temp_array = array();
7551 7551
         
7552
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7552
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7553 7553
 		{
7554 7554
 			$temp_array['route_count'] = $row['route_count'];
7555 7555
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7577,8 +7577,8 @@  discard block
 block discarded – undo
7577 7577
 	public function countAllRoutesByDate($date, $filters = array())
7578 7578
 	{
7579 7579
 		global $globalTimezone, $globalDBdriver;
7580
-		$filter_query = $this->getFilter($filters,true,true);
7581
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7580
+		$filter_query = $this->getFilter($filters, true, true);
7581
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7582 7582
 		if ($globalTimezone != '') {
7583 7583
 			date_default_timezone_set($globalTimezone);
7584 7584
 			$datetime = new DateTime($date);
@@ -7586,12 +7586,12 @@  discard block
 block discarded – undo
7586 7586
 		} else $offset = '+00:00';
7587 7587
 		
7588 7588
 		if ($globalDBdriver == 'mysql') {
7589
-			$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
7589
+			$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
7590 7590
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
7591 7591
 				    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
7592 7592
 				    ORDER BY route_count DESC";
7593 7593
 		} else {
7594
-			$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
7594
+			$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
7595 7595
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
7596 7596
 				    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
7597 7597
 				    ORDER BY route_count DESC";
@@ -7603,7 +7603,7 @@  discard block
 block discarded – undo
7603 7603
 		$routes_array = array();
7604 7604
 		$temp_array = array();
7605 7605
         
7606
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7606
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7607 7607
 		{
7608 7608
 			$temp_array['route_count'] = $row['route_count'];
7609 7609
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7630,9 +7630,9 @@  discard block
 block discarded – undo
7630 7630
 	*/
7631 7631
 	public function countAllRoutesByIdent($ident, $filters = array())
7632 7632
 	{
7633
-		$filter_query = $this->getFilter($filters,true,true);
7634
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7635
-		$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
7633
+		$filter_query = $this->getFilter($filters, true, true);
7634
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7635
+		$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
7636 7636
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.ident = :ident   
7637 7637
                     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
7638 7638
                     ORDER BY route_count DESC";
@@ -7644,7 +7644,7 @@  discard block
 block discarded – undo
7644 7644
 		$routes_array = array();
7645 7645
 		$temp_array = array();
7646 7646
         
7647
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7647
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7648 7648
 		{
7649 7649
 			$temp_array['route_count'] = $row['route_count'];
7650 7650
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7671,9 +7671,9 @@  discard block
 block discarded – undo
7671 7671
 	*/
7672 7672
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
7673 7673
 	{
7674
-		$filter_query = $this->getFilter($filters,true,true);
7675
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7676
-		$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
7674
+		$filter_query = $this->getFilter($filters, true, true);
7675
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7676
+		$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
7677 7677
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
7678 7678
                     GROUP BY route
7679 7679
                     ORDER BY route_count DESC";
@@ -7685,7 +7685,7 @@  discard block
 block discarded – undo
7685 7685
 		$routes_array = array();
7686 7686
 		$temp_array = array();
7687 7687
         
7688
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7688
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7689 7689
 		{
7690 7690
 			$temp_array['route_count'] = $row['route_count'];
7691 7691
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7713,8 +7713,8 @@  discard block
 block discarded – undo
7713 7713
 	*/
7714 7714
 	public function countAllRoutesWithWaypoints($filters = array())
7715 7715
 	{
7716
-		$filter_query = $this->getFilter($filters,true,true);
7717
-		$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
7716
+		$filter_query = $this->getFilter($filters, true, true);
7717
+		$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
7718 7718
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.waypoints <> '' 
7719 7719
                     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
7720 7720
                     ORDER BY route_count DESC
@@ -7727,7 +7727,7 @@  discard block
 block discarded – undo
7727 7727
 		$routes_array = array();
7728 7728
 		$temp_array = array();
7729 7729
         
7730
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7730
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7731 7731
 		{
7732 7732
 			$temp_array['spotter_id'] = $row['spotter_id'];
7733 7733
 			$temp_array['route_count'] = $row['route_count'];
@@ -7752,11 +7752,11 @@  discard block
 block discarded – undo
7752 7752
 	* @return Array the callsign list
7753 7753
 	*
7754 7754
 	*/
7755
-	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
7755
+	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7756 7756
 	{
7757 7757
 		global $globalDBdriver;
7758
-		$filter_query = $this->getFilter($filters,true,true);
7759
-		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7758
+		$filter_query = $this->getFilter($filters, true, true);
7759
+		$query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7760 7760
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
7761 7761
 		 if ($olderthanmonths > 0) {
7762 7762
 			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
@@ -7775,7 +7775,7 @@  discard block
 block discarded – undo
7775 7775
 		$callsign_array = array();
7776 7776
 		$temp_array = array();
7777 7777
         
7778
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7778
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7779 7779
 		{
7780 7780
 			$temp_array['callsign_icao'] = $row['ident'];
7781 7781
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -7797,8 +7797,8 @@  discard block
 block discarded – undo
7797 7797
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7798 7798
 	{
7799 7799
 		global $globalDBdriver;
7800
-		$filter_query = $this->getFilter($filters,true,true);
7801
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7800
+		$filter_query = $this->getFilter($filters, true, true);
7801
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7802 7802
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
7803 7803
 		 if ($olderthanmonths > 0) {
7804 7804
 			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
@@ -7817,7 +7817,7 @@  discard block
 block discarded – undo
7817 7817
 		$callsign_array = array();
7818 7818
 		$temp_array = array();
7819 7819
         
7820
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7820
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7821 7821
 		{
7822 7822
 			$temp_array['callsign_icao'] = $row['ident'];
7823 7823
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -7871,7 +7871,7 @@  discard block
 block discarded – undo
7871 7871
 		$date_array = array();
7872 7872
 		$temp_array = array();
7873 7873
         
7874
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7874
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7875 7875
 		{
7876 7876
 			$temp_array['date_name'] = $row['date_name'];
7877 7877
 			$temp_array['date_count'] = $row['date_count'];
@@ -7896,15 +7896,15 @@  discard block
 block discarded – undo
7896 7896
 			$datetime = new DateTime();
7897 7897
 			$offset = $datetime->format('P');
7898 7898
 		} else $offset = '+00:00';
7899
-		$filter_query = $this->getFilter($filters,true,true);
7899
+		$filter_query = $this->getFilter($filters, true, true);
7900 7900
 		if ($globalDBdriver == 'mysql') {
7901
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7901
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7902 7902
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
7903 7903
 								GROUP BY spotter_output.airline_icao, date_name 
7904 7904
 								ORDER BY date_count DESC
7905 7905
 								LIMIT 10 OFFSET 0";
7906 7906
 		} else {
7907
-			$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
7907
+			$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
7908 7908
 								FROM spotter_output 
7909 7909
 								WHERE spotter_output.airline_icao <> '' 
7910 7910
 								GROUP BY spotter_output.airline_icao, date_name 
@@ -7919,7 +7919,7 @@  discard block
 block discarded – undo
7919 7919
 		$date_array = array();
7920 7920
 		$temp_array = array();
7921 7921
         
7922
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7922
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7923 7923
 		{
7924 7924
 			$temp_array['date_name'] = $row['date_name'];
7925 7925
 			$temp_array['date_count'] = $row['date_count'];
@@ -7945,7 +7945,7 @@  discard block
 block discarded – undo
7945 7945
 			$datetime = new DateTime();
7946 7946
 			$offset = $datetime->format('P');
7947 7947
 		} else $offset = '+00:00';
7948
-		$filter_query = $this->getFilter($filters,true,true);
7948
+		$filter_query = $this->getFilter($filters, true, true);
7949 7949
 		if ($globalDBdriver == 'mysql') {
7950 7950
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7951 7951
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -7966,7 +7966,7 @@  discard block
 block discarded – undo
7966 7966
 		$date_array = array();
7967 7967
 		$temp_array = array();
7968 7968
         
7969
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7969
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7970 7970
 		{
7971 7971
 			$temp_array['date_name'] = $row['date_name'];
7972 7972
 			$temp_array['date_count'] = $row['date_count'];
@@ -7991,7 +7991,7 @@  discard block
 block discarded – undo
7991 7991
 			$datetime = new DateTime();
7992 7992
 			$offset = $datetime->format('P');
7993 7993
 		} else $offset = '+00:00';
7994
-		$filter_query = $this->getFilter($filters,true,true);
7994
+		$filter_query = $this->getFilter($filters, true, true);
7995 7995
 		if ($globalDBdriver == 'mysql') {
7996 7996
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7997 7997
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)";
@@ -8012,7 +8012,7 @@  discard block
 block discarded – undo
8012 8012
 		$date_array = array();
8013 8013
 		$temp_array = array();
8014 8014
         
8015
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8015
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8016 8016
 		{
8017 8017
 			$temp_array['date_name'] = $row['date_name'];
8018 8018
 			$temp_array['date_count'] = $row['date_count'];
@@ -8033,7 +8033,7 @@  discard block
 block discarded – undo
8033 8033
 	public function countAllDatesLastMonthByAirlines($filters = array())
8034 8034
 	{
8035 8035
 		global $globalTimezone, $globalDBdriver;
8036
-		$filter_query = $this->getFilter($filters,true,true);
8036
+		$filter_query = $this->getFilter($filters, true, true);
8037 8037
 		if ($globalTimezone != '') {
8038 8038
 			date_default_timezone_set($globalTimezone);
8039 8039
 			$datetime = new DateTime();
@@ -8041,13 +8041,13 @@  discard block
 block discarded – undo
8041 8041
 		} else $offset = '+00:00';
8042 8042
 		
8043 8043
 		if ($globalDBdriver == 'mysql') {
8044
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
8044
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
8045 8045
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)
8046 8046
 								GROUP BY spotter_output.airline_icao, date_name 
8047 8047
 								ORDER BY spotter_output.date ASC";
8048 8048
 			$query_data = array(':offset' => $offset);
8049 8049
 		} else {
8050
-			$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
8050
+			$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
8051 8051
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS'
8052 8052
 								GROUP BY spotter_output.airline_icao, date_name 
8053 8053
 								ORDER BY date_name ASC";
@@ -8060,7 +8060,7 @@  discard block
 block discarded – undo
8060 8060
 		$date_array = array();
8061 8061
 		$temp_array = array();
8062 8062
         
8063
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8063
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8064 8064
 		{
8065 8065
 			$temp_array['date_name'] = $row['date_name'];
8066 8066
 			$temp_array['date_count'] = $row['date_count'];
@@ -8107,7 +8107,7 @@  discard block
 block discarded – undo
8107 8107
 		$date_array = array();
8108 8108
 		$temp_array = array();
8109 8109
         
8110
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8110
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8111 8111
 		{
8112 8112
 			$temp_array['month_name'] = $row['month_name'];
8113 8113
 			$temp_array['year_name'] = $row['year_name'];
@@ -8128,7 +8128,7 @@  discard block
 block discarded – undo
8128 8128
 	public function countAllMonthsByAirlines($filters = array())
8129 8129
 	{
8130 8130
 		global $globalTimezone, $globalDBdriver;
8131
-		$filter_query = $this->getFilter($filters,true,true);
8131
+		$filter_query = $this->getFilter($filters, true, true);
8132 8132
 		if ($globalTimezone != '') {
8133 8133
 			date_default_timezone_set($globalTimezone);
8134 8134
 			$datetime = new DateTime();
@@ -8136,12 +8136,12 @@  discard block
 block discarded – undo
8136 8136
 		} else $offset = '+00:00';
8137 8137
 
8138 8138
 		if ($globalDBdriver == 'mysql') {
8139
-			$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
8139
+			$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
8140 8140
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8141 8141
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
8142 8142
 								ORDER BY date_count DESC";
8143 8143
 		} else {
8144
-			$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
8144
+			$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
8145 8145
 								FROM spotter_output 
8146 8146
 								WHERE spotter_output.airline_icao <> '' 
8147 8147
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
@@ -8155,7 +8155,7 @@  discard block
 block discarded – undo
8155 8155
 		$date_array = array();
8156 8156
 		$temp_array = array();
8157 8157
         
8158
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8158
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8159 8159
 		{
8160 8160
 			$temp_array['month_name'] = $row['month_name'];
8161 8161
 			$temp_array['year_name'] = $row['year_name'];
@@ -8182,14 +8182,14 @@  discard block
 block discarded – undo
8182 8182
 			$datetime = new DateTime();
8183 8183
 			$offset = $datetime->format('P');
8184 8184
 		} else $offset = '+00:00';
8185
-		$filter_query = $this->getFilter($filters,true,true);
8185
+		$filter_query = $this->getFilter($filters, true, true);
8186 8186
 		if ($globalDBdriver == 'mysql') {
8187
-			$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
8187
+			$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
8188 8188
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
8189 8189
 								GROUP BY year_name, month_name 
8190 8190
 								ORDER BY date_count DESC";
8191 8191
 		} else {
8192
-			$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
8192
+			$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
8193 8193
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
8194 8194
 								GROUP BY year_name, month_name 
8195 8195
 								ORDER BY date_count DESC";
@@ -8201,7 +8201,7 @@  discard block
 block discarded – undo
8201 8201
 		$date_array = array();
8202 8202
 		$temp_array = array();
8203 8203
         
8204
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8204
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8205 8205
 		{
8206 8206
 			$temp_array['month_name'] = $row['month_name'];
8207 8207
 			$temp_array['year_name'] = $row['year_name'];
@@ -8227,15 +8227,15 @@  discard block
 block discarded – undo
8227 8227
 			$datetime = new DateTime();
8228 8228
 			$offset = $datetime->format('P');
8229 8229
 		} else $offset = '+00:00';
8230
-		$filter_query = $this->getFilter($filters,true,true);
8230
+		$filter_query = $this->getFilter($filters, true, true);
8231 8231
 
8232 8232
 		if ($globalDBdriver == 'mysql') {
8233
-			$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
8233
+			$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
8234 8234
 								FROM spotter_output".$filter_query." owner_name <> ''
8235 8235
 								GROUP BY year_name, month_name
8236 8236
 								ORDER BY date_count DESC";
8237 8237
 		} else {
8238
-			$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
8238
+			$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
8239 8239
 								FROM spotter_output".$filter_query." owner_name <> ''
8240 8240
 								GROUP BY year_name, month_name
8241 8241
 								ORDER BY date_count DESC";
@@ -8247,7 +8247,7 @@  discard block
 block discarded – undo
8247 8247
 		$date_array = array();
8248 8248
 		$temp_array = array();
8249 8249
         
8250
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8250
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8251 8251
 		{
8252 8252
 			$temp_array['month_name'] = $row['month_name'];
8253 8253
 			$temp_array['year_name'] = $row['year_name'];
@@ -8268,7 +8268,7 @@  discard block
 block discarded – undo
8268 8268
 	public function countAllMonthsOwnersByAirlines($filters = array())
8269 8269
 	{
8270 8270
 		global $globalTimezone, $globalDBdriver;
8271
-		$filter_query = $this->getFilter($filters,true,true);
8271
+		$filter_query = $this->getFilter($filters, true, true);
8272 8272
 		if ($globalTimezone != '') {
8273 8273
 			date_default_timezone_set($globalTimezone);
8274 8274
 			$datetime = new DateTime();
@@ -8276,12 +8276,12 @@  discard block
 block discarded – undo
8276 8276
 		} else $offset = '+00:00';
8277 8277
 
8278 8278
 		if ($globalDBdriver == 'mysql') {
8279
-			$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
8279
+			$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
8280 8280
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
8281 8281
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8282 8282
 								ORDER BY date_count DESC";
8283 8283
 		} else {
8284
-			$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
8284
+			$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
8285 8285
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
8286 8286
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8287 8287
 								ORDER BY date_count DESC";
@@ -8293,7 +8293,7 @@  discard block
 block discarded – undo
8293 8293
 		$date_array = array();
8294 8294
 		$temp_array = array();
8295 8295
         
8296
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8296
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8297 8297
 		{
8298 8298
 			$temp_array['month_name'] = $row['month_name'];
8299 8299
 			$temp_array['year_name'] = $row['year_name'];
@@ -8320,15 +8320,15 @@  discard block
 block discarded – undo
8320 8320
 			$datetime = new DateTime();
8321 8321
 			$offset = $datetime->format('P');
8322 8322
 		} else $offset = '+00:00';
8323
-		$filter_query = $this->getFilter($filters,true,true);
8323
+		$filter_query = $this->getFilter($filters, true, true);
8324 8324
 
8325 8325
 		if ($globalDBdriver == 'mysql') {
8326
-			$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
8326
+			$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
8327 8327
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
8328 8328
 								GROUP BY year_name, month_name
8329 8329
 								ORDER BY date_count DESC";
8330 8330
 		} else {
8331
-			$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
8331
+			$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
8332 8332
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
8333 8333
 								GROUP BY year_name, month_name
8334 8334
 								ORDER BY date_count DESC";
@@ -8340,7 +8340,7 @@  discard block
 block discarded – undo
8340 8340
 		$date_array = array();
8341 8341
 		$temp_array = array();
8342 8342
         
8343
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8343
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8344 8344
 		{
8345 8345
 			$temp_array['month_name'] = $row['month_name'];
8346 8346
 			$temp_array['year_name'] = $row['year_name'];
@@ -8361,7 +8361,7 @@  discard block
 block discarded – undo
8361 8361
 	public function countAllMonthsPilotsByAirlines($filters = array())
8362 8362
 	{
8363 8363
 		global $globalTimezone, $globalDBdriver;
8364
-		$filter_query = $this->getFilter($filters,true,true);
8364
+		$filter_query = $this->getFilter($filters, true, true);
8365 8365
 		if ($globalTimezone != '') {
8366 8366
 			date_default_timezone_set($globalTimezone);
8367 8367
 			$datetime = new DateTime();
@@ -8369,12 +8369,12 @@  discard block
 block discarded – undo
8369 8369
 		} else $offset = '+00:00';
8370 8370
 
8371 8371
 		if ($globalDBdriver == 'mysql') {
8372
-			$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
8372
+			$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
8373 8373
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
8374 8374
 								GROUP BY spotter_output.airline_icao,year_name, month_name
8375 8375
 								ORDER BY date_count DESC";
8376 8376
 		} else {
8377
-			$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
8377
+			$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
8378 8378
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
8379 8379
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8380 8380
 								ORDER BY date_count DESC";
@@ -8386,7 +8386,7 @@  discard block
 block discarded – undo
8386 8386
 		$date_array = array();
8387 8387
 		$temp_array = array();
8388 8388
         
8389
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8389
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8390 8390
 		{
8391 8391
 			$temp_array['month_name'] = $row['month_name'];
8392 8392
 			$temp_array['year_name'] = $row['year_name'];
@@ -8408,7 +8408,7 @@  discard block
 block discarded – undo
8408 8408
 	public function countAllMonthsAirlines($filters = array())
8409 8409
 	{
8410 8410
 		global $globalTimezone, $globalDBdriver;
8411
-		$filter_query = $this->getFilter($filters,true,true);
8411
+		$filter_query = $this->getFilter($filters, true, true);
8412 8412
 		if ($globalTimezone != '') {
8413 8413
 			date_default_timezone_set($globalTimezone);
8414 8414
 			$datetime = new DateTime();
@@ -8416,12 +8416,12 @@  discard block
 block discarded – undo
8416 8416
 		} else $offset = '+00:00';
8417 8417
 
8418 8418
 		if ($globalDBdriver == 'mysql') {
8419
-			$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
8419
+			$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
8420 8420
 								FROM spotter_output".$filter_query." airline_icao <> '' 
8421 8421
 								GROUP BY year_name, month_name
8422 8422
 								ORDER BY date_count DESC";
8423 8423
 		} else {
8424
-			$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
8424
+			$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
8425 8425
 								FROM spotter_output".$filter_query." airline_icao <> '' 
8426 8426
 								GROUP BY year_name, month_name
8427 8427
 								ORDER BY date_count DESC";
@@ -8433,7 +8433,7 @@  discard block
 block discarded – undo
8433 8433
 		$date_array = array();
8434 8434
 		$temp_array = array();
8435 8435
         
8436
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8436
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8437 8437
 		{
8438 8438
 			$temp_array['month_name'] = $row['month_name'];
8439 8439
 			$temp_array['year_name'] = $row['year_name'];
@@ -8459,15 +8459,15 @@  discard block
 block discarded – undo
8459 8459
 			$datetime = new DateTime();
8460 8460
 			$offset = $datetime->format('P');
8461 8461
 		} else $offset = '+00:00';
8462
-		$filter_query = $this->getFilter($filters,true,true);
8462
+		$filter_query = $this->getFilter($filters, true, true);
8463 8463
 
8464 8464
 		if ($globalDBdriver == 'mysql') {
8465
-			$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
8465
+			$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
8466 8466
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
8467 8467
 								GROUP BY year_name, month_name
8468 8468
 								ORDER BY date_count DESC";
8469 8469
 		} else {
8470
-			$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
8470
+			$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
8471 8471
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
8472 8472
 								GROUP BY year_name, month_name
8473 8473
 								ORDER BY date_count DESC";
@@ -8479,7 +8479,7 @@  discard block
 block discarded – undo
8479 8479
 		$date_array = array();
8480 8480
 		$temp_array = array();
8481 8481
         
8482
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8482
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8483 8483
 		{
8484 8484
 			$temp_array['month_name'] = $row['month_name'];
8485 8485
 			$temp_array['year_name'] = $row['year_name'];
@@ -8501,7 +8501,7 @@  discard block
 block discarded – undo
8501 8501
 	public function countAllMonthsAircraftsByAirlines($filters = array())
8502 8502
 	{
8503 8503
 		global $globalTimezone, $globalDBdriver;
8504
-		$filter_query = $this->getFilter($filters,true,true);
8504
+		$filter_query = $this->getFilter($filters, true, true);
8505 8505
 		if ($globalTimezone != '') {
8506 8506
 			date_default_timezone_set($globalTimezone);
8507 8507
 			$datetime = new DateTime();
@@ -8509,12 +8509,12 @@  discard block
 block discarded – undo
8509 8509
 		} else $offset = '+00:00';
8510 8510
 
8511 8511
 		if ($globalDBdriver == 'mysql') {
8512
-			$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
8512
+			$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
8513 8513
 								FROM spotter_output".$filter_query." aircraft_icao <> ''  AND spotter_output.airline_icao <> '' 
8514 8514
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8515 8515
 								ORDER BY date_count DESC";
8516 8516
 		} else {
8517
-			$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
8517
+			$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
8518 8518
 								FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' 
8519 8519
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8520 8520
 								ORDER BY date_count DESC";
@@ -8526,7 +8526,7 @@  discard block
 block discarded – undo
8526 8526
 		$date_array = array();
8527 8527
 		$temp_array = array();
8528 8528
         
8529
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8529
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8530 8530
 		{
8531 8531
 			$temp_array['month_name'] = $row['month_name'];
8532 8532
 			$temp_array['year_name'] = $row['year_name'];
@@ -8553,15 +8553,15 @@  discard block
 block discarded – undo
8553 8553
 			$datetime = new DateTime();
8554 8554
 			$offset = $datetime->format('P');
8555 8555
 		} else $offset = '+00:00';
8556
-		$filter_query = $this->getFilter($filters,true,true);
8556
+		$filter_query = $this->getFilter($filters, true, true);
8557 8557
 
8558 8558
 		if ($globalDBdriver == 'mysql') {
8559
-			$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
8559
+			$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
8560 8560
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
8561 8561
 								GROUP BY year_name, month_name
8562 8562
 								ORDER BY date_count DESC";
8563 8563
 		} else {
8564
-			$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
8564
+			$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
8565 8565
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
8566 8566
 								GROUP BY year_name, month_name
8567 8567
 								ORDER BY date_count DESC";
@@ -8573,7 +8573,7 @@  discard block
 block discarded – undo
8573 8573
 		$date_array = array();
8574 8574
 		$temp_array = array();
8575 8575
         
8576
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8576
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8577 8577
 		{
8578 8578
 			$temp_array['month_name'] = $row['month_name'];
8579 8579
 			$temp_array['year_name'] = $row['year_name'];
@@ -8595,7 +8595,7 @@  discard block
 block discarded – undo
8595 8595
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
8596 8596
 	{
8597 8597
 		global $globalTimezone, $globalDBdriver;
8598
-		$filter_query = $this->getFilter($filters,true,true);
8598
+		$filter_query = $this->getFilter($filters, true, true);
8599 8599
 		if ($globalTimezone != '') {
8600 8600
 			date_default_timezone_set($globalTimezone);
8601 8601
 			$datetime = new DateTime();
@@ -8603,12 +8603,12 @@  discard block
 block discarded – undo
8603 8603
 		} else $offset = '+00:00';
8604 8604
 
8605 8605
 		if ($globalDBdriver == 'mysql') {
8606
-			$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
8606
+			$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
8607 8607
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
8608 8608
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8609 8609
 								ORDER BY date_count DESC";
8610 8610
 		} else {
8611
-			$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
8611
+			$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
8612 8612
 								FROM spotter_output".$filter_query." real_arrival_airport_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";
@@ -8620,7 +8620,7 @@  discard block
 block discarded – undo
8620 8620
 		$date_array = array();
8621 8621
 		$temp_array = array();
8622 8622
         
8623
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8623
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8624 8624
 		{
8625 8625
 			$temp_array['month_name'] = $row['month_name'];
8626 8626
 			$temp_array['year_name'] = $row['year_name'];
@@ -8648,7 +8648,7 @@  discard block
 block discarded – undo
8648 8648
 			$datetime = new DateTime();
8649 8649
 			$offset = $datetime->format('P');
8650 8650
 		} else $offset = '+00:00';
8651
-		$filter_query = $this->getFilter($filters,true,true);
8651
+		$filter_query = $this->getFilter($filters, true, true);
8652 8652
 		if ($globalDBdriver == 'mysql') {
8653 8653
 			$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
8654 8654
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
@@ -8669,7 +8669,7 @@  discard block
 block discarded – undo
8669 8669
 		$date_array = array();
8670 8670
 		$temp_array = array();
8671 8671
         
8672
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8672
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8673 8673
 		{
8674 8674
 			$temp_array['year_name'] = $row['year_name'];
8675 8675
 			$temp_array['month_name'] = $row['month_name'];
@@ -8689,7 +8689,7 @@  discard block
 block discarded – undo
8689 8689
 	* @return Array the hour list
8690 8690
 	*
8691 8691
 	*/
8692
-	public function countAllHours($orderby,$filters = array())
8692
+	public function countAllHours($orderby, $filters = array())
8693 8693
 	{
8694 8694
 		global $globalTimezone, $globalDBdriver;
8695 8695
 		if ($globalTimezone != '') {
@@ -8737,7 +8737,7 @@  discard block
 block discarded – undo
8737 8737
 		$hour_array = array();
8738 8738
 		$temp_array = array();
8739 8739
         
8740
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8740
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8741 8741
 		{
8742 8742
 			$temp_array['hour_name'] = $row['hour_name'];
8743 8743
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8757,7 +8757,7 @@  discard block
 block discarded – undo
8757 8757
 	public function countAllHoursByAirlines($orderby, $filters = array())
8758 8758
 	{
8759 8759
 		global $globalTimezone, $globalDBdriver;
8760
-		$filter_query = $this->getFilter($filters,true,true);
8760
+		$filter_query = $this->getFilter($filters, true, true);
8761 8761
 		if ($globalTimezone != '') {
8762 8762
 			date_default_timezone_set($globalTimezone);
8763 8763
 			$datetime = new DateTime();
@@ -8775,7 +8775,7 @@  discard block
 block discarded – undo
8775 8775
 		}
8776 8776
 		
8777 8777
 		if ($globalDBdriver == 'mysql') {
8778
-			$query  = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8778
+			$query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8779 8779
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8780 8780
 								GROUP BY spotter_output.airline_icao, hour_name 
8781 8781
 								".$orderby_sql;
@@ -8788,7 +8788,7 @@  discard block
 block discarded – undo
8788 8788
   */    
8789 8789
 		$query_data = array(':offset' => $offset);
8790 8790
 		} else {
8791
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8791
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8792 8792
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8793 8793
 								GROUP BY spotter_output.airline_icao, hour_name 
8794 8794
 								".$orderby_sql;
@@ -8801,7 +8801,7 @@  discard block
 block discarded – undo
8801 8801
 		$hour_array = array();
8802 8802
 		$temp_array = array();
8803 8803
         
8804
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8804
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8805 8805
 		{
8806 8806
 			$temp_array['hour_name'] = $row['hour_name'];
8807 8807
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8824,34 +8824,34 @@  discard block
 block discarded – undo
8824 8824
 	public function countAllHoursByAirline($airline_icao, $filters = array())
8825 8825
 	{
8826 8826
 		global $globalTimezone, $globalDBdriver;
8827
-		$filter_query = $this->getFilter($filters,true,true);
8827
+		$filter_query = $this->getFilter($filters, true, true);
8828 8828
 		if ($globalTimezone != '') {
8829 8829
 			date_default_timezone_set($globalTimezone);
8830 8830
 			$datetime = new DateTime();
8831 8831
 			$offset = $datetime->format('P');
8832 8832
 		} else $offset = '+00:00';
8833 8833
 
8834
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8834
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
8835 8835
 
8836 8836
 		if ($globalDBdriver == 'mysql') {
8837
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8837
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8838 8838
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
8839 8839
 								GROUP BY hour_name 
8840 8840
 								ORDER BY hour_name ASC";
8841 8841
 		} else {
8842
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8842
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8843 8843
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
8844 8844
 								GROUP BY hour_name 
8845 8845
 								ORDER BY hour_name ASC";
8846 8846
 		}
8847 8847
 		
8848 8848
 		$sth = $this->db->prepare($query);
8849
-		$sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset));
8849
+		$sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset));
8850 8850
       
8851 8851
 		$hour_array = array();
8852 8852
 		$temp_array = array();
8853 8853
         
8854
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8854
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8855 8855
 		{
8856 8856
 			$temp_array['hour_name'] = $row['hour_name'];
8857 8857
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8874,8 +8874,8 @@  discard block
 block discarded – undo
8874 8874
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
8875 8875
 	{
8876 8876
 		global $globalTimezone, $globalDBdriver;
8877
-		$filter_query = $this->getFilter($filters,true,true);
8878
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
8877
+		$filter_query = $this->getFilter($filters, true, true);
8878
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
8879 8879
 		if ($globalTimezone != '') {
8880 8880
 			date_default_timezone_set($globalTimezone);
8881 8881
 			$datetime = new DateTime();
@@ -8883,24 +8883,24 @@  discard block
 block discarded – undo
8883 8883
 		} else $offset = '+00:00';
8884 8884
 
8885 8885
 		if ($globalDBdriver == 'mysql') {
8886
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8886
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8887 8887
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
8888 8888
 								GROUP BY hour_name 
8889 8889
 								ORDER BY hour_name ASC";
8890 8890
 		} else {
8891
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8891
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8892 8892
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
8893 8893
 								GROUP BY hour_name 
8894 8894
 								ORDER BY hour_name ASC";
8895 8895
 		}
8896 8896
 		
8897 8897
 		$sth = $this->db->prepare($query);
8898
-		$sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset));
8898
+		$sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset));
8899 8899
       
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'];
@@ -8921,8 +8921,8 @@  discard block
 block discarded – undo
8921 8921
 	public function countAllHoursByRegistration($registration, $filters = array())
8922 8922
 	{
8923 8923
 		global $globalTimezone, $globalDBdriver;
8924
-		$filter_query = $this->getFilter($filters,true,true);
8925
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
8924
+		$filter_query = $this->getFilter($filters, true, true);
8925
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8926 8926
 		if ($globalTimezone != '') {
8927 8927
 			date_default_timezone_set($globalTimezone);
8928 8928
 			$datetime = new DateTime();
@@ -8930,24 +8930,24 @@  discard block
 block discarded – undo
8930 8930
 		} else $offset = '+00:00';
8931 8931
 
8932 8932
 		if ($globalDBdriver == 'mysql') {
8933
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8933
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8934 8934
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
8935 8935
 								GROUP BY hour_name 
8936 8936
 								ORDER BY hour_name ASC";
8937 8937
 		} else {
8938
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8938
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8939 8939
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
8940 8940
 								GROUP BY hour_name 
8941 8941
 								ORDER BY hour_name ASC";
8942 8942
 		}
8943 8943
 		
8944 8944
 		$sth = $this->db->prepare($query);
8945
-		$sth->execute(array(':registration' => $registration,':offset' => $offset));
8945
+		$sth->execute(array(':registration' => $registration, ':offset' => $offset));
8946 8946
       
8947 8947
 		$hour_array = array();
8948 8948
 		$temp_array = array();
8949 8949
         
8950
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8950
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8951 8951
 		{
8952 8952
 			$temp_array['hour_name'] = $row['hour_name'];
8953 8953
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8968,8 +8968,8 @@  discard block
 block discarded – undo
8968 8968
 	public function countAllHoursByAirport($airport_icao, $filters = array())
8969 8969
 	{
8970 8970
 		global $globalTimezone, $globalDBdriver;
8971
-		$filter_query = $this->getFilter($filters,true,true);
8972
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8971
+		$filter_query = $this->getFilter($filters, true, true);
8972
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8973 8973
 		if ($globalTimezone != '') {
8974 8974
 			date_default_timezone_set($globalTimezone);
8975 8975
 			$datetime = new DateTime();
@@ -8977,24 +8977,24 @@  discard block
 block discarded – undo
8977 8977
 		} else $offset = '+00:00';
8978 8978
 
8979 8979
 		if ($globalDBdriver == 'mysql') {
8980
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8980
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8981 8981
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
8982 8982
 								GROUP BY hour_name 
8983 8983
 								ORDER BY hour_name ASC";
8984 8984
 		} else {
8985
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8985
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8986 8986
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
8987 8987
 								GROUP BY hour_name 
8988 8988
 								ORDER BY hour_name ASC";
8989 8989
 		}
8990 8990
 		
8991 8991
 		$sth = $this->db->prepare($query);
8992
-		$sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset));
8992
+		$sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset));
8993 8993
       
8994 8994
 		$hour_array = array();
8995 8995
 		$temp_array = array();
8996 8996
         
8997
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8997
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8998 8998
 		{
8999 8999
 			$temp_array['hour_name'] = $row['hour_name'];
9000 9000
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9013,11 +9013,11 @@  discard block
 block discarded – undo
9013 9013
 	* @return Array the hour list
9014 9014
 	*
9015 9015
 	*/
9016
-	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
9016
+	public function countAllHoursByManufacturer($aircraft_manufacturer, $filters = array())
9017 9017
 	{
9018 9018
 		global $globalTimezone, $globalDBdriver;
9019
-		$filter_query = $this->getFilter($filters,true,true);
9020
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
9019
+		$filter_query = $this->getFilter($filters, true, true);
9020
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
9021 9021
 		if ($globalTimezone != '') {
9022 9022
 			date_default_timezone_set($globalTimezone);
9023 9023
 			$datetime = new DateTime();
@@ -9025,24 +9025,24 @@  discard block
 block discarded – undo
9025 9025
 		} else $offset = '+00:00';
9026 9026
 
9027 9027
 		if ($globalDBdriver == 'mysql') {
9028
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9028
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9029 9029
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
9030 9030
 								GROUP BY hour_name 
9031 9031
 								ORDER BY hour_name ASC";
9032 9032
 		} else {
9033
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9033
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9034 9034
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
9035 9035
 								GROUP BY hour_name 
9036 9036
 								ORDER BY hour_name ASC";
9037 9037
 		}
9038 9038
 		
9039 9039
 		$sth = $this->db->prepare($query);
9040
-		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset));
9040
+		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset));
9041 9041
       
9042 9042
 		$hour_array = array();
9043 9043
 		$temp_array = array();
9044 9044
         
9045
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9045
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9046 9046
 		{
9047 9047
 			$temp_array['hour_name'] = $row['hour_name'];
9048 9048
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9064,8 +9064,8 @@  discard block
 block discarded – undo
9064 9064
 	public function countAllHoursByDate($date, $filters = array())
9065 9065
 	{
9066 9066
 		global $globalTimezone, $globalDBdriver;
9067
-		$filter_query = $this->getFilter($filters,true,true);
9068
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
9067
+		$filter_query = $this->getFilter($filters, true, true);
9068
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
9069 9069
 		if ($globalTimezone != '') {
9070 9070
 			date_default_timezone_set($globalTimezone);
9071 9071
 			$datetime = new DateTime($date);
@@ -9073,12 +9073,12 @@  discard block
 block discarded – undo
9073 9073
 		} else $offset = '+00:00';
9074 9074
 
9075 9075
 		if ($globalDBdriver == 'mysql') {
9076
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9076
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9077 9077
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
9078 9078
 								GROUP BY hour_name 
9079 9079
 								ORDER BY hour_name ASC";
9080 9080
 		} else {
9081
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9081
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9082 9082
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date
9083 9083
 								GROUP BY hour_name 
9084 9084
 								ORDER BY hour_name ASC";
@@ -9090,7 +9090,7 @@  discard block
 block discarded – undo
9090 9090
 		$hour_array = array();
9091 9091
 		$temp_array = array();
9092 9092
         
9093
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9093
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9094 9094
 		{
9095 9095
 			$temp_array['hour_name'] = $row['hour_name'];
9096 9096
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9112,8 +9112,8 @@  discard block
 block discarded – undo
9112 9112
 	public function countAllHoursByIdent($ident, $filters = array())
9113 9113
 	{
9114 9114
 		global $globalTimezone, $globalDBdriver;
9115
-		$filter_query = $this->getFilter($filters,true,true);
9116
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
9115
+		$filter_query = $this->getFilter($filters, true, true);
9116
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
9117 9117
 		if ($globalTimezone != '') {
9118 9118
 			date_default_timezone_set($globalTimezone);
9119 9119
 			$datetime = new DateTime();
@@ -9121,12 +9121,12 @@  discard block
 block discarded – undo
9121 9121
 		} else $offset = '+00:00';
9122 9122
 
9123 9123
 		if ($globalDBdriver == 'mysql') {
9124
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9124
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9125 9125
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
9126 9126
 								GROUP BY hour_name 
9127 9127
 								ORDER BY hour_name ASC";
9128 9128
 		} else {
9129
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9129
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9130 9130
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
9131 9131
 								GROUP BY hour_name 
9132 9132
 								ORDER BY hour_name ASC";
@@ -9134,12 +9134,12 @@  discard block
 block discarded – undo
9134 9134
       
9135 9135
 		
9136 9136
 		$sth = $this->db->prepare($query);
9137
-		$sth->execute(array(':ident' => $ident,':offset' => $offset));
9137
+		$sth->execute(array(':ident' => $ident, ':offset' => $offset));
9138 9138
       
9139 9139
 		$hour_array = array();
9140 9140
 		$temp_array = array();
9141 9141
         
9142
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9142
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9143 9143
 		{
9144 9144
 			$temp_array['hour_name'] = $row['hour_name'];
9145 9145
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9158,12 +9158,12 @@  discard block
 block discarded – undo
9158 9158
 	* @return Array the hour list
9159 9159
 	*
9160 9160
 	*/
9161
-	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
9161
+	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
9162 9162
 	{
9163 9163
 		global $globalTimezone, $globalDBdriver;
9164
-		$filter_query = $this->getFilter($filters,true,true);
9165
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
9166
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
9164
+		$filter_query = $this->getFilter($filters, true, true);
9165
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
9166
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
9167 9167
 		if ($globalTimezone != '') {
9168 9168
 			date_default_timezone_set($globalTimezone);
9169 9169
 			$datetime = new DateTime();
@@ -9171,24 +9171,24 @@  discard block
 block discarded – undo
9171 9171
 		} else $offset = '+00:00';
9172 9172
 
9173 9173
 		if ($globalDBdriver == 'mysql') {
9174
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9174
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9175 9175
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
9176 9176
 								GROUP BY hour_name 
9177 9177
 								ORDER BY hour_name ASC";
9178 9178
 		} else {
9179
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9179
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9180 9180
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
9181 9181
 								GROUP BY hour_name 
9182 9182
 								ORDER BY hour_name ASC";
9183 9183
 		}
9184 9184
 		
9185 9185
 		$sth = $this->db->prepare($query);
9186
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset));
9186
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset));
9187 9187
       
9188 9188
 		$hour_array = array();
9189 9189
 		$temp_array = array();
9190 9190
         
9191
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9191
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9192 9192
 		{
9193 9193
 			$temp_array['hour_name'] = $row['hour_name'];
9194 9194
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9209,8 +9209,8 @@  discard block
 block discarded – undo
9209 9209
 	public function countAllHoursByCountry($country, $filters = array())
9210 9210
 	{
9211 9211
 		global $globalTimezone, $globalDBdriver;
9212
-		$filter_query = $this->getFilter($filters,true,true);
9213
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
9212
+		$filter_query = $this->getFilter($filters, true, true);
9213
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
9214 9214
 		if ($globalTimezone != '') {
9215 9215
 			date_default_timezone_set($globalTimezone);
9216 9216
 			$datetime = new DateTime();
@@ -9218,24 +9218,24 @@  discard block
 block discarded – undo
9218 9218
 		} else $offset = '+00:00';
9219 9219
 
9220 9220
 		if ($globalDBdriver == 'mysql') {
9221
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9221
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9222 9222
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
9223 9223
 								GROUP BY hour_name 
9224 9224
 								ORDER BY hour_name ASC";
9225 9225
 		} else {
9226
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9226
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9227 9227
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
9228 9228
 								GROUP BY hour_name 
9229 9229
 								ORDER BY hour_name ASC";
9230 9230
 		}
9231 9231
 		
9232 9232
 		$sth = $this->db->prepare($query);
9233
-		$sth->execute(array(':country' => $country,':offset' => $offset));
9233
+		$sth->execute(array(':country' => $country, ':offset' => $offset));
9234 9234
       
9235 9235
 		$hour_array = array();
9236 9236
 		$temp_array = array();
9237 9237
         
9238
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9238
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9239 9239
 		{
9240 9240
 			$temp_array['hour_name'] = $row['hour_name'];
9241 9241
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9257,8 +9257,8 @@  discard block
 block discarded – undo
9257 9257
 	*/
9258 9258
 	public function countOverallAircrafts($filters = array())
9259 9259
 	{
9260
-		$filter_query = $this->getFilter($filters,true,true);
9261
-		$query  = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
9260
+		$filter_query = $this->getFilter($filters, true, true);
9261
+		$query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
9262 9262
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
9263 9263
 		$sth = $this->db->prepare($query);
9264 9264
 		$sth->execute();
@@ -9273,8 +9273,8 @@  discard block
 block discarded – undo
9273 9273
 	*/
9274 9274
 	public function countOverallArrival($filters = array())
9275 9275
 	{
9276
-		$filter_query = $this->getFilter($filters,true,true);
9277
-		$query  = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
9276
+		$filter_query = $this->getFilter($filters, true, true);
9277
+		$query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
9278 9278
                     FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''";
9279 9279
 		
9280 9280
 		$sth = $this->db->prepare($query);
@@ -9290,8 +9290,8 @@  discard block
 block discarded – undo
9290 9290
 	*/
9291 9291
 	public function countOverallPilots($filters = array())
9292 9292
 	{
9293
-		$filter_query = $this->getFilter($filters,true,true);
9294
-		$query  = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
9293
+		$filter_query = $this->getFilter($filters, true, true);
9294
+		$query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
9295 9295
                     FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''";
9296 9296
 		$sth = $this->db->prepare($query);
9297 9297
 		$sth->execute();
@@ -9306,8 +9306,8 @@  discard block
 block discarded – undo
9306 9306
 	*/
9307 9307
 	public function countOverallOwners($filters = array())
9308 9308
 	{
9309
-		$filter_query = $this->getFilter($filters,true,true);
9310
-		$query  = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
9309
+		$filter_query = $this->getFilter($filters, true, true);
9310
+		$query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
9311 9311
                     FROM spotter_output".$filter_query." spotter_output.owner_name <> ''";
9312 9312
 		$sth = $this->db->prepare($query);
9313 9313
 		$sth->execute();
@@ -9340,8 +9340,8 @@  discard block
 block discarded – undo
9340 9340
 	*/
9341 9341
 	public function countOverallMilitaryFlights($filters = array())
9342 9342
 	{
9343
-		$filter_query = $this->getFilter($filters,true,true);
9344
-		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
9343
+		$filter_query = $this->getFilter($filters, true, true);
9344
+		$query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
9345 9345
                     FROM airlines,spotter_output".$filter_query." spotter_output.airline_icao = airlines.icao AND airlines.type = 'military'";
9346 9346
       
9347 9347
 		$sth = $this->db->prepare($query);
@@ -9378,7 +9378,7 @@  discard block
 block discarded – undo
9378 9378
 	public function countAllHoursFromToday($filters = array())
9379 9379
 	{
9380 9380
 		global $globalTimezone, $globalDBdriver;
9381
-		$filter_query = $this->getFilter($filters,true,true);
9381
+		$filter_query = $this->getFilter($filters, true, true);
9382 9382
 		if ($globalTimezone != '') {
9383 9383
 			date_default_timezone_set($globalTimezone);
9384 9384
 			$datetime = new DateTime();
@@ -9386,12 +9386,12 @@  discard block
 block discarded – undo
9386 9386
 		} else $offset = '+00:00';
9387 9387
 
9388 9388
 		if ($globalDBdriver == 'mysql') {
9389
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9389
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9390 9390
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE()
9391 9391
 								GROUP BY hour_name 
9392 9392
 								ORDER BY hour_name ASC";
9393 9393
 		} else {
9394
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9394
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9395 9395
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date)
9396 9396
 								GROUP BY hour_name 
9397 9397
 								ORDER BY hour_name ASC";
@@ -9403,7 +9403,7 @@  discard block
 block discarded – undo
9403 9403
 		$hour_array = array();
9404 9404
 		$temp_array = array();
9405 9405
         
9406
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9406
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9407 9407
 		{
9408 9408
 			$temp_array['hour_name'] = $row['hour_name'];
9409 9409
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9422,14 +9422,14 @@  discard block
 block discarded – undo
9422 9422
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
9423 9423
 	{
9424 9424
 		global $global_query, $globalDBdriver, $globalTimezone;
9425
-		$filter_query = $this->getFilter($filters,true,true);
9425
+		$filter_query = $this->getFilter($filters, true, true);
9426 9426
 		date_default_timezone_set('UTC');
9427 9427
 		$limit_query = '';
9428 9428
 		if ($limit != "")
9429 9429
 		{
9430 9430
 			$limit_array = explode(",", $limit);
9431
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
9432
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
9431
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
9432
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
9433 9433
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
9434 9434
 			{
9435 9435
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
@@ -9482,7 +9482,7 @@  discard block
 block discarded – undo
9482 9482
 			    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')
9483 9483
 			    HAVING count(spotter_output.ident) > 5$orderby_query";
9484 9484
 			//echo $query;
9485
-			$spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone));
9485
+			$spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone));
9486 9486
 			/*
9487 9487
 			$sth = $this->db->prepare($query);
9488 9488
 			$sth->execute(array(':timezone' => $globalTimezone));
@@ -9501,9 +9501,9 @@  discard block
 block discarded – undo
9501 9501
 	*/
9502 9502
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
9503 9503
 	{
9504
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
9504
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
9505 9505
 
9506
-		$query  = "SELECT spotter_output.spotter_id
9506
+		$query = "SELECT spotter_output.spotter_id
9507 9507
 								FROM spotter_output 
9508 9508
 								WHERE spotter_output.flightaware_id = '".$flightaware_id."'";
9509 9509
         
@@ -9511,7 +9511,7 @@  discard block
 block discarded – undo
9511 9511
 		$sth = $this->db->prepare($query);
9512 9512
 		$sth->execute();
9513 9513
 
9514
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9514
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9515 9515
 		{
9516 9516
 			return $row['spotter_id'];
9517 9517
 		}
@@ -9536,23 +9536,23 @@  discard block
 block discarded – undo
9536 9536
 		}
9537 9537
 		
9538 9538
 		$current_date = date("Y-m-d H:i:s");
9539
-		$date = date("Y-m-d H:i:s",strtotime($dateString." UTC"));
9539
+		$date = date("Y-m-d H:i:s", strtotime($dateString." UTC"));
9540 9540
 		
9541 9541
 		$diff = abs(strtotime($current_date) - strtotime($date));
9542 9542
 
9543
-		$time_array['years'] = floor($diff / (365*60*60*24)); 
9543
+		$time_array['years'] = floor($diff/(365*60*60*24)); 
9544 9544
 		$years = $time_array['years'];
9545 9545
 		
9546
-		$time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
9546
+		$time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24));
9547 9547
 		$months = $time_array['months'];
9548 9548
 		
9549
-		$time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
9549
+		$time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24));
9550 9550
 		$days = $time_array['days'];
9551
-		$time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60));
9551
+		$time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60));
9552 9552
 		$hours = $time_array['hours'];
9553
-		$time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60);
9553
+		$time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60);
9554 9554
 		$minutes = $time_array['minutes'];
9555
-		$time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
9555
+		$time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
9556 9556
 		
9557 9557
 		return $time_array;	
9558 9558
 	}	
@@ -9578,63 +9578,63 @@  discard block
 block discarded – undo
9578 9578
 			$temp_array['direction_degree'] = $direction;
9579 9579
 			$temp_array['direction_shortname'] = "N";
9580 9580
 			$temp_array['direction_fullname'] = "North";
9581
-		} elseif ($direction >= 22.5 && $direction < 45){
9581
+		} elseif ($direction >= 22.5 && $direction < 45) {
9582 9582
 			$temp_array['direction_degree'] = $direction;
9583 9583
 			$temp_array['direction_shortname'] = "NNE";
9584 9584
 			$temp_array['direction_fullname'] = "North-Northeast";
9585
-		} elseif ($direction >= 45 && $direction < 67.5){
9585
+		} elseif ($direction >= 45 && $direction < 67.5) {
9586 9586
 			$temp_array['direction_degree'] = $direction;
9587 9587
 			$temp_array['direction_shortname'] = "NE";
9588 9588
 			$temp_array['direction_fullname'] = "Northeast";
9589
-		} elseif ($direction >= 67.5 && $direction < 90){
9589
+		} elseif ($direction >= 67.5 && $direction < 90) {
9590 9590
 			$temp_array['direction_degree'] = $direction;
9591 9591
 			$temp_array['direction_shortname'] = "ENE";
9592 9592
 			$temp_array['direction_fullname'] = "East-Northeast";
9593
-		} elseif ($direction >= 90 && $direction < 112.5){
9593
+		} elseif ($direction >= 90 && $direction < 112.5) {
9594 9594
 			$temp_array['direction_degree'] = $direction;
9595 9595
 			$temp_array['direction_shortname'] = "E";
9596 9596
 			$temp_array['direction_fullname'] = "East";
9597
-		} elseif ($direction >= 112.5 && $direction < 135){
9597
+		} elseif ($direction >= 112.5 && $direction < 135) {
9598 9598
 			$temp_array['direction_degree'] = $direction;
9599 9599
 			$temp_array['direction_shortname'] = "ESE";
9600 9600
 			$temp_array['direction_fullname'] = "East-Southeast";
9601
-		} elseif ($direction >= 135 && $direction < 157.5){
9601
+		} elseif ($direction >= 135 && $direction < 157.5) {
9602 9602
 			$temp_array['direction_degree'] = $direction;
9603 9603
 			$temp_array['direction_shortname'] = "SE";
9604 9604
 			$temp_array['direction_fullname'] = "Southeast";
9605
-		} elseif ($direction >= 157.5 && $direction < 180){
9605
+		} elseif ($direction >= 157.5 && $direction < 180) {
9606 9606
 			$temp_array['direction_degree'] = $direction;
9607 9607
 			$temp_array['direction_shortname'] = "SSE";
9608 9608
 			$temp_array['direction_fullname'] = "South-Southeast";
9609
-		} elseif ($direction >= 180 && $direction < 202.5){
9609
+		} elseif ($direction >= 180 && $direction < 202.5) {
9610 9610
 			$temp_array['direction_degree'] = $direction;
9611 9611
 			$temp_array['direction_shortname'] = "S";
9612 9612
 			$temp_array['direction_fullname'] = "South";
9613
-		} elseif ($direction >= 202.5 && $direction < 225){
9613
+		} elseif ($direction >= 202.5 && $direction < 225) {
9614 9614
 			$temp_array['direction_degree'] = $direction;
9615 9615
 			$temp_array['direction_shortname'] = "SSW";
9616 9616
 			$temp_array['direction_fullname'] = "South-Southwest";
9617
-		} elseif ($direction >= 225 && $direction < 247.5){
9617
+		} elseif ($direction >= 225 && $direction < 247.5) {
9618 9618
 			$temp_array['direction_degree'] = $direction;
9619 9619
 			$temp_array['direction_shortname'] = "SW";
9620 9620
 			$temp_array['direction_fullname'] = "Southwest";
9621
-		} elseif ($direction >= 247.5 && $direction < 270){
9621
+		} elseif ($direction >= 247.5 && $direction < 270) {
9622 9622
 			$temp_array['direction_degree'] = $direction;
9623 9623
 			$temp_array['direction_shortname'] = "WSW";
9624 9624
 			$temp_array['direction_fullname'] = "West-Southwest";
9625
-		} elseif ($direction >= 270 && $direction < 292.5){
9625
+		} elseif ($direction >= 270 && $direction < 292.5) {
9626 9626
 			$temp_array['direction_degree'] = $direction;
9627 9627
 			$temp_array['direction_shortname'] = "W";
9628 9628
 			$temp_array['direction_fullname'] = "West";
9629
-		} elseif ($direction >= 292.5 && $direction < 315){
9629
+		} elseif ($direction >= 292.5 && $direction < 315) {
9630 9630
 			$temp_array['direction_degree'] = $direction;
9631 9631
 			$temp_array['direction_shortname'] = "WNW";
9632 9632
 			$temp_array['direction_fullname'] = "West-Northwest";
9633
-		} elseif ($direction >= 315 && $direction < 337.5){
9633
+		} elseif ($direction >= 315 && $direction < 337.5) {
9634 9634
 			$temp_array['direction_degree'] = $direction;
9635 9635
 			$temp_array['direction_shortname'] = "NW";
9636 9636
 			$temp_array['direction_fullname'] = "Northwest";
9637
-		} elseif ($direction >= 337.5 && $direction < 360){
9637
+		} elseif ($direction >= 337.5 && $direction < 360) {
9638 9638
 			$temp_array['direction_degree'] = $direction;
9639 9639
 			$temp_array['direction_shortname'] = "NNW";
9640 9640
 			$temp_array['direction_fullname'] = "North-Northwest";
@@ -9687,9 +9687,9 @@  discard block
 block discarded – undo
9687 9687
 	*/
9688 9688
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
9689 9689
 	{
9690
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
9690
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
9691 9691
 	
9692
-		$query  = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
9692
+		$query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
9693 9693
 		
9694 9694
 		$sth = $this->db->prepare($query);
9695 9695
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -9712,9 +9712,9 @@  discard block
 block discarded – undo
9712 9712
 	*/
9713 9713
 	public function getAircraftTypeBymodeS($aircraft_modes)
9714 9714
 	{
9715
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
9715
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
9716 9716
 	
9717
-		$query  = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
9717
+		$query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
9718 9718
 		
9719 9719
 		$sth = $this->db->prepare($query);
9720 9720
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -9735,11 +9735,11 @@  discard block
 block discarded – undo
9735 9735
 	* @param Float $longitude longitute of the flight
9736 9736
 	* @return String the countrie
9737 9737
 	*/
9738
-	public function getCountryFromLatitudeLongitude($latitude,$longitude)
9738
+	public function getCountryFromLatitudeLongitude($latitude, $longitude)
9739 9739
 	{
9740 9740
 		global $globalDBdriver, $globalDebug;
9741
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9742
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9741
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
9742
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
9743 9743
 	
9744 9744
 		$Connection = new Connection($this->db);
9745 9745
 		if (!$Connection->tableExists('countries')) return '';
@@ -9779,7 +9779,7 @@  discard block
 block discarded – undo
9779 9779
 	public function getCountryFromISO2($iso2)
9780 9780
 	{
9781 9781
 		global $globalDBdriver, $globalDebug;
9782
-		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
9782
+		$iso2 = filter_var($iso2, FILTER_SANITIZE_STRING);
9783 9783
 	
9784 9784
 		$Connection = new Connection($this->db);
9785 9785
 		if (!$Connection->tableExists('countries')) return '';
@@ -9811,19 +9811,19 @@  discard block
 block discarded – undo
9811 9811
 	*/
9812 9812
 	public function convertAircraftRegistration($registration)
9813 9813
 	{
9814
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9814
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9815 9815
 		$registration_prefix = '';
9816 9816
 		$registration_1 = substr($registration, 0, 1);
9817 9817
 		$registration_2 = substr($registration, 0, 2);
9818 9818
 
9819 9819
 		//first get the prefix based on two characters
9820
-		$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
9820
+		$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
9821 9821
       
9822 9822
 		
9823 9823
 		$sth = $this->db->prepare($query);
9824 9824
 		$sth->execute(array(':registration_2' => $registration_2));
9825 9825
         
9826
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9826
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9827 9827
 		{
9828 9828
 			$registration_prefix = $row['registration_prefix'];
9829 9829
 		}
@@ -9831,11 +9831,11 @@  discard block
 block discarded – undo
9831 9831
 		//if we didn't find a two chracter prefix lets just search the one with one character
9832 9832
 		if ($registration_prefix == '')
9833 9833
 		{
9834
-			$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
9834
+			$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
9835 9835
 			$sth = $this->db->prepare($query);
9836 9836
 			$sth->execute(array(':registration_1' => $registration_1));
9837 9837
 	        
9838
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9838
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9839 9839
 			{
9840 9840
 				$registration_prefix = $row['registration_prefix'];
9841 9841
 			}
@@ -9849,7 +9849,7 @@  discard block
 block discarded – undo
9849 9849
 			} else {
9850 9850
 				$registration = preg_replace("/^(.{1})/", "$1-", $registration);
9851 9851
 			}
9852
-		} else if(strlen($registration_prefix) == 2){
9852
+		} else if (strlen($registration_prefix) == 2) {
9853 9853
 			if (0 === strpos($registration, 'N')) {
9854 9854
 				$registration = preg_replace("/^(.{2})/", "$1", $registration);
9855 9855
 			} else {
@@ -9868,17 +9868,17 @@  discard block
 block discarded – undo
9868 9868
 	*/
9869 9869
 	public function countryFromAircraftRegistration($registration)
9870 9870
 	{
9871
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9871
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9872 9872
 		
9873 9873
 		$registration_prefix = '';
9874
-		$registration_test = explode('-',$registration);
9874
+		$registration_test = explode('-', $registration);
9875 9875
 		$country = '';
9876 9876
 		if ($registration_test[0] != $registration) {
9877 9877
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9878 9878
 	      
9879 9879
 			$sth = $this->db->prepare($query);
9880 9880
 			$sth->execute(array(':registration_1' => $registration_test[0]));
9881
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9881
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9882 9882
 			{
9883 9883
 				//$registration_prefix = $row['registration_prefix'];
9884 9884
 				$country = $row['country'];
@@ -9889,13 +9889,13 @@  discard block
 block discarded – undo
9889 9889
 
9890 9890
 			$country = '';
9891 9891
 			//first get the prefix based on two characters
9892
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
9892
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
9893 9893
       
9894 9894
 			
9895 9895
 			$sth = $this->db->prepare($query);
9896 9896
 			$sth->execute(array(':registration_2' => $registration_2));
9897 9897
         
9898
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9898
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9899 9899
 			{
9900 9900
 				$registration_prefix = $row['registration_prefix'];
9901 9901
 				$country = $row['country'];
@@ -9904,12 +9904,12 @@  discard block
 block discarded – undo
9904 9904
 			//if we didn't find a two chracter prefix lets just search the one with one character
9905 9905
 			if ($registration_prefix == "")
9906 9906
 			{
9907
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9907
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9908 9908
 	      
9909 9909
 				$sth = $this->db->prepare($query);
9910 9910
 				$sth->execute(array(':registration_1' => $registration_1));
9911 9911
 	        
9912
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
9912
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9913 9913
 				{
9914 9914
 					//$registration_prefix = $row['registration_prefix'];
9915 9915
 					$country = $row['country'];
@@ -9929,13 +9929,13 @@  discard block
 block discarded – undo
9929 9929
 	*/
9930 9930
 	public function countryFromAircraftRegistrationCode($registration)
9931 9931
 	{
9932
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9932
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9933 9933
 		
9934 9934
 		$country = '';
9935
-		$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1";
9935
+		$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1";
9936 9936
 		$sth = $this->db->prepare($query);
9937 9937
 		$sth->execute(array(':registration' => $registration));
9938
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9938
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9939 9939
 		{
9940 9940
 			$country = $row['country'];
9941 9941
 		}
@@ -9948,9 +9948,9 @@  discard block
 block discarded – undo
9948 9948
 	* @param String $flightaware_id flightaware_id from spotter_output table
9949 9949
 	* @param String $highlight New highlight value
9950 9950
 	*/
9951
-	public function setHighlightFlight($flightaware_id,$highlight) {
9951
+	public function setHighlightFlight($flightaware_id, $highlight) {
9952 9952
 		
9953
-		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
9953
+		$query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
9954 9954
 		$sth = $this->db->prepare($query);
9955 9955
 		$sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight));
9956 9956
 	}
@@ -9979,7 +9979,7 @@  discard block
 block discarded – undo
9979 9979
 		
9980 9980
 		$bitly_data = json_decode($bitly_data);
9981 9981
 		$bitly_url = '';
9982
-		if ($bitly_data->status_txt = "OK"){
9982
+		if ($bitly_data->status_txt = "OK") {
9983 9983
 			$bitly_url = $bitly_data->data->url;
9984 9984
 		}
9985 9985
 
@@ -9989,7 +9989,7 @@  discard block
 block discarded – undo
9989 9989
 
9990 9990
 	public function getOrderBy()
9991 9991
 	{
9992
-		$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"));
9992
+		$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"));
9993 9993
 		
9994 9994
 		return $orderby;
9995 9995
 		
@@ -10123,14 +10123,14 @@  discard block
 block discarded – undo
10123 10123
 		}
10124 10124
 		$sth = $this->db->prepare($query);
10125 10125
 		$sth->execute();
10126
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10126
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10127 10127
 		{
10128 10128
 			$departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']);
10129 10129
 			$arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']);
10130 10130
 			if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) {
10131
-				$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";
10131
+				$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";
10132 10132
 				$sthu = $this->db->prepare($update_query);
10133
-				$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']));
10133
+				$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']));
10134 10134
 			}
10135 10135
 		}
10136 10136
 		
@@ -10143,7 +10143,7 @@  discard block
 block discarded – undo
10143 10143
 		}
10144 10144
 		$sth = $this->db->prepare($query);
10145 10145
 		$sth->execute();
10146
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10146
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10147 10147
 		{
10148 10148
 			if (is_numeric(substr($row['ident'], -1, 1)))
10149 10149
 			{
@@ -10152,11 +10152,11 @@  discard block
 block discarded – undo
10152 10152
 				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
10153 10153
 				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
10154 10154
 				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
10155
-				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
10155
+				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
10156 10156
 				if (isset($airline_array[0]['name'])) {
10157
-					$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";
10157
+					$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";
10158 10158
 					$sthu = $this->db->prepare($update_query);
10159
-					$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']));
10159
+					$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']));
10160 10160
 				}
10161 10161
 			}
10162 10162
 		}
@@ -10176,18 +10176,18 @@  discard block
 block discarded – undo
10176 10176
 		}
10177 10177
 		$sth = $this->db->prepare($query);
10178 10178
 		$sth->execute();
10179
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10179
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10180 10180
 		{
10181 10181
 			if ($row['aircraft_icao'] != '') {
10182 10182
 				$aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']);
10183
-				if ($row['registration'] != ""){
10183
+				if ($row['registration'] != "") {
10184 10184
 					$image_array = $Image->getSpotterImage($row['registration']);
10185 10185
 					if (!isset($image_array[0]['registration'])) {
10186 10186
 						$Image->addSpotterImage($row['registration']);
10187 10187
 					}
10188 10188
 				}
10189 10189
 				if (count($aircraft_name) > 0) {
10190
-					$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";
10190
+					$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";
10191 10191
 					$sthu = $this->db->prepare($update_query);
10192 10192
 					$sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id']));
10193 10193
 				}
@@ -10202,10 +10202,10 @@  discard block
 block discarded – undo
10202 10202
 		$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";
10203 10203
 		$sth = $this->db->prepare($query);
10204 10204
 		$sth->execute();
10205
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10205
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10206 10206
 		{
10207 10207
 			if ($row['last_latitude'] != '' && $row['last_longitude'] != '') {
10208
-				$closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist);
10208
+				$closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist);
10209 10209
 				$airport_icao = '';
10210 10210
 				 if (isset($closestAirports[0])) {
10211 10211
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
@@ -10219,7 +10219,7 @@  discard block
 block discarded – undo
10219 10219
 								break;
10220 10220
 							}
10221 10221
 						}
10222
-					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
10222
+					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) {
10223 10223
 						$airport_icao = $closestAirports[0]['icao'];
10224 10224
 						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";
10225 10225
 					} else {
@@ -10230,28 +10230,28 @@  discard block
 block discarded – undo
10230 10230
 				}
10231 10231
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
10232 10232
 					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
10233
-					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10233
+					$update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10234 10234
 					$sthu = $this->db->prepare($update_query);
10235
-					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
10235
+					$sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id']));
10236 10236
 				}
10237 10237
 			}
10238 10238
 		}
10239 10239
 	}
10240 10240
 	
10241
-	public function closestAirports($origLat,$origLon,$dist = 10) {
10241
+	public function closestAirports($origLat, $origLon, $dist = 10) {
10242 10242
 		global $globalDBdriver;
10243
-		$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
10243
+		$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
10244 10244
 /*
10245 10245
 		$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 
10246 10246
                       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)) 
10247 10247
                       having distance < $dist ORDER BY distance limit 100;";
10248 10248
 */
10249 10249
 		if ($globalDBdriver == 'mysql') {
10250
-			$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 
10250
+			$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 
10251 10251
 	                      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)) 
10252 10252
 	                      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;";
10253 10253
                 } else {
10254
-			$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 
10254
+			$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 
10255 10255
 	                      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)) 
10256 10256
 	                      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;";
10257 10257
     		}
Please login to merge, or discard this patch.
Braces   +685 added lines, -237 removed lines patch added patch discarded remove patch
@@ -27,7 +27,9 @@  discard block
 block discarded – undo
27 27
 				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
28 28
 			}
29 29
 		}
30
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
30
+		if (is_array($globalFilter)) {
31
+			$filter = array_merge($filter,$globalFilter);
32
+		}
31 33
 		$filter_query_join = '';
32 34
 		$filter_query_where = '';
33 35
 		foreach($filters as $flt) {
@@ -77,8 +79,11 @@  discard block
 block discarded – undo
77 79
 				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
78 80
 			}
79 81
 		}
80
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
81
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
82
+		if ($filter_query_where == '' && $where) {
83
+			$filter_query_where = ' WHERE';
84
+		} elseif ($filter_query_where != '' && $and) {
85
+			$filter_query_where .= ' AND';
86
+		}
82 87
 		$filter_query = $filter_query_join.$filter_query_where;
83 88
 		return $filter_query;
84 89
 	}
@@ -98,10 +103,18 @@  discard block
 block discarded – undo
98 103
 		$Image = new Image($this->db);
99 104
 		$Schedule = new Schedule($this->db);
100 105
 		$ACARS = new ACARS($this->db);
101
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
102
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
103
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
104
-		if (!isset($globalVAM)) $globalVAM = FALSE;
106
+		if (!isset($globalIVAO)) {
107
+			$globalIVAO = FALSE;
108
+		}
109
+		if (!isset($globalVATSIM)) {
110
+			$globalVATSIM = FALSE;
111
+		}
112
+		if (!isset($globalphpVMS)) {
113
+			$globalphpVMS = FALSE;
114
+		}
115
+		if (!isset($globalVAM)) {
116
+			$globalVAM = FALSE;
117
+		}
105 118
 		date_default_timezone_set('UTC');
106 119
 		
107 120
 		if (!is_string($query))
@@ -148,21 +161,35 @@  discard block
 block discarded – undo
148 161
 			} else {
149 162
 				$temp_array['spotter_id'] = '';
150 163
 			}
151
-			if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id'];
152
-			if (isset($row['modes'])) $temp_array['modes'] = $row['modes'];
164
+			if (isset($row['flightaware_id'])) {
165
+				$temp_array['flightaware_id'] = $row['flightaware_id'];
166
+			}
167
+			if (isset($row['modes'])) {
168
+				$temp_array['modes'] = $row['modes'];
169
+			}
153 170
 			$temp_array['ident'] = $row['ident'];
154 171
 			if (isset($row['registration']) && $row['registration'] != '') {
155 172
 				$temp_array['registration'] = $row['registration'];
156 173
 			} elseif (isset($temp_array['modes'])) {
157 174
 				$temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']);
158
-			} else $temp_array['registration'] = '';
159
-			if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao'];
175
+			} else {
176
+				$temp_array['registration'] = '';
177
+			}
178
+			if (isset($row['aircraft_icao'])) {
179
+				$temp_array['aircraft_type'] = $row['aircraft_icao'];
180
+			}
160 181
 			
161 182
 			$temp_array['departure_airport'] = $row['departure_airport_icao'];
162 183
 			$temp_array['arrival_airport'] = $row['arrival_airport_icao'];
163
-			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
164
-			if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude'];
165
-			if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude'];
184
+			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) {
185
+				$temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
186
+			}
187
+			if (isset($row['latitude'])) {
188
+				$temp_array['latitude'] = $row['latitude'];
189
+			}
190
+			if (isset($row['longitude'])) {
191
+				$temp_array['longitude'] = $row['longitude'];
192
+			}
166 193
 			/*
167 194
 			if (Connection->tableExists('countries')) {
168 195
 				$country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']);
@@ -172,8 +199,12 @@  discard block
 block discarded – undo
172 199
 				}
173 200
 			}
174 201
 			*/
175
-			if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints'];
176
-			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
202
+			if (isset($row['waypoints'])) {
203
+				$temp_array['waypoints'] = $row['waypoints'];
204
+			}
205
+			if (isset($row['format_source'])) {
206
+				$temp_array['format_source'] = $row['format_source'];
207
+			}
177 208
 			if (isset($row['route_stop'])) {
178 209
 				$temp_array['route_stop'] = $row['route_stop'];
179 210
 				if ($row['route_stop'] != '') {
@@ -192,13 +223,19 @@  discard block
 block discarded – undo
192 223
 					}
193 224
 				}
194 225
 			}
195
-			if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude'];
226
+			if (isset($row['altitude'])) {
227
+				$temp_array['altitude'] = $row['altitude'];
228
+			}
196 229
 			if (isset($row['heading'])) {
197 230
 				$temp_array['heading'] = $row['heading'];
198 231
 				$heading_direction = $this->parseDirection($row['heading']);
199
-				if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
232
+				if (isset($heading_direction[0]['direction_fullname'])) {
233
+					$temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
234
+				}
235
+			}
236
+			if (isset($row['ground_speed'])) {
237
+				$temp_array['ground_speed'] = $row['ground_speed'];
200 238
 			}
201
-			if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed'];
202 239
 			$temp_array['image'] = "";
203 240
 			$temp_array['image_thumbnail'] = "";
204 241
 			$temp_array['image_source'] = "";
@@ -206,7 +243,9 @@  discard block
 block discarded – undo
206 243
  
207 244
 			if (isset($row['highlight'])) {
208 245
 				$temp_array['highlight'] = $row['highlight'];
209
-			} else $temp_array['highlight'] = '';
246
+			} else {
247
+				$temp_array['highlight'] = '';
248
+			}
210 249
 			
211 250
 			if (isset($row['date'])) {
212 251
 				$dateArray = $this->parseDateString($row['date']);
@@ -254,7 +293,9 @@  discard block
 block discarded – undo
254 293
 				
255 294
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
256 295
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
257
-					} else $temp_array['aircraft_shadow'] = 'default.png';
296
+					} else {
297
+						$temp_array['aircraft_shadow'] = 'default.png';
298
+					}
258 299
                                 } else {
259 300
                             		$temp_array['aircraft_shadow'] = 'default.png';
260 301
 					$temp_array['aircraft_name'] = 'N/A';
@@ -262,11 +303,17 @@  discard block
 block discarded – undo
262 303
                             	}
263 304
 			}
264 305
 			$fromsource = NULL;
265
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
266
-			elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
267
-			elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
268
-			elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
269
-			elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
306
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
307
+				$fromsource = $globalAirlinesSource;
308
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
309
+				$fromsource = 'vatsim';
310
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
311
+				$fromsource = 'ivao';
312
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
313
+				$fromsource = 'vatsim';
314
+			} elseif (isset($globalIVAO) && $globalIVAO) {
315
+				$fromsource = 'ivao';
316
+			}
270 317
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
271 318
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
272 319
 					if (is_numeric(substr($row['ident'], 2, 1))) {
@@ -289,12 +336,18 @@  discard block
 block discarded – undo
289 336
 				}
290 337
 			} else {
291 338
 				$temp_array['airline_icao'] = $row['airline_icao'];
292
-				if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata'];
293
-				else $temp_array['airline_iata'] = 'N/A';
339
+				if (isset($row['airline_iata'])) {
340
+					$temp_array['airline_iata'] = $row['airline_iata'];
341
+				} else {
342
+					$temp_array['airline_iata'] = 'N/A';
343
+				}
294 344
 				$temp_array['airline_name'] = $row['airline_name'];
295 345
 				$temp_array['airline_country'] = $row['airline_country'];
296
-				if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign'];
297
-				else $temp_array['airline_callsign'] = 'N/A';
346
+				if (isset($row['airline_callsign'])) {
347
+					$temp_array['airline_callsign'] = $row['airline_callsign'];
348
+				} else {
349
+					$temp_array['airline_callsign'] = 'N/A';
350
+				}
298 351
 				$temp_array['airline_type'] = $row['airline_type'];
299 352
 				if ($temp_array['airline_icao'] != '' && $temp_array['airline_iata'] == 'N/A') {
300 353
 					$airline_array = $this->getAllAirlineInfo($temp_array['airline_icao']);
@@ -321,7 +374,9 @@  discard block
 block discarded – undo
321 374
 			}
322 375
 			if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) {
323 376
 				$owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']);
324
-				if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
377
+				if ($owner_info['owner'] != '') {
378
+					$temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
379
+				}
325 380
 				$temp_array['aircraft_base'] = $owner_info['base'];
326 381
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
327 382
 			}
@@ -329,9 +384,14 @@  discard block
 block discarded – undo
329 384
 			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
330 385
 			{
331 386
 				if ($globalIVAO) {
332
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
333
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
334
-				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
387
+					if (isset($temp_array['airline_icao'])) {
388
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
389
+					} else {
390
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
391
+					}
392
+				} else {
393
+					$image_array = $Image->getSpotterImage($temp_array['registration']);
394
+				}
335 395
 				if (count($image_array) > 0) {
336 396
 					$temp_array['image'] = $image_array[0]['image'];
337 397
 					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -383,7 +443,9 @@  discard block
 block discarded – undo
383 443
 			//if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') {
384 444
 			if ($row['departure_airport_icao'] != '') {
385 445
 				$departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']);
386
-				if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA');
446
+				if (!isset($departure_airport_array[0]['name'])) {
447
+					$departure_airport_array = $this->getAllAirportInfo('NA');
448
+				}
387 449
 			/*
388 450
 			} elseif ($row['departure_airport_name'] != '') {
389 451
 				$temp_array['departure_airport_name'] = $row['departure_airport_name'];
@@ -391,7 +453,9 @@  discard block
 block discarded – undo
391 453
 				$temp_array['departure_airport_country'] = $row['departure_airport_country'];
392 454
 				$temp_array['departure_airport_icao'] = $row['departure_airport_icao'];
393 455
 			*/
394
-			} else $departure_airport_array = $this->getAllAirportInfo('NA');
456
+			} else {
457
+				$departure_airport_array = $this->getAllAirportInfo('NA');
458
+			}
395 459
 			if (isset($departure_airport_array[0]['name'])) {
396 460
 				$temp_array['departure_airport_name'] = $departure_airport_array[0]['name'];
397 461
 				$temp_array['departure_airport_city'] = $departure_airport_array[0]['city'];
@@ -411,8 +475,12 @@  discard block
 block discarded – undo
411 475
 			
412 476
 			if ($row['arrival_airport_icao'] != '') {
413 477
 				$arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']);
414
-				if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA');
415
-			} else $arrival_airport_array = $this->getAllAirportInfo('NA');
478
+				if (count($arrival_airport_array) == 0) {
479
+					$arrival_airport_array = $this->getAllAirportInfo('NA');
480
+				}
481
+			} else {
482
+				$arrival_airport_array = $this->getAllAirportInfo('NA');
483
+			}
416 484
 			if (isset($arrival_airport_array[0]['name'])) {
417 485
 				$temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name'];
418 486
 				$temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city'];
@@ -428,27 +496,45 @@  discard block
 block discarded – undo
428 496
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
429 497
 			}
430 498
 			*/
431
-			if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id'];
432
-			if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name'];
433
-			if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name'];
434
-			if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country'];
435
-			if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance'];
499
+			if (isset($row['pilot_id']) && $row['pilot_id'] != '') {
500
+				$temp_array['pilot_id'] = $row['pilot_id'];
501
+			}
502
+			if (isset($row['pilot_name']) && $row['pilot_name'] != '') {
503
+				$temp_array['pilot_name'] = $row['pilot_name'];
504
+			}
505
+			if (isset($row['source_name']) && $row['source_name'] != '') {
506
+				$temp_array['source_name'] = $row['source_name'];
507
+			}
508
+			if (isset($row['over_country']) && $row['over_country'] != '') {
509
+				$temp_array['over_country'] = $row['over_country'];
510
+			}
511
+			if (isset($row['distance']) && $row['distance'] != '') {
512
+				$temp_array['distance'] = $row['distance'];
513
+			}
436 514
 			if (isset($row['squawk'])) {
437 515
 				$temp_array['squawk'] = $row['squawk'];
438 516
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
439 517
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
440
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
518
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
519
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
520
+					}
441 521
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
442 522
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
443
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
444
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
523
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
524
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
525
+					}
526
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) {
527
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
528
+				}
445 529
 			}
446 530
     			
447 531
 			$temp_array['query_number_rows'] = $num_rows;
448 532
 			
449 533
 			$spotter_array[] = $temp_array;
450 534
 		}
451
-		if ($num_rows == 0) return array();
535
+		if ($num_rows == 0) {
536
+			return array();
537
+		}
452 538
 		$spotter_array[0]['query_number_rows'] = $num_rows;
453 539
 		return $spotter_array;
454 540
 	}	
@@ -481,7 +567,9 @@  discard block
 block discarded – undo
481 567
 				foreach ($q_array as $q_item){
482 568
 					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
483 569
 					$additional_query .= " AND (";
484
-					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
570
+					if (is_int($q_item)) {
571
+						$additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
572
+					}
485 573
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
486 574
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
487 575
 					$additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR ";
@@ -502,7 +590,9 @@  discard block
 block discarded – undo
502 590
 					$additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR ";
503 591
 					$additional_query .= "(spotter_output.ident like '%".$q_item."%') OR ";
504 592
 					$translate = $Translation->ident2icao($q_item);
505
-					if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
593
+					if ($translate != $q_item) {
594
+						$additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
595
+					}
506 596
 					$additional_query .= "(spotter_output.highlight like '%".$q_item."%')";
507 597
 					$additional_query .= ")";
508 598
 				}
@@ -729,7 +819,9 @@  discard block
 block discarded – undo
729 819
 				date_default_timezone_set($globalTimezone);
730 820
 				$datetime = new DateTime();
731 821
 				$offset = $datetime->format('P');
732
-			} else $offset = '+00:00';
822
+			} else {
823
+				$offset = '+00:00';
824
+			}
733 825
 
734 826
 			if ($date_array[1] != "")
735 827
 			{
@@ -761,8 +853,12 @@  discard block
 block discarded – undo
761 853
 			{
762 854
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
763 855
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
764
-			} else $limit_query = "";
765
-		} else $limit_query = "";
856
+			} else {
857
+				$limit_query = "";
858
+			}
859
+		} else {
860
+			$limit_query = "";
861
+		}
766 862
 
767 863
 
768 864
 		if ($sort != "")
@@ -830,8 +926,12 @@  discard block
 block discarded – undo
830 926
 			{
831 927
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
832 928
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
833
-			} else $limit_query = "";
834
-		} else $limit_query = "";
929
+			} else {
930
+				$limit_query = "";
931
+			}
932
+		} else {
933
+			$limit_query = "";
934
+		}
835 935
 		
836 936
 		if ($sort != "")
837 937
 		{
@@ -1155,7 +1255,9 @@  discard block
 block discarded – undo
1155 1255
 		global $global_query;
1156 1256
 		
1157 1257
 		date_default_timezone_set('UTC');
1158
-		if ($id == '') return array();
1258
+		if ($id == '') {
1259
+			return array();
1260
+		}
1159 1261
 		$additional_query = "spotter_output.spotter_id = :id";
1160 1262
 		$query_values = array(':id' => $id);
1161 1263
 
@@ -1787,7 +1889,9 @@  discard block
 block discarded – undo
1787 1889
 		{
1788 1890
 			$highlight = $row['highlight'];
1789 1891
 		}
1790
-		if (isset($highlight)) return $highlight;
1892
+		if (isset($highlight)) {
1893
+			return $highlight;
1894
+		}
1791 1895
 	}
1792 1896
 
1793 1897
 	
@@ -1815,7 +1919,9 @@  discard block
 block discarded – undo
1815 1919
 		$sth->closeCursor();
1816 1920
 		if (count($row) > 0) {
1817 1921
 			return $row['usage'];
1818
-		} else return '';
1922
+		} else {
1923
+			return '';
1924
+		}
1819 1925
 	}
1820 1926
 
1821 1927
 	/**
@@ -1840,7 +1946,9 @@  discard block
 block discarded – undo
1840 1946
 		$sth->closeCursor();
1841 1947
 		if (count($row) > 0) {
1842 1948
 			return $row['icao'];
1843
-		} else return '';
1949
+		} else {
1950
+			return '';
1951
+		}
1844 1952
 	}
1845 1953
 
1846 1954
 	/**
@@ -1868,7 +1976,9 @@  discard block
 block discarded – undo
1868 1976
 			$airport_longitude = $row['longitude'];
1869 1977
 			$Common = new Common();
1870 1978
 			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
1871
-		} else return '';
1979
+		} else {
1980
+			return '';
1981
+		}
1872 1982
 	}
1873 1983
 	
1874 1984
 	/**
@@ -1980,7 +2090,9 @@  discard block
 block discarded – undo
1980 2090
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1981 2091
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1982 2092
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1983
-		} else return array();
2093
+		} else {
2094
+			return array();
2095
+		}
1984 2096
 		if ($globalDBdriver == 'mysql') {
1985 2097
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
1986 2098
 		} else {
@@ -2015,7 +2127,9 @@  discard block
 block discarded – undo
2015 2127
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2016 2128
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2017 2129
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2018
-		} else return array();
2130
+		} else {
2131
+			return array();
2132
+		}
2019 2133
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2020 2134
 		$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.")";
2021 2135
 		//$query  = "SELECT waypoints.* FROM waypoints";
@@ -2050,7 +2164,9 @@  discard block
 block discarded – undo
2050 2164
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2051 2165
 	{
2052 2166
 		global $globalUseRealAirlines;
2053
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2167
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2168
+			$fromsource = NULL;
2169
+		}
2054 2170
 		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2055 2171
 		if ($airline_icao == 'NA') {
2056 2172
 			$airline_array = array();
@@ -2100,7 +2216,9 @@  discard block
 block discarded – undo
2100 2216
 				$sth->execute(array(':fromsource' => $fromsource));
2101 2217
 				$row = $sth->fetch(PDO::FETCH_ASSOC);
2102 2218
 				$sth->closeCursor();
2103
-				if ($row['nb'] == 0) $result = $this->getAllAirlineInfo($airline_icao);
2219
+				if ($row['nb'] == 0) {
2220
+					$result = $this->getAllAirlineInfo($airline_icao);
2221
+				}
2104 2222
 			}
2105 2223
 			return $result;
2106 2224
 		}
@@ -2116,7 +2234,9 @@  discard block
 block discarded – undo
2116 2234
 	public function getAllAirlineInfoByName($airline_name, $fromsource = NULL)
2117 2235
 	{
2118 2236
 		global $globalUseRealAirlines;
2119
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2237
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2238
+			$fromsource = NULL;
2239
+		}
2120 2240
 		$airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING));
2121 2241
 		$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";
2122 2242
 		$sth = $this->db->prepare($query);
@@ -2132,7 +2252,9 @@  discard block
 block discarded – undo
2132 2252
 			$sth->execute(array(':fromsource' => $fromsource));
2133 2253
 			$row = $sth->fetch(PDO::FETCH_ASSOC);
2134 2254
 			$sth->closeCursor();
2135
-			if ($row['nb'] == 0) $result = $this->getAllAirlineInfoByName($airline_name);
2255
+			if ($row['nb'] == 0) {
2256
+				$result = $this->getAllAirlineInfoByName($airline_name);
2257
+			}
2136 2258
 		}
2137 2259
 		return $result;
2138 2260
 	}
@@ -2195,15 +2317,20 @@  discard block
 block discarded – undo
2195 2317
 				'A320-211' => 'A320',
2196 2318
 				'747-8i' => 'B748',
2197 2319
 				'A380' => 'A388');
2198
-		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2320
+		if (isset($all_aircraft[$aircraft_type])) {
2321
+			return $all_aircraft[$aircraft_type];
2322
+		}
2199 2323
 
2200 2324
 		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2201 2325
 		$aircraft_type = strtoupper($aircraft_type);
2202 2326
 		$sth = $this->db->prepare($query);
2203 2327
 		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2204 2328
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2205
-		if (isset($result[0]['icao'])) return $result[0]['icao'];
2206
-		else return '';
2329
+		if (isset($result[0]['icao'])) {
2330
+			return $result[0]['icao'];
2331
+		} else {
2332
+			return '';
2333
+		}
2207 2334
 	}
2208 2335
 	
2209 2336
 	/**
@@ -2226,7 +2353,9 @@  discard block
 block discarded – undo
2226 2353
 		$sth->closeCursor();
2227 2354
 		if (isset($row['icaotypecode'])) {
2228 2355
 			return $row['icaotypecode'];
2229
-		} else return '';
2356
+		} else {
2357
+			return '';
2358
+		}
2230 2359
 	}
2231 2360
 
2232 2361
 	/**
@@ -2249,7 +2378,9 @@  discard block
 block discarded – undo
2249 2378
 		$sth->closeCursor();
2250 2379
 		if (isset($row['icaotypecode'])) {
2251 2380
 			return $row['icaotypecode'];
2252
-		} else return '';
2381
+		} else {
2382
+			return '';
2383
+		}
2253 2384
 	}
2254 2385
 
2255 2386
 	/**
@@ -2271,7 +2402,9 @@  discard block
 block discarded – undo
2271 2402
 		$sth->closeCursor();
2272 2403
 		if (isset($row['operator_correct'])) {
2273 2404
 			return $row['operator_correct'];
2274
-		} else return $operator;
2405
+		} else {
2406
+			return $operator;
2407
+		}
2275 2408
 	}
2276 2409
 
2277 2410
 	/**
@@ -2284,7 +2417,9 @@  discard block
 block discarded – undo
2284 2417
 	public function getRouteInfo($callsign)
2285 2418
 	{
2286 2419
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2287
-                if ($callsign == '') return array();
2420
+                if ($callsign == '') {
2421
+                	return array();
2422
+                }
2288 2423
 		$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";
2289 2424
 		
2290 2425
 		$sth = $this->db->prepare($query);
@@ -2294,7 +2429,9 @@  discard block
 block discarded – undo
2294 2429
 		$sth->closeCursor();
2295 2430
 		if (count($row) > 0) {
2296 2431
 			return $row;
2297
-		} else return array();
2432
+		} else {
2433
+			return array();
2434
+		}
2298 2435
 	}
2299 2436
 	
2300 2437
 	/**
@@ -2347,7 +2484,9 @@  discard block
 block discarded – undo
2347 2484
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
2348 2485
 			$sth->closeCursor();
2349 2486
 			return $result;
2350
-		} else return array();
2487
+		} else {
2488
+			return array();
2489
+		}
2351 2490
 	}
2352 2491
 	
2353 2492
   
@@ -2506,8 +2645,11 @@  discard block
 block discarded – undo
2506 2645
 		$query .= " ORDER BY spotter_output.source_name ASC";
2507 2646
 
2508 2647
 		$sth = $this->db->prepare($query);
2509
-		if (!empty($query_values)) $sth->execute($query_values);
2510
-		else $sth->execute();
2648
+		if (!empty($query_values)) {
2649
+			$sth->execute($query_values);
2650
+		} else {
2651
+			$sth->execute();
2652
+		}
2511 2653
 
2512 2654
 		$source_array = array();
2513 2655
 		$temp_array = array();
@@ -2540,9 +2682,13 @@  discard block
 block discarded – undo
2540 2682
 								WHERE spotter_output.airline_icao <> '' 
2541 2683
 								ORDER BY spotter_output.airline_name ASC";
2542 2684
 			*/
2543
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2544
-			elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2545
-			elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2685
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2686
+				$forsource = $globalAirlinesSource;
2687
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
2688
+				$forsource = 'vatsim';
2689
+			} elseif (isset($globalIVAO) && $globalIVAO) {
2690
+				$forsource = 'ivao';
2691
+			}
2546 2692
 			if ($forsource === NULL) {
2547 2693
 				$query = "SELECT DISTINCT icao AS airline_icao, name AS airline_name, type AS airline_type FROM airlines WHERE forsource IS NULL ORDER BY name ASC";
2548 2694
 				$query_data = array();
@@ -2834,7 +2980,9 @@  discard block
 block discarded – undo
2834 2980
 			date_default_timezone_set($globalTimezone);
2835 2981
 			$datetime = new DateTime();
2836 2982
 			$offset = $datetime->format('P');
2837
-		} else $offset = '+00:00';
2983
+		} else {
2984
+			$offset = '+00:00';
2985
+		}
2838 2986
 		if ($airport_icao == '') {
2839 2987
 			if ($globalDBdriver == 'mysql') {
2840 2988
 				$query = "SELECT COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' GROUP BY departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -2866,7 +3014,9 @@  discard block
 block discarded – undo
2866 3014
 			date_default_timezone_set($globalTimezone);
2867 3015
 			$datetime = new DateTime();
2868 3016
 			$offset = $datetime->format('P');
2869
-		} else $offset = '+00:00';
3017
+		} else {
3018
+			$offset = '+00:00';
3019
+		}
2870 3020
 		if ($airport_icao == '') {
2871 3021
 			if ($globalDBdriver == 'mysql') {
2872 3022
 				$query = "SELECT spotter_output.airline_icao, COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -2899,7 +3049,9 @@  discard block
 block discarded – undo
2899 3049
 			date_default_timezone_set($globalTimezone);
2900 3050
 			$datetime = new DateTime();
2901 3051
 			$offset = $datetime->format('P');
2902
-		} else $offset = '+00:00';
3052
+		} else {
3053
+			$offset = '+00:00';
3054
+		}
2903 3055
 		if ($airport_icao == '') {
2904 3056
 			if ($globalDBdriver == 'mysql') {
2905 3057
 				$query = "SELECT COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -2938,7 +3090,9 @@  discard block
 block discarded – undo
2938 3090
 			date_default_timezone_set($globalTimezone);
2939 3091
 			$datetime = new DateTime();
2940 3092
 			$offset = $datetime->format('P');
2941
-		} else $offset = '+00:00';
3093
+		} else {
3094
+			$offset = '+00:00';
3095
+		}
2942 3096
 		if ($airport_icao == '') {
2943 3097
 			if ($globalDBdriver == 'mysql') {
2944 3098
 				$query = "SELECT spotter_output.airline_icao, COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -2983,7 +3137,9 @@  discard block
 block discarded – undo
2983 3137
 			date_default_timezone_set($globalTimezone);
2984 3138
 			$datetime = new DateTime();
2985 3139
 			$offset = $datetime->format('P');
2986
-		} else $offset = '+00:00';
3140
+		} else {
3141
+			$offset = '+00:00';
3142
+		}
2987 3143
 		if ($airport_icao == '') {
2988 3144
 			if ($globalDBdriver == 'mysql') {
2989 3145
 				$query = "SELECT COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' GROUP BY arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -3018,7 +3174,9 @@  discard block
 block discarded – undo
3018 3174
 			date_default_timezone_set($globalTimezone);
3019 3175
 			$datetime = new DateTime();
3020 3176
 			$offset = $datetime->format('P');
3021
-		} else $offset = '+00:00';
3177
+		} else {
3178
+			$offset = '+00:00';
3179
+		}
3022 3180
 		if ($airport_icao == '') {
3023 3181
 			if ($globalDBdriver == 'mysql') {
3024 3182
 				$query = "SELECT COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -3060,7 +3218,9 @@  discard block
 block discarded – undo
3060 3218
 			date_default_timezone_set($globalTimezone);
3061 3219
 			$datetime = new DateTime();
3062 3220
 			$offset = $datetime->format('P');
3063
-		} else $offset = '+00:00';
3221
+		} else {
3222
+			$offset = '+00:00';
3223
+		}
3064 3224
 		if ($airport_icao == '') {
3065 3225
 			if ($globalDBdriver == 'mysql') {
3066 3226
 				$query = "SELECT spotter_output.airline_icao, COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -3094,7 +3254,9 @@  discard block
 block discarded – undo
3094 3254
 			date_default_timezone_set($globalTimezone);
3095 3255
 			$datetime = new DateTime();
3096 3256
 			$offset = $datetime->format('P');
3097
-		} else $offset = '+00:00';
3257
+		} else {
3258
+			$offset = '+00:00';
3259
+		}
3098 3260
 		if ($airport_icao == '') {
3099 3261
 			if ($globalDBdriver == 'mysql') {
3100 3262
 				$query = "SELECT spotter_output.airline_icao, COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -3142,7 +3304,9 @@  discard block
 block discarded – undo
3142 3304
 			date_default_timezone_set($globalTimezone);
3143 3305
 			$datetime = new DateTime();
3144 3306
 			$offset = $datetime->format('P');
3145
-		} else $offset = '+00:00';
3307
+		} else {
3308
+			$offset = '+00:00';
3309
+		}
3146 3310
 
3147 3311
 		if ($globalDBdriver == 'mysql') {
3148 3312
 			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
@@ -3262,7 +3426,9 @@  discard block
 block discarded – undo
3262 3426
 	*/	
3263 3427
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3264 3428
 	{
3265
-		if ($groundspeed == '') $groundspeed = NULL;
3429
+		if ($groundspeed == '') {
3430
+			$groundspeed = NULL;
3431
+		}
3266 3432
 		$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';
3267 3433
                 $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);
3268 3434
 
@@ -3312,10 +3478,18 @@  discard block
 block discarded – undo
3312 3478
 		$Image = new Image($this->db);
3313 3479
 		$Common = new Common();
3314 3480
 		
3315
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
3316
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
3317
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
3318
-		if (!isset($globalVAM)) $globalVAM = FALSE;
3481
+		if (!isset($globalIVAO)) {
3482
+			$globalIVAO = FALSE;
3483
+		}
3484
+		if (!isset($globalVATSIM)) {
3485
+			$globalVATSIM = FALSE;
3486
+		}
3487
+		if (!isset($globalphpVMS)) {
3488
+			$globalphpVMS = FALSE;
3489
+		}
3490
+		if (!isset($globalVAM)) {
3491
+			$globalVAM = FALSE;
3492
+		}
3319 3493
 		date_default_timezone_set('UTC');
3320 3494
 		
3321 3495
 		//getting the registration
@@ -3328,23 +3502,33 @@  discard block
 block discarded – undo
3328 3502
 				if ($ModeS != '') {
3329 3503
 					$timeelapsed = microtime(true);
3330 3504
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3331
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3505
+					if ($globalDebugTimeElapsed) {
3506
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3507
+					}
3332 3508
 				} else {
3333 3509
 					$myhex = explode('-',$flightaware_id);
3334 3510
 					if (count($myhex) > 0) {
3335 3511
 						$timeelapsed = microtime(true);
3336 3512
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3337
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3513
+						if ($globalDebugTimeElapsed) {
3514
+							echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3515
+						}
3338 3516
 					}
3339 3517
 				}
3340 3518
 			}
3341 3519
 		}
3342 3520
 		$fromsource = NULL;
3343
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
3344
-		elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim';
3345
-		elseif ($format_source == 'whazzup') $fromsource = 'ivao';
3346
-		elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
3347
-		elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
3521
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
3522
+			$fromsource = $globalAirlinesSource;
3523
+		} elseif ($format_source == 'vatsimtxt') {
3524
+			$fromsource = 'vatsim';
3525
+		} elseif ($format_source == 'whazzup') {
3526
+			$fromsource = 'ivao';
3527
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
3528
+			$fromsource = 'vatsim';
3529
+		} elseif (isset($globalIVAO) && $globalIVAO) {
3530
+			$fromsource = 'ivao';
3531
+		}
3348 3532
 		//getting the airline information
3349 3533
 		if ($ident != "")
3350 3534
 		{
@@ -3368,15 +3552,21 @@  discard block
 block discarded – undo
3368 3552
 					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3369 3553
 						$airline_array = $this->getAllAirlineInfo("NA");
3370 3554
 					}
3371
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3555
+					if ($globalDebugTimeElapsed) {
3556
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3557
+					}
3372 3558
 
3373 3559
 				} else {
3374 3560
 					$timeelapsed = microtime(true);
3375 3561
 					$airline_array = $this->getAllAirlineInfo("NA");
3376
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3562
+					if ($globalDebugTimeElapsed) {
3563
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3564
+					}
3377 3565
 				}
3378 3566
 			}
3379
-		} else $airline_array = array();
3567
+		} else {
3568
+			$airline_array = array();
3569
+		}
3380 3570
 		
3381 3571
 		//getting the aircraft information
3382 3572
 		$aircraft_array = array();
@@ -3390,27 +3580,37 @@  discard block
 block discarded – undo
3390 3580
 				{
3391 3581
 					$timeelapsed = microtime(true);
3392 3582
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3393
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3583
+					if ($globalDebugTimeElapsed) {
3584
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3585
+					}
3394 3586
 				} else {
3395 3587
 					$timeelapsed = microtime(true);
3396 3588
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3397
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3589
+					if ($globalDebugTimeElapsed) {
3590
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3591
+					}
3398 3592
 				}
3399 3593
 			}
3400 3594
 		} else {
3401 3595
 			if ($ModeS != '') {
3402 3596
 				$timeelapsed = microtime(true);
3403 3597
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3404
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3598
+				if ($globalDebugTimeElapsed) {
3599
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3600
+				}
3405 3601
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3406 3602
 				{
3407 3603
 					$timeelapsed = microtime(true);
3408 3604
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3409
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3605
+					if ($globalDebugTimeElapsed) {
3606
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3607
+					}
3410 3608
 				} else {
3411 3609
 					$timeelapsed = microtime(true);
3412 3610
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3413
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3611
+					if ($globalDebugTimeElapsed) {
3612
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3613
+					}
3414 3614
 				}
3415 3615
 			}
3416 3616
 		}
@@ -3426,7 +3626,9 @@  discard block
 block discarded – undo
3426 3626
 			} else {
3427 3627
 				$timeelapsed = microtime(true);
3428 3628
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3429
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3629
+				if ($globalDebugTimeElapsed) {
3630
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3631
+				}
3430 3632
 			}
3431 3633
 		}
3432 3634
 		
@@ -3441,7 +3643,9 @@  discard block
 block discarded – undo
3441 3643
 			} else {
3442 3644
 				$timeelapsed = microtime(true);
3443 3645
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3444
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3646
+				if ($globalDebugTimeElapsed) {
3647
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3648
+				}
3445 3649
 			}
3446 3650
 		}
3447 3651
 
@@ -3475,7 +3679,9 @@  discard block
 block discarded – undo
3475 3679
 			{
3476 3680
 				return false;
3477 3681
 			}
3478
-		} else $altitude = 0;
3682
+		} else {
3683
+			$altitude = 0;
3684
+		}
3479 3685
 		
3480 3686
 		if ($heading != "")
3481 3687
 		{
@@ -3504,7 +3710,9 @@  discard block
 block discarded – undo
3504 3710
 		{
3505 3711
 			$timeelapsed = microtime(true);
3506 3712
 			$image_array = $Image->getSpotterImage($registration);
3507
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3713
+			if ($globalDebugTimeElapsed) {
3714
+				echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3715
+			}
3508 3716
 			if (!isset($image_array[0]['registration']))
3509 3717
 			{
3510 3718
 				//echo "Add image !!!! \n";
@@ -3512,14 +3720,21 @@  discard block
 block discarded – undo
3512 3720
 			}
3513 3721
 			$timeelapsed = microtime(true);
3514 3722
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3515
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3516
-			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3723
+			if ($globalDebugTimeElapsed) {
3724
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3725
+			}
3726
+			if ($owner_info['owner'] != '') {
3727
+				$aircraft_owner = ucwords(strtolower($owner_info['owner']));
3728
+			}
3517 3729
 		}
3518 3730
     
3519 3731
 		if ($globalIVAO && $aircraft_icao != '')
3520 3732
 		{
3521
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3522
-            		else $airline_icao = '';
3733
+            		if (isset($airline_array[0]['icao'])) {
3734
+            			$airline_icao = $airline_array[0]['icao'];
3735
+            		} else {
3736
+            			$airline_icao = '';
3737
+            		}
3523 3738
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3524 3739
 			if (!isset($image_array[0]['registration']))
3525 3740
 			{
@@ -3564,16 +3779,28 @@  discard block
 block discarded – undo
3564 3779
                 {
3565 3780
                         $arrival_airport_array = $this->getAllAirportInfo('NA');
3566 3781
                 }
3567
-                if ($registration == '') $registration = 'NA';
3782
+                if ($registration == '') {
3783
+                	$registration = 'NA';
3784
+                }
3568 3785
                 if ($latitude == '' && $longitude == '') {
3569 3786
             		$latitude = 0;
3570 3787
             		$longitude = 0;
3571 3788
             	}
3572
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3573
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3574
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3575
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3576
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3789
+                if ($squawk == '' || $Common->isInteger($squawk) === false) {
3790
+                	$squawk = NULL;
3791
+                }
3792
+                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) {
3793
+                	$verticalrate = NULL;
3794
+                }
3795
+                if ($heading == '' || $Common->isInteger($heading) === false) {
3796
+                	$heading = 0;
3797
+                }
3798
+                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) {
3799
+                	$groundspeed = 0;
3800
+                }
3801
+                if (!isset($aircraft_owner)) {
3802
+                	$aircraft_owner = NULL;
3803
+                }
3577 3804
                 $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) 
3578 3805
                 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)";
3579 3806
 
@@ -3584,9 +3811,13 @@  discard block
 block discarded – undo
3584 3811
 		if ($airline_type == '') {
3585 3812
 			$timeelapsed = microtime(true);
3586 3813
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3587
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3814
+			if ($globalDebugTimeElapsed) {
3815
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3816
+			}
3817
+		}
3818
+		if ($airline_type == null) {
3819
+			$airline_type = '';
3588 3820
 		}
3589
-		if ($airline_type == null) $airline_type = '';
3590 3821
                 $aircraft_type = $aircraft_array[0]['type'];
3591 3822
                 $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3592 3823
                 $departure_airport_name = $departure_airport_array[0]['name'];
@@ -3722,7 +3953,9 @@  discard block
 block discarded – undo
3722 3953
 			}
3723 3954
 		}
3724 3955
 		$query .= "GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
3725
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3956
+		if ($limit) {
3957
+			$query .= " LIMIT 10 OFFSET 0";
3958
+		}
3726 3959
 		
3727 3960
 		$sth = $this->db->prepare($query);
3728 3961
 		$sth->execute();
@@ -3767,7 +4000,9 @@  discard block
 block discarded – undo
3767 4000
 			}
3768 4001
 		}
3769 4002
 		$query .= "GROUP BY spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC";
3770
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4003
+		if ($limit) {
4004
+			$query .= " LIMIT 10 OFFSET 0";
4005
+		}
3771 4006
       
3772 4007
 		
3773 4008
 		$sth = $this->db->prepare($query);
@@ -3813,7 +4048,9 @@  discard block
 block discarded – undo
3813 4048
 			}
3814 4049
 		}
3815 4050
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC";
3816
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4051
+		if ($limit) {
4052
+			$query .= " LIMIT 10 OFFSET 0";
4053
+		}
3817 4054
       
3818 4055
 		
3819 4056
 		$sth = $this->db->prepare($query);
@@ -3861,7 +4098,9 @@  discard block
 block discarded – undo
3861 4098
 			}
3862 4099
 		}
3863 4100
 		$query .= "GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
3864
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4101
+		if ($limit) {
4102
+			$query .= " LIMIT 10 OFFSET 0";
4103
+		}
3865 4104
       
3866 4105
 		
3867 4106
 		$sth = $this->db->prepare($query);
@@ -3906,7 +4145,9 @@  discard block
 block discarded – undo
3906 4145
 			}
3907 4146
 		}
3908 4147
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC";
3909
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4148
+		if ($limit) {
4149
+			$query .= " LIMIT 10 OFFSET 0";
4150
+		}
3910 4151
       
3911 4152
 		
3912 4153
 		$sth = $this->db->prepare($query);
@@ -4149,7 +4390,9 @@  discard block
 block discarded – undo
4149 4390
 			date_default_timezone_set($globalTimezone);
4150 4391
 			$datetime = new DateTime($date);
4151 4392
 			$offset = $datetime->format('P');
4152
-		} else $offset = '+00:00';
4393
+		} else {
4394
+			$offset = '+00:00';
4395
+		}
4153 4396
 
4154 4397
 		if ($globalDBdriver == 'mysql') {
4155 4398
 			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
@@ -4197,7 +4440,9 @@  discard block
 block discarded – undo
4197 4440
 			date_default_timezone_set($globalTimezone);
4198 4441
 			$datetime = new DateTime($date);
4199 4442
 			$offset = $datetime->format('P');
4200
-		} else $offset = '+00:00';
4443
+		} else {
4444
+			$offset = '+00:00';
4445
+		}
4201 4446
 		
4202 4447
 		if ($globalDBdriver == 'mysql') {
4203 4448
 			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
@@ -4415,7 +4660,9 @@  discard block
 block discarded – undo
4415 4660
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' 
4416 4661
 					GROUP BY spotter_output.airline_country
4417 4662
 					ORDER BY airline_country_count DESC";
4418
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4663
+		if ($limit) {
4664
+			$query .= " LIMIT 10 OFFSET 0";
4665
+		}
4419 4666
       
4420 4667
 		$sth = $this->db->prepare($query);
4421 4668
 		$sth->execute();
@@ -4443,7 +4690,9 @@  discard block
 block discarded – undo
4443 4690
 		global $globalDBdriver;
4444 4691
 		//$filter_query = $this->getFilter($filters,true,true);
4445 4692
 		$Connection= new Connection($this->db);
4446
-		if (!$Connection->tableExists('countries')) return array();
4693
+		if (!$Connection->tableExists('countries')) {
4694
+			return array();
4695
+		}
4447 4696
 		/*
4448 4697
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
4449 4698
 					FROM countries c, spotter_output s
@@ -4475,7 +4724,9 @@  discard block
 block discarded – undo
4475 4724
 		}
4476 4725
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT flightaware_id,over_country FROM spotter_live".$filter_query.") l ON c.iso2 = l.over_country ";
4477 4726
 		$query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC";
4478
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4727
+		if ($limit) {
4728
+			$query .= " LIMIT 10 OFFSET 0";
4729
+		}
4479 4730
       
4480 4731
 		
4481 4732
 		$sth = $this->db->prepare($query);
@@ -4525,7 +4776,9 @@  discard block
 block discarded – undo
4525 4776
 		}
4526 4777
 
4527 4778
 		$query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
4528
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4779
+		if ($limit) {
4780
+			$query .= " LIMIT 10 OFFSET 0";
4781
+		}
4529 4782
  
4530 4783
 		$sth = $this->db->prepare($query);
4531 4784
 		$sth->execute();
@@ -4571,7 +4824,9 @@  discard block
 block discarded – undo
4571 4824
 		}
4572 4825
 
4573 4826
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
4574
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4827
+		if ($limit) {
4828
+			$query .= " LIMIT 10 OFFSET 0";
4829
+		}
4575 4830
  
4576 4831
 		$sth = $this->db->prepare($query);
4577 4832
 		$sth->execute();
@@ -4618,7 +4873,9 @@  discard block
 block discarded – undo
4618 4873
 		}
4619 4874
 
4620 4875
 		$query .= "GROUP BY EXTRACT(month from spotter_output.date), EXTRACT(year from spotter_output.date), spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
4621
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4876
+		if ($limit) {
4877
+			$query .= " LIMIT 10 OFFSET 0";
4878
+		}
4622 4879
  
4623 4880
 		$sth = $this->db->prepare($query);
4624 4881
 		$sth->execute();
@@ -4671,7 +4928,9 @@  discard block
 block discarded – undo
4671 4928
 			if($row['registration'] != "")
4672 4929
 			{
4673 4930
 				$image_array = $Image->getSpotterImage($row['registration']);
4674
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4931
+				if (isset($image_array[0]['image_thumbnail'])) {
4932
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4933
+				}
4675 4934
 			}
4676 4935
 			$temp_array['registration_count'] = $row['registration_count'];
4677 4936
 
@@ -4746,7 +5005,9 @@  discard block
 block discarded – undo
4746 5005
 			if($row['registration'] != "")
4747 5006
 			{
4748 5007
 				$image_array = $Image->getSpotterImage($row['registration']);
4749
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5008
+				if (isset($image_array[0]['image_thumbnail'])) {
5009
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5010
+				}
4750 5011
 			}
4751 5012
 			$temp_array['registration_count'] = $row['registration_count'];
4752 5013
 
@@ -4853,7 +5114,9 @@  discard block
 block discarded – undo
4853 5114
 			if($row['registration'] != "")
4854 5115
 			{
4855 5116
 				$image_array = $Image->getSpotterImage($row['registration']);
4856
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5117
+				if (isset($image_array[0]['image_thumbnail'])) {
5118
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5119
+				}
4857 5120
 			}
4858 5121
 			$temp_array['registration_count'] = $row['registration_count'];
4859 5122
 			$aircraft_array[] = $temp_array;
@@ -4978,7 +5241,9 @@  discard block
 block discarded – undo
4978 5241
 			date_default_timezone_set($globalTimezone);
4979 5242
 			$datetime = new DateTime($date);
4980 5243
 			$offset = $datetime->format('P');
4981
-		} else $offset = '+00:00';
5244
+		} else {
5245
+			$offset = '+00:00';
5246
+		}
4982 5247
 
4983 5248
 		if ($globalDBdriver == 'mysql') {
4984 5249
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
@@ -5025,7 +5290,9 @@  discard block
 block discarded – undo
5025 5290
 			date_default_timezone_set($globalTimezone);
5026 5291
 			$datetime = new DateTime($date);
5027 5292
 			$offset = $datetime->format('P');
5028
-		} else $offset = '+00:00';
5293
+		} else {
5294
+			$offset = '+00:00';
5295
+		}
5029 5296
 
5030 5297
 		if ($globalDBdriver == 'mysql') {
5031 5298
 			$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 
@@ -5054,7 +5321,9 @@  discard block
 block discarded – undo
5054 5321
 			if($row['registration'] != "")
5055 5322
 			{
5056 5323
 				$image_array = $Image->getSpotterImage($row['registration']);
5057
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5324
+				if (isset($image_array[0]['image_thumbnail'])) {
5325
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5326
+				}
5058 5327
 			}
5059 5328
 			$temp_array['registration_count'] = $row['registration_count'];
5060 5329
  
@@ -5079,7 +5348,9 @@  discard block
 block discarded – undo
5079 5348
 			date_default_timezone_set($globalTimezone);
5080 5349
 			$datetime = new DateTime($date);
5081 5350
 			$offset = $datetime->format('P');
5082
-		} else $offset = '+00:00';
5351
+		} else {
5352
+			$offset = '+00:00';
5353
+		}
5083 5354
 
5084 5355
 		if ($globalDBdriver == 'mysql') {
5085 5356
 			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
@@ -5177,8 +5448,11 @@  discard block
 block discarded – undo
5177 5448
 			if($row['registration'] != "")
5178 5449
 			{
5179 5450
 				$image_array = $Image->getSpotterImage($row['registration']);
5180
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5181
-				else $temp_array['image_thumbnail'] = '';
5451
+				if (isset($image_array[0]['image_thumbnail'])) {
5452
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5453
+				} else {
5454
+					$temp_array['image_thumbnail'] = '';
5455
+				}
5182 5456
 			}
5183 5457
 			$temp_array['registration_count'] = $row['registration_count'];
5184 5458
 			$aircraft_array[] = $temp_array;
@@ -5285,7 +5559,9 @@  discard block
 block discarded – undo
5285 5559
 			if($row['registration'] != "")
5286 5560
 			{
5287 5561
 				$image_array = $Image->getSpotterImage($row['registration']);
5288
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5562
+				if (isset($image_array[0]['image_thumbnail'])) {
5563
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5564
+				}
5289 5565
 			}
5290 5566
 			$temp_array['registration_count'] = $row['registration_count'];
5291 5567
           
@@ -5402,7 +5678,9 @@  discard block
 block discarded – undo
5402 5678
 			if($row['registration'] != "")
5403 5679
 			{
5404 5680
 				$image_array = $Image->getSpotterImage($row['registration']);
5405
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5681
+				if (isset($image_array[0]['image_thumbnail'])) {
5682
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5683
+				}
5406 5684
 			}
5407 5685
 			$temp_array['registration_count'] = $row['registration_count'];
5408 5686
           
@@ -5514,7 +5792,9 @@  discard block
 block discarded – undo
5514 5792
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5515 5793
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5516 5794
                 $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5517
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5795
+		if ($limit) {
5796
+			$query .= " LIMIT 10 OFFSET 0";
5797
+		}
5518 5798
 		
5519 5799
 		$sth = $this->db->prepare($query);
5520 5800
 		$sth->execute();
@@ -5533,7 +5813,9 @@  discard block
 block discarded – undo
5533 5813
 			if($row['registration'] != "")
5534 5814
 			{
5535 5815
 				$image_array = $Image->getSpotterImage($row['registration']);
5536
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5816
+				if (isset($image_array[0]['image_thumbnail'])) {
5817
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5818
+				}
5537 5819
 			}
5538 5820
           
5539 5821
 			$aircraft_array[] = $temp_array;
@@ -5574,7 +5856,9 @@  discard block
 block discarded – undo
5574 5856
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5575 5857
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5576 5858
                 $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";
5577
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5859
+		if ($limit) {
5860
+			$query .= " LIMIT 10 OFFSET 0";
5861
+		}
5578 5862
 		
5579 5863
 		$sth = $this->db->prepare($query);
5580 5864
 		$sth->execute();
@@ -5594,7 +5878,9 @@  discard block
 block discarded – undo
5594 5878
 			if($row['registration'] != "")
5595 5879
 			{
5596 5880
 				$image_array = $Image->getSpotterImage($row['registration']);
5597
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5881
+				if (isset($image_array[0]['image_thumbnail'])) {
5882
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5883
+				}
5598 5884
 			}
5599 5885
           
5600 5886
 			$aircraft_array[] = $temp_array;
@@ -5635,7 +5921,9 @@  discard block
 block discarded – undo
5635 5921
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5636 5922
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5637 5923
 				ORDER BY airport_departure_icao_count DESC";
5638
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5924
+		if ($limit) {
5925
+			$query .= " LIMIT 10 OFFSET 0";
5926
+		}
5639 5927
       
5640 5928
 		$sth = $this->db->prepare($query);
5641 5929
 		$sth->execute();
@@ -5687,7 +5975,9 @@  discard block
 block discarded – undo
5687 5975
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5688 5976
                 $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
5689 5977
 				ORDER BY airport_departure_icao_count DESC";
5690
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5978
+		if ($limit) {
5979
+			$query .= " LIMIT 10 OFFSET 0";
5980
+		}
5691 5981
       
5692 5982
 		$sth = $this->db->prepare($query);
5693 5983
 		$sth->execute();
@@ -5739,7 +6029,9 @@  discard block
 block discarded – undo
5739 6029
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5740 6030
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5741 6031
 				ORDER BY airport_departure_icao_count DESC";
5742
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6032
+		if ($limit) {
6033
+			$query .= " LIMIT 10 OFFSET 0";
6034
+		}
5743 6035
     		//echo $query;
5744 6036
 		$sth = $this->db->prepare($query);
5745 6037
 		$sth->execute();
@@ -5791,7 +6083,9 @@  discard block
 block discarded – undo
5791 6083
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5792 6084
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5793 6085
 				ORDER BY airport_departure_icao_count DESC";
5794
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6086
+		if ($limit) {
6087
+			$query .= " LIMIT 10 OFFSET 0";
6088
+		}
5795 6089
       
5796 6090
 		$sth = $this->db->prepare($query);
5797 6091
 		$sth->execute();
@@ -6186,7 +6480,9 @@  discard block
 block discarded – undo
6186 6480
 			date_default_timezone_set($globalTimezone);
6187 6481
 			$datetime = new DateTime($date);
6188 6482
 			$offset = $datetime->format('P');
6189
-		} else $offset = '+00:00';
6483
+		} else {
6484
+			$offset = '+00:00';
6485
+		}
6190 6486
 
6191 6487
 		if ($globalDBdriver == 'mysql') {
6192 6488
 			$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 
@@ -6236,7 +6532,9 @@  discard block
 block discarded – undo
6236 6532
 			date_default_timezone_set($globalTimezone);
6237 6533
 			$datetime = new DateTime($date);
6238 6534
 			$offset = $datetime->format('P');
6239
-		} else $offset = '+00:00';
6535
+		} else {
6536
+			$offset = '+00:00';
6537
+		}
6240 6538
 
6241 6539
 		if ($globalDBdriver == 'mysql') {
6242 6540
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
@@ -6449,7 +6747,9 @@  discard block
 block discarded – undo
6449 6747
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6450 6748
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6451 6749
 					ORDER BY airport_arrival_icao_count DESC";
6452
-		if ($limit) $query .= " LIMIT 10";
6750
+		if ($limit) {
6751
+			$query .= " LIMIT 10";
6752
+		}
6453 6753
       
6454 6754
 		
6455 6755
 		$sth = $this->db->prepare($query);
@@ -6469,7 +6769,9 @@  discard block
 block discarded – undo
6469 6769
 			if ($icaoaskey) {
6470 6770
 				$icao = $row['arrival_airport_icao'];
6471 6771
 				$airport_array[$icao] = $temp_array;
6472
-			} else $airport_array[] = $temp_array;
6772
+			} else {
6773
+				$airport_array[] = $temp_array;
6774
+			}
6473 6775
 		}
6474 6776
 
6475 6777
 		return $airport_array;
@@ -6506,7 +6808,9 @@  discard block
 block discarded – undo
6506 6808
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6507 6809
                 $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
6508 6810
 					ORDER BY airport_arrival_icao_count DESC";
6509
-		if ($limit) $query .= " LIMIT 10";
6811
+		if ($limit) {
6812
+			$query .= " LIMIT 10";
6813
+		}
6510 6814
       
6511 6815
 		
6512 6816
 		$sth = $this->db->prepare($query);
@@ -6527,7 +6831,9 @@  discard block
 block discarded – undo
6527 6831
 			if ($icaoaskey) {
6528 6832
 				$icao = $row['arrival_airport_icao'];
6529 6833
 				$airport_array[$icao] = $temp_array;
6530
-			} else $airport_array[] = $temp_array;
6834
+			} else {
6835
+				$airport_array[] = $temp_array;
6836
+			}
6531 6837
 		}
6532 6838
 
6533 6839
 		return $airport_array;
@@ -6564,7 +6870,9 @@  discard block
 block discarded – undo
6564 6870
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6565 6871
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6566 6872
 					ORDER BY airport_arrival_icao_count DESC";
6567
-		if ($limit) $query .= " LIMIT 10";
6873
+		if ($limit) {
6874
+			$query .= " LIMIT 10";
6875
+		}
6568 6876
       
6569 6877
 		
6570 6878
 		$sth = $this->db->prepare($query);
@@ -6584,7 +6892,9 @@  discard block
 block discarded – undo
6584 6892
 			if ($icaoaskey) {
6585 6893
 				$icao = $row['arrival_airport_icao'];
6586 6894
 				$airport_array[$icao] = $temp_array;
6587
-			} else $airport_array[] = $temp_array;
6895
+			} else {
6896
+				$airport_array[] = $temp_array;
6897
+			}
6588 6898
 		}
6589 6899
 
6590 6900
 		return $airport_array;
@@ -6621,7 +6931,9 @@  discard block
 block discarded – undo
6621 6931
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6622 6932
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6623 6933
 					ORDER BY airport_arrival_icao_count DESC";
6624
-		if ($limit) $query .= " LIMIT 10";
6934
+		if ($limit) {
6935
+			$query .= " LIMIT 10";
6936
+		}
6625 6937
       
6626 6938
 		
6627 6939
 		$sth = $this->db->prepare($query);
@@ -6642,7 +6954,9 @@  discard block
 block discarded – undo
6642 6954
 			if ($icaoaskey) {
6643 6955
 				$icao = $row['arrival_airport_icao'];
6644 6956
 				$airport_array[$icao] = $temp_array;
6645
-			} else $airport_array[] = $temp_array;
6957
+			} else {
6958
+				$airport_array[] = $temp_array;
6959
+			}
6646 6960
 		}
6647 6961
 
6648 6962
 		return $airport_array;
@@ -7023,7 +7337,9 @@  discard block
 block discarded – undo
7023 7337
 			date_default_timezone_set($globalTimezone);
7024 7338
 			$datetime = new DateTime($date);
7025 7339
 			$offset = $datetime->format('P');
7026
-		} else $offset = '+00:00';
7340
+		} else {
7341
+			$offset = '+00:00';
7342
+		}
7027 7343
 
7028 7344
 		if ($globalDBdriver == 'mysql') {
7029 7345
 			$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 
@@ -7073,7 +7389,9 @@  discard block
 block discarded – undo
7073 7389
 			date_default_timezone_set($globalTimezone);
7074 7390
 			$datetime = new DateTime($date);
7075 7391
 			$offset = $datetime->format('P');
7076
-		} else $offset = '+00:00';
7392
+		} else {
7393
+			$offset = '+00:00';
7394
+		}
7077 7395
 
7078 7396
 		if ($globalDBdriver == 'mysql') {
7079 7397
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
@@ -7296,7 +7614,9 @@  discard block
 block discarded – undo
7296 7614
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
7297 7615
 		$query .= " GROUP BY spotter_output.arrival_airport_country
7298 7616
 					ORDER BY airport_arrival_country_count DESC";
7299
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7617
+		if ($limit) {
7618
+			$query .= " LIMIT 10 OFFSET 0";
7619
+		}
7300 7620
       
7301 7621
 		
7302 7622
 		$sth = $this->db->prepare($query);
@@ -7583,7 +7903,9 @@  discard block
 block discarded – undo
7583 7903
 			date_default_timezone_set($globalTimezone);
7584 7904
 			$datetime = new DateTime($date);
7585 7905
 			$offset = $datetime->format('P');
7586
-		} else $offset = '+00:00';
7906
+		} else {
7907
+			$offset = '+00:00';
7908
+		}
7587 7909
 		
7588 7910
 		if ($globalDBdriver == 'mysql') {
7589 7911
 			$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
@@ -7759,15 +8081,23 @@  discard block
 block discarded – undo
7759 8081
 		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7760 8082
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
7761 8083
 		 if ($olderthanmonths > 0) {
7762
-			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
7763
-			else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
8084
+			if ($globalDBdriver == 'mysql') {
8085
+				$query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
8086
+			} else {
8087
+				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
8088
+			}
7764 8089
 		}
7765 8090
 		if ($sincedate != '') {
7766
-			if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'";
7767
-			else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
8091
+			if ($globalDBdriver == 'mysql') {
8092
+				$query .= " AND spotter_output.date > '".$sincedate."'";
8093
+			} else {
8094
+				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
8095
+			}
7768 8096
 		}
7769 8097
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
7770
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
8098
+		if ($limit) {
8099
+			$query .= " LIMIT 10 OFFSET 0";
8100
+		}
7771 8101
       		
7772 8102
 		$sth = $this->db->prepare($query);
7773 8103
 		$sth->execute();
@@ -7801,15 +8131,23 @@  discard block
 block discarded – undo
7801 8131
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7802 8132
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
7803 8133
 		 if ($olderthanmonths > 0) {
7804
-			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7805
-			else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
8134
+			if ($globalDBdriver == 'mysql') {
8135
+				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
8136
+			} else {
8137
+				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
8138
+			}
7806 8139
 		}
7807 8140
 		if ($sincedate != '') {
7808
-			if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' ";
7809
-			else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
8141
+			if ($globalDBdriver == 'mysql') {
8142
+				$query .= "AND spotter_output.date > '".$sincedate."' ";
8143
+			} else {
8144
+				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
8145
+			}
7810 8146
 		}
7811 8147
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
7812
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
8148
+		if ($limit) {
8149
+			$query .= " LIMIT 10 OFFSET 0";
8150
+		}
7813 8151
       		
7814 8152
 		$sth = $this->db->prepare($query);
7815 8153
 		$sth->execute();
@@ -7846,7 +8184,9 @@  discard block
 block discarded – undo
7846 8184
 			date_default_timezone_set($globalTimezone);
7847 8185
 			$datetime = new DateTime();
7848 8186
 			$offset = $datetime->format('P');
7849
-		} else $offset = '+00:00';
8187
+		} else {
8188
+			$offset = '+00:00';
8189
+		}
7850 8190
 
7851 8191
 		if ($globalDBdriver == 'mysql') {
7852 8192
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7895,7 +8235,9 @@  discard block
 block discarded – undo
7895 8235
 			date_default_timezone_set($globalTimezone);
7896 8236
 			$datetime = new DateTime();
7897 8237
 			$offset = $datetime->format('P');
7898
-		} else $offset = '+00:00';
8238
+		} else {
8239
+			$offset = '+00:00';
8240
+		}
7899 8241
 		$filter_query = $this->getFilter($filters,true,true);
7900 8242
 		if ($globalDBdriver == 'mysql') {
7901 8243
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7944,7 +8286,9 @@  discard block
 block discarded – undo
7944 8286
 			date_default_timezone_set($globalTimezone);
7945 8287
 			$datetime = new DateTime();
7946 8288
 			$offset = $datetime->format('P');
7947
-		} else $offset = '+00:00';
8289
+		} else {
8290
+			$offset = '+00:00';
8291
+		}
7948 8292
 		$filter_query = $this->getFilter($filters,true,true);
7949 8293
 		if ($globalDBdriver == 'mysql') {
7950 8294
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7990,7 +8334,9 @@  discard block
 block discarded – undo
7990 8334
 			date_default_timezone_set($globalTimezone);
7991 8335
 			$datetime = new DateTime();
7992 8336
 			$offset = $datetime->format('P');
7993
-		} else $offset = '+00:00';
8337
+		} else {
8338
+			$offset = '+00:00';
8339
+		}
7994 8340
 		$filter_query = $this->getFilter($filters,true,true);
7995 8341
 		if ($globalDBdriver == 'mysql') {
7996 8342
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -8038,7 +8384,9 @@  discard block
 block discarded – undo
8038 8384
 			date_default_timezone_set($globalTimezone);
8039 8385
 			$datetime = new DateTime();
8040 8386
 			$offset = $datetime->format('P');
8041
-		} else $offset = '+00:00';
8387
+		} else {
8388
+			$offset = '+00:00';
8389
+		}
8042 8390
 		
8043 8391
 		if ($globalDBdriver == 'mysql') {
8044 8392
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -8086,7 +8434,9 @@  discard block
 block discarded – undo
8086 8434
 			date_default_timezone_set($globalTimezone);
8087 8435
 			$datetime = new DateTime();
8088 8436
 			$offset = $datetime->format('P');
8089
-		} else $offset = '+00:00';
8437
+		} else {
8438
+			$offset = '+00:00';
8439
+		}
8090 8440
 
8091 8441
 		if ($globalDBdriver == 'mysql') {
8092 8442
 			$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
@@ -8133,7 +8483,9 @@  discard block
 block discarded – undo
8133 8483
 			date_default_timezone_set($globalTimezone);
8134 8484
 			$datetime = new DateTime();
8135 8485
 			$offset = $datetime->format('P');
8136
-		} else $offset = '+00:00';
8486
+		} else {
8487
+			$offset = '+00:00';
8488
+		}
8137 8489
 
8138 8490
 		if ($globalDBdriver == 'mysql') {
8139 8491
 			$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
@@ -8181,7 +8533,9 @@  discard block
 block discarded – undo
8181 8533
 			date_default_timezone_set($globalTimezone);
8182 8534
 			$datetime = new DateTime();
8183 8535
 			$offset = $datetime->format('P');
8184
-		} else $offset = '+00:00';
8536
+		} else {
8537
+			$offset = '+00:00';
8538
+		}
8185 8539
 		$filter_query = $this->getFilter($filters,true,true);
8186 8540
 		if ($globalDBdriver == 'mysql') {
8187 8541
 			$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
@@ -8226,7 +8580,9 @@  discard block
 block discarded – undo
8226 8580
 			date_default_timezone_set($globalTimezone);
8227 8581
 			$datetime = new DateTime();
8228 8582
 			$offset = $datetime->format('P');
8229
-		} else $offset = '+00:00';
8583
+		} else {
8584
+			$offset = '+00:00';
8585
+		}
8230 8586
 		$filter_query = $this->getFilter($filters,true,true);
8231 8587
 
8232 8588
 		if ($globalDBdriver == 'mysql') {
@@ -8273,7 +8629,9 @@  discard block
 block discarded – undo
8273 8629
 			date_default_timezone_set($globalTimezone);
8274 8630
 			$datetime = new DateTime();
8275 8631
 			$offset = $datetime->format('P');
8276
-		} else $offset = '+00:00';
8632
+		} else {
8633
+			$offset = '+00:00';
8634
+		}
8277 8635
 
8278 8636
 		if ($globalDBdriver == 'mysql') {
8279 8637
 			$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
@@ -8319,7 +8677,9 @@  discard block
 block discarded – undo
8319 8677
 			date_default_timezone_set($globalTimezone);
8320 8678
 			$datetime = new DateTime();
8321 8679
 			$offset = $datetime->format('P');
8322
-		} else $offset = '+00:00';
8680
+		} else {
8681
+			$offset = '+00:00';
8682
+		}
8323 8683
 		$filter_query = $this->getFilter($filters,true,true);
8324 8684
 
8325 8685
 		if ($globalDBdriver == 'mysql') {
@@ -8366,7 +8726,9 @@  discard block
 block discarded – undo
8366 8726
 			date_default_timezone_set($globalTimezone);
8367 8727
 			$datetime = new DateTime();
8368 8728
 			$offset = $datetime->format('P');
8369
-		} else $offset = '+00:00';
8729
+		} else {
8730
+			$offset = '+00:00';
8731
+		}
8370 8732
 
8371 8733
 		if ($globalDBdriver == 'mysql') {
8372 8734
 			$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
@@ -8413,7 +8775,9 @@  discard block
 block discarded – undo
8413 8775
 			date_default_timezone_set($globalTimezone);
8414 8776
 			$datetime = new DateTime();
8415 8777
 			$offset = $datetime->format('P');
8416
-		} else $offset = '+00:00';
8778
+		} else {
8779
+			$offset = '+00:00';
8780
+		}
8417 8781
 
8418 8782
 		if ($globalDBdriver == 'mysql') {
8419 8783
 			$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
@@ -8458,7 +8822,9 @@  discard block
 block discarded – undo
8458 8822
 			date_default_timezone_set($globalTimezone);
8459 8823
 			$datetime = new DateTime();
8460 8824
 			$offset = $datetime->format('P');
8461
-		} else $offset = '+00:00';
8825
+		} else {
8826
+			$offset = '+00:00';
8827
+		}
8462 8828
 		$filter_query = $this->getFilter($filters,true,true);
8463 8829
 
8464 8830
 		if ($globalDBdriver == 'mysql') {
@@ -8506,7 +8872,9 @@  discard block
 block discarded – undo
8506 8872
 			date_default_timezone_set($globalTimezone);
8507 8873
 			$datetime = new DateTime();
8508 8874
 			$offset = $datetime->format('P');
8509
-		} else $offset = '+00:00';
8875
+		} else {
8876
+			$offset = '+00:00';
8877
+		}
8510 8878
 
8511 8879
 		if ($globalDBdriver == 'mysql') {
8512 8880
 			$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
@@ -8552,7 +8920,9 @@  discard block
 block discarded – undo
8552 8920
 			date_default_timezone_set($globalTimezone);
8553 8921
 			$datetime = new DateTime();
8554 8922
 			$offset = $datetime->format('P');
8555
-		} else $offset = '+00:00';
8923
+		} else {
8924
+			$offset = '+00:00';
8925
+		}
8556 8926
 		$filter_query = $this->getFilter($filters,true,true);
8557 8927
 
8558 8928
 		if ($globalDBdriver == 'mysql') {
@@ -8600,7 +8970,9 @@  discard block
 block discarded – undo
8600 8970
 			date_default_timezone_set($globalTimezone);
8601 8971
 			$datetime = new DateTime();
8602 8972
 			$offset = $datetime->format('P');
8603
-		} else $offset = '+00:00';
8973
+		} else {
8974
+			$offset = '+00:00';
8975
+		}
8604 8976
 
8605 8977
 		if ($globalDBdriver == 'mysql') {
8606 8978
 			$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
@@ -8647,7 +9019,9 @@  discard block
 block discarded – undo
8647 9019
 			date_default_timezone_set($globalTimezone);
8648 9020
 			$datetime = new DateTime();
8649 9021
 			$offset = $datetime->format('P');
8650
-		} else $offset = '+00:00';
9022
+		} else {
9023
+			$offset = '+00:00';
9024
+		}
8651 9025
 		$filter_query = $this->getFilter($filters,true,true);
8652 9026
 		if ($globalDBdriver == 'mysql') {
8653 9027
 			$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
@@ -8696,7 +9070,9 @@  discard block
 block discarded – undo
8696 9070
 			date_default_timezone_set($globalTimezone);
8697 9071
 			$datetime = new DateTime();
8698 9072
 			$offset = $datetime->format('P');
8699
-		} else $offset = '+00:00';
9073
+		} else {
9074
+			$offset = '+00:00';
9075
+		}
8700 9076
 
8701 9077
 		$orderby_sql = '';
8702 9078
 		if ($orderby == "hour")
@@ -8762,7 +9138,9 @@  discard block
 block discarded – undo
8762 9138
 			date_default_timezone_set($globalTimezone);
8763 9139
 			$datetime = new DateTime();
8764 9140
 			$offset = $datetime->format('P');
8765
-		} else $offset = '+00:00';
9141
+		} else {
9142
+			$offset = '+00:00';
9143
+		}
8766 9144
 
8767 9145
 		$orderby_sql = '';
8768 9146
 		if ($orderby == "hour")
@@ -8829,7 +9207,9 @@  discard block
 block discarded – undo
8829 9207
 			date_default_timezone_set($globalTimezone);
8830 9208
 			$datetime = new DateTime();
8831 9209
 			$offset = $datetime->format('P');
8832
-		} else $offset = '+00:00';
9210
+		} else {
9211
+			$offset = '+00:00';
9212
+		}
8833 9213
 
8834 9214
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8835 9215
 
@@ -8880,7 +9260,9 @@  discard block
 block discarded – undo
8880 9260
 			date_default_timezone_set($globalTimezone);
8881 9261
 			$datetime = new DateTime();
8882 9262
 			$offset = $datetime->format('P');
8883
-		} else $offset = '+00:00';
9263
+		} else {
9264
+			$offset = '+00:00';
9265
+		}
8884 9266
 
8885 9267
 		if ($globalDBdriver == 'mysql') {
8886 9268
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8927,7 +9309,9 @@  discard block
 block discarded – undo
8927 9309
 			date_default_timezone_set($globalTimezone);
8928 9310
 			$datetime = new DateTime();
8929 9311
 			$offset = $datetime->format('P');
8930
-		} else $offset = '+00:00';
9312
+		} else {
9313
+			$offset = '+00:00';
9314
+		}
8931 9315
 
8932 9316
 		if ($globalDBdriver == 'mysql') {
8933 9317
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8974,7 +9358,9 @@  discard block
 block discarded – undo
8974 9358
 			date_default_timezone_set($globalTimezone);
8975 9359
 			$datetime = new DateTime();
8976 9360
 			$offset = $datetime->format('P');
8977
-		} else $offset = '+00:00';
9361
+		} else {
9362
+			$offset = '+00:00';
9363
+		}
8978 9364
 
8979 9365
 		if ($globalDBdriver == 'mysql') {
8980 9366
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9022,7 +9408,9 @@  discard block
 block discarded – undo
9022 9408
 			date_default_timezone_set($globalTimezone);
9023 9409
 			$datetime = new DateTime();
9024 9410
 			$offset = $datetime->format('P');
9025
-		} else $offset = '+00:00';
9411
+		} else {
9412
+			$offset = '+00:00';
9413
+		}
9026 9414
 
9027 9415
 		if ($globalDBdriver == 'mysql') {
9028 9416
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9070,7 +9458,9 @@  discard block
 block discarded – undo
9070 9458
 			date_default_timezone_set($globalTimezone);
9071 9459
 			$datetime = new DateTime($date);
9072 9460
 			$offset = $datetime->format('P');
9073
-		} else $offset = '+00:00';
9461
+		} else {
9462
+			$offset = '+00:00';
9463
+		}
9074 9464
 
9075 9465
 		if ($globalDBdriver == 'mysql') {
9076 9466
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9118,7 +9508,9 @@  discard block
 block discarded – undo
9118 9508
 			date_default_timezone_set($globalTimezone);
9119 9509
 			$datetime = new DateTime();
9120 9510
 			$offset = $datetime->format('P');
9121
-		} else $offset = '+00:00';
9511
+		} else {
9512
+			$offset = '+00:00';
9513
+		}
9122 9514
 
9123 9515
 		if ($globalDBdriver == 'mysql') {
9124 9516
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9168,7 +9560,9 @@  discard block
 block discarded – undo
9168 9560
 			date_default_timezone_set($globalTimezone);
9169 9561
 			$datetime = new DateTime();
9170 9562
 			$offset = $datetime->format('P');
9171
-		} else $offset = '+00:00';
9563
+		} else {
9564
+			$offset = '+00:00';
9565
+		}
9172 9566
 
9173 9567
 		if ($globalDBdriver == 'mysql') {
9174 9568
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9215,7 +9609,9 @@  discard block
 block discarded – undo
9215 9609
 			date_default_timezone_set($globalTimezone);
9216 9610
 			$datetime = new DateTime();
9217 9611
 			$offset = $datetime->format('P');
9218
-		} else $offset = '+00:00';
9612
+		} else {
9613
+			$offset = '+00:00';
9614
+		}
9219 9615
 
9220 9616
 		if ($globalDBdriver == 'mysql') {
9221 9617
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9383,7 +9779,9 @@  discard block
 block discarded – undo
9383 9779
 			date_default_timezone_set($globalTimezone);
9384 9780
 			$datetime = new DateTime();
9385 9781
 			$offset = $datetime->format('P');
9386
-		} else $offset = '+00:00';
9782
+		} else {
9783
+			$offset = '+00:00';
9784
+		}
9387 9785
 
9388 9786
 		if ($globalDBdriver == 'mysql') {
9389 9787
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9569,7 +9967,9 @@  discard block
 block discarded – undo
9569 9967
 	*/
9570 9968
 	public function parseDirection($direction = 0)
9571 9969
 	{
9572
-		if ($direction == '') $direction = 0;
9970
+		if ($direction == '') {
9971
+			$direction = 0;
9972
+		}
9573 9973
 		$direction_array = array();
9574 9974
 		$temp_array = array();
9575 9975
 
@@ -9670,7 +10070,9 @@  discard block
 block discarded – undo
9670 10070
 		if (isset($result->AirlineFlightInfoResult))
9671 10071
 		{
9672 10072
 			$registration = $result->AirlineFlightInfoResult->tailnumber;
9673
-		} else return '';
10073
+		} else {
10074
+			return '';
10075
+		}
9674 10076
 		
9675 10077
 		$registration = $this->convertAircraftRegistration($registration);
9676 10078
 		
@@ -9699,7 +10101,9 @@  discard block
 block discarded – undo
9699 10101
 		if (count($row) > 0) {
9700 10102
 		    //return $row['Registration'];
9701 10103
 		    return $row['registration'];
9702
-		} else return '';
10104
+		} else {
10105
+			return '';
10106
+		}
9703 10107
 	
9704 10108
 	}
9705 10109
 
@@ -9722,9 +10126,14 @@  discard block
 block discarded – undo
9722 10126
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9723 10127
 		$sth->closeCursor();
9724 10128
 		if (count($row) > 0) {
9725
-		    if ($row['type_flight'] == null) return '';
9726
-		    else return $row['type_flight'];
9727
-		} else return '';
10129
+		    if ($row['type_flight'] == null) {
10130
+		    	return '';
10131
+		    } else {
10132
+		    	return $row['type_flight'];
10133
+		    }
10134
+		} else {
10135
+			return '';
10136
+		}
9728 10137
 	
9729 10138
 	}
9730 10139
 
@@ -9742,7 +10151,9 @@  discard block
 block discarded – undo
9742 10151
 		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9743 10152
 	
9744 10153
 		$Connection = new Connection($this->db);
9745
-		if (!$Connection->tableExists('countries')) return '';
10154
+		if (!$Connection->tableExists('countries')) {
10155
+			return '';
10156
+		}
9746 10157
 	
9747 10158
 		try {
9748 10159
 			/*
@@ -9762,9 +10173,13 @@  discard block
 block discarded – undo
9762 10173
 			$sth->closeCursor();
9763 10174
 			if (count($row) > 0) {
9764 10175
 				return $row;
9765
-			} else return '';
10176
+			} else {
10177
+				return '';
10178
+			}
9766 10179
 		} catch (PDOException $e) {
9767
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
10180
+			if (isset($globalDebug) && $globalDebug) {
10181
+				echo 'Error : '.$e->getMessage()."\n";
10182
+			}
9768 10183
 			return '';
9769 10184
 		}
9770 10185
 	
@@ -9782,7 +10197,9 @@  discard block
 block discarded – undo
9782 10197
 		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
9783 10198
 	
9784 10199
 		$Connection = new Connection($this->db);
9785
-		if (!$Connection->tableExists('countries')) return '';
10200
+		if (!$Connection->tableExists('countries')) {
10201
+			return '';
10202
+		}
9786 10203
 	
9787 10204
 		try {
9788 10205
 			$query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1";
@@ -9794,9 +10211,13 @@  discard block
 block discarded – undo
9794 10211
 			$sth->closeCursor();
9795 10212
 			if (count($row) > 0) {
9796 10213
 				return $row;
9797
-			} else return '';
10214
+			} else {
10215
+				return '';
10216
+			}
9798 10217
 		} catch (PDOException $e) {
9799
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
10218
+			if (isset($globalDebug) && $globalDebug) {
10219
+				echo 'Error : '.$e->getMessage()."\n";
10220
+			}
9800 10221
 			return '';
9801 10222
 		}
9802 10223
 	
@@ -9966,7 +10387,9 @@  discard block
 block discarded – undo
9966 10387
 	{
9967 10388
 		global $globalBitlyAccessToken;
9968 10389
 		
9969
-		if ($globalBitlyAccessToken == '') return $url;
10390
+		if ($globalBitlyAccessToken == '') {
10391
+			return $url;
10392
+		}
9970 10393
         
9971 10394
 		$google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url;
9972 10395
 		
@@ -10115,7 +10538,9 @@  discard block
 block discarded – undo
10115 10538
 		
10116 10539
 
10117 10540
 		// routes
10118
-		if ($globalDebug) print "Routes...\n";
10541
+		if ($globalDebug) {
10542
+			print "Routes...\n";
10543
+		}
10119 10544
 		if ($globalDBdriver == 'mysql') {
10120 10545
 			$query = "SELECT spotter_output.spotter_id, routes.FromAirport_ICAO, routes.ToAirport_ICAO FROM spotter_output, routes WHERE spotter_output.ident = routes.CallSign AND ( spotter_output.departure_airport_icao != routes.FromAirport_ICAO OR spotter_output.arrival_airport_icao != routes.ToAirport_ICAO) AND routes.FromAirport_ICAO != '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)";
10121 10546
 		} else {
@@ -10134,7 +10559,9 @@  discard block
 block discarded – undo
10134 10559
 			}
10135 10560
 		}
10136 10561
 		
10137
-		if ($globalDebug) print "Airlines...\n";
10562
+		if ($globalDebug) {
10563
+			print "Airlines...\n";
10564
+		}
10138 10565
 		//airlines
10139 10566
 		if ($globalDBdriver == 'mysql') {
10140 10567
 			$query  = "SELECT spotter_output.spotter_id, spotter_output.ident FROM spotter_output WHERE (spotter_output.airline_name = '' OR spotter_output.airline_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)";
@@ -10148,10 +10575,15 @@  discard block
 block discarded – undo
10148 10575
 			if (is_numeric(substr($row['ident'], -1, 1)))
10149 10576
 			{
10150 10577
 				$fromsource = NULL;
10151
-				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
10152
-				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
10153
-				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
10154
-				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
10578
+				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
10579
+					$fromsource = 'vatsim';
10580
+				} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
10581
+					$fromsource = 'ivao';
10582
+				} elseif (isset($globalVATSIM) && $globalVATSIM) {
10583
+					$fromsource = 'vatsim';
10584
+				} elseif (isset($globalIVAO) && $globalIVAO) {
10585
+					$fromsource = 'ivao';
10586
+				}
10155 10587
 				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
10156 10588
 				if (isset($airline_array[0]['name'])) {
10157 10589
 					$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";
@@ -10161,13 +10593,17 @@  discard block
 block discarded – undo
10161 10593
 			}
10162 10594
 		}
10163 10595
 
10164
-		if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n";
10596
+		if ($globalDebug) {
10597
+			print "Remove Duplicate in aircraft_modes...\n";
10598
+		}
10165 10599
 		//duplicate modes
10166 10600
 		$query = "DELETE aircraft_modes FROM aircraft_modes LEFT OUTER JOIN (SELECT max(`AircraftID`) as `AircraftID`,`ModeS` FROM `aircraft_modes` group by ModeS) as KeepRows ON aircraft_modes.AircraftID = KeepRows.AircraftID WHERE KeepRows.AircraftID IS NULL";
10167 10601
 		$sth = $this->db->prepare($query);
10168 10602
 		$sth->execute();
10169 10603
 		
10170
-		if ($globalDebug) print "Aircraft...\n";
10604
+		if ($globalDebug) {
10605
+			print "Aircraft...\n";
10606
+		}
10171 10607
 		//aircraft
10172 10608
 		if ($globalDBdriver == 'mysql') {
10173 10609
 			$query  = "SELECT spotter_output.spotter_id, spotter_output.aircraft_icao, spotter_output.registration FROM spotter_output WHERE (spotter_output.aircraft_name = '' OR spotter_output.aircraft_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -10210,26 +10646,38 @@  discard block
 block discarded – undo
10210 10646
 				 if (isset($closestAirports[0])) {
10211 10647
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
10212 10648
 						$airport_icao = $closestAirports[0]['icao'];
10213
-						if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10649
+						if ($globalDebug) {
10650
+							echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10651
+						}
10214 10652
 					} elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') {
10215 10653
 						foreach ($closestAirports as $airport) {
10216 10654
 							if ($row['arrival_airport_icao'] == $airport['icao']) {
10217 10655
 								$airport_icao = $airport['icao'];
10218
-								if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10656
+								if ($globalDebug) {
10657
+									echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10658
+								}
10219 10659
 								break;
10220 10660
 							}
10221 10661
 						}
10222 10662
 					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
10223 10663
 						$airport_icao = $closestAirports[0]['icao'];
10224
-						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";
10664
+						if ($globalDebug) {
10665
+							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";
10666
+						}
10225 10667
 					} else {
10226
-						if ($globalDebug) echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10668
+						if ($globalDebug) {
10669
+							echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10670
+						}
10227 10671
 					}
10228 10672
 				} else {
10229
-					if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
10673
+					if ($globalDebug) {
10674
+						echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
10675
+					}
10230 10676
 				}
10231 10677
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
10232
-					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
10678
+					if ($globalDebug) {
10679
+						echo "Updating airport to ".$airport_icao."...\n";
10680
+					}
10233 10681
 					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10234 10682
 					$sthu = $this->db->prepare($update_query);
10235 10683
 					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
Please login to merge, or discard this patch.
statistics-sub-menu.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 					} else {
14 14
 						print '<option value="">All</option>';
15 15
 					}
16
-					foreach($airlines as $airline) {
16
+					foreach ($airlines as $airline) {
17 17
 						if (isset($airline_icao) && $airline_icao == $airline['airline_icao']) {
18 18
 							print '<option value="'.$airline['airline_icao'].'" selected>'.$airline['airline_name'].'</option>';
19 19
 						} else {
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 <div class="sub-menu sub-menu-container">
29 29
 	<ul class="nav">
30 30
 		<li class="dropdown">
31
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#" >
31
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#" >
32 32
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
33 33
 		    </a>
34 34
 		    <ul class="dropdown-menu">
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 		    </ul>
40 40
 		</li>
41 41
 		<li class="dropdown">
42
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
42
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign") { print 'active'; } ?>" data-toggle="dropdown" href="#">
43 43
 		      <?php echo _("Airline"); ?> <span class="caret"></span>
44 44
 		    </a>
45 45
 		    <ul class="dropdown-menu" role="menu">
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 		    </ul>
50 50
 		</li>
51 51
 		<li class="dropdown">
52
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
52
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country") { print 'active'; } ?>" data-toggle="dropdown" href="#">
53 53
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
54 54
 		    </a>
55 55
 		    <ul class="dropdown-menu" role="menu">
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 		    </ul>
61 61
 		</li>
62 62
 		<li class="dropdown">
63
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
63
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint") { print 'active'; } ?>" data-toggle="dropdown" href="#">
64 64
 		      <?php echo _("Route"); ?> <span class="caret"></span>
65 65
 		    </a>
66 66
 		    <ul class="dropdown-menu" role="menu">
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 		    </ul>
70 70
 		</li>
71 71
 		<li class="dropdown">
72
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
72
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#">
73 73
 		      <?php echo _("Date &amp; Time"); ?> <span class="caret"></span>
74 74
 		    </a>
75 75
 		    <ul class="dropdown-menu" role="menu">
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,9 @@
 block discarded – undo
7 7
 				<?php
8 8
 					require_once('require/class.Stats.php');
9 9
 					$Stats = new Stats();
10
-					if (!isset($filter_name)) $filter_name = '';
10
+					if (!isset($filter_name)) {
11
+						$filter_name = '';
12
+					}
11 13
 					$airlines = $Stats->getAllAirlineNames($filter_name);
12 14
 					if (isset($airline_icao) && ($airline_icao == '' || $airline_icao == 'all')) {
13 15
 						print '<option value="all" selected>All</option>';
Please login to merge, or discard this patch.