Completed
Push — master ( 3d8e1c...e89c80 )
by Yannick
06:03
created
require/libs/Predict/Predict/QTH.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@
 block discarded – undo
7 7
  */
8 8
 class Predict_QTH
9 9
 {
10
-     public $name;   /*!< Name, eg. callsign. */
11
-     public $loc;    /*!< Location, eg City, Country. */
12
-     public $desc;   /*!< Short description. */
13
-     public $lat;    /*!< Latitude in dec. deg. North. */
14
-     public $lon;    /*!< Longitude in dec. deg. East. */
15
-     public $alt;    /*!< Altitude above sea level in meters. */
16
-     public $qra;    /*!< QRA locator */
17
-     public $wx;     /*!< Weather station code (4 chars). */
10
+	 public $name;   /*!< Name, eg. callsign. */
11
+	 public $loc;    /*!< Location, eg City, Country. */
12
+	 public $desc;   /*!< Short description. */
13
+	 public $lat;    /*!< Latitude in dec. deg. North. */
14
+	 public $lon;    /*!< Longitude in dec. deg. East. */
15
+	 public $alt;    /*!< Altitude above sea level in meters. */
16
+	 public $qra;    /*!< QRA locator */
17
+	 public $wx;     /*!< Weather station code (4 chars). */
18 18
 
19
-     public $data;   /*!< Raw data from cfg file. */
19
+	 public $data;   /*!< Raw data from cfg file. */
20 20
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@
 block discarded – undo
7 7
  */
8 8
 class Predict_QTH
9 9
 {
10
-     public $name;   /*!< Name, eg. callsign. */
11
-     public $loc;    /*!< Location, eg City, Country. */
12
-     public $desc;   /*!< Short description. */
13
-     public $lat;    /*!< Latitude in dec. deg. North. */
14
-     public $lon;    /*!< Longitude in dec. deg. East. */
15
-     public $alt;    /*!< Altitude above sea level in meters. */
16
-     public $qra;    /*!< QRA locator */
17
-     public $wx;     /*!< Weather station code (4 chars). */
10
+     public $name; /*!< Name, eg. callsign. */
11
+     public $loc; /*!< Location, eg City, Country. */
12
+     public $desc; /*!< Short description. */
13
+     public $lat; /*!< Latitude in dec. deg. North. */
14
+     public $lon; /*!< Longitude in dec. deg. East. */
15
+     public $alt; /*!< Altitude above sea level in meters. */
16
+     public $qra; /*!< QRA locator */
17
+     public $wx; /*!< Weather station code (4 chars). */
18 18
 
19
-     public $data;   /*!< Raw data from cfg file. */
19
+     public $data; /*!< Raw data from cfg file. */
20 20
 }
Please login to merge, or discard this patch.
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   +386 added lines, -134 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
         }
@@ -59,7 +61,9 @@  discard block
 block discarded – undo
59 61
                 }
60 62
         }
61 63
 	public function getAllAirlineNames($filter_name = '') {
62
-		if ($filter_name == '') $filter_name = $this->filter_name;
64
+		if ($filter_name == '') {
65
+			$filter_name = $this->filter_name;
66
+		}
63 67
                 $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC";
64 68
                  try {
65 69
                         $sth = $this->db->prepare($query);
@@ -71,7 +75,9 @@  discard block
 block discarded – undo
71 75
                 return $all;
72 76
         }
73 77
 	public function getAllAircraftTypes($stats_airline = '',$filter_name = '') {
74
-		if ($filter_name == '') $filter_name = $this->filter_name;
78
+		if ($filter_name == '') {
79
+			$filter_name = $this->filter_name;
80
+		}
75 81
                 $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
76 82
                  try {
77 83
                         $sth = $this->db->prepare($query);
@@ -83,7 +89,9 @@  discard block
 block discarded – undo
83 89
                 return $all;
84 90
         }
85 91
 	public function getAllManufacturers($stats_airline = '',$filter_name = '') {
86
-		if ($filter_name == '') $filter_name = $this->filter_name;
92
+		if ($filter_name == '') {
93
+			$filter_name = $this->filter_name;
94
+		}
87 95
                 $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";
88 96
                  try {
89 97
                         $sth = $this->db->prepare($query);
@@ -95,7 +103,9 @@  discard block
 block discarded – undo
95 103
                 return $all;
96 104
         }
97 105
 	public function getAllAirportNames($stats_airline = '',$filter_name = '') {
98
-		if ($filter_name == '') $filter_name = $this->filter_name;
106
+		if ($filter_name == '') {
107
+			$filter_name = $this->filter_name;
108
+		}
99 109
                 $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";
100 110
                  try {
101 111
                         $sth = $this->db->prepare($query);
@@ -110,9 +120,14 @@  discard block
 block discarded – undo
110 120
 
111 121
 	public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '') {
112 122
 		global $globalStatsFilters;
113
-		if ($filter_name == '') $filter_name = $this->filter_name;
114
-		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";
115
-		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";
123
+		if ($filter_name == '') {
124
+			$filter_name = $this->filter_name;
125
+		}
126
+		if ($limit) {
127
+			$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";
128
+		} else {
129
+			$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";
130
+		}
116 131
                  try {
117 132
                         $sth = $this->db->prepare($query);
118 133
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -132,9 +147,14 @@  discard block
 block discarded – undo
132 147
 	}
133 148
 	public function countAllAirlineCountries($limit = true,$filter_name = '') {
134 149
 		global $globalStatsFilters;
135
-		if ($filter_name == '') $filter_name = $this->filter_name;
136
-		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";
137
-		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";
150
+		if ($filter_name == '') {
151
+			$filter_name = $this->filter_name;
152
+		}
153
+		if ($limit) {
154
+			$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 {
156
+			$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";
157
+		}
138 158
                  try {
139 159
                         $sth = $this->db->prepare($query);
140 160
                         $sth->execute(array(':filter_name' => $filter_name));
@@ -154,9 +174,14 @@  discard block
 block discarded – undo
154 174
 	}
155 175
 	public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '') {
156 176
 		global $globalStatsFilters;
157
-		if ($filter_name == '') $filter_name = $this->filter_name;
158
-		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";
159
-		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";
177
+		if ($filter_name == '') {
178
+			$filter_name = $this->filter_name;
179
+		}
180
+		if ($limit) {
181
+			$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";
182
+		} else {
183
+			$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";
184
+		}
160 185
                  try {
161 186
                         $sth = $this->db->prepare($query);
162 187
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -177,9 +202,14 @@  discard block
 block discarded – undo
177 202
 
178 203
 	public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '') {
179 204
 		global $globalStatsFilters;
180
-		if ($filter_name == '') $filter_name = $this->filter_name;
181
-		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";
182
-		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";
205
+		if ($filter_name == '') {
206
+			$filter_name = $this->filter_name;
207
+		}
208
+		if ($limit) {
209
+			$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";
210
+		} else {
211
+			$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";
212
+		}
183 213
                  try {
184 214
                         $sth = $this->db->prepare($query);
185 215
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -199,9 +229,14 @@  discard block
 block discarded – undo
199 229
 	}
200 230
 	public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '') {
201 231
 		global $globalStatsFilters;
202
-		if ($filter_name == '') $filter_name = $this->filter_name;
203
-		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";
204
-		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";
232
+		if ($filter_name == '') {
233
+			$filter_name = $this->filter_name;
234
+		}
235
+		if ($limit) {
236
+			$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";
237
+		} else {
238
+			$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";
239
+		}
205 240
                  try {
206 241
                         $sth = $this->db->prepare($query);
207 242
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -222,9 +257,14 @@  discard block
 block discarded – undo
222 257
 
223 258
 	public function countAllAirlines($limit = true,$filter_name = '') {
224 259
 		global $globalStatsFilters;
225
-		if ($filter_name == '') $filter_name = $this->filter_name;
226
-		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";
227
-		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";
260
+		if ($filter_name == '') {
261
+			$filter_name = $this->filter_name;
262
+		}
263
+		if ($limit) {
264
+			$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";
265
+		} else {
266
+			$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";
267
+		}
228 268
                  try {
229 269
                         $sth = $this->db->prepare($query);
230 270
                         $sth->execute(array(':filter_name' => $filter_name));
@@ -245,9 +285,14 @@  discard block
 block discarded – undo
245 285
 	}
246 286
 	public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '') {
247 287
 		global $globalStatsFilters;
248
-		if ($filter_name == '') $filter_name = $this->filter_name;
249
-		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";
250
-		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";
288
+		if ($filter_name == '') {
289
+			$filter_name = $this->filter_name;
290
+		}
291
+		if ($limit) {
292
+			$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";
293
+		} else {
294
+			$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";
295
+		}
251 296
                  try {
252 297
                         $sth = $this->db->prepare($query);
253 298
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -267,9 +312,14 @@  discard block
 block discarded – undo
267 312
 	}
268 313
 	public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '') {
269 314
 		global $globalStatsFilters;
270
-		if ($filter_name == '') $filter_name = $this->filter_name;
271
-		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";
272
-		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";
315
+		if ($filter_name == '') {
316
+			$filter_name = $this->filter_name;
317
+		}
318
+		if ($limit) {
319
+			$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";
320
+		} else {
321
+			$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";
322
+		}
273 323
 		 try {
274 324
 			$sth = $this->db->prepare($query);
275 325
 			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -289,10 +339,15 @@  discard block
 block discarded – undo
289 339
 	}
290 340
 	public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '') {
291 341
 		$Connection = new Connection();
292
-		if ($filter_name == '') $filter_name = $this->filter_name;
342
+		if ($filter_name == '') {
343
+			$filter_name = $this->filter_name;
344
+		}
293 345
 		if ($Connection->tableExists('countries')) {
294
-			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";
295
-			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";
346
+			if ($limit) {
347
+				$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";
348
+			} else {
349
+				$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";
350
+			}
296 351
 			 try {
297 352
 				$sth = $this->db->prepare($query);
298 353
 				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -313,9 +368,14 @@  discard block
 block discarded – undo
313 368
 	}
314 369
 	public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '') {
315 370
 		global $globalStatsFilters;
316
-		if ($filter_name == '') $filter_name = $this->filter_name;
317
-		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";
318
-		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";
371
+		if ($filter_name == '') {
372
+			$filter_name = $this->filter_name;
373
+		}
374
+		if ($limit) {
375
+			$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";
376
+		} else {
377
+			$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";
378
+		}
319 379
                  try {
320 380
                         $sth = $this->db->prepare($query);
321 381
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -335,9 +395,14 @@  discard block
 block discarded – undo
335 395
 	}
336 396
 	public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '') {
337 397
 		global $globalStatsFilters;
338
-		if ($filter_name == '') $filter_name = $this->filter_name;
339
-		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";
340
-		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";
398
+		if ($filter_name == '') {
399
+			$filter_name = $this->filter_name;
400
+		}
401
+		if ($limit) {
402
+			$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";
403
+		} else {
404
+			$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";
405
+		}
341 406
                  try {
342 407
                         $sth = $this->db->prepare($query);
343 408
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -357,9 +422,14 @@  discard block
 block discarded – undo
357 422
 	}
358 423
 	public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '') {
359 424
 		global $globalStatsFilters;
360
-		if ($filter_name == '') $filter_name = $this->filter_name;
361
-		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";
362
-		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";
425
+		if ($filter_name == '') {
426
+			$filter_name = $this->filter_name;
427
+		}
428
+		if ($limit) {
429
+			$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";
430
+		} else {
431
+			$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";
432
+		}
363 433
                  try {
364 434
                         $sth = $this->db->prepare($query);
365 435
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -385,7 +455,9 @@  discard block
 block discarded – undo
385 455
         			$icao = $value['airport_departure_icao'];
386 456
         			if (isset($all[$icao])) {
387 457
         				$all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
388
-        			} else $all[$icao] = $value;
458
+        			} else {
459
+        				$all[$icao] = $value;
460
+        			}
389 461
         		}
390 462
         		$count = array();
391 463
         		foreach ($all as $key => $row) {
@@ -397,9 +469,14 @@  discard block
 block discarded – undo
397 469
 	}
398 470
 	public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '') {
399 471
 		global $globalStatsFilters;
400
-		if ($filter_name == '') $filter_name = $this->filter_name;
401
-		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";
402
-		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";
472
+		if ($filter_name == '') {
473
+			$filter_name = $this->filter_name;
474
+		}
475
+		if ($limit) {
476
+			$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";
477
+		} else {
478
+			$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";
479
+		}
403 480
 		try {
404 481
 			$sth = $this->db->prepare($query);
405 482
 			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -425,7 +502,9 @@  discard block
 block discarded – undo
425 502
         			$icao = $value['airport_arrival_icao'];
426 503
         			if (isset($all[$icao])) {
427 504
         				$all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
428
-        			} else $all[$icao] = $value;
505
+        			} else {
506
+        				$all[$icao] = $value;
507
+        			}
429 508
         		}
430 509
         		$count = array();
431 510
         		foreach ($all as $key => $row) {
@@ -438,13 +517,21 @@  discard block
 block discarded – undo
438 517
 	}
439 518
 	public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') {
440 519
 		global $globalDBdriver, $globalStatsFilters;
441
-		if ($filter_name == '') $filter_name = $this->filter_name;
520
+		if ($filter_name == '') {
521
+			$filter_name = $this->filter_name;
522
+		}
442 523
 		if ($globalDBdriver == 'mysql') {
443
-			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";
444
-			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";
524
+			if ($limit) {
525
+				$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";
526
+			} else {
527
+				$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";
528
+			}
445 529
 		} else {
446
-			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";
447
-			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";
530
+			if ($limit) {
531
+				$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";
532
+			} else {
533
+				$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";
534
+			}
448 535
 		}
449 536
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
450 537
                  try {
@@ -468,7 +555,9 @@  discard block
 block discarded – undo
468 555
 	
469 556
 	public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') {
470 557
 		global $globalStatsFilters;
471
-		if ($filter_name == '') $filter_name = $this->filter_name;
558
+		if ($filter_name == '') {
559
+			$filter_name = $this->filter_name;
560
+		}
472 561
 		$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";
473 562
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
474 563
                  try {
@@ -490,7 +579,9 @@  discard block
 block discarded – undo
490 579
 	}
491 580
 	public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') {
492 581
 		global $globalDBdriver, $globalStatsFilters;
493
-		if ($filter_name == '') $filter_name = $this->filter_name;
582
+		if ($filter_name == '') {
583
+			$filter_name = $this->filter_name;
584
+		}
494 585
 		if ($globalDBdriver == 'mysql') {
495 586
 			$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";
496 587
 		} else {
@@ -516,7 +607,9 @@  discard block
 block discarded – undo
516 607
 	}
517 608
 	public function countAllDates($stats_airline = '',$filter_name = '') {
518 609
 		global $globalStatsFilters;
519
-		if ($filter_name == '') $filter_name = $this->filter_name;
610
+		if ($filter_name == '') {
611
+			$filter_name = $this->filter_name;
612
+		}
520 613
 		$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";
521 614
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
522 615
                  try {
@@ -538,7 +631,9 @@  discard block
 block discarded – undo
538 631
 	}
539 632
 	public function countAllDatesByAirlines($filter_name = '') {
540 633
 		global $globalStatsFilters;
541
-		if ($filter_name == '') $filter_name = $this->filter_name;
634
+		if ($filter_name == '') {
635
+			$filter_name = $this->filter_name;
636
+		}
542 637
 		$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";
543 638
 		$query_data = array('filter_name' => $filter_name);
544 639
                  try {
@@ -560,7 +655,9 @@  discard block
 block discarded – undo
560 655
 	}
561 656
 	public function countAllMonths($stats_airline = '',$filter_name = '') {
562 657
 		global $globalStatsFilters;
563
-		if ($filter_name == '') $filter_name = $this->filter_name;
658
+		if ($filter_name == '') {
659
+			$filter_name = $this->filter_name;
660
+		}
564 661
 	    	$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";
565 662
                  try {
566 663
                         $sth = $this->db->prepare($query);
@@ -581,7 +678,9 @@  discard block
 block discarded – undo
581 678
 	}
582 679
 	public function countAllMilitaryMonths($filter_name = '') {
583 680
 		global $globalStatsFilters;
584
-		if ($filter_name == '') $filter_name = $this->filter_name;
681
+		if ($filter_name == '') {
682
+			$filter_name = $this->filter_name;
683
+		}
585 684
 	    	$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";
586 685
                  try {
587 686
                         $sth = $this->db->prepare($query);
@@ -602,9 +701,14 @@  discard block
 block discarded – undo
602 701
 	}
603 702
 	public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') {
604 703
 		global $globalTimezone, $globalDBdriver, $globalStatsFilters;
605
-		if ($filter_name == '') $filter_name = $this->filter_name;
606
-		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";
607
-		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";
704
+		if ($filter_name == '') {
705
+			$filter_name = $this->filter_name;
706
+		}
707
+		if ($limit) {
708
+			$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";
709
+		} else {
710
+			$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";
711
+		}
608 712
 		if ($orderby == 'hour') {
609 713
 			/*
610 714
 			if ($globalDBdriver == 'mysql') {
@@ -613,7 +717,9 @@  discard block
 block discarded – undo
613 717
 			*/
614 718
 			$query .= " ORDER BY CAST(flight_date AS integer) ASC";
615 719
 		}
616
-		if ($orderby == 'count') $query .= " ORDER BY hour_count DESC";
720
+		if ($orderby == 'count') {
721
+			$query .= " ORDER BY hour_count DESC";
722
+		}
617 723
                  try {
618 724
                         $sth = $this->db->prepare($query);
619 725
                         $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
@@ -634,7 +740,9 @@  discard block
 block discarded – undo
634 740
 	
635 741
 	public function countOverallFlights($stats_airline = '', $filter_name = '') {
636 742
 		global $globalStatsFilters;
637
-		if ($filter_name == '') $filter_name = $this->filter_name;
743
+		if ($filter_name == '') {
744
+			$filter_name = $this->filter_name;
745
+		}
638 746
 		$all = $this->getSumStats('flights_bymonth',date('Y'),$stats_airline,$filter_name);
639 747
 		if (empty($all)) {
640 748
 			$filters = array('airlines' => array($stats_airline));
@@ -648,7 +756,9 @@  discard block
 block discarded – undo
648 756
 	}
649 757
 	public function countOverallMilitaryFlights($filter_name = '') {
650 758
 		global $globalStatsFilters;
651
-		if ($filter_name == '') $filter_name = $this->filter_name;
759
+		if ($filter_name == '') {
760
+			$filter_name = $this->filter_name;
761
+		}
652 762
 		$all = $this->getSumStats('military_flights_bymonth',date('Y'),'',$filter_name);
653 763
 		if (empty($all)) {
654 764
 		        $filters = array();
@@ -662,7 +772,9 @@  discard block
 block discarded – undo
662 772
 	}
663 773
 	public function countOverallArrival($stats_airline = '',$filter_name = '') {
664 774
 		global $globalStatsFilters;
665
-		if ($filter_name == '') $filter_name = $this->filter_name;
775
+		if ($filter_name == '') {
776
+			$filter_name = $this->filter_name;
777
+		}
666 778
 		$all = $this->getSumStats('realarrivals_bymonth',date('Y'),$stats_airline,$filter_name);
667 779
 		if (empty($all)) {
668 780
 			$filters = array('airlines' => array($stats_airline));
@@ -676,7 +788,9 @@  discard block
 block discarded – undo
676 788
 	}
677 789
 	public function countOverallAircrafts($stats_airline = '',$filter_name = '') {
678 790
 		global $globalStatsFilters;
679
-		if ($filter_name == '') $filter_name = $this->filter_name;
791
+		if ($filter_name == '') {
792
+			$filter_name = $this->filter_name;
793
+		}
680 794
 		$all = $this->getSumStats('aircrafts_bymonth',date('Y'),$stats_airline,$filter_name);
681 795
 		if (empty($all)) {
682 796
 			$filters = array('airlines' => array($stats_airline));
@@ -690,7 +804,9 @@  discard block
 block discarded – undo
690 804
 	}
691 805
 	public function countOverallAirlines($filter_name = '') {
692 806
 		global $globalStatsFilters;
693
-		if ($filter_name == '') $filter_name = $this->filter_name;
807
+		if ($filter_name == '') {
808
+			$filter_name = $this->filter_name;
809
+		}
694 810
 		$query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name";
695 811
                  try {
696 812
                         $sth = $this->db->prepare($query);
@@ -713,7 +829,9 @@  discard block
 block discarded – undo
713 829
 	}
714 830
 	public function countOverallOwners($stats_airline = '',$filter_name = '') {
715 831
 		global $globalStatsFilters;
716
-		if ($filter_name == '') $filter_name = $this->filter_name;
832
+		if ($filter_name == '') {
833
+			$filter_name = $this->filter_name;
834
+		}
717 835
 		/*
718 836
 		$query = "SELECT COUNT(*) AS nb_owner FROM stats_owner";
719 837
                  try {
@@ -738,7 +856,9 @@  discard block
 block discarded – undo
738 856
 	}
739 857
 	public function countOverallPilots($stats_airline = '',$filter_name = '') {
740 858
 		global $globalStatsFilters;
741
-		if ($filter_name == '') $filter_name = $this->filter_name;
859
+		if ($filter_name == '') {
860
+			$filter_name = $this->filter_name;
861
+		}
742 862
 		$all = $this->getSumStats('pilots_bymonth',date('Y'),$stats_airline,$filter_name);
743 863
 		if (empty($all)) {
744 864
 			$filters = array('airlines' => array($stats_airline));
@@ -752,7 +872,9 @@  discard block
 block discarded – undo
752 872
 	}
753 873
 
754 874
 	public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') {
755
-		if ($filter_name == '') $filter_name = $this->filter_name;
875
+		if ($filter_name == '') {
876
+			$filter_name = $this->filter_name;
877
+		}
756 878
 		$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";
757 879
 		$query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
758 880
                  try {
@@ -765,7 +887,9 @@  discard block
 block discarded – undo
765 887
                 return $all;
766 888
 	}
767 889
 	public function getStats($type,$stats_airline = '', $filter_name = '') {
768
-		if ($filter_name == '') $filter_name = $this->filter_name;
890
+		if ($filter_name == '') {
891
+			$filter_name = $this->filter_name;
892
+		}
769 893
                 $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date";
770 894
                 $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
771 895
                  try {
@@ -778,7 +902,9 @@  discard block
 block discarded – undo
778 902
                 return $all;
779 903
         }
780 904
 	public function getSumStats($type,$year,$stats_airline = '',$filter_name = '') {
781
-		if ($filter_name == '') $filter_name = $this->filter_name;
905
+		if ($filter_name == '') {
906
+			$filter_name = $this->filter_name;
907
+		}
782 908
     		global $globalArchiveMonths, $globalDBdriver;
783 909
     		if ($globalDBdriver == 'mysql') {
784 910
 	                $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";
@@ -797,7 +923,9 @@  discard block
 block discarded – undo
797 923
         }
798 924
 	public function getStatsTotal($type, $stats_airline = '', $filter_name = '') {
799 925
     		global $globalArchiveMonths, $globalDBdriver;
800
-		if ($filter_name == '') $filter_name = $this->filter_name;
926
+		if ($filter_name == '') {
927
+			$filter_name = $this->filter_name;
928
+		}
801 929
     		if ($globalDBdriver == 'mysql') {
802 930
 			$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";
803 931
 		} else {
@@ -815,7 +943,9 @@  discard block
 block discarded – undo
815 943
         }
816 944
 	public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') {
817 945
     		global $globalArchiveMonths, $globalDBdriver;
818
-		if ($filter_name == '') $filter_name = $this->filter_name;
946
+		if ($filter_name == '') {
947
+			$filter_name = $this->filter_name;
948
+		}
819 949
     		if ($globalDBdriver == 'mysql') {
820 950
 			$query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name";
821 951
                 } else {
@@ -832,7 +962,9 @@  discard block
 block discarded – undo
832 962
         }
833 963
 	public function getStatsAirlineTotal($filter_name = '') {
834 964
     		global $globalArchiveMonths, $globalDBdriver;
835
-		if ($filter_name == '') $filter_name = $this->filter_name;
965
+		if ($filter_name == '') {
966
+			$filter_name = $this->filter_name;
967
+		}
836 968
     		if ($globalDBdriver == 'mysql') {
837 969
 			$query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name";
838 970
                 } else {
@@ -849,7 +981,9 @@  discard block
 block discarded – undo
849 981
         }
850 982
 	public function getStatsOwnerTotal($filter_name = '') {
851 983
     		global $globalArchiveMonths, $globalDBdriver;
852
-		if ($filter_name == '') $filter_name = $this->filter_name;
984
+		if ($filter_name == '') {
985
+			$filter_name = $this->filter_name;
986
+		}
853 987
     		if ($globalDBdriver == 'mysql') {
854 988
 			$query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name";
855 989
 		} else {
@@ -866,7 +1000,9 @@  discard block
 block discarded – undo
866 1000
         }
867 1001
 	public function getStatsPilotTotal($filter_name = '') {
868 1002
     		global $globalArchiveMonths, $globalDBdriver;
869
-		if ($filter_name == '') $filter_name = $this->filter_name;
1003
+		if ($filter_name == '') {
1004
+			$filter_name = $this->filter_name;
1005
+		}
870 1006
     		if ($globalDBdriver == 'mysql') {
871 1007
             		$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
872 1008
             	} else {
@@ -884,7 +1020,9 @@  discard block
 block discarded – undo
884 1020
 
885 1021
 	public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
886 1022
 		global $globalDBdriver;
887
-		if ($filter_name == '') $filter_name = $this->filter_name;
1023
+		if ($filter_name == '') {
1024
+			$filter_name = $this->filter_name;
1025
+		}
888 1026
 		if ($globalDBdriver == 'mysql') {
889 1027
 			$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";
890 1028
                 } else {
@@ -900,7 +1038,9 @@  discard block
 block discarded – undo
900 1038
         }
901 1039
 	public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
902 1040
 		global $globalDBdriver;
903
-		if ($filter_name == '') $filter_name = $this->filter_name;
1041
+		if ($filter_name == '') {
1042
+			$filter_name = $this->filter_name;
1043
+		}
904 1044
 		if ($globalDBdriver == 'mysql') {
905 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+:cnt, stats_date = :date";
906 1046
 		} else {
@@ -1383,47 +1523,69 @@  discard block
 block discarded – undo
1383 1523
 			$this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s'));
1384 1524
 		} else {
1385 1525
 		*/
1386
-			if ($globalDebug) echo 'Update stats !'."\n";
1387
-			if ($globalDebug) echo 'Count all aircraft types...'."\n";
1526
+			if ($globalDebug) {
1527
+				echo 'Update stats !'."\n";
1528
+			}
1529
+			if ($globalDebug) {
1530
+				echo 'Count all aircraft types...'."\n";
1531
+			}
1388 1532
 			if (isset($last_update[0]['value'])) {
1389 1533
 				$last_update_day = $last_update[0]['value'];
1390
-			} else $last_update_day = '2012-12-12 12:12:12';
1534
+			} else {
1535
+				$last_update_day = '2012-12-12 12:12:12';
1536
+			}
1391 1537
 			$Spotter = new Spotter($this->db);
1392 1538
 			$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day);
1393 1539
 			foreach ($alldata as $number) {
1394 1540
 				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer']);
1395 1541
 			}
1396
-			if ($globalDebug) echo 'Count all airlines...'."\n";
1542
+			if ($globalDebug) {
1543
+				echo 'Count all airlines...'."\n";
1544
+			}
1397 1545
 			$alldata = $Spotter->countAllAirlines(false,0,$last_update_day);
1398 1546
 			foreach ($alldata as $number) {
1399 1547
 				$this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name']);
1400 1548
 			}
1401
-			if ($globalDebug) echo 'Count all registrations...'."\n";
1549
+			if ($globalDebug) {
1550
+				echo 'Count all registrations...'."\n";
1551
+			}
1402 1552
 			$alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day);
1403 1553
 			foreach ($alldata as $number) {
1404 1554
 				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao']);
1405 1555
 			}
1406
-			if ($globalDebug) echo 'Count all callsigns...'."\n";
1556
+			if ($globalDebug) {
1557
+				echo 'Count all callsigns...'."\n";
1558
+			}
1407 1559
 			$alldata = $Spotter->countAllCallsigns(false,0,$last_update_day);
1408 1560
 			foreach ($alldata as $number) {
1409 1561
 				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']);
1410 1562
 			}
1411
-			if ($globalDebug) echo 'Count all owners...'."\n";
1563
+			if ($globalDebug) {
1564
+				echo 'Count all owners...'."\n";
1565
+			}
1412 1566
 			$alldata = $Spotter->countAllOwners(false,0,$last_update_day);
1413 1567
 			foreach ($alldata as $number) {
1414 1568
 				$this->addStatOwner($number['owner_name'],$number['owner_count']);
1415 1569
 			}
1416
-			if ($globalDebug) echo 'Count all pilots...'."\n";
1570
+			if ($globalDebug) {
1571
+				echo 'Count all pilots...'."\n";
1572
+			}
1417 1573
 			$alldata = $Spotter->countAllPilots(false,0,$last_update_day);
1418 1574
 			foreach ($alldata as $number) {
1419 1575
 				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source']);
1420 1576
 			}
1421 1577
 			
1422
-			if ($globalDebug) echo 'Count all departure airports...'."\n";
1578
+			if ($globalDebug) {
1579
+				echo 'Count all departure airports...'."\n";
1580
+			}
1423 1581
 			$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day);
1424
-			if ($globalDebug) echo 'Count all detected departure airports...'."\n";
1582
+			if ($globalDebug) {
1583
+				echo 'Count all detected departure airports...'."\n";
1584
+			}
1425 1585
         		$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day);
1426
-			if ($globalDebug) echo 'Order departure airports...'."\n";
1586
+			if ($globalDebug) {
1587
+				echo 'Order departure airports...'."\n";
1588
+			}
1427 1589
 	        	$alldata = array();
1428 1590
 	        	
1429 1591
     			foreach ($pall as $value) {
@@ -1434,7 +1596,9 @@  discard block
 block discarded – undo
1434 1596
     				$icao = $value['airport_departure_icao'];
1435 1597
         			if (isset($alldata[$icao])) {
1436 1598
     					$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1437
-        			} else $alldata[$icao] = $value;
1599
+        			} else {
1600
+        				$alldata[$icao] = $value;
1601
+        			}
1438 1602
 			}
1439 1603
     			$count = array();
1440 1604
     			foreach ($alldata as $key => $row) {
@@ -1444,11 +1608,17 @@  discard block
 block discarded – undo
1444 1608
 			foreach ($alldata as $number) {
1445 1609
 				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count']);
1446 1610
 			}
1447
-			if ($globalDebug) echo 'Count all arrival airports...'."\n";
1611
+			if ($globalDebug) {
1612
+				echo 'Count all arrival airports...'."\n";
1613
+			}
1448 1614
 			$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day);
1449
-			if ($globalDebug) echo 'Count all detected arrival airports...'."\n";
1615
+			if ($globalDebug) {
1616
+				echo 'Count all detected arrival airports...'."\n";
1617
+			}
1450 1618
         		$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day);
1451
-			if ($globalDebug) echo 'Order arrival airports...'."\n";
1619
+			if ($globalDebug) {
1620
+				echo 'Order arrival airports...'."\n";
1621
+			}
1452 1622
 	        	$alldata = array();
1453 1623
     			foreach ($pall as $value) {
1454 1624
 	        		$icao = $value['airport_arrival_icao'];
@@ -1458,7 +1628,9 @@  discard block
 block discarded – undo
1458 1628
     				$icao = $value['airport_arrival_icao'];
1459 1629
         			if (isset($alldata[$icao])) {
1460 1630
         				$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1461
-	        		} else $alldata[$icao] = $value;
1631
+	        		} else {
1632
+	        			$alldata[$icao] = $value;
1633
+	        		}
1462 1634
     			}
1463 1635
         		$count = array();
1464 1636
         		foreach ($alldata as $key => $row) {
@@ -1469,7 +1641,9 @@  discard block
 block discarded – undo
1469 1641
 				echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count']);
1470 1642
 			}
1471 1643
 			if ($Connection->tableExists('countries')) {
1472
-				if ($globalDebug) echo 'Count all flights by countries...'."\n";
1644
+				if ($globalDebug) {
1645
+					echo 'Count all flights by countries...'."\n";
1646
+				}
1473 1647
 				$SpotterArchive = new SpotterArchive();
1474 1648
 				$alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day);
1475 1649
 				foreach ($alldata as $number) {
@@ -1481,46 +1655,66 @@  discard block
 block discarded – undo
1481 1655
 			// Add by month using getstat if month finish...
1482 1656
 
1483 1657
 			//if (date('m',strtotime($last_update_day)) != date('m')) {
1484
-			if ($globalDebug) echo 'Count all flights by months...'."\n";
1658
+			if ($globalDebug) {
1659
+				echo 'Count all flights by months...'."\n";
1660
+			}
1485 1661
 			$Spotter = new Spotter($this->db);
1486 1662
 			$alldata = $Spotter->countAllMonths();
1487 1663
 			$lastyear = false;
1488 1664
 			foreach ($alldata as $number) {
1489
-				if ($number['year_name'] != date('Y')) $lastyear = true;
1665
+				if ($number['year_name'] != date('Y')) {
1666
+					$lastyear = true;
1667
+				}
1490 1668
 				$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'])));
1491 1669
 			}
1492
-			if ($globalDebug) echo 'Count all military flights by months...'."\n";
1670
+			if ($globalDebug) {
1671
+				echo 'Count all military flights by months...'."\n";
1672
+			}
1493 1673
 			$alldata = $Spotter->countAllMilitaryMonths();
1494 1674
 			foreach ($alldata as $number) {
1495 1675
 				$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'])));
1496 1676
 			}
1497
-			if ($globalDebug) echo 'Count all owners by months...'."\n";
1677
+			if ($globalDebug) {
1678
+				echo 'Count all owners by months...'."\n";
1679
+			}
1498 1680
 			$alldata = $Spotter->countAllMonthsOwners();
1499 1681
 			foreach ($alldata as $number) {
1500 1682
 				$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'])));
1501 1683
 			}
1502
-			if ($globalDebug) echo 'Count all pilots by months...'."\n";
1684
+			if ($globalDebug) {
1685
+				echo 'Count all pilots by months...'."\n";
1686
+			}
1503 1687
 			$alldata = $Spotter->countAllMonthsPilots();
1504 1688
 			foreach ($alldata as $number) {
1505 1689
 				$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'])));
1506 1690
 			}
1507
-			if ($globalDebug) echo 'Count all airlines by months...'."\n";
1691
+			if ($globalDebug) {
1692
+				echo 'Count all airlines by months...'."\n";
1693
+			}
1508 1694
 			$alldata = $Spotter->countAllMonthsAirlines();
1509 1695
 			foreach ($alldata as $number) {
1510 1696
 				$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'])));
1511 1697
 			}
1512
-			if ($globalDebug) echo 'Count all aircrafts by months...'."\n";
1698
+			if ($globalDebug) {
1699
+				echo 'Count all aircrafts by months...'."\n";
1700
+			}
1513 1701
 			$alldata = $Spotter->countAllMonthsAircrafts();
1514 1702
 			foreach ($alldata as $number) {
1515 1703
 				$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'])));
1516 1704
 			}
1517
-			if ($globalDebug) echo 'Count all real arrivals by months...'."\n";
1705
+			if ($globalDebug) {
1706
+				echo 'Count all real arrivals by months...'."\n";
1707
+			}
1518 1708
 			$alldata = $Spotter->countAllMonthsRealArrivals();
1519 1709
 			foreach ($alldata as $number) {
1520 1710
 				$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'])));
1521 1711
 			}
1522
-			if ($globalDebug) echo 'Airports data...'."\n";
1523
-			if ($globalDebug) echo '...Departure'."\n";
1712
+			if ($globalDebug) {
1713
+				echo 'Airports data...'."\n";
1714
+			}
1715
+			if ($globalDebug) {
1716
+				echo '...Departure'."\n";
1717
+			}
1524 1718
 			$this->deleteStatAirport('daily');
1525 1719
 //			$pall = $Spotter->getLast7DaysAirportsDeparture();
1526 1720
   //      		$dall = $Spotter->getLast7DaysDetectedAirportsDeparture();
@@ -1640,37 +1834,53 @@  discard block
 block discarded – undo
1640 1834
 
1641 1835
 			// Count by airlines
1642 1836
 			echo '--- Stats by airlines ---'."\n";
1643
-			if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n";
1837
+			if ($globalDebug) {
1838
+				echo 'Count all aircraft types by airlines...'."\n";
1839
+			}
1644 1840
 			$Spotter = new Spotter($this->db);
1645 1841
 			$alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day);
1646 1842
 			foreach ($alldata as $number) {
1647 1843
 				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao']);
1648 1844
 			}
1649
-			if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n";
1845
+			if ($globalDebug) {
1846
+				echo 'Count all aircraft registrations by airlines...'."\n";
1847
+			}
1650 1848
 			$alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day);
1651 1849
 			foreach ($alldata as $number) {
1652 1850
 				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao']);
1653 1851
 			}
1654
-			if ($globalDebug) echo 'Count all callsigns by airlines...'."\n";
1852
+			if ($globalDebug) {
1853
+				echo 'Count all callsigns by airlines...'."\n";
1854
+			}
1655 1855
 			$alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day);
1656 1856
 			foreach ($alldata as $number) {
1657 1857
 				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']);
1658 1858
 			}
1659
-			if ($globalDebug) echo 'Count all owners by airlines...'."\n";
1859
+			if ($globalDebug) {
1860
+				echo 'Count all owners by airlines...'."\n";
1861
+			}
1660 1862
 			$alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day);
1661 1863
 			foreach ($alldata as $number) {
1662 1864
 				$this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao']);
1663 1865
 			}
1664
-			if ($globalDebug) echo 'Count all pilots by airlines...'."\n";
1866
+			if ($globalDebug) {
1867
+				echo 'Count all pilots by airlines...'."\n";
1868
+			}
1665 1869
 			$alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day);
1666 1870
 			foreach ($alldata as $number) {
1667 1871
 				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source']);
1668 1872
 			}
1669
-			if ($globalDebug) echo 'Count all departure airports by airlines...'."\n";
1873
+			if ($globalDebug) {
1874
+				echo 'Count all departure airports by airlines...'."\n";
1875
+			}
1670 1876
 			$pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day);
1671
-			if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n";
1877
+			if ($globalDebug) {
1878
+				echo 'Count all detected departure airports by airlines...'."\n";
1879
+			}
1672 1880
        			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day);
1673
-			if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n";
1881
+			if ($globalDebug) {
1882
+				echo 'Order detected departure airports by airlines...'."\n";
1883
+			}
1674 1884
 	        	//$alldata = array();
1675 1885
     			foreach ($dall as $value) {
1676 1886
     				$icao = $value['airport_departure_icao'];
@@ -1691,11 +1901,17 @@  discard block
 block discarded – undo
1691 1901
 			foreach ($alldata as $number) {
1692 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'],$number['airline_icao']);
1693 1903
 			}
1694
-			if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n";
1904
+			if ($globalDebug) {
1905
+				echo 'Count all arrival airports by airlines...'."\n";
1906
+			}
1695 1907
 			$pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day);
1696
-			if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n";
1908
+			if ($globalDebug) {
1909
+				echo 'Count all detected arrival airports by airlines...'."\n";
1910
+			}
1697 1911
         		$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day);
1698
-			if ($globalDebug) echo 'Order arrival airports by airlines...'."\n";
1912
+			if ($globalDebug) {
1913
+				echo 'Order arrival airports by airlines...'."\n";
1914
+			}
1699 1915
 	        	//$alldata = array();
1700 1916
     			foreach ($dall as $value) {
1701 1917
     				$icao = $value['airport_arrival_icao'];
@@ -1716,35 +1932,49 @@  discard block
 block discarded – undo
1716 1932
                         foreach ($alldata as $number) {
1717 1933
 				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']);
1718 1934
 			}
1719
-			if ($globalDebug) echo 'Count all flights by months by airlines...'."\n";
1935
+			if ($globalDebug) {
1936
+				echo 'Count all flights by months by airlines...'."\n";
1937
+			}
1720 1938
 			$Spotter = new Spotter($this->db);
1721 1939
 			$alldata = $Spotter->countAllMonthsByAirlines();
1722 1940
 			$lastyear = false;
1723 1941
 			foreach ($alldata as $number) {
1724
-				if ($number['year_name'] != date('Y')) $lastyear = true;
1942
+				if ($number['year_name'] != date('Y')) {
1943
+					$lastyear = true;
1944
+				}
1725 1945
 				$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']);
1726 1946
 			}
1727
-			if ($globalDebug) echo 'Count all owners by months by airlines...'."\n";
1947
+			if ($globalDebug) {
1948
+				echo 'Count all owners by months by airlines...'."\n";
1949
+			}
1728 1950
 			$alldata = $Spotter->countAllMonthsOwnersByAirlines();
1729 1951
 			foreach ($alldata as $number) {
1730 1952
 				$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']);
1731 1953
 			}
1732
-			if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n";
1954
+			if ($globalDebug) {
1955
+				echo 'Count all pilots by months by airlines...'."\n";
1956
+			}
1733 1957
 			$alldata = $Spotter->countAllMonthsPilotsByAirlines();
1734 1958
 			foreach ($alldata as $number) {
1735 1959
 				$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']);
1736 1960
 			}
1737
-			if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n";
1961
+			if ($globalDebug) {
1962
+				echo 'Count all aircrafts by months by airlines...'."\n";
1963
+			}
1738 1964
 			$alldata = $Spotter->countAllMonthsAircraftsByAirlines();
1739 1965
 			foreach ($alldata as $number) {
1740 1966
 				$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']);
1741 1967
 			}
1742
-			if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n";
1968
+			if ($globalDebug) {
1969
+				echo 'Count all real arrivals by months by airlines...'."\n";
1970
+			}
1743 1971
 			$alldata = $Spotter->countAllMonthsRealArrivalsByAirlines();
1744 1972
 			foreach ($alldata as $number) {
1745 1973
 				$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']);
1746 1974
 			}
1747
-			if ($globalDebug) echo '...Departure'."\n";
1975
+			if ($globalDebug) {
1976
+				echo '...Departure'."\n";
1977
+			}
1748 1978
 			$pall = $Spotter->getLast7DaysAirportsDepartureByAirlines();
1749 1979
         		$dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines();
1750 1980
     			foreach ($dall as $value) {
@@ -1767,7 +1997,9 @@  discard block
 block discarded – undo
1767 1997
 			foreach ($alldata as $number) {
1768 1998
 				$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']);
1769 1999
 			}
1770
-			if ($globalDebug) echo '...Arrival'."\n";
2000
+			if ($globalDebug) {
2001
+				echo '...Arrival'."\n";
2002
+			}
1771 2003
 			$pall = $Spotter->getLast7DaysAirportsArrivalByAirlines();
1772 2004
         		$dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines();
1773 2005
     			foreach ($dall as $value) {
@@ -1791,13 +2023,19 @@  discard block
 block discarded – undo
1791 2023
 				$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']);
1792 2024
 			}
1793 2025
 
1794
-			if ($globalDebug) echo 'Flights data...'."\n";
1795
-			if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n";
2026
+			if ($globalDebug) {
2027
+				echo 'Flights data...'."\n";
2028
+			}
2029
+			if ($globalDebug) {
2030
+				echo '-> countAllDatesLastMonth...'."\n";
2031
+			}
1796 2032
 			$alldata = $Spotter->countAllDatesLastMonthByAirlines();
1797 2033
 			foreach ($alldata as $number) {
1798 2034
 				$this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']);
1799 2035
 			}
1800
-			if ($globalDebug) echo '-> countAllDates...'."\n";
2036
+			if ($globalDebug) {
2037
+				echo '-> countAllDates...'."\n";
2038
+			}
1801 2039
 			//$previousdata = $this->countAllDatesByAirlines();
1802 2040
 			$alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines());
1803 2041
 			$values = array();
@@ -1810,14 +2048,18 @@  discard block
 block discarded – undo
1810 2048
 				$this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']);
1811 2049
 			}
1812 2050
 			
1813
-			if ($globalDebug) echo '-> countAllHours...'."\n";
2051
+			if ($globalDebug) {
2052
+				echo '-> countAllHours...'."\n";
2053
+			}
1814 2054
 			$alldata = $Spotter->countAllHoursByAirlines('hour');
1815 2055
 			foreach ($alldata as $number) {
1816 2056
 				$this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']);
1817 2057
 			}
1818 2058
 			
1819 2059
 
1820
-			if (!isset($globalStatsFilters) || $globalStatsFilters == '') $globalStatsFilters = array();
2060
+			if (!isset($globalStatsFilters) || $globalStatsFilters == '') {
2061
+				$globalStatsFilters = array();
2062
+			}
1821 2063
 			foreach ($globalStatsFilters as $name => $filter) {
1822 2064
 				//$filter_name = $filter['name'];
1823 2065
 				$filter_name = $name;
@@ -1825,10 +2067,14 @@  discard block
 block discarded – undo
1825 2067
 				$last_update = $this->getLastStatsUpdate('last_update_stats_'.$filter_name);
1826 2068
 				if (isset($last_update[0]['value'])) {
1827 2069
 					$last_update_day = $last_update[0]['value'];
1828
-				} else $last_update_day = '2012-12-12 12:12:12';
2070
+				} else {
2071
+					$last_update_day = '2012-12-12 12:12:12';
2072
+				}
1829 2073
 
1830 2074
 				// Count by filter
1831
-				if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n";
2075
+				if ($globalDebug) {
2076
+					echo '--- Stats for filter '.$filter_name.' ---'."\n";
2077
+				}
1832 2078
 				$Spotter = new Spotter($this->db);
1833 2079
 				$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter);
1834 2080
 				foreach ($alldata as $number) {
@@ -1866,7 +2112,9 @@  discard block
 block discarded – undo
1866 2112
 	    				$icao = $value['airport_departure_icao'];
1867 2113
         				if (isset($alldata[$icao])) {
1868 2114
     						$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1869
-        				} else $alldata[$icao] = $value;
2115
+        				} else {
2116
+        					$alldata[$icao] = $value;
2117
+        				}
1870 2118
 				}
1871 2119
 	    			$count = array();
1872 2120
     				foreach ($alldata as $key => $row) {
@@ -1887,7 +2135,9 @@  discard block
 block discarded – undo
1887 2135
 	    				$icao = $value['airport_arrival_icao'];
1888 2136
         				if (isset($alldata[$icao])) {
1889 2137
         					$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1890
-		        		} else $alldata[$icao] = $value;
2138
+		        		} else {
2139
+		        			$alldata[$icao] = $value;
2140
+		        		}
1891 2141
 	    			}
1892 2142
         			$count = array();
1893 2143
         			foreach ($alldata as $key => $row) {
@@ -1901,7 +2151,9 @@  discard block
 block discarded – undo
1901 2151
 				$alldata = $Spotter->countAllMonths($filter);
1902 2152
 				$lastyear = false;
1903 2153
 				foreach ($alldata as $number) {
1904
-					if ($number['year_name'] != date('Y')) $lastyear = true;
2154
+					if ($number['year_name'] != date('Y')) {
2155
+						$lastyear = true;
2156
+					}
1905 2157
 					$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);
1906 2158
 				}
1907 2159
 				$alldata = $Spotter->countAllMonthsOwners($filter);
Please login to merge, or discard this patch.
Indentation   +851 added lines, -851 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 ($globalDBdriver == 'mysql') {
@@ -1088,14 +1088,14 @@  discard block
 block discarded – undo
1088 1088
 		} else {
1089 1089
 			$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);"; 
1090 1090
 		}
1091
-                $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
-                 try {
1093
-                        $sth = $this->db->prepare($query);
1094
-                        $sth->execute($query_values);
1095
-                } catch(PDOException $e) {
1096
-                        return "error : ".$e->getMessage();
1097
-                }
1098
-        }
1091
+				$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
+				 try {
1093
+						$sth = $this->db->prepare($query);
1094
+						$sth->execute($query_values);
1095
+				} catch(PDOException $e) {
1096
+						return "error : ".$e->getMessage();
1097
+				}
1098
+		}
1099 1099
 	public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') {
1100 1100
 		global $globalDBdriver;
1101 1101
 		if ($globalDBdriver == 'mysql') {
@@ -1103,14 +1103,14 @@  discard block
 block discarded – undo
1103 1103
 		} else {
1104 1104
 			$query = "UPDATE stats_airport SET departure = 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);"; 
1105 1105
 		}
1106
-                $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);
1107
-                 try {
1108
-                        $sth = $this->db->prepare($query);
1109
-                        $sth->execute($query_values);
1110
-                } catch(PDOException $e) {
1111
-                        return "error : ".$e->getMessage();
1112
-                }
1113
-        }
1106
+				$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);
1107
+				 try {
1108
+						$sth = $this->db->prepare($query);
1109
+						$sth->execute($query_values);
1110
+				} catch(PDOException $e) {
1111
+						return "error : ".$e->getMessage();
1112
+				}
1113
+		}
1114 1114
 	public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') {
1115 1115
 		global $globalDBdriver;
1116 1116
 		if ($globalDBdriver == 'mysql') {
@@ -1118,14 +1118,14 @@  discard block
 block discarded – undo
1118 1118
 		} else {
1119 1119
 			$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);"; 
1120 1120
 		}
1121
-                $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);
1122
-                 try {
1123
-                        $sth = $this->db->prepare($query);
1124
-                        $sth->execute($query_values);
1125
-                } catch(PDOException $e) {
1126
-                        return "error : ".$e->getMessage();
1127
-                }
1128
-        }
1121
+				$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);
1122
+				 try {
1123
+						$sth = $this->db->prepare($query);
1124
+						$sth->execute($query_values);
1125
+				} catch(PDOException $e) {
1126
+						return "error : ".$e->getMessage();
1127
+				}
1128
+		}
1129 1129
 	public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') {
1130 1130
 		global $globalDBdriver;
1131 1131
 		if ($globalDBdriver == 'mysql') {
@@ -1133,52 +1133,52 @@  discard block
 block discarded – undo
1133 1133
 		} else {
1134 1134
 			$query = "UPDATE stats_airport SET arrival = 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);"; 
1135 1135
 		}
1136
-                $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);
1137
-                 try {
1138
-                        $sth = $this->db->prepare($query);
1139
-                        $sth->execute($query_values);
1140
-                } catch(PDOException $e) {
1141
-                        return "error : ".$e->getMessage();
1142
-                }
1143
-        }
1136
+				$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);
1137
+				 try {
1138
+						$sth = $this->db->prepare($query);
1139
+						$sth->execute($query_values);
1140
+				} catch(PDOException $e) {
1141
+						return "error : ".$e->getMessage();
1142
+				}
1143
+		}
1144 1144
 
1145 1145
 	public function deleteStat($id) {
1146
-                $query = "DELETE FROM stats WHERE stats_id = :id";
1147
-                $query_values = array(':id' => $id);
1148
-                 try {
1149
-                        $sth = $this->db->prepare($query);
1150
-                        $sth->execute($query_values);
1151
-                } catch(PDOException $e) {
1152
-                        return "error : ".$e->getMessage();
1153
-                }
1154
-        }
1146
+				$query = "DELETE FROM stats WHERE stats_id = :id";
1147
+				$query_values = array(':id' => $id);
1148
+				 try {
1149
+						$sth = $this->db->prepare($query);
1150
+						$sth->execute($query_values);
1151
+				} catch(PDOException $e) {
1152
+						return "error : ".$e->getMessage();
1153
+				}
1154
+		}
1155 1155
 	public function deleteStatFlight($type) {
1156
-                $query = "DELETE FROM stats_flight WHERE stats_type = :type";
1157
-                $query_values = array(':type' => $type);
1158
-                 try {
1159
-                        $sth = $this->db->prepare($query);
1160
-                        $sth->execute($query_values);
1161
-                } catch(PDOException $e) {
1162
-                        return "error : ".$e->getMessage();
1163
-                }
1164
-        }
1156
+				$query = "DELETE FROM stats_flight WHERE stats_type = :type";
1157
+				$query_values = array(':type' => $type);
1158
+				 try {
1159
+						$sth = $this->db->prepare($query);
1160
+						$sth->execute($query_values);
1161
+				} catch(PDOException $e) {
1162
+						return "error : ".$e->getMessage();
1163
+				}
1164
+		}
1165 1165
 	public function deleteStatAirport($type) {
1166
-                $query = "DELETE FROM stats_airport WHERE stats_type = :type";
1167
-                $query_values = array(':type' => $type);
1168
-                 try {
1169
-                        $sth = $this->db->prepare($query);
1170
-                        $sth->execute($query_values);
1171
-                } catch(PDOException $e) {
1172
-                        return "error : ".$e->getMessage();
1173
-                }
1174
-        }
1166
+				$query = "DELETE FROM stats_airport WHERE stats_type = :type";
1167
+				$query_values = array(':type' => $type);
1168
+				 try {
1169
+						$sth = $this->db->prepare($query);
1170
+						$sth->execute($query_values);
1171
+				} catch(PDOException $e) {
1172
+						return "error : ".$e->getMessage();
1173
+				}
1174
+		}
1175 1175
         
1176
-        public function addOldStats() {
1177
-    		global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats;
1178
-    		$Common = new Common();
1179
-    		$Connection = new Connection();
1180
-    		date_default_timezone_set('UTC');
1181
-    		$last_update = $this->getLastStatsUpdate('last_update_stats');
1176
+		public function addOldStats() {
1177
+			global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats;
1178
+			$Common = new Common();
1179
+			$Connection = new Connection();
1180
+			date_default_timezone_set('UTC');
1181
+			$last_update = $this->getLastStatsUpdate('last_update_stats');
1182 1182
 		//print_r($last_update);
1183 1183
 		/*
1184 1184
 		$flightsbymonth = $this->getStats('flights_by_month');
@@ -1440,24 +1440,24 @@  discard block
 block discarded – undo
1440 1440
 			if ($globalDebug) echo 'Count all departure airports...'."\n";
1441 1441
 			$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day);
1442 1442
 			if ($globalDebug) echo 'Count all detected departure airports...'."\n";
1443
-        		$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day);
1443
+				$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day);
1444 1444
 			if ($globalDebug) echo 'Order departure airports...'."\n";
1445
-	        	$alldata = array();
1445
+				$alldata = array();
1446 1446
 	        	
1447
-    			foreach ($pall as $value) {
1448
-	        		$icao = $value['airport_departure_icao'];
1449
-    				$alldata[$icao] = $value;
1450
-	        	}
1451
-	        	foreach ($dall as $value) {
1452
-    				$icao = $value['airport_departure_icao'];
1453
-        			if (isset($alldata[$icao])) {
1454
-    					$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1455
-        			} else $alldata[$icao] = $value;
1456
-			}
1457
-    			$count = array();
1458
-    			foreach ($alldata as $key => $row) {
1459
-    				$count[$key] = $row['airport_departure_icao_count'];
1460
-        		}
1447
+				foreach ($pall as $value) {
1448
+					$icao = $value['airport_departure_icao'];
1449
+					$alldata[$icao] = $value;
1450
+				}
1451
+				foreach ($dall as $value) {
1452
+					$icao = $value['airport_departure_icao'];
1453
+					if (isset($alldata[$icao])) {
1454
+						$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1455
+					} else $alldata[$icao] = $value;
1456
+			}
1457
+				$count = array();
1458
+				foreach ($alldata as $key => $row) {
1459
+					$count[$key] = $row['airport_departure_icao_count'];
1460
+				}
1461 1461
 			array_multisort($count,SORT_DESC,$alldata);
1462 1462
 			foreach ($alldata as $number) {
1463 1463
 				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count']);
@@ -1465,25 +1465,25 @@  discard block
 block discarded – undo
1465 1465
 			if ($globalDebug) echo 'Count all arrival airports...'."\n";
1466 1466
 			$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day);
1467 1467
 			if ($globalDebug) echo 'Count all detected arrival airports...'."\n";
1468
-        		$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day);
1468
+				$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day);
1469 1469
 			if ($globalDebug) echo 'Order arrival airports...'."\n";
1470
-	        	$alldata = array();
1471
-    			foreach ($pall as $value) {
1472
-	        		$icao = $value['airport_arrival_icao'];
1473
-    				$alldata[$icao] = $value;
1474
-	        	}
1475
-	        	foreach ($dall as $value) {
1476
-    				$icao = $value['airport_arrival_icao'];
1477
-        			if (isset($alldata[$icao])) {
1478
-        				$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1479
-	        		} else $alldata[$icao] = $value;
1480
-    			}
1481
-        		$count = array();
1482
-        		foreach ($alldata as $key => $row) {
1483
-        			$count[$key] = $row['airport_arrival_icao_count'];
1484
-	        	}
1485
-    			array_multisort($count,SORT_DESC,$alldata);
1486
-                        foreach ($alldata as $number) {
1470
+				$alldata = array();
1471
+				foreach ($pall as $value) {
1472
+					$icao = $value['airport_arrival_icao'];
1473
+					$alldata[$icao] = $value;
1474
+				}
1475
+				foreach ($dall as $value) {
1476
+					$icao = $value['airport_arrival_icao'];
1477
+					if (isset($alldata[$icao])) {
1478
+						$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1479
+					} else $alldata[$icao] = $value;
1480
+				}
1481
+				$count = array();
1482
+				foreach ($alldata as $key => $row) {
1483
+					$count[$key] = $row['airport_arrival_icao_count'];
1484
+				}
1485
+				array_multisort($count,SORT_DESC,$alldata);
1486
+						foreach ($alldata as $number) {
1487 1487
 				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 1488
 			}
1489 1489
 			if ($Connection->tableExists('countries')) {
@@ -1543,8 +1543,8 @@  discard block
 block discarded – undo
1543 1543
 //			$pall = $Spotter->getLast7DaysAirportsDeparture();
1544 1544
   //      		$dall = $Spotter->getLast7DaysDetectedAirportsDeparture();
1545 1545
 			$pall = $Spotter->getLast7DaysAirportsDeparture();
1546
-        		$dall = $Spotter->getLast7DaysDetectedAirportsDeparture();
1547
-        		/*
1546
+				$dall = $Spotter->getLast7DaysDetectedAirportsDeparture();
1547
+				/*
1548 1548
 	        	$alldata = array();
1549 1549
     			foreach ($pall as $value) {
1550 1550
 	        		$icao = $value['departure_airport_icao'];
@@ -1563,29 +1563,29 @@  discard block
 block discarded – undo
1563 1563
 	        	}
1564 1564
     			array_multisort($count,SORT_DESC,$alldata);
1565 1565
     			*/
1566
-    			foreach ($dall as $value) {
1567
-    				$icao = $value['departure_airport_icao'];
1568
-    				$ddate = $value['date'];
1569
-    				$find = false;
1570
-    				foreach ($pall as $pvalue) {
1571
-    					if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1572
-    						$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1573
-    						$find = true;
1574
-    						break;
1575
-    					}
1576
-    				}
1577
-    				if ($find === false) {
1578
-    					$pall[] = $value;
1579
-    				}
1580
-    			}
1581
-    			$alldata = $pall;
1566
+				foreach ($dall as $value) {
1567
+					$icao = $value['departure_airport_icao'];
1568
+					$ddate = $value['date'];
1569
+					$find = false;
1570
+					foreach ($pall as $pvalue) {
1571
+						if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1572
+							$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1573
+							$find = true;
1574
+							break;
1575
+						}
1576
+					}
1577
+					if ($find === false) {
1578
+						$pall[] = $value;
1579
+					}
1580
+				}
1581
+				$alldata = $pall;
1582 1582
 			foreach ($alldata as $number) {
1583 1583
 				$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']);
1584 1584
 			}
1585 1585
 			echo '...Arrival'."\n";
1586 1586
 			$pall = $Spotter->getLast7DaysAirportsArrival();
1587
-        		$dall = $Spotter->getLast7DaysDetectedAirportsArrival();
1588
-        		/*
1587
+				$dall = $Spotter->getLast7DaysDetectedAirportsArrival();
1588
+				/*
1589 1589
 	        	$alldata = array();
1590 1590
     			foreach ($pall as $value) {
1591 1591
 	        		$icao = $value['arrival_airport_icao'];
@@ -1605,22 +1605,22 @@  discard block
 block discarded – undo
1605 1605
     			*/
1606 1606
 
1607 1607
 
1608
-    			foreach ($dall as $value) {
1609
-    				$icao = $value['arrival_airport_icao'];
1610
-    				$ddate = $value['date'];
1611
-    				$find = false;
1612
-    				foreach ($pall as $pvalue) {
1613
-    					if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1614
-    						$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1615
-    						$find = true;
1616
-    						break;
1617
-    					}
1618
-    				}
1619
-    				if ($find === false) {
1620
-    					$pall[] = $value;
1621
-    				}
1622
-    			}
1623
-    			$alldata = $pall;
1608
+				foreach ($dall as $value) {
1609
+					$icao = $value['arrival_airport_icao'];
1610
+					$ddate = $value['date'];
1611
+					$find = false;
1612
+					foreach ($pall as $pvalue) {
1613
+						if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1614
+							$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1615
+							$find = true;
1616
+							break;
1617
+						}
1618
+					}
1619
+					if ($find === false) {
1620
+						$pall[] = $value;
1621
+					}
1622
+				}
1623
+				$alldata = $pall;
1624 1624
 			foreach ($alldata as $number) {
1625 1625
 				$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']);
1626 1626
 			}
@@ -1687,51 +1687,51 @@  discard block
 block discarded – undo
1687 1687
 			if ($globalDebug) echo 'Count all departure airports by airlines...'."\n";
1688 1688
 			$pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day);
1689 1689
 			if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n";
1690
-       			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day);
1690
+	   			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day);
1691 1691
 			if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n";
1692
-	        	//$alldata = array();
1693
-    			foreach ($dall as $value) {
1694
-    				$icao = $value['airport_departure_icao'];
1695
-    				$dicao = $value['airline_icao'];
1696
-    				$find = false;
1697
-    				foreach ($pall as $pvalue) {
1698
-    					if ($pvalue['airport_departure_icao'] == $icao && $pvalue['airline_icao'] = $dicao) {
1699
-    						$pvalue['airport_departure_icao_count'] = $pvalue['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1700
-    						$find = true;
1701
-    						break;
1702
-    					}
1703
-    				}
1704
-    				if ($find === false) {
1705
-    					$pall[] = $value;
1706
-    				}
1707
-    			}
1708
-    			$alldata = $pall;
1692
+				//$alldata = array();
1693
+				foreach ($dall as $value) {
1694
+					$icao = $value['airport_departure_icao'];
1695
+					$dicao = $value['airline_icao'];
1696
+					$find = false;
1697
+					foreach ($pall as $pvalue) {
1698
+						if ($pvalue['airport_departure_icao'] == $icao && $pvalue['airline_icao'] = $dicao) {
1699
+							$pvalue['airport_departure_icao_count'] = $pvalue['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1700
+							$find = true;
1701
+							break;
1702
+						}
1703
+					}
1704
+					if ($find === false) {
1705
+						$pall[] = $value;
1706
+					}
1707
+				}
1708
+				$alldata = $pall;
1709 1709
 			foreach ($alldata as $number) {
1710 1710
 				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 1711
 			}
1712 1712
 			if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n";
1713 1713
 			$pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day);
1714 1714
 			if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n";
1715
-        		$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day);
1715
+				$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day);
1716 1716
 			if ($globalDebug) echo 'Order arrival airports by airlines...'."\n";
1717
-	        	//$alldata = array();
1718
-    			foreach ($dall as $value) {
1719
-    				$icao = $value['airport_arrival_icao'];
1720
-    				$dicao = $value['airline_icao'];
1721
-    				$find = false;
1722
-    				foreach ($pall as $pvalue) {
1723
-    					if ($pvalue['airport_arrival_icao'] == $icao && $pvalue['airline_icao'] = $dicao) {
1724
-    						$pvalue['airport_arrival_icao_count'] = $pvalue['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1725
-    						$find = true;
1726
-    						break;
1727
-    					}
1728
-    				}
1729
-    				if ($find === false) {
1730
-    					$pall[] = $value;
1731
-    				}
1732
-    			}
1733
-    			$alldata = $pall;
1734
-                        foreach ($alldata as $number) {
1717
+				//$alldata = array();
1718
+				foreach ($dall as $value) {
1719
+					$icao = $value['airport_arrival_icao'];
1720
+					$dicao = $value['airline_icao'];
1721
+					$find = false;
1722
+					foreach ($pall as $pvalue) {
1723
+						if ($pvalue['airport_arrival_icao'] == $icao && $pvalue['airline_icao'] = $dicao) {
1724
+							$pvalue['airport_arrival_icao_count'] = $pvalue['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1725
+							$find = true;
1726
+							break;
1727
+						}
1728
+					}
1729
+					if ($find === false) {
1730
+						$pall[] = $value;
1731
+					}
1732
+				}
1733
+				$alldata = $pall;
1734
+						foreach ($alldata as $number) {
1735 1735
 				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']);
1736 1736
 			}
1737 1737
 			if ($globalDebug) echo 'Count all flights by months by airlines...'."\n";
@@ -1764,47 +1764,47 @@  discard block
 block discarded – undo
1764 1764
 			}
1765 1765
 			if ($globalDebug) echo '...Departure'."\n";
1766 1766
 			$pall = $Spotter->getLast7DaysAirportsDepartureByAirlines();
1767
-        		$dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines();
1768
-    			foreach ($dall as $value) {
1769
-    				$icao = $value['departure_airport_icao'];
1770
-    				$airline = $value['airline_icao'];
1771
-    				$ddate = $value['date'];
1772
-    				$find = false;
1773
-    				foreach ($pall as $pvalue) {
1774
-    					if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] = $airline) {
1775
-    						$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1776
-    						$find = true;
1777
-    						break;
1778
-    					}
1779
-    				}
1780
-    				if ($find === false) {
1781
-    					$pall[] = $value;
1782
-    				}
1783
-    			}
1784
-    			$alldata = $pall;
1767
+				$dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines();
1768
+				foreach ($dall as $value) {
1769
+					$icao = $value['departure_airport_icao'];
1770
+					$airline = $value['airline_icao'];
1771
+					$ddate = $value['date'];
1772
+					$find = false;
1773
+					foreach ($pall as $pvalue) {
1774
+						if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] = $airline) {
1775
+							$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1776
+							$find = true;
1777
+							break;
1778
+						}
1779
+					}
1780
+					if ($find === false) {
1781
+						$pall[] = $value;
1782
+					}
1783
+				}
1784
+				$alldata = $pall;
1785 1785
 			foreach ($alldata as $number) {
1786 1786
 				$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 1787
 			}
1788 1788
 			if ($globalDebug) echo '...Arrival'."\n";
1789 1789
 			$pall = $Spotter->getLast7DaysAirportsArrivalByAirlines();
1790
-        		$dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines();
1791
-    			foreach ($dall as $value) {
1792
-    				$icao = $value['arrival_airport_icao'];
1793
-    				$airline = $value['airline_icao'];
1794
-    				$ddate = $value['date'];
1795
-    				$find = false;
1796
-    				foreach ($pall as $pvalue) {
1797
-    					if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] == $airline) {
1798
-    						$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1799
-    						$find = true;
1800
-    						break;
1801
-    					}
1802
-    				}
1803
-    				if ($find === false) {
1804
-    					$pall[] = $value;
1805
-    				}
1806
-    			}
1807
-    			$alldata = $pall;
1790
+				$dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines();
1791
+				foreach ($dall as $value) {
1792
+					$icao = $value['arrival_airport_icao'];
1793
+					$airline = $value['airline_icao'];
1794
+					$ddate = $value['date'];
1795
+					$find = false;
1796
+					foreach ($pall as $pvalue) {
1797
+						if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] == $airline) {
1798
+							$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1799
+							$find = true;
1800
+							break;
1801
+						}
1802
+					}
1803
+					if ($find === false) {
1804
+						$pall[] = $value;
1805
+					}
1806
+				}
1807
+				$alldata = $pall;
1808 1808
 			foreach ($alldata as $number) {
1809 1809
 				$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 1810
 			}
@@ -1873,44 +1873,44 @@  discard block
 block discarded – undo
1873 1873
 					$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name,$number['format_source']);
1874 1874
 				}
1875 1875
 				$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter);
1876
-	       			$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter);
1877
-		        	$alldata = array();
1878
-	    			foreach ($pall as $value) {
1879
-		        		$icao = $value['airport_departure_icao'];
1880
-    					$alldata[$icao] = $value;
1881
-	    			}
1882
-		        	foreach ($dall as $value) {
1883
-	    				$icao = $value['airport_departure_icao'];
1884
-        				if (isset($alldata[$icao])) {
1885
-    						$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1886
-        				} else $alldata[$icao] = $value;
1887
-				}
1888
-	    			$count = array();
1889
-    				foreach ($alldata as $key => $row) {
1890
-    					$count[$key] = $row['airport_departure_icao_count'];
1891
-    				}
1876
+		   			$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter);
1877
+					$alldata = array();
1878
+					foreach ($pall as $value) {
1879
+						$icao = $value['airport_departure_icao'];
1880
+						$alldata[$icao] = $value;
1881
+					}
1882
+					foreach ($dall as $value) {
1883
+						$icao = $value['airport_departure_icao'];
1884
+						if (isset($alldata[$icao])) {
1885
+							$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1886
+						} else $alldata[$icao] = $value;
1887
+				}
1888
+					$count = array();
1889
+					foreach ($alldata as $key => $row) {
1890
+						$count[$key] = $row['airport_departure_icao_count'];
1891
+					}
1892 1892
 				array_multisort($count,SORT_DESC,$alldata);
1893 1893
 				foreach ($alldata as $number) {
1894
-    					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);
1894
+						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);
1895 1895
 				}
1896 1896
 				$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,$filter);
1897
-    				$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,$filter);
1897
+					$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,$filter);
1898 1898
 				$alldata = array();
1899
-    				foreach ($pall as $value) {
1900
-		        		$icao = $value['airport_arrival_icao'];
1901
-    					$alldata[$icao] = $value;
1902
-	    			}
1903
-		        	foreach ($dall as $value) {
1904
-	    				$icao = $value['airport_arrival_icao'];
1905
-        				if (isset($alldata[$icao])) {
1906
-        					$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1907
-		        		} else $alldata[$icao] = $value;
1908
-	    			}
1909
-        			$count = array();
1910
-        			foreach ($alldata as $key => $row) {
1911
-    					$count[$key] = $row['airport_arrival_icao_count'];
1912
-		        	}
1913
-        			array_multisort($count,SORT_DESC,$alldata);
1899
+					foreach ($pall as $value) {
1900
+						$icao = $value['airport_arrival_icao'];
1901
+						$alldata[$icao] = $value;
1902
+					}
1903
+					foreach ($dall as $value) {
1904
+						$icao = $value['airport_arrival_icao'];
1905
+						if (isset($alldata[$icao])) {
1906
+							$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1907
+						} else $alldata[$icao] = $value;
1908
+					}
1909
+					$count = array();
1910
+					foreach ($alldata as $key => $row) {
1911
+						$count[$key] = $row['airport_arrival_icao_count'];
1912
+					}
1913
+					array_multisort($count,SORT_DESC,$alldata);
1914 1914
 				foreach ($alldata as $number) {
1915 1915
 					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);
1916 1916
 				}
@@ -1943,45 +1943,45 @@  discard block
 block discarded – undo
1943 1943
 				}
1944 1944
 				echo '...Departure'."\n";
1945 1945
 				$pall = $Spotter->getLast7DaysAirportsDeparture('',$filter);
1946
-        			$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter);
1946
+					$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter);
1947 1947
 				foreach ($dall as $value) {
1948
-    					$icao = $value['departure_airport_icao'];
1949
-    					$ddate = $value['date'];
1950
-    					$find = false;
1951
-    					foreach ($pall as $pvalue) {
1952
-    						if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1953
-    							$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1954
-	    						$find = true;
1955
-    							break;
1956
-    						}
1957
-    					}
1958
-    					if ($find === false) {
1959
-    						$pall[] = $value;
1960
-	    				}
1961
-    				}
1962
-	    			$alldata = $pall;
1948
+						$icao = $value['departure_airport_icao'];
1949
+						$ddate = $value['date'];
1950
+						$find = false;
1951
+						foreach ($pall as $pvalue) {
1952
+							if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1953
+								$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1954
+								$find = true;
1955
+								break;
1956
+							}
1957
+						}
1958
+						if ($find === false) {
1959
+							$pall[] = $value;
1960
+						}
1961
+					}
1962
+					$alldata = $pall;
1963 1963
 				foreach ($alldata as $number) {
1964 1964
 					$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);
1965 1965
 				}
1966 1966
 				echo '...Arrival'."\n";
1967 1967
 				$pall = $Spotter->getLast7DaysAirportsArrival('',$filter);
1968
-    				$dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter);
1968
+					$dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter);
1969 1969
 				foreach ($dall as $value) {
1970 1970
 					$icao = $value['arrival_airport_icao'];
1971 1971
 					$ddate = $value['date'];
1972
-    					$find = false;
1972
+						$find = false;
1973 1973
 					foreach ($pall as $pvalue) {
1974
-    						if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1975
-    							$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1976
-    							$find = true;
1977
-    							break;
1978
-	    					}
1979
-    					}
1980
-    					if ($find === false) {
1981
-    						$pall[] = $value;
1982
-	    				}
1983
-    				}
1984
-    				$alldata = $pall;
1974
+							if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1975
+								$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1976
+								$find = true;
1977
+								break;
1978
+							}
1979
+						}
1980
+						if ($find === false) {
1981
+							$pall[] = $value;
1982
+						}
1983
+					}
1984
+					$alldata = $pall;
1985 1985
 				foreach ($alldata as $number) {
1986 1986
 					$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);
1987 1987
 				}
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,219 +925,219 @@  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 ($globalDBdriver == 'mysql') {
1087 1087
 			$query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:departure,'yearly',:date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE departure = departure+:departure";
1088 1088
 		} else {
1089 1089
 			$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);"; 
1090 1090
 		}
1091
-                $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);
1091
+                $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 1092
                  try {
1093 1093
                         $sth = $this->db->prepare($query);
1094 1094
                         $sth->execute($query_values);
1095
-                } catch(PDOException $e) {
1095
+                } catch (PDOException $e) {
1096 1096
                         return "error : ".$e->getMessage();
1097 1097
                 }
1098 1098
         }
1099
-	public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') {
1099
+	public function addStatDepartureAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') {
1100 1100
 		global $globalDBdriver;
1101 1101
 		if ($globalDBdriver == 'mysql') {
1102 1102
 			$query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE departure = :departure";
1103 1103
 		} else {
1104 1104
 			$query = "UPDATE stats_airport SET departure = 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);"; 
1105 1105
 		}
1106
-                $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);
1106
+                $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);
1107 1107
                  try {
1108 1108
                         $sth = $this->db->prepare($query);
1109 1109
                         $sth->execute($query_values);
1110
-                } catch(PDOException $e) {
1110
+                } catch (PDOException $e) {
1111 1111
                         return "error : ".$e->getMessage();
1112 1112
                 }
1113 1113
         }
1114
-	public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') {
1114
+	public function addStatArrivalAirports($airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') {
1115 1115
 		global $globalDBdriver;
1116 1116
 		if ($globalDBdriver == 'mysql') {
1117 1117
 			$query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE arrival = arrival+:arrival";
1118 1118
 		} else {
1119 1119
 			$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);"; 
1120 1120
 		}
1121
-                $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);
1121
+                $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);
1122 1122
                  try {
1123 1123
                         $sth = $this->db->prepare($query);
1124 1124
                         $sth->execute($query_values);
1125
-                } catch(PDOException $e) {
1125
+                } catch (PDOException $e) {
1126 1126
                         return "error : ".$e->getMessage();
1127 1127
                 }
1128 1128
         }
1129
-	public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') {
1129
+	public function addStatArrivalAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') {
1130 1130
 		global $globalDBdriver;
1131 1131
 		if ($globalDBdriver == 'mysql') {
1132 1132
 			$query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'daily',:date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE arrival = :arrival";
1133 1133
 		} else {
1134 1134
 			$query = "UPDATE stats_airport SET arrival = 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);"; 
1135 1135
 		}
1136
-                $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);
1136
+                $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);
1137 1137
                  try {
1138 1138
                         $sth = $this->db->prepare($query);
1139 1139
                         $sth->execute($query_values);
1140
-                } catch(PDOException $e) {
1140
+                } catch (PDOException $e) {
1141 1141
                         return "error : ".$e->getMessage();
1142 1142
                 }
1143 1143
         }
@@ -1148,7 +1148,7 @@  discard block
 block discarded – undo
1148 1148
                  try {
1149 1149
                         $sth = $this->db->prepare($query);
1150 1150
                         $sth->execute($query_values);
1151
-                } catch(PDOException $e) {
1151
+                } catch (PDOException $e) {
1152 1152
                         return "error : ".$e->getMessage();
1153 1153
                 }
1154 1154
         }
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
                  try {
1159 1159
                         $sth = $this->db->prepare($query);
1160 1160
                         $sth->execute($query_values);
1161
-                } catch(PDOException $e) {
1161
+                } catch (PDOException $e) {
1162 1162
                         return "error : ".$e->getMessage();
1163 1163
                 }
1164 1164
         }
@@ -1168,13 +1168,13 @@  discard block
 block discarded – undo
1168 1168
                  try {
1169 1169
                         $sth = $this->db->prepare($query);
1170 1170
                         $sth->execute($query_values);
1171
-                } catch(PDOException $e) {
1171
+                } catch (PDOException $e) {
1172 1172
                         return "error : ".$e->getMessage();
1173 1173
                 }
1174 1174
         }
1175 1175
         
1176 1176
         public function addOldStats() {
1177
-    		global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats;
1177
+    		global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters, $globalDeleteLastYearStats;
1178 1178
     		$Common = new Common();
1179 1179
     		$Connection = new Connection();
1180 1180
     		date_default_timezone_set('UTC');
@@ -1407,40 +1407,40 @@  discard block
 block discarded – undo
1407 1407
 				$last_update_day = $last_update[0]['value'];
1408 1408
 			} else $last_update_day = '2012-12-12 12:12:12';
1409 1409
 			$Spotter = new Spotter($this->db);
1410
-			$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day);
1410
+			$alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day);
1411 1411
 			foreach ($alldata as $number) {
1412
-				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer']);
1412
+				$this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer']);
1413 1413
 			}
1414 1414
 			if ($globalDebug) echo 'Count all airlines...'."\n";
1415
-			$alldata = $Spotter->countAllAirlines(false,0,$last_update_day);
1415
+			$alldata = $Spotter->countAllAirlines(false, 0, $last_update_day);
1416 1416
 			foreach ($alldata as $number) {
1417
-				$this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name']);
1417
+				$this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name']);
1418 1418
 			}
1419 1419
 			if ($globalDebug) echo 'Count all registrations...'."\n";
1420
-			$alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day);
1420
+			$alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day);
1421 1421
 			foreach ($alldata as $number) {
1422
-				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao']);
1422
+				$this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao']);
1423 1423
 			}
1424 1424
 			if ($globalDebug) echo 'Count all callsigns...'."\n";
1425
-			$alldata = $Spotter->countAllCallsigns(false,0,$last_update_day);
1425
+			$alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day);
1426 1426
 			foreach ($alldata as $number) {
1427
-				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']);
1427
+				$this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao']);
1428 1428
 			}
1429 1429
 			if ($globalDebug) echo 'Count all owners...'."\n";
1430
-			$alldata = $Spotter->countAllOwners(false,0,$last_update_day);
1430
+			$alldata = $Spotter->countAllOwners(false, 0, $last_update_day);
1431 1431
 			foreach ($alldata as $number) {
1432
-				$this->addStatOwner($number['owner_name'],$number['owner_count']);
1432
+				$this->addStatOwner($number['owner_name'], $number['owner_count']);
1433 1433
 			}
1434 1434
 			if ($globalDebug) echo 'Count all pilots...'."\n";
1435
-			$alldata = $Spotter->countAllPilots(false,0,$last_update_day);
1435
+			$alldata = $Spotter->countAllPilots(false, 0, $last_update_day);
1436 1436
 			foreach ($alldata as $number) {
1437
-				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source']);
1437
+				$this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', '', $number['format_source']);
1438 1438
 			}
1439 1439
 			
1440 1440
 			if ($globalDebug) echo 'Count all departure airports...'."\n";
1441
-			$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day);
1441
+			$pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day);
1442 1442
 			if ($globalDebug) echo 'Count all detected departure airports...'."\n";
1443
-        		$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day);
1443
+        		$dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day);
1444 1444
 			if ($globalDebug) echo 'Order departure airports...'."\n";
1445 1445
 	        	$alldata = array();
1446 1446
 	        	
@@ -1458,14 +1458,14 @@  discard block
 block discarded – undo
1458 1458
     			foreach ($alldata as $key => $row) {
1459 1459
     				$count[$key] = $row['airport_departure_icao_count'];
1460 1460
         		}
1461
-			array_multisort($count,SORT_DESC,$alldata);
1461
+			array_multisort($count, SORT_DESC, $alldata);
1462 1462
 			foreach ($alldata as $number) {
1463
-				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count']);
1463
+				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 1464
 			}
1465 1465
 			if ($globalDebug) echo 'Count all arrival airports...'."\n";
1466
-			$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day);
1466
+			$pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day);
1467 1467
 			if ($globalDebug) echo 'Count all detected arrival airports...'."\n";
1468
-        		$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day);
1468
+        		$dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day);
1469 1469
 			if ($globalDebug) echo 'Order arrival airports...'."\n";
1470 1470
 	        	$alldata = array();
1471 1471
     			foreach ($pall as $value) {
@@ -1482,16 +1482,16 @@  discard block
 block discarded – undo
1482 1482
         		foreach ($alldata as $key => $row) {
1483 1483
         			$count[$key] = $row['airport_arrival_icao_count'];
1484 1484
 	        	}
1485
-    			array_multisort($count,SORT_DESC,$alldata);
1485
+    			array_multisort($count, SORT_DESC, $alldata);
1486 1486
                         foreach ($alldata as $number) {
1487
-				echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count']);
1487
+				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 1488
 			}
1489 1489
 			if ($Connection->tableExists('countries')) {
1490 1490
 				if ($globalDebug) echo 'Count all flights by countries...'."\n";
1491 1491
 				$SpotterArchive = new SpotterArchive();
1492
-				$alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day);
1492
+				$alldata = $SpotterArchive->countAllFlightOverCountries(false, 0, $last_update_day);
1493 1493
 				foreach ($alldata as $number) {
1494
-					$this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count']);
1494
+					$this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count']);
1495 1495
 				}
1496 1496
 			}
1497 1497
 			
@@ -1505,37 +1505,37 @@  discard block
 block discarded – undo
1505 1505
 			$lastyear = false;
1506 1506
 			foreach ($alldata as $number) {
1507 1507
 				if ($number['year_name'] != date('Y')) $lastyear = true;
1508
-				$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'])));
1508
+				$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 1509
 			}
1510 1510
 			if ($globalDebug) echo 'Count all military flights by months...'."\n";
1511 1511
 			$alldata = $Spotter->countAllMilitaryMonths();
1512 1512
 			foreach ($alldata as $number) {
1513
-				$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'])));
1513
+				$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 1514
 			}
1515 1515
 			if ($globalDebug) echo 'Count all owners by months...'."\n";
1516 1516
 			$alldata = $Spotter->countAllMonthsOwners();
1517 1517
 			foreach ($alldata as $number) {
1518
-				$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'])));
1518
+				$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 1519
 			}
1520 1520
 			if ($globalDebug) echo 'Count all pilots by months...'."\n";
1521 1521
 			$alldata = $Spotter->countAllMonthsPilots();
1522 1522
 			foreach ($alldata as $number) {
1523
-				$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'])));
1523
+				$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 1524
 			}
1525 1525
 			if ($globalDebug) echo 'Count all airlines by months...'."\n";
1526 1526
 			$alldata = $Spotter->countAllMonthsAirlines();
1527 1527
 			foreach ($alldata as $number) {
1528
-				$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'])));
1528
+				$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 1529
 			}
1530 1530
 			if ($globalDebug) echo 'Count all aircrafts by months...'."\n";
1531 1531
 			$alldata = $Spotter->countAllMonthsAircrafts();
1532 1532
 			foreach ($alldata as $number) {
1533
-				$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'])));
1533
+				$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 1534
 			}
1535 1535
 			if ($globalDebug) echo 'Count all real arrivals by months...'."\n";
1536 1536
 			$alldata = $Spotter->countAllMonthsRealArrivals();
1537 1537
 			foreach ($alldata as $number) {
1538
-				$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'])));
1538
+				$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 1539
 			}
1540 1540
 			if ($globalDebug) echo 'Airports data...'."\n";
1541 1541
 			if ($globalDebug) echo '...Departure'."\n";
@@ -1580,7 +1580,7 @@  discard block
 block discarded – undo
1580 1580
     			}
1581 1581
     			$alldata = $pall;
1582 1582
 			foreach ($alldata as $number) {
1583
-				$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']);
1583
+				$this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count']);
1584 1584
 			}
1585 1585
 			echo '...Arrival'."\n";
1586 1586
 			$pall = $Spotter->getLast7DaysAirportsArrival();
@@ -1622,7 +1622,7 @@  discard block
 block discarded – undo
1622 1622
     			}
1623 1623
     			$alldata = $pall;
1624 1624
 			foreach ($alldata as $number) {
1625
-				$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']);
1625
+				$this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count']);
1626 1626
 			}
1627 1627
 
1628 1628
 			echo 'Flights data...'."\n";
@@ -1630,28 +1630,28 @@  discard block
 block discarded – undo
1630 1630
 			echo '-> countAllDatesLastMonth...'."\n";
1631 1631
 			$alldata = $Spotter->countAllDatesLastMonth();
1632 1632
 			foreach ($alldata as $number) {
1633
-				$this->addStatFlight('month',$number['date_name'],$number['date_count']);
1633
+				$this->addStatFlight('month', $number['date_name'], $number['date_count']);
1634 1634
 			}
1635 1635
 			echo '-> countAllDates...'."\n";
1636 1636
 			$previousdata = $this->countAllDates();
1637 1637
 			$previousdatabyairlines = $this->countAllDatesByAirlines();
1638 1638
 			$this->deleteStatFlight('date');
1639
-			$alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates());
1639
+			$alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates());
1640 1640
 			$values = array();
1641 1641
 			foreach ($alldata as $cnt) {
1642 1642
 				$values[] = $cnt['date_count'];
1643 1643
 			}
1644
-			array_multisort($values,SORT_DESC,$alldata);
1645
-			array_splice($alldata,11);
1644
+			array_multisort($values, SORT_DESC, $alldata);
1645
+			array_splice($alldata, 11);
1646 1646
 			foreach ($alldata as $number) {
1647
-				$this->addStatFlight('date',$number['date_name'],$number['date_count']);
1647
+				$this->addStatFlight('date', $number['date_name'], $number['date_count']);
1648 1648
 			}
1649 1649
 			
1650 1650
 			$this->deleteStatFlight('hour');
1651 1651
 			echo '-> countAllHours...'."\n";
1652 1652
 			$alldata = $Spotter->countAllHours('hour');
1653 1653
 			foreach ($alldata as $number) {
1654
-				$this->addStatFlight('hour',$number['hour_name'],$number['hour_count']);
1654
+				$this->addStatFlight('hour', $number['hour_name'], $number['hour_count']);
1655 1655
 			}
1656 1656
 
1657 1657
 
@@ -1660,34 +1660,34 @@  discard block
 block discarded – undo
1660 1660
 			echo '--- Stats by airlines ---'."\n";
1661 1661
 			if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n";
1662 1662
 			$Spotter = new Spotter($this->db);
1663
-			$alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day);
1663
+			$alldata = $Spotter->countAllAircraftTypesByAirlines(false, 0, $last_update_day);
1664 1664
 			foreach ($alldata as $number) {
1665
-				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao']);
1665
+				$this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], $number['airline_icao']);
1666 1666
 			}
1667 1667
 			if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n";
1668
-			$alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day);
1668
+			$alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false, 0, $last_update_day);
1669 1669
 			foreach ($alldata as $number) {
1670
-				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao']);
1670
+				$this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], $number['airline_icao']);
1671 1671
 			}
1672 1672
 			if ($globalDebug) echo 'Count all callsigns by airlines...'."\n";
1673
-			$alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day);
1673
+			$alldata = $Spotter->countAllCallsignsByAirlines(false, 0, $last_update_day);
1674 1674
 			foreach ($alldata as $number) {
1675
-				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']);
1675
+				$this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao']);
1676 1676
 			}
1677 1677
 			if ($globalDebug) echo 'Count all owners by airlines...'."\n";
1678
-			$alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day);
1678
+			$alldata = $Spotter->countAllOwnersByAirlines(false, 0, $last_update_day);
1679 1679
 			foreach ($alldata as $number) {
1680
-				$this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao']);
1680
+				$this->addStatOwner($number['owner_name'], $number['owner_count'], $number['airline_icao']);
1681 1681
 			}
1682 1682
 			if ($globalDebug) echo 'Count all pilots by airlines...'."\n";
1683
-			$alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day);
1683
+			$alldata = $Spotter->countAllPilotsByAirlines(false, 0, $last_update_day);
1684 1684
 			foreach ($alldata as $number) {
1685
-				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source']);
1685
+				$this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], $number['airline_icao'], '', $number['format_source']);
1686 1686
 			}
1687 1687
 			if ($globalDebug) echo 'Count all departure airports by airlines...'."\n";
1688
-			$pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day);
1688
+			$pall = $Spotter->countAllDepartureAirportsByAirlines(false, 0, $last_update_day);
1689 1689
 			if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n";
1690
-       			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day);
1690
+       			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false, 0, $last_update_day);
1691 1691
 			if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n";
1692 1692
 	        	//$alldata = array();
1693 1693
     			foreach ($dall as $value) {
@@ -1707,12 +1707,12 @@  discard block
 block discarded – undo
1707 1707
     			}
1708 1708
     			$alldata = $pall;
1709 1709
 			foreach ($alldata as $number) {
1710
-				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']);
1710
+				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 1711
 			}
1712 1712
 			if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n";
1713
-			$pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day);
1713
+			$pall = $Spotter->countAllArrivalAirportsByAirlines(false, 0, $last_update_day);
1714 1714
 			if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n";
1715
-        		$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day);
1715
+        		$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false, 0, $last_update_day);
1716 1716
 			if ($globalDebug) echo 'Order arrival airports by airlines...'."\n";
1717 1717
 	        	//$alldata = array();
1718 1718
     			foreach ($dall as $value) {
@@ -1732,7 +1732,7 @@  discard block
 block discarded – undo
1732 1732
     			}
1733 1733
     			$alldata = $pall;
1734 1734
                         foreach ($alldata as $number) {
1735
-				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']);
1735
+				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']);
1736 1736
 			}
1737 1737
 			if ($globalDebug) echo 'Count all flights by months by airlines...'."\n";
1738 1738
 			$Spotter = new Spotter($this->db);
@@ -1740,27 +1740,27 @@  discard block
 block discarded – undo
1740 1740
 			$lastyear = false;
1741 1741
 			foreach ($alldata as $number) {
1742 1742
 				if ($number['year_name'] != date('Y')) $lastyear = true;
1743
-				$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']);
1743
+				$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 1744
 			}
1745 1745
 			if ($globalDebug) echo 'Count all owners by months by airlines...'."\n";
1746 1746
 			$alldata = $Spotter->countAllMonthsOwnersByAirlines();
1747 1747
 			foreach ($alldata as $number) {
1748
-				$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']);
1748
+				$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 1749
 			}
1750 1750
 			if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n";
1751 1751
 			$alldata = $Spotter->countAllMonthsPilotsByAirlines();
1752 1752
 			foreach ($alldata as $number) {
1753
-				$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']);
1753
+				$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 1754
 			}
1755 1755
 			if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n";
1756 1756
 			$alldata = $Spotter->countAllMonthsAircraftsByAirlines();
1757 1757
 			foreach ($alldata as $number) {
1758
-				$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']);
1758
+				$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 1759
 			}
1760 1760
 			if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n";
1761 1761
 			$alldata = $Spotter->countAllMonthsRealArrivalsByAirlines();
1762 1762
 			foreach ($alldata as $number) {
1763
-				$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']);
1763
+				$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 1764
 			}
1765 1765
 			if ($globalDebug) echo '...Departure'."\n";
1766 1766
 			$pall = $Spotter->getLast7DaysAirportsDepartureByAirlines();
@@ -1783,7 +1783,7 @@  discard block
 block discarded – undo
1783 1783
     			}
1784 1784
     			$alldata = $pall;
1785 1785
 			foreach ($alldata as $number) {
1786
-				$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']);
1786
+				$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 1787
 			}
1788 1788
 			if ($globalDebug) echo '...Arrival'."\n";
1789 1789
 			$pall = $Spotter->getLast7DaysAirportsArrivalByAirlines();
@@ -1806,32 +1806,32 @@  discard block
 block discarded – undo
1806 1806
     			}
1807 1807
     			$alldata = $pall;
1808 1808
 			foreach ($alldata as $number) {
1809
-				$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']);
1809
+				$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 1810
 			}
1811 1811
 
1812 1812
 			if ($globalDebug) echo 'Flights data...'."\n";
1813 1813
 			if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n";
1814 1814
 			$alldata = $Spotter->countAllDatesLastMonthByAirlines();
1815 1815
 			foreach ($alldata as $number) {
1816
-				$this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']);
1816
+				$this->addStatFlight('month', $number['date_name'], $number['date_count'], $number['airline_icao']);
1817 1817
 			}
1818 1818
 			if ($globalDebug) echo '-> countAllDates...'."\n";
1819 1819
 			//$previousdata = $this->countAllDatesByAirlines();
1820
-			$alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines());
1820
+			$alldata = $Common->array_merge_noappend($previousdatabyairlines, $Spotter->countAllDatesByAirlines());
1821 1821
 			$values = array();
1822 1822
 			foreach ($alldata as $cnt) {
1823 1823
 				$values[] = $cnt['date_count'];
1824 1824
 			}
1825
-			array_multisort($values,SORT_DESC,$alldata);
1826
-			array_splice($alldata,11);
1825
+			array_multisort($values, SORT_DESC, $alldata);
1826
+			array_splice($alldata, 11);
1827 1827
 			foreach ($alldata as $number) {
1828
-				$this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']);
1828
+				$this->addStatFlight('date', $number['date_name'], $number['date_count'], $number['airline_icao']);
1829 1829
 			}
1830 1830
 			
1831 1831
 			if ($globalDebug) echo '-> countAllHours...'."\n";
1832 1832
 			$alldata = $Spotter->countAllHoursByAirlines('hour');
1833 1833
 			foreach ($alldata as $number) {
1834
-				$this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']);
1834
+				$this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], $number['airline_icao']);
1835 1835
 			}
1836 1836
 			
1837 1837
 
@@ -1848,32 +1848,32 @@  discard block
 block discarded – undo
1848 1848
 				// Count by filter
1849 1849
 				if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n";
1850 1850
 				$Spotter = new Spotter($this->db);
1851
-				$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter);
1851
+				$alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day, $filter);
1852 1852
 				foreach ($alldata as $number) {
1853
-					$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'',$filter_name);
1853
+					$this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', $filter_name);
1854 1854
 				}
1855
-				$alldata = $Spotter->countAllAirlines(false,0,$last_update_day,$filter);
1855
+				$alldata = $Spotter->countAllAirlines(false, 0, $last_update_day, $filter);
1856 1856
 				foreach ($alldata as $number) {
1857
-					$this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],$filter_name);
1857
+					$this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], $filter_name);
1858 1858
 				}
1859
-				$alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day,$filter);
1859
+				$alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day, $filter);
1860 1860
 				foreach ($alldata as $number) {
1861
-					$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'',$filter_name);
1861
+					$this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', $filter_name);
1862 1862
 				}
1863
-				$alldata = $Spotter->countAllCallsigns(false,0,$last_update_day,$filter);
1863
+				$alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day, $filter);
1864 1864
 				foreach ($alldata as $number) {
1865
-					$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],'',$filter_name);
1865
+					$this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], '', $filter_name);
1866 1866
 				}
1867
-				$alldata = $Spotter->countAllOwners(false,0,$last_update_day,$filter);
1867
+				$alldata = $Spotter->countAllOwners(false, 0, $last_update_day, $filter);
1868 1868
 				foreach ($alldata as $number) {
1869
-					$this->addStatOwner($number['owner_name'],$number['owner_count'],'',$filter_name);
1869
+					$this->addStatOwner($number['owner_name'], $number['owner_count'], '', $filter_name);
1870 1870
 				}
1871
-				$alldata = $Spotter->countAllPilots(false,0,$last_update_day,$filter);
1871
+				$alldata = $Spotter->countAllPilots(false, 0, $last_update_day, $filter);
1872 1872
 				foreach ($alldata as $number) {
1873
-					$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name,$number['format_source']);
1873
+					$this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', $filter_name, $number['format_source']);
1874 1874
 				}
1875
-				$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter);
1876
-	       			$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter);
1875
+				$pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day, $filter);
1876
+	       			$dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day, $filter);
1877 1877
 		        	$alldata = array();
1878 1878
 	    			foreach ($pall as $value) {
1879 1879
 		        		$icao = $value['airport_departure_icao'];
@@ -1889,12 +1889,12 @@  discard block
 block discarded – undo
1889 1889
     				foreach ($alldata as $key => $row) {
1890 1890
     					$count[$key] = $row['airport_departure_icao_count'];
1891 1891
     				}
1892
-				array_multisort($count,SORT_DESC,$alldata);
1892
+				array_multisort($count, SORT_DESC, $alldata);
1893 1893
 				foreach ($alldata as $number) {
1894
-    					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);
1894
+    					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);
1895 1895
 				}
1896
-				$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,$filter);
1897
-    				$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,$filter);
1896
+				$pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day, $filter);
1897
+    				$dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day, $filter);
1898 1898
 				$alldata = array();
1899 1899
     				foreach ($pall as $value) {
1900 1900
 		        		$icao = $value['airport_arrival_icao'];
@@ -1910,40 +1910,40 @@  discard block
 block discarded – undo
1910 1910
         			foreach ($alldata as $key => $row) {
1911 1911
     					$count[$key] = $row['airport_arrival_icao_count'];
1912 1912
 		        	}
1913
-        			array_multisort($count,SORT_DESC,$alldata);
1913
+        			array_multisort($count, SORT_DESC, $alldata);
1914 1914
 				foreach ($alldata as $number) {
1915
-					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);
1915
+					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);
1916 1916
 				}
1917 1917
 				$Spotter = new Spotter($this->db);
1918 1918
 				$alldata = $Spotter->countAllMonths($filter);
1919 1919
 				$lastyear = false;
1920 1920
 				foreach ($alldata as $number) {
1921 1921
 					if ($number['year_name'] != date('Y')) $lastyear = true;
1922
-					$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);
1922
+					$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 1923
 				}
1924 1924
 				$alldata = $Spotter->countAllMonthsOwners($filter);
1925 1925
 				foreach ($alldata as $number) {
1926
-					$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);
1926
+					$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);
1927 1927
 				}
1928 1928
 				$alldata = $Spotter->countAllMonthsPilots($filter);
1929 1929
 				foreach ($alldata as $number) {
1930
-					$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);
1930
+					$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);
1931 1931
 				}
1932 1932
 				$alldata = $Spotter->countAllMilitaryMonths($filter);
1933 1933
 				foreach ($alldata as $number) {
1934
-					$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);
1934
+					$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);
1935 1935
 				}
1936 1936
 				$alldata = $Spotter->countAllMonthsAircrafts($filter);
1937 1937
 				foreach ($alldata as $number) {
1938
-					$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);
1938
+					$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);
1939 1939
 				}
1940 1940
 				$alldata = $Spotter->countAllMonthsRealArrivals($filter);
1941 1941
 				foreach ($alldata as $number) {
1942
-					$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);
1942
+					$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);
1943 1943
 				}
1944 1944
 				echo '...Departure'."\n";
1945
-				$pall = $Spotter->getLast7DaysAirportsDeparture('',$filter);
1946
-        			$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter);
1945
+				$pall = $Spotter->getLast7DaysAirportsDeparture('', $filter);
1946
+        			$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('', $filter);
1947 1947
 				foreach ($dall as $value) {
1948 1948
     					$icao = $value['departure_airport_icao'];
1949 1949
     					$ddate = $value['date'];
@@ -1961,11 +1961,11 @@  discard block
 block discarded – undo
1961 1961
     				}
1962 1962
 	    			$alldata = $pall;
1963 1963
 				foreach ($alldata as $number) {
1964
-					$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);
1964
+					$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);
1965 1965
 				}
1966 1966
 				echo '...Arrival'."\n";
1967
-				$pall = $Spotter->getLast7DaysAirportsArrival('',$filter);
1968
-    				$dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter);
1967
+				$pall = $Spotter->getLast7DaysAirportsArrival('', $filter);
1968
+    				$dall = $Spotter->getLast7DaysDetectedAirportsArrival('', $filter);
1969 1969
 				foreach ($dall as $value) {
1970 1970
 					$icao = $value['arrival_airport_icao'];
1971 1971
 					$ddate = $value['date'];
@@ -1983,40 +1983,40 @@  discard block
 block discarded – undo
1983 1983
     				}
1984 1984
     				$alldata = $pall;
1985 1985
 				foreach ($alldata as $number) {
1986
-					$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);
1986
+					$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);
1987 1987
 				}
1988 1988
     
1989 1989
 				echo 'Flights data...'."\n";
1990 1990
 				echo '-> countAllDatesLastMonth...'."\n";
1991 1991
 				$alldata = $Spotter->countAllDatesLastMonth($filter);
1992 1992
 				foreach ($alldata as $number) {
1993
-					$this->addStatFlight('month',$number['date_name'],$number['date_count'], '',$filter_name);
1993
+					$this->addStatFlight('month', $number['date_name'], $number['date_count'], '', $filter_name);
1994 1994
 				}
1995 1995
 				echo '-> countAllDates...'."\n";
1996
-				$previousdata = $this->countAllDates('',$filter_name);
1997
-				$alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter));
1996
+				$previousdata = $this->countAllDates('', $filter_name);
1997
+				$alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter));
1998 1998
 				$values = array();
1999 1999
 				foreach ($alldata as $cnt) {
2000 2000
 					$values[] = $cnt['date_count'];
2001 2001
 				}
2002
-				array_multisort($values,SORT_DESC,$alldata);
2003
-				array_splice($alldata,11);
2002
+				array_multisort($values, SORT_DESC, $alldata);
2003
+				array_splice($alldata, 11);
2004 2004
 				foreach ($alldata as $number) {
2005
-					$this->addStatFlight('date',$number['date_name'],$number['date_count'],'',$filter_name);
2005
+					$this->addStatFlight('date', $number['date_name'], $number['date_count'], '', $filter_name);
2006 2006
 				}
2007 2007
 				
2008 2008
 				echo '-> countAllHours...'."\n";
2009
-				$alldata = $Spotter->countAllHours('hour',$filter);
2009
+				$alldata = $Spotter->countAllHours('hour', $filter);
2010 2010
 				foreach ($alldata as $number) {
2011
-					$this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],'',$filter_name);
2011
+					$this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], '', $filter_name);
2012 2012
 				}
2013 2013
 				echo 'Insert last stats update date...'."\n";
2014 2014
 				date_default_timezone_set('UTC');
2015
-				$this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y-m-d G:i:s'));
2015
+				$this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y-m-d G:i:s'));
2016 2016
 				if (isset($filter['DeleteLastYearStats']) && $filter['DeleteLastYearStats'] == true) {
2017
-					if (date('Y',strtotime($last_update_day)) != date('Y')) {
2017
+					if (date('Y', strtotime($last_update_day)) != date('Y')) {
2018 2018
 						$this->deleteOldStats($filter_name);
2019
-						$this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y').'-01-01 00:00:00');
2019
+						$this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y').'-01-01 00:00:00');
2020 2020
 					}
2021 2021
 				}
2022 2022
 
@@ -2029,16 +2029,16 @@  discard block
 block discarded – undo
2029 2029
 				// SUM all previous month to put as year
2030 2030
 				$previous_year = date('Y');
2031 2031
 				$previous_year--;
2032
-				$this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
2033
-				$this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
2034
-				$this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
2035
-				$this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
2032
+				$this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
2033
+				$this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
2034
+				$this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
2035
+				$this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
2036 2036
 				$allairlines = $this->getAllAirlineNames();
2037 2037
 				foreach ($allairlines as $data) {
2038
-					$this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
2039
-					$this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
2040
-					$this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
2041
-					$this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
2038
+					$this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
2039
+					$this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
2040
+					$this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
2041
+					$this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
2042 2042
 				}
2043 2043
 				
2044 2044
 				if (isset($globalArchiveYear) && $globalArchiveYear) {
@@ -2047,7 +2047,7 @@  discard block
 block discarded – undo
2047 2047
 						try {
2048 2048
 							$sth = $this->db->prepare($query);
2049 2049
 							$sth->execute();
2050
-						} catch(PDOException $e) {
2050
+						} catch (PDOException $e) {
2051 2051
 							return "error : ".$e->getMessage().' - query : '.$query."\n";
2052 2052
 						}
2053 2053
 					}
@@ -2056,15 +2056,15 @@  discard block
 block discarded – undo
2056 2056
 					try {
2057 2057
 						$sth = $this->db->prepare($query);
2058 2058
 						$sth->execute();
2059
-					} catch(PDOException $e) {
2059
+					} catch (PDOException $e) {
2060 2060
 						return "error : ".$e->getMessage().' - query : '.$query."\n";
2061 2061
 					}
2062 2062
 				}
2063 2063
 				if (isset($globalDeleteLastYearStats) && $globalDeleteLastYearStats) {
2064 2064
 					$last_update = $this->getLastStatsUpdate('last_update_stats');
2065
-					if (date('Y',strtotime($last_update[0]['value'])) != date('Y')) {
2065
+					if (date('Y', strtotime($last_update[0]['value'])) != date('Y')) {
2066 2066
 						$this->deleteOldStats();
2067
-						$this->addLastStatsUpdate('last_update_stats',date('Y').'-01-01 00:00:00');
2067
+						$this->addLastStatsUpdate('last_update_stats', date('Y').'-01-01 00:00:00');
2068 2068
 						$lastyearupdate = true;
2069 2069
 					}
2070 2070
 				}
@@ -2086,7 +2086,7 @@  discard block
 block discarded – undo
2086 2086
 					try {
2087 2087
 						$sth = $this->db->prepare($query);
2088 2088
 						$sth->execute();
2089
-					} catch(PDOException $e) {
2089
+					} catch (PDOException $e) {
2090 2090
 						return "error : ".$e->getMessage();
2091 2091
 					}
2092 2092
 				}
@@ -2100,14 +2100,14 @@  discard block
 block discarded – undo
2100 2100
 				try {
2101 2101
 					$sth = $this->db->prepare($query);
2102 2102
 					$sth->execute();
2103
-				} catch(PDOException $e) {
2103
+				} catch (PDOException $e) {
2104 2104
 					return "error : ".$e->getMessage();
2105 2105
 				}
2106 2106
 			}
2107 2107
 			if (!isset($lastyearupdate)) {
2108 2108
 				echo 'Insert last stats update date...'."\n";
2109 2109
 				date_default_timezone_set('UTC');
2110
-				$this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s'));
2110
+				$this->addLastStatsUpdate('last_update_stats', date('Y-m-d G:i:s'));
2111 2111
 			}
2112 2112
 		//}
2113 2113
 	}
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.
Braces   +679 added lines, -235 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
 
@@ -1784,7 +1886,9 @@  discard block
 block discarded – undo
1784 1886
 		{
1785 1887
 			$highlight = $row['highlight'];
1786 1888
 		}
1787
-		if (isset($highlight)) return $highlight;
1889
+		if (isset($highlight)) {
1890
+			return $highlight;
1891
+		}
1788 1892
 	}
1789 1893
 
1790 1894
 	
@@ -1812,7 +1916,9 @@  discard block
 block discarded – undo
1812 1916
 		$sth->closeCursor();
1813 1917
 		if (count($row) > 0) {
1814 1918
 			return $row['usage'];
1815
-		} else return '';
1919
+		} else {
1920
+			return '';
1921
+		}
1816 1922
 	}
1817 1923
 
1818 1924
 	/**
@@ -1837,7 +1943,9 @@  discard block
 block discarded – undo
1837 1943
 		$sth->closeCursor();
1838 1944
 		if (count($row) > 0) {
1839 1945
 			return $row['icao'];
1840
-		} else return '';
1946
+		} else {
1947
+			return '';
1948
+		}
1841 1949
 	}
1842 1950
 
1843 1951
 	/**
@@ -1865,7 +1973,9 @@  discard block
 block discarded – undo
1865 1973
 			$airport_longitude = $row['longitude'];
1866 1974
 			$Common = new Common();
1867 1975
 			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
1868
-		} else return '';
1976
+		} else {
1977
+			return '';
1978
+		}
1869 1979
 	}
1870 1980
 	
1871 1981
 	/**
@@ -1977,7 +2087,9 @@  discard block
 block discarded – undo
1977 2087
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1978 2088
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1979 2089
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1980
-		} else return array();
2090
+		} else {
2091
+			return array();
2092
+		}
1981 2093
 		if ($globalDBdriver == 'mysql') {
1982 2094
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
1983 2095
 		} else {
@@ -2012,7 +2124,9 @@  discard block
 block discarded – undo
2012 2124
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2013 2125
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2014 2126
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2015
-		} else return array();
2127
+		} else {
2128
+			return array();
2129
+		}
2016 2130
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2017 2131
 		$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.")";
2018 2132
 		//$query  = "SELECT waypoints.* FROM waypoints";
@@ -2047,7 +2161,9 @@  discard block
 block discarded – undo
2047 2161
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2048 2162
 	{
2049 2163
 		global $globalUseRealAirlines;
2050
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2164
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2165
+			$fromsource = NULL;
2166
+		}
2051 2167
 		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2052 2168
 		if ($airline_icao == 'NA') {
2053 2169
 			$airline_array = array();
@@ -2097,7 +2213,9 @@  discard block
 block discarded – undo
2097 2213
 				$sth->execute(array(':fromsource' => $fromsource));
2098 2214
 				$row = $sth->fetch(PDO::FETCH_ASSOC);
2099 2215
 				$sth->closeCursor();
2100
-				if ($row['nb'] == 0) $result = $this->getAllAirlineInfo($airline_icao);
2216
+				if ($row['nb'] == 0) {
2217
+					$result = $this->getAllAirlineInfo($airline_icao);
2218
+				}
2101 2219
 			}
2102 2220
 			return $result;
2103 2221
 		}
@@ -2161,15 +2279,20 @@  discard block
 block discarded – undo
2161 2279
 				'A320-211' => 'A320',
2162 2280
 				'747-8i' => 'B748',
2163 2281
 				'A380' => 'A388');
2164
-		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2282
+		if (isset($all_aircraft[$aircraft_type])) {
2283
+			return $all_aircraft[$aircraft_type];
2284
+		}
2165 2285
 
2166 2286
 		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2167 2287
 		$aircraft_type = strtoupper($aircraft_type);
2168 2288
 		$sth = $this->db->prepare($query);
2169 2289
 		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2170 2290
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2171
-		if (isset($result[0]['icao'])) return $result[0]['icao'];
2172
-		else return '';
2291
+		if (isset($result[0]['icao'])) {
2292
+			return $result[0]['icao'];
2293
+		} else {
2294
+			return '';
2295
+		}
2173 2296
 	}
2174 2297
 	
2175 2298
 	/**
@@ -2192,7 +2315,9 @@  discard block
 block discarded – undo
2192 2315
 		$sth->closeCursor();
2193 2316
 		if (isset($row['icaotypecode'])) {
2194 2317
 			return $row['icaotypecode'];
2195
-		} else return '';
2318
+		} else {
2319
+			return '';
2320
+		}
2196 2321
 	}
2197 2322
 
2198 2323
 	/**
@@ -2215,7 +2340,9 @@  discard block
 block discarded – undo
2215 2340
 		$sth->closeCursor();
2216 2341
 		if (isset($row['icaotypecode'])) {
2217 2342
 			return $row['icaotypecode'];
2218
-		} else return '';
2343
+		} else {
2344
+			return '';
2345
+		}
2219 2346
 	}
2220 2347
 
2221 2348
 	/**
@@ -2237,7 +2364,9 @@  discard block
 block discarded – undo
2237 2364
 		$sth->closeCursor();
2238 2365
 		if (isset($row['operator_correct'])) {
2239 2366
 			return $row['operator_correct'];
2240
-		} else return $operator;
2367
+		} else {
2368
+			return $operator;
2369
+		}
2241 2370
 	}
2242 2371
 
2243 2372
 	/**
@@ -2250,7 +2379,9 @@  discard block
 block discarded – undo
2250 2379
 	public function getRouteInfo($callsign)
2251 2380
 	{
2252 2381
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2253
-                if ($callsign == '') return array();
2382
+                if ($callsign == '') {
2383
+                	return array();
2384
+                }
2254 2385
 		$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";
2255 2386
 		
2256 2387
 		$sth = $this->db->prepare($query);
@@ -2260,7 +2391,9 @@  discard block
 block discarded – undo
2260 2391
 		$sth->closeCursor();
2261 2392
 		if (count($row) > 0) {
2262 2393
 			return $row;
2263
-		} else return array();
2394
+		} else {
2395
+			return array();
2396
+		}
2264 2397
 	}
2265 2398
 	
2266 2399
 	/**
@@ -2313,7 +2446,9 @@  discard block
 block discarded – undo
2313 2446
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
2314 2447
 			$sth->closeCursor();
2315 2448
 			return $result;
2316
-		} else return array();
2449
+		} else {
2450
+			return array();
2451
+		}
2317 2452
 	}
2318 2453
 	
2319 2454
   
@@ -2470,8 +2605,11 @@  discard block
 block discarded – undo
2470 2605
 		$query .= " ORDER BY spotter_output.source_name ASC";
2471 2606
 
2472 2607
 		$sth = $this->db->prepare($query);
2473
-		if (!empty($query_values)) $sth->execute($query_values);
2474
-		else $sth->execute();
2608
+		if (!empty($query_values)) {
2609
+			$sth->execute($query_values);
2610
+		} else {
2611
+			$sth->execute();
2612
+		}
2475 2613
 
2476 2614
 		$source_array = array();
2477 2615
 		$temp_array = array();
@@ -2504,9 +2642,13 @@  discard block
 block discarded – undo
2504 2642
 								WHERE spotter_output.airline_icao <> '' 
2505 2643
 								ORDER BY spotter_output.airline_name ASC";
2506 2644
 			*/
2507
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2508
-			elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2509
-			elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2645
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2646
+				$forsource = $globalAirlinesSource;
2647
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
2648
+				$forsource = 'vatsim';
2649
+			} elseif (isset($globalIVAO) && $globalIVAO) {
2650
+				$forsource = 'ivao';
2651
+			}
2510 2652
 			if ($forsource === NULL) {
2511 2653
 				$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";
2512 2654
 				$query_data = array();
@@ -2798,7 +2940,9 @@  discard block
 block discarded – undo
2798 2940
 			date_default_timezone_set($globalTimezone);
2799 2941
 			$datetime = new DateTime();
2800 2942
 			$offset = $datetime->format('P');
2801
-		} else $offset = '+00:00';
2943
+		} else {
2944
+			$offset = '+00:00';
2945
+		}
2802 2946
 		if ($airport_icao == '') {
2803 2947
 			if ($globalDBdriver == 'mysql') {
2804 2948
 				$query = "SELECT COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' GROUP BY departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -2830,7 +2974,9 @@  discard block
 block discarded – undo
2830 2974
 			date_default_timezone_set($globalTimezone);
2831 2975
 			$datetime = new DateTime();
2832 2976
 			$offset = $datetime->format('P');
2833
-		} else $offset = '+00:00';
2977
+		} else {
2978
+			$offset = '+00:00';
2979
+		}
2834 2980
 		if ($airport_icao == '') {
2835 2981
 			if ($globalDBdriver == 'mysql') {
2836 2982
 				$query = "SELECT spotter_output.airline_icao, COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -2863,7 +3009,9 @@  discard block
 block discarded – undo
2863 3009
 			date_default_timezone_set($globalTimezone);
2864 3010
 			$datetime = new DateTime();
2865 3011
 			$offset = $datetime->format('P');
2866
-		} else $offset = '+00:00';
3012
+		} else {
3013
+			$offset = '+00:00';
3014
+		}
2867 3015
 		if ($airport_icao == '') {
2868 3016
 			if ($globalDBdriver == 'mysql') {
2869 3017
 				$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 
@@ -2902,7 +3050,9 @@  discard block
 block discarded – undo
2902 3050
 			date_default_timezone_set($globalTimezone);
2903 3051
 			$datetime = new DateTime();
2904 3052
 			$offset = $datetime->format('P');
2905
-		} else $offset = '+00:00';
3053
+		} else {
3054
+			$offset = '+00:00';
3055
+		}
2906 3056
 		if ($airport_icao == '') {
2907 3057
 			if ($globalDBdriver == 'mysql') {
2908 3058
 				$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 
@@ -2947,7 +3097,9 @@  discard block
 block discarded – undo
2947 3097
 			date_default_timezone_set($globalTimezone);
2948 3098
 			$datetime = new DateTime();
2949 3099
 			$offset = $datetime->format('P');
2950
-		} else $offset = '+00:00';
3100
+		} else {
3101
+			$offset = '+00:00';
3102
+		}
2951 3103
 		if ($airport_icao == '') {
2952 3104
 			if ($globalDBdriver == 'mysql') {
2953 3105
 				$query = "SELECT COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' GROUP BY arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -2982,7 +3134,9 @@  discard block
 block discarded – undo
2982 3134
 			date_default_timezone_set($globalTimezone);
2983 3135
 			$datetime = new DateTime();
2984 3136
 			$offset = $datetime->format('P');
2985
-		} else $offset = '+00:00';
3137
+		} else {
3138
+			$offset = '+00:00';
3139
+		}
2986 3140
 		if ($airport_icao == '') {
2987 3141
 			if ($globalDBdriver == 'mysql') {
2988 3142
 				$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 
@@ -3024,7 +3178,9 @@  discard block
 block discarded – undo
3024 3178
 			date_default_timezone_set($globalTimezone);
3025 3179
 			$datetime = new DateTime();
3026 3180
 			$offset = $datetime->format('P');
3027
-		} else $offset = '+00:00';
3181
+		} else {
3182
+			$offset = '+00:00';
3183
+		}
3028 3184
 		if ($airport_icao == '') {
3029 3185
 			if ($globalDBdriver == 'mysql') {
3030 3186
 				$query = "SELECT spotter_output.airline_icao, COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -3058,7 +3214,9 @@  discard block
 block discarded – undo
3058 3214
 			date_default_timezone_set($globalTimezone);
3059 3215
 			$datetime = new DateTime();
3060 3216
 			$offset = $datetime->format('P');
3061
-		} else $offset = '+00:00';
3217
+		} else {
3218
+			$offset = '+00:00';
3219
+		}
3062 3220
 		if ($airport_icao == '') {
3063 3221
 			if ($globalDBdriver == 'mysql') {
3064 3222
 				$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 
@@ -3106,7 +3264,9 @@  discard block
 block discarded – undo
3106 3264
 			date_default_timezone_set($globalTimezone);
3107 3265
 			$datetime = new DateTime();
3108 3266
 			$offset = $datetime->format('P');
3109
-		} else $offset = '+00:00';
3267
+		} else {
3268
+			$offset = '+00:00';
3269
+		}
3110 3270
 
3111 3271
 		if ($globalDBdriver == 'mysql') {
3112 3272
 			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
@@ -3226,7 +3386,9 @@  discard block
 block discarded – undo
3226 3386
 	*/	
3227 3387
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3228 3388
 	{
3229
-		if ($groundspeed == '') $groundspeed = NULL;
3389
+		if ($groundspeed == '') {
3390
+			$groundspeed = NULL;
3391
+		}
3230 3392
 		$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';
3231 3393
                 $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);
3232 3394
 
@@ -3276,10 +3438,18 @@  discard block
 block discarded – undo
3276 3438
 		$Image = new Image($this->db);
3277 3439
 		$Common = new Common();
3278 3440
 		
3279
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
3280
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
3281
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
3282
-		if (!isset($globalVAM)) $globalVAM = FALSE;
3441
+		if (!isset($globalIVAO)) {
3442
+			$globalIVAO = FALSE;
3443
+		}
3444
+		if (!isset($globalVATSIM)) {
3445
+			$globalVATSIM = FALSE;
3446
+		}
3447
+		if (!isset($globalphpVMS)) {
3448
+			$globalphpVMS = FALSE;
3449
+		}
3450
+		if (!isset($globalVAM)) {
3451
+			$globalVAM = FALSE;
3452
+		}
3283 3453
 		date_default_timezone_set('UTC');
3284 3454
 		
3285 3455
 		//getting the registration
@@ -3292,23 +3462,33 @@  discard block
 block discarded – undo
3292 3462
 				if ($ModeS != '') {
3293 3463
 					$timeelapsed = microtime(true);
3294 3464
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3295
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3465
+					if ($globalDebugTimeElapsed) {
3466
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3467
+					}
3296 3468
 				} else {
3297 3469
 					$myhex = explode('-',$flightaware_id);
3298 3470
 					if (count($myhex) > 0) {
3299 3471
 						$timeelapsed = microtime(true);
3300 3472
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3301
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3473
+						if ($globalDebugTimeElapsed) {
3474
+							echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3475
+						}
3302 3476
 					}
3303 3477
 				}
3304 3478
 			}
3305 3479
 		}
3306 3480
 		$fromsource = NULL;
3307
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
3308
-		elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim';
3309
-		elseif ($format_source == 'whazzup') $fromsource = 'ivao';
3310
-		elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
3311
-		elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
3481
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
3482
+			$fromsource = $globalAirlinesSource;
3483
+		} elseif ($format_source == 'vatsimtxt') {
3484
+			$fromsource = 'vatsim';
3485
+		} elseif ($format_source == 'whazzup') {
3486
+			$fromsource = 'ivao';
3487
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
3488
+			$fromsource = 'vatsim';
3489
+		} elseif (isset($globalIVAO) && $globalIVAO) {
3490
+			$fromsource = 'ivao';
3491
+		}
3312 3492
 		//getting the airline information
3313 3493
 		if ($ident != "")
3314 3494
 		{
@@ -3332,15 +3512,21 @@  discard block
 block discarded – undo
3332 3512
 					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3333 3513
 						$airline_array = $this->getAllAirlineInfo("NA");
3334 3514
 					}
3335
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3515
+					if ($globalDebugTimeElapsed) {
3516
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3517
+					}
3336 3518
 
3337 3519
 				} else {
3338 3520
 					$timeelapsed = microtime(true);
3339 3521
 					$airline_array = $this->getAllAirlineInfo("NA");
3340
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3522
+					if ($globalDebugTimeElapsed) {
3523
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3524
+					}
3341 3525
 				}
3342 3526
 			}
3343
-		} else $airline_array = array();
3527
+		} else {
3528
+			$airline_array = array();
3529
+		}
3344 3530
 		
3345 3531
 		//getting the aircraft information
3346 3532
 		$aircraft_array = array();
@@ -3354,27 +3540,37 @@  discard block
 block discarded – undo
3354 3540
 				{
3355 3541
 					$timeelapsed = microtime(true);
3356 3542
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3357
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3543
+					if ($globalDebugTimeElapsed) {
3544
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3545
+					}
3358 3546
 				} else {
3359 3547
 					$timeelapsed = microtime(true);
3360 3548
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3361
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3549
+					if ($globalDebugTimeElapsed) {
3550
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3551
+					}
3362 3552
 				}
3363 3553
 			}
3364 3554
 		} else {
3365 3555
 			if ($ModeS != '') {
3366 3556
 				$timeelapsed = microtime(true);
3367 3557
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3368
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3558
+				if ($globalDebugTimeElapsed) {
3559
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3560
+				}
3369 3561
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3370 3562
 				{
3371 3563
 					$timeelapsed = microtime(true);
3372 3564
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3373
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3565
+					if ($globalDebugTimeElapsed) {
3566
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3567
+					}
3374 3568
 				} else {
3375 3569
 					$timeelapsed = microtime(true);
3376 3570
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3377
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3571
+					if ($globalDebugTimeElapsed) {
3572
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3573
+					}
3378 3574
 				}
3379 3575
 			}
3380 3576
 		}
@@ -3389,7 +3585,9 @@  discard block
 block discarded – undo
3389 3585
 			} else {
3390 3586
 				$timeelapsed = microtime(true);
3391 3587
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3392
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3588
+				if ($globalDebugTimeElapsed) {
3589
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3590
+				}
3393 3591
 			}
3394 3592
 		}
3395 3593
 		
@@ -3403,7 +3601,9 @@  discard block
 block discarded – undo
3403 3601
 			} else {
3404 3602
 				$timeelapsed = microtime(true);
3405 3603
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3406
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3604
+				if ($globalDebugTimeElapsed) {
3605
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3606
+				}
3407 3607
 			}
3408 3608
 		}
3409 3609
 
@@ -3438,7 +3638,9 @@  discard block
 block discarded – undo
3438 3638
 			{
3439 3639
 				return false;
3440 3640
 			}
3441
-		} else $altitude = 0;
3641
+		} else {
3642
+			$altitude = 0;
3643
+		}
3442 3644
 		
3443 3645
 		if ($heading != "")
3444 3646
 		{
@@ -3467,7 +3669,9 @@  discard block
 block discarded – undo
3467 3669
 		{
3468 3670
 			$timeelapsed = microtime(true);
3469 3671
 			$image_array = $Image->getSpotterImage($registration);
3470
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3672
+			if ($globalDebugTimeElapsed) {
3673
+				echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3674
+			}
3471 3675
 			if (!isset($image_array[0]['registration']))
3472 3676
 			{
3473 3677
 				//echo "Add image !!!! \n";
@@ -3475,14 +3679,21 @@  discard block
 block discarded – undo
3475 3679
 			}
3476 3680
 			$timeelapsed = microtime(true);
3477 3681
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3478
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3479
-			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3682
+			if ($globalDebugTimeElapsed) {
3683
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3684
+			}
3685
+			if ($owner_info['owner'] != '') {
3686
+				$aircraft_owner = ucwords(strtolower($owner_info['owner']));
3687
+			}
3480 3688
 		}
3481 3689
     
3482 3690
 		if ($globalIVAO && $aircraft_icao != '')
3483 3691
 		{
3484
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3485
-            		else $airline_icao = '';
3692
+            		if (isset($airline_array[0]['icao'])) {
3693
+            			$airline_icao = $airline_array[0]['icao'];
3694
+            		} else {
3695
+            			$airline_icao = '';
3696
+            		}
3486 3697
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3487 3698
 			if (!isset($image_array[0]['registration']))
3488 3699
 			{
@@ -3527,16 +3738,28 @@  discard block
 block discarded – undo
3527 3738
                 {
3528 3739
                         $arrival_airport_array = $this->getAllAirportInfo('NA');
3529 3740
                 }
3530
-                if ($registration == '') $registration = 'NA';
3741
+                if ($registration == '') {
3742
+                	$registration = 'NA';
3743
+                }
3531 3744
                 if ($latitude == '' && $longitude == '') {
3532 3745
             		$latitude = 0;
3533 3746
             		$longitude = 0;
3534 3747
             	}
3535
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3536
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3537
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3538
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3539
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3748
+                if ($squawk == '' || $Common->isInteger($squawk) === false) {
3749
+                	$squawk = NULL;
3750
+                }
3751
+                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) {
3752
+                	$verticalrate = NULL;
3753
+                }
3754
+                if ($heading == '' || $Common->isInteger($heading) === false) {
3755
+                	$heading = 0;
3756
+                }
3757
+                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) {
3758
+                	$groundspeed = 0;
3759
+                }
3760
+                if (!isset($aircraft_owner)) {
3761
+                	$aircraft_owner = NULL;
3762
+                }
3540 3763
                 $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) 
3541 3764
                 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)";
3542 3765
 
@@ -3547,9 +3770,13 @@  discard block
 block discarded – undo
3547 3770
 		if ($airline_type == '') {
3548 3771
 			$timeelapsed = microtime(true);
3549 3772
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3550
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3773
+			if ($globalDebugTimeElapsed) {
3774
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3775
+			}
3776
+		}
3777
+		if ($airline_type == null) {
3778
+			$airline_type = '';
3551 3779
 		}
3552
-		if ($airline_type == null) $airline_type = '';
3553 3780
                 $aircraft_type = $aircraft_array[0]['type'];
3554 3781
                 $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3555 3782
                 $departure_airport_name = $departure_airport_array[0]['name'];
@@ -3684,7 +3911,9 @@  discard block
 block discarded – undo
3684 3911
 			}
3685 3912
 		}
3686 3913
 		$query .= "GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
3687
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3914
+		if ($limit) {
3915
+			$query .= " LIMIT 10 OFFSET 0";
3916
+		}
3688 3917
 		
3689 3918
 		$sth = $this->db->prepare($query);
3690 3919
 		$sth->execute();
@@ -3729,7 +3958,9 @@  discard block
 block discarded – undo
3729 3958
 			}
3730 3959
 		}
3731 3960
 		$query .= "GROUP BY spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC";
3732
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3961
+		if ($limit) {
3962
+			$query .= " LIMIT 10 OFFSET 0";
3963
+		}
3733 3964
       
3734 3965
 		
3735 3966
 		$sth = $this->db->prepare($query);
@@ -3775,7 +4006,9 @@  discard block
 block discarded – undo
3775 4006
 			}
3776 4007
 		}
3777 4008
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC";
3778
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4009
+		if ($limit) {
4010
+			$query .= " LIMIT 10 OFFSET 0";
4011
+		}
3779 4012
       
3780 4013
 		
3781 4014
 		$sth = $this->db->prepare($query);
@@ -3823,7 +4056,9 @@  discard block
 block discarded – undo
3823 4056
 			}
3824 4057
 		}
3825 4058
 		$query .= "GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
3826
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4059
+		if ($limit) {
4060
+			$query .= " LIMIT 10 OFFSET 0";
4061
+		}
3827 4062
       
3828 4063
 		
3829 4064
 		$sth = $this->db->prepare($query);
@@ -3868,7 +4103,9 @@  discard block
 block discarded – undo
3868 4103
 			}
3869 4104
 		}
3870 4105
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC";
3871
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4106
+		if ($limit) {
4107
+			$query .= " LIMIT 10 OFFSET 0";
4108
+		}
3872 4109
       
3873 4110
 		
3874 4111
 		$sth = $this->db->prepare($query);
@@ -4111,7 +4348,9 @@  discard block
 block discarded – undo
4111 4348
 			date_default_timezone_set($globalTimezone);
4112 4349
 			$datetime = new DateTime($date);
4113 4350
 			$offset = $datetime->format('P');
4114
-		} else $offset = '+00:00';
4351
+		} else {
4352
+			$offset = '+00:00';
4353
+		}
4115 4354
 
4116 4355
 		if ($globalDBdriver == 'mysql') {
4117 4356
 			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
@@ -4159,7 +4398,9 @@  discard block
 block discarded – undo
4159 4398
 			date_default_timezone_set($globalTimezone);
4160 4399
 			$datetime = new DateTime($date);
4161 4400
 			$offset = $datetime->format('P');
4162
-		} else $offset = '+00:00';
4401
+		} else {
4402
+			$offset = '+00:00';
4403
+		}
4163 4404
 		
4164 4405
 		if ($globalDBdriver == 'mysql') {
4165 4406
 			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
@@ -4377,7 +4618,9 @@  discard block
 block discarded – undo
4377 4618
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' 
4378 4619
 					GROUP BY spotter_output.airline_country
4379 4620
 					ORDER BY airline_country_count DESC";
4380
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4621
+		if ($limit) {
4622
+			$query .= " LIMIT 10 OFFSET 0";
4623
+		}
4381 4624
       
4382 4625
 		$sth = $this->db->prepare($query);
4383 4626
 		$sth->execute();
@@ -4405,7 +4648,9 @@  discard block
 block discarded – undo
4405 4648
 		global $globalDBdriver;
4406 4649
 		//$filter_query = $this->getFilter($filters,true,true);
4407 4650
 		$Connection= new Connection($this->db);
4408
-		if (!$Connection->tableExists('countries')) return array();
4651
+		if (!$Connection->tableExists('countries')) {
4652
+			return array();
4653
+		}
4409 4654
 		/*
4410 4655
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
4411 4656
 					FROM countries c, spotter_output s
@@ -4437,7 +4682,9 @@  discard block
 block discarded – undo
4437 4682
 		}
4438 4683
 		$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 ";
4439 4684
 		$query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC";
4440
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4685
+		if ($limit) {
4686
+			$query .= " LIMIT 10 OFFSET 0";
4687
+		}
4441 4688
       
4442 4689
 		
4443 4690
 		$sth = $this->db->prepare($query);
@@ -4487,7 +4734,9 @@  discard block
 block discarded – undo
4487 4734
 		}
4488 4735
 
4489 4736
 		$query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
4490
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4737
+		if ($limit) {
4738
+			$query .= " LIMIT 10 OFFSET 0";
4739
+		}
4491 4740
  
4492 4741
 		$sth = $this->db->prepare($query);
4493 4742
 		$sth->execute();
@@ -4533,7 +4782,9 @@  discard block
 block discarded – undo
4533 4782
 		}
4534 4783
 
4535 4784
 		$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";
4536
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4785
+		if ($limit) {
4786
+			$query .= " LIMIT 10 OFFSET 0";
4787
+		}
4537 4788
  
4538 4789
 		$sth = $this->db->prepare($query);
4539 4790
 		$sth->execute();
@@ -4580,7 +4831,9 @@  discard block
 block discarded – undo
4580 4831
 		}
4581 4832
 
4582 4833
 		$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";
4583
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4834
+		if ($limit) {
4835
+			$query .= " LIMIT 10 OFFSET 0";
4836
+		}
4584 4837
  
4585 4838
 		$sth = $this->db->prepare($query);
4586 4839
 		$sth->execute();
@@ -4633,7 +4886,9 @@  discard block
 block discarded – undo
4633 4886
 			if($row['registration'] != "")
4634 4887
 			{
4635 4888
 				$image_array = $Image->getSpotterImage($row['registration']);
4636
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4889
+				if (isset($image_array[0]['image_thumbnail'])) {
4890
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4891
+				}
4637 4892
 			}
4638 4893
 			$temp_array['registration_count'] = $row['registration_count'];
4639 4894
 
@@ -4708,7 +4963,9 @@  discard block
 block discarded – undo
4708 4963
 			if($row['registration'] != "")
4709 4964
 			{
4710 4965
 				$image_array = $Image->getSpotterImage($row['registration']);
4711
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4966
+				if (isset($image_array[0]['image_thumbnail'])) {
4967
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4968
+				}
4712 4969
 			}
4713 4970
 			$temp_array['registration_count'] = $row['registration_count'];
4714 4971
 
@@ -4815,7 +5072,9 @@  discard block
 block discarded – undo
4815 5072
 			if($row['registration'] != "")
4816 5073
 			{
4817 5074
 				$image_array = $Image->getSpotterImage($row['registration']);
4818
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5075
+				if (isset($image_array[0]['image_thumbnail'])) {
5076
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5077
+				}
4819 5078
 			}
4820 5079
 			$temp_array['registration_count'] = $row['registration_count'];
4821 5080
 			$aircraft_array[] = $temp_array;
@@ -4940,7 +5199,9 @@  discard block
 block discarded – undo
4940 5199
 			date_default_timezone_set($globalTimezone);
4941 5200
 			$datetime = new DateTime($date);
4942 5201
 			$offset = $datetime->format('P');
4943
-		} else $offset = '+00:00';
5202
+		} else {
5203
+			$offset = '+00:00';
5204
+		}
4944 5205
 
4945 5206
 		if ($globalDBdriver == 'mysql') {
4946 5207
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
@@ -4987,7 +5248,9 @@  discard block
 block discarded – undo
4987 5248
 			date_default_timezone_set($globalTimezone);
4988 5249
 			$datetime = new DateTime($date);
4989 5250
 			$offset = $datetime->format('P');
4990
-		} else $offset = '+00:00';
5251
+		} else {
5252
+			$offset = '+00:00';
5253
+		}
4991 5254
 
4992 5255
 		if ($globalDBdriver == 'mysql') {
4993 5256
 			$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 
@@ -5016,7 +5279,9 @@  discard block
 block discarded – undo
5016 5279
 			if($row['registration'] != "")
5017 5280
 			{
5018 5281
 				$image_array = $Image->getSpotterImage($row['registration']);
5019
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5282
+				if (isset($image_array[0]['image_thumbnail'])) {
5283
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5284
+				}
5020 5285
 			}
5021 5286
 			$temp_array['registration_count'] = $row['registration_count'];
5022 5287
  
@@ -5041,7 +5306,9 @@  discard block
 block discarded – undo
5041 5306
 			date_default_timezone_set($globalTimezone);
5042 5307
 			$datetime = new DateTime($date);
5043 5308
 			$offset = $datetime->format('P');
5044
-		} else $offset = '+00:00';
5309
+		} else {
5310
+			$offset = '+00:00';
5311
+		}
5045 5312
 
5046 5313
 		if ($globalDBdriver == 'mysql') {
5047 5314
 			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
@@ -5139,8 +5406,11 @@  discard block
 block discarded – undo
5139 5406
 			if($row['registration'] != "")
5140 5407
 			{
5141 5408
 				$image_array = $Image->getSpotterImage($row['registration']);
5142
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5143
-				else $temp_array['image_thumbnail'] = '';
5409
+				if (isset($image_array[0]['image_thumbnail'])) {
5410
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5411
+				} else {
5412
+					$temp_array['image_thumbnail'] = '';
5413
+				}
5144 5414
 			}
5145 5415
 			$temp_array['registration_count'] = $row['registration_count'];
5146 5416
 			$aircraft_array[] = $temp_array;
@@ -5247,7 +5517,9 @@  discard block
 block discarded – undo
5247 5517
 			if($row['registration'] != "")
5248 5518
 			{
5249 5519
 				$image_array = $Image->getSpotterImage($row['registration']);
5250
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5520
+				if (isset($image_array[0]['image_thumbnail'])) {
5521
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5522
+				}
5251 5523
 			}
5252 5524
 			$temp_array['registration_count'] = $row['registration_count'];
5253 5525
           
@@ -5364,7 +5636,9 @@  discard block
 block discarded – undo
5364 5636
 			if($row['registration'] != "")
5365 5637
 			{
5366 5638
 				$image_array = $Image->getSpotterImage($row['registration']);
5367
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5639
+				if (isset($image_array[0]['image_thumbnail'])) {
5640
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5641
+				}
5368 5642
 			}
5369 5643
 			$temp_array['registration_count'] = $row['registration_count'];
5370 5644
           
@@ -5476,7 +5750,9 @@  discard block
 block discarded – undo
5476 5750
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5477 5751
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5478 5752
                 $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5479
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5753
+		if ($limit) {
5754
+			$query .= " LIMIT 10 OFFSET 0";
5755
+		}
5480 5756
 		
5481 5757
 		$sth = $this->db->prepare($query);
5482 5758
 		$sth->execute();
@@ -5495,7 +5771,9 @@  discard block
 block discarded – undo
5495 5771
 			if($row['registration'] != "")
5496 5772
 			{
5497 5773
 				$image_array = $Image->getSpotterImage($row['registration']);
5498
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5774
+				if (isset($image_array[0]['image_thumbnail'])) {
5775
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5776
+				}
5499 5777
 			}
5500 5778
           
5501 5779
 			$aircraft_array[] = $temp_array;
@@ -5536,7 +5814,9 @@  discard block
 block discarded – undo
5536 5814
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5537 5815
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5538 5816
                 $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";
5539
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5817
+		if ($limit) {
5818
+			$query .= " LIMIT 10 OFFSET 0";
5819
+		}
5540 5820
 		
5541 5821
 		$sth = $this->db->prepare($query);
5542 5822
 		$sth->execute();
@@ -5556,7 +5836,9 @@  discard block
 block discarded – undo
5556 5836
 			if($row['registration'] != "")
5557 5837
 			{
5558 5838
 				$image_array = $Image->getSpotterImage($row['registration']);
5559
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5839
+				if (isset($image_array[0]['image_thumbnail'])) {
5840
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5841
+				}
5560 5842
 			}
5561 5843
           
5562 5844
 			$aircraft_array[] = $temp_array;
@@ -5597,7 +5879,9 @@  discard block
 block discarded – undo
5597 5879
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5598 5880
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5599 5881
 				ORDER BY airport_departure_icao_count DESC";
5600
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5882
+		if ($limit) {
5883
+			$query .= " LIMIT 10 OFFSET 0";
5884
+		}
5601 5885
       
5602 5886
 		$sth = $this->db->prepare($query);
5603 5887
 		$sth->execute();
@@ -5649,7 +5933,9 @@  discard block
 block discarded – undo
5649 5933
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5650 5934
                 $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
5651 5935
 				ORDER BY airport_departure_icao_count DESC";
5652
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5936
+		if ($limit) {
5937
+			$query .= " LIMIT 10 OFFSET 0";
5938
+		}
5653 5939
       
5654 5940
 		$sth = $this->db->prepare($query);
5655 5941
 		$sth->execute();
@@ -5701,7 +5987,9 @@  discard block
 block discarded – undo
5701 5987
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5702 5988
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5703 5989
 				ORDER BY airport_departure_icao_count DESC";
5704
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5990
+		if ($limit) {
5991
+			$query .= " LIMIT 10 OFFSET 0";
5992
+		}
5705 5993
     		//echo $query;
5706 5994
 		$sth = $this->db->prepare($query);
5707 5995
 		$sth->execute();
@@ -5753,7 +6041,9 @@  discard block
 block discarded – undo
5753 6041
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5754 6042
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5755 6043
 				ORDER BY airport_departure_icao_count DESC";
5756
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6044
+		if ($limit) {
6045
+			$query .= " LIMIT 10 OFFSET 0";
6046
+		}
5757 6047
       
5758 6048
 		$sth = $this->db->prepare($query);
5759 6049
 		$sth->execute();
@@ -6148,7 +6438,9 @@  discard block
 block discarded – undo
6148 6438
 			date_default_timezone_set($globalTimezone);
6149 6439
 			$datetime = new DateTime($date);
6150 6440
 			$offset = $datetime->format('P');
6151
-		} else $offset = '+00:00';
6441
+		} else {
6442
+			$offset = '+00:00';
6443
+		}
6152 6444
 
6153 6445
 		if ($globalDBdriver == 'mysql') {
6154 6446
 			$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,7 +6490,9 @@  discard block
 block discarded – undo
6198 6490
 			date_default_timezone_set($globalTimezone);
6199 6491
 			$datetime = new DateTime($date);
6200 6492
 			$offset = $datetime->format('P');
6201
-		} else $offset = '+00:00';
6493
+		} else {
6494
+			$offset = '+00:00';
6495
+		}
6202 6496
 
6203 6497
 		if ($globalDBdriver == 'mysql') {
6204 6498
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
@@ -6411,7 +6705,9 @@  discard block
 block discarded – undo
6411 6705
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6412 6706
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6413 6707
 					ORDER BY airport_arrival_icao_count DESC";
6414
-		if ($limit) $query .= " LIMIT 10";
6708
+		if ($limit) {
6709
+			$query .= " LIMIT 10";
6710
+		}
6415 6711
       
6416 6712
 		
6417 6713
 		$sth = $this->db->prepare($query);
@@ -6431,7 +6727,9 @@  discard block
 block discarded – undo
6431 6727
 			if ($icaoaskey) {
6432 6728
 				$icao = $row['arrival_airport_icao'];
6433 6729
 				$airport_array[$icao] = $temp_array;
6434
-			} else $airport_array[] = $temp_array;
6730
+			} else {
6731
+				$airport_array[] = $temp_array;
6732
+			}
6435 6733
 		}
6436 6734
 
6437 6735
 		return $airport_array;
@@ -6473,7 +6771,9 @@  discard block
 block discarded – undo
6473 6771
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6474 6772
                 $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
6475 6773
 					ORDER BY airport_arrival_icao_count DESC";
6476
-		if ($limit) $query .= " LIMIT 10";
6774
+		if ($limit) {
6775
+			$query .= " LIMIT 10";
6776
+		}
6477 6777
       
6478 6778
 		
6479 6779
 		$sth = $this->db->prepare($query);
@@ -6494,7 +6794,9 @@  discard block
 block discarded – undo
6494 6794
 			if ($icaoaskey) {
6495 6795
 				$icao = $row['arrival_airport_icao'];
6496 6796
 				$airport_array[$icao] = $temp_array;
6497
-			} else $airport_array[] = $temp_array;
6797
+			} else {
6798
+				$airport_array[] = $temp_array;
6799
+			}
6498 6800
 		}
6499 6801
 
6500 6802
 		return $airport_array;
@@ -6536,7 +6838,9 @@  discard block
 block discarded – undo
6536 6838
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6537 6839
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6538 6840
 					ORDER BY airport_arrival_icao_count DESC";
6539
-		if ($limit) $query .= " LIMIT 10";
6841
+		if ($limit) {
6842
+			$query .= " LIMIT 10";
6843
+		}
6540 6844
       
6541 6845
 		
6542 6846
 		$sth = $this->db->prepare($query);
@@ -6556,7 +6860,9 @@  discard block
 block discarded – undo
6556 6860
 			if ($icaoaskey) {
6557 6861
 				$icao = $row['arrival_airport_icao'];
6558 6862
 				$airport_array[$icao] = $temp_array;
6559
-			} else $airport_array[] = $temp_array;
6863
+			} else {
6864
+				$airport_array[] = $temp_array;
6865
+			}
6560 6866
 		}
6561 6867
 
6562 6868
 		return $airport_array;
@@ -6598,7 +6904,9 @@  discard block
 block discarded – undo
6598 6904
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6599 6905
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6600 6906
 					ORDER BY airport_arrival_icao_count DESC";
6601
-		if ($limit) $query .= " LIMIT 10";
6907
+		if ($limit) {
6908
+			$query .= " LIMIT 10";
6909
+		}
6602 6910
       
6603 6911
 		
6604 6912
 		$sth = $this->db->prepare($query);
@@ -6619,7 +6927,9 @@  discard block
 block discarded – undo
6619 6927
 			if ($icaoaskey) {
6620 6928
 				$icao = $row['arrival_airport_icao'];
6621 6929
 				$airport_array[$icao] = $temp_array;
6622
-			} else $airport_array[] = $temp_array;
6930
+			} else {
6931
+				$airport_array[] = $temp_array;
6932
+			}
6623 6933
 		}
6624 6934
 
6625 6935
 		return $airport_array;
@@ -7000,7 +7310,9 @@  discard block
 block discarded – undo
7000 7310
 			date_default_timezone_set($globalTimezone);
7001 7311
 			$datetime = new DateTime($date);
7002 7312
 			$offset = $datetime->format('P');
7003
-		} else $offset = '+00:00';
7313
+		} else {
7314
+			$offset = '+00:00';
7315
+		}
7004 7316
 
7005 7317
 		if ($globalDBdriver == 'mysql') {
7006 7318
 			$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 
@@ -7050,7 +7362,9 @@  discard block
 block discarded – undo
7050 7362
 			date_default_timezone_set($globalTimezone);
7051 7363
 			$datetime = new DateTime($date);
7052 7364
 			$offset = $datetime->format('P');
7053
-		} else $offset = '+00:00';
7365
+		} else {
7366
+			$offset = '+00:00';
7367
+		}
7054 7368
 
7055 7369
 		if ($globalDBdriver == 'mysql') {
7056 7370
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
@@ -7273,7 +7587,9 @@  discard block
 block discarded – undo
7273 7587
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
7274 7588
 		$query .= " GROUP BY spotter_output.arrival_airport_country
7275 7589
 					ORDER BY airport_arrival_country_count DESC";
7276
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7590
+		if ($limit) {
7591
+			$query .= " LIMIT 10 OFFSET 0";
7592
+		}
7277 7593
       
7278 7594
 		
7279 7595
 		$sth = $this->db->prepare($query);
@@ -7560,7 +7876,9 @@  discard block
 block discarded – undo
7560 7876
 			date_default_timezone_set($globalTimezone);
7561 7877
 			$datetime = new DateTime($date);
7562 7878
 			$offset = $datetime->format('P');
7563
-		} else $offset = '+00:00';
7879
+		} else {
7880
+			$offset = '+00:00';
7881
+		}
7564 7882
 		
7565 7883
 		if ($globalDBdriver == 'mysql') {
7566 7884
 			$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
@@ -7736,15 +8054,23 @@  discard block
 block discarded – undo
7736 8054
 		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7737 8055
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
7738 8056
 		 if ($olderthanmonths > 0) {
7739
-			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
7740
-			else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
8057
+			if ($globalDBdriver == 'mysql') {
8058
+				$query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
8059
+			} else {
8060
+				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
8061
+			}
7741 8062
 		}
7742 8063
 		if ($sincedate != '') {
7743
-			if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'";
7744
-			else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
8064
+			if ($globalDBdriver == 'mysql') {
8065
+				$query .= " AND spotter_output.date > '".$sincedate."'";
8066
+			} else {
8067
+				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
8068
+			}
7745 8069
 		}
7746 8070
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
7747
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
8071
+		if ($limit) {
8072
+			$query .= " LIMIT 10 OFFSET 0";
8073
+		}
7748 8074
       		
7749 8075
 		$sth = $this->db->prepare($query);
7750 8076
 		$sth->execute();
@@ -7778,15 +8104,23 @@  discard block
 block discarded – undo
7778 8104
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7779 8105
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
7780 8106
 		 if ($olderthanmonths > 0) {
7781
-			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7782
-			else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
8107
+			if ($globalDBdriver == 'mysql') {
8108
+				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
8109
+			} else {
8110
+				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
8111
+			}
7783 8112
 		}
7784 8113
 		if ($sincedate != '') {
7785
-			if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' ";
7786
-			else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
8114
+			if ($globalDBdriver == 'mysql') {
8115
+				$query .= "AND spotter_output.date > '".$sincedate."' ";
8116
+			} else {
8117
+				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
8118
+			}
7787 8119
 		}
7788 8120
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
7789
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
8121
+		if ($limit) {
8122
+			$query .= " LIMIT 10 OFFSET 0";
8123
+		}
7790 8124
       		
7791 8125
 		$sth = $this->db->prepare($query);
7792 8126
 		$sth->execute();
@@ -7823,7 +8157,9 @@  discard block
 block discarded – undo
7823 8157
 			date_default_timezone_set($globalTimezone);
7824 8158
 			$datetime = new DateTime();
7825 8159
 			$offset = $datetime->format('P');
7826
-		} else $offset = '+00:00';
8160
+		} else {
8161
+			$offset = '+00:00';
8162
+		}
7827 8163
 
7828 8164
 		if ($globalDBdriver == 'mysql') {
7829 8165
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7872,7 +8208,9 @@  discard block
 block discarded – undo
7872 8208
 			date_default_timezone_set($globalTimezone);
7873 8209
 			$datetime = new DateTime();
7874 8210
 			$offset = $datetime->format('P');
7875
-		} else $offset = '+00:00';
8211
+		} else {
8212
+			$offset = '+00:00';
8213
+		}
7876 8214
 		$filter_query = $this->getFilter($filters,true,true);
7877 8215
 		if ($globalDBdriver == 'mysql') {
7878 8216
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7921,7 +8259,9 @@  discard block
 block discarded – undo
7921 8259
 			date_default_timezone_set($globalTimezone);
7922 8260
 			$datetime = new DateTime();
7923 8261
 			$offset = $datetime->format('P');
7924
-		} else $offset = '+00:00';
8262
+		} else {
8263
+			$offset = '+00:00';
8264
+		}
7925 8265
 		$filter_query = $this->getFilter($filters,true,true);
7926 8266
 		if ($globalDBdriver == 'mysql') {
7927 8267
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7967,7 +8307,9 @@  discard block
 block discarded – undo
7967 8307
 			date_default_timezone_set($globalTimezone);
7968 8308
 			$datetime = new DateTime();
7969 8309
 			$offset = $datetime->format('P');
7970
-		} else $offset = '+00:00';
8310
+		} else {
8311
+			$offset = '+00:00';
8312
+		}
7971 8313
 		$filter_query = $this->getFilter($filters,true,true);
7972 8314
 		if ($globalDBdriver == 'mysql') {
7973 8315
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -8015,7 +8357,9 @@  discard block
 block discarded – undo
8015 8357
 			date_default_timezone_set($globalTimezone);
8016 8358
 			$datetime = new DateTime();
8017 8359
 			$offset = $datetime->format('P');
8018
-		} else $offset = '+00:00';
8360
+		} else {
8361
+			$offset = '+00:00';
8362
+		}
8019 8363
 		
8020 8364
 		if ($globalDBdriver == 'mysql') {
8021 8365
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -8063,7 +8407,9 @@  discard block
 block discarded – undo
8063 8407
 			date_default_timezone_set($globalTimezone);
8064 8408
 			$datetime = new DateTime();
8065 8409
 			$offset = $datetime->format('P');
8066
-		} else $offset = '+00:00';
8410
+		} else {
8411
+			$offset = '+00:00';
8412
+		}
8067 8413
 
8068 8414
 		if ($globalDBdriver == 'mysql') {
8069 8415
 			$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
@@ -8110,7 +8456,9 @@  discard block
 block discarded – undo
8110 8456
 			date_default_timezone_set($globalTimezone);
8111 8457
 			$datetime = new DateTime();
8112 8458
 			$offset = $datetime->format('P');
8113
-		} else $offset = '+00:00';
8459
+		} else {
8460
+			$offset = '+00:00';
8461
+		}
8114 8462
 
8115 8463
 		if ($globalDBdriver == 'mysql') {
8116 8464
 			$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
@@ -8158,7 +8506,9 @@  discard block
 block discarded – undo
8158 8506
 			date_default_timezone_set($globalTimezone);
8159 8507
 			$datetime = new DateTime();
8160 8508
 			$offset = $datetime->format('P');
8161
-		} else $offset = '+00:00';
8509
+		} else {
8510
+			$offset = '+00:00';
8511
+		}
8162 8512
 		$filter_query = $this->getFilter($filters,true,true);
8163 8513
 		if ($globalDBdriver == 'mysql') {
8164 8514
 			$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
@@ -8203,7 +8553,9 @@  discard block
 block discarded – undo
8203 8553
 			date_default_timezone_set($globalTimezone);
8204 8554
 			$datetime = new DateTime();
8205 8555
 			$offset = $datetime->format('P');
8206
-		} else $offset = '+00:00';
8556
+		} else {
8557
+			$offset = '+00:00';
8558
+		}
8207 8559
 		$filter_query = $this->getFilter($filters,true,true);
8208 8560
 
8209 8561
 		if ($globalDBdriver == 'mysql') {
@@ -8250,7 +8602,9 @@  discard block
 block discarded – undo
8250 8602
 			date_default_timezone_set($globalTimezone);
8251 8603
 			$datetime = new DateTime();
8252 8604
 			$offset = $datetime->format('P');
8253
-		} else $offset = '+00:00';
8605
+		} else {
8606
+			$offset = '+00:00';
8607
+		}
8254 8608
 
8255 8609
 		if ($globalDBdriver == 'mysql') {
8256 8610
 			$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
@@ -8296,7 +8650,9 @@  discard block
 block discarded – undo
8296 8650
 			date_default_timezone_set($globalTimezone);
8297 8651
 			$datetime = new DateTime();
8298 8652
 			$offset = $datetime->format('P');
8299
-		} else $offset = '+00:00';
8653
+		} else {
8654
+			$offset = '+00:00';
8655
+		}
8300 8656
 		$filter_query = $this->getFilter($filters,true,true);
8301 8657
 
8302 8658
 		if ($globalDBdriver == 'mysql') {
@@ -8343,7 +8699,9 @@  discard block
 block discarded – undo
8343 8699
 			date_default_timezone_set($globalTimezone);
8344 8700
 			$datetime = new DateTime();
8345 8701
 			$offset = $datetime->format('P');
8346
-		} else $offset = '+00:00';
8702
+		} else {
8703
+			$offset = '+00:00';
8704
+		}
8347 8705
 
8348 8706
 		if ($globalDBdriver == 'mysql') {
8349 8707
 			$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
@@ -8390,7 +8748,9 @@  discard block
 block discarded – undo
8390 8748
 			date_default_timezone_set($globalTimezone);
8391 8749
 			$datetime = new DateTime();
8392 8750
 			$offset = $datetime->format('P');
8393
-		} else $offset = '+00:00';
8751
+		} else {
8752
+			$offset = '+00:00';
8753
+		}
8394 8754
 
8395 8755
 		if ($globalDBdriver == 'mysql') {
8396 8756
 			$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
@@ -8435,7 +8795,9 @@  discard block
 block discarded – undo
8435 8795
 			date_default_timezone_set($globalTimezone);
8436 8796
 			$datetime = new DateTime();
8437 8797
 			$offset = $datetime->format('P');
8438
-		} else $offset = '+00:00';
8798
+		} else {
8799
+			$offset = '+00:00';
8800
+		}
8439 8801
 		$filter_query = $this->getFilter($filters,true,true);
8440 8802
 
8441 8803
 		if ($globalDBdriver == 'mysql') {
@@ -8483,7 +8845,9 @@  discard block
 block discarded – undo
8483 8845
 			date_default_timezone_set($globalTimezone);
8484 8846
 			$datetime = new DateTime();
8485 8847
 			$offset = $datetime->format('P');
8486
-		} else $offset = '+00:00';
8848
+		} else {
8849
+			$offset = '+00:00';
8850
+		}
8487 8851
 
8488 8852
 		if ($globalDBdriver == 'mysql') {
8489 8853
 			$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
@@ -8529,7 +8893,9 @@  discard block
 block discarded – undo
8529 8893
 			date_default_timezone_set($globalTimezone);
8530 8894
 			$datetime = new DateTime();
8531 8895
 			$offset = $datetime->format('P');
8532
-		} else $offset = '+00:00';
8896
+		} else {
8897
+			$offset = '+00:00';
8898
+		}
8533 8899
 		$filter_query = $this->getFilter($filters,true,true);
8534 8900
 
8535 8901
 		if ($globalDBdriver == 'mysql') {
@@ -8577,7 +8943,9 @@  discard block
 block discarded – undo
8577 8943
 			date_default_timezone_set($globalTimezone);
8578 8944
 			$datetime = new DateTime();
8579 8945
 			$offset = $datetime->format('P');
8580
-		} else $offset = '+00:00';
8946
+		} else {
8947
+			$offset = '+00:00';
8948
+		}
8581 8949
 
8582 8950
 		if ($globalDBdriver == 'mysql') {
8583 8951
 			$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
@@ -8624,7 +8992,9 @@  discard block
 block discarded – undo
8624 8992
 			date_default_timezone_set($globalTimezone);
8625 8993
 			$datetime = new DateTime();
8626 8994
 			$offset = $datetime->format('P');
8627
-		} else $offset = '+00:00';
8995
+		} else {
8996
+			$offset = '+00:00';
8997
+		}
8628 8998
 		$filter_query = $this->getFilter($filters,true,true);
8629 8999
 		if ($globalDBdriver == 'mysql') {
8630 9000
 			$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
@@ -8673,7 +9043,9 @@  discard block
 block discarded – undo
8673 9043
 			date_default_timezone_set($globalTimezone);
8674 9044
 			$datetime = new DateTime();
8675 9045
 			$offset = $datetime->format('P');
8676
-		} else $offset = '+00:00';
9046
+		} else {
9047
+			$offset = '+00:00';
9048
+		}
8677 9049
 
8678 9050
 		$orderby_sql = '';
8679 9051
 		if ($orderby == "hour")
@@ -8739,7 +9111,9 @@  discard block
 block discarded – undo
8739 9111
 			date_default_timezone_set($globalTimezone);
8740 9112
 			$datetime = new DateTime();
8741 9113
 			$offset = $datetime->format('P');
8742
-		} else $offset = '+00:00';
9114
+		} else {
9115
+			$offset = '+00:00';
9116
+		}
8743 9117
 
8744 9118
 		$orderby_sql = '';
8745 9119
 		if ($orderby == "hour")
@@ -8806,7 +9180,9 @@  discard block
 block discarded – undo
8806 9180
 			date_default_timezone_set($globalTimezone);
8807 9181
 			$datetime = new DateTime();
8808 9182
 			$offset = $datetime->format('P');
8809
-		} else $offset = '+00:00';
9183
+		} else {
9184
+			$offset = '+00:00';
9185
+		}
8810 9186
 
8811 9187
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8812 9188
 
@@ -8857,7 +9233,9 @@  discard block
 block discarded – undo
8857 9233
 			date_default_timezone_set($globalTimezone);
8858 9234
 			$datetime = new DateTime();
8859 9235
 			$offset = $datetime->format('P');
8860
-		} else $offset = '+00:00';
9236
+		} else {
9237
+			$offset = '+00:00';
9238
+		}
8861 9239
 
8862 9240
 		if ($globalDBdriver == 'mysql') {
8863 9241
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8904,7 +9282,9 @@  discard block
 block discarded – undo
8904 9282
 			date_default_timezone_set($globalTimezone);
8905 9283
 			$datetime = new DateTime();
8906 9284
 			$offset = $datetime->format('P');
8907
-		} else $offset = '+00:00';
9285
+		} else {
9286
+			$offset = '+00:00';
9287
+		}
8908 9288
 
8909 9289
 		if ($globalDBdriver == 'mysql') {
8910 9290
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8951,7 +9331,9 @@  discard block
 block discarded – undo
8951 9331
 			date_default_timezone_set($globalTimezone);
8952 9332
 			$datetime = new DateTime();
8953 9333
 			$offset = $datetime->format('P');
8954
-		} else $offset = '+00:00';
9334
+		} else {
9335
+			$offset = '+00:00';
9336
+		}
8955 9337
 
8956 9338
 		if ($globalDBdriver == 'mysql') {
8957 9339
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8999,7 +9381,9 @@  discard block
 block discarded – undo
8999 9381
 			date_default_timezone_set($globalTimezone);
9000 9382
 			$datetime = new DateTime();
9001 9383
 			$offset = $datetime->format('P');
9002
-		} else $offset = '+00:00';
9384
+		} else {
9385
+			$offset = '+00:00';
9386
+		}
9003 9387
 
9004 9388
 		if ($globalDBdriver == 'mysql') {
9005 9389
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9047,7 +9431,9 @@  discard block
 block discarded – undo
9047 9431
 			date_default_timezone_set($globalTimezone);
9048 9432
 			$datetime = new DateTime($date);
9049 9433
 			$offset = $datetime->format('P');
9050
-		} else $offset = '+00:00';
9434
+		} else {
9435
+			$offset = '+00:00';
9436
+		}
9051 9437
 
9052 9438
 		if ($globalDBdriver == 'mysql') {
9053 9439
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9095,7 +9481,9 @@  discard block
 block discarded – undo
9095 9481
 			date_default_timezone_set($globalTimezone);
9096 9482
 			$datetime = new DateTime();
9097 9483
 			$offset = $datetime->format('P');
9098
-		} else $offset = '+00:00';
9484
+		} else {
9485
+			$offset = '+00:00';
9486
+		}
9099 9487
 
9100 9488
 		if ($globalDBdriver == 'mysql') {
9101 9489
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9145,7 +9533,9 @@  discard block
 block discarded – undo
9145 9533
 			date_default_timezone_set($globalTimezone);
9146 9534
 			$datetime = new DateTime();
9147 9535
 			$offset = $datetime->format('P');
9148
-		} else $offset = '+00:00';
9536
+		} else {
9537
+			$offset = '+00:00';
9538
+		}
9149 9539
 
9150 9540
 		if ($globalDBdriver == 'mysql') {
9151 9541
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9192,7 +9582,9 @@  discard block
 block discarded – undo
9192 9582
 			date_default_timezone_set($globalTimezone);
9193 9583
 			$datetime = new DateTime();
9194 9584
 			$offset = $datetime->format('P');
9195
-		} else $offset = '+00:00';
9585
+		} else {
9586
+			$offset = '+00:00';
9587
+		}
9196 9588
 
9197 9589
 		if ($globalDBdriver == 'mysql') {
9198 9590
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9360,7 +9752,9 @@  discard block
 block discarded – undo
9360 9752
 			date_default_timezone_set($globalTimezone);
9361 9753
 			$datetime = new DateTime();
9362 9754
 			$offset = $datetime->format('P');
9363
-		} else $offset = '+00:00';
9755
+		} else {
9756
+			$offset = '+00:00';
9757
+		}
9364 9758
 
9365 9759
 		if ($globalDBdriver == 'mysql') {
9366 9760
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9546,7 +9940,9 @@  discard block
 block discarded – undo
9546 9940
 	*/
9547 9941
 	public function parseDirection($direction = 0)
9548 9942
 	{
9549
-		if ($direction == '') $direction = 0;
9943
+		if ($direction == '') {
9944
+			$direction = 0;
9945
+		}
9550 9946
 		$direction_array = array();
9551 9947
 		$temp_array = array();
9552 9948
 
@@ -9647,7 +10043,9 @@  discard block
 block discarded – undo
9647 10043
 		if (isset($result->AirlineFlightInfoResult))
9648 10044
 		{
9649 10045
 			$registration = $result->AirlineFlightInfoResult->tailnumber;
9650
-		} else return '';
10046
+		} else {
10047
+			return '';
10048
+		}
9651 10049
 		
9652 10050
 		$registration = $this->convertAircraftRegistration($registration);
9653 10051
 		
@@ -9676,7 +10074,9 @@  discard block
 block discarded – undo
9676 10074
 		if (count($row) > 0) {
9677 10075
 		    //return $row['Registration'];
9678 10076
 		    return $row['registration'];
9679
-		} else return '';
10077
+		} else {
10078
+			return '';
10079
+		}
9680 10080
 	
9681 10081
 	}
9682 10082
 
@@ -9699,9 +10099,14 @@  discard block
 block discarded – undo
9699 10099
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9700 10100
 		$sth->closeCursor();
9701 10101
 		if (count($row) > 0) {
9702
-		    if ($row['type_flight'] == null) return '';
9703
-		    else return $row['type_flight'];
9704
-		} else return '';
10102
+		    if ($row['type_flight'] == null) {
10103
+		    	return '';
10104
+		    } else {
10105
+		    	return $row['type_flight'];
10106
+		    }
10107
+		} else {
10108
+			return '';
10109
+		}
9705 10110
 	
9706 10111
 	}
9707 10112
 
@@ -9719,7 +10124,9 @@  discard block
 block discarded – undo
9719 10124
 		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9720 10125
 	
9721 10126
 		$Connection = new Connection($this->db);
9722
-		if (!$Connection->tableExists('countries')) return '';
10127
+		if (!$Connection->tableExists('countries')) {
10128
+			return '';
10129
+		}
9723 10130
 	
9724 10131
 		try {
9725 10132
 			/*
@@ -9739,9 +10146,13 @@  discard block
 block discarded – undo
9739 10146
 			$sth->closeCursor();
9740 10147
 			if (count($row) > 0) {
9741 10148
 				return $row;
9742
-			} else return '';
10149
+			} else {
10150
+				return '';
10151
+			}
9743 10152
 		} catch (PDOException $e) {
9744
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
10153
+			if (isset($globalDebug) && $globalDebug) {
10154
+				echo 'Error : '.$e->getMessage()."\n";
10155
+			}
9745 10156
 			return '';
9746 10157
 		}
9747 10158
 	
@@ -9759,7 +10170,9 @@  discard block
 block discarded – undo
9759 10170
 		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
9760 10171
 	
9761 10172
 		$Connection = new Connection($this->db);
9762
-		if (!$Connection->tableExists('countries')) return '';
10173
+		if (!$Connection->tableExists('countries')) {
10174
+			return '';
10175
+		}
9763 10176
 	
9764 10177
 		try {
9765 10178
 			$query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1";
@@ -9771,9 +10184,13 @@  discard block
 block discarded – undo
9771 10184
 			$sth->closeCursor();
9772 10185
 			if (count($row) > 0) {
9773 10186
 				return $row;
9774
-			} else return '';
10187
+			} else {
10188
+				return '';
10189
+			}
9775 10190
 		} catch (PDOException $e) {
9776
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
10191
+			if (isset($globalDebug) && $globalDebug) {
10192
+				echo 'Error : '.$e->getMessage()."\n";
10193
+			}
9777 10194
 			return '';
9778 10195
 		}
9779 10196
 	
@@ -9943,7 +10360,9 @@  discard block
 block discarded – undo
9943 10360
 	{
9944 10361
 		global $globalBitlyAccessToken;
9945 10362
 		
9946
-		if ($globalBitlyAccessToken == '') return $url;
10363
+		if ($globalBitlyAccessToken == '') {
10364
+			return $url;
10365
+		}
9947 10366
         
9948 10367
 		$google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url;
9949 10368
 		
@@ -10092,7 +10511,9 @@  discard block
 block discarded – undo
10092 10511
 		
10093 10512
 
10094 10513
 		// routes
10095
-		if ($globalDebug) print "Routes...\n";
10514
+		if ($globalDebug) {
10515
+			print "Routes...\n";
10516
+		}
10096 10517
 		if ($globalDBdriver == 'mysql') {
10097 10518
 			$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)";
10098 10519
 		} else {
@@ -10111,7 +10532,9 @@  discard block
 block discarded – undo
10111 10532
 			}
10112 10533
 		}
10113 10534
 		
10114
-		if ($globalDebug) print "Airlines...\n";
10535
+		if ($globalDebug) {
10536
+			print "Airlines...\n";
10537
+		}
10115 10538
 		//airlines
10116 10539
 		if ($globalDBdriver == 'mysql') {
10117 10540
 			$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)";
@@ -10125,10 +10548,15 @@  discard block
 block discarded – undo
10125 10548
 			if (is_numeric(substr($row['ident'], -1, 1)))
10126 10549
 			{
10127 10550
 				$fromsource = NULL;
10128
-				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
10129
-				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
10130
-				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
10131
-				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
10551
+				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
10552
+					$fromsource = 'vatsim';
10553
+				} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
10554
+					$fromsource = 'ivao';
10555
+				} elseif (isset($globalVATSIM) && $globalVATSIM) {
10556
+					$fromsource = 'vatsim';
10557
+				} elseif (isset($globalIVAO) && $globalIVAO) {
10558
+					$fromsource = 'ivao';
10559
+				}
10132 10560
 				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
10133 10561
 				if (isset($airline_array[0]['name'])) {
10134 10562
 					$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";
@@ -10138,13 +10566,17 @@  discard block
 block discarded – undo
10138 10566
 			}
10139 10567
 		}
10140 10568
 
10141
-		if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n";
10569
+		if ($globalDebug) {
10570
+			print "Remove Duplicate in aircraft_modes...\n";
10571
+		}
10142 10572
 		//duplicate modes
10143 10573
 		$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";
10144 10574
 		$sth = $this->db->prepare($query);
10145 10575
 		$sth->execute();
10146 10576
 		
10147
-		if ($globalDebug) print "Aircraft...\n";
10577
+		if ($globalDebug) {
10578
+			print "Aircraft...\n";
10579
+		}
10148 10580
 		//aircraft
10149 10581
 		if ($globalDBdriver == 'mysql') {
10150 10582
 			$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)";
@@ -10187,26 +10619,38 @@  discard block
 block discarded – undo
10187 10619
 				 if (isset($closestAirports[0])) {
10188 10620
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
10189 10621
 						$airport_icao = $closestAirports[0]['icao'];
10190
-						if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10622
+						if ($globalDebug) {
10623
+							echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10624
+						}
10191 10625
 					} elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') {
10192 10626
 						foreach ($closestAirports as $airport) {
10193 10627
 							if ($row['arrival_airport_icao'] == $airport['icao']) {
10194 10628
 								$airport_icao = $airport['icao'];
10195
-								if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10629
+								if ($globalDebug) {
10630
+									echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10631
+								}
10196 10632
 								break;
10197 10633
 							}
10198 10634
 						}
10199 10635
 					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
10200 10636
 						$airport_icao = $closestAirports[0]['icao'];
10201
-						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";
10637
+						if ($globalDebug) {
10638
+							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";
10639
+						}
10202 10640
 					} else {
10203
-						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";
10641
+						if ($globalDebug) {
10642
+							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";
10643
+						}
10204 10644
 					}
10205 10645
 				} else {
10206
-					if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
10646
+					if ($globalDebug) {
10647
+						echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
10648
+					}
10207 10649
 				}
10208 10650
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
10209
-					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
10651
+					if ($globalDebug) {
10652
+						echo "Updating airport to ".$airport_icao."...\n";
10653
+					}
10210 10654
 					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10211 10655
 					$sthu = $this->db->prepare($update_query);
10212 10656
 					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
Please login to merge, or discard this patch.
Indentation   +1292 added lines, -1292 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;
@@ -1527,11 +1527,11 @@  discard block
 block discarded – undo
1527 1527
 
1528 1528
 
1529 1529
 	/**
1530
-	* Gets all the spotter information based on the country name
1531
-	*
1532
-	* @return Array the spotter information
1533
-	*
1534
-	*/
1530
+	 * Gets all the spotter information based on the country name
1531
+	 *
1532
+	 * @return Array the spotter information
1533
+	 *
1534
+	 */
1535 1535
 	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1536 1536
 	{
1537 1537
 		global $global_query;
@@ -1585,11 +1585,11 @@  discard block
 block discarded – undo
1585 1585
 	
1586 1586
 	
1587 1587
 	/**
1588
-	* Gets all the spotter information based on the manufacturer name
1589
-	*
1590
-	* @return Array the spotter information
1591
-	*
1592
-	*/
1588
+	 * Gets all the spotter information based on the manufacturer name
1589
+	 *
1590
+	 * @return Array the spotter information
1591
+	 *
1592
+	 */
1593 1593
 	public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array())
1594 1594
 	{
1595 1595
 		global $global_query;
@@ -1645,13 +1645,13 @@  discard block
 block discarded – undo
1645 1645
   
1646 1646
   
1647 1647
 	/**
1648
-	* Gets a list of all aircraft that take a route
1649
-	*
1650
-	* @param String $departure_airport_icao ICAO code of departure airport
1651
-	* @param String $arrival_airport_icao ICAO code of arrival airport
1652
-	* @return Array the spotter information
1653
-	*
1654
-	*/
1648
+	 * Gets a list of all aircraft that take a route
1649
+	 *
1650
+	 * @param String $departure_airport_icao ICAO code of departure airport
1651
+	 * @param String $arrival_airport_icao ICAO code of arrival airport
1652
+	 * @return Array the spotter information
1653
+	 *
1654
+	 */
1655 1655
 	public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array())
1656 1656
 	{
1657 1657
 		global $global_query;
@@ -1720,11 +1720,11 @@  discard block
 block discarded – undo
1720 1720
 	
1721 1721
 	
1722 1722
 	/**
1723
-	* Gets all the spotter information based on the special column in the table
1724
-	*
1725
-	* @return Array the spotter information
1726
-	*
1727
-	*/
1723
+	 * Gets all the spotter information based on the special column in the table
1724
+	 *
1725
+	 * @return Array the spotter information
1726
+	 *
1727
+	 */
1728 1728
 	public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array())
1729 1729
 	{
1730 1730
 		global $global_query;
@@ -1763,11 +1763,11 @@  discard block
 block discarded – undo
1763 1763
 	}
1764 1764
 
1765 1765
 	/**
1766
-	* Gets all the highlight based on a aircraft registration
1767
-	*
1768
-	* @return String the highlight text
1769
-	*
1770
-	*/
1766
+	 * Gets all the highlight based on a aircraft registration
1767
+	 *
1768
+	 * @return String the highlight text
1769
+	 *
1770
+	 */
1771 1771
 	public function getHighlightByRegistration($registration,$filter = array())
1772 1772
 	{
1773 1773
 		global $global_query;
@@ -1789,13 +1789,13 @@  discard block
 block discarded – undo
1789 1789
 
1790 1790
 	
1791 1791
 	/**
1792
-	* Gets the squawk usage from squawk code
1793
-	*
1794
-	* @param String $squawk squawk code
1795
-	* @param String $country country
1796
-	* @return String usage
1797
-	*
1798
-	*/
1792
+	 * Gets the squawk usage from squawk code
1793
+	 *
1794
+	 * @param String $squawk squawk code
1795
+	 * @param String $country country
1796
+	 * @return String usage
1797
+	 *
1798
+	 */
1799 1799
 	public function getSquawkUsage($squawk = '',$country = 'FR')
1800 1800
 	{
1801 1801
 		
@@ -1816,12 +1816,12 @@  discard block
 block discarded – undo
1816 1816
 	}
1817 1817
 
1818 1818
 	/**
1819
-	* Gets the airport icao from the iata
1820
-	*
1821
-	* @param String $airport_iata the iata code of the airport
1822
-	* @return String airport iata
1823
-	*
1824
-	*/
1819
+	 * Gets the airport icao from the iata
1820
+	 *
1821
+	 * @param String $airport_iata the iata code of the airport
1822
+	 * @return String airport iata
1823
+	 *
1824
+	 */
1825 1825
 	public function getAirportIcao($airport_iata = '')
1826 1826
 	{
1827 1827
 		
@@ -1841,14 +1841,14 @@  discard block
 block discarded – undo
1841 1841
 	}
1842 1842
 
1843 1843
 	/**
1844
-	* Gets the airport distance
1845
-	*
1846
-	* @param String $airport_icao the icao code of the airport
1847
-	* @param Float $latitude the latitude
1848
-	* @param Float $longitude the longitude
1849
-	* @return Float distance to the airport
1850
-	*
1851
-	*/
1844
+	 * Gets the airport distance
1845
+	 *
1846
+	 * @param String $airport_icao the icao code of the airport
1847
+	 * @param Float $latitude the latitude
1848
+	 * @param Float $longitude the longitude
1849
+	 * @return Float distance to the airport
1850
+	 *
1851
+	 */
1852 1852
 	public function getAirportDistance($airport_icao,$latitude,$longitude)
1853 1853
 	{
1854 1854
 		
@@ -1869,12 +1869,12 @@  discard block
 block discarded – undo
1869 1869
 	}
1870 1870
 	
1871 1871
 	/**
1872
-	* Gets the airport info based on the icao
1873
-	*
1874
-	* @param String $airport the icao code of the airport
1875
-	* @return Array airport information
1876
-	*
1877
-	*/
1872
+	 * Gets the airport info based on the icao
1873
+	 *
1874
+	 * @param String $airport the icao code of the airport
1875
+	 * @return Array airport information
1876
+	 *
1877
+	 */
1878 1878
 	public function getAllAirportInfo($airport = '')
1879 1879
 	{
1880 1880
 		
@@ -1920,12 +1920,12 @@  discard block
 block discarded – undo
1920 1920
 	}
1921 1921
 	
1922 1922
 	/**
1923
-	* Gets the airport info based on the country
1924
-	*
1925
-	* @param Array $countries Airports countries
1926
-	* @return Array airport information
1927
-	*
1928
-	*/
1923
+	 * Gets the airport info based on the country
1924
+	 *
1925
+	 * @param Array $countries Airports countries
1926
+	 * @return Array airport information
1927
+	 *
1928
+	 */
1929 1929
 	public function getAllAirportInfobyCountry($countries)
1930 1930
 	{
1931 1931
 		$lst_countries = '';
@@ -1963,12 +1963,12 @@  discard block
 block discarded – undo
1963 1963
 	}
1964 1964
 	
1965 1965
 	/**
1966
-	* Gets airports info based on the coord
1967
-	*
1968
-	* @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1969
-	* @return Array airport information
1970
-	*
1971
-	*/
1966
+	 * Gets airports info based on the coord
1967
+	 *
1968
+	 * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1969
+	 * @return Array airport information
1970
+	 *
1971
+	 */
1972 1972
 	public function getAllAirportInfobyCoord($coord)
1973 1973
 	{
1974 1974
 		global $globalDBdriver;
@@ -1999,12 +1999,12 @@  discard block
 block discarded – undo
1999 1999
 	}
2000 2000
 
2001 2001
 	/**
2002
-	* Gets waypoints info based on the coord
2003
-	*
2004
-	* @param Array $coord waypoints coord
2005
-	* @return Array airport information
2006
-	*
2007
-	*/
2002
+	 * Gets waypoints info based on the coord
2003
+	 *
2004
+	 * @param Array $coord waypoints coord
2005
+	 * @return Array airport information
2006
+	 *
2007
+	 */
2008 2008
 	public function getAllWaypointsInfobyCoord($coord)
2009 2009
 	{
2010 2010
 		if (is_array($coord)) {
@@ -2038,12 +2038,12 @@  discard block
 block discarded – undo
2038 2038
 	
2039 2039
 	
2040 2040
 	/**
2041
-	* Gets the airline info based on the icao code or iata code
2042
-	*
2043
-	* @param String $airline_icao the iata code of the airport
2044
-	* @return Array airport information
2045
-	*
2046
-	*/
2041
+	 * Gets the airline info based on the icao code or iata code
2042
+	 *
2043
+	 * @param String $airline_icao the iata code of the airport
2044
+	 * @return Array airport information
2045
+	 *
2046
+	 */
2047 2047
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2048 2048
 	{
2049 2049
 		global $globalUseRealAirlines;
@@ -2074,7 +2074,7 @@  discard block
 block discarded – undo
2074 2074
 			} else {
2075 2075
 				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2076 2076
 			}
2077
-                        /*
2077
+						/*
2078 2078
 			$airline_array = array();
2079 2079
 			$temp_array = array();
2080 2080
 		
@@ -2106,12 +2106,12 @@  discard block
 block discarded – undo
2106 2106
 	
2107 2107
 	
2108 2108
 	/**
2109
-	* Gets the aircraft info based on the aircraft type
2110
-	*
2111
-	* @param String $aircraft_type the aircraft type
2112
-	* @return Array aircraft information
2113
-	*
2114
-	*/
2109
+	 * Gets the aircraft info based on the aircraft type
2110
+	 *
2111
+	 * @param String $aircraft_type the aircraft type
2112
+	 * @return Array aircraft information
2113
+	 *
2114
+	 */
2115 2115
 	public function getAllAircraftInfo($aircraft_type)
2116 2116
 	{
2117 2117
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2143,12 +2143,12 @@  discard block
 block discarded – undo
2143 2143
 	}
2144 2144
 
2145 2145
 	/**
2146
-	* Gets the aircraft icao based on the aircraft name/type
2147
-	*
2148
-	* @param String $aircraft_type the aircraft type
2149
-	* @return String aircraft information
2150
-	*
2151
-	*/
2146
+	 * Gets the aircraft icao based on the aircraft name/type
2147
+	 *
2148
+	 * @param String $aircraft_type the aircraft type
2149
+	 * @return String aircraft information
2150
+	 *
2151
+	 */
2152 2152
 	public function getAircraftIcao($aircraft_type)
2153 2153
 	{
2154 2154
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2173,12 +2173,12 @@  discard block
 block discarded – undo
2173 2173
 	}
2174 2174
 	
2175 2175
 	/**
2176
-	* Gets the aircraft info based on the aircraft modes
2177
-	*
2178
-	* @param String $aircraft_modes the aircraft ident (hex)
2179
-	* @return String aircraft type
2180
-	*
2181
-	*/
2176
+	 * Gets the aircraft info based on the aircraft modes
2177
+	 *
2178
+	 * @param String $aircraft_modes the aircraft ident (hex)
2179
+	 * @return String aircraft type
2180
+	 *
2181
+	 */
2182 2182
 	public function getAllAircraftType($aircraft_modes)
2183 2183
 	{
2184 2184
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -2196,12 +2196,12 @@  discard block
 block discarded – undo
2196 2196
 	}
2197 2197
 
2198 2198
 	/**
2199
-	* Gets the aircraft info based on the aircraft registration
2200
-	*
2201
-	* @param String $registration the aircraft registration
2202
-	* @return String aircraft type
2203
-	*
2204
-	*/
2199
+	 * Gets the aircraft info based on the aircraft registration
2200
+	 *
2201
+	 * @param String $registration the aircraft registration
2202
+	 * @return String aircraft type
2203
+	 *
2204
+	 */
2205 2205
 	public function getAllAircraftTypeByRegistration($registration)
2206 2206
 	{
2207 2207
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2219,12 +2219,12 @@  discard block
 block discarded – undo
2219 2219
 	}
2220 2220
 
2221 2221
 	/**
2222
-	* Gets correct aircraft operator corde
2223
-	*
2224
-	* @param String $operator the aircraft operator code (callsign)
2225
-	* @return String aircraft operator code
2226
-	*
2227
-	*/
2222
+	 * Gets correct aircraft operator corde
2223
+	 *
2224
+	 * @param String $operator the aircraft operator code (callsign)
2225
+	 * @return String aircraft operator code
2226
+	 *
2227
+	 */
2228 2228
 	public function getOperator($operator)
2229 2229
 	{
2230 2230
 		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
@@ -2241,16 +2241,16 @@  discard block
 block discarded – undo
2241 2241
 	}
2242 2242
 
2243 2243
 	/**
2244
-	* Gets the aircraft route based on the aircraft callsign
2245
-	*
2246
-	* @param String $callsign the aircraft callsign
2247
-	* @return Array aircraft type
2248
-	*
2249
-	*/
2244
+	 * Gets the aircraft route based on the aircraft callsign
2245
+	 *
2246
+	 * @param String $callsign the aircraft callsign
2247
+	 * @return Array aircraft type
2248
+	 *
2249
+	 */
2250 2250
 	public function getRouteInfo($callsign)
2251 2251
 	{
2252 2252
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2253
-                if ($callsign == '') return array();
2253
+				if ($callsign == '') return array();
2254 2254
 		$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";
2255 2255
 		
2256 2256
 		$sth = $this->db->prepare($query);
@@ -2264,12 +2264,12 @@  discard block
 block discarded – undo
2264 2264
 	}
2265 2265
 	
2266 2266
 	/**
2267
-	* Gets the aircraft info based on the aircraft registration
2268
-	*
2269
-	* @param String $registration the aircraft registration
2270
-	* @return Array aircraft information
2271
-	*
2272
-	*/
2267
+	 * Gets the aircraft info based on the aircraft registration
2268
+	 *
2269
+	 * @param String $registration the aircraft registration
2270
+	 * @return Array aircraft information
2271
+	 *
2272
+	 */
2273 2273
 	public function getAircraftInfoByRegistration($registration)
2274 2274
 	{
2275 2275
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2296,12 +2296,12 @@  discard block
 block discarded – undo
2296 2296
 	}
2297 2297
 	
2298 2298
 	/**
2299
-	* Gets the aircraft owner & base based on the aircraft registration
2300
-	*
2301
-	* @param String $registration the aircraft registration
2302
-	* @return Array aircraft information
2303
-	*
2304
-	*/
2299
+	 * Gets the aircraft owner & base based on the aircraft registration
2300
+	 *
2301
+	 * @param String $registration the aircraft registration
2302
+	 * @return Array aircraft information
2303
+	 *
2304
+	 */
2305 2305
 	public function getAircraftOwnerByRegistration($registration)
2306 2306
 	{
2307 2307
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2318,11 +2318,11 @@  discard block
 block discarded – undo
2318 2318
 	
2319 2319
   
2320 2320
   /**
2321
-	* Gets all flights (but with only little info)
2322
-	*
2323
-	* @return Array basic flight information
2324
-	*
2325
-	*/
2321
+   * Gets all flights (but with only little info)
2322
+   *
2323
+   * @return Array basic flight information
2324
+   *
2325
+   */
2326 2326
 	public function getAllFlightsforSitemap()
2327 2327
 	{
2328 2328
 		//$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 ";
@@ -2330,7 +2330,7 @@  discard block
 block discarded – undo
2330 2330
 		
2331 2331
 		$sth = $this->db->prepare($query);
2332 2332
 		$sth->execute();
2333
-                  /*
2333
+				  /*
2334 2334
 		$flight_array = array();
2335 2335
 		$temp_array = array();
2336 2336
 		
@@ -2352,11 +2352,11 @@  discard block
 block discarded – undo
2352 2352
 	}
2353 2353
   
2354 2354
 	/**
2355
-	* Gets a list of all aircraft manufacturers
2356
-	*
2357
-	* @return Array list of aircraft types
2358
-	*
2359
-	*/
2355
+	 * Gets a list of all aircraft manufacturers
2356
+	 *
2357
+	 * @return Array list of aircraft types
2358
+	 *
2359
+	 */
2360 2360
 	public function getAllManufacturers()
2361 2361
 	{
2362 2362
 		/*
@@ -2385,11 +2385,11 @@  discard block
 block discarded – undo
2385 2385
   
2386 2386
   
2387 2387
   /**
2388
-	* Gets a list of all aircraft types
2389
-	*
2390
-	* @return Array list of aircraft types
2391
-	*
2392
-	*/
2388
+   * Gets a list of all aircraft types
2389
+   *
2390
+   * @return Array list of aircraft types
2391
+   *
2392
+   */
2393 2393
 	public function getAllAircraftTypes($filters = array())
2394 2394
 	{
2395 2395
 		/*
@@ -2422,11 +2422,11 @@  discard block
 block discarded – undo
2422 2422
 	
2423 2423
 	
2424 2424
 	/**
2425
-	* Gets a list of all aircraft registrations
2426
-	*
2427
-	* @return Array list of aircraft registrations
2428
-	*
2429
-	*/
2425
+	 * Gets a list of all aircraft registrations
2426
+	 *
2427
+	 * @return Array list of aircraft registrations
2428
+	 *
2429
+	 */
2430 2430
 	public function getAllAircraftRegistrations($filters = array())
2431 2431
 	{
2432 2432
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2451,12 +2451,12 @@  discard block
 block discarded – undo
2451 2451
 	}
2452 2452
 
2453 2453
 	/**
2454
-	* Gets all source name
2455
-	*
2456
-	* @param String type format of source
2457
-	* @return Array list of source name
2458
-	*
2459
-	*/
2454
+	 * Gets all source name
2455
+	 *
2456
+	 * @param String type format of source
2457
+	 * @return Array list of source name
2458
+	 *
2459
+	 */
2460 2460
 	public function getAllSourceName($type = '',$filters = array())
2461 2461
 	{
2462 2462
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2487,11 +2487,11 @@  discard block
 block discarded – undo
2487 2487
 
2488 2488
 
2489 2489
 	/**
2490
-	* Gets a list of all airline names
2491
-	*
2492
-	* @return Array list of airline names
2493
-	*
2494
-	*/
2490
+	 * Gets a list of all airline names
2491
+	 *
2492
+	 * @return Array list of airline names
2493
+	 *
2494
+	 */
2495 2495
 	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2496 2496
 	{
2497 2497
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2541,11 +2541,11 @@  discard block
 block discarded – undo
2541 2541
 	
2542 2542
 	
2543 2543
 	/**
2544
-	* Gets a list of all airline countries
2545
-	*
2546
-	* @return Array list of airline countries
2547
-	*
2548
-	*/
2544
+	 * Gets a list of all airline countries
2545
+	 *
2546
+	 * @return Array list of airline countries
2547
+	 *
2548
+	 */
2549 2549
 	public function getAllAirlineCountries($filters = array())
2550 2550
 	{
2551 2551
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2573,11 +2573,11 @@  discard block
 block discarded – undo
2573 2573
 	
2574 2574
 	
2575 2575
 	/**
2576
-	* Gets a list of all departure & arrival names
2577
-	*
2578
-	* @return Array list of airport names
2579
-	*
2580
-	*/
2576
+	 * Gets a list of all departure & arrival names
2577
+	 *
2578
+	 * @return Array list of airport names
2579
+	 *
2580
+	 */
2581 2581
 	public function getAllAirportNames($filters = array())
2582 2582
 	{
2583 2583
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2626,11 +2626,11 @@  discard block
 block discarded – undo
2626 2626
 	
2627 2627
 	
2628 2628
 	/**
2629
-	* Gets a list of all departure & arrival airport countries
2630
-	*
2631
-	* @return Array list of airport countries
2632
-	*
2633
-	*/
2629
+	 * Gets a list of all departure & arrival airport countries
2630
+	 *
2631
+	 * @return Array list of airport countries
2632
+	 *
2633
+	 */
2634 2634
 	public function getAllAirportCountries($filters = array())
2635 2635
 	{
2636 2636
 		$airport_array = array();
@@ -2678,11 +2678,11 @@  discard block
 block discarded – undo
2678 2678
 	
2679 2679
 	
2680 2680
 	/**
2681
-	* Gets a list of all countries (airline, departure airport & arrival airport)
2682
-	*
2683
-	* @return Array list of countries
2684
-	*
2685
-	*/
2681
+	 * Gets a list of all countries (airline, departure airport & arrival airport)
2682
+	 *
2683
+	 * @return Array list of countries
2684
+	 *
2685
+	 */
2686 2686
 	public function getAllCountries($filters = array())
2687 2687
 	{
2688 2688
 		$Connection= new Connection($this->db);
@@ -2759,11 +2759,11 @@  discard block
 block discarded – undo
2759 2759
 	
2760 2760
 	
2761 2761
 	/**
2762
-	* Gets a list of all idents/callsigns
2763
-	*
2764
-	* @return Array list of ident/callsign names
2765
-	*
2766
-	*/
2762
+	 * Gets a list of all idents/callsigns
2763
+	 *
2764
+	 * @return Array list of ident/callsign names
2765
+	 *
2766
+	 */
2767 2767
 	public function getAllIdents($filters = array())
2768 2768
 	{
2769 2769
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2787,9 +2787,9 @@  discard block
 block discarded – undo
2787 2787
 	}
2788 2788
 
2789 2789
 	/**
2790
-	* Get a list of flights from airport since 7 days
2791
-	* @return Array number, icao, name and city of airports
2792
-	*/
2790
+	 * Get a list of flights from airport since 7 days
2791
+	 * @return Array number, icao, name and city of airports
2792
+	 */
2793 2793
 
2794 2794
 	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
2795 2795
 		global $globalTimezone, $globalDBdriver;
@@ -2820,9 +2820,9 @@  discard block
 block discarded – undo
2820 2820
 	}
2821 2821
 
2822 2822
 	/**
2823
-	* Get a list of flights from airport since 7 days
2824
-	* @return Array number, icao, name and city of airports
2825
-	*/
2823
+	 * Get a list of flights from airport since 7 days
2824
+	 * @return Array number, icao, name and city of airports
2825
+	 */
2826 2826
 
2827 2827
 	public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') {
2828 2828
 		global $globalTimezone, $globalDBdriver;
@@ -2852,9 +2852,9 @@  discard block
 block discarded – undo
2852 2852
 	}
2853 2853
 
2854 2854
 	/**
2855
-	* Get a list of flights from detected airport since 7 days
2856
-	* @return Array number, icao, name and city of airports
2857
-	*/
2855
+	 * Get a list of flights from detected airport since 7 days
2856
+	 * @return Array number, icao, name and city of airports
2857
+	 */
2858 2858
 
2859 2859
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
2860 2860
 		global $globalTimezone, $globalDBdriver;
@@ -2892,9 +2892,9 @@  discard block
 block discarded – undo
2892 2892
 	}
2893 2893
 
2894 2894
 	/**
2895
-	* Get a list of flights from detected airport since 7 days
2896
-	* @return Array number, icao, name and city of airports
2897
-	*/
2895
+	 * Get a list of flights from detected airport since 7 days
2896
+	 * @return Array number, icao, name and city of airports
2897
+	 */
2898 2898
 
2899 2899
 	public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') {
2900 2900
 		global $globalTimezone, $globalDBdriver;
@@ -2936,9 +2936,9 @@  discard block
 block discarded – undo
2936 2936
 
2937 2937
 
2938 2938
 	/**
2939
-	* Get a list of flights to airport since 7 days
2940
-	* @return Array number, icao, name and city of airports
2941
-	*/
2939
+	 * Get a list of flights to airport since 7 days
2940
+	 * @return Array number, icao, name and city of airports
2941
+	 */
2942 2942
 
2943 2943
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
2944 2944
 		global $globalTimezone, $globalDBdriver;
@@ -2971,9 +2971,9 @@  discard block
 block discarded – undo
2971 2971
 
2972 2972
 
2973 2973
 	/**
2974
-	* Get a list of flights detected to airport since 7 days
2975
-	* @return Array number, icao, name and city of airports
2976
-	*/
2974
+	 * Get a list of flights detected to airport since 7 days
2975
+	 * @return Array number, icao, name and city of airports
2976
+	 */
2977 2977
 
2978 2978
 	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
2979 2979
 		global $globalTimezone, $globalDBdriver;
@@ -3014,9 +3014,9 @@  discard block
 block discarded – undo
3014 3014
 
3015 3015
 
3016 3016
 	/**
3017
-	* Get a list of flights to airport since 7 days
3018
-	* @return Array number, icao, name and city of airports
3019
-	*/
3017
+	 * Get a list of flights to airport since 7 days
3018
+	 * @return Array number, icao, name and city of airports
3019
+	 */
3020 3020
 
3021 3021
 	public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') {
3022 3022
 		global $globalTimezone, $globalDBdriver;
@@ -3048,9 +3048,9 @@  discard block
 block discarded – undo
3048 3048
 
3049 3049
 
3050 3050
 	/**
3051
-	* Get a list of flights detected to airport since 7 days
3052
-	* @return Array number, icao, name and city of airports
3053
-	*/
3051
+	 * Get a list of flights detected to airport since 7 days
3052
+	 * @return Array number, icao, name and city of airports
3053
+	 */
3054 3054
 
3055 3055
 	public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') {
3056 3056
 		global $globalTimezone, $globalDBdriver;
@@ -3094,11 +3094,11 @@  discard block
 block discarded – undo
3094 3094
 
3095 3095
 
3096 3096
 	/**
3097
-	* Gets a list of all dates
3098
-	*
3099
-	* @return Array list of date names
3100
-	*
3101
-	*/
3097
+	 * Gets a list of all dates
3098
+	 *
3099
+	 * @return Array list of date names
3100
+	 *
3101
+	 */
3102 3102
 	public function getAllDates()
3103 3103
 	{
3104 3104
 		global $globalTimezone, $globalDBdriver;
@@ -3139,11 +3139,11 @@  discard block
 block discarded – undo
3139 3139
 	
3140 3140
 	
3141 3141
 	/**
3142
-	* Gets all route combinations
3143
-	*
3144
-	* @return Array the route list
3145
-	*
3146
-	*/
3142
+	 * Gets all route combinations
3143
+	 *
3144
+	 * @return Array the route list
3145
+	 *
3146
+	 */
3147 3147
 	public function getAllRoutes()
3148 3148
 	{
3149 3149
 		$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 
@@ -3169,13 +3169,13 @@  discard block
 block discarded – undo
3169 3169
 	}
3170 3170
 
3171 3171
 	/**
3172
-	* Update ident spotter data
3173
-	*
3174
-	* @param String $flightaware_id the ID from flightaware
3175
-	* @param String $ident the flight ident
3176
-	* @return String success or false
3177
-	*
3178
-	*/	
3172
+	 * Update ident spotter data
3173
+	 *
3174
+	 * @param String $flightaware_id the ID from flightaware
3175
+	 * @param String $ident the flight ident
3176
+	 * @return String success or false
3177
+	 *
3178
+	 */	
3179 3179
 	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3180 3180
 	{
3181 3181
 		if (!is_numeric(substr($ident, 0, 3)))
@@ -3196,14 +3196,14 @@  discard block
 block discarded – undo
3196 3196
 		} else {
3197 3197
 			$airline_array = $this->getAllAirlineInfo("NA");
3198 3198
 		}
3199
-                $airline_name = $airline_array[0]['name'];
3200
-                $airline_icao = $airline_array[0]['icao'];
3201
-                $airline_country = $airline_array[0]['country'];
3202
-                $airline_type = $airline_array[0]['type'];
3199
+				$airline_name = $airline_array[0]['name'];
3200
+				$airline_icao = $airline_array[0]['icao'];
3201
+				$airline_country = $airline_array[0]['country'];
3202
+				$airline_type = $airline_array[0]['type'];
3203 3203
 
3204 3204
 
3205 3205
 		$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';
3206
-                $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);
3206
+				$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);
3207 3207
 
3208 3208
 		try {
3209 3209
 			$sth = $this->db->prepare($query);
@@ -3216,19 +3216,19 @@  discard block
 block discarded – undo
3216 3216
 
3217 3217
 	}
3218 3218
 	/**
3219
-	* Update latest spotter data
3220
-	*
3221
-	* @param String $flightaware_id the ID from flightaware
3222
-	* @param String $ident the flight ident
3223
-	* @param String $arrival_airport_icao the arrival airport
3224
-	* @return String success or false
3225
-	*
3226
-	*/	
3219
+	 * Update latest spotter data
3220
+	 *
3221
+	 * @param String $flightaware_id the ID from flightaware
3222
+	 * @param String $ident the flight ident
3223
+	 * @param String $arrival_airport_icao the arrival airport
3224
+	 * @return String success or false
3225
+	 *
3226
+	 */	
3227 3227
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3228 3228
 	{
3229 3229
 		if ($groundspeed == '') $groundspeed = NULL;
3230 3230
 		$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';
3231
-                $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);
3231
+				$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);
3232 3232
 
3233 3233
 		try {
3234 3234
 			$sth = $this->db->prepare($query);
@@ -3242,32 +3242,32 @@  discard block
 block discarded – undo
3242 3242
 	}
3243 3243
 
3244 3244
 	/**
3245
-	* Adds a new spotter data
3246
-	*
3247
-	* @param String $flightaware_id the ID from flightaware
3248
-	* @param String $ident the flight ident
3249
-	* @param String $aircraft_icao the aircraft type
3250
-	* @param String $departure_airport_icao the departure airport
3251
-	* @param String $arrival_airport_icao the arrival airport
3252
-	* @param String $latitude latitude of flight
3253
-	* @param String $longitude latitude of flight
3254
-	* @param String $waypoints waypoints of flight
3255
-	* @param String $altitude altitude of flight
3256
-	* @param String $heading heading of flight
3257
-	* @param String $groundspeed speed of flight
3258
-	* @param String $date date of flight
3259
-	* @param String $departure_airport_time departure time of flight
3260
-	* @param String $arrival_airport_time arrival time of flight
3261
-	* @param String $squawk squawk code of flight
3262
-	* @param String $route_stop route stop of flight
3263
-	* @param String $highlight highlight or not
3264
-	* @param String $ModeS ModesS code of flight
3265
-	* @param String $registration registration code of flight
3266
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
3267
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
3268
-	* @param String $verticalrate vertival rate of flight
3269
-	* @return String success or false
3270
-	*/
3245
+	 * Adds a new spotter data
3246
+	 *
3247
+	 * @param String $flightaware_id the ID from flightaware
3248
+	 * @param String $ident the flight ident
3249
+	 * @param String $aircraft_icao the aircraft type
3250
+	 * @param String $departure_airport_icao the departure airport
3251
+	 * @param String $arrival_airport_icao the arrival airport
3252
+	 * @param String $latitude latitude of flight
3253
+	 * @param String $longitude latitude of flight
3254
+	 * @param String $waypoints waypoints of flight
3255
+	 * @param String $altitude altitude of flight
3256
+	 * @param String $heading heading of flight
3257
+	 * @param String $groundspeed speed of flight
3258
+	 * @param String $date date of flight
3259
+	 * @param String $departure_airport_time departure time of flight
3260
+	 * @param String $arrival_airport_time arrival time of flight
3261
+	 * @param String $squawk squawk code of flight
3262
+	 * @param String $route_stop route stop of flight
3263
+	 * @param String $highlight highlight or not
3264
+	 * @param String $ModeS ModesS code of flight
3265
+	 * @param String $registration registration code of flight
3266
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
3267
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
3268
+	 * @param String $verticalrate vertival rate of flight
3269
+	 * @return String success or false
3270
+	 */
3271 3271
 	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 = '')
3272 3272
 	{
3273 3273
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
@@ -3481,8 +3481,8 @@  discard block
 block discarded – undo
3481 3481
     
3482 3482
 		if ($globalIVAO && $aircraft_icao != '')
3483 3483
 		{
3484
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3485
-            		else $airline_icao = '';
3484
+					if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3485
+					else $airline_icao = '';
3486 3486
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3487 3487
 			if (!isset($image_array[0]['registration']))
3488 3488
 			{
@@ -3513,52 +3513,52 @@  discard block
 block discarded – undo
3513 3513
 	
3514 3514
 		if (count($airline_array) == 0) 
3515 3515
 		{
3516
-                        $airline_array = $this->getAllAirlineInfo('NA');
3517
-                }
3518
-                if (count($aircraft_array) == 0) 
3519
-                {
3520
-                        $aircraft_array = $this->getAllAircraftInfo('NA');
3521
-                }
3522
-                if (count($departure_airport_array) == 0) 
3523
-                {
3524
-                        $departure_airport_array = $this->getAllAirportInfo('NA');
3525
-                }
3526
-                if (count($arrival_airport_array) == 0) 
3527
-                {
3528
-                        $arrival_airport_array = $this->getAllAirportInfo('NA');
3529
-                }
3530
-                if ($registration == '') $registration = 'NA';
3531
-                if ($latitude == '' && $longitude == '') {
3532
-            		$latitude = 0;
3533
-            		$longitude = 0;
3534
-            	}
3535
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3536
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3537
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3538
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3539
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3540
-                $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) 
3516
+						$airline_array = $this->getAllAirlineInfo('NA');
3517
+				}
3518
+				if (count($aircraft_array) == 0) 
3519
+				{
3520
+						$aircraft_array = $this->getAllAircraftInfo('NA');
3521
+				}
3522
+				if (count($departure_airport_array) == 0) 
3523
+				{
3524
+						$departure_airport_array = $this->getAllAirportInfo('NA');
3525
+				}
3526
+				if (count($arrival_airport_array) == 0) 
3527
+				{
3528
+						$arrival_airport_array = $this->getAllAirportInfo('NA');
3529
+				}
3530
+				if ($registration == '') $registration = 'NA';
3531
+				if ($latitude == '' && $longitude == '') {
3532
+					$latitude = 0;
3533
+					$longitude = 0;
3534
+				}
3535
+				if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3536
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3537
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3538
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3539
+				if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3540
+				$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) 
3541 3541
                 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)";
3542 3542
 
3543
-                $airline_name = $airline_array[0]['name'];
3544
-                $airline_icao = $airline_array[0]['icao'];
3545
-                $airline_country = $airline_array[0]['country'];
3546
-                $airline_type = $airline_array[0]['type'];
3543
+				$airline_name = $airline_array[0]['name'];
3544
+				$airline_icao = $airline_array[0]['icao'];
3545
+				$airline_country = $airline_array[0]['country'];
3546
+				$airline_type = $airline_array[0]['type'];
3547 3547
 		if ($airline_type == '') {
3548 3548
 			$timeelapsed = microtime(true);
3549 3549
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3550 3550
 			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3551 3551
 		}
3552 3552
 		if ($airline_type == null) $airline_type = '';
3553
-                $aircraft_type = $aircraft_array[0]['type'];
3554
-                $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3555
-                $departure_airport_name = $departure_airport_array[0]['name'];
3556
-                $departure_airport_city = $departure_airport_array[0]['city'];
3557
-                $departure_airport_country = $departure_airport_array[0]['country'];
3558
-                $arrival_airport_name = $arrival_airport_array[0]['name'];
3559
-                $arrival_airport_city = $arrival_airport_array[0]['city'];
3560
-                $arrival_airport_country = $arrival_airport_array[0]['country'];
3561
-                $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);
3553
+				$aircraft_type = $aircraft_array[0]['type'];
3554
+				$aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3555
+				$departure_airport_name = $departure_airport_array[0]['name'];
3556
+				$departure_airport_city = $departure_airport_array[0]['city'];
3557
+				$departure_airport_country = $departure_airport_array[0]['country'];
3558
+				$arrival_airport_name = $arrival_airport_array[0]['name'];
3559
+				$arrival_airport_city = $arrival_airport_array[0]['city'];
3560
+				$arrival_airport_country = $arrival_airport_array[0]['country'];
3561
+				$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);
3562 3562
 
3563 3563
 		try {
3564 3564
 		        
@@ -3566,7 +3566,7 @@  discard block
 block discarded – undo
3566 3566
 			$sth->execute($query_values);
3567 3567
 			$this->db = null;
3568 3568
 		} catch (PDOException $e) {
3569
-		    return "error : ".$e->getMessage();
3569
+			return "error : ".$e->getMessage();
3570 3570
 		}
3571 3571
 		
3572 3572
 		return "success";
@@ -3575,11 +3575,11 @@  discard block
 block discarded – undo
3575 3575
 	
3576 3576
   
3577 3577
 	/**
3578
-	* Gets the aircraft ident within the last hour
3579
-	*
3580
-	* @return String the ident
3581
-	*
3582
-	*/
3578
+	 * Gets the aircraft ident within the last hour
3579
+	 *
3580
+	 * @return String the ident
3581
+	 *
3582
+	 */
3583 3583
 	public function getIdentFromLastHour($ident)
3584 3584
 	{
3585 3585
 		global $globalDBdriver, $globalTimezone;
@@ -3595,11 +3595,11 @@  discard block
 block discarded – undo
3595 3595
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3596 3596
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
3597 3597
 			$query_data = array(':ident' => $ident);
3598
-    		}
3598
+			}
3599 3599
 		
3600 3600
 		$sth = $this->db->prepare($query);
3601 3601
 		$sth->execute($query_data);
3602
-    		$ident_result='';
3602
+			$ident_result='';
3603 3603
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3604 3604
 		{
3605 3605
 			$ident_result = $row['ident'];
@@ -3610,11 +3610,11 @@  discard block
 block discarded – undo
3610 3610
 	
3611 3611
 	
3612 3612
 	/**
3613
-	* Gets the aircraft data from the last 20 seconds
3614
-	*
3615
-	* @return Array the spotter data
3616
-	*
3617
-	*/
3613
+	 * Gets the aircraft data from the last 20 seconds
3614
+	 *
3615
+	 * @return Array the spotter data
3616
+	 *
3617
+	 */
3618 3618
 	public function getRealTimeData($q = '')
3619 3619
 	{
3620 3620
 		global $globalDBdriver;
@@ -3658,11 +3658,11 @@  discard block
 block discarded – undo
3658 3658
 	
3659 3659
 	
3660 3660
 	 /**
3661
-	* Gets all airlines that have flown over
3662
-	*
3663
-	* @return Array the airline list
3664
-	*
3665
-	*/
3661
+	  * Gets all airlines that have flown over
3662
+	  *
3663
+	  * @return Array the airline list
3664
+	  *
3665
+	  */
3666 3666
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3667 3667
 	{
3668 3668
 		global $globalDBdriver;
@@ -3676,7 +3676,7 @@  discard block
 block discarded – undo
3676 3676
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3677 3677
 			}
3678 3678
 		}
3679
-                if ($sincedate != '') {
3679
+				if ($sincedate != '') {
3680 3680
 			if ($globalDBdriver == 'mysql') {
3681 3681
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3682 3682
 			} else {
@@ -3703,26 +3703,26 @@  discard block
 block discarded – undo
3703 3703
 	}
3704 3704
 
3705 3705
 	 /**
3706
-	* Gets all pilots that have flown over
3707
-	*
3708
-	* @return Array the pilots list
3709
-	*
3710
-	*/
3706
+	  * Gets all pilots that have flown over
3707
+	  *
3708
+	  * @return Array the pilots list
3709
+	  *
3710
+	  */
3711 3711
 	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3712 3712
 	{
3713 3713
 		global $globalDBdriver;
3714 3714
 		$filter_query = $this->getFilter($filters,true,true);
3715 3715
 		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3716 3716
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3717
-                if ($olderthanmonths > 0) {
3718
-            		if ($globalDBdriver == 'mysql') {
3717
+				if ($olderthanmonths > 0) {
3718
+					if ($globalDBdriver == 'mysql') {
3719 3719
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3720 3720
 			} else {
3721 3721
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3722 3722
 			}
3723 3723
 		}
3724
-                if ($sincedate != '') {
3725
-            		if ($globalDBdriver == 'mysql') {
3724
+				if ($sincedate != '') {
3725
+					if ($globalDBdriver == 'mysql') {
3726 3726
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3727 3727
 			} else {
3728 3728
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3750,25 +3750,25 @@  discard block
 block discarded – undo
3750 3750
 	}
3751 3751
 	
3752 3752
 		 /**
3753
-	* Gets all pilots that have flown over
3754
-	*
3755
-	* @return Array the pilots list
3756
-	*
3757
-	*/
3753
+		  * Gets all pilots that have flown over
3754
+		  *
3755
+		  * @return Array the pilots list
3756
+		  *
3757
+		  */
3758 3758
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3759 3759
 	{
3760 3760
 		global $globalDBdriver;
3761 3761
 		$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
3762 3762
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
3763
-                if ($olderthanmonths > 0) {
3764
-            		if ($globalDBdriver == 'mysql') {
3763
+				if ($olderthanmonths > 0) {
3764
+					if ($globalDBdriver == 'mysql') {
3765 3765
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3766 3766
 			} else {
3767 3767
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3768 3768
 			}
3769 3769
 		}
3770
-                if ($sincedate != '') {
3771
-            		if ($globalDBdriver == 'mysql') {
3770
+				if ($sincedate != '') {
3771
+					if ($globalDBdriver == 'mysql') {
3772 3772
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3773 3773
 			} else {
3774 3774
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3797,26 +3797,26 @@  discard block
 block discarded – undo
3797 3797
 	}
3798 3798
 	
3799 3799
 	 /**
3800
-	* Gets all owner that have flown over
3801
-	*
3802
-	* @return Array the pilots list
3803
-	*
3804
-	*/
3800
+	  * Gets all owner that have flown over
3801
+	  *
3802
+	  * @return Array the pilots list
3803
+	  *
3804
+	  */
3805 3805
 	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3806 3806
 	{
3807 3807
 		global $globalDBdriver;
3808 3808
 		$filter_query = $this->getFilter($filters,true,true);
3809 3809
 		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3810 3810
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3811
-                if ($olderthanmonths > 0) {
3812
-            		if ($globalDBdriver == 'mysql') {
3811
+				if ($olderthanmonths > 0) {
3812
+					if ($globalDBdriver == 'mysql') {
3813 3813
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3814 3814
 			} else {
3815 3815
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3816 3816
 			}
3817 3817
 		}
3818
-                if ($sincedate != '') {
3819
-            		if ($globalDBdriver == 'mysql') {
3818
+				if ($sincedate != '') {
3819
+					if ($globalDBdriver == 'mysql') {
3820 3820
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3821 3821
 			} else {
3822 3822
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3842,26 +3842,26 @@  discard block
 block discarded – undo
3842 3842
 	}
3843 3843
 	
3844 3844
 	 /**
3845
-	* Gets all owner that have flown over
3846
-	*
3847
-	* @return Array the pilots list
3848
-	*
3849
-	*/
3845
+	  * Gets all owner that have flown over
3846
+	  *
3847
+	  * @return Array the pilots list
3848
+	  *
3849
+	  */
3850 3850
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3851 3851
 	{
3852 3852
 		global $globalDBdriver;
3853 3853
 		$filter_query = $this->getFilter($filters,true,true);
3854 3854
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3855 3855
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3856
-                if ($olderthanmonths > 0) {
3857
-            		if ($globalDBdriver == 'mysql') {
3856
+				if ($olderthanmonths > 0) {
3857
+					if ($globalDBdriver == 'mysql') {
3858 3858
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3859 3859
 			} else {
3860 3860
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3861 3861
 			}
3862 3862
 		}
3863
-                if ($sincedate != '') {
3864
-            		if ($globalDBdriver == 'mysql') {
3863
+				if ($sincedate != '') {
3864
+					if ($globalDBdriver == 'mysql') {
3865 3865
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3866 3866
 			} else {
3867 3867
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3888,11 +3888,11 @@  discard block
 block discarded – undo
3888 3888
 	}
3889 3889
 
3890 3890
 	/**
3891
-	* Gets all airlines that have flown over by aircraft
3892
-	*
3893
-	* @return Array the airline list
3894
-	*
3895
-	*/
3891
+	 * Gets all airlines that have flown over by aircraft
3892
+	 *
3893
+	 * @return Array the airline list
3894
+	 *
3895
+	 */
3896 3896
 	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
3897 3897
 	{
3898 3898
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3924,11 +3924,11 @@  discard block
 block discarded – undo
3924 3924
 
3925 3925
 
3926 3926
 	/**
3927
-	* Gets all airline countries that have flown over by aircraft
3928
-	*
3929
-	* @return Array the airline country list
3930
-	*
3931
-	*/
3927
+	 * Gets all airline countries that have flown over by aircraft
3928
+	 *
3929
+	 * @return Array the airline country list
3930
+	 *
3931
+	 */
3932 3932
 	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
3933 3933
 	{
3934 3934
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3960,11 +3960,11 @@  discard block
 block discarded – undo
3960 3960
 	
3961 3961
 	
3962 3962
 	/**
3963
-	* Gets all airlines that have flown over by airport
3964
-	*
3965
-	* @return Array the airline list
3966
-	*
3967
-	*/
3963
+	 * Gets all airlines that have flown over by airport
3964
+	 *
3965
+	 * @return Array the airline list
3966
+	 *
3967
+	 */
3968 3968
 	public function countAllAirlinesByAirport($airport_icao,$filters = array())
3969 3969
 	{
3970 3970
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -3995,11 +3995,11 @@  discard block
 block discarded – undo
3995 3995
 
3996 3996
 
3997 3997
 	/**
3998
-	* Gets all airline countries that have flown over by airport icao
3999
-	*
4000
-	* @return Array the airline country list
4001
-	*
4002
-	*/
3998
+	 * Gets all airline countries that have flown over by airport icao
3999
+	 *
4000
+	 * @return Array the airline country list
4001
+	 *
4002
+	 */
4003 4003
 	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4004 4004
 	{
4005 4005
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4029,11 +4029,11 @@  discard block
 block discarded – undo
4029 4029
 
4030 4030
 
4031 4031
 	/**
4032
-	* Gets all airlines that have flown over by aircraft manufacturer
4033
-	*
4034
-	* @return Array the airline list
4035
-	*
4036
-	*/
4032
+	 * Gets all airlines that have flown over by aircraft manufacturer
4033
+	 *
4034
+	 * @return Array the airline list
4035
+	 *
4036
+	 */
4037 4037
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4038 4038
 	{
4039 4039
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4064,11 +4064,11 @@  discard block
 block discarded – undo
4064 4064
 
4065 4065
 
4066 4066
 	/**
4067
-	* Gets all airline countries that have flown over by aircraft manufacturer
4068
-	*
4069
-	* @return Array the airline country list
4070
-	*
4071
-	*/
4067
+	 * Gets all airline countries that have flown over by aircraft manufacturer
4068
+	 *
4069
+	 * @return Array the airline country list
4070
+	 *
4071
+	 */
4072 4072
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4073 4073
 	{
4074 4074
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4097,11 +4097,11 @@  discard block
 block discarded – undo
4097 4097
 
4098 4098
 
4099 4099
 	/**
4100
-	* Gets all airlines that have flown over by date
4101
-	*
4102
-	* @return Array the airline list
4103
-	*
4104
-	*/
4100
+	 * Gets all airlines that have flown over by date
4101
+	 *
4102
+	 * @return Array the airline list
4103
+	 *
4104
+	 */
4105 4105
 	public function countAllAirlinesByDate($date,$filters = array())
4106 4106
 	{
4107 4107
 		global $globalTimezone, $globalDBdriver;
@@ -4145,11 +4145,11 @@  discard block
 block discarded – undo
4145 4145
 	
4146 4146
 	
4147 4147
 	/**
4148
-	* Gets all airline countries that have flown over by date
4149
-	*
4150
-	* @return Array the airline country list
4151
-	*
4152
-	*/
4148
+	 * Gets all airline countries that have flown over by date
4149
+	 *
4150
+	 * @return Array the airline country list
4151
+	 *
4152
+	 */
4153 4153
 	public function countAllAirlineCountriesByDate($date,$filters = array())
4154 4154
 	{
4155 4155
 		global $globalTimezone, $globalDBdriver;
@@ -4192,11 +4192,11 @@  discard block
 block discarded – undo
4192 4192
 
4193 4193
 
4194 4194
 	/**
4195
-	* Gets all airlines that have flown over by ident/callsign
4196
-	*
4197
-	* @return Array the airline list
4198
-	*
4199
-	*/
4195
+	 * Gets all airlines that have flown over by ident/callsign
4196
+	 *
4197
+	 * @return Array the airline list
4198
+	 *
4199
+	 */
4200 4200
 	public function countAllAirlinesByIdent($ident,$filters = array())
4201 4201
 	{
4202 4202
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4226,11 +4226,11 @@  discard block
 block discarded – undo
4226 4226
 	}
4227 4227
 
4228 4228
 	/**
4229
-	* Gets all airlines that have flown over by route
4230
-	*
4231
-	* @return Array the airline list
4232
-	*
4233
-	*/
4229
+	 * Gets all airlines that have flown over by route
4230
+	 *
4231
+	 * @return Array the airline list
4232
+	 *
4233
+	 */
4234 4234
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4235 4235
 	{
4236 4236
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4262,11 +4262,11 @@  discard block
 block discarded – undo
4262 4262
 	}
4263 4263
 
4264 4264
 	/**
4265
-	* Gets all airline countries that have flown over by route
4266
-	*
4267
-	* @return Array the airline country list
4268
-	*
4269
-	*/
4265
+	 * Gets all airline countries that have flown over by route
4266
+	 *
4267
+	 * @return Array the airline country list
4268
+	 *
4269
+	 */
4270 4270
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4271 4271
 	{
4272 4272
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4298,11 +4298,11 @@  discard block
 block discarded – undo
4298 4298
 
4299 4299
 
4300 4300
 	/**
4301
-	* Gets all airlines that have flown over by country
4302
-	*
4303
-	* @return Array the airline list
4304
-	*
4305
-	*/
4301
+	 * Gets all airlines that have flown over by country
4302
+	 *
4303
+	 * @return Array the airline list
4304
+	 *
4305
+	 */
4306 4306
 	public function countAllAirlinesByCountry($country,$filters = array())
4307 4307
 	{
4308 4308
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4332,11 +4332,11 @@  discard block
 block discarded – undo
4332 4332
 
4333 4333
 
4334 4334
 	/**
4335
-	* Gets all airline countries that have flown over by country
4336
-	*
4337
-	* @return Array the airline country list
4338
-	*
4339
-	*/
4335
+	 * Gets all airline countries that have flown over by country
4336
+	 *
4337
+	 * @return Array the airline country list
4338
+	 *
4339
+	 */
4340 4340
 	public function countAllAirlineCountriesByCountry($country,$filters = array())
4341 4341
 	{
4342 4342
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4365,11 +4365,11 @@  discard block
 block discarded – undo
4365 4365
 
4366 4366
 
4367 4367
 	/**
4368
-	* Gets all airlines countries
4369
-	*
4370
-	* @return Array the airline country list
4371
-	*
4372
-	*/
4368
+	 * Gets all airlines countries
4369
+	 *
4370
+	 * @return Array the airline country list
4371
+	 *
4372
+	 */
4373 4373
 	public function countAllAirlineCountries($limit = true, $filters = array())
4374 4374
 	{
4375 4375
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4395,11 +4395,11 @@  discard block
 block discarded – undo
4395 4395
 	}
4396 4396
 
4397 4397
 	/**
4398
-	* Gets all number of flight over countries
4399
-	*
4400
-	* @return Array the airline country list
4401
-	*
4402
-	*/
4398
+	 * Gets all number of flight over countries
4399
+	 *
4400
+	 * @return Array the airline country list
4401
+	 *
4402
+	 */
4403 4403
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4404 4404
 	{
4405 4405
 		global $globalDBdriver;
@@ -4421,15 +4421,15 @@  discard block
 block discarded – undo
4421 4421
 		$SpotterLive = new SpotterLive();
4422 4422
 		$filter_query = $SpotterLive->getFilter($filters,true,true);
4423 4423
 		$filter_query .= ' over_country IS NOT NULL';
4424
-                if ($olderthanmonths > 0) {
4424
+				if ($olderthanmonths > 0) {
4425 4425
 			if ($globalDBdriver == 'mysql') {
4426 4426
 				$filter_query .= ' AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
4427 4427
 			} else {
4428 4428
 				$filter_query .= " AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4429 4429
 			}
4430 4430
 		}
4431
-                if ($sincedate != '') {
4432
-            		if ($globalDBdriver == 'mysql') {
4431
+				if ($sincedate != '') {
4432
+					if ($globalDBdriver == 'mysql') {
4433 4433
 				$filter_query .= " AND spotter_live.date > '".$sincedate."' ";
4434 4434
 			} else {
4435 4435
 				$filter_query .= " AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4459,11 +4459,11 @@  discard block
 block discarded – undo
4459 4459
 	
4460 4460
 	
4461 4461
 	/**
4462
-	* Gets all aircraft types that have flown over
4463
-	*
4464
-	* @return Array the aircraft list
4465
-	*
4466
-	*/
4462
+	 * Gets all aircraft types that have flown over
4463
+	 *
4464
+	 * @return Array the aircraft list
4465
+	 *
4466
+	 */
4467 4467
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4468 4468
 	{
4469 4469
 		global $globalDBdriver;
@@ -4506,11 +4506,11 @@  discard block
 block discarded – undo
4506 4506
 	}
4507 4507
 
4508 4508
 	/**
4509
-	* Gets all aircraft types that have flown over by airline
4510
-	*
4511
-	* @return Array the aircraft list
4512
-	*
4513
-	*/
4509
+	 * Gets all aircraft types that have flown over by airline
4510
+	 *
4511
+	 * @return Array the aircraft list
4512
+	 *
4513
+	 */
4514 4514
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4515 4515
 	{
4516 4516
 		global $globalDBdriver;
@@ -4553,11 +4553,11 @@  discard block
 block discarded – undo
4553 4553
 	}
4554 4554
 
4555 4555
 	/**
4556
-	* Gets all aircraft types that have flown over by months
4557
-	*
4558
-	* @return Array the aircraft list
4559
-	*
4560
-	*/
4556
+	 * Gets all aircraft types that have flown over by months
4557
+	 *
4558
+	 * @return Array the aircraft list
4559
+	 *
4560
+	 */
4561 4561
 	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4562 4562
 	{
4563 4563
 		global $globalDBdriver;
@@ -4601,11 +4601,11 @@  discard block
 block discarded – undo
4601 4601
 
4602 4602
 
4603 4603
 	/**
4604
-	* Gets all aircraft registration that have flown over by aircaft icao
4605
-	*
4606
-	* @return Array the aircraft list
4607
-	*
4608
-	*/
4604
+	 * Gets all aircraft registration that have flown over by aircaft icao
4605
+	 *
4606
+	 * @return Array the aircraft list
4607
+	 *
4608
+	 */
4609 4609
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
4610 4610
 	{
4611 4611
 		$Image = new Image($this->db);
@@ -4644,11 +4644,11 @@  discard block
 block discarded – undo
4644 4644
 
4645 4645
 
4646 4646
 	/**
4647
-	* Gets all aircraft types that have flown over by airline icao
4648
-	*
4649
-	* @return Array the aircraft list
4650
-	*
4651
-	*/
4647
+	 * Gets all aircraft types that have flown over by airline icao
4648
+	 *
4649
+	 * @return Array the aircraft list
4650
+	 *
4651
+	 */
4652 4652
 	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
4653 4653
 	{
4654 4654
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4677,11 +4677,11 @@  discard block
 block discarded – undo
4677 4677
 
4678 4678
 
4679 4679
 	/**
4680
-	* Gets all aircraft registration that have flown over by airline icao
4681
-	*
4682
-	* @return Array the aircraft list
4683
-	*
4684
-	*/
4680
+	 * Gets all aircraft registration that have flown over by airline icao
4681
+	 *
4682
+	 * @return Array the aircraft list
4683
+	 *
4684
+	 */
4685 4685
 	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
4686 4686
 	{
4687 4687
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4719,11 +4719,11 @@  discard block
 block discarded – undo
4719 4719
 
4720 4720
 
4721 4721
 	/**
4722
-	* Gets all aircraft manufacturer that have flown over by airline icao
4723
-	*
4724
-	* @return Array the aircraft list
4725
-	*
4726
-	*/
4722
+	 * Gets all aircraft manufacturer that have flown over by airline icao
4723
+	 *
4724
+	 * @return Array the aircraft list
4725
+	 *
4726
+	 */
4727 4727
 	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
4728 4728
 	{
4729 4729
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4751,11 +4751,11 @@  discard block
 block discarded – undo
4751 4751
 
4752 4752
 
4753 4753
 	/**
4754
-	* Gets all aircraft types that have flown over by airline icao
4755
-	*
4756
-	* @return Array the aircraft list
4757
-	*
4758
-	*/
4754
+	 * Gets all aircraft types that have flown over by airline icao
4755
+	 *
4756
+	 * @return Array the aircraft list
4757
+	 *
4758
+	 */
4759 4759
 	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
4760 4760
 	{
4761 4761
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4784,11 +4784,11 @@  discard block
 block discarded – undo
4784 4784
 
4785 4785
 
4786 4786
 	/**
4787
-	* Gets all aircraft registration that have flown over by airport icao
4788
-	*
4789
-	* @return Array the aircraft list
4790
-	*
4791
-	*/
4787
+	 * Gets all aircraft registration that have flown over by airport icao
4788
+	 *
4789
+	 * @return Array the aircraft list
4790
+	 *
4791
+	 */
4792 4792
 	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
4793 4793
 	{
4794 4794
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4825,11 +4825,11 @@  discard block
 block discarded – undo
4825 4825
 	
4826 4826
 	
4827 4827
 	/**
4828
-	* Gets all aircraft manufacturer that have flown over by airport icao
4829
-	*
4830
-	* @return Array the aircraft list
4831
-	*
4832
-	*/
4828
+	 * Gets all aircraft manufacturer that have flown over by airport icao
4829
+	 *
4830
+	 * @return Array the aircraft list
4831
+	 *
4832
+	 */
4833 4833
 	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
4834 4834
 	{
4835 4835
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4855,11 +4855,11 @@  discard block
 block discarded – undo
4855 4855
 	}
4856 4856
 
4857 4857
 	/**
4858
-	* Gets all aircraft types that have flown over by aircraft manufacturer
4859
-	*
4860
-	* @return Array the aircraft list
4861
-	*
4862
-	*/
4858
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
4859
+	 *
4860
+	 * @return Array the aircraft list
4861
+	 *
4862
+	 */
4863 4863
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
4864 4864
 	{
4865 4865
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4886,11 +4886,11 @@  discard block
 block discarded – undo
4886 4886
 
4887 4887
 
4888 4888
 	/**
4889
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
4890
-	*
4891
-	* @return Array the aircraft list
4892
-	*
4893
-	*/
4889
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
4890
+	 *
4891
+	 * @return Array the aircraft list
4892
+	 *
4893
+	 */
4894 4894
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
4895 4895
 	{
4896 4896
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4926,11 +4926,11 @@  discard block
 block discarded – undo
4926 4926
 	}
4927 4927
 
4928 4928
 	/**
4929
-	* Gets all aircraft types that have flown over by date
4930
-	*
4931
-	* @return Array the aircraft list
4932
-	*
4933
-	*/
4929
+	 * Gets all aircraft types that have flown over by date
4930
+	 *
4931
+	 * @return Array the aircraft list
4932
+	 *
4933
+	 */
4934 4934
 	public function countAllAircraftTypesByDate($date,$filters = array())
4935 4935
 	{
4936 4936
 		global $globalTimezone, $globalDBdriver;
@@ -4972,11 +4972,11 @@  discard block
 block discarded – undo
4972 4972
 
4973 4973
 
4974 4974
 	/**
4975
-	* Gets all aircraft registration that have flown over by date
4976
-	*
4977
-	* @return Array the aircraft list
4978
-	*
4979
-	*/
4975
+	 * Gets all aircraft registration that have flown over by date
4976
+	 *
4977
+	 * @return Array the aircraft list
4978
+	 *
4979
+	 */
4980 4980
 	public function countAllAircraftRegistrationByDate($date,$filters = array())
4981 4981
 	{
4982 4982
 		global $globalTimezone, $globalDBdriver;
@@ -5027,11 +5027,11 @@  discard block
 block discarded – undo
5027 5027
 
5028 5028
 
5029 5029
 	/**
5030
-	* Gets all aircraft manufacturer that have flown over by date
5031
-	*
5032
-	* @return Array the aircraft manufacturer list
5033
-	*
5034
-	*/
5030
+	 * Gets all aircraft manufacturer that have flown over by date
5031
+	 *
5032
+	 * @return Array the aircraft manufacturer list
5033
+	 *
5034
+	 */
5035 5035
 	public function countAllAircraftManufacturerByDate($date,$filters = array())
5036 5036
 	{
5037 5037
 		global $globalTimezone, $globalDBdriver;
@@ -5073,11 +5073,11 @@  discard block
 block discarded – undo
5073 5073
 
5074 5074
 
5075 5075
 	/**
5076
-	* Gets all aircraft types that have flown over by ident/callsign
5077
-	*
5078
-	* @return Array the aircraft list
5079
-	*
5080
-	*/
5076
+	 * Gets all aircraft types that have flown over by ident/callsign
5077
+	 *
5078
+	 * @return Array the aircraft list
5079
+	 *
5080
+	 */
5081 5081
 	public function countAllAircraftTypesByIdent($ident,$filters = array())
5082 5082
 	{
5083 5083
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5106,11 +5106,11 @@  discard block
 block discarded – undo
5106 5106
 
5107 5107
 
5108 5108
 	/**
5109
-	* Gets all aircraft registration that have flown over by ident/callsign
5110
-	*
5111
-	* @return Array the aircraft list
5112
-	*
5113
-	*/
5109
+	 * Gets all aircraft registration that have flown over by ident/callsign
5110
+	 *
5111
+	 * @return Array the aircraft list
5112
+	 *
5113
+	 */
5114 5114
 	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5115 5115
 	{
5116 5116
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5150,11 +5150,11 @@  discard block
 block discarded – undo
5150 5150
 
5151 5151
 
5152 5152
 	/**
5153
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
5154
-	*
5155
-	* @return Array the aircraft manufacturer list
5156
-	*
5157
-	*/
5153
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
5154
+	 *
5155
+	 * @return Array the aircraft manufacturer list
5156
+	 *
5157
+	 */
5158 5158
 	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5159 5159
 	{
5160 5160
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5180,11 +5180,11 @@  discard block
 block discarded – undo
5180 5180
 
5181 5181
 
5182 5182
 	/**
5183
-	* Gets all aircraft types that have flown over by route
5184
-	*
5185
-	* @return Array the aircraft list
5186
-	*
5187
-	*/
5183
+	 * Gets all aircraft types that have flown over by route
5184
+	 *
5185
+	 * @return Array the aircraft list
5186
+	 *
5187
+	 */
5188 5188
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5189 5189
 	{
5190 5190
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5213,11 +5213,11 @@  discard block
 block discarded – undo
5213 5213
 	}
5214 5214
 
5215 5215
 	/**
5216
-	* Gets all aircraft registration that have flown over by route
5217
-	*
5218
-	* @return Array the aircraft list
5219
-	*
5220
-	*/
5216
+	 * Gets all aircraft registration that have flown over by route
5217
+	 *
5218
+	 * @return Array the aircraft list
5219
+	 *
5220
+	 */
5221 5221
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5222 5222
 	{
5223 5223
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5259,11 +5259,11 @@  discard block
 block discarded – undo
5259 5259
 	
5260 5260
 	
5261 5261
 	/**
5262
-	* Gets all aircraft manufacturer that have flown over by route
5263
-	*
5264
-	* @return Array the aircraft manufacturer list
5265
-	*
5266
-	*/
5262
+	 * Gets all aircraft manufacturer that have flown over by route
5263
+	 *
5264
+	 * @return Array the aircraft manufacturer list
5265
+	 *
5266
+	 */
5267 5267
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5268 5268
 	{
5269 5269
 		$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 types that have flown over by country
5301
-	*
5302
-	* @return Array the aircraft list
5303
-	*
5304
-	*/
5300
+	 * Gets all aircraft types that have flown over by country
5301
+	 *
5302
+	 * @return Array the aircraft list
5303
+	 *
5304
+	 */
5305 5305
 	public function countAllAircraftTypesByCountry($country,$filters = array())
5306 5306
 	{
5307 5307
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5332,11 +5332,11 @@  discard block
 block discarded – undo
5332 5332
 
5333 5333
 
5334 5334
 	/**
5335
-	* Gets all aircraft registration that have flown over by country
5336
-	*
5337
-	* @return Array the aircraft list
5338
-	*
5339
-	*/
5335
+	 * Gets all aircraft registration that have flown over by country
5336
+	 *
5337
+	 * @return Array the aircraft list
5338
+	 *
5339
+	 */
5340 5340
 	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5341 5341
 	{
5342 5342
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5376,11 +5376,11 @@  discard block
 block discarded – undo
5376 5376
 	
5377 5377
 	
5378 5378
 	/**
5379
-	* Gets all aircraft manufacturer that have flown over by country
5380
-	*
5381
-	* @return Array the aircraft manufacturer list
5382
-	*
5383
-	*/
5379
+	 * Gets all aircraft manufacturer that have flown over by country
5380
+	 *
5381
+	 * @return Array the aircraft manufacturer list
5382
+	 *
5383
+	 */
5384 5384
 	public function countAllAircraftManufacturerByCountry($country,$filters = array())
5385 5385
 	{
5386 5386
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5411,17 +5411,17 @@  discard block
 block discarded – undo
5411 5411
 	
5412 5412
 	
5413 5413
 	/**
5414
-	* Gets all aircraft manufacturers that have flown over
5415
-	*
5416
-	* @return Array the aircraft list
5417
-	*
5418
-	*/
5414
+	 * Gets all aircraft manufacturers that have flown over
5415
+	 *
5416
+	 * @return Array the aircraft list
5417
+	 *
5418
+	 */
5419 5419
 	public function countAllAircraftManufacturers($filters = array())
5420 5420
 	{
5421 5421
 		$filter_query = $this->getFilter($filters,true,true);
5422 5422
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5423 5423
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5424
-                $query .= " GROUP BY spotter_output.aircraft_manufacturer
5424
+				$query .= " GROUP BY spotter_output.aircraft_manufacturer
5425 5425
 					ORDER BY aircraft_manufacturer_count DESC
5426 5426
 					LIMIT 10";
5427 5427
       
@@ -5446,11 +5446,11 @@  discard block
 block discarded – undo
5446 5446
 	
5447 5447
 	
5448 5448
 	/**
5449
-	* Gets all aircraft registrations that have flown over
5450
-	*
5451
-	* @return Array the aircraft list
5452
-	*
5453
-	*/
5449
+	 * Gets all aircraft registrations that have flown over
5450
+	 *
5451
+	 * @return Array the aircraft list
5452
+	 *
5453
+	 */
5454 5454
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5455 5455
 	{
5456 5456
 		global $globalDBdriver;
@@ -5458,15 +5458,15 @@  discard block
 block discarded – undo
5458 5458
 		$filter_query = $this->getFilter($filters,true,true);
5459 5459
 		$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    
5460 5460
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5461
-                if ($olderthanmonths > 0) {
5462
-            		if ($globalDBdriver == 'mysql') {
5461
+				if ($olderthanmonths > 0) {
5462
+					if ($globalDBdriver == 'mysql') {
5463 5463
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5464 5464
 			} else {
5465 5465
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5466 5466
 			}
5467 5467
 		}
5468
-                if ($sincedate != '') {
5469
-            		if ($globalDBdriver == 'mysql') {
5468
+				if ($sincedate != '') {
5469
+					if ($globalDBdriver == 'mysql') {
5470 5470
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5471 5471
 			} else {
5472 5472
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5475,7 +5475,7 @@  discard block
 block discarded – undo
5475 5475
 
5476 5476
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5477 5477
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5478
-                $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5478
+				$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5479 5479
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5480 5480
 		
5481 5481
 		$sth = $this->db->prepare($query);
@@ -5506,11 +5506,11 @@  discard block
 block discarded – undo
5506 5506
 
5507 5507
 
5508 5508
 	/**
5509
-	* Gets all aircraft registrations that have flown over
5510
-	*
5511
-	* @return Array the aircraft list
5512
-	*
5513
-	*/
5509
+	 * Gets all aircraft registrations that have flown over
5510
+	 *
5511
+	 * @return Array the aircraft list
5512
+	 *
5513
+	 */
5514 5514
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5515 5515
 	{
5516 5516
 		global $globalDBdriver;
@@ -5518,15 +5518,15 @@  discard block
 block discarded – undo
5518 5518
 		$Image = new Image($this->db);
5519 5519
 		$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    
5520 5520
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5521
-                if ($olderthanmonths > 0) {
5522
-            		if ($globalDBdriver == 'mysql') {
5521
+				if ($olderthanmonths > 0) {
5522
+					if ($globalDBdriver == 'mysql') {
5523 5523
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5524 5524
 			} else {
5525 5525
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5526 5526
 			}
5527 5527
 		}
5528
-                if ($sincedate != '') {
5529
-            		if ($globalDBdriver == 'mysql') {
5528
+				if ($sincedate != '') {
5529
+					if ($globalDBdriver == 'mysql') {
5530 5530
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5531 5531
 			} else {
5532 5532
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5535,7 +5535,7 @@  discard block
 block discarded – undo
5535 5535
 
5536 5536
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5537 5537
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5538
-                $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";
5538
+				$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";
5539 5539
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5540 5540
 		
5541 5541
 		$sth = $this->db->prepare($query);
@@ -5567,35 +5567,35 @@  discard block
 block discarded – undo
5567 5567
 	
5568 5568
 	
5569 5569
 	/**
5570
-	* Gets all departure airports of the airplanes that have flown over
5571
-	*
5572
-	* @return Array the airport list
5573
-	*
5574
-	*/
5570
+	 * Gets all departure airports of the airplanes that have flown over
5571
+	 *
5572
+	 * @return Array the airport list
5573
+	 *
5574
+	 */
5575 5575
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5576 5576
 	{
5577 5577
 		global $globalDBdriver;
5578 5578
 		$filter_query = $this->getFilter($filters,true,true);
5579 5579
 		$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 
5580 5580
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA'";
5581
-                if ($olderthanmonths > 0) {
5582
-            		if ($globalDBdriver == 'mysql') {
5581
+				if ($olderthanmonths > 0) {
5582
+					if ($globalDBdriver == 'mysql') {
5583 5583
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5584 5584
 			} else {
5585 5585
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5586 5586
 			}
5587
-                }
5588
-                if ($sincedate != '') {
5589
-            		if ($globalDBdriver == 'mysql') {
5587
+				}
5588
+				if ($sincedate != '') {
5589
+					if ($globalDBdriver == 'mysql') {
5590 5590
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5591 5591
 			} else {
5592 5592
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5593 5593
 			}
5594 5594
 		}
5595 5595
 
5596
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5597
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5598
-                $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5596
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5597
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5598
+				$query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5599 5599
 				ORDER BY airport_departure_icao_count DESC";
5600 5600
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5601 5601
       
@@ -5619,35 +5619,35 @@  discard block
 block discarded – undo
5619 5619
 	}
5620 5620
 
5621 5621
 	/**
5622
-	* Gets all departure airports of the airplanes that have flown over
5623
-	*
5624
-	* @return Array the airport list
5625
-	*
5626
-	*/
5622
+	 * Gets all departure airports of the airplanes that have flown over
5623
+	 *
5624
+	 * @return Array the airport list
5625
+	 *
5626
+	 */
5627 5627
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5628 5628
 	{
5629 5629
 		global $globalDBdriver;
5630 5630
 		$filter_query = $this->getFilter($filters,true,true);
5631 5631
 		$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 
5632 5632
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' ";
5633
-                if ($olderthanmonths > 0) {
5634
-            		if ($globalDBdriver == 'mysql') {
5633
+				if ($olderthanmonths > 0) {
5634
+					if ($globalDBdriver == 'mysql') {
5635 5635
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5636 5636
 			} else {
5637 5637
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5638 5638
 			}
5639
-                }
5640
-                if ($sincedate != '') {
5641
-            		if ($globalDBdriver == 'mysql') {
5639
+				}
5640
+				if ($sincedate != '') {
5641
+					if ($globalDBdriver == 'mysql') {
5642 5642
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5643 5643
 			} else {
5644 5644
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5645 5645
 			}
5646 5646
 		}
5647 5647
 
5648
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5649
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5650
-                $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
5648
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5649
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5650
+				$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
5651 5651
 				ORDER BY airport_departure_icao_count DESC";
5652 5652
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5653 5653
       
@@ -5672,37 +5672,37 @@  discard block
 block discarded – undo
5672 5672
 	}
5673 5673
 
5674 5674
 	/**
5675
-	* Gets all detected departure airports of the airplanes that have flown over
5676
-	*
5677
-	* @return Array the airport list
5678
-	*
5679
-	*/
5675
+	 * Gets all detected departure airports of the airplanes that have flown over
5676
+	 *
5677
+	 * @return Array the airport list
5678
+	 *
5679
+	 */
5680 5680
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5681 5681
 	{
5682 5682
 		global $globalDBdriver;
5683 5683
 		$filter_query = $this->getFilter($filters,true,true);
5684 5684
 		$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
5685 5685
 				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";
5686
-                if ($olderthanmonths > 0) {
5687
-            		if ($globalDBdriver == 'mysql') {
5686
+				if ($olderthanmonths > 0) {
5687
+					if ($globalDBdriver == 'mysql') {
5688 5688
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5689 5689
 			} else {
5690 5690
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5691 5691
 			}
5692
-                }
5693
-                if ($sincedate != '') {
5694
-            		if ($globalDBdriver == 'mysql') {
5692
+				}
5693
+				if ($sincedate != '') {
5694
+					if ($globalDBdriver == 'mysql') {
5695 5695
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5696 5696
 			} else {
5697 5697
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5698 5698
 			}
5699 5699
 		}
5700
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5701
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5702
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5700
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5701
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5702
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5703 5703
 				ORDER BY airport_departure_icao_count DESC";
5704 5704
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5705
-    		//echo $query;
5705
+			//echo $query;
5706 5706
 		$sth = $this->db->prepare($query);
5707 5707
 		$sth->execute();
5708 5708
       
@@ -5723,35 +5723,35 @@  discard block
 block discarded – undo
5723 5723
 	}
5724 5724
 	
5725 5725
 	/**
5726
-	* Gets all detected departure airports of the airplanes that have flown over
5727
-	*
5728
-	* @return Array the airport list
5729
-	*
5730
-	*/
5726
+	 * Gets all detected departure airports of the airplanes that have flown over
5727
+	 *
5728
+	 * @return Array the airport list
5729
+	 *
5730
+	 */
5731 5731
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5732 5732
 	{
5733 5733
 		global $globalDBdriver;
5734 5734
 		$filter_query = $this->getFilter($filters,true,true);
5735 5735
 		$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
5736 5736
 				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 ";
5737
-                if ($olderthanmonths > 0) {
5738
-            		if ($globalDBdriver == 'mysql') {
5737
+				if ($olderthanmonths > 0) {
5738
+					if ($globalDBdriver == 'mysql') {
5739 5739
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5740 5740
 			} else {
5741 5741
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5742 5742
 			}
5743
-                }
5744
-                if ($sincedate != '') {
5745
-            		if ($globalDBdriver == 'mysql') {
5743
+				}
5744
+				if ($sincedate != '') {
5745
+					if ($globalDBdriver == 'mysql') {
5746 5746
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5747 5747
 			} else {
5748 5748
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
5749 5749
 			}
5750 5750
 		}
5751 5751
 
5752
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5753
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5754
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5752
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5753
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5754
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5755 5755
 				ORDER BY airport_departure_icao_count DESC";
5756 5756
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5757 5757
       
@@ -5776,11 +5776,11 @@  discard block
 block discarded – undo
5776 5776
 	}	
5777 5777
 	
5778 5778
 	/**
5779
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
5780
-	*
5781
-	* @return Array the airport list
5782
-	*
5783
-	*/
5779
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
5780
+	 *
5781
+	 * @return Array the airport list
5782
+	 *
5783
+	 */
5784 5784
 	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
5785 5785
 	{
5786 5786
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5814,11 +5814,11 @@  discard block
 block discarded – undo
5814 5814
 	
5815 5815
 	
5816 5816
 	/**
5817
-	* Gets all departure airports by country 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 by country 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 countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
5823 5823
 	{
5824 5824
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5849,11 +5849,11 @@  discard block
 block discarded – undo
5849 5849
 	
5850 5850
 	
5851 5851
 	/**
5852
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5853
-	*
5854
-	* @return Array the airport list
5855
-	*
5856
-	*/
5852
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5853
+	 *
5854
+	 * @return Array the airport list
5855
+	 *
5856
+	 */
5857 5857
 	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
5858 5858
 	{
5859 5859
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5886,11 +5886,11 @@  discard block
 block discarded – undo
5886 5886
 	
5887 5887
 	
5888 5888
 	/**
5889
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5890
-	*
5891
-	* @return Array the airport list
5892
-	*
5893
-	*/
5889
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5890
+	 *
5891
+	 * @return Array the airport list
5892
+	 *
5893
+	 */
5894 5894
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
5895 5895
 	{
5896 5896
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5920,11 +5920,11 @@  discard block
 block discarded – undo
5920 5920
 	
5921 5921
 	
5922 5922
 	/**
5923
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5924
-	*
5925
-	* @return Array the airport list
5926
-	*
5927
-	*/
5923
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5924
+	 *
5925
+	 * @return Array the airport list
5926
+	 *
5927
+	 */
5928 5928
 	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
5929 5929
 	{
5930 5930
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5957,11 +5957,11 @@  discard block
 block discarded – undo
5957 5957
 	
5958 5958
 	
5959 5959
 	/**
5960
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
5961
-	*
5962
-	* @return Array the airport list
5963
-	*
5964
-	*/
5960
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
5961
+	 *
5962
+	 * @return Array the airport list
5963
+	 *
5964
+	 */
5965 5965
 	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
5966 5966
 	{
5967 5967
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5991,11 +5991,11 @@  discard block
 block discarded – undo
5991 5991
 	
5992 5992
 	
5993 5993
 	/**
5994
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
5995
-	*
5996
-	* @return Array the airport list
5997
-	*
5998
-	*/
5994
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
5995
+	 *
5996
+	 * @return Array the airport list
5997
+	 *
5998
+	 */
5999 5999
 	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
6000 6000
 	{
6001 6001
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6028,11 +6028,11 @@  discard block
 block discarded – undo
6028 6028
 	
6029 6029
 	
6030 6030
 	/**
6031
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
6032
-	*
6033
-	* @return Array the airport list
6034
-	*
6035
-	*/
6031
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
6032
+	 *
6033
+	 * @return Array the airport list
6034
+	 *
6035
+	 */
6036 6036
 	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
6037 6037
 	{
6038 6038
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6063,11 +6063,11 @@  discard block
 block discarded – undo
6063 6063
 	
6064 6064
 	
6065 6065
 	/**
6066
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
6067
-	*
6068
-	* @return Array the airport list
6069
-	*
6070
-	*/
6066
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
6067
+	 *
6068
+	 * @return Array the airport list
6069
+	 *
6070
+	 */
6071 6071
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6072 6072
 	{
6073 6073
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6100,11 +6100,11 @@  discard block
 block discarded – undo
6100 6100
 	
6101 6101
 	
6102 6102
 	/**
6103
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
6104
-	*
6105
-	* @return Array the airport list
6106
-	*
6107
-	*/
6103
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
6104
+	 *
6105
+	 * @return Array the airport list
6106
+	 *
6107
+	 */
6108 6108
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6109 6109
 	{
6110 6110
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6134,11 +6134,11 @@  discard block
 block discarded – undo
6134 6134
 	
6135 6135
 	
6136 6136
 	/**
6137
-	* Gets all departure airports of the airplanes that have flown over based on a date
6138
-	*
6139
-	* @return Array the airport list
6140
-	*
6141
-	*/
6137
+	 * Gets all departure airports of the airplanes that have flown over based on a date
6138
+	 *
6139
+	 * @return Array the airport list
6140
+	 *
6141
+	 */
6142 6142
 	public function countAllDepartureAirportsByDate($date,$filters = array())
6143 6143
 	{
6144 6144
 		global $globalTimezone, $globalDBdriver;
@@ -6184,11 +6184,11 @@  discard block
 block discarded – undo
6184 6184
 	
6185 6185
 	
6186 6186
 	/**
6187
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
6188
-	*
6189
-	* @return Array the airport list
6190
-	*
6191
-	*/
6187
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
6188
+	 *
6189
+	 * @return Array the airport list
6190
+	 *
6191
+	 */
6192 6192
 	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6193 6193
 	{
6194 6194
 		global $globalTimezone, $globalDBdriver;
@@ -6231,11 +6231,11 @@  discard block
 block discarded – undo
6231 6231
 	
6232 6232
 	
6233 6233
 	/**
6234
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6235
-	*
6236
-	* @return Array the airport list
6237
-	*
6238
-	*/
6234
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6235
+	 *
6236
+	 * @return Array the airport list
6237
+	 *
6238
+	 */
6239 6239
 	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6240 6240
 	{
6241 6241
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6269,11 +6269,11 @@  discard block
 block discarded – undo
6269 6269
 	
6270 6270
 	
6271 6271
 	/**
6272
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6273
-	*
6274
-	* @return Array the airport list
6275
-	*
6276
-	*/
6272
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6273
+	 *
6274
+	 * @return Array the airport list
6275
+	 *
6276
+	 */
6277 6277
 	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
6278 6278
 	{
6279 6279
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6304,11 +6304,11 @@  discard block
 block discarded – undo
6304 6304
 	
6305 6305
 	
6306 6306
 	/**
6307
-	* Gets all departure airports of the airplanes that have flown over based on a country
6308
-	*
6309
-	* @return Array the airport list
6310
-	*
6311
-	*/
6307
+	 * Gets all departure airports of the airplanes that have flown over based on a country
6308
+	 *
6309
+	 * @return Array the airport list
6310
+	 *
6311
+	 */
6312 6312
 	public function countAllDepartureAirportsByCountry($country,$filters = array())
6313 6313
 	{
6314 6314
 		$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 by country of the airplanes that have flown over based on an aircraft icao
6346
-	*
6347
-	* @return Array the airport list
6348
-	*
6349
-	*/
6345
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6346
+	 *
6347
+	 * @return Array the airport list
6348
+	 *
6349
+	 */
6350 6350
 	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
6351 6351
 	{
6352 6352
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6376,40 +6376,40 @@  discard block
 block discarded – undo
6376 6376
 	
6377 6377
 
6378 6378
 	/**
6379
-	* Gets all arrival airports of the airplanes that have flown over
6380
-	*
6381
-	* @return Array the airport list
6382
-	*
6383
-	*/
6379
+	 * Gets all arrival airports of the airplanes that have flown over
6380
+	 *
6381
+	 * @return Array the airport list
6382
+	 *
6383
+	 */
6384 6384
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6385 6385
 	{
6386 6386
 		global $globalDBdriver;
6387 6387
 		$filter_query = $this->getFilter($filters,true,true);
6388 6388
 		$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 
6389 6389
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
6390
-                if ($olderthanmonths > 0) {
6391
-            		if ($globalDBdriver == 'mysql') {
6390
+				if ($olderthanmonths > 0) {
6391
+					if ($globalDBdriver == 'mysql') {
6392 6392
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6393 6393
 			} else {
6394 6394
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6395 6395
 			}
6396
-                if ($sincedate != '') {
6397
-            		if ($globalDBdriver == 'mysql') {
6396
+				if ($sincedate != '') {
6397
+					if ($globalDBdriver == 'mysql') {
6398 6398
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6399 6399
 			} else {
6400 6400
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6401 6401
 			}
6402 6402
 		}
6403
-            		if ($globalDBdriver == 'mysql') {
6403
+					if ($globalDBdriver == 'mysql') {
6404 6404
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6405 6405
 			} else {
6406 6406
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6407 6407
 			}
6408 6408
 		}
6409 6409
 
6410
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6411
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6412
-                $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6410
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6411
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6412
+				$query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6413 6413
 					ORDER BY airport_arrival_icao_count DESC";
6414 6414
 		if ($limit) $query .= " LIMIT 10";
6415 6415
       
@@ -6438,40 +6438,40 @@  discard block
 block discarded – undo
6438 6438
 	}
6439 6439
 
6440 6440
 	/**
6441
-	* Gets all arrival airports of the airplanes that have flown over
6442
-	*
6443
-	* @return Array the airport list
6444
-	*
6445
-	*/
6441
+	 * Gets all arrival airports of the airplanes that have flown over
6442
+	 *
6443
+	 * @return Array the airport list
6444
+	 *
6445
+	 */
6446 6446
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6447 6447
 	{
6448 6448
 		global $globalDBdriver;
6449 6449
 		$filter_query = $this->getFilter($filters,true,true);
6450 6450
 		$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 
6451 6451
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' ";
6452
-                if ($olderthanmonths > 0) {
6453
-            		if ($globalDBdriver == 'mysql') {
6452
+				if ($olderthanmonths > 0) {
6453
+					if ($globalDBdriver == 'mysql') {
6454 6454
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6455 6455
 			} else {
6456 6456
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6457 6457
 			}
6458
-                if ($sincedate != '') {
6459
-            		if ($globalDBdriver == 'mysql') {
6458
+				if ($sincedate != '') {
6459
+					if ($globalDBdriver == 'mysql') {
6460 6460
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6461 6461
 			} else {
6462 6462
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6463 6463
 			}
6464 6464
 		}
6465
-            		if ($globalDBdriver == 'mysql') {
6465
+					if ($globalDBdriver == 'mysql') {
6466 6466
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6467 6467
 			} else {
6468 6468
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6469 6469
 			}
6470 6470
 		}
6471 6471
 
6472
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6473
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6474
-                $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
6472
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6473
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6474
+				$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
6475 6475
 					ORDER BY airport_arrival_icao_count DESC";
6476 6476
 		if ($limit) $query .= " LIMIT 10";
6477 6477
       
@@ -6502,39 +6502,39 @@  discard block
 block discarded – undo
6502 6502
 
6503 6503
 
6504 6504
 	/**
6505
-	* Gets all detected arrival airports of the airplanes that have flown over
6506
-	*
6507
-	* @return Array the airport list
6508
-	*
6509
-	*/
6505
+	 * Gets all detected arrival airports of the airplanes that have flown over
6506
+	 *
6507
+	 * @return Array the airport list
6508
+	 *
6509
+	 */
6510 6510
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6511 6511
 	{
6512 6512
 		global $globalDBdriver;
6513 6513
 		$filter_query = $this->getFilter($filters,true,true);
6514 6514
 		$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 
6515 6515
 			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";
6516
-                if ($olderthanmonths > 0) {
6517
-            		if ($globalDBdriver == 'mysql') {
6516
+				if ($olderthanmonths > 0) {
6517
+					if ($globalDBdriver == 'mysql') {
6518 6518
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6519 6519
 			} else {
6520 6520
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6521 6521
 			}
6522
-                if ($sincedate != '') {
6523
-            		if ($globalDBdriver == 'mysql') {
6522
+				if ($sincedate != '') {
6523
+					if ($globalDBdriver == 'mysql') {
6524 6524
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6525 6525
 			} else {
6526 6526
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6527 6527
 			}
6528 6528
 		}
6529
-            		if ($globalDBdriver == 'mysql') {
6529
+					if ($globalDBdriver == 'mysql') {
6530 6530
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6531 6531
 			} else {
6532 6532
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6533 6533
 			}
6534 6534
 		}
6535
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6536
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6537
-                $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6535
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6536
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6537
+				$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6538 6538
 					ORDER BY airport_arrival_icao_count DESC";
6539 6539
 		if ($limit) $query .= " LIMIT 10";
6540 6540
       
@@ -6563,40 +6563,40 @@  discard block
 block discarded – undo
6563 6563
 	}
6564 6564
 	
6565 6565
 	/**
6566
-	* Gets all detected arrival airports of the airplanes that have flown over
6567
-	*
6568
-	* @return Array the airport list
6569
-	*
6570
-	*/
6566
+	 * Gets all detected arrival airports of the airplanes that have flown over
6567
+	 *
6568
+	 * @return Array the airport list
6569
+	 *
6570
+	 */
6571 6571
 	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6572 6572
 	{
6573 6573
 		global $globalDBdriver;
6574 6574
 		$filter_query = $this->getFilter($filters,true,true);
6575 6575
 		$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 
6576 6576
 			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 ";
6577
-                if ($olderthanmonths > 0) {
6578
-            		if ($globalDBdriver == 'mysql') {
6577
+				if ($olderthanmonths > 0) {
6578
+					if ($globalDBdriver == 'mysql') {
6579 6579
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6580 6580
 			} else {
6581 6581
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6582 6582
 			}
6583
-                if ($sincedate != '') {
6584
-            		if ($globalDBdriver == 'mysql') {
6583
+				if ($sincedate != '') {
6584
+					if ($globalDBdriver == 'mysql') {
6585 6585
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6586 6586
 			} else {
6587 6587
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6588 6588
 			}
6589 6589
 		}
6590
-            		if ($globalDBdriver == 'mysql') {
6590
+					if ($globalDBdriver == 'mysql') {
6591 6591
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6592 6592
 			} else {
6593 6593
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6594 6594
 			}
6595 6595
 		}
6596 6596
 
6597
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6598
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6599
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6597
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6598
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6599
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6600 6600
 					ORDER BY airport_arrival_icao_count DESC";
6601 6601
 		if ($limit) $query .= " LIMIT 10";
6602 6602
       
@@ -6626,11 +6626,11 @@  discard block
 block discarded – undo
6626 6626
 	}	
6627 6627
 	
6628 6628
 	/**
6629
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
6630
-	*
6631
-	* @return Array the airport list
6632
-	*
6633
-	*/
6629
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
6630
+	 *
6631
+	 * @return Array the airport list
6632
+	 *
6633
+	 */
6634 6634
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
6635 6635
 	{
6636 6636
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6662,11 +6662,11 @@  discard block
 block discarded – undo
6662 6662
 	
6663 6663
 	
6664 6664
 	/**
6665
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6666
-	*
6667
-	* @return Array the airport list
6668
-	*
6669
-	*/
6665
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6666
+	 *
6667
+	 * @return Array the airport list
6668
+	 *
6669
+	 */
6670 6670
 	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
6671 6671
 	{
6672 6672
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6697,11 +6697,11 @@  discard block
 block discarded – undo
6697 6697
 	
6698 6698
 	
6699 6699
 	/**
6700
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6701
-	*
6702
-	* @return Array the airport list
6703
-	*
6704
-	*/
6700
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6701
+	 *
6702
+	 * @return Array the airport list
6703
+	 *
6704
+	 */
6705 6705
 	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
6706 6706
 	{
6707 6707
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6735,11 +6735,11 @@  discard block
 block discarded – undo
6735 6735
 	
6736 6736
 	
6737 6737
 	/**
6738
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6739
-	*
6740
-	* @return Array the airport list
6741
-	*
6742
-	*/
6738
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6739
+	 *
6740
+	 * @return Array the airport list
6741
+	 *
6742
+	 */
6743 6743
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
6744 6744
 	{
6745 6745
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6769,11 +6769,11 @@  discard block
 block discarded – undo
6769 6769
 	
6770 6770
 	
6771 6771
 	/**
6772
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6773
-	*
6774
-	* @return Array the airport list
6775
-	*
6776
-	*/
6772
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6773
+	 *
6774
+	 * @return Array the airport list
6775
+	 *
6776
+	 */
6777 6777
 	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
6778 6778
 	{
6779 6779
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6807,11 +6807,11 @@  discard block
 block discarded – undo
6807 6807
 	
6808 6808
 	
6809 6809
 	/**
6810
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6811
-	*
6812
-	* @return Array the airport list
6813
-	*
6814
-	*/
6810
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6811
+	 *
6812
+	 * @return Array the airport list
6813
+	 *
6814
+	 */
6815 6815
 	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
6816 6816
 	{
6817 6817
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6842,11 +6842,11 @@  discard block
 block discarded – undo
6842 6842
 	
6843 6843
 	
6844 6844
 	/**
6845
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
6846
-	*
6847
-	* @return Array the airport list
6848
-	*
6849
-	*/
6845
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
6846
+	 *
6847
+	 * @return Array the airport list
6848
+	 *
6849
+	 */
6850 6850
 	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
6851 6851
 	{
6852 6852
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6879,11 +6879,11 @@  discard block
 block discarded – undo
6879 6879
 	
6880 6880
 	
6881 6881
 	/**
6882
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6883
-	*
6884
-	* @return Array the airport list
6885
-	*
6886
-	*/
6882
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6883
+	 *
6884
+	 * @return Array the airport list
6885
+	 *
6886
+	 */
6887 6887
 	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
6888 6888
 	{
6889 6889
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6913,11 +6913,11 @@  discard block
 block discarded – undo
6913 6913
 	
6914 6914
 	
6915 6915
 	/**
6916
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6917
-	*
6918
-	* @return Array the airport list
6919
-	*
6920
-	*/
6916
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6917
+	 *
6918
+	 * @return Array the airport list
6919
+	 *
6920
+	 */
6921 6921
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6922 6922
 	{
6923 6923
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6951,11 +6951,11 @@  discard block
 block discarded – undo
6951 6951
 	
6952 6952
 	
6953 6953
 	/**
6954
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
6955
-	*
6956
-	* @return Array the airport list
6957
-	*
6958
-	*/
6954
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
6955
+	 *
6956
+	 * @return Array the airport list
6957
+	 *
6958
+	 */
6959 6959
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6960 6960
 	{
6961 6961
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6986,11 +6986,11 @@  discard block
 block discarded – undo
6986 6986
 	
6987 6987
 	
6988 6988
 	/**
6989
-	* Gets all arrival airports of the airplanes that have flown over based on a date
6990
-	*
6991
-	* @return Array the airport list
6992
-	*
6993
-	*/
6989
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
6990
+	 *
6991
+	 * @return Array the airport list
6992
+	 *
6993
+	 */
6994 6994
 	public function countAllArrivalAirportsByDate($date,$filters = array())
6995 6995
 	{
6996 6996
 		global $globalTimezone, $globalDBdriver;
@@ -7036,11 +7036,11 @@  discard block
 block discarded – undo
7036 7036
 	
7037 7037
 	
7038 7038
 	/**
7039
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
7040
-	*
7041
-	* @return Array the airport list
7042
-	*
7043
-	*/
7039
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
7040
+	 *
7041
+	 * @return Array the airport list
7042
+	 *
7043
+	 */
7044 7044
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
7045 7045
 	{
7046 7046
 		global $globalTimezone, $globalDBdriver;
@@ -7083,11 +7083,11 @@  discard block
 block discarded – undo
7083 7083
 	
7084 7084
 	
7085 7085
 	/**
7086
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
7087
-	*
7088
-	* @return Array the airport list
7089
-	*
7090
-	*/
7086
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
7087
+	 *
7088
+	 * @return Array the airport list
7089
+	 *
7090
+	 */
7091 7091
 	public function countAllArrivalAirportsByIdent($ident,$filters = array())
7092 7092
 	{
7093 7093
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7120,11 +7120,11 @@  discard block
 block discarded – undo
7120 7120
 	
7121 7121
 	
7122 7122
 	/**
7123
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7124
-	*
7125
-	* @return Array the airport list
7126
-	*
7127
-	*/
7123
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7124
+	 *
7125
+	 * @return Array the airport list
7126
+	 *
7127
+	 */
7128 7128
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
7129 7129
 	{
7130 7130
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7155,11 +7155,11 @@  discard block
 block discarded – undo
7155 7155
 	
7156 7156
 	
7157 7157
 	/**
7158
-	* Gets all arrival airports of the airplanes that have flown over based on a country
7159
-	*
7160
-	* @return Array the airport list
7161
-	*
7162
-	*/
7158
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
7159
+	 *
7160
+	 * @return Array the airport list
7161
+	 *
7162
+	 */
7163 7163
 	public function countAllArrivalAirportsByCountry($country,$filters = array())
7164 7164
 	{
7165 7165
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7192,11 +7192,11 @@  discard block
 block discarded – undo
7192 7192
 	
7193 7193
 	
7194 7194
 	/**
7195
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
7196
-	*
7197
-	* @return Array the airport list
7198
-	*
7199
-	*/
7195
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
7196
+	 *
7197
+	 * @return Array the airport list
7198
+	 *
7199
+	 */
7200 7200
 	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
7201 7201
 	{
7202 7202
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7227,11 +7227,11 @@  discard block
 block discarded – undo
7227 7227
 
7228 7228
 
7229 7229
 	/**
7230
-	* Counts all airport departure countries
7231
-	*
7232
-	* @return Array the airport departure list
7233
-	*
7234
-	*/
7230
+	 * Counts all airport departure countries
7231
+	 *
7232
+	 * @return Array the airport departure list
7233
+	 *
7234
+	 */
7235 7235
 	public function countAllDepartureCountries($filters = array())
7236 7236
 	{
7237 7237
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7261,11 +7261,11 @@  discard block
 block discarded – undo
7261 7261
 	
7262 7262
 	
7263 7263
 	/**
7264
-	* Counts all airport arrival countries
7265
-	*
7266
-	* @return Array the airport arrival list
7267
-	*
7268
-	*/
7264
+	 * Counts all airport arrival countries
7265
+	 *
7266
+	 * @return Array the airport arrival list
7267
+	 *
7268
+	 */
7269 7269
 	public function countAllArrivalCountries($limit = true,$filters = array())
7270 7270
 	{
7271 7271
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7298,11 +7298,11 @@  discard block
 block discarded – undo
7298 7298
 
7299 7299
 
7300 7300
 	/**
7301
-	* Gets all route combinations
7302
-	*
7303
-	* @return Array the route list
7304
-	*
7305
-	*/
7301
+	 * Gets all route combinations
7302
+	 *
7303
+	 * @return Array the route list
7304
+	 *
7305
+	 */
7306 7306
 	public function countAllRoutes($filters = array())
7307 7307
 	{
7308 7308
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7341,11 +7341,11 @@  discard block
 block discarded – undo
7341 7341
 	
7342 7342
 	
7343 7343
 	/**
7344
-	* Gets all route combinations based on an aircraft
7345
-	*
7346
-	* @return Array the route list
7347
-	*
7348
-	*/
7344
+	 * Gets all route combinations based on an aircraft
7345
+	 *
7346
+	 * @return Array the route list
7347
+	 *
7348
+	 */
7349 7349
 	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
7350 7350
 	{
7351 7351
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7381,11 +7381,11 @@  discard block
 block discarded – undo
7381 7381
 	
7382 7382
 	
7383 7383
 	/**
7384
-	* Gets all route combinations based on an aircraft registration
7385
-	*
7386
-	* @return Array the route list
7387
-	*
7388
-	*/
7384
+	 * Gets all route combinations based on an aircraft registration
7385
+	 *
7386
+	 * @return Array the route list
7387
+	 *
7388
+	 */
7389 7389
 	public function countAllRoutesByRegistration($registration, $filters = array())
7390 7390
 	{
7391 7391
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7423,11 +7423,11 @@  discard block
 block discarded – undo
7423 7423
 	
7424 7424
 	
7425 7425
 	/**
7426
-	* Gets all route combinations based on an airline
7427
-	*
7428
-	* @return Array the route list
7429
-	*
7430
-	*/
7426
+	 * Gets all route combinations based on an airline
7427
+	 *
7428
+	 * @return Array the route list
7429
+	 *
7430
+	 */
7431 7431
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
7432 7432
 	{
7433 7433
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7465,11 +7465,11 @@  discard block
 block discarded – undo
7465 7465
 	
7466 7466
 	
7467 7467
 	/**
7468
-	* Gets all route combinations based on an airport
7469
-	*
7470
-	* @return Array the route list
7471
-	*
7472
-	*/
7468
+	 * Gets all route combinations based on an airport
7469
+	 *
7470
+	 * @return Array the route list
7471
+	 *
7472
+	 */
7473 7473
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
7474 7474
 	{
7475 7475
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7506,11 +7506,11 @@  discard block
 block discarded – undo
7506 7506
 	
7507 7507
 	
7508 7508
 	/**
7509
-	* Gets all route combinations based on an country
7510
-	*
7511
-	* @return Array the route list
7512
-	*
7513
-	*/
7509
+	 * Gets all route combinations based on an country
7510
+	 *
7511
+	 * @return Array the route list
7512
+	 *
7513
+	 */
7514 7514
 	public function countAllRoutesByCountry($country, $filters = array())
7515 7515
 	{
7516 7516
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7546,11 +7546,11 @@  discard block
 block discarded – undo
7546 7546
 
7547 7547
 
7548 7548
 	/**
7549
-	* Gets all route combinations based on an date
7550
-	*
7551
-	* @return Array the route list
7552
-	*
7553
-	*/
7549
+	 * Gets all route combinations based on an date
7550
+	 *
7551
+	 * @return Array the route list
7552
+	 *
7553
+	 */
7554 7554
 	public function countAllRoutesByDate($date, $filters = array())
7555 7555
 	{
7556 7556
 		global $globalTimezone, $globalDBdriver;
@@ -7600,11 +7600,11 @@  discard block
 block discarded – undo
7600 7600
 	
7601 7601
 	
7602 7602
 	/**
7603
-	* Gets all route combinations based on an ident/callsign
7604
-	*
7605
-	* @return Array the route list
7606
-	*
7607
-	*/
7603
+	 * Gets all route combinations based on an ident/callsign
7604
+	 *
7605
+	 * @return Array the route list
7606
+	 *
7607
+	 */
7608 7608
 	public function countAllRoutesByIdent($ident, $filters = array())
7609 7609
 	{
7610 7610
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7641,11 +7641,11 @@  discard block
 block discarded – undo
7641 7641
 	
7642 7642
 	
7643 7643
 	/**
7644
-	* Gets all route combinations based on an manufacturer
7645
-	*
7646
-	* @return Array the route list
7647
-	*
7648
-	*/
7644
+	 * Gets all route combinations based on an manufacturer
7645
+	 *
7646
+	 * @return Array the route list
7647
+	 *
7648
+	 */
7649 7649
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
7650 7650
 	{
7651 7651
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7683,11 +7683,11 @@  discard block
 block discarded – undo
7683 7683
 	
7684 7684
 	
7685 7685
 	/**
7686
-	* Gets all route combinations with waypoints
7687
-	*
7688
-	* @return Array the route list
7689
-	*
7690
-	*/
7686
+	 * Gets all route combinations with waypoints
7687
+	 *
7688
+	 * @return Array the route list
7689
+	 *
7690
+	 */
7691 7691
 	public function countAllRoutesWithWaypoints($filters = array())
7692 7692
 	{
7693 7693
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7724,11 +7724,11 @@  discard block
 block discarded – undo
7724 7724
 	}
7725 7725
 	
7726 7726
 	/**
7727
-	* Gets all callsigns that have flown over
7728
-	*
7729
-	* @return Array the callsign list
7730
-	*
7731
-	*/
7727
+	 * Gets all callsigns that have flown over
7728
+	 *
7729
+	 * @return Array the callsign list
7730
+	 *
7731
+	 */
7732 7732
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
7733 7733
 	{
7734 7734
 		global $globalDBdriver;
@@ -7766,11 +7766,11 @@  discard block
 block discarded – undo
7766 7766
 	}
7767 7767
 
7768 7768
 	/**
7769
-	* Gets all callsigns that have flown over
7770
-	*
7771
-	* @return Array the callsign list
7772
-	*
7773
-	*/
7769
+	 * Gets all callsigns that have flown over
7770
+	 *
7771
+	 * @return Array the callsign list
7772
+	 *
7773
+	 */
7774 7774
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7775 7775
 	{
7776 7776
 		global $globalDBdriver;
@@ -7811,11 +7811,11 @@  discard block
 block discarded – undo
7811 7811
 
7812 7812
 
7813 7813
 	/**
7814
-	* Counts all dates
7815
-	*
7816
-	* @return Array the date list
7817
-	*
7818
-	*/
7814
+	 * Counts all dates
7815
+	 *
7816
+	 * @return Array the date list
7817
+	 *
7818
+	 */
7819 7819
 	public function countAllDates($filters = array())
7820 7820
 	{
7821 7821
 		global $globalTimezone, $globalDBdriver;
@@ -7860,11 +7860,11 @@  discard block
 block discarded – undo
7860 7860
 	}
7861 7861
 	
7862 7862
 	/**
7863
-	* Counts all dates
7864
-	*
7865
-	* @return Array the date list
7866
-	*
7867
-	*/
7863
+	 * Counts all dates
7864
+	 *
7865
+	 * @return Array the date list
7866
+	 *
7867
+	 */
7868 7868
 	public function countAllDatesByAirlines($filters = array())
7869 7869
 	{
7870 7870
 		global $globalTimezone, $globalDBdriver;
@@ -7909,11 +7909,11 @@  discard block
 block discarded – undo
7909 7909
 	}	
7910 7910
 	
7911 7911
 	/**
7912
-	* Counts all dates during the last 7 days
7913
-	*
7914
-	* @return Array the date list
7915
-	*
7916
-	*/
7912
+	 * Counts all dates during the last 7 days
7913
+	 *
7914
+	 * @return Array the date list
7915
+	 *
7916
+	 */
7917 7917
 	public function countAllDatesLast7Days($filters = array())
7918 7918
 	{
7919 7919
 		global $globalTimezone, $globalDBdriver;
@@ -7935,7 +7935,7 @@  discard block
 block discarded – undo
7935 7935
 			$query .= " GROUP BY date_name 
7936 7936
 								ORDER BY date_name ASC";
7937 7937
 			$query_data = array(':offset' => $offset);
7938
-    		}
7938
+			}
7939 7939
 		
7940 7940
 		$sth = $this->db->prepare($query);
7941 7941
 		$sth->execute($query_data);
@@ -7955,11 +7955,11 @@  discard block
 block discarded – undo
7955 7955
 	}
7956 7956
 
7957 7957
 	/**
7958
-	* Counts all dates during the last month
7959
-	*
7960
-	* @return Array the date list
7961
-	*
7962
-	*/
7958
+	 * Counts all dates during the last month
7959
+	 *
7960
+	 * @return Array the date list
7961
+	 *
7962
+	 */
7963 7963
 	public function countAllDatesLastMonth($filters = array())
7964 7964
 	{
7965 7965
 		global $globalTimezone, $globalDBdriver;
@@ -7981,7 +7981,7 @@  discard block
 block discarded – undo
7981 7981
 			$query .= " GROUP BY date_name 
7982 7982
 								ORDER BY date_name ASC";
7983 7983
 			$query_data = array(':offset' => $offset);
7984
-    		}
7984
+			}
7985 7985
 		
7986 7986
 		$sth = $this->db->prepare($query);
7987 7987
 		$sth->execute($query_data);
@@ -8002,11 +8002,11 @@  discard block
 block discarded – undo
8002 8002
 
8003 8003
 
8004 8004
 	/**
8005
-	* Counts all dates during the last month
8006
-	*
8007
-	* @return Array the date list
8008
-	*
8009
-	*/
8005
+	 * Counts all dates during the last month
8006
+	 *
8007
+	 * @return Array the date list
8008
+	 *
8009
+	 */
8010 8010
 	public function countAllDatesLastMonthByAirlines($filters = array())
8011 8011
 	{
8012 8012
 		global $globalTimezone, $globalDBdriver;
@@ -8029,7 +8029,7 @@  discard block
 block discarded – undo
8029 8029
 								GROUP BY spotter_output.airline_icao, date_name 
8030 8030
 								ORDER BY date_name ASC";
8031 8031
 			$query_data = array(':offset' => $offset);
8032
-    		}
8032
+			}
8033 8033
 		
8034 8034
 		$sth = $this->db->prepare($query);
8035 8035
 		$sth->execute($query_data);
@@ -8051,11 +8051,11 @@  discard block
 block discarded – undo
8051 8051
 	
8052 8052
 
8053 8053
 	/**
8054
-	* Counts all month
8055
-	*
8056
-	* @return Array the month list
8057
-	*
8058
-	*/
8054
+	 * Counts all month
8055
+	 *
8056
+	 * @return Array the month list
8057
+	 *
8058
+	 */
8059 8059
 	public function countAllMonths($filters = array())
8060 8060
 	{
8061 8061
 		global $globalTimezone, $globalDBdriver;
@@ -8097,11 +8097,11 @@  discard block
 block discarded – undo
8097 8097
 	}
8098 8098
 
8099 8099
 	/**
8100
-	* Counts all month
8101
-	*
8102
-	* @return Array the month list
8103
-	*
8104
-	*/
8100
+	 * Counts all month
8101
+	 *
8102
+	 * @return Array the month list
8103
+	 *
8104
+	 */
8105 8105
 	public function countAllMonthsByAirlines($filters = array())
8106 8106
 	{
8107 8107
 		global $globalTimezone, $globalDBdriver;
@@ -8146,11 +8146,11 @@  discard block
 block discarded – undo
8146 8146
 	}
8147 8147
 
8148 8148
 	/**
8149
-	* Counts all military month
8150
-	*
8151
-	* @return Array the month list
8152
-	*
8153
-	*/
8149
+	 * Counts all military month
8150
+	 *
8151
+	 * @return Array the month list
8152
+	 *
8153
+	 */
8154 8154
 	public function countAllMilitaryMonths($filters = array())
8155 8155
 	{
8156 8156
 		global $globalTimezone, $globalDBdriver;
@@ -8191,11 +8191,11 @@  discard block
 block discarded – undo
8191 8191
 	}
8192 8192
 	
8193 8193
 	/**
8194
-	* Counts all month owners
8195
-	*
8196
-	* @return Array the month list
8197
-	*
8198
-	*/
8194
+	 * Counts all month owners
8195
+	 *
8196
+	 * @return Array the month list
8197
+	 *
8198
+	 */
8199 8199
 	public function countAllMonthsOwners($filters = array())
8200 8200
 	{
8201 8201
 		global $globalTimezone, $globalDBdriver;
@@ -8237,11 +8237,11 @@  discard block
 block discarded – undo
8237 8237
 	}
8238 8238
 	
8239 8239
 	/**
8240
-	* Counts all month owners
8241
-	*
8242
-	* @return Array the month list
8243
-	*
8244
-	*/
8240
+	 * Counts all month owners
8241
+	 *
8242
+	 * @return Array the month list
8243
+	 *
8244
+	 */
8245 8245
 	public function countAllMonthsOwnersByAirlines($filters = array())
8246 8246
 	{
8247 8247
 		global $globalTimezone, $globalDBdriver;
@@ -8284,11 +8284,11 @@  discard block
 block discarded – undo
8284 8284
 	}
8285 8285
 
8286 8286
 	/**
8287
-	* Counts all month pilot
8288
-	*
8289
-	* @return Array the month list
8290
-	*
8291
-	*/
8287
+	 * Counts all month pilot
8288
+	 *
8289
+	 * @return Array the month list
8290
+	 *
8291
+	 */
8292 8292
 	public function countAllMonthsPilots($filters = array())
8293 8293
 	{
8294 8294
 		global $globalTimezone, $globalDBdriver;
@@ -8330,11 +8330,11 @@  discard block
 block discarded – undo
8330 8330
 	}
8331 8331
 	
8332 8332
 	/**
8333
-	* Counts all month pilot
8334
-	*
8335
-	* @return Array the month list
8336
-	*
8337
-	*/
8333
+	 * Counts all month pilot
8334
+	 *
8335
+	 * @return Array the month list
8336
+	 *
8337
+	 */
8338 8338
 	public function countAllMonthsPilotsByAirlines($filters = array())
8339 8339
 	{
8340 8340
 		global $globalTimezone, $globalDBdriver;
@@ -8377,11 +8377,11 @@  discard block
 block discarded – undo
8377 8377
 	}
8378 8378
 
8379 8379
 	/**
8380
-	* Counts all month airline
8381
-	*
8382
-	* @return Array the month list
8383
-	*
8384
-	*/
8380
+	 * Counts all month airline
8381
+	 *
8382
+	 * @return Array the month list
8383
+	 *
8384
+	 */
8385 8385
 	public function countAllMonthsAirlines($filters = array())
8386 8386
 	{
8387 8387
 		global $globalTimezone, $globalDBdriver;
@@ -8423,11 +8423,11 @@  discard block
 block discarded – undo
8423 8423
 	}
8424 8424
 	
8425 8425
 	/**
8426
-	* Counts all month aircraft
8427
-	*
8428
-	* @return Array the month list
8429
-	*
8430
-	*/
8426
+	 * Counts all month aircraft
8427
+	 *
8428
+	 * @return Array the month list
8429
+	 *
8430
+	 */
8431 8431
 	public function countAllMonthsAircrafts($filters = array())
8432 8432
 	{
8433 8433
 		global $globalTimezone, $globalDBdriver;
@@ -8470,11 +8470,11 @@  discard block
 block discarded – undo
8470 8470
 	
8471 8471
 
8472 8472
 	/**
8473
-	* Counts all month aircraft
8474
-	*
8475
-	* @return Array the month list
8476
-	*
8477
-	*/
8473
+	 * Counts all month aircraft
8474
+	 *
8475
+	 * @return Array the month list
8476
+	 *
8477
+	 */
8478 8478
 	public function countAllMonthsAircraftsByAirlines($filters = array())
8479 8479
 	{
8480 8480
 		global $globalTimezone, $globalDBdriver;
@@ -8517,11 +8517,11 @@  discard block
 block discarded – undo
8517 8517
 	}
8518 8518
 
8519 8519
 	/**
8520
-	* Counts all month real arrival
8521
-	*
8522
-	* @return Array the month list
8523
-	*
8524
-	*/
8520
+	 * Counts all month real arrival
8521
+	 *
8522
+	 * @return Array the month list
8523
+	 *
8524
+	 */
8525 8525
 	public function countAllMonthsRealArrivals($filters = array())
8526 8526
 	{
8527 8527
 		global $globalTimezone, $globalDBdriver;
@@ -8564,11 +8564,11 @@  discard block
 block discarded – undo
8564 8564
 	
8565 8565
 
8566 8566
 	/**
8567
-	* Counts all month real arrival
8568
-	*
8569
-	* @return Array the month list
8570
-	*
8571
-	*/
8567
+	 * Counts all month real arrival
8568
+	 *
8569
+	 * @return Array the month list
8570
+	 *
8571
+	 */
8572 8572
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
8573 8573
 	{
8574 8574
 		global $globalTimezone, $globalDBdriver;
@@ -8612,11 +8612,11 @@  discard block
 block discarded – undo
8612 8612
 	
8613 8613
 
8614 8614
 	/**
8615
-	* Counts all dates during the last year
8616
-	*
8617
-	* @return Array the date list
8618
-	*
8619
-	*/
8615
+	 * Counts all dates during the last year
8616
+	 *
8617
+	 * @return Array the date list
8618
+	 *
8619
+	 */
8620 8620
 	public function countAllMonthsLastYear($filters)
8621 8621
 	{
8622 8622
 		global $globalTimezone, $globalDBdriver;
@@ -8638,7 +8638,7 @@  discard block
 block discarded – undo
8638 8638
 			$query .= " GROUP BY year_name, month_name
8639 8639
 								ORDER BY year_name, month_name ASC";
8640 8640
 			$query_data = array(':offset' => $offset);
8641
-    		}
8641
+			}
8642 8642
 		
8643 8643
 		$sth = $this->db->prepare($query);
8644 8644
 		$sth->execute($query_data);
@@ -8661,11 +8661,11 @@  discard block
 block discarded – undo
8661 8661
 	
8662 8662
 	
8663 8663
 	/**
8664
-	* Counts all hours
8665
-	*
8666
-	* @return Array the hour list
8667
-	*
8668
-	*/
8664
+	 * Counts all hours
8665
+	 *
8666
+	 * @return Array the hour list
8667
+	 *
8668
+	 */
8669 8669
 	public function countAllHours($orderby,$filters = array())
8670 8670
 	{
8671 8671
 		global $globalTimezone, $globalDBdriver;
@@ -8726,11 +8726,11 @@  discard block
 block discarded – undo
8726 8726
 	}
8727 8727
 	
8728 8728
 	/**
8729
-	* Counts all hours
8730
-	*
8731
-	* @return Array the hour list
8732
-	*
8733
-	*/
8729
+	 * Counts all hours
8730
+	 *
8731
+	 * @return Array the hour list
8732
+	 *
8733
+	 */
8734 8734
 	public function countAllHoursByAirlines($orderby, $filters = array())
8735 8735
 	{
8736 8736
 		global $globalTimezone, $globalDBdriver;
@@ -8793,11 +8793,11 @@  discard block
 block discarded – undo
8793 8793
 
8794 8794
 
8795 8795
 	/**
8796
-	* Counts all hours by airline
8797
-	*
8798
-	* @return Array the hour list
8799
-	*
8800
-	*/
8796
+	 * Counts all hours by airline
8797
+	 *
8798
+	 * @return Array the hour list
8799
+	 *
8800
+	 */
8801 8801
 	public function countAllHoursByAirline($airline_icao, $filters = array())
8802 8802
 	{
8803 8803
 		global $globalTimezone, $globalDBdriver;
@@ -8843,11 +8843,11 @@  discard block
 block discarded – undo
8843 8843
 	
8844 8844
 	
8845 8845
 	/**
8846
-	* Counts all hours by aircraft
8847
-	*
8848
-	* @return Array the hour list
8849
-	*
8850
-	*/
8846
+	 * Counts all hours by aircraft
8847
+	 *
8848
+	 * @return Array the hour list
8849
+	 *
8850
+	 */
8851 8851
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
8852 8852
 	{
8853 8853
 		global $globalTimezone, $globalDBdriver;
@@ -8890,11 +8890,11 @@  discard block
 block discarded – undo
8890 8890
 	
8891 8891
 	
8892 8892
 	/**
8893
-	* Counts all hours by aircraft registration
8894
-	*
8895
-	* @return Array the hour list
8896
-	*
8897
-	*/
8893
+	 * Counts all hours by aircraft registration
8894
+	 *
8895
+	 * @return Array the hour list
8896
+	 *
8897
+	 */
8898 8898
 	public function countAllHoursByRegistration($registration, $filters = array())
8899 8899
 	{
8900 8900
 		global $globalTimezone, $globalDBdriver;
@@ -8937,11 +8937,11 @@  discard block
 block discarded – undo
8937 8937
 	
8938 8938
 	
8939 8939
 	/**
8940
-	* Counts all hours by airport
8941
-	*
8942
-	* @return Array the hour list
8943
-	*
8944
-	*/
8940
+	 * Counts all hours by airport
8941
+	 *
8942
+	 * @return Array the hour list
8943
+	 *
8944
+	 */
8945 8945
 	public function countAllHoursByAirport($airport_icao, $filters = array())
8946 8946
 	{
8947 8947
 		global $globalTimezone, $globalDBdriver;
@@ -8985,11 +8985,11 @@  discard block
 block discarded – undo
8985 8985
 	
8986 8986
 	
8987 8987
 	/**
8988
-	* Counts all hours by manufacturer
8989
-	*
8990
-	* @return Array the hour list
8991
-	*
8992
-	*/
8988
+	 * Counts all hours by manufacturer
8989
+	 *
8990
+	 * @return Array the hour list
8991
+	 *
8992
+	 */
8993 8993
 	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
8994 8994
 	{
8995 8995
 		global $globalTimezone, $globalDBdriver;
@@ -9033,11 +9033,11 @@  discard block
 block discarded – undo
9033 9033
 	
9034 9034
 	
9035 9035
 	/**
9036
-	* Counts all hours by date
9037
-	*
9038
-	* @return Array the hour list
9039
-	*
9040
-	*/
9036
+	 * Counts all hours by date
9037
+	 *
9038
+	 * @return Array the hour list
9039
+	 *
9040
+	 */
9041 9041
 	public function countAllHoursByDate($date, $filters = array())
9042 9042
 	{
9043 9043
 		global $globalTimezone, $globalDBdriver;
@@ -9081,11 +9081,11 @@  discard block
 block discarded – undo
9081 9081
 	
9082 9082
 	
9083 9083
 	/**
9084
-	* Counts all hours by a ident/callsign
9085
-	*
9086
-	* @return Array the hour list
9087
-	*
9088
-	*/
9084
+	 * Counts all hours by a ident/callsign
9085
+	 *
9086
+	 * @return Array the hour list
9087
+	 *
9088
+	 */
9089 9089
 	public function countAllHoursByIdent($ident, $filters = array())
9090 9090
 	{
9091 9091
 		global $globalTimezone, $globalDBdriver;
@@ -9130,11 +9130,11 @@  discard block
 block discarded – undo
9130 9130
 	
9131 9131
 	
9132 9132
 	/**
9133
-	* Counts all hours by route
9134
-	*
9135
-	* @return Array the hour list
9136
-	*
9137
-	*/
9133
+	 * Counts all hours by route
9134
+	 *
9135
+	 * @return Array the hour list
9136
+	 *
9137
+	 */
9138 9138
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
9139 9139
 	{
9140 9140
 		global $globalTimezone, $globalDBdriver;
@@ -9178,11 +9178,11 @@  discard block
 block discarded – undo
9178 9178
 	
9179 9179
 	
9180 9180
 	/**
9181
-	* Counts all hours by country
9182
-	*
9183
-	* @return Array the hour list
9184
-	*
9185
-	*/
9181
+	 * Counts all hours by country
9182
+	 *
9183
+	 * @return Array the hour list
9184
+	 *
9185
+	 */
9186 9186
 	public function countAllHoursByCountry($country, $filters = array())
9187 9187
 	{
9188 9188
 		global $globalTimezone, $globalDBdriver;
@@ -9227,11 +9227,11 @@  discard block
 block discarded – undo
9227 9227
 
9228 9228
 
9229 9229
 	/**
9230
-	* Counts all aircraft that have flown over
9231
-	*
9232
-	* @return Integer the number of aircrafts
9233
-	*
9234
-	*/
9230
+	 * Counts all aircraft that have flown over
9231
+	 *
9232
+	 * @return Integer the number of aircrafts
9233
+	 *
9234
+	 */
9235 9235
 	public function countOverallAircrafts($filters = array())
9236 9236
 	{
9237 9237
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9243,11 +9243,11 @@  discard block
 block discarded – undo
9243 9243
 	}
9244 9244
 
9245 9245
 	/**
9246
-	* Counts all flight that really arrival
9247
-	*
9248
-	* @return Integer the number of aircrafts
9249
-	*
9250
-	*/
9246
+	 * Counts all flight that really arrival
9247
+	 *
9248
+	 * @return Integer the number of aircrafts
9249
+	 *
9250
+	 */
9251 9251
 	public function countOverallArrival($filters = array())
9252 9252
 	{
9253 9253
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9260,11 +9260,11 @@  discard block
 block discarded – undo
9260 9260
 	}
9261 9261
 
9262 9262
 	/**
9263
-	* Counts all pilots that have flown over
9264
-	*
9265
-	* @return Integer the number of pilots
9266
-	*
9267
-	*/
9263
+	 * Counts all pilots that have flown over
9264
+	 *
9265
+	 * @return Integer the number of pilots
9266
+	 *
9267
+	 */
9268 9268
 	public function countOverallPilots($filters = array())
9269 9269
 	{
9270 9270
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9276,11 +9276,11 @@  discard block
 block discarded – undo
9276 9276
 	}
9277 9277
 
9278 9278
 	/**
9279
-	* Counts all owners that have flown over
9280
-	*
9281
-	* @return Integer the number of owners
9282
-	*
9283
-	*/
9279
+	 * Counts all owners that have flown over
9280
+	 *
9281
+	 * @return Integer the number of owners
9282
+	 *
9283
+	 */
9284 9284
 	public function countOverallOwners($filters = array())
9285 9285
 	{
9286 9286
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9293,11 +9293,11 @@  discard block
 block discarded – undo
9293 9293
 	
9294 9294
 	
9295 9295
 	/**
9296
-	* Counts all flights that have flown over
9297
-	*
9298
-	* @return Integer the number of flights
9299
-	*
9300
-	*/
9296
+	 * Counts all flights that have flown over
9297
+	 *
9298
+	 * @return Integer the number of flights
9299
+	 *
9300
+	 */
9301 9301
 	public function countOverallFlights($filters = array())
9302 9302
 	{
9303 9303
 		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
@@ -9310,11 +9310,11 @@  discard block
 block discarded – undo
9310 9310
 	}
9311 9311
 	
9312 9312
 	/**
9313
-	* Counts all military flights that have flown over
9314
-	*
9315
-	* @return Integer the number of flights
9316
-	*
9317
-	*/
9313
+	 * Counts all military flights that have flown over
9314
+	 *
9315
+	 * @return Integer the number of flights
9316
+	 *
9317
+	 */
9318 9318
 	public function countOverallMilitaryFlights($filters = array())
9319 9319
 	{
9320 9320
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9329,11 +9329,11 @@  discard block
 block discarded – undo
9329 9329
 	
9330 9330
 	
9331 9331
 	/**
9332
-	* Counts all airlines that have flown over
9333
-	*
9334
-	* @return Integer the number of airlines
9335
-	*
9336
-	*/
9332
+	 * Counts all airlines that have flown over
9333
+	 *
9334
+	 * @return Integer the number of airlines
9335
+	 *
9336
+	 */
9337 9337
 	public function countOverallAirlines($filters = array())
9338 9338
 	{
9339 9339
 		$query  = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
@@ -9347,11 +9347,11 @@  discard block
 block discarded – undo
9347 9347
 
9348 9348
   
9349 9349
 	/**
9350
-	* Counts all hours of today
9351
-	*
9352
-	* @return Array the hour list
9353
-	*
9354
-	*/
9350
+	 * Counts all hours of today
9351
+	 *
9352
+	 * @return Array the hour list
9353
+	 *
9354
+	 */
9355 9355
 	public function countAllHoursFromToday($filters = array())
9356 9356
 	{
9357 9357
 		global $globalTimezone, $globalDBdriver;
@@ -9391,11 +9391,11 @@  discard block
 block discarded – undo
9391 9391
 	}
9392 9392
     
9393 9393
 	/**
9394
-	* Gets all the spotter information based on calculated upcoming flights
9395
-	*
9396
-	* @return Array the spotter information
9397
-	*
9398
-	*/
9394
+	 * Gets all the spotter information based on calculated upcoming flights
9395
+	 *
9396
+	 * @return Array the spotter information
9397
+	 *
9398
+	 */
9399 9399
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
9400 9400
 	{
9401 9401
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -9470,12 +9470,12 @@  discard block
 block discarded – undo
9470 9470
 	}
9471 9471
     
9472 9472
     
9473
-     /**
9474
-	* Gets the Barrie Spotter ID based on the FlightAware ID
9475
-	*
9476
-	* @return Integer the Barrie Spotter ID
9473
+	 /**
9474
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
9475
+	  *
9476
+	  * @return Integer the Barrie Spotter ID
9477 9477
 q	*
9478
-	*/
9478
+	  */
9479 9479
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
9480 9480
 	{
9481 9481
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -9496,13 +9496,13 @@  discard block
 block discarded – undo
9496 9496
   
9497 9497
  
9498 9498
 	/**
9499
-	* Parses a date string
9500
-	*
9501
-	* @param String $dateString the date string
9502
-	* @param String $timezone the timezone of a user
9503
-	* @return Array the time information
9504
-	*
9505
-	*/
9499
+	 * Parses a date string
9500
+	 *
9501
+	 * @param String $dateString the date string
9502
+	 * @param String $timezone the timezone of a user
9503
+	 * @return Array the time information
9504
+	 *
9505
+	 */
9506 9506
 	public function parseDateString($dateString, $timezone = '')
9507 9507
 	{
9508 9508
 		$time_array = array();
@@ -9538,12 +9538,12 @@  discard block
 block discarded – undo
9538 9538
 	
9539 9539
 	
9540 9540
 	/**
9541
-	* Parses the direction degrees to working
9542
-	*
9543
-	* @param Float $direction the direction in degrees
9544
-	* @return Array the direction information
9545
-	*
9546
-	*/
9541
+	 * Parses the direction degrees to working
9542
+	 *
9543
+	 * @param Float $direction the direction in degrees
9544
+	 * @return Array the direction information
9545
+	 *
9546
+	 */
9547 9547
 	public function parseDirection($direction = 0)
9548 9548
 	{
9549 9549
 		if ($direction == '') $direction = 0;
@@ -9622,12 +9622,12 @@  discard block
 block discarded – undo
9622 9622
 	
9623 9623
 	
9624 9624
 	/**
9625
-	* Gets the aircraft registration
9626
-	*
9627
-	* @param String $flightaware_id the flight aware id
9628
-	* @return String the aircraft registration
9629
-	*
9630
-	*/
9625
+	 * Gets the aircraft registration
9626
+	 *
9627
+	 * @param String $flightaware_id the flight aware id
9628
+	 * @return String the aircraft registration
9629
+	 *
9630
+	 */
9631 9631
 	
9632 9632
 	public function getAircraftRegistration($flightaware_id)
9633 9633
 	{
@@ -9656,12 +9656,12 @@  discard block
 block discarded – undo
9656 9656
 
9657 9657
 
9658 9658
 	/**
9659
-	* Gets the aircraft registration from ModeS
9660
-	*
9661
-	* @param String $aircraft_modes the flight ModeS in hex
9662
-	* @return String the aircraft registration
9663
-	*
9664
-	*/
9659
+	 * Gets the aircraft registration from ModeS
9660
+	 *
9661
+	 * @param String $aircraft_modes the flight ModeS in hex
9662
+	 * @return String the aircraft registration
9663
+	 *
9664
+	 */
9665 9665
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
9666 9666
 	{
9667 9667
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9674,19 +9674,19 @@  discard block
 block discarded – undo
9674 9674
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9675 9675
 		$sth->closeCursor();
9676 9676
 		if (count($row) > 0) {
9677
-		    //return $row['Registration'];
9678
-		    return $row['registration'];
9677
+			//return $row['Registration'];
9678
+			return $row['registration'];
9679 9679
 		} else return '';
9680 9680
 	
9681 9681
 	}
9682 9682
 
9683 9683
 	/**
9684
-	* Gets the aircraft type from ModeS
9685
-	*
9686
-	* @param String $aircraft_modes the flight ModeS in hex
9687
-	* @return String the aircraft type
9688
-	*
9689
-	*/
9684
+	 * Gets the aircraft type from ModeS
9685
+	 *
9686
+	 * @param String $aircraft_modes the flight ModeS in hex
9687
+	 * @return String the aircraft type
9688
+	 *
9689
+	 */
9690 9690
 	public function getAircraftTypeBymodeS($aircraft_modes)
9691 9691
 	{
9692 9692
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9699,19 +9699,19 @@  discard block
 block discarded – undo
9699 9699
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9700 9700
 		$sth->closeCursor();
9701 9701
 		if (count($row) > 0) {
9702
-		    if ($row['type_flight'] == null) return '';
9703
-		    else return $row['type_flight'];
9702
+			if ($row['type_flight'] == null) return '';
9703
+			else return $row['type_flight'];
9704 9704
 		} else return '';
9705 9705
 	
9706 9706
 	}
9707 9707
 
9708 9708
 	/**
9709
-	* Gets Country from latitude/longitude
9710
-	*
9711
-	* @param Float $latitude latitute of the flight
9712
-	* @param Float $longitude longitute of the flight
9713
-	* @return String the countrie
9714
-	*/
9709
+	 * Gets Country from latitude/longitude
9710
+	 *
9711
+	 * @param Float $latitude latitute of the flight
9712
+	 * @param Float $longitude longitute of the flight
9713
+	 * @return String the countrie
9714
+	 */
9715 9715
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
9716 9716
 	{
9717 9717
 		global $globalDBdriver, $globalDebug;
@@ -9748,11 +9748,11 @@  discard block
 block discarded – undo
9748 9748
 	}
9749 9749
 
9750 9750
 	/**
9751
-	* Gets Country from iso2
9752
-	*
9753
-	* @param String $iso2 ISO2 country code
9754
-	* @return String the countrie
9755
-	*/
9751
+	 * Gets Country from iso2
9752
+	 *
9753
+	 * @param String $iso2 ISO2 country code
9754
+	 * @return String the countrie
9755
+	 */
9756 9756
 	public function getCountryFromISO2($iso2)
9757 9757
 	{
9758 9758
 		global $globalDBdriver, $globalDebug;
@@ -9780,12 +9780,12 @@  discard block
 block discarded – undo
9780 9780
 	}
9781 9781
 
9782 9782
 	/**
9783
-	* converts the registration code using the country prefix
9784
-	*
9785
-	* @param String $registration the aircraft registration
9786
-	* @return String the aircraft registration
9787
-	*
9788
-	*/
9783
+	 * converts the registration code using the country prefix
9784
+	 *
9785
+	 * @param String $registration the aircraft registration
9786
+	 * @return String the aircraft registration
9787
+	 *
9788
+	 */
9789 9789
 	public function convertAircraftRegistration($registration)
9790 9790
 	{
9791 9791
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9837,12 +9837,12 @@  discard block
 block discarded – undo
9837 9837
 	}
9838 9838
 
9839 9839
 	/**
9840
-	* Country from the registration code
9841
-	*
9842
-	* @param String $registration the aircraft registration
9843
-	* @return String the country
9844
-	*
9845
-	*/
9840
+	 * Country from the registration code
9841
+	 *
9842
+	 * @param String $registration the aircraft registration
9843
+	 * @return String the country
9844
+	 *
9845
+	 */
9846 9846
 	public function countryFromAircraftRegistration($registration)
9847 9847
 	{
9848 9848
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9861,8 +9861,8 @@  discard block
 block discarded – undo
9861 9861
 				$country = $row['country'];
9862 9862
 			}
9863 9863
 		} else {
9864
-    			$registration_1 = substr($registration, 0, 1);
9865
-		        $registration_2 = substr($registration, 0, 2);
9864
+				$registration_1 = substr($registration, 0, 1);
9865
+				$registration_2 = substr($registration, 0, 2);
9866 9866
 
9867 9867
 			$country = '';
9868 9868
 			//first get the prefix based on two characters
@@ -9898,12 +9898,12 @@  discard block
 block discarded – undo
9898 9898
 	}
9899 9899
 
9900 9900
 	/**
9901
-	* Country from the registration code
9902
-	*
9903
-	* @param String $registration the aircraft registration
9904
-	* @return String the country
9905
-	*
9906
-	*/
9901
+	 * Country from the registration code
9902
+	 *
9903
+	 * @param String $registration the aircraft registration
9904
+	 * @return String the country
9905
+	 *
9906
+	 */
9907 9907
 	public function countryFromAircraftRegistrationCode($registration)
9908 9908
 	{
9909 9909
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9920,11 +9920,11 @@  discard block
 block discarded – undo
9920 9920
 	}
9921 9921
 	
9922 9922
 	/**
9923
-	* Set a new highlight value for a flight
9924
-	*
9925
-	* @param String $flightaware_id flightaware_id from spotter_output table
9926
-	* @param String $highlight New highlight value
9927
-	*/
9923
+	 * Set a new highlight value for a flight
9924
+	 *
9925
+	 * @param String $flightaware_id flightaware_id from spotter_output table
9926
+	 * @param String $highlight New highlight value
9927
+	 */
9928 9928
 	public function setHighlightFlight($flightaware_id,$highlight) {
9929 9929
 		
9930 9930
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -9933,12 +9933,12 @@  discard block
 block discarded – undo
9933 9933
 	}
9934 9934
 	
9935 9935
 	/**
9936
-	* Gets the short url from bit.ly
9937
-	*
9938
-	* @param String $url the full url
9939
-	* @return String the bit.ly url
9940
-	*
9941
-	*/
9936
+	 * Gets the short url from bit.ly
9937
+	 *
9938
+	 * @param String $url the full url
9939
+	 * @return String the bit.ly url
9940
+	 *
9941
+	 */
9942 9942
 	public function getBitlyURL($url)
9943 9943
 	{
9944 9944
 		global $globalBitlyAccessToken;
@@ -10227,11 +10227,11 @@  discard block
 block discarded – undo
10227 10227
 			$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 
10228 10228
 	                      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)) 
10229 10229
 	                      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;";
10230
-                } else {
10230
+				} else {
10231 10231
 			$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 
10232 10232
 	                      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)) 
10233 10233
 	                      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;";
10234
-    		}
10234
+			}
10235 10235
 		$sth = $this->db->prepare($query);
10236 10236
 		$sth->execute();
10237 10237
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
Spacing   +1010 added lines, -1010 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' 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' 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
 		{
@@ -1501,8 +1501,8 @@  discard block
 block discarded – undo
1501 1501
 		{
1502 1502
 			$limit_array = explode(",", $limit);
1503 1503
 			
1504
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1505
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1504
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1505
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1506 1506
 			
1507 1507
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1508 1508
 			{
@@ -1532,7 +1532,7 @@  discard block
 block discarded – undo
1532 1532
 	* @return Array the spotter information
1533 1533
 	*
1534 1534
 	*/
1535
-	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1535
+	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '', $filters = array())
1536 1536
 	{
1537 1537
 		global $global_query;
1538 1538
 		
@@ -1541,7 +1541,7 @@  discard block
 block discarded – undo
1541 1541
 		$query_values = array();
1542 1542
 		$limit_query = '';
1543 1543
 		$additional_query = '';
1544
-		$filter_query = $this->getFilter($filters,true,true);
1544
+		$filter_query = $this->getFilter($filters, true, true);
1545 1545
 		if ($country != "")
1546 1546
 		{
1547 1547
 			if (!is_string($country))
@@ -1558,8 +1558,8 @@  discard block
 block discarded – undo
1558 1558
 		{
1559 1559
 			$limit_array = explode(",", $limit);
1560 1560
 			
1561
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1562
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1561
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1562
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1563 1563
 			
1564 1564
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1565 1565
 			{
@@ -1599,7 +1599,7 @@  discard block
 block discarded – undo
1599 1599
 		$query_values = array();
1600 1600
 		$additional_query = '';
1601 1601
 		$limit_query = '';
1602
-		$filter_query = $this->getFilter($filters,true,true);
1602
+		$filter_query = $this->getFilter($filters, true, true);
1603 1603
 		
1604 1604
 		if ($aircraft_manufacturer != "")
1605 1605
 		{
@@ -1616,8 +1616,8 @@  discard block
 block discarded – undo
1616 1616
 		{
1617 1617
 			$limit_array = explode(",", $limit);
1618 1618
 			
1619
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1620
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1619
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1620
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1621 1621
 			
1622 1622
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1623 1623
 			{
@@ -1659,14 +1659,14 @@  discard block
 block discarded – undo
1659 1659
 		$query_values = array();
1660 1660
 		$additional_query = '';
1661 1661
 		$limit_query = '';
1662
-		$filter_query = $this->getFilter($filters,true,true);
1662
+		$filter_query = $this->getFilter($filters, true, true);
1663 1663
 		if ($departure_airport_icao != "")
1664 1664
 		{
1665 1665
 			if (!is_string($departure_airport_icao))
1666 1666
 			{
1667 1667
 				return false;
1668 1668
 			} else {
1669
-				$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1669
+				$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1670 1670
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)";
1671 1671
 				//$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";
1672 1672
 				$query_values = array(':departure_airport_icao' => $departure_airport_icao);
@@ -1679,10 +1679,10 @@  discard block
 block discarded – undo
1679 1679
 			{
1680 1680
 				return false;
1681 1681
 			} else {
1682
-				$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1682
+				$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1683 1683
 				$additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)";
1684 1684
 				//$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)";
1685
-				$query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao));
1685
+				$query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao));
1686 1686
 			}
1687 1687
 		}
1688 1688
 		
@@ -1690,8 +1690,8 @@  discard block
 block discarded – undo
1690 1690
 		{
1691 1691
 			$limit_array = explode(",", $limit);
1692 1692
 			
1693
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1694
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1693
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1694
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1695 1695
 			
1696 1696
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1697 1697
 			{
@@ -1730,15 +1730,15 @@  discard block
 block discarded – undo
1730 1730
 		global $global_query;
1731 1731
 		
1732 1732
 		date_default_timezone_set('UTC');
1733
-		$filter_query = $this->getFilter($filter,true,true);
1733
+		$filter_query = $this->getFilter($filter, true, true);
1734 1734
 		$limit_query = '';
1735 1735
 		
1736 1736
 		if ($limit != "")
1737 1737
 		{
1738 1738
 			$limit_array = explode(",", $limit);
1739 1739
 			
1740
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1741
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1740
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1741
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1742 1742
 			
1743 1743
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1744 1744
 			{
@@ -1755,7 +1755,7 @@  discard block
 block discarded – undo
1755 1755
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1756 1756
 		}
1757 1757
 
1758
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1758
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1759 1759
 
1760 1760
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1761 1761
 
@@ -1768,19 +1768,19 @@  discard block
 block discarded – undo
1768 1768
 	* @return String the highlight text
1769 1769
 	*
1770 1770
 	*/
1771
-	public function getHighlightByRegistration($registration,$filter = array())
1771
+	public function getHighlightByRegistration($registration, $filter = array())
1772 1772
 	{
1773 1773
 		global $global_query;
1774 1774
 		
1775 1775
 		date_default_timezone_set('UTC');
1776
-		$filter_query = $this->getFilter($filter,true,true);
1777
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
1776
+		$filter_query = $this->getFilter($filter, true, true);
1777
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
1778 1778
 		
1779
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1779
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1780 1780
 		$sth = $this->db->prepare($query);
1781 1781
 		$sth->execute(array(':registration' => $registration));
1782 1782
 
1783
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1783
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1784 1784
 		{
1785 1785
 			$highlight = $row['highlight'];
1786 1786
 		}
@@ -1796,14 +1796,14 @@  discard block
 block discarded – undo
1796 1796
 	* @return String usage
1797 1797
 	*
1798 1798
 	*/
1799
-	public function getSquawkUsage($squawk = '',$country = 'FR')
1799
+	public function getSquawkUsage($squawk = '', $country = 'FR')
1800 1800
 	{
1801 1801
 		
1802
-		$squawk = filter_var($squawk,FILTER_SANITIZE_STRING);
1803
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
1802
+		$squawk = filter_var($squawk, FILTER_SANITIZE_STRING);
1803
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
1804 1804
 
1805 1805
 		$query  = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1";
1806
-		$query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country);
1806
+		$query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country);
1807 1807
 		
1808 1808
 		$sth = $this->db->prepare($query);
1809 1809
 		$sth->execute($query_values);
@@ -1825,9 +1825,9 @@  discard block
 block discarded – undo
1825 1825
 	public function getAirportIcao($airport_iata = '')
1826 1826
 	{
1827 1827
 		
1828
-		$airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING);
1828
+		$airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING);
1829 1829
 
1830
-		$query  = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1830
+		$query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1831 1831
 		$query_values = array(':airport' => $airport_iata);
1832 1832
 		
1833 1833
 		$sth = $this->db->prepare($query);
@@ -1849,12 +1849,12 @@  discard block
 block discarded – undo
1849 1849
 	* @return Float distance to the airport
1850 1850
 	*
1851 1851
 	*/
1852
-	public function getAirportDistance($airport_icao,$latitude,$longitude)
1852
+	public function getAirportDistance($airport_icao, $latitude, $longitude)
1853 1853
 	{
1854 1854
 		
1855
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
1855
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
1856 1856
 
1857
-		$query  = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
1857
+		$query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
1858 1858
 		$query_values = array(':airport' => $airport_icao);
1859 1859
 		$sth = $this->db->prepare($query);
1860 1860
 		$sth->execute($query_values);
@@ -1864,7 +1864,7 @@  discard block
 block discarded – undo
1864 1864
 			$airport_latitude = $row['latitude'];
1865 1865
 			$airport_longitude = $row['longitude'];
1866 1866
 			$Common = new Common();
1867
-			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
1867
+			return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude);
1868 1868
 		} else return '';
1869 1869
 	}
1870 1870
 	
@@ -1878,11 +1878,11 @@  discard block
 block discarded – undo
1878 1878
 	public function getAllAirportInfo($airport = '')
1879 1879
 	{
1880 1880
 		
1881
-		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
1881
+		$airport = filter_var($airport, FILTER_SANITIZE_STRING);
1882 1882
 
1883 1883
 		$query_values = array();
1884 1884
 		if ($airport == 'NA') {
1885
-			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' => ''));
1885
+			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' => ''));
1886 1886
 		} elseif ($airport == '') {
1887 1887
 			$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";
1888 1888
 		} else {
@@ -1930,14 +1930,14 @@  discard block
 block discarded – undo
1930 1930
 	{
1931 1931
 		$lst_countries = '';
1932 1932
 		foreach ($countries as $country) {
1933
-			$country = filter_var($country,FILTER_SANITIZE_STRING);
1933
+			$country = filter_var($country, FILTER_SANITIZE_STRING);
1934 1934
 			if ($lst_countries == '') {
1935 1935
 				$lst_countries = "'".$country."'";
1936 1936
 			} else {
1937 1937
 				$lst_countries .= ",'".$country."'";
1938 1938
 			}
1939 1939
 		}
1940
-		$query  = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
1940
+		$query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
1941 1941
 		
1942 1942
 		$sth = $this->db->prepare($query);
1943 1943
 		$sth->execute();
@@ -1945,7 +1945,7 @@  discard block
 block discarded – undo
1945 1945
 		$airport_array = array();
1946 1946
 		$temp_array = array();
1947 1947
 		
1948
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1948
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1949 1949
 		{
1950 1950
 			$temp_array['name'] = $row['name'];
1951 1951
 			$temp_array['city'] = $row['city'];
@@ -1973,10 +1973,10 @@  discard block
 block discarded – undo
1973 1973
 	{
1974 1974
 		global $globalDBdriver;
1975 1975
 		if (is_array($coord)) {
1976
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1977
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1978
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1979
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1976
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1977
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1978
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1979
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1980 1980
 		} else return array();
1981 1981
 		if ($globalDBdriver == 'mysql') {
1982 1982
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
@@ -1988,7 +1988,7 @@  discard block
 block discarded – undo
1988 1988
     
1989 1989
 		$airport_array = array();
1990 1990
 		
1991
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1991
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1992 1992
 		{
1993 1993
 			$temp_array = $row;
1994 1994
 
@@ -2008,13 +2008,13 @@  discard block
 block discarded – undo
2008 2008
 	public function getAllWaypointsInfobyCoord($coord)
2009 2009
 	{
2010 2010
 		if (is_array($coord)) {
2011
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2012
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2013
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2014
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2011
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2012
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2013
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2014
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2015 2015
 		} else return array();
2016 2016
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2017
-		$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.")";
2017
+		$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.")";
2018 2018
 		//$query  = "SELECT waypoints.* FROM waypoints";
2019 2019
 		//$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";
2020 2020
 		//$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;
@@ -2026,7 +2026,7 @@  discard block
 block discarded – undo
2026 2026
     
2027 2027
 		$waypoints_array = array();
2028 2028
 		
2029
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2029
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2030 2030
 		{
2031 2031
 			$temp_array = $row;
2032 2032
 
@@ -2048,10 +2048,10 @@  discard block
 block discarded – undo
2048 2048
 	{
2049 2049
 		global $globalUseRealAirlines;
2050 2050
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2051
-		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2051
+		$airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING));
2052 2052
 		if ($airline_icao == 'NA') {
2053 2053
 			$airline_array = array();
2054
-			$airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2054
+			$airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2055 2055
 			return $airline_array;
2056 2056
 		} else {
2057 2057
 			if (strlen($airline_icao) == 2) {
@@ -2072,7 +2072,7 @@  discard block
 block discarded – undo
2072 2072
 			if ($fromsource === NULL) {
2073 2073
 				$sth->execute(array(':airline_icao' => $airline_icao));
2074 2074
 			} else {
2075
-				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2075
+				$sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource));
2076 2076
 			}
2077 2077
                         /*
2078 2078
 			$airline_array = array();
@@ -2114,12 +2114,12 @@  discard block
 block discarded – undo
2114 2114
 	*/
2115 2115
 	public function getAllAircraftInfo($aircraft_type)
2116 2116
 	{
2117
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2117
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2118 2118
 
2119 2119
 		if ($aircraft_type == 'NA') {
2120
-			return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2120
+			return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2121 2121
 		}
2122
-		$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";
2122
+		$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";
2123 2123
 		
2124 2124
 		$sth = $this->db->prepare($query);
2125 2125
 		$sth->execute(array(':aircraft_type' => $aircraft_type));
@@ -2151,7 +2151,7 @@  discard block
 block discarded – undo
2151 2151
 	*/
2152 2152
 	public function getAircraftIcao($aircraft_type)
2153 2153
 	{
2154
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2154
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2155 2155
 		$all_aircraft = array('737-300' => 'B733',
2156 2156
 				'777-200' => 'B772',
2157 2157
 				'777-200ER' => 'B772',
@@ -2163,10 +2163,10 @@  discard block
 block discarded – undo
2163 2163
 				'A380' => 'A388');
2164 2164
 		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2165 2165
 
2166
-		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2166
+		$query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2167 2167
 		$aircraft_type = strtoupper($aircraft_type);
2168 2168
 		$sth = $this->db->prepare($query);
2169
-		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2169
+		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,));
2170 2170
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2171 2171
 		if (isset($result[0]['icao'])) return $result[0]['icao'];
2172 2172
 		else return '';
@@ -2181,9 +2181,9 @@  discard block
 block discarded – undo
2181 2181
 	*/
2182 2182
 	public function getAllAircraftType($aircraft_modes)
2183 2183
 	{
2184
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
2184
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
2185 2185
 
2186
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
2186
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
2187 2187
 		
2188 2188
 		$sth = $this->db->prepare($query);
2189 2189
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -2204,9 +2204,9 @@  discard block
 block discarded – undo
2204 2204
 	*/
2205 2205
 	public function getAllAircraftTypeByRegistration($registration)
2206 2206
 	{
2207
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2207
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2208 2208
 
2209
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1";
2209
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1";
2210 2210
 		
2211 2211
 		$sth = $this->db->prepare($query);
2212 2212
 		$sth->execute(array(':registration' => $registration));
@@ -2227,8 +2227,8 @@  discard block
 block discarded – undo
2227 2227
 	*/
2228 2228
 	public function getOperator($operator)
2229 2229
 	{
2230
-		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
2231
-		$query  = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2230
+		$operator = filter_var($operator, FILTER_SANITIZE_STRING);
2231
+		$query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2232 2232
 		
2233 2233
 		$sth = $this->db->prepare($query);
2234 2234
 		$sth->execute(array(':operator' => $operator));
@@ -2249,9 +2249,9 @@  discard block
 block discarded – undo
2249 2249
 	*/
2250 2250
 	public function getRouteInfo($callsign)
2251 2251
 	{
2252
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2252
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
2253 2253
                 if ($callsign == '') return array();
2254
-		$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";
2254
+		$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";
2255 2255
 		
2256 2256
 		$sth = $this->db->prepare($query);
2257 2257
 		$sth->execute(array(':callsign' => $callsign));
@@ -2272,9 +2272,9 @@  discard block
 block discarded – undo
2272 2272
 	*/
2273 2273
 	public function getAircraftInfoByRegistration($registration)
2274 2274
 	{
2275
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2275
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2276 2276
 
2277
-		$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";
2277
+		$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";
2278 2278
 		
2279 2279
 		$sth = $this->db->prepare($query);
2280 2280
 		$sth->execute(array(':registration' => $registration));
@@ -2282,7 +2282,7 @@  discard block
 block discarded – undo
2282 2282
 		$aircraft_array = array();
2283 2283
 		$temp_array = array();
2284 2284
 		
2285
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2285
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2286 2286
 		{
2287 2287
 			$temp_array['airline_icao'] = $row['airline_icao'];
2288 2288
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -2304,7 +2304,7 @@  discard block
 block discarded – undo
2304 2304
 	*/
2305 2305
 	public function getAircraftOwnerByRegistration($registration)
2306 2306
 	{
2307
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2307
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2308 2308
 		$Connection = new Connection($this->db);
2309 2309
 		if ($Connection->tableExists('aircraft_owner')) {
2310 2310
 			$query  = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1";
@@ -2326,7 +2326,7 @@  discard block
 block discarded – undo
2326 2326
 	public function getAllFlightsforSitemap()
2327 2327
 	{
2328 2328
 		//$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 ";
2329
-		$query  = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2329
+		$query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2330 2330
 		
2331 2331
 		$sth = $this->db->prepare($query);
2332 2332
 		$sth->execute();
@@ -2373,7 +2373,7 @@  discard block
 block discarded – undo
2373 2373
 		$manufacturer_array = array();
2374 2374
 		$temp_array = array();
2375 2375
 		
2376
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2376
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2377 2377
 		{
2378 2378
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
2379 2379
 
@@ -2410,7 +2410,7 @@  discard block
 block discarded – undo
2410 2410
 		$aircraft_array = array();
2411 2411
 		$temp_array = array();
2412 2412
 		
2413
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2413
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2414 2414
 		{
2415 2415
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
2416 2416
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
@@ -2431,8 +2431,8 @@  discard block
 block discarded – undo
2431 2431
 	*/
2432 2432
 	public function getAllAircraftRegistrations($filters = array())
2433 2433
 	{
2434
-		$filter_query = $this->getFilter($filters,true,true);
2435
-		$query  = "SELECT DISTINCT spotter_output.registration 
2434
+		$filter_query = $this->getFilter($filters, true, true);
2435
+		$query = "SELECT DISTINCT spotter_output.registration 
2436 2436
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' 
2437 2437
 				ORDER BY spotter_output.registration ASC";
2438 2438
 
@@ -2442,7 +2442,7 @@  discard block
 block discarded – undo
2442 2442
 		$aircraft_array = array();
2443 2443
 		$temp_array = array();
2444 2444
 		
2445
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2445
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2446 2446
 		{
2447 2447
 			$temp_array['registration'] = $row['registration'];
2448 2448
 
@@ -2459,11 +2459,11 @@  discard block
 block discarded – undo
2459 2459
 	* @return Array list of source name
2460 2460
 	*
2461 2461
 	*/
2462
-	public function getAllSourceName($type = '',$filters = array())
2462
+	public function getAllSourceName($type = '', $filters = array())
2463 2463
 	{
2464
-		$filter_query = $this->getFilter($filters,true,true);
2464
+		$filter_query = $this->getFilter($filters, true, true);
2465 2465
 		$query_values = array();
2466
-		$query  = "SELECT DISTINCT spotter_output.source_name 
2466
+		$query = "SELECT DISTINCT spotter_output.source_name 
2467 2467
 				FROM spotter_output".$filter_query." spotter_output.source_name <> ''";
2468 2468
 		if ($type != '') {
2469 2469
 			$query_values = array(':type' => $type);
@@ -2478,7 +2478,7 @@  discard block
 block discarded – undo
2478 2478
 		$source_array = array();
2479 2479
 		$temp_array = array();
2480 2480
 		
2481
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2481
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2482 2482
 		{
2483 2483
 			$temp_array['source_name'] = $row['source_name'];
2484 2484
 			$source_array[] = $temp_array;
@@ -2494,11 +2494,11 @@  discard block
 block discarded – undo
2494 2494
 	* @return Array list of airline names
2495 2495
 	*
2496 2496
 	*/
2497
-	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2497
+	public function getAllAirlineNames($airline_type = '', $forsource = NULL, $filters = array())
2498 2498
 	{
2499
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2500
-		$filter_query = $this->getFilter($filters,true,true);
2501
-		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
2499
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2500
+		$filter_query = $this->getFilter($filters, true, true);
2501
+		$airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
2502 2502
 		if ($airline_type == '' || $airline_type == 'all') {
2503 2503
 			/*
2504 2504
 			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
@@ -2517,7 +2517,7 @@  discard block
 block discarded – undo
2517 2517
 				$query_data = array(':forsource' => $forsource);
2518 2518
 			}
2519 2519
 		} else {
2520
-			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2520
+			$query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2521 2521
 					FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
2522 2522
 					AND spotter_output.airline_type = :airline_type 
2523 2523
 					ORDER BY spotter_output.airline_icao ASC";
@@ -2530,7 +2530,7 @@  discard block
 block discarded – undo
2530 2530
 		$airline_array = array();
2531 2531
 		$temp_array = array();
2532 2532
 		
2533
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2533
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2534 2534
 		{
2535 2535
 			$temp_array['airline_icao'] = $row['airline_icao'];
2536 2536
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -2550,8 +2550,8 @@  discard block
 block discarded – undo
2550 2550
 	*/
2551 2551
 	public function getAllAirlineCountries($filters = array())
2552 2552
 	{
2553
-		$filter_query = $this->getFilter($filters,true,true);
2554
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2553
+		$filter_query = $this->getFilter($filters, true, true);
2554
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2555 2555
 				FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2556 2556
 				ORDER BY spotter_output.airline_country ASC";
2557 2557
 		
@@ -2562,7 +2562,7 @@  discard block
 block discarded – undo
2562 2562
 		$airline_array = array();
2563 2563
 		$temp_array = array();
2564 2564
 		
2565
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2565
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2566 2566
 		{
2567 2567
 			$temp_array['airline_country'] = $row['airline_country'];
2568 2568
 
@@ -2582,9 +2582,9 @@  discard block
 block discarded – undo
2582 2582
 	*/
2583 2583
 	public function getAllAirportNames($filters = array())
2584 2584
 	{
2585
-		$filter_query = $this->getFilter($filters,true,true);
2585
+		$filter_query = $this->getFilter($filters, true, true);
2586 2586
 		$airport_array = array();
2587
-		$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
2587
+		$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
2588 2588
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' 
2589 2589
 				ORDER BY spotter_output.departure_airport_city ASC";
2590 2590
 		
@@ -2593,7 +2593,7 @@  discard block
 block discarded – undo
2593 2593
 		$sth->execute();
2594 2594
 
2595 2595
 		$temp_array = array();
2596
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2596
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2597 2597
 		{
2598 2598
 			$temp_array['airport_icao'] = $row['airport_icao'];
2599 2599
 			$temp_array['airport_name'] = $row['airport_name'];
@@ -2603,14 +2603,14 @@  discard block
 block discarded – undo
2603 2603
 			$airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array;
2604 2604
 		}
2605 2605
 
2606
-		$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
2606
+		$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
2607 2607
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' 
2608 2608
 								ORDER BY spotter_output.arrival_airport_city ASC";
2609 2609
 					
2610 2610
 		$sth = $this->db->prepare($query);
2611 2611
 		$sth->execute();
2612 2612
 
2613
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2613
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2614 2614
 			{
2615 2615
 		//	if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao'])
2616 2616
 		//	{
@@ -2650,21 +2650,21 @@  discard block
 block discarded – undo
2650 2650
    
2651 2651
 		$temp_array = array();
2652 2652
 		
2653
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2653
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2654 2654
 		{
2655 2655
 			$temp_array['airport_country'] = $row['airport_country'];
2656 2656
 
2657 2657
 			$airport_array[$row['airport_country']] = $temp_array;
2658 2658
 		}
2659
-		$filter_query = $this->getFilter($filters,true,true);
2660
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2659
+		$filter_query = $this->getFilter($filters, true, true);
2660
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2661 2661
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2662 2662
 								ORDER BY spotter_output.arrival_airport_country ASC";
2663 2663
 					
2664 2664
 		$sth = $this->db->prepare($query);
2665 2665
 		$sth->execute();
2666 2666
 		
2667
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2667
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2668 2668
 		{
2669 2669
 			if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country'])
2670 2670
 			{
@@ -2687,9 +2687,9 @@  discard block
 block discarded – undo
2687 2687
 	*/
2688 2688
 	public function getAllCountries($filters = array())
2689 2689
 	{
2690
-		$Connection= new Connection($this->db);
2690
+		$Connection = new Connection($this->db);
2691 2691
 		if ($Connection->tableExists('countries')) {
2692
-			$query  = "SELECT countries.name AS airport_country
2692
+			$query = "SELECT countries.name AS airport_country
2693 2693
 				FROM countries
2694 2694
 				ORDER BY countries.name ASC";
2695 2695
 			$sth = $this->db->prepare($query);
@@ -2698,14 +2698,14 @@  discard block
 block discarded – undo
2698 2698
 			$temp_array = array();
2699 2699
 			$country_array = array();
2700 2700
 		
2701
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2701
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2702 2702
 			{
2703 2703
 				$temp_array['country'] = $row['airport_country'];
2704 2704
 				$country_array[$row['airport_country']] = $temp_array;
2705 2705
 			}
2706 2706
 		} else {
2707
-			$filter_query = $this->getFilter($filters,true,true);
2708
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2707
+			$filter_query = $this->getFilter($filters, true, true);
2708
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2709 2709
 								FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' 
2710 2710
 								ORDER BY spotter_output.departure_airport_country ASC";
2711 2711
 
@@ -2714,20 +2714,20 @@  discard block
 block discarded – undo
2714 2714
    
2715 2715
 			$temp_array = array();
2716 2716
 			$country_array = array();
2717
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2717
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2718 2718
 			{
2719 2719
 				$temp_array['country'] = $row['airport_country'];
2720 2720
 				$country_array[$row['airport_country']] = $temp_array;
2721 2721
 			}
2722 2722
 
2723
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2723
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2724 2724
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2725 2725
 								ORDER BY spotter_output.arrival_airport_country ASC";
2726 2726
 					
2727 2727
 		$sth = $this->db->prepare($query);
2728 2728
 		$sth->execute();
2729 2729
 		
2730
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2730
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2731 2731
 		{
2732 2732
 			if ($country_array[$row['airport_country']]['country'] != $row['airport_country'])
2733 2733
 			{
@@ -2737,14 +2737,14 @@  discard block
 block discarded – undo
2737 2737
 			}
2738 2738
 		}
2739 2739
 		
2740
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2740
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2741 2741
 								FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2742 2742
 								ORDER BY spotter_output.airline_country ASC";
2743 2743
 					
2744 2744
 		$sth = $this->db->prepare($query);
2745 2745
 		$sth->execute();
2746 2746
 		
2747
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2747
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2748 2748
 		{
2749 2749
 			if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country'])
2750 2750
 			{
@@ -2768,8 +2768,8 @@  discard block
 block discarded – undo
2768 2768
 	*/
2769 2769
 	public function getAllIdents($filters = array())
2770 2770
 	{
2771
-		$filter_query = $this->getFilter($filters,true,true);
2772
-		$query  = "SELECT DISTINCT spotter_output.ident
2771
+		$filter_query = $this->getFilter($filters, true, true);
2772
+		$query = "SELECT DISTINCT spotter_output.ident
2773 2773
 								FROM spotter_output".$filter_query." spotter_output.ident <> '' 
2774 2774
 								ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0";
2775 2775
 
@@ -2779,7 +2779,7 @@  discard block
 block discarded – undo
2779 2779
 		$ident_array = array();
2780 2780
 		$temp_array = array();
2781 2781
 		
2782
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2782
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2783 2783
 		{
2784 2784
 			$temp_array['ident'] = $row['ident'];
2785 2785
 			$ident_array[] = $temp_array;
@@ -2793,9 +2793,9 @@  discard block
 block discarded – undo
2793 2793
 	* @return Array number, icao, name and city of airports
2794 2794
 	*/
2795 2795
 
2796
-	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
2796
+	public function getLast7DaysAirportsDeparture($airport_icao = '', $filters = array()) {
2797 2797
 		global $globalTimezone, $globalDBdriver;
2798
-		$filter_query = $this->getFilter($filters,true,true);
2798
+		$filter_query = $this->getFilter($filters, true, true);
2799 2799
 		if ($globalTimezone != '') {
2800 2800
 			date_default_timezone_set($globalTimezone);
2801 2801
 			$datetime = new DateTime();
@@ -2860,7 +2860,7 @@  discard block
 block discarded – undo
2860 2860
 
2861 2861
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
2862 2862
 		global $globalTimezone, $globalDBdriver;
2863
-		$filter_query = $this->getFilter($filters,true,true);
2863
+		$filter_query = $this->getFilter($filters, true, true);
2864 2864
 		if ($globalTimezone != '') {
2865 2865
 			date_default_timezone_set($globalTimezone);
2866 2866
 			$datetime = new DateTime();
@@ -2944,7 +2944,7 @@  discard block
 block discarded – undo
2944 2944
 
2945 2945
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
2946 2946
 		global $globalTimezone, $globalDBdriver;
2947
-		$filter_query = $this->getFilter($filters,true,true);
2947
+		$filter_query = $this->getFilter($filters, true, true);
2948 2948
 		if ($globalTimezone != '') {
2949 2949
 			date_default_timezone_set($globalTimezone);
2950 2950
 			$datetime = new DateTime();
@@ -2977,9 +2977,9 @@  discard block
 block discarded – undo
2977 2977
 	* @return Array number, icao, name and city of airports
2978 2978
 	*/
2979 2979
 
2980
-	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
2980
+	public function getLast7DaysDetectedAirportsArrival($airport_icao = '', $filters = array()) {
2981 2981
 		global $globalTimezone, $globalDBdriver;
2982
-		$filter_query = $this->getFilter($filters,true,true);
2982
+		$filter_query = $this->getFilter($filters, true, true);
2983 2983
 		if ($globalTimezone != '') {
2984 2984
 			date_default_timezone_set($globalTimezone);
2985 2985
 			$datetime = new DateTime();
@@ -3111,12 +3111,12 @@  discard block
 block discarded – undo
3111 3111
 		} else $offset = '+00:00';
3112 3112
 
3113 3113
 		if ($globalDBdriver == 'mysql') {
3114
-			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3114
+			$query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3115 3115
 								FROM spotter_output
3116 3116
 								WHERE spotter_output.date <> '' 
3117 3117
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
3118 3118
 		} else {
3119
-			$query  = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3119
+			$query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3120 3120
 								FROM spotter_output
3121 3121
 								WHERE spotter_output.date <> '' 
3122 3122
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
@@ -3128,7 +3128,7 @@  discard block
 block discarded – undo
3128 3128
 		$date_array = array();
3129 3129
 		$temp_array = array();
3130 3130
 		
3131
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3131
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3132 3132
 		{
3133 3133
 			$temp_array['date'] = $row['date'];
3134 3134
 
@@ -3148,7 +3148,7 @@  discard block
 block discarded – undo
3148 3148
 	*/
3149 3149
 	public function getAllRoutes()
3150 3150
 	{
3151
-		$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 
3151
+		$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 
3152 3152
 				FROM spotter_output
3153 3153
 				WHERE spotter_output.ident <> '' 
3154 3154
 				GROUP BY route
@@ -3159,7 +3159,7 @@  discard block
 block discarded – undo
3159 3159
 
3160 3160
 		$routes_array = array();
3161 3161
 		$temp_array = array();
3162
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3162
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3163 3163
 		{
3164 3164
 			$temp_array['route'] = $row['route'];
3165 3165
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -3178,21 +3178,21 @@  discard block
 block discarded – undo
3178 3178
 	* @return String success or false
3179 3179
 	*
3180 3180
 	*/	
3181
-	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3181
+	public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL)
3182 3182
 	{
3183 3183
 		if (!is_numeric(substr($ident, 0, 3)))
3184 3184
 		{
3185 3185
 			if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3186
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3186
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3187 3187
 			} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3188
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3188
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3189 3189
 			} else {
3190 3190
 				$airline_array = $this->getAllAirlineInfo("NA");
3191 3191
 			}
3192 3192
 			if (count($airline_array) == 0) {
3193 3193
 				$airline_array = $this->getAllAirlineInfo("NA");
3194 3194
 			}
3195
-			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3195
+			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3196 3196
 				$airline_array = $this->getAllAirlineInfo("NA");
3197 3197
 			}
3198 3198
 		} else {
@@ -3205,7 +3205,7 @@  discard block
 block discarded – undo
3205 3205
 
3206 3206
 
3207 3207
 		$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';
3208
-                $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);
3208
+                $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);
3209 3209
 
3210 3210
 		try {
3211 3211
 			$sth = $this->db->prepare($query);
@@ -3226,11 +3226,11 @@  discard block
 block discarded – undo
3226 3226
 	* @return String success or false
3227 3227
 	*
3228 3228
 	*/	
3229
-	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3229
+	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '')
3230 3230
 	{
3231 3231
 		if ($groundspeed == '') $groundspeed = NULL;
3232 3232
 		$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';
3233
-                $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);
3233
+                $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);
3234 3234
 
3235 3235
 		try {
3236 3236
 			$sth = $this->db->prepare($query);
@@ -3270,7 +3270,7 @@  discard block
 block discarded – undo
3270 3270
 	* @param String $verticalrate vertival rate of flight
3271 3271
 	* @return String success or false
3272 3272
 	*/
3273
-	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 = '')
3273
+	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 = '')
3274 3274
 	{
3275 3275
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
3276 3276
 		
@@ -3294,13 +3294,13 @@  discard block
 block discarded – undo
3294 3294
 				if ($ModeS != '') {
3295 3295
 					$timeelapsed = microtime(true);
3296 3296
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3297
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3297
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3298 3298
 				} else {
3299
-					$myhex = explode('-',$flightaware_id);
3299
+					$myhex = explode('-', $flightaware_id);
3300 3300
 					if (count($myhex) > 0) {
3301 3301
 						$timeelapsed = microtime(true);
3302 3302
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3303
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3303
+						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3304 3304
 					}
3305 3305
 				}
3306 3306
 			}
@@ -3322,24 +3322,24 @@  discard block
 block discarded – undo
3322 3322
 				{
3323 3323
 					$timeelapsed = microtime(true);
3324 3324
 					if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3325
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3325
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3326 3326
 					} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3327
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3327
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3328 3328
 					} else {
3329 3329
 						$airline_array = $this->getAllAirlineInfo("NA");
3330 3330
 					}
3331 3331
 					if (count($airline_array) == 0) {
3332 3332
 						$airline_array = $this->getAllAirlineInfo("NA");
3333 3333
 					}
3334
-					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3334
+					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3335 3335
 						$airline_array = $this->getAllAirlineInfo("NA");
3336 3336
 					}
3337
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3337
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3338 3338
 
3339 3339
 				} else {
3340 3340
 					$timeelapsed = microtime(true);
3341 3341
 					$airline_array = $this->getAllAirlineInfo("NA");
3342
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3342
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3343 3343
 				}
3344 3344
 			}
3345 3345
 		} else $airline_array = array();
@@ -3356,27 +3356,27 @@  discard block
 block discarded – undo
3356 3356
 				{
3357 3357
 					$timeelapsed = microtime(true);
3358 3358
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3359
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3359
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3360 3360
 				} else {
3361 3361
 					$timeelapsed = microtime(true);
3362 3362
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3363
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3363
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3364 3364
 				}
3365 3365
 			}
3366 3366
 		} else {
3367 3367
 			if ($ModeS != '') {
3368 3368
 				$timeelapsed = microtime(true);
3369 3369
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3370
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3370
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3371 3371
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3372 3372
 				{
3373 3373
 					$timeelapsed = microtime(true);
3374 3374
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3375
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3375
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3376 3376
 				} else {
3377 3377
 					$timeelapsed = microtime(true);
3378 3378
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3379
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3379
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3380 3380
 				}
3381 3381
 			}
3382 3382
 		}
@@ -3391,7 +3391,7 @@  discard block
 block discarded – undo
3391 3391
 			} else {
3392 3392
 				$timeelapsed = microtime(true);
3393 3393
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3394
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3394
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3395 3395
 			}
3396 3396
 		}
3397 3397
 		
@@ -3405,7 +3405,7 @@  discard block
 block discarded – undo
3405 3405
 			} else {
3406 3406
 				$timeelapsed = microtime(true);
3407 3407
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3408
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3408
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3409 3409
 			}
3410 3410
 		}
3411 3411
 
@@ -3469,7 +3469,7 @@  discard block
 block discarded – undo
3469 3469
 		{
3470 3470
 			$timeelapsed = microtime(true);
3471 3471
 			$image_array = $Image->getSpotterImage($registration);
3472
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3472
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3473 3473
 			if (!isset($image_array[0]['registration']))
3474 3474
 			{
3475 3475
 				//echo "Add image !!!! \n";
@@ -3477,7 +3477,7 @@  discard block
 block discarded – undo
3477 3477
 			}
3478 3478
 			$timeelapsed = microtime(true);
3479 3479
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3480
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3480
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3481 3481
 			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3482 3482
 		}
3483 3483
     
@@ -3485,33 +3485,33 @@  discard block
 block discarded – undo
3485 3485
 		{
3486 3486
             		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3487 3487
             		else $airline_icao = '';
3488
-			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3488
+			$image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao);
3489 3489
 			if (!isset($image_array[0]['registration']))
3490 3490
 			{
3491 3491
 				//echo "Add image !!!! \n";
3492
-				$Image->addSpotterImage('',$aircraft_icao,$airline_icao);
3492
+				$Image->addSpotterImage('', $aircraft_icao, $airline_icao);
3493 3493
 			}
3494 3494
 		}
3495 3495
     
3496
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
3497
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
3498
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
3499
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3500
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
3501
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
3502
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3503
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3504
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
3505
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3506
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
3507
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3508
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
3509
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
3510
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
3511
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
3512
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
3513
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
3514
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
3496
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
3497
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
3498
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
3499
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3500
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
3501
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
3502
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3503
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3504
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
3505
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3506
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
3507
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3508
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
3509
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
3510
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
3511
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
3512
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
3513
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
3514
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
3515 3515
 	
3516 3516
 		if (count($airline_array) == 0) 
3517 3517
 		{
@@ -3539,7 +3539,7 @@  discard block
 block discarded – undo
3539 3539
                 if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3540 3540
                 if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3541 3541
                 if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3542
-                $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) 
3542
+                $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) 
3543 3543
                 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)";
3544 3544
 
3545 3545
                 $airline_name = $airline_array[0]['name'];
@@ -3549,7 +3549,7 @@  discard block
 block discarded – undo
3549 3549
 		if ($airline_type == '') {
3550 3550
 			$timeelapsed = microtime(true);
3551 3551
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3552
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3552
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3553 3553
 		}
3554 3554
 		if ($airline_type == null) $airline_type = '';
3555 3555
                 $aircraft_type = $aircraft_array[0]['type'];
@@ -3560,7 +3560,7 @@  discard block
 block discarded – undo
3560 3560
                 $arrival_airport_name = $arrival_airport_array[0]['name'];
3561 3561
                 $arrival_airport_city = $arrival_airport_array[0]['city'];
3562 3562
                 $arrival_airport_country = $arrival_airport_array[0]['country'];
3563
-                $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);
3563
+                $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);
3564 3564
 
3565 3565
 		try {
3566 3566
 		        
@@ -3586,13 +3586,13 @@  discard block
 block discarded – undo
3586 3586
 	{
3587 3587
 		global $globalDBdriver, $globalTimezone;
3588 3588
 		if ($globalDBdriver == 'mysql') {
3589
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3589
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3590 3590
 								WHERE spotter_output.ident = :ident 
3591 3591
 								AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
3592 3592
 								AND spotter_output.date < UTC_TIMESTAMP()";
3593 3593
 			$query_data = array(':ident' => $ident);
3594 3594
 		} else {
3595
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3595
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3596 3596
 								WHERE spotter_output.ident = :ident 
3597 3597
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3598 3598
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
@@ -3601,8 +3601,8 @@  discard block
 block discarded – undo
3601 3601
 		
3602 3602
 		$sth = $this->db->prepare($query);
3603 3603
 		$sth->execute($query_data);
3604
-    		$ident_result='';
3605
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3604
+    		$ident_result = '';
3605
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3606 3606
 		{
3607 3607
 			$ident_result = $row['ident'];
3608 3608
 		}
@@ -3628,8 +3628,8 @@  discard block
 block discarded – undo
3628 3628
 				return false;
3629 3629
 			} else {
3630 3630
 				$q_array = explode(" ", $q);
3631
-				foreach ($q_array as $q_item){
3632
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
3631
+				foreach ($q_array as $q_item) {
3632
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
3633 3633
 					$additional_query .= " AND (";
3634 3634
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
3635 3635
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
@@ -3644,11 +3644,11 @@  discard block
 block discarded – undo
3644 3644
 			}
3645 3645
 		}
3646 3646
 		if ($globalDBdriver == 'mysql') {
3647
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3647
+			$query = "SELECT spotter_output.* FROM spotter_output 
3648 3648
 				WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
3649 3649
 				AND spotter_output.date < UTC_TIMESTAMP()";
3650 3650
 		} else {
3651
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3651
+			$query = "SELECT spotter_output.* FROM spotter_output 
3652 3652
 				WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
3653 3653
 				AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
3654 3654
 		}
@@ -3665,11 +3665,11 @@  discard block
 block discarded – undo
3665 3665
 	* @return Array the airline list
3666 3666
 	*
3667 3667
 	*/
3668
-	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3668
+	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3669 3669
 	{
3670 3670
 		global $globalDBdriver;
3671
-		$filter_query = $this->getFilter($filters,true,true);
3672
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3671
+		$filter_query = $this->getFilter($filters, true, true);
3672
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3673 3673
 		 			FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA' ";
3674 3674
 		if ($olderthanmonths > 0) {
3675 3675
 			if ($globalDBdriver == 'mysql') {
@@ -3693,7 +3693,7 @@  discard block
 block discarded – undo
3693 3693
  
3694 3694
 		$airline_array = array();
3695 3695
 		$temp_array = array();
3696
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3696
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3697 3697
 		{
3698 3698
 			$temp_array['airline_name'] = $row['airline_name'];
3699 3699
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3710,11 +3710,11 @@  discard block
 block discarded – undo
3710 3710
 	* @return Array the pilots list
3711 3711
 	*
3712 3712
 	*/
3713
-	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3713
+	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3714 3714
 	{
3715 3715
 		global $globalDBdriver;
3716
-		$filter_query = $this->getFilter($filters,true,true);
3717
-		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3716
+		$filter_query = $this->getFilter($filters, true, true);
3717
+		$query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3718 3718
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3719 3719
                 if ($olderthanmonths > 0) {
3720 3720
             		if ($globalDBdriver == 'mysql') {
@@ -3740,7 +3740,7 @@  discard block
 block discarded – undo
3740 3740
 		$airline_array = array();
3741 3741
 		$temp_array = array();
3742 3742
         
3743
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3743
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3744 3744
 		{
3745 3745
 			$temp_array['pilot_name'] = $row['pilot_name'];
3746 3746
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -3760,7 +3760,7 @@  discard block
 block discarded – undo
3760 3760
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3761 3761
 	{
3762 3762
 		global $globalDBdriver;
3763
-		$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
3763
+		$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
3764 3764
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
3765 3765
                 if ($olderthanmonths > 0) {
3766 3766
             		if ($globalDBdriver == 'mysql') {
@@ -3786,7 +3786,7 @@  discard block
 block discarded – undo
3786 3786
 		$airline_array = array();
3787 3787
 		$temp_array = array();
3788 3788
         
3789
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3789
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3790 3790
 		{
3791 3791
 			$temp_array['pilot_name'] = $row['pilot_name'];
3792 3792
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -3804,11 +3804,11 @@  discard block
 block discarded – undo
3804 3804
 	* @return Array the pilots list
3805 3805
 	*
3806 3806
 	*/
3807
-	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3807
+	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3808 3808
 	{
3809 3809
 		global $globalDBdriver;
3810
-		$filter_query = $this->getFilter($filters,true,true);
3811
-		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3810
+		$filter_query = $this->getFilter($filters, true, true);
3811
+		$query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3812 3812
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3813 3813
                 if ($olderthanmonths > 0) {
3814 3814
             		if ($globalDBdriver == 'mysql') {
@@ -3834,7 +3834,7 @@  discard block
 block discarded – undo
3834 3834
 		$airline_array = array();
3835 3835
 		$temp_array = array();
3836 3836
         
3837
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3837
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3838 3838
 		{
3839 3839
 			$temp_array['owner_name'] = $row['owner_name'];
3840 3840
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -3849,11 +3849,11 @@  discard block
 block discarded – undo
3849 3849
 	* @return Array the pilots list
3850 3850
 	*
3851 3851
 	*/
3852
-	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3852
+	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3853 3853
 	{
3854 3854
 		global $globalDBdriver;
3855
-		$filter_query = $this->getFilter($filters,true,true);
3856
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3855
+		$filter_query = $this->getFilter($filters, true, true);
3856
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3857 3857
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3858 3858
                 if ($olderthanmonths > 0) {
3859 3859
             		if ($globalDBdriver == 'mysql') {
@@ -3879,7 +3879,7 @@  discard block
 block discarded – undo
3879 3879
 		$airline_array = array();
3880 3880
 		$temp_array = array();
3881 3881
         
3882
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3882
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3883 3883
 		{
3884 3884
 			$temp_array['owner_name'] = $row['owner_name'];
3885 3885
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -3895,11 +3895,11 @@  discard block
 block discarded – undo
3895 3895
 	* @return Array the airline list
3896 3896
 	*
3897 3897
 	*/
3898
-	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
3898
+	public function countAllAirlinesByAircraft($aircraft_icao, $filters = array())
3899 3899
 	{
3900
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3901
-		$filter_query = $this->getFilter($filters,true,true);
3902
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3900
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3901
+		$filter_query = $this->getFilter($filters, true, true);
3902
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3903 3903
 		 	    FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
3904 3904
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
3905 3905
 			    ORDER BY airline_count DESC";
@@ -3911,7 +3911,7 @@  discard block
 block discarded – undo
3911 3911
 		$airline_array = array();
3912 3912
 		$temp_array = array();
3913 3913
         
3914
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3914
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3915 3915
 		{
3916 3916
 			$temp_array['airline_name'] = $row['airline_name'];
3917 3917
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3931,11 +3931,11 @@  discard block
 block discarded – undo
3931 3931
 	* @return Array the airline country list
3932 3932
 	*
3933 3933
 	*/
3934
-	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
3934
+	public function countAllAirlineCountriesByAircraft($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_country, COUNT(spotter_output.airline_country) AS airline_country_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_country, COUNT(spotter_output.airline_country) AS airline_country_count
3939 3939
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
3940 3940
                     GROUP BY spotter_output.airline_country
3941 3941
 					ORDER BY airline_country_count DESC
@@ -3948,7 +3948,7 @@  discard block
 block discarded – undo
3948 3948
 		$airline_country_array = array();
3949 3949
 		$temp_array = array();
3950 3950
         
3951
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3951
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3952 3952
 		{
3953 3953
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
3954 3954
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -3967,11 +3967,11 @@  discard block
 block discarded – undo
3967 3967
 	* @return Array the airline list
3968 3968
 	*
3969 3969
 	*/
3970
-	public function countAllAirlinesByAirport($airport_icao,$filters = array())
3970
+	public function countAllAirlinesByAirport($airport_icao, $filters = array())
3971 3971
 	{
3972
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
3973
-		$filter_query = $this->getFilter($filters,true,true);
3974
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3972
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
3973
+		$filter_query = $this->getFilter($filters, true, true);
3974
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3975 3975
 		    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 ) 
3976 3976
                     GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country
3977 3977
 		    ORDER BY airline_count DESC";
@@ -3983,7 +3983,7 @@  discard block
 block discarded – undo
3983 3983
 		$airline_array = array();
3984 3984
 		$temp_array = array();
3985 3985
         
3986
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3986
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3987 3987
 		{
3988 3988
 			$temp_array['airline_name'] = $row['airline_name'];
3989 3989
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4002,11 +4002,11 @@  discard block
 block discarded – undo
4002 4002
 	* @return Array the airline country list
4003 4003
 	*
4004 4004
 	*/
4005
-	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4005
+	public function countAllAirlineCountriesByAirport($airport_icao, $filters = array())
4006 4006
 	{
4007
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4008
-		$filter_query = $this->getFilter($filters,true,true);
4009
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4007
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4008
+		$filter_query = $this->getFilter($filters, true, true);
4009
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4010 4010
 		 			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 )
4011 4011
 					GROUP BY spotter_output.airline_country
4012 4012
 					ORDER BY airline_country_count DESC
@@ -4019,7 +4019,7 @@  discard block
 block discarded – undo
4019 4019
 		$airline_country_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_country_count'] = $row['airline_country_count'];
4025 4025
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4036,11 +4036,11 @@  discard block
 block discarded – undo
4036 4036
 	* @return Array the airline list
4037 4037
 	*
4038 4038
 	*/
4039
-	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4039
+	public function countAllAirlinesByManufacturer($aircraft_manufacturer, $filters = array())
4040 4040
 	{
4041
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4042
-		$filter_query = $this->getFilter($filters,true,true);
4043
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4041
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4042
+		$filter_query = $this->getFilter($filters, true, true);
4043
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4044 4044
 		 			FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4045 4045
 					GROUP BY spotter_output.airline_name
4046 4046
 					ORDER BY airline_count DESC";
@@ -4051,7 +4051,7 @@  discard block
 block discarded – undo
4051 4051
 		$airline_array = array();
4052 4052
 		$temp_array = array();
4053 4053
         
4054
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4054
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4055 4055
 		{
4056 4056
 			$temp_array['airline_name'] = $row['airline_name'];
4057 4057
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4071,11 +4071,11 @@  discard block
 block discarded – undo
4071 4071
 	* @return Array the airline country list
4072 4072
 	*
4073 4073
 	*/
4074
-	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4074
+	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer, $filters = array())
4075 4075
 	{
4076
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4077
-		$filter_query = $this->getFilter($filters,true,true);
4078
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4076
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4077
+		$filter_query = $this->getFilter($filters, true, true);
4078
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4079 4079
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4080 4080
 					GROUP BY spotter_output.airline_country
4081 4081
 					ORDER BY airline_country_count DESC
@@ -4088,7 +4088,7 @@  discard block
 block discarded – undo
4088 4088
 		$airline_country_array = array();
4089 4089
 		$temp_array = array();
4090 4090
         
4091
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4091
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4092 4092
 		{
4093 4093
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4094 4094
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4104,11 +4104,11 @@  discard block
 block discarded – undo
4104 4104
 	* @return Array the airline list
4105 4105
 	*
4106 4106
 	*/
4107
-	public function countAllAirlinesByDate($date,$filters = array())
4107
+	public function countAllAirlinesByDate($date, $filters = array())
4108 4108
 	{
4109 4109
 		global $globalTimezone, $globalDBdriver;
4110
-		$filter_query = $this->getFilter($filters,true,true);
4111
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4110
+		$filter_query = $this->getFilter($filters, true, true);
4111
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4112 4112
 		if ($globalTimezone != '') {
4113 4113
 			date_default_timezone_set($globalTimezone);
4114 4114
 			$datetime = new DateTime($date);
@@ -4116,12 +4116,12 @@  discard block
 block discarded – undo
4116 4116
 		} else $offset = '+00:00';
4117 4117
 
4118 4118
 		if ($globalDBdriver == 'mysql') {
4119
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4119
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4120 4120
 		 			FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4121 4121
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country 
4122 4122
 					ORDER BY airline_count DESC";
4123 4123
 		} else {
4124
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4124
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4125 4125
 		 			FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4126 4126
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country
4127 4127
 					ORDER BY airline_count DESC";
@@ -4132,7 +4132,7 @@  discard block
 block discarded – undo
4132 4132
 
4133 4133
 		$airline_array = array();
4134 4134
 		$temp_array = array();
4135
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4135
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4136 4136
 		{
4137 4137
 			$temp_array['airline_name'] = $row['airline_name'];
4138 4138
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4152,11 +4152,11 @@  discard block
 block discarded – undo
4152 4152
 	* @return Array the airline country list
4153 4153
 	*
4154 4154
 	*/
4155
-	public function countAllAirlineCountriesByDate($date,$filters = array())
4155
+	public function countAllAirlineCountriesByDate($date, $filters = array())
4156 4156
 	{
4157 4157
 		global $globalTimezone, $globalDBdriver;
4158
-		$filter_query = $this->getFilter($filters,true,true);
4159
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4158
+		$filter_query = $this->getFilter($filters, true, true);
4159
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4160 4160
 		if ($globalTimezone != '') {
4161 4161
 			date_default_timezone_set($globalTimezone);
4162 4162
 			$datetime = new DateTime($date);
@@ -4164,13 +4164,13 @@  discard block
 block discarded – undo
4164 4164
 		} else $offset = '+00:00';
4165 4165
 		
4166 4166
 		if ($globalDBdriver == 'mysql') {
4167
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4167
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4168 4168
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4169 4169
 					GROUP BY spotter_output.airline_country
4170 4170
 					ORDER BY airline_country_count DESC
4171 4171
 					LIMIT 10 OFFSET 0";
4172 4172
 		} else {
4173
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4173
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4174 4174
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4175 4175
 					GROUP BY spotter_output.airline_country
4176 4176
 					ORDER BY airline_country_count DESC
@@ -4182,7 +4182,7 @@  discard block
 block discarded – undo
4182 4182
  
4183 4183
 		$airline_country_array = array();
4184 4184
 		$temp_array = array();
4185
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4185
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4186 4186
 		{
4187 4187
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4188 4188
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4199,11 +4199,11 @@  discard block
 block discarded – undo
4199 4199
 	* @return Array the airline list
4200 4200
 	*
4201 4201
 	*/
4202
-	public function countAllAirlinesByIdent($ident,$filters = array())
4202
+	public function countAllAirlinesByIdent($ident, $filters = array())
4203 4203
 	{
4204
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4205
-		$filter_query = $this->getFilter($filters,true,true);
4206
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4204
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4205
+		$filter_query = $this->getFilter($filters, true, true);
4206
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4207 4207
 		 		FROM spotter_output".$filter_query." spotter_output.ident = :ident  
4208 4208
 				GROUP BY spotter_output.airline_name
4209 4209
 				ORDER BY airline_count DESC";
@@ -4215,7 +4215,7 @@  discard block
 block discarded – undo
4215 4215
 		$airline_array = array();
4216 4216
 		$temp_array = array();
4217 4217
         
4218
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4218
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4219 4219
 		{
4220 4220
 			$temp_array['airline_name'] = $row['airline_name'];
4221 4221
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4233,25 +4233,25 @@  discard block
 block discarded – undo
4233 4233
 	* @return Array the airline list
4234 4234
 	*
4235 4235
 	*/
4236
-	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4236
+	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4237 4237
 	{
4238
-		$filter_query = $this->getFilter($filters,true,true);
4239
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4240
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4238
+		$filter_query = $this->getFilter($filters, true, true);
4239
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4240
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4241 4241
 
4242
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
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.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4244 4244
 					GROUP BY spotter_output.airline_name
4245 4245
 					ORDER BY airline_count DESC";
4246 4246
       
4247 4247
 		
4248 4248
 		$sth = $this->db->prepare($query);
4249
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4249
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4250 4250
       
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,13 +4269,13 @@  discard block
 block discarded – undo
4269 4269
 	* @return Array the airline country list
4270 4270
 	*
4271 4271
 	*/
4272
-	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4272
+	public function countAllAirlineCountriesByRoute($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_country, COUNT(spotter_output.airline_country) AS airline_country_count
4278
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4279 4279
 		 		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) 
4280 4280
 				GROUP BY spotter_output.airline_country
4281 4281
 				ORDER BY airline_country_count DESC
@@ -4283,11 +4283,11 @@  discard block
 block discarded – undo
4283 4283
       
4284 4284
 		
4285 4285
 		$sth = $this->db->prepare($query);
4286
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4286
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4287 4287
       
4288 4288
 		$airline_country_array = array();
4289 4289
 		$temp_array = array();
4290
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4290
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4291 4291
 		{
4292 4292
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4293 4293
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4305,11 +4305,11 @@  discard block
 block discarded – undo
4305 4305
 	* @return Array the airline list
4306 4306
 	*
4307 4307
 	*/
4308
-	public function countAllAirlinesByCountry($country,$filters = array())
4308
+	public function countAllAirlinesByCountry($country, $filters = array())
4309 4309
 	{
4310
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4311
-		$filter_query = $this->getFilter($filters,true,true);
4312
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4310
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4311
+		$filter_query = $this->getFilter($filters, true, true);
4312
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4313 4313
 		 	    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
4314 4314
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4315 4315
 			    ORDER BY airline_count DESC";
@@ -4320,7 +4320,7 @@  discard block
 block discarded – undo
4320 4320
 
4321 4321
 		$airline_array = array();
4322 4322
 		$temp_array = array();
4323
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4323
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4324 4324
 		{
4325 4325
 			$temp_array['airline_name'] = $row['airline_name'];
4326 4326
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4339,11 +4339,11 @@  discard block
 block discarded – undo
4339 4339
 	* @return Array the airline country list
4340 4340
 	*
4341 4341
 	*/
4342
-	public function countAllAirlineCountriesByCountry($country,$filters = array())
4342
+	public function countAllAirlineCountriesByCountry($country, $filters = array())
4343 4343
 	{
4344
-		$filter_query = $this->getFilter($filters,true,true);
4345
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4346
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4344
+		$filter_query = $this->getFilter($filters, true, true);
4345
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4346
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4347 4347
 		 		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 
4348 4348
 				GROUP BY spotter_output.airline_country
4349 4349
 				ORDER BY airline_country_count DESC
@@ -4355,7 +4355,7 @@  discard block
 block discarded – undo
4355 4355
 
4356 4356
 		$airline_country_array = array();
4357 4357
 		$temp_array = array();
4358
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4358
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4359 4359
 		{
4360 4360
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4361 4361
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4374,8 +4374,8 @@  discard block
 block discarded – undo
4374 4374
 	*/
4375 4375
 	public function countAllAirlineCountries($limit = true, $filters = array())
4376 4376
 	{
4377
-		$filter_query = $this->getFilter($filters,true,true);
4378
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4377
+		$filter_query = $this->getFilter($filters, true, true);
4378
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4379 4379
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' 
4380 4380
 					GROUP BY spotter_output.airline_country
4381 4381
 					ORDER BY airline_country_count DESC";
@@ -4386,7 +4386,7 @@  discard block
 block discarded – undo
4386 4386
 
4387 4387
 		$airline_array = array();
4388 4388
 		$temp_array = array();
4389
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4389
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4390 4390
 		{
4391 4391
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4392 4392
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4402,11 +4402,11 @@  discard block
 block discarded – undo
4402 4402
 	* @return Array the airline country list
4403 4403
 	*
4404 4404
 	*/
4405
-	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4405
+	public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4406 4406
 	{
4407 4407
 		global $globalDBdriver;
4408 4408
 		//$filter_query = $this->getFilter($filters,true,true);
4409
-		$Connection= new Connection($this->db);
4409
+		$Connection = new Connection($this->db);
4410 4410
 		if (!$Connection->tableExists('countries')) return array();
4411 4411
 		/*
4412 4412
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -4421,7 +4421,7 @@  discard block
 block discarded – undo
4421 4421
 */
4422 4422
 		require_once('class.SpotterLive.php');
4423 4423
 		$SpotterLive = new SpotterLive();
4424
-		$filter_query = $SpotterLive->getFilter($filters,true,true);
4424
+		$filter_query = $SpotterLive->getFilter($filters, true, true);
4425 4425
 		$filter_query .= ' over_country IS NOT NULL';
4426 4426
                 if ($olderthanmonths > 0) {
4427 4427
 			if ($globalDBdriver == 'mysql') {
@@ -4448,7 +4448,7 @@  discard block
 block discarded – undo
4448 4448
 		$flight_array = array();
4449 4449
 		$temp_array = array();
4450 4450
         
4451
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4451
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4452 4452
 		{
4453 4453
 			$temp_array['flight_count'] = $row['nb'];
4454 4454
 			$temp_array['flight_country'] = $row['name'];
@@ -4466,12 +4466,12 @@  discard block
 block discarded – undo
4466 4466
 	* @return Array the aircraft list
4467 4467
 	*
4468 4468
 	*/
4469
-	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4469
+	public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4470 4470
 	{
4471 4471
 		global $globalDBdriver;
4472
-		$filter_query = $this->getFilter($filters,true,true);
4472
+		$filter_query = $this->getFilter($filters, true, true);
4473 4473
 
4474
-		$query  = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4474
+		$query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4475 4475
 		    FROM spotter_output ".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> ''";
4476 4476
 		if ($olderthanmonths > 0) {
4477 4477
 			if ($globalDBdriver == 'mysql') {
@@ -4496,7 +4496,7 @@  discard block
 block discarded – undo
4496 4496
 
4497 4497
 		$aircraft_array = array();
4498 4498
 		$temp_array = array();
4499
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4499
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4500 4500
 		{
4501 4501
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4502 4502
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4513,11 +4513,11 @@  discard block
 block discarded – undo
4513 4513
 	* @return Array the aircraft list
4514 4514
 	*
4515 4515
 	*/
4516
-	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4516
+	public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4517 4517
 	{
4518 4518
 		global $globalDBdriver;
4519
-		$filter_query = $this->getFilter($filters,true,true);
4520
-		$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 
4519
+		$filter_query = $this->getFilter($filters, true, true);
4520
+		$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 
4521 4521
 		    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' ";
4522 4522
 		if ($olderthanmonths > 0) {
4523 4523
 			if ($globalDBdriver == 'mysql') {
@@ -4542,7 +4542,7 @@  discard block
 block discarded – undo
4542 4542
 
4543 4543
 		$aircraft_array = array();
4544 4544
 		$temp_array = array();
4545
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4545
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4546 4546
 		{
4547 4547
 			$temp_array['airline_icao'] = $row['airline_icao'];
4548 4548
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -4560,11 +4560,11 @@  discard block
 block discarded – undo
4560 4560
 	* @return Array the aircraft list
4561 4561
 	*
4562 4562
 	*/
4563
-	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4563
+	public function countAllAircraftTypesByMonths($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4564 4564
 	{
4565 4565
 		global $globalDBdriver;
4566
-		$filter_query = $this->getFilter($filters,true,true);
4567
-		$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 
4566
+		$filter_query = $this->getFilter($filters, true, true);
4567
+		$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 
4568 4568
 		    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' ";
4569 4569
 		if ($olderthanmonths > 0) {
4570 4570
 			if ($globalDBdriver == 'mysql') {
@@ -4589,7 +4589,7 @@  discard block
 block discarded – undo
4589 4589
 
4590 4590
 		$aircraft_array = array();
4591 4591
 		$temp_array = array();
4592
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4592
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4593 4593
 		{
4594 4594
 			//$temp_array['airline_icao'] = $row['airline_icao'];
4595 4595
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -4608,13 +4608,13 @@  discard block
 block discarded – undo
4608 4608
 	* @return Array the aircraft list
4609 4609
 	*
4610 4610
 	*/
4611
-	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
4611
+	public function countAllAircraftRegistrationByAircraft($aircraft_icao, $filters = array())
4612 4612
 	{
4613 4613
 		$Image = new Image($this->db);
4614
-		$filter_query = $this->getFilter($filters,true,true);
4615
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4614
+		$filter_query = $this->getFilter($filters, true, true);
4615
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4616 4616
 
4617
-		$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  
4617
+		$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  
4618 4618
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao  
4619 4619
 				GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4620 4620
 				ORDER BY registration_count DESC";
@@ -4625,14 +4625,14 @@  discard block
 block discarded – undo
4625 4625
 		$aircraft_array = array();
4626 4626
 		$temp_array = array();
4627 4627
         
4628
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4628
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4629 4629
 		{
4630 4630
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4631 4631
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4632 4632
 			$temp_array['registration'] = $row['registration'];
4633 4633
 			$temp_array['airline_name'] = $row['airline_name'];
4634 4634
 			$temp_array['image_thumbnail'] = "";
4635
-			if($row['registration'] != "")
4635
+			if ($row['registration'] != "")
4636 4636
 			{
4637 4637
 				$image_array = $Image->getSpotterImage($row['registration']);
4638 4638
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4651,11 +4651,11 @@  discard block
 block discarded – undo
4651 4651
 	* @return Array the aircraft list
4652 4652
 	*
4653 4653
 	*/
4654
-	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
4654
+	public function countAllAircraftTypesByAirline($airline_icao, $filters = array())
4655 4655
 	{
4656
-		$filter_query = $this->getFilter($filters,true,true);
4657
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4658
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4656
+		$filter_query = $this->getFilter($filters, true, true);
4657
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4658
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4659 4659
 			    FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao 
4660 4660
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
4661 4661
 			    ORDER BY aircraft_icao_count DESC";
@@ -4666,7 +4666,7 @@  discard block
 block discarded – undo
4666 4666
 		$aircraft_array = array();
4667 4667
 		$temp_array = array();
4668 4668
 
4669
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4669
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4670 4670
 		{
4671 4671
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4672 4672
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4684,13 +4684,13 @@  discard block
 block discarded – undo
4684 4684
 	* @return Array the aircraft list
4685 4685
 	*
4686 4686
 	*/
4687
-	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
4687
+	public function countAllAircraftRegistrationByAirline($airline_icao, $filters = array())
4688 4688
 	{
4689
-		$filter_query = $this->getFilter($filters,true,true);
4689
+		$filter_query = $this->getFilter($filters, true, true);
4690 4690
 		$Image = new Image($this->db);
4691
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4691
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4692 4692
 
4693
-		$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 
4693
+		$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 
4694 4694
 			    FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao 
4695 4695
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
4696 4696
 			    ORDER BY registration_count DESC";
@@ -4700,14 +4700,14 @@  discard block
 block discarded – undo
4700 4700
 
4701 4701
 		$aircraft_array = array();
4702 4702
 		$temp_array = array();
4703
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4703
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4704 4704
 		{
4705 4705
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4706 4706
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4707 4707
 			$temp_array['registration'] = $row['registration'];
4708 4708
 			$temp_array['airline_name'] = $row['airline_name'];
4709 4709
 			$temp_array['image_thumbnail'] = "";
4710
-			if($row['registration'] != "")
4710
+			if ($row['registration'] != "")
4711 4711
 			{
4712 4712
 				$image_array = $Image->getSpotterImage($row['registration']);
4713 4713
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4726,11 +4726,11 @@  discard block
 block discarded – undo
4726 4726
 	* @return Array the aircraft list
4727 4727
 	*
4728 4728
 	*/
4729
-	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
4729
+	public function countAllAircraftManufacturerByAirline($airline_icao, $filters = array())
4730 4730
 	{
4731
-		$filter_query = $this->getFilter($filters,true,true);
4732
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4733
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4731
+		$filter_query = $this->getFilter($filters, true, true);
4732
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4733
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4734 4734
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao 
4735 4735
 				GROUP BY spotter_output.aircraft_manufacturer 
4736 4736
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -4741,7 +4741,7 @@  discard block
 block discarded – undo
4741 4741
 		$aircraft_array = array();
4742 4742
 		$temp_array = array();
4743 4743
 
4744
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4744
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4745 4745
 		{
4746 4746
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4747 4747
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4758,12 +4758,12 @@  discard block
 block discarded – undo
4758 4758
 	* @return Array the aircraft list
4759 4759
 	*
4760 4760
 	*/
4761
-	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
4761
+	public function countAllAircraftTypesByAirport($airport_icao, $filters = array())
4762 4762
 	{
4763
-		$filter_query = $this->getFilter($filters,true,true);
4764
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4763
+		$filter_query = $this->getFilter($filters, true, true);
4764
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4765 4765
 
4766
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4766
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4767 4767
 				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) 
4768 4768
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
4769 4769
 				ORDER BY aircraft_icao_count DESC";
@@ -4773,7 +4773,7 @@  discard block
 block discarded – undo
4773 4773
 
4774 4774
 		$aircraft_array = array();
4775 4775
 		$temp_array = array();
4776
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4776
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4777 4777
 		{
4778 4778
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4779 4779
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4791,13 +4791,13 @@  discard block
 block discarded – undo
4791 4791
 	* @return Array the aircraft list
4792 4792
 	*
4793 4793
 	*/
4794
-	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
4794
+	public function countAllAircraftRegistrationByAirport($airport_icao, $filters = array())
4795 4795
 	{
4796
-		$filter_query = $this->getFilter($filters,true,true);
4796
+		$filter_query = $this->getFilter($filters, true, true);
4797 4797
 		$Image = new Image($this->db);
4798
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4798
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4799 4799
 
4800
-		$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  
4800
+		$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  
4801 4801
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)   
4802 4802
                     GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
4803 4803
 		    ORDER BY registration_count DESC";
@@ -4807,14 +4807,14 @@  discard block
 block discarded – undo
4807 4807
 
4808 4808
 		$aircraft_array = array();
4809 4809
 		$temp_array = array();
4810
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4810
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4811 4811
 		{
4812 4812
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4813 4813
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4814 4814
 			$temp_array['registration'] = $row['registration'];
4815 4815
 			$temp_array['airline_name'] = $row['airline_name'];
4816 4816
 			$temp_array['image_thumbnail'] = "";
4817
-			if($row['registration'] != "")
4817
+			if ($row['registration'] != "")
4818 4818
 			{
4819 4819
 				$image_array = $Image->getSpotterImage($row['registration']);
4820 4820
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4832,11 +4832,11 @@  discard block
 block discarded – undo
4832 4832
 	* @return Array the aircraft list
4833 4833
 	*
4834 4834
 	*/
4835
-	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
4835
+	public function countAllAircraftManufacturerByAirport($airport_icao, $filters = array())
4836 4836
 	{
4837
-		$filter_query = $this->getFilter($filters,true,true);
4838
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4839
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4837
+		$filter_query = $this->getFilter($filters, true, true);
4838
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4839
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4840 4840
                     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)  
4841 4841
                     GROUP BY spotter_output.aircraft_manufacturer 
4842 4842
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -4847,7 +4847,7 @@  discard block
 block discarded – undo
4847 4847
 
4848 4848
 		$aircraft_array = array();
4849 4849
 		$temp_array = array();
4850
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4850
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4851 4851
 		{
4852 4852
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4853 4853
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4862,12 +4862,12 @@  discard block
 block discarded – undo
4862 4862
 	* @return Array the aircraft list
4863 4863
 	*
4864 4864
 	*/
4865
-	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
4865
+	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer, $filters = array())
4866 4866
 	{
4867
-		$filter_query = $this->getFilter($filters,true,true);
4868
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4867
+		$filter_query = $this->getFilter($filters, true, true);
4868
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4869 4869
 
4870
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4870
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4871 4871
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
4872 4872
                     GROUP BY spotter_output.aircraft_name 
4873 4873
 					ORDER BY aircraft_icao_count DESC";
@@ -4876,7 +4876,7 @@  discard block
 block discarded – undo
4876 4876
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
4877 4877
 		$aircraft_array = array();
4878 4878
 		$temp_array = array();
4879
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4879
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4880 4880
 		{
4881 4881
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4882 4882
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4895,11 +4895,11 @@  discard block
 block discarded – undo
4895 4895
 	*/
4896 4896
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
4897 4897
 	{
4898
-		$filter_query = $this->getFilter($filters,true,true);
4898
+		$filter_query = $this->getFilter($filters, true, true);
4899 4899
 		$Image = new Image($this->db);
4900
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4900
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4901 4901
 
4902
-		$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   
4902
+		$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   
4903 4903
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
4904 4904
                     GROUP BY spotter_output.registration 
4905 4905
 					ORDER BY registration_count DESC";
@@ -4909,14 +4909,14 @@  discard block
 block discarded – undo
4909 4909
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
4910 4910
 		$aircraft_array = array();
4911 4911
 		$temp_array = array();
4912
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4912
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4913 4913
 		{
4914 4914
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4915 4915
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4916 4916
 			$temp_array['registration'] = $row['registration'];
4917 4917
 			$temp_array['airline_name'] = $row['airline_name'];
4918 4918
 			$temp_array['image_thumbnail'] = "";
4919
-			if($row['registration'] != "")
4919
+			if ($row['registration'] != "")
4920 4920
 			{
4921 4921
 				$image_array = $Image->getSpotterImage($row['registration']);
4922 4922
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4933,11 +4933,11 @@  discard block
 block discarded – undo
4933 4933
 	* @return Array the aircraft list
4934 4934
 	*
4935 4935
 	*/
4936
-	public function countAllAircraftTypesByDate($date,$filters = array())
4936
+	public function countAllAircraftTypesByDate($date, $filters = array())
4937 4937
 	{
4938 4938
 		global $globalTimezone, $globalDBdriver;
4939
-		$filter_query = $this->getFilter($filters,true,true);
4940
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4939
+		$filter_query = $this->getFilter($filters, true, true);
4940
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4941 4941
 		if ($globalTimezone != '') {
4942 4942
 			date_default_timezone_set($globalTimezone);
4943 4943
 			$datetime = new DateTime($date);
@@ -4945,12 +4945,12 @@  discard block
 block discarded – undo
4945 4945
 		} else $offset = '+00:00';
4946 4946
 
4947 4947
 		if ($globalDBdriver == 'mysql') {
4948
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4948
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4949 4949
 					FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
4950 4950
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
4951 4951
 					ORDER BY aircraft_icao_count DESC";
4952 4952
 		} else {
4953
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4953
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4954 4954
 					FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
4955 4955
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
4956 4956
 					ORDER BY aircraft_icao_count DESC";
@@ -4961,7 +4961,7 @@  discard block
 block discarded – undo
4961 4961
 
4962 4962
 		$aircraft_array = array();
4963 4963
 		$temp_array = array();
4964
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4964
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4965 4965
 		{
4966 4966
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4967 4967
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4979,12 +4979,12 @@  discard block
 block discarded – undo
4979 4979
 	* @return Array the aircraft list
4980 4980
 	*
4981 4981
 	*/
4982
-	public function countAllAircraftRegistrationByDate($date,$filters = array())
4982
+	public function countAllAircraftRegistrationByDate($date, $filters = array())
4983 4983
 	{
4984 4984
 		global $globalTimezone, $globalDBdriver;
4985
-		$filter_query = $this->getFilter($filters,true,true);
4985
+		$filter_query = $this->getFilter($filters, true, true);
4986 4986
 		$Image = new Image($this->db);
4987
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4987
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4988 4988
 		if ($globalTimezone != '') {
4989 4989
 			date_default_timezone_set($globalTimezone);
4990 4990
 			$datetime = new DateTime($date);
@@ -4992,12 +4992,12 @@  discard block
 block discarded – undo
4992 4992
 		} else $offset = '+00:00';
4993 4993
 
4994 4994
 		if ($globalDBdriver == 'mysql') {
4995
-			$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 
4995
+			$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 
4996 4996
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4997 4997
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
4998 4998
 					ORDER BY registration_count DESC";
4999 4999
 		} else {
5000
-			$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    
5000
+			$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    
5001 5001
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5002 5002
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5003 5003
 					ORDER BY registration_count DESC";
@@ -5008,14 +5008,14 @@  discard block
 block discarded – undo
5008 5008
 
5009 5009
 		$aircraft_array = array();
5010 5010
 		$temp_array = array();
5011
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5011
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5012 5012
 		{
5013 5013
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5014 5014
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5015 5015
 			$temp_array['registration'] = $row['registration'];
5016 5016
 			$temp_array['airline_name'] = $row['airline_name'];
5017 5017
 			$temp_array['image_thumbnail'] = "";
5018
-			if($row['registration'] != "")
5018
+			if ($row['registration'] != "")
5019 5019
 			{
5020 5020
 				$image_array = $Image->getSpotterImage($row['registration']);
5021 5021
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5034,11 +5034,11 @@  discard block
 block discarded – undo
5034 5034
 	* @return Array the aircraft manufacturer list
5035 5035
 	*
5036 5036
 	*/
5037
-	public function countAllAircraftManufacturerByDate($date,$filters = array())
5037
+	public function countAllAircraftManufacturerByDate($date, $filters = array())
5038 5038
 	{
5039 5039
 		global $globalTimezone, $globalDBdriver;
5040
-		$filter_query = $this->getFilter($filters,true,true);
5041
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5040
+		$filter_query = $this->getFilter($filters, true, true);
5041
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5042 5042
 		if ($globalTimezone != '') {
5043 5043
 			date_default_timezone_set($globalTimezone);
5044 5044
 			$datetime = new DateTime($date);
@@ -5046,12 +5046,12 @@  discard block
 block discarded – undo
5046 5046
 		} else $offset = '+00:00';
5047 5047
 
5048 5048
 		if ($globalDBdriver == 'mysql') {
5049
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5049
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5050 5050
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
5051 5051
 				GROUP BY spotter_output.aircraft_manufacturer 
5052 5052
 				ORDER BY aircraft_manufacturer_count DESC";
5053 5053
 		} else {
5054
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5054
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5055 5055
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5056 5056
 				GROUP BY spotter_output.aircraft_manufacturer 
5057 5057
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -5063,7 +5063,7 @@  discard block
 block discarded – undo
5063 5063
 		$aircraft_array = array();
5064 5064
 		$temp_array = array();
5065 5065
 
5066
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5066
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5067 5067
 		{
5068 5068
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5069 5069
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5080,11 +5080,11 @@  discard block
 block discarded – undo
5080 5080
 	* @return Array the aircraft list
5081 5081
 	*
5082 5082
 	*/
5083
-	public function countAllAircraftTypesByIdent($ident,$filters = array())
5083
+	public function countAllAircraftTypesByIdent($ident, $filters = array())
5084 5084
 	{
5085
-		$filter_query = $this->getFilter($filters,true,true);
5086
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5087
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5085
+		$filter_query = $this->getFilter($filters, true, true);
5086
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5087
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5088 5088
 				FROM spotter_output".$filter_query." spotter_output.ident = :ident 
5089 5089
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
5090 5090
 				ORDER BY aircraft_icao_count DESC";
@@ -5095,7 +5095,7 @@  discard block
 block discarded – undo
5095 5095
 		$aircraft_array = array();
5096 5096
 		$temp_array = array();
5097 5097
 
5098
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5098
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5099 5099
 		{
5100 5100
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5101 5101
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5113,13 +5113,13 @@  discard block
 block discarded – undo
5113 5113
 	* @return Array the aircraft list
5114 5114
 	*
5115 5115
 	*/
5116
-	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5116
+	public function countAllAircraftRegistrationByIdent($ident, $filters = array())
5117 5117
 	{
5118
-		$filter_query = $this->getFilter($filters,true,true);
5118
+		$filter_query = $this->getFilter($filters, true, true);
5119 5119
 		$Image = new Image($this->db);
5120
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5120
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5121 5121
 
5122
-		$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  
5122
+		$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  
5123 5123
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.ident = :ident   
5124 5124
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
5125 5125
 		    ORDER BY registration_count DESC";
@@ -5131,14 +5131,14 @@  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'];
5138 5138
 			$temp_array['registration'] = $row['registration'];
5139 5139
 			$temp_array['airline_name'] = $row['airline_name'];
5140 5140
 			$temp_array['image_thumbnail'] = "";
5141
-			if($row['registration'] != "")
5141
+			if ($row['registration'] != "")
5142 5142
 			{
5143 5143
 				$image_array = $Image->getSpotterImage($row['registration']);
5144 5144
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5157,11 +5157,11 @@  discard block
 block discarded – undo
5157 5157
 	* @return Array the aircraft manufacturer list
5158 5158
 	*
5159 5159
 	*/
5160
-	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5160
+	public function countAllAircraftManufacturerByIdent($ident, $filters = array())
5161 5161
 	{
5162
-		$filter_query = $this->getFilter($filters,true,true);
5163
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5164
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5162
+		$filter_query = $this->getFilter($filters, true, true);
5163
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5164
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5165 5165
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident  
5166 5166
                     GROUP BY spotter_output.aircraft_manufacturer 
5167 5167
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5171,7 +5171,7 @@  discard block
 block discarded – undo
5171 5171
 		$sth->execute(array(':ident' => $ident));
5172 5172
 		$aircraft_array = array();
5173 5173
 		$temp_array = array();
5174
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5174
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5175 5175
 		{
5176 5176
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5177 5177
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5187,24 +5187,24 @@  discard block
 block discarded – undo
5187 5187
 	* @return Array the aircraft list
5188 5188
 	*
5189 5189
 	*/
5190
-	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5190
+	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5191 5191
 	{
5192
-		$filter_query = $this->getFilter($filters,true,true);
5193
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5194
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5192
+		$filter_query = $this->getFilter($filters, true, true);
5193
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5194
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5195 5195
 		
5196 5196
 
5197
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5197
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5198 5198
                     FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
5199 5199
                     GROUP BY spotter_output.aircraft_name 
5200 5200
 					ORDER BY aircraft_icao_count DESC";
5201 5201
  
5202 5202
 		
5203 5203
 		$sth = $this->db->prepare($query);
5204
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5204
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5205 5205
 		$aircraft_array = array();
5206 5206
 		$temp_array = array();
5207
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5207
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5208 5208
 		{
5209 5209
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5210 5210
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5220,33 +5220,33 @@  discard block
 block discarded – undo
5220 5220
 	* @return Array the aircraft list
5221 5221
 	*
5222 5222
 	*/
5223
-	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5223
+	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5224 5224
 	{
5225
-		$filter_query = $this->getFilter($filters,true,true);
5225
+		$filter_query = $this->getFilter($filters, true, true);
5226 5226
 		$Image = new Image($this->db);
5227
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5228
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5227
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5228
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5229 5229
 
5230
-		$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   
5230
+		$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   
5231 5231
                     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)   
5232 5232
                     GROUP BY spotter_output.registration 
5233 5233
 					ORDER BY registration_count DESC";
5234 5234
 
5235 5235
 		
5236 5236
 		$sth = $this->db->prepare($query);
5237
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5237
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5238 5238
       
5239 5239
 		$aircraft_array = array();
5240 5240
 		$temp_array = array();
5241 5241
         
5242
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5242
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5243 5243
 		{
5244 5244
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5245 5245
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5246 5246
 			$temp_array['registration'] = $row['registration'];
5247 5247
 			$temp_array['airline_name'] = $row['airline_name'];
5248 5248
 			$temp_array['image_thumbnail'] = "";
5249
-			if($row['registration'] != "")
5249
+			if ($row['registration'] != "")
5250 5250
 			{
5251 5251
 				$image_array = $Image->getSpotterImage($row['registration']);
5252 5252
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5266,25 +5266,25 @@  discard block
 block discarded – undo
5266 5266
 	* @return Array the aircraft manufacturer list
5267 5267
 	*
5268 5268
 	*/
5269
-	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5269
+	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5270 5270
 	{
5271
-		$filter_query = $this->getFilter($filters,true,true);
5272
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5273
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5271
+		$filter_query = $this->getFilter($filters, true, true);
5272
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5273
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5274 5274
 
5275
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5275
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5276 5276
                     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) 
5277 5277
                     GROUP BY spotter_output.aircraft_manufacturer 
5278 5278
 					ORDER BY aircraft_manufacturer_count DESC";
5279 5279
 
5280 5280
 		
5281 5281
 		$sth = $this->db->prepare($query);
5282
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5282
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5283 5283
       
5284 5284
 		$aircraft_array = array();
5285 5285
 		$temp_array = array();
5286 5286
         
5287
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5287
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5288 5288
 		{
5289 5289
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5290 5290
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5304,11 +5304,11 @@  discard block
 block discarded – undo
5304 5304
 	* @return Array the aircraft list
5305 5305
 	*
5306 5306
 	*/
5307
-	public function countAllAircraftTypesByCountry($country,$filters = array())
5307
+	public function countAllAircraftTypesByCountry($country, $filters = array())
5308 5308
 	{
5309
-		$filter_query = $this->getFilter($filters,true,true);
5310
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5311
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5309
+		$filter_query = $this->getFilter($filters, true, true);
5310
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5311
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5312 5312
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
5313 5313
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5314 5314
 			    ORDER BY aircraft_icao_count DESC";
@@ -5320,7 +5320,7 @@  discard block
 block discarded – undo
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_icao'] = $row['aircraft_icao'];
5326 5326
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5339,12 +5339,12 @@  discard block
 block discarded – undo
5339 5339
 	* @return Array the aircraft list
5340 5340
 	*
5341 5341
 	*/
5342
-	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5342
+	public function countAllAircraftRegistrationByCountry($country, $filters = array())
5343 5343
 	{
5344
-		$filter_query = $this->getFilter($filters,true,true);
5344
+		$filter_query = $this->getFilter($filters, true, true);
5345 5345
 		$Image = new Image($this->db);
5346
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5347
-		$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 
5346
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5347
+		$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 
5348 5348
 			    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)    
5349 5349
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5350 5350
 			    ORDER BY registration_count DESC";
@@ -5356,14 +5356,14 @@  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'];
5363 5363
 			$temp_array['registration'] = $row['registration'];
5364 5364
 			$temp_array['airline_name'] = $row['airline_name'];
5365 5365
 			$temp_array['image_thumbnail'] = "";
5366
-			if($row['registration'] != "")
5366
+			if ($row['registration'] != "")
5367 5367
 			{
5368 5368
 				$image_array = $Image->getSpotterImage($row['registration']);
5369 5369
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5383,11 +5383,11 @@  discard block
 block discarded – undo
5383 5383
 	* @return Array the aircraft manufacturer list
5384 5384
 	*
5385 5385
 	*/
5386
-	public function countAllAircraftManufacturerByCountry($country,$filters = array())
5386
+	public function countAllAircraftManufacturerByCountry($country, $filters = array())
5387 5387
 	{
5388
-		$filter_query = $this->getFilter($filters,true,true);
5389
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5390
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5388
+		$filter_query = $this->getFilter($filters, true, true);
5389
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5390
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5391 5391
                     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) 
5392 5392
                     GROUP BY spotter_output.aircraft_manufacturer 
5393 5393
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5399,7 +5399,7 @@  discard block
 block discarded – undo
5399 5399
 		$aircraft_array = array();
5400 5400
 		$temp_array = array();
5401 5401
         
5402
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5402
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5403 5403
 		{
5404 5404
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5405 5405
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5420,8 +5420,8 @@  discard block
 block discarded – undo
5420 5420
 	*/
5421 5421
 	public function countAllAircraftManufacturers($filters = array())
5422 5422
 	{
5423
-		$filter_query = $this->getFilter($filters,true,true);
5424
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5423
+		$filter_query = $this->getFilter($filters, true, true);
5424
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5425 5425
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5426 5426
                 $query .= " GROUP BY spotter_output.aircraft_manufacturer
5427 5427
 					ORDER BY aircraft_manufacturer_count DESC
@@ -5434,7 +5434,7 @@  discard block
 block discarded – undo
5434 5434
 		$manufacturer_array = array();
5435 5435
 		$temp_array = array();
5436 5436
         
5437
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5437
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5438 5438
 		{
5439 5439
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5440 5440
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5453,12 +5453,12 @@  discard block
 block discarded – undo
5453 5453
 	* @return Array the aircraft list
5454 5454
 	*
5455 5455
 	*/
5456
-	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5456
+	public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5457 5457
 	{
5458 5458
 		global $globalDBdriver;
5459 5459
 		$Image = new Image($this->db);
5460
-		$filter_query = $this->getFilter($filters,true,true);
5461
-		$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    
5460
+		$filter_query = $this->getFilter($filters, true, true);
5461
+		$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    
5462 5462
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5463 5463
                 if ($olderthanmonths > 0) {
5464 5464
             		if ($globalDBdriver == 'mysql') {
@@ -5486,7 +5486,7 @@  discard block
 block discarded – undo
5486 5486
 		$aircraft_array = array();
5487 5487
 		$temp_array = array();
5488 5488
         
5489
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5489
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5490 5490
 		{
5491 5491
 			$temp_array['registration'] = $row['registration'];
5492 5492
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -5494,7 +5494,7 @@  discard block
 block discarded – undo
5494 5494
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5495 5495
 			$temp_array['airline_name'] = $row['airline_name'];
5496 5496
 			$temp_array['image_thumbnail'] = "";
5497
-			if($row['registration'] != "")
5497
+			if ($row['registration'] != "")
5498 5498
 			{
5499 5499
 				$image_array = $Image->getSpotterImage($row['registration']);
5500 5500
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5513,12 +5513,12 @@  discard block
 block discarded – undo
5513 5513
 	* @return Array the aircraft list
5514 5514
 	*
5515 5515
 	*/
5516
-	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5516
+	public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5517 5517
 	{
5518 5518
 		global $globalDBdriver;
5519
-		$filter_query = $this->getFilter($filters,true,true);
5519
+		$filter_query = $this->getFilter($filters, true, true);
5520 5520
 		$Image = new Image($this->db);
5521
-		$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    
5521
+		$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    
5522 5522
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5523 5523
                 if ($olderthanmonths > 0) {
5524 5524
             		if ($globalDBdriver == 'mysql') {
@@ -5546,7 +5546,7 @@  discard block
 block discarded – undo
5546 5546
 		$aircraft_array = array();
5547 5547
 		$temp_array = array();
5548 5548
         
5549
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5549
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5550 5550
 		{
5551 5551
 			$temp_array['registration'] = $row['registration'];
5552 5552
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -5555,7 +5555,7 @@  discard block
 block discarded – undo
5555 5555
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5556 5556
 			$temp_array['airline_name'] = $row['airline_name'];
5557 5557
 			$temp_array['image_thumbnail'] = "";
5558
-			if($row['registration'] != "")
5558
+			if ($row['registration'] != "")
5559 5559
 			{
5560 5560
 				$image_array = $Image->getSpotterImage($row['registration']);
5561 5561
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5574,11 +5574,11 @@  discard block
 block discarded – undo
5574 5574
 	* @return Array the airport list
5575 5575
 	*
5576 5576
 	*/
5577
-	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5577
+	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5578 5578
 	{
5579 5579
 		global $globalDBdriver;
5580
-		$filter_query = $this->getFilter($filters,true,true);
5581
-		$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 
5580
+		$filter_query = $this->getFilter($filters, true, true);
5581
+		$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 
5582 5582
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA'";
5583 5583
                 if ($olderthanmonths > 0) {
5584 5584
             		if ($globalDBdriver == 'mysql') {
@@ -5607,7 +5607,7 @@  discard block
 block discarded – undo
5607 5607
 		$airport_array = array();
5608 5608
 		$temp_array = array();
5609 5609
         
5610
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5610
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5611 5611
 		{
5612 5612
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5613 5613
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5626,11 +5626,11 @@  discard block
 block discarded – undo
5626 5626
 	* @return Array the airport list
5627 5627
 	*
5628 5628
 	*/
5629
-	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5629
+	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5630 5630
 	{
5631 5631
 		global $globalDBdriver;
5632
-		$filter_query = $this->getFilter($filters,true,true);
5633
-		$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 
5632
+		$filter_query = $this->getFilter($filters, true, true);
5633
+		$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 
5634 5634
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' ";
5635 5635
                 if ($olderthanmonths > 0) {
5636 5636
             		if ($globalDBdriver == 'mysql') {
@@ -5659,7 +5659,7 @@  discard block
 block discarded – undo
5659 5659
 		$airport_array = array();
5660 5660
 		$temp_array = array();
5661 5661
         
5662
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5662
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5663 5663
 		{
5664 5664
 			$temp_array['airline_icao'] = $row['airline_icao'];
5665 5665
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -5679,11 +5679,11 @@  discard block
 block discarded – undo
5679 5679
 	* @return Array the airport list
5680 5680
 	*
5681 5681
 	*/
5682
-	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5682
+	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5683 5683
 	{
5684 5684
 		global $globalDBdriver;
5685
-		$filter_query = $this->getFilter($filters,true,true);
5686
-		$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
5685
+		$filter_query = $this->getFilter($filters, true, true);
5686
+		$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
5687 5687
 				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";
5688 5688
                 if ($olderthanmonths > 0) {
5689 5689
             		if ($globalDBdriver == 'mysql') {
@@ -5711,7 +5711,7 @@  discard block
 block discarded – undo
5711 5711
 		$airport_array = array();
5712 5712
 		$temp_array = array();
5713 5713
         
5714
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5714
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5715 5715
 		{
5716 5716
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5717 5717
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5730,11 +5730,11 @@  discard block
 block discarded – undo
5730 5730
 	* @return Array the airport list
5731 5731
 	*
5732 5732
 	*/
5733
-	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5733
+	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5734 5734
 	{
5735 5735
 		global $globalDBdriver;
5736
-		$filter_query = $this->getFilter($filters,true,true);
5737
-		$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
5736
+		$filter_query = $this->getFilter($filters, true, true);
5737
+		$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
5738 5738
 				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 ";
5739 5739
                 if ($olderthanmonths > 0) {
5740 5740
             		if ($globalDBdriver == 'mysql') {
@@ -5763,7 +5763,7 @@  discard block
 block discarded – undo
5763 5763
 		$airport_array = array();
5764 5764
 		$temp_array = array();
5765 5765
         
5766
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5766
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5767 5767
 		{
5768 5768
 			$temp_array['airline_icao'] = $row['airline_icao'];
5769 5769
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -5783,11 +5783,11 @@  discard block
 block discarded – undo
5783 5783
 	* @return Array the airport list
5784 5784
 	*
5785 5785
 	*/
5786
-	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
5786
+	public function countAllDepartureAirportsByAirline($airline_icao, $filters = array())
5787 5787
 	{
5788
-		$filter_query = $this->getFilter($filters,true,true);
5789
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5790
-		$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 
5788
+		$filter_query = $this->getFilter($filters, true, true);
5789
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5790
+		$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 
5791 5791
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao 
5792 5792
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5793 5793
 			    ORDER BY airport_departure_icao_count DESC";
@@ -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['airport_departure_icao'] = $row['departure_airport_icao'];
5805 5805
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5821,11 +5821,11 @@  discard block
 block discarded – undo
5821 5821
 	* @return Array the airport list
5822 5822
 	*
5823 5823
 	*/
5824
-	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
5824
+	public function countAllDepartureAirportCountriesByAirline($airline_icao, $filters = array())
5825 5825
 	{
5826
-		$filter_query = $this->getFilter($filters,true,true);
5827
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5828
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5826
+		$filter_query = $this->getFilter($filters, true, true);
5827
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5828
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5829 5829
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
5830 5830
                     GROUP BY spotter_output.departure_airport_country
5831 5831
 					ORDER BY airport_departure_country_count DESC";
@@ -5837,7 +5837,7 @@  discard block
 block discarded – undo
5837 5837
 		$airport_array = array();
5838 5838
 		$temp_array = array();
5839 5839
         
5840
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5840
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5841 5841
 		{
5842 5842
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5843 5843
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5856,11 +5856,11 @@  discard block
 block discarded – undo
5856 5856
 	* @return Array the airport list
5857 5857
 	*
5858 5858
 	*/
5859
-	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
5859
+	public function countAllDepartureAirportsByAircraft($aircraft_icao, $filters = array())
5860 5860
 	{
5861
-		$filter_query = $this->getFilter($filters,true,true);
5862
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5863
-		$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 
5861
+		$filter_query = $this->getFilter($filters, true, true);
5862
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5863
+		$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 
5864 5864
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao 
5865 5865
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5866 5866
 			    ORDER BY airport_departure_icao_count DESC";
@@ -5872,7 +5872,7 @@  discard block
 block discarded – undo
5872 5872
 		$airport_array = array();
5873 5873
 		$temp_array = array();
5874 5874
         
5875
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5875
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5876 5876
 		{
5877 5877
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5878 5878
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5893,11 +5893,11 @@  discard block
 block discarded – undo
5893 5893
 	* @return Array the airport list
5894 5894
 	*
5895 5895
 	*/
5896
-	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
5896
+	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao, $filters = array())
5897 5897
 	{
5898
-		$filter_query = $this->getFilter($filters,true,true);
5899
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5900
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5898
+		$filter_query = $this->getFilter($filters, true, true);
5899
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5900
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5901 5901
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
5902 5902
                     GROUP BY spotter_output.departure_airport_country
5903 5903
 					ORDER BY airport_departure_country_count DESC";
@@ -5909,7 +5909,7 @@  discard block
 block discarded – undo
5909 5909
 		$airport_array = array();
5910 5910
 		$temp_array = array();
5911 5911
         
5912
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5912
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5913 5913
 		{
5914 5914
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5915 5915
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5927,11 +5927,11 @@  discard block
 block discarded – undo
5927 5927
 	* @return Array the airport list
5928 5928
 	*
5929 5929
 	*/
5930
-	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
5930
+	public function countAllDepartureAirportsByRegistration($registration, $filters = array())
5931 5931
 	{
5932
-		$filter_query = $this->getFilter($filters,true,true);
5933
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
5934
-		$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 
5932
+		$filter_query = $this->getFilter($filters, true, true);
5933
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
5934
+		$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 
5935 5935
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.registration = :registration 
5936 5936
                     GROUP BY spotter_output.departure_airport_icao
5937 5937
 					ORDER BY airport_departure_icao_count DESC";
@@ -5943,7 +5943,7 @@  discard block
 block discarded – undo
5943 5943
 		$airport_array = array();
5944 5944
 		$temp_array = array();
5945 5945
         
5946
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5946
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5947 5947
 		{
5948 5948
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5949 5949
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5964,11 +5964,11 @@  discard block
 block discarded – undo
5964 5964
 	* @return Array the airport list
5965 5965
 	*
5966 5966
 	*/
5967
-	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
5967
+	public function countAllDepartureAirportCountriesByRegistration($registration, $filters = array())
5968 5968
 	{
5969
-		$filter_query = $this->getFilter($filters,true,true);
5970
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
5971
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5969
+		$filter_query = $this->getFilter($filters, true, true);
5970
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
5971
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5972 5972
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration 
5973 5973
                     GROUP BY spotter_output.departure_airport_country
5974 5974
 					ORDER BY airport_departure_country_count DESC";
@@ -5980,7 +5980,7 @@  discard block
 block discarded – undo
5980 5980
 		$airport_array = array();
5981 5981
 		$temp_array = array();
5982 5982
         
5983
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5983
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5984 5984
 		{
5985 5985
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5986 5986
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5998,11 +5998,11 @@  discard block
 block discarded – undo
5998 5998
 	* @return Array the airport list
5999 5999
 	*
6000 6000
 	*/
6001
-	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
6001
+	public function countAllDepartureAirportsByAirport($airport_icao, $filters = array())
6002 6002
 	{
6003
-		$filter_query = $this->getFilter($filters,true,true);
6004
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6005
-		$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 
6003
+		$filter_query = $this->getFilter($filters, true, true);
6004
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6005
+		$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 
6006 6006
 			    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 
6007 6007
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6008 6008
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6014,7 +6014,7 @@  discard block
 block discarded – undo
6014 6014
 		$airport_array = array();
6015 6015
 		$temp_array = array();
6016 6016
         
6017
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6017
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6018 6018
 		{
6019 6019
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6020 6020
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6035,11 +6035,11 @@  discard block
 block discarded – undo
6035 6035
 	* @return Array the airport list
6036 6036
 	*
6037 6037
 	*/
6038
-	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
6038
+	public function countAllDepartureAirportCountriesByAirport($airport_icao, $filters = array())
6039 6039
 	{
6040
-		$filter_query = $this->getFilter($filters,true,true);
6041
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6042
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6040
+		$filter_query = $this->getFilter($filters, true, true);
6041
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6042
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6043 6043
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao 
6044 6044
                     GROUP BY spotter_output.departure_airport_country
6045 6045
 					ORDER BY airport_departure_country_count DESC";
@@ -6051,7 +6051,7 @@  discard block
 block discarded – undo
6051 6051
 		$airport_array = array();
6052 6052
 		$temp_array = array();
6053 6053
         
6054
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6054
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6055 6055
 		{
6056 6056
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6057 6057
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6070,11 +6070,11 @@  discard block
 block discarded – undo
6070 6070
 	* @return Array the airport list
6071 6071
 	*
6072 6072
 	*/
6073
-	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6073
+	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer, $filters = array())
6074 6074
 	{
6075
-		$filter_query = $this->getFilter($filters,true,true);
6076
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6077
-		$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 
6075
+		$filter_query = $this->getFilter($filters, true, true);
6076
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6077
+		$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 
6078 6078
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6079 6079
                     GROUP BY spotter_output.departure_airport_icao
6080 6080
 					ORDER BY airport_departure_icao_count DESC";
@@ -6086,7 +6086,7 @@  discard block
 block discarded – undo
6086 6086
 		$airport_array = array();
6087 6087
 		$temp_array = array();
6088 6088
         
6089
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6089
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6090 6090
 		{
6091 6091
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6092 6092
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6107,11 +6107,11 @@  discard block
 block discarded – undo
6107 6107
 	* @return Array the airport list
6108 6108
 	*
6109 6109
 	*/
6110
-	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6110
+	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
6111 6111
 	{
6112
-		$filter_query = $this->getFilter($filters,true,true);
6113
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6114
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6112
+		$filter_query = $this->getFilter($filters, true, true);
6113
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6114
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6115 6115
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6116 6116
                     GROUP BY spotter_output.departure_airport_country
6117 6117
 					ORDER BY airport_departure_country_count DESC";
@@ -6123,7 +6123,7 @@  discard block
 block discarded – undo
6123 6123
 		$airport_array = array();
6124 6124
 		$temp_array = array();
6125 6125
         
6126
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6126
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6127 6127
 		{
6128 6128
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6129 6129
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6141,11 +6141,11 @@  discard block
 block discarded – undo
6141 6141
 	* @return Array the airport list
6142 6142
 	*
6143 6143
 	*/
6144
-	public function countAllDepartureAirportsByDate($date,$filters = array())
6144
+	public function countAllDepartureAirportsByDate($date, $filters = array())
6145 6145
 	{
6146 6146
 		global $globalTimezone, $globalDBdriver;
6147
-		$filter_query = $this->getFilter($filters,true,true);
6148
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6147
+		$filter_query = $this->getFilter($filters, true, true);
6148
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6149 6149
 		if ($globalTimezone != '') {
6150 6150
 			date_default_timezone_set($globalTimezone);
6151 6151
 			$datetime = new DateTime($date);
@@ -6153,12 +6153,12 @@  discard block
 block discarded – undo
6153 6153
 		} else $offset = '+00:00';
6154 6154
 
6155 6155
 		if ($globalDBdriver == 'mysql') {
6156
-			$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 
6156
+			$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 
6157 6157
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
6158 6158
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6159 6159
 					ORDER BY airport_departure_icao_count DESC";
6160 6160
 		} else {
6161
-			$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 
6161
+			$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 
6162 6162
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
6163 6163
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6164 6164
 					ORDER BY airport_departure_icao_count DESC";
@@ -6170,7 +6170,7 @@  discard block
 block discarded – undo
6170 6170
 		$airport_array = array();
6171 6171
 		$temp_array = array();
6172 6172
         
6173
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6173
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6174 6174
 		{
6175 6175
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6176 6176
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6191,11 +6191,11 @@  discard block
 block discarded – undo
6191 6191
 	* @return Array the airport list
6192 6192
 	*
6193 6193
 	*/
6194
-	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6194
+	public function countAllDepartureAirportCountriesByDate($date, $filters = array())
6195 6195
 	{
6196 6196
 		global $globalTimezone, $globalDBdriver;
6197
-		$filter_query = $this->getFilter($filters,true,true);
6198
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6197
+		$filter_query = $this->getFilter($filters, true, true);
6198
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6199 6199
 		if ($globalTimezone != '') {
6200 6200
 			date_default_timezone_set($globalTimezone);
6201 6201
 			$datetime = new DateTime($date);
@@ -6203,12 +6203,12 @@  discard block
 block discarded – undo
6203 6203
 		} else $offset = '+00:00';
6204 6204
 
6205 6205
 		if ($globalDBdriver == 'mysql') {
6206
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6206
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6207 6207
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
6208 6208
 					GROUP BY spotter_output.departure_airport_country
6209 6209
 					ORDER BY airport_departure_country_count DESC";
6210 6210
 		} else {
6211
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6211
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6212 6212
 					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 
6213 6213
 					GROUP BY spotter_output.departure_airport_country
6214 6214
 					ORDER BY airport_departure_country_count DESC";
@@ -6220,7 +6220,7 @@  discard block
 block discarded – undo
6220 6220
 		$airport_array = array();
6221 6221
 		$temp_array = array();
6222 6222
         
6223
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6223
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6224 6224
 		{
6225 6225
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6226 6226
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6238,11 +6238,11 @@  discard block
 block discarded – undo
6238 6238
 	* @return Array the airport list
6239 6239
 	*
6240 6240
 	*/
6241
-	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6241
+	public function countAllDepartureAirportsByIdent($ident, $filters = array())
6242 6242
 	{
6243
-		$filter_query = $this->getFilter($filters,true,true);
6244
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6245
-		$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 
6243
+		$filter_query = $this->getFilter($filters, true, true);
6244
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6245
+		$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 
6246 6246
 		    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.ident = :ident 
6247 6247
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6248 6248
 		    ORDER BY airport_departure_icao_count DESC";
@@ -6254,7 +6254,7 @@  discard block
 block discarded – undo
6254 6254
 		$airport_array = array();
6255 6255
 		$temp_array = array();
6256 6256
         
6257
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6257
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6258 6258
 		{
6259 6259
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6260 6260
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6276,11 +6276,11 @@  discard block
 block discarded – undo
6276 6276
 	* @return Array the airport list
6277 6277
 	*
6278 6278
 	*/
6279
-	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
6279
+	public function countAllDepartureAirportCountriesByIdent($ident, $filters = array())
6280 6280
 	{
6281
-		$filter_query = $this->getFilter($filters,true,true);
6282
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6283
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6281
+		$filter_query = $this->getFilter($filters, true, true);
6282
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6283
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6284 6284
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident 
6285 6285
                     GROUP BY spotter_output.departure_airport_country
6286 6286
 					ORDER BY airport_departure_country_count DESC";
@@ -6292,7 +6292,7 @@  discard block
 block discarded – undo
6292 6292
 		$airport_array = array();
6293 6293
 		$temp_array = array();
6294 6294
         
6295
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6295
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6296 6296
 		{
6297 6297
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6298 6298
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6311,12 +6311,12 @@  discard block
 block discarded – undo
6311 6311
 	* @return Array the airport list
6312 6312
 	*
6313 6313
 	*/
6314
-	public function countAllDepartureAirportsByCountry($country,$filters = array())
6314
+	public function countAllDepartureAirportsByCountry($country, $filters = array())
6315 6315
 	{
6316
-		$filter_query = $this->getFilter($filters,true,true);
6317
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6316
+		$filter_query = $this->getFilter($filters, true, true);
6317
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6318 6318
 
6319
-		$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 
6319
+		$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 
6320 6320
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
6321 6321
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6322 6322
 			    ORDER BY airport_departure_icao_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['airport_departure_icao'] = $row['departure_airport_icao'];
6334 6334
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6349,11 +6349,11 @@  discard block
 block discarded – undo
6349 6349
 	* @return Array the airport list
6350 6350
 	*
6351 6351
 	*/
6352
-	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
6352
+	public function countAllDepartureAirportCountriesByCountry($country, $filters = array())
6353 6353
 	{
6354
-		$filter_query = $this->getFilter($filters,true,true);
6355
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6356
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6354
+		$filter_query = $this->getFilter($filters, true, true);
6355
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6356
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6357 6357
 			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 
6358 6358
                     GROUP BY spotter_output.departure_airport_country
6359 6359
 					ORDER BY airport_departure_country_count DESC";
@@ -6365,7 +6365,7 @@  discard block
 block discarded – undo
6365 6365
 		$airport_array = array();
6366 6366
 		$temp_array = array();
6367 6367
         
6368
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6368
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6369 6369
 		{
6370 6370
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6371 6371
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6383,11 +6383,11 @@  discard block
 block discarded – undo
6383 6383
 	* @return Array the airport list
6384 6384
 	*
6385 6385
 	*/
6386
-	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6386
+	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6387 6387
 	{
6388 6388
 		global $globalDBdriver;
6389
-		$filter_query = $this->getFilter($filters,true,true);
6390
-		$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 
6389
+		$filter_query = $this->getFilter($filters, true, true);
6390
+		$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 
6391 6391
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
6392 6392
                 if ($olderthanmonths > 0) {
6393 6393
             		if ($globalDBdriver == 'mysql') {
@@ -6422,7 +6422,7 @@  discard block
 block discarded – undo
6422 6422
 		$airport_array = array();
6423 6423
 		$temp_array = array();
6424 6424
         
6425
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6425
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6426 6426
 		{
6427 6427
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6428 6428
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6445,11 +6445,11 @@  discard block
 block discarded – undo
6445 6445
 	* @return Array the airport list
6446 6446
 	*
6447 6447
 	*/
6448
-	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6448
+	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6449 6449
 	{
6450 6450
 		global $globalDBdriver;
6451
-		$filter_query = $this->getFilter($filters,true,true);
6452
-		$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 
6451
+		$filter_query = $this->getFilter($filters, true, true);
6452
+		$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 
6453 6453
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' ";
6454 6454
                 if ($olderthanmonths > 0) {
6455 6455
             		if ($globalDBdriver == 'mysql') {
@@ -6484,7 +6484,7 @@  discard block
 block discarded – undo
6484 6484
 		$airport_array = array();
6485 6485
 		$temp_array = array();
6486 6486
         
6487
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6487
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6488 6488
 		{
6489 6489
 			$temp_array['airline_icao'] = $row['airline_icao'];
6490 6490
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
@@ -6509,11 +6509,11 @@  discard block
 block discarded – undo
6509 6509
 	* @return Array the airport list
6510 6510
 	*
6511 6511
 	*/
6512
-	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6512
+	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6513 6513
 	{
6514 6514
 		global $globalDBdriver;
6515
-		$filter_query = $this->getFilter($filters,true,true);
6516
-		$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 
6515
+		$filter_query = $this->getFilter($filters, true, true);
6516
+		$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 
6517 6517
 			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";
6518 6518
                 if ($olderthanmonths > 0) {
6519 6519
             		if ($globalDBdriver == 'mysql') {
@@ -6547,7 +6547,7 @@  discard block
 block discarded – undo
6547 6547
 		$airport_array = array();
6548 6548
 		$temp_array = array();
6549 6549
         
6550
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6550
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6551 6551
 		{
6552 6552
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6553 6553
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6570,11 +6570,11 @@  discard block
 block discarded – undo
6570 6570
 	* @return Array the airport list
6571 6571
 	*
6572 6572
 	*/
6573
-	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6573
+	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6574 6574
 	{
6575 6575
 		global $globalDBdriver;
6576
-		$filter_query = $this->getFilter($filters,true,true);
6577
-		$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 
6576
+		$filter_query = $this->getFilter($filters, true, true);
6577
+		$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 
6578 6578
 			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 ";
6579 6579
                 if ($olderthanmonths > 0) {
6580 6580
             		if ($globalDBdriver == 'mysql') {
@@ -6609,7 +6609,7 @@  discard block
 block discarded – undo
6609 6609
 		$airport_array = array();
6610 6610
 		$temp_array = array();
6611 6611
         
6612
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6612
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6613 6613
 		{
6614 6614
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6615 6615
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6635,9 +6635,9 @@  discard block
 block discarded – undo
6635 6635
 	*/
6636 6636
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
6637 6637
 	{
6638
-		$filter_query = $this->getFilter($filters,true,true);
6639
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6640
-		$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 
6638
+		$filter_query = $this->getFilter($filters, true, true);
6639
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6640
+		$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 
6641 6641
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao 
6642 6642
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6643 6643
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -6648,7 +6648,7 @@  discard block
 block discarded – undo
6648 6648
 		$airport_array = array();
6649 6649
 		$temp_array = array();
6650 6650
         
6651
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6651
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6652 6652
 		{
6653 6653
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6654 6654
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6669,12 +6669,12 @@  discard block
 block discarded – undo
6669 6669
 	* @return Array the airport list
6670 6670
 	*
6671 6671
 	*/
6672
-	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
6672
+	public function countAllArrivalAirportCountriesByAirline($airline_icao, $filters = array())
6673 6673
 	{
6674
-		$filter_query = $this->getFilter($filters,true,true);
6675
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6674
+		$filter_query = $this->getFilter($filters, true, true);
6675
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6676 6676
 					
6677
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6677
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6678 6678
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
6679 6679
                     GROUP BY spotter_output.arrival_airport_country
6680 6680
 					ORDER BY airport_arrival_country_count DESC";
@@ -6686,7 +6686,7 @@  discard block
 block discarded – undo
6686 6686
 		$airport_array = array();
6687 6687
 		$temp_array = array();
6688 6688
         
6689
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6689
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6690 6690
 		{
6691 6691
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6692 6692
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6704,11 +6704,11 @@  discard block
 block discarded – undo
6704 6704
 	* @return Array the airport list
6705 6705
 	*
6706 6706
 	*/
6707
-	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
6707
+	public function countAllArrivalAirportsByAircraft($aircraft_icao, $filters = array())
6708 6708
 	{
6709
-		$filter_query = $this->getFilter($filters,true,true);
6710
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6711
-		$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 
6709
+		$filter_query = $this->getFilter($filters, true, true);
6710
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6711
+		$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 
6712 6712
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao 
6713 6713
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6714 6714
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -6720,7 +6720,7 @@  discard block
 block discarded – undo
6720 6720
 		$airport_array = array();
6721 6721
 		$temp_array = array();
6722 6722
         
6723
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6723
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6724 6724
 		{
6725 6725
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6726 6726
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6742,11 +6742,11 @@  discard block
 block discarded – undo
6742 6742
 	* @return Array the airport list
6743 6743
 	*
6744 6744
 	*/
6745
-	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
6745
+	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao, $filters = array())
6746 6746
 	{
6747
-		$filter_query = $this->getFilter($filters,true,true);
6748
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6749
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6747
+		$filter_query = $this->getFilter($filters, true, true);
6748
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6749
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6750 6750
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
6751 6751
                     GROUP BY spotter_output.arrival_airport_country
6752 6752
 					ORDER BY airport_arrival_country_count DESC";
@@ -6758,7 +6758,7 @@  discard block
 block discarded – undo
6758 6758
 		$airport_array = array();
6759 6759
 		$temp_array = array();
6760 6760
         
6761
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6761
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6762 6762
 		{
6763 6763
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6764 6764
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6776,12 +6776,12 @@  discard block
 block discarded – undo
6776 6776
 	* @return Array the airport list
6777 6777
 	*
6778 6778
 	*/
6779
-	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
6779
+	public function countAllArrivalAirportsByRegistration($registration, $filters = array())
6780 6780
 	{
6781
-		$filter_query = $this->getFilter($filters,true,true);
6782
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6781
+		$filter_query = $this->getFilter($filters, true, true);
6782
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6783 6783
 
6784
-		$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 
6784
+		$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 
6785 6785
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.registration = :registration 
6786 6786
                     GROUP BY spotter_output.arrival_airport_icao
6787 6787
 					ORDER BY airport_arrival_icao_count DESC";
@@ -6793,7 +6793,7 @@  discard block
 block discarded – undo
6793 6793
 		$airport_array = array();
6794 6794
 		$temp_array = array();
6795 6795
         
6796
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6796
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6797 6797
 		{
6798 6798
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6799 6799
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6814,11 +6814,11 @@  discard block
 block discarded – undo
6814 6814
 	* @return Array the airport list
6815 6815
 	*
6816 6816
 	*/
6817
-	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
6817
+	public function countAllArrivalAirportCountriesByRegistration($registration, $filters = array())
6818 6818
 	{
6819
-		$filter_query = $this->getFilter($filters,true,true);
6820
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6821
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6819
+		$filter_query = $this->getFilter($filters, true, true);
6820
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6821
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6822 6822
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration 
6823 6823
                     GROUP BY spotter_output.arrival_airport_country
6824 6824
 					ORDER BY airport_arrival_country_count DESC";
@@ -6830,7 +6830,7 @@  discard block
 block discarded – undo
6830 6830
 		$airport_array = array();
6831 6831
 		$temp_array = array();
6832 6832
         
6833
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6833
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6834 6834
 		{
6835 6835
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6836 6836
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6849,11 +6849,11 @@  discard block
 block discarded – undo
6849 6849
 	* @return Array the airport list
6850 6850
 	*
6851 6851
 	*/
6852
-	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
6852
+	public function countAllArrivalAirportsByAirport($airport_icao, $filters = array())
6853 6853
 	{
6854
-		$filter_query = $this->getFilter($filters,true,true);
6855
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6856
-		$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 
6854
+		$filter_query = $this->getFilter($filters, true, true);
6855
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6856
+		$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 
6857 6857
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.departure_airport_icao = :airport_icao 
6858 6858
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6859 6859
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -6865,7 +6865,7 @@  discard block
 block discarded – undo
6865 6865
 		$airport_array = array();
6866 6866
 		$temp_array = array();
6867 6867
         
6868
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6868
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6869 6869
 		{
6870 6870
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6871 6871
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6886,11 +6886,11 @@  discard block
 block discarded – undo
6886 6886
 	* @return Array the airport list
6887 6887
 	*
6888 6888
 	*/
6889
-	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
6889
+	public function countAllArrivalAirportCountriesByAirport($airport_icao, $filters = array())
6890 6890
 	{
6891
-		$filter_query = $this->getFilter($filters,true,true);
6892
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6893
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6891
+		$filter_query = $this->getFilter($filters, true, true);
6892
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6893
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6894 6894
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao 
6895 6895
                     GROUP BY spotter_output.arrival_airport_country
6896 6896
 					ORDER BY airport_arrival_country_count DESC";
@@ -6902,7 +6902,7 @@  discard block
 block discarded – undo
6902 6902
 		$airport_array = array();
6903 6903
 		$temp_array = array();
6904 6904
         
6905
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6905
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6906 6906
 		{
6907 6907
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6908 6908
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6920,11 +6920,11 @@  discard block
 block discarded – undo
6920 6920
 	* @return Array the airport list
6921 6921
 	*
6922 6922
 	*/
6923
-	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6923
+	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer, $filters = array())
6924 6924
 	{
6925
-		$filter_query = $this->getFilter($filters,true,true);
6926
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6927
-		$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 
6925
+		$filter_query = $this->getFilter($filters, true, true);
6926
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6927
+		$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 
6928 6928
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6929 6929
                     GROUP BY spotter_output.arrival_airport_icao
6930 6930
 					ORDER BY airport_arrival_icao_count DESC";
@@ -6936,7 +6936,7 @@  discard block
 block discarded – undo
6936 6936
 		$airport_array = array();
6937 6937
 		$temp_array = array();
6938 6938
         
6939
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6939
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6940 6940
 		{
6941 6941
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6942 6942
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6958,11 +6958,11 @@  discard block
 block discarded – undo
6958 6958
 	* @return Array the airport list
6959 6959
 	*
6960 6960
 	*/
6961
-	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6961
+	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
6962 6962
 	{
6963
-		$filter_query = $this->getFilter($filters,true,true);
6964
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6965
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6963
+		$filter_query = $this->getFilter($filters, true, true);
6964
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6965
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6966 6966
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6967 6967
                     GROUP BY spotter_output.arrival_airport_country
6968 6968
 					ORDER BY airport_arrival_country_count DESC";
@@ -6974,7 +6974,7 @@  discard block
 block discarded – undo
6974 6974
 		$airport_array = array();
6975 6975
 		$temp_array = array();
6976 6976
         
6977
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6977
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6978 6978
 		{
6979 6979
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6980 6980
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6993,11 +6993,11 @@  discard block
 block discarded – undo
6993 6993
 	* @return Array the airport list
6994 6994
 	*
6995 6995
 	*/
6996
-	public function countAllArrivalAirportsByDate($date,$filters = array())
6996
+	public function countAllArrivalAirportsByDate($date, $filters = array())
6997 6997
 	{
6998 6998
 		global $globalTimezone, $globalDBdriver;
6999
-		$filter_query = $this->getFilter($filters,true,true);
7000
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6999
+		$filter_query = $this->getFilter($filters, true, true);
7000
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7001 7001
 		if ($globalTimezone != '') {
7002 7002
 			date_default_timezone_set($globalTimezone);
7003 7003
 			$datetime = new DateTime($date);
@@ -7005,12 +7005,12 @@  discard block
 block discarded – undo
7005 7005
 		} else $offset = '+00:00';
7006 7006
 
7007 7007
 		if ($globalDBdriver == 'mysql') {
7008
-			$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 
7008
+			$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 
7009 7009
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
7010 7010
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7011 7011
 					ORDER BY airport_arrival_icao_count DESC";
7012 7012
 		} else {
7013
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7013
+			$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 
7014 7014
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
7015 7015
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7016 7016
 					ORDER BY airport_arrival_icao_count DESC";
@@ -7022,7 +7022,7 @@  discard block
 block discarded – undo
7022 7022
 		$airport_array = array();
7023 7023
 		$temp_array = array();
7024 7024
         
7025
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7025
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7026 7026
 		{
7027 7027
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7028 7028
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7046,8 +7046,8 @@  discard block
 block discarded – undo
7046 7046
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
7047 7047
 	{
7048 7048
 		global $globalTimezone, $globalDBdriver;
7049
-		$filter_query = $this->getFilter($filters,true,true);
7050
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7049
+		$filter_query = $this->getFilter($filters, true, true);
7050
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7051 7051
 		if ($globalTimezone != '') {
7052 7052
 			date_default_timezone_set($globalTimezone);
7053 7053
 			$datetime = new DateTime($date);
@@ -7055,12 +7055,12 @@  discard block
 block discarded – undo
7055 7055
 		} else $offset = '+00:00';
7056 7056
 
7057 7057
 		if ($globalDBdriver == 'mysql') {
7058
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7058
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7059 7059
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
7060 7060
 					GROUP BY spotter_output.arrival_airport_country
7061 7061
 					ORDER BY airport_arrival_country_count DESC";
7062 7062
 		} else {
7063
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7063
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7064 7064
 					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 
7065 7065
 					GROUP BY spotter_output.arrival_airport_country
7066 7066
 					ORDER BY airport_arrival_country_count DESC";
@@ -7072,7 +7072,7 @@  discard block
 block discarded – undo
7072 7072
 		$airport_array = array();
7073 7073
 		$temp_array = array();
7074 7074
         
7075
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7075
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7076 7076
 		{
7077 7077
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7078 7078
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7090,11 +7090,11 @@  discard block
 block discarded – undo
7090 7090
 	* @return Array the airport list
7091 7091
 	*
7092 7092
 	*/
7093
-	public function countAllArrivalAirportsByIdent($ident,$filters = array())
7093
+	public function countAllArrivalAirportsByIdent($ident, $filters = array())
7094 7094
 	{
7095
-		$filter_query = $this->getFilter($filters,true,true);
7096
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7097
-		$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 
7095
+		$filter_query = $this->getFilter($filters, true, true);
7096
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7097
+		$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 
7098 7098
 		    FROM spotter_output".$filter_query." WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.ident = :ident  
7099 7099
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7100 7100
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -7106,7 +7106,7 @@  discard block
 block discarded – undo
7106 7106
 		$airport_array = array();
7107 7107
 		$temp_array = array();
7108 7108
         
7109
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7109
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7110 7110
 		{
7111 7111
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7112 7112
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7129,9 +7129,9 @@  discard block
 block discarded – undo
7129 7129
 	*/
7130 7130
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
7131 7131
 	{
7132
-		$filter_query = $this->getFilter($filters,true,true);
7133
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7134
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7132
+		$filter_query = $this->getFilter($filters, true, true);
7133
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7134
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7135 7135
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident 
7136 7136
                     GROUP BY spotter_output.arrival_airport_country
7137 7137
 					ORDER BY airport_arrival_country_count DESC";
@@ -7143,7 +7143,7 @@  discard block
 block discarded – undo
7143 7143
 		$airport_array = array();
7144 7144
 		$temp_array = array();
7145 7145
         
7146
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7146
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7147 7147
 		{
7148 7148
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7149 7149
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7162,11 +7162,11 @@  discard block
 block discarded – undo
7162 7162
 	* @return Array the airport list
7163 7163
 	*
7164 7164
 	*/
7165
-	public function countAllArrivalAirportsByCountry($country,$filters = array())
7165
+	public function countAllArrivalAirportsByCountry($country, $filters = array())
7166 7166
 	{
7167
-		$filter_query = $this->getFilter($filters,true,true);
7168
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7169
-		$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 
7167
+		$filter_query = $this->getFilter($filters, true, true);
7168
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7169
+		$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 
7170 7170
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
7171 7171
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7172 7172
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7178,7 +7178,7 @@  discard block
 block discarded – undo
7178 7178
 		$airport_array = array();
7179 7179
 		$temp_array = array();
7180 7180
         
7181
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7181
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7182 7182
 		{
7183 7183
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7184 7184
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7199,11 +7199,11 @@  discard block
 block discarded – undo
7199 7199
 	* @return Array the airport list
7200 7200
 	*
7201 7201
 	*/
7202
-	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
7202
+	public function countAllArrivalAirportCountriesByCountry($country, $filters = array())
7203 7203
 	{
7204
-		$filter_query = $this->getFilter($filters,true,true);
7205
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7206
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7204
+		$filter_query = $this->getFilter($filters, true, true);
7205
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7206
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7207 7207
 			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 
7208 7208
                     GROUP BY spotter_output.arrival_airport_country
7209 7209
 					ORDER BY airport_arrival_country_count DESC";
@@ -7215,7 +7215,7 @@  discard block
 block discarded – undo
7215 7215
 		$airport_array = array();
7216 7216
 		$temp_array = array();
7217 7217
         
7218
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7218
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7219 7219
 		{
7220 7220
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7221 7221
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7236,7 +7236,7 @@  discard block
 block discarded – undo
7236 7236
 	*/
7237 7237
 	public function countAllDepartureCountries($filters = array())
7238 7238
 	{
7239
-		$filter_query = $this->getFilter($filters,true,true);
7239
+		$filter_query = $this->getFilter($filters, true, true);
7240 7240
 		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7241 7241
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA'";
7242 7242
 		$query .= " GROUP BY spotter_output.departure_airport_country
@@ -7250,7 +7250,7 @@  discard block
 block discarded – undo
7250 7250
 		$airport_array = array();
7251 7251
 		$temp_array = array();
7252 7252
         
7253
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7253
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7254 7254
 		{
7255 7255
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
7256 7256
 			$temp_array['airport_departure_country'] = $row['departure_airport_country'];
@@ -7268,9 +7268,9 @@  discard block
 block discarded – undo
7268 7268
 	* @return Array the airport arrival list
7269 7269
 	*
7270 7270
 	*/
7271
-	public function countAllArrivalCountries($limit = true,$filters = array())
7271
+	public function countAllArrivalCountries($limit = true, $filters = array())
7272 7272
 	{
7273
-		$filter_query = $this->getFilter($filters,true,true);
7273
+		$filter_query = $this->getFilter($filters, true, true);
7274 7274
 		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7275 7275
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
7276 7276
 		$query .= " GROUP BY spotter_output.arrival_airport_country
@@ -7284,7 +7284,7 @@  discard block
 block discarded – undo
7284 7284
 		$airport_array = array();
7285 7285
 		$temp_array = array();
7286 7286
         
7287
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7287
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7288 7288
 		{
7289 7289
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
7290 7290
 			$temp_array['airport_arrival_country'] = $row['arrival_airport_country'];
@@ -7307,8 +7307,8 @@  discard block
 block discarded – undo
7307 7307
 	*/
7308 7308
 	public function countAllRoutes($filters = array())
7309 7309
 	{
7310
-		$filter_query = $this->getFilter($filters,true,true);
7311
-		$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
7310
+		$filter_query = $this->getFilter($filters, true, true);
7311
+		$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
7312 7312
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> 'NA'
7313 7313
                     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
7314 7314
                     ORDER BY route_count DESC
@@ -7321,7 +7321,7 @@  discard block
 block discarded – undo
7321 7321
 		$routes_array = array();
7322 7322
 		$temp_array = array();
7323 7323
         
7324
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7324
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7325 7325
 		{
7326 7326
 			$temp_array['route_count'] = $row['route_count'];
7327 7327
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7348,11 +7348,11 @@  discard block
 block discarded – undo
7348 7348
 	* @return Array the route list
7349 7349
 	*
7350 7350
 	*/
7351
-	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
7351
+	public function countAllRoutesByAircraft($aircraft_icao, $filters = array())
7352 7352
 	{
7353
-		$filter_query = $this->getFilter($filters,true,true);
7354
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7355
-		$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
7353
+		$filter_query = $this->getFilter($filters, true, true);
7354
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7355
+		$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
7356 7356
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
7357 7357
 			    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 
7358 7358
 			    ORDER BY route_count DESC";
@@ -7363,7 +7363,7 @@  discard block
 block discarded – undo
7363 7363
 		$routes_array = array();
7364 7364
 		$temp_array = array();
7365 7365
         
7366
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7366
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7367 7367
 		{
7368 7368
 			$temp_array['route_count'] = $row['route_count'];
7369 7369
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7390,9 +7390,9 @@  discard block
 block discarded – undo
7390 7390
 	*/
7391 7391
 	public function countAllRoutesByRegistration($registration, $filters = array())
7392 7392
 	{
7393
-		$filter_query = $this->getFilter($filters,true,true);
7393
+		$filter_query = $this->getFilter($filters, true, true);
7394 7394
 		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7395
-		$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
7395
+		$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
7396 7396
 			FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.registration = :registration 
7397 7397
                     GROUP BY route
7398 7398
                     ORDER BY route_count DESC";
@@ -7404,7 +7404,7 @@  discard block
 block discarded – undo
7404 7404
 		$routes_array = array();
7405 7405
 		$temp_array = array();
7406 7406
         
7407
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7407
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7408 7408
 		{
7409 7409
 			$temp_array['route_count'] = $row['route_count'];
7410 7410
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7432,9 +7432,9 @@  discard block
 block discarded – undo
7432 7432
 	*/
7433 7433
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
7434 7434
 	{
7435
-		$filter_query = $this->getFilter($filters,true,true);
7436
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7437
-		$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
7435
+		$filter_query = $this->getFilter($filters, true, true);
7436
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7437
+		$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
7438 7438
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao 
7439 7439
 			    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 
7440 7440
 			    ORDER BY route_count DESC";
@@ -7446,7 +7446,7 @@  discard block
 block discarded – undo
7446 7446
 		$routes_array = array();
7447 7447
 		$temp_array = array();
7448 7448
         
7449
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7449
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7450 7450
 		{
7451 7451
 			$temp_array['route_count'] = $row['route_count'];
7452 7452
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7474,9 +7474,9 @@  discard block
 block discarded – undo
7474 7474
 	*/
7475 7475
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
7476 7476
 	{
7477
-		$filter_query = $this->getFilter($filters,true,true);
7478
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7479
-		$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
7477
+		$filter_query = $this->getFilter($filters, true, true);
7478
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7479
+		$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
7480 7480
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
7481 7481
 			    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 
7482 7482
 			    ORDER BY route_count DESC";
@@ -7487,7 +7487,7 @@  discard block
 block discarded – undo
7487 7487
 		$routes_array = array();
7488 7488
 		$temp_array = array();
7489 7489
         
7490
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7490
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7491 7491
 		{
7492 7492
 			$temp_array['route_count'] = $row['route_count'];
7493 7493
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7515,9 +7515,9 @@  discard block
 block discarded – undo
7515 7515
 	*/
7516 7516
 	public function countAllRoutesByCountry($country, $filters = array())
7517 7517
 	{
7518
-		$filter_query = $this->getFilter($filters,true,true);
7519
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7520
-		$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
7518
+		$filter_query = $this->getFilter($filters, true, true);
7519
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7520
+		$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
7521 7521
 			    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 
7522 7522
 			    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 
7523 7523
 			    ORDER BY route_count DESC";
@@ -7528,7 +7528,7 @@  discard block
 block discarded – undo
7528 7528
 		$routes_array = array();
7529 7529
 		$temp_array = array();
7530 7530
         
7531
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7531
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7532 7532
 		{
7533 7533
 			$temp_array['route_count'] = $row['route_count'];
7534 7534
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7556,8 +7556,8 @@  discard block
 block discarded – undo
7556 7556
 	public function countAllRoutesByDate($date, $filters = array())
7557 7557
 	{
7558 7558
 		global $globalTimezone, $globalDBdriver;
7559
-		$filter_query = $this->getFilter($filters,true,true);
7560
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7559
+		$filter_query = $this->getFilter($filters, true, true);
7560
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7561 7561
 		if ($globalTimezone != '') {
7562 7562
 			date_default_timezone_set($globalTimezone);
7563 7563
 			$datetime = new DateTime($date);
@@ -7565,12 +7565,12 @@  discard block
 block discarded – undo
7565 7565
 		} else $offset = '+00:00';
7566 7566
 		
7567 7567
 		if ($globalDBdriver == 'mysql') {
7568
-			$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
7568
+			$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
7569 7569
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
7570 7570
 				    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
7571 7571
 				    ORDER BY route_count DESC";
7572 7572
 		} else {
7573
-			$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
7573
+			$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
7574 7574
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
7575 7575
 				    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
7576 7576
 				    ORDER BY route_count DESC";
@@ -7582,7 +7582,7 @@  discard block
 block discarded – undo
7582 7582
 		$routes_array = array();
7583 7583
 		$temp_array = array();
7584 7584
         
7585
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7585
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7586 7586
 		{
7587 7587
 			$temp_array['route_count'] = $row['route_count'];
7588 7588
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7609,9 +7609,9 @@  discard block
 block discarded – undo
7609 7609
 	*/
7610 7610
 	public function countAllRoutesByIdent($ident, $filters = array())
7611 7611
 	{
7612
-		$filter_query = $this->getFilter($filters,true,true);
7613
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7614
-		$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
7612
+		$filter_query = $this->getFilter($filters, true, true);
7613
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7614
+		$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
7615 7615
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.ident = :ident   
7616 7616
                     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
7617 7617
                     ORDER BY route_count DESC";
@@ -7623,7 +7623,7 @@  discard block
 block discarded – undo
7623 7623
 		$routes_array = array();
7624 7624
 		$temp_array = array();
7625 7625
         
7626
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7626
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7627 7627
 		{
7628 7628
 			$temp_array['route_count'] = $row['route_count'];
7629 7629
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7650,9 +7650,9 @@  discard block
 block discarded – undo
7650 7650
 	*/
7651 7651
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
7652 7652
 	{
7653
-		$filter_query = $this->getFilter($filters,true,true);
7654
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7655
-		$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
7653
+		$filter_query = $this->getFilter($filters, true, true);
7654
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7655
+		$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
7656 7656
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
7657 7657
                     GROUP BY route
7658 7658
                     ORDER BY route_count DESC";
@@ -7664,7 +7664,7 @@  discard block
 block discarded – undo
7664 7664
 		$routes_array = array();
7665 7665
 		$temp_array = array();
7666 7666
         
7667
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7667
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7668 7668
 		{
7669 7669
 			$temp_array['route_count'] = $row['route_count'];
7670 7670
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7692,8 +7692,8 @@  discard block
 block discarded – undo
7692 7692
 	*/
7693 7693
 	public function countAllRoutesWithWaypoints($filters = array())
7694 7694
 	{
7695
-		$filter_query = $this->getFilter($filters,true,true);
7696
-		$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
7695
+		$filter_query = $this->getFilter($filters, true, true);
7696
+		$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
7697 7697
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.waypoints <> '' 
7698 7698
                     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
7699 7699
                     ORDER BY route_count DESC
@@ -7706,7 +7706,7 @@  discard block
 block discarded – undo
7706 7706
 		$routes_array = array();
7707 7707
 		$temp_array = array();
7708 7708
         
7709
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7709
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7710 7710
 		{
7711 7711
 			$temp_array['spotter_id'] = $row['spotter_id'];
7712 7712
 			$temp_array['route_count'] = $row['route_count'];
@@ -7731,11 +7731,11 @@  discard block
 block discarded – undo
7731 7731
 	* @return Array the callsign list
7732 7732
 	*
7733 7733
 	*/
7734
-	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
7734
+	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7735 7735
 	{
7736 7736
 		global $globalDBdriver;
7737
-		$filter_query = $this->getFilter($filters,true,true);
7738
-		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7737
+		$filter_query = $this->getFilter($filters, true, true);
7738
+		$query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7739 7739
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
7740 7740
 		 if ($olderthanmonths > 0) {
7741 7741
 			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
@@ -7754,7 +7754,7 @@  discard block
 block discarded – undo
7754 7754
 		$callsign_array = array();
7755 7755
 		$temp_array = array();
7756 7756
         
7757
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7757
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7758 7758
 		{
7759 7759
 			$temp_array['callsign_icao'] = $row['ident'];
7760 7760
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -7776,8 +7776,8 @@  discard block
 block discarded – undo
7776 7776
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7777 7777
 	{
7778 7778
 		global $globalDBdriver;
7779
-		$filter_query = $this->getFilter($filters,true,true);
7780
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7779
+		$filter_query = $this->getFilter($filters, true, true);
7780
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7781 7781
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
7782 7782
 		 if ($olderthanmonths > 0) {
7783 7783
 			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
@@ -7796,7 +7796,7 @@  discard block
 block discarded – undo
7796 7796
 		$callsign_array = array();
7797 7797
 		$temp_array = array();
7798 7798
         
7799
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7799
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7800 7800
 		{
7801 7801
 			$temp_array['callsign_icao'] = $row['ident'];
7802 7802
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -7850,7 +7850,7 @@  discard block
 block discarded – undo
7850 7850
 		$date_array = array();
7851 7851
 		$temp_array = array();
7852 7852
         
7853
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7853
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7854 7854
 		{
7855 7855
 			$temp_array['date_name'] = $row['date_name'];
7856 7856
 			$temp_array['date_count'] = $row['date_count'];
@@ -7875,15 +7875,15 @@  discard block
 block discarded – undo
7875 7875
 			$datetime = new DateTime();
7876 7876
 			$offset = $datetime->format('P');
7877 7877
 		} else $offset = '+00:00';
7878
-		$filter_query = $this->getFilter($filters,true,true);
7878
+		$filter_query = $this->getFilter($filters, true, true);
7879 7879
 		if ($globalDBdriver == 'mysql') {
7880
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7880
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7881 7881
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
7882 7882
 								GROUP BY spotter_output.airline_icao, date_name 
7883 7883
 								ORDER BY date_count DESC
7884 7884
 								LIMIT 10 OFFSET 0";
7885 7885
 		} else {
7886
-			$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
7886
+			$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
7887 7887
 								FROM spotter_output 
7888 7888
 								WHERE spotter_output.airline_icao <> '' 
7889 7889
 								GROUP BY spotter_output.airline_icao, date_name 
@@ -7898,7 +7898,7 @@  discard block
 block discarded – undo
7898 7898
 		$date_array = array();
7899 7899
 		$temp_array = array();
7900 7900
         
7901
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7901
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7902 7902
 		{
7903 7903
 			$temp_array['date_name'] = $row['date_name'];
7904 7904
 			$temp_array['date_count'] = $row['date_count'];
@@ -7924,7 +7924,7 @@  discard block
 block discarded – undo
7924 7924
 			$datetime = new DateTime();
7925 7925
 			$offset = $datetime->format('P');
7926 7926
 		} else $offset = '+00:00';
7927
-		$filter_query = $this->getFilter($filters,true,true);
7927
+		$filter_query = $this->getFilter($filters, true, true);
7928 7928
 		if ($globalDBdriver == 'mysql') {
7929 7929
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7930 7930
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -7945,7 +7945,7 @@  discard block
 block discarded – undo
7945 7945
 		$date_array = array();
7946 7946
 		$temp_array = array();
7947 7947
         
7948
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7948
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7949 7949
 		{
7950 7950
 			$temp_array['date_name'] = $row['date_name'];
7951 7951
 			$temp_array['date_count'] = $row['date_count'];
@@ -7970,7 +7970,7 @@  discard block
 block discarded – undo
7970 7970
 			$datetime = new DateTime();
7971 7971
 			$offset = $datetime->format('P');
7972 7972
 		} else $offset = '+00:00';
7973
-		$filter_query = $this->getFilter($filters,true,true);
7973
+		$filter_query = $this->getFilter($filters, true, true);
7974 7974
 		if ($globalDBdriver == 'mysql') {
7975 7975
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7976 7976
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)";
@@ -7991,7 +7991,7 @@  discard block
 block discarded – undo
7991 7991
 		$date_array = array();
7992 7992
 		$temp_array = array();
7993 7993
         
7994
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7994
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7995 7995
 		{
7996 7996
 			$temp_array['date_name'] = $row['date_name'];
7997 7997
 			$temp_array['date_count'] = $row['date_count'];
@@ -8012,7 +8012,7 @@  discard block
 block discarded – undo
8012 8012
 	public function countAllDatesLastMonthByAirlines($filters = array())
8013 8013
 	{
8014 8014
 		global $globalTimezone, $globalDBdriver;
8015
-		$filter_query = $this->getFilter($filters,true,true);
8015
+		$filter_query = $this->getFilter($filters, true, true);
8016 8016
 		if ($globalTimezone != '') {
8017 8017
 			date_default_timezone_set($globalTimezone);
8018 8018
 			$datetime = new DateTime();
@@ -8020,13 +8020,13 @@  discard block
 block discarded – undo
8020 8020
 		} else $offset = '+00:00';
8021 8021
 		
8022 8022
 		if ($globalDBdriver == 'mysql') {
8023
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
8023
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
8024 8024
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)
8025 8025
 								GROUP BY spotter_output.airline_icao, date_name 
8026 8026
 								ORDER BY spotter_output.date ASC";
8027 8027
 			$query_data = array(':offset' => $offset);
8028 8028
 		} else {
8029
-			$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
8029
+			$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
8030 8030
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS'
8031 8031
 								GROUP BY spotter_output.airline_icao, date_name 
8032 8032
 								ORDER BY date_name ASC";
@@ -8039,7 +8039,7 @@  discard block
 block discarded – undo
8039 8039
 		$date_array = array();
8040 8040
 		$temp_array = array();
8041 8041
         
8042
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8042
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8043 8043
 		{
8044 8044
 			$temp_array['date_name'] = $row['date_name'];
8045 8045
 			$temp_array['date_count'] = $row['date_count'];
@@ -8086,7 +8086,7 @@  discard block
 block discarded – undo
8086 8086
 		$date_array = array();
8087 8087
 		$temp_array = array();
8088 8088
         
8089
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8089
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8090 8090
 		{
8091 8091
 			$temp_array['month_name'] = $row['month_name'];
8092 8092
 			$temp_array['year_name'] = $row['year_name'];
@@ -8107,7 +8107,7 @@  discard block
 block discarded – undo
8107 8107
 	public function countAllMonthsByAirlines($filters = array())
8108 8108
 	{
8109 8109
 		global $globalTimezone, $globalDBdriver;
8110
-		$filter_query = $this->getFilter($filters,true,true);
8110
+		$filter_query = $this->getFilter($filters, true, true);
8111 8111
 		if ($globalTimezone != '') {
8112 8112
 			date_default_timezone_set($globalTimezone);
8113 8113
 			$datetime = new DateTime();
@@ -8115,12 +8115,12 @@  discard block
 block discarded – undo
8115 8115
 		} else $offset = '+00:00';
8116 8116
 
8117 8117
 		if ($globalDBdriver == 'mysql') {
8118
-			$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
8118
+			$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
8119 8119
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8120 8120
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
8121 8121
 								ORDER BY date_count DESC";
8122 8122
 		} else {
8123
-			$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
8123
+			$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
8124 8124
 								FROM spotter_output 
8125 8125
 								WHERE spotter_output.airline_icao <> '' 
8126 8126
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
@@ -8134,7 +8134,7 @@  discard block
 block discarded – undo
8134 8134
 		$date_array = array();
8135 8135
 		$temp_array = array();
8136 8136
         
8137
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8137
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8138 8138
 		{
8139 8139
 			$temp_array['month_name'] = $row['month_name'];
8140 8140
 			$temp_array['year_name'] = $row['year_name'];
@@ -8161,14 +8161,14 @@  discard block
 block discarded – undo
8161 8161
 			$datetime = new DateTime();
8162 8162
 			$offset = $datetime->format('P');
8163 8163
 		} else $offset = '+00:00';
8164
-		$filter_query = $this->getFilter($filters,true,true);
8164
+		$filter_query = $this->getFilter($filters, true, true);
8165 8165
 		if ($globalDBdriver == 'mysql') {
8166
-			$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
8166
+			$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
8167 8167
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
8168 8168
 								GROUP BY year_name, month_name 
8169 8169
 								ORDER BY date_count DESC";
8170 8170
 		} else {
8171
-			$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
8171
+			$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
8172 8172
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
8173 8173
 								GROUP BY year_name, month_name 
8174 8174
 								ORDER BY date_count DESC";
@@ -8180,7 +8180,7 @@  discard block
 block discarded – undo
8180 8180
 		$date_array = array();
8181 8181
 		$temp_array = array();
8182 8182
         
8183
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8183
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8184 8184
 		{
8185 8185
 			$temp_array['month_name'] = $row['month_name'];
8186 8186
 			$temp_array['year_name'] = $row['year_name'];
@@ -8206,15 +8206,15 @@  discard block
 block discarded – undo
8206 8206
 			$datetime = new DateTime();
8207 8207
 			$offset = $datetime->format('P');
8208 8208
 		} else $offset = '+00:00';
8209
-		$filter_query = $this->getFilter($filters,true,true);
8209
+		$filter_query = $this->getFilter($filters, true, true);
8210 8210
 
8211 8211
 		if ($globalDBdriver == 'mysql') {
8212
-			$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
8212
+			$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
8213 8213
 								FROM spotter_output".$filter_query." owner_name <> ''
8214 8214
 								GROUP BY year_name, month_name
8215 8215
 								ORDER BY date_count DESC";
8216 8216
 		} else {
8217
-			$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
8217
+			$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
8218 8218
 								FROM spotter_output".$filter_query." owner_name <> ''
8219 8219
 								GROUP BY year_name, month_name
8220 8220
 								ORDER BY date_count DESC";
@@ -8226,7 +8226,7 @@  discard block
 block discarded – undo
8226 8226
 		$date_array = array();
8227 8227
 		$temp_array = array();
8228 8228
         
8229
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8229
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8230 8230
 		{
8231 8231
 			$temp_array['month_name'] = $row['month_name'];
8232 8232
 			$temp_array['year_name'] = $row['year_name'];
@@ -8247,7 +8247,7 @@  discard block
 block discarded – undo
8247 8247
 	public function countAllMonthsOwnersByAirlines($filters = array())
8248 8248
 	{
8249 8249
 		global $globalTimezone, $globalDBdriver;
8250
-		$filter_query = $this->getFilter($filters,true,true);
8250
+		$filter_query = $this->getFilter($filters, true, true);
8251 8251
 		if ($globalTimezone != '') {
8252 8252
 			date_default_timezone_set($globalTimezone);
8253 8253
 			$datetime = new DateTime();
@@ -8255,12 +8255,12 @@  discard block
 block discarded – undo
8255 8255
 		} else $offset = '+00:00';
8256 8256
 
8257 8257
 		if ($globalDBdriver == 'mysql') {
8258
-			$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
8258
+			$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
8259 8259
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
8260 8260
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8261 8261
 								ORDER BY date_count DESC";
8262 8262
 		} else {
8263
-			$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
8263
+			$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
8264 8264
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
8265 8265
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8266 8266
 								ORDER BY date_count DESC";
@@ -8272,7 +8272,7 @@  discard block
 block discarded – undo
8272 8272
 		$date_array = array();
8273 8273
 		$temp_array = array();
8274 8274
         
8275
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8275
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8276 8276
 		{
8277 8277
 			$temp_array['month_name'] = $row['month_name'];
8278 8278
 			$temp_array['year_name'] = $row['year_name'];
@@ -8299,15 +8299,15 @@  discard block
 block discarded – undo
8299 8299
 			$datetime = new DateTime();
8300 8300
 			$offset = $datetime->format('P');
8301 8301
 		} else $offset = '+00:00';
8302
-		$filter_query = $this->getFilter($filters,true,true);
8302
+		$filter_query = $this->getFilter($filters, true, true);
8303 8303
 
8304 8304
 		if ($globalDBdriver == 'mysql') {
8305
-			$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
8305
+			$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
8306 8306
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
8307 8307
 								GROUP BY year_name, month_name
8308 8308
 								ORDER BY date_count DESC";
8309 8309
 		} else {
8310
-			$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
8310
+			$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
8311 8311
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
8312 8312
 								GROUP BY year_name, month_name
8313 8313
 								ORDER BY date_count DESC";
@@ -8319,7 +8319,7 @@  discard block
 block discarded – undo
8319 8319
 		$date_array = array();
8320 8320
 		$temp_array = array();
8321 8321
         
8322
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8322
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8323 8323
 		{
8324 8324
 			$temp_array['month_name'] = $row['month_name'];
8325 8325
 			$temp_array['year_name'] = $row['year_name'];
@@ -8340,7 +8340,7 @@  discard block
 block discarded – undo
8340 8340
 	public function countAllMonthsPilotsByAirlines($filters = array())
8341 8341
 	{
8342 8342
 		global $globalTimezone, $globalDBdriver;
8343
-		$filter_query = $this->getFilter($filters,true,true);
8343
+		$filter_query = $this->getFilter($filters, true, true);
8344 8344
 		if ($globalTimezone != '') {
8345 8345
 			date_default_timezone_set($globalTimezone);
8346 8346
 			$datetime = new DateTime();
@@ -8348,12 +8348,12 @@  discard block
 block discarded – undo
8348 8348
 		} else $offset = '+00:00';
8349 8349
 
8350 8350
 		if ($globalDBdriver == 'mysql') {
8351
-			$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
8351
+			$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
8352 8352
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
8353 8353
 								GROUP BY spotter_output.airline_icao,year_name, month_name
8354 8354
 								ORDER BY date_count DESC";
8355 8355
 		} else {
8356
-			$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
8356
+			$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
8357 8357
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
8358 8358
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8359 8359
 								ORDER BY date_count DESC";
@@ -8365,7 +8365,7 @@  discard block
 block discarded – undo
8365 8365
 		$date_array = array();
8366 8366
 		$temp_array = array();
8367 8367
         
8368
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8368
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8369 8369
 		{
8370 8370
 			$temp_array['month_name'] = $row['month_name'];
8371 8371
 			$temp_array['year_name'] = $row['year_name'];
@@ -8387,7 +8387,7 @@  discard block
 block discarded – undo
8387 8387
 	public function countAllMonthsAirlines($filters = array())
8388 8388
 	{
8389 8389
 		global $globalTimezone, $globalDBdriver;
8390
-		$filter_query = $this->getFilter($filters,true,true);
8390
+		$filter_query = $this->getFilter($filters, true, true);
8391 8391
 		if ($globalTimezone != '') {
8392 8392
 			date_default_timezone_set($globalTimezone);
8393 8393
 			$datetime = new DateTime();
@@ -8395,12 +8395,12 @@  discard block
 block discarded – undo
8395 8395
 		} else $offset = '+00:00';
8396 8396
 
8397 8397
 		if ($globalDBdriver == 'mysql') {
8398
-			$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
8398
+			$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
8399 8399
 								FROM spotter_output".$filter_query." airline_icao <> '' 
8400 8400
 								GROUP BY year_name, month_name
8401 8401
 								ORDER BY date_count DESC";
8402 8402
 		} else {
8403
-			$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
8403
+			$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
8404 8404
 								FROM spotter_output".$filter_query." airline_icao <> '' 
8405 8405
 								GROUP BY year_name, month_name
8406 8406
 								ORDER BY date_count DESC";
@@ -8412,7 +8412,7 @@  discard block
 block discarded – undo
8412 8412
 		$date_array = array();
8413 8413
 		$temp_array = array();
8414 8414
         
8415
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8415
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8416 8416
 		{
8417 8417
 			$temp_array['month_name'] = $row['month_name'];
8418 8418
 			$temp_array['year_name'] = $row['year_name'];
@@ -8438,15 +8438,15 @@  discard block
 block discarded – undo
8438 8438
 			$datetime = new DateTime();
8439 8439
 			$offset = $datetime->format('P');
8440 8440
 		} else $offset = '+00:00';
8441
-		$filter_query = $this->getFilter($filters,true,true);
8441
+		$filter_query = $this->getFilter($filters, true, true);
8442 8442
 
8443 8443
 		if ($globalDBdriver == 'mysql') {
8444
-			$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
8444
+			$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
8445 8445
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
8446 8446
 								GROUP BY year_name, month_name
8447 8447
 								ORDER BY date_count DESC";
8448 8448
 		} else {
8449
-			$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
8449
+			$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
8450 8450
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
8451 8451
 								GROUP BY year_name, month_name
8452 8452
 								ORDER BY date_count DESC";
@@ -8458,7 +8458,7 @@  discard block
 block discarded – undo
8458 8458
 		$date_array = array();
8459 8459
 		$temp_array = array();
8460 8460
         
8461
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8461
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8462 8462
 		{
8463 8463
 			$temp_array['month_name'] = $row['month_name'];
8464 8464
 			$temp_array['year_name'] = $row['year_name'];
@@ -8480,7 +8480,7 @@  discard block
 block discarded – undo
8480 8480
 	public function countAllMonthsAircraftsByAirlines($filters = array())
8481 8481
 	{
8482 8482
 		global $globalTimezone, $globalDBdriver;
8483
-		$filter_query = $this->getFilter($filters,true,true);
8483
+		$filter_query = $this->getFilter($filters, true, true);
8484 8484
 		if ($globalTimezone != '') {
8485 8485
 			date_default_timezone_set($globalTimezone);
8486 8486
 			$datetime = new DateTime();
@@ -8488,12 +8488,12 @@  discard block
 block discarded – undo
8488 8488
 		} else $offset = '+00:00';
8489 8489
 
8490 8490
 		if ($globalDBdriver == 'mysql') {
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(distinct aircraft_icao) as date_count
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(distinct aircraft_icao) as date_count
8492 8492
 								FROM spotter_output".$filter_query." aircraft_icao <> ''  AND spotter_output.airline_icao <> '' 
8493 8493
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8494 8494
 								ORDER BY date_count DESC";
8495 8495
 		} else {
8496
-			$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
8496
+			$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
8497 8497
 								FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' 
8498 8498
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8499 8499
 								ORDER BY date_count DESC";
@@ -8505,7 +8505,7 @@  discard block
 block discarded – undo
8505 8505
 		$date_array = array();
8506 8506
 		$temp_array = array();
8507 8507
         
8508
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8508
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8509 8509
 		{
8510 8510
 			$temp_array['month_name'] = $row['month_name'];
8511 8511
 			$temp_array['year_name'] = $row['year_name'];
@@ -8532,15 +8532,15 @@  discard block
 block discarded – undo
8532 8532
 			$datetime = new DateTime();
8533 8533
 			$offset = $datetime->format('P');
8534 8534
 		} else $offset = '+00:00';
8535
-		$filter_query = $this->getFilter($filters,true,true);
8535
+		$filter_query = $this->getFilter($filters, true, true);
8536 8536
 
8537 8537
 		if ($globalDBdriver == 'mysql') {
8538
-			$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
8538
+			$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
8539 8539
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
8540 8540
 								GROUP BY year_name, month_name
8541 8541
 								ORDER BY date_count DESC";
8542 8542
 		} else {
8543
-			$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
8543
+			$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
8544 8544
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
8545 8545
 								GROUP BY year_name, month_name
8546 8546
 								ORDER BY date_count DESC";
@@ -8552,7 +8552,7 @@  discard block
 block discarded – undo
8552 8552
 		$date_array = array();
8553 8553
 		$temp_array = array();
8554 8554
         
8555
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8555
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8556 8556
 		{
8557 8557
 			$temp_array['month_name'] = $row['month_name'];
8558 8558
 			$temp_array['year_name'] = $row['year_name'];
@@ -8574,7 +8574,7 @@  discard block
 block discarded – undo
8574 8574
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
8575 8575
 	{
8576 8576
 		global $globalTimezone, $globalDBdriver;
8577
-		$filter_query = $this->getFilter($filters,true,true);
8577
+		$filter_query = $this->getFilter($filters, true, true);
8578 8578
 		if ($globalTimezone != '') {
8579 8579
 			date_default_timezone_set($globalTimezone);
8580 8580
 			$datetime = new DateTime();
@@ -8582,12 +8582,12 @@  discard block
 block discarded – undo
8582 8582
 		} else $offset = '+00:00';
8583 8583
 
8584 8584
 		if ($globalDBdriver == 'mysql') {
8585
-			$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
8585
+			$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
8586 8586
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
8587 8587
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8588 8588
 								ORDER BY date_count DESC";
8589 8589
 		} else {
8590
-			$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
8590
+			$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
8591 8591
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
8592 8592
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8593 8593
 								ORDER BY date_count DESC";
@@ -8599,7 +8599,7 @@  discard block
 block discarded – undo
8599 8599
 		$date_array = array();
8600 8600
 		$temp_array = array();
8601 8601
         
8602
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8602
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8603 8603
 		{
8604 8604
 			$temp_array['month_name'] = $row['month_name'];
8605 8605
 			$temp_array['year_name'] = $row['year_name'];
@@ -8627,7 +8627,7 @@  discard block
 block discarded – undo
8627 8627
 			$datetime = new DateTime();
8628 8628
 			$offset = $datetime->format('P');
8629 8629
 		} else $offset = '+00:00';
8630
-		$filter_query = $this->getFilter($filters,true,true);
8630
+		$filter_query = $this->getFilter($filters, true, true);
8631 8631
 		if ($globalDBdriver == 'mysql') {
8632 8632
 			$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
8633 8633
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
@@ -8648,7 +8648,7 @@  discard block
 block discarded – undo
8648 8648
 		$date_array = array();
8649 8649
 		$temp_array = array();
8650 8650
         
8651
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8651
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8652 8652
 		{
8653 8653
 			$temp_array['year_name'] = $row['year_name'];
8654 8654
 			$temp_array['month_name'] = $row['month_name'];
@@ -8668,7 +8668,7 @@  discard block
 block discarded – undo
8668 8668
 	* @return Array the hour list
8669 8669
 	*
8670 8670
 	*/
8671
-	public function countAllHours($orderby,$filters = array())
8671
+	public function countAllHours($orderby, $filters = array())
8672 8672
 	{
8673 8673
 		global $globalTimezone, $globalDBdriver;
8674 8674
 		if ($globalTimezone != '') {
@@ -8716,7 +8716,7 @@  discard block
 block discarded – undo
8716 8716
 		$hour_array = array();
8717 8717
 		$temp_array = array();
8718 8718
         
8719
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8719
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8720 8720
 		{
8721 8721
 			$temp_array['hour_name'] = $row['hour_name'];
8722 8722
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8736,7 +8736,7 @@  discard block
 block discarded – undo
8736 8736
 	public function countAllHoursByAirlines($orderby, $filters = array())
8737 8737
 	{
8738 8738
 		global $globalTimezone, $globalDBdriver;
8739
-		$filter_query = $this->getFilter($filters,true,true);
8739
+		$filter_query = $this->getFilter($filters, true, true);
8740 8740
 		if ($globalTimezone != '') {
8741 8741
 			date_default_timezone_set($globalTimezone);
8742 8742
 			$datetime = new DateTime();
@@ -8754,7 +8754,7 @@  discard block
 block discarded – undo
8754 8754
 		}
8755 8755
 		
8756 8756
 		if ($globalDBdriver == 'mysql') {
8757
-			$query  = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8757
+			$query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8758 8758
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8759 8759
 								GROUP BY spotter_output.airline_icao, hour_name 
8760 8760
 								".$orderby_sql;
@@ -8767,7 +8767,7 @@  discard block
 block discarded – undo
8767 8767
   */    
8768 8768
 		$query_data = array(':offset' => $offset);
8769 8769
 		} else {
8770
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8770
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8771 8771
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8772 8772
 								GROUP BY spotter_output.airline_icao, hour_name 
8773 8773
 								".$orderby_sql;
@@ -8780,7 +8780,7 @@  discard block
 block discarded – undo
8780 8780
 		$hour_array = array();
8781 8781
 		$temp_array = array();
8782 8782
         
8783
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8783
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8784 8784
 		{
8785 8785
 			$temp_array['hour_name'] = $row['hour_name'];
8786 8786
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8803,34 +8803,34 @@  discard block
 block discarded – undo
8803 8803
 	public function countAllHoursByAirline($airline_icao, $filters = array())
8804 8804
 	{
8805 8805
 		global $globalTimezone, $globalDBdriver;
8806
-		$filter_query = $this->getFilter($filters,true,true);
8806
+		$filter_query = $this->getFilter($filters, true, true);
8807 8807
 		if ($globalTimezone != '') {
8808 8808
 			date_default_timezone_set($globalTimezone);
8809 8809
 			$datetime = new DateTime();
8810 8810
 			$offset = $datetime->format('P');
8811 8811
 		} else $offset = '+00:00';
8812 8812
 
8813
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8813
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
8814 8814
 
8815 8815
 		if ($globalDBdriver == 'mysql') {
8816
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8816
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8817 8817
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
8818 8818
 								GROUP BY hour_name 
8819 8819
 								ORDER BY hour_name ASC";
8820 8820
 		} else {
8821
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8821
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8822 8822
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
8823 8823
 								GROUP BY hour_name 
8824 8824
 								ORDER BY hour_name ASC";
8825 8825
 		}
8826 8826
 		
8827 8827
 		$sth = $this->db->prepare($query);
8828
-		$sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset));
8828
+		$sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset));
8829 8829
       
8830 8830
 		$hour_array = array();
8831 8831
 		$temp_array = array();
8832 8832
         
8833
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8833
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8834 8834
 		{
8835 8835
 			$temp_array['hour_name'] = $row['hour_name'];
8836 8836
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8853,8 +8853,8 @@  discard block
 block discarded – undo
8853 8853
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
8854 8854
 	{
8855 8855
 		global $globalTimezone, $globalDBdriver;
8856
-		$filter_query = $this->getFilter($filters,true,true);
8857
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
8856
+		$filter_query = $this->getFilter($filters, true, true);
8857
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
8858 8858
 		if ($globalTimezone != '') {
8859 8859
 			date_default_timezone_set($globalTimezone);
8860 8860
 			$datetime = new DateTime();
@@ -8862,24 +8862,24 @@  discard block
 block discarded – undo
8862 8862
 		} else $offset = '+00:00';
8863 8863
 
8864 8864
 		if ($globalDBdriver == 'mysql') {
8865
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8865
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8866 8866
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
8867 8867
 								GROUP BY hour_name 
8868 8868
 								ORDER BY hour_name ASC";
8869 8869
 		} else {
8870
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8870
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8871 8871
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
8872 8872
 								GROUP BY hour_name 
8873 8873
 								ORDER BY hour_name ASC";
8874 8874
 		}
8875 8875
 		
8876 8876
 		$sth = $this->db->prepare($query);
8877
-		$sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset));
8877
+		$sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset));
8878 8878
       
8879 8879
 		$hour_array = array();
8880 8880
 		$temp_array = array();
8881 8881
         
8882
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8882
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8883 8883
 		{
8884 8884
 			$temp_array['hour_name'] = $row['hour_name'];
8885 8885
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8900,8 +8900,8 @@  discard block
 block discarded – undo
8900 8900
 	public function countAllHoursByRegistration($registration, $filters = array())
8901 8901
 	{
8902 8902
 		global $globalTimezone, $globalDBdriver;
8903
-		$filter_query = $this->getFilter($filters,true,true);
8904
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
8903
+		$filter_query = $this->getFilter($filters, true, true);
8904
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8905 8905
 		if ($globalTimezone != '') {
8906 8906
 			date_default_timezone_set($globalTimezone);
8907 8907
 			$datetime = new DateTime();
@@ -8909,24 +8909,24 @@  discard block
 block discarded – undo
8909 8909
 		} else $offset = '+00:00';
8910 8910
 
8911 8911
 		if ($globalDBdriver == 'mysql') {
8912
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8912
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8913 8913
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
8914 8914
 								GROUP BY hour_name 
8915 8915
 								ORDER BY hour_name ASC";
8916 8916
 		} else {
8917
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8917
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8918 8918
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
8919 8919
 								GROUP BY hour_name 
8920 8920
 								ORDER BY hour_name ASC";
8921 8921
 		}
8922 8922
 		
8923 8923
 		$sth = $this->db->prepare($query);
8924
-		$sth->execute(array(':registration' => $registration,':offset' => $offset));
8924
+		$sth->execute(array(':registration' => $registration, ':offset' => $offset));
8925 8925
       
8926 8926
 		$hour_array = array();
8927 8927
 		$temp_array = array();
8928 8928
         
8929
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8929
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8930 8930
 		{
8931 8931
 			$temp_array['hour_name'] = $row['hour_name'];
8932 8932
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8947,8 +8947,8 @@  discard block
 block discarded – undo
8947 8947
 	public function countAllHoursByAirport($airport_icao, $filters = array())
8948 8948
 	{
8949 8949
 		global $globalTimezone, $globalDBdriver;
8950
-		$filter_query = $this->getFilter($filters,true,true);
8951
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8950
+		$filter_query = $this->getFilter($filters, true, true);
8951
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8952 8952
 		if ($globalTimezone != '') {
8953 8953
 			date_default_timezone_set($globalTimezone);
8954 8954
 			$datetime = new DateTime();
@@ -8956,24 +8956,24 @@  discard block
 block discarded – undo
8956 8956
 		} else $offset = '+00:00';
8957 8957
 
8958 8958
 		if ($globalDBdriver == 'mysql') {
8959
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8959
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8960 8960
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
8961 8961
 								GROUP BY hour_name 
8962 8962
 								ORDER BY hour_name ASC";
8963 8963
 		} else {
8964
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8964
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8965 8965
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
8966 8966
 								GROUP BY hour_name 
8967 8967
 								ORDER BY hour_name ASC";
8968 8968
 		}
8969 8969
 		
8970 8970
 		$sth = $this->db->prepare($query);
8971
-		$sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset));
8971
+		$sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset));
8972 8972
       
8973 8973
 		$hour_array = array();
8974 8974
 		$temp_array = array();
8975 8975
         
8976
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8976
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8977 8977
 		{
8978 8978
 			$temp_array['hour_name'] = $row['hour_name'];
8979 8979
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8992,11 +8992,11 @@  discard block
 block discarded – undo
8992 8992
 	* @return Array the hour list
8993 8993
 	*
8994 8994
 	*/
8995
-	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
8995
+	public function countAllHoursByManufacturer($aircraft_manufacturer, $filters = array())
8996 8996
 	{
8997 8997
 		global $globalTimezone, $globalDBdriver;
8998
-		$filter_query = $this->getFilter($filters,true,true);
8999
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
8998
+		$filter_query = $this->getFilter($filters, true, true);
8999
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
9000 9000
 		if ($globalTimezone != '') {
9001 9001
 			date_default_timezone_set($globalTimezone);
9002 9002
 			$datetime = new DateTime();
@@ -9004,24 +9004,24 @@  discard block
 block discarded – undo
9004 9004
 		} else $offset = '+00:00';
9005 9005
 
9006 9006
 		if ($globalDBdriver == 'mysql') {
9007
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9007
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9008 9008
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
9009 9009
 								GROUP BY hour_name 
9010 9010
 								ORDER BY hour_name ASC";
9011 9011
 		} else {
9012
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9012
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9013 9013
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
9014 9014
 								GROUP BY hour_name 
9015 9015
 								ORDER BY hour_name ASC";
9016 9016
 		}
9017 9017
 		
9018 9018
 		$sth = $this->db->prepare($query);
9019
-		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset));
9019
+		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset));
9020 9020
       
9021 9021
 		$hour_array = array();
9022 9022
 		$temp_array = array();
9023 9023
         
9024
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9024
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9025 9025
 		{
9026 9026
 			$temp_array['hour_name'] = $row['hour_name'];
9027 9027
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9043,8 +9043,8 @@  discard block
 block discarded – undo
9043 9043
 	public function countAllHoursByDate($date, $filters = array())
9044 9044
 	{
9045 9045
 		global $globalTimezone, $globalDBdriver;
9046
-		$filter_query = $this->getFilter($filters,true,true);
9047
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
9046
+		$filter_query = $this->getFilter($filters, true, true);
9047
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
9048 9048
 		if ($globalTimezone != '') {
9049 9049
 			date_default_timezone_set($globalTimezone);
9050 9050
 			$datetime = new DateTime($date);
@@ -9052,12 +9052,12 @@  discard block
 block discarded – undo
9052 9052
 		} else $offset = '+00:00';
9053 9053
 
9054 9054
 		if ($globalDBdriver == 'mysql') {
9055
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9055
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9056 9056
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
9057 9057
 								GROUP BY hour_name 
9058 9058
 								ORDER BY hour_name ASC";
9059 9059
 		} else {
9060
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9060
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9061 9061
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date
9062 9062
 								GROUP BY hour_name 
9063 9063
 								ORDER BY hour_name ASC";
@@ -9069,7 +9069,7 @@  discard block
 block discarded – undo
9069 9069
 		$hour_array = array();
9070 9070
 		$temp_array = array();
9071 9071
         
9072
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9072
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9073 9073
 		{
9074 9074
 			$temp_array['hour_name'] = $row['hour_name'];
9075 9075
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9091,8 +9091,8 @@  discard block
 block discarded – undo
9091 9091
 	public function countAllHoursByIdent($ident, $filters = array())
9092 9092
 	{
9093 9093
 		global $globalTimezone, $globalDBdriver;
9094
-		$filter_query = $this->getFilter($filters,true,true);
9095
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
9094
+		$filter_query = $this->getFilter($filters, true, true);
9095
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
9096 9096
 		if ($globalTimezone != '') {
9097 9097
 			date_default_timezone_set($globalTimezone);
9098 9098
 			$datetime = new DateTime();
@@ -9100,12 +9100,12 @@  discard block
 block discarded – undo
9100 9100
 		} else $offset = '+00:00';
9101 9101
 
9102 9102
 		if ($globalDBdriver == 'mysql') {
9103
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9103
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9104 9104
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
9105 9105
 								GROUP BY hour_name 
9106 9106
 								ORDER BY hour_name ASC";
9107 9107
 		} else {
9108
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9108
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9109 9109
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
9110 9110
 								GROUP BY hour_name 
9111 9111
 								ORDER BY hour_name ASC";
@@ -9113,12 +9113,12 @@  discard block
 block discarded – undo
9113 9113
       
9114 9114
 		
9115 9115
 		$sth = $this->db->prepare($query);
9116
-		$sth->execute(array(':ident' => $ident,':offset' => $offset));
9116
+		$sth->execute(array(':ident' => $ident, ':offset' => $offset));
9117 9117
       
9118 9118
 		$hour_array = array();
9119 9119
 		$temp_array = array();
9120 9120
         
9121
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9121
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9122 9122
 		{
9123 9123
 			$temp_array['hour_name'] = $row['hour_name'];
9124 9124
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9137,12 +9137,12 @@  discard block
 block discarded – undo
9137 9137
 	* @return Array the hour list
9138 9138
 	*
9139 9139
 	*/
9140
-	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
9140
+	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
9141 9141
 	{
9142 9142
 		global $globalTimezone, $globalDBdriver;
9143
-		$filter_query = $this->getFilter($filters,true,true);
9144
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
9145
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
9143
+		$filter_query = $this->getFilter($filters, true, true);
9144
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
9145
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
9146 9146
 		if ($globalTimezone != '') {
9147 9147
 			date_default_timezone_set($globalTimezone);
9148 9148
 			$datetime = new DateTime();
@@ -9150,24 +9150,24 @@  discard block
 block discarded – undo
9150 9150
 		} else $offset = '+00:00';
9151 9151
 
9152 9152
 		if ($globalDBdriver == 'mysql') {
9153
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9153
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9154 9154
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
9155 9155
 								GROUP BY hour_name 
9156 9156
 								ORDER BY hour_name ASC";
9157 9157
 		} else {
9158
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9158
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9159 9159
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
9160 9160
 								GROUP BY hour_name 
9161 9161
 								ORDER BY hour_name ASC";
9162 9162
 		}
9163 9163
 		
9164 9164
 		$sth = $this->db->prepare($query);
9165
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset));
9165
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset));
9166 9166
       
9167 9167
 		$hour_array = array();
9168 9168
 		$temp_array = array();
9169 9169
         
9170
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9170
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9171 9171
 		{
9172 9172
 			$temp_array['hour_name'] = $row['hour_name'];
9173 9173
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9188,8 +9188,8 @@  discard block
 block discarded – undo
9188 9188
 	public function countAllHoursByCountry($country, $filters = array())
9189 9189
 	{
9190 9190
 		global $globalTimezone, $globalDBdriver;
9191
-		$filter_query = $this->getFilter($filters,true,true);
9192
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
9191
+		$filter_query = $this->getFilter($filters, true, true);
9192
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
9193 9193
 		if ($globalTimezone != '') {
9194 9194
 			date_default_timezone_set($globalTimezone);
9195 9195
 			$datetime = new DateTime();
@@ -9197,24 +9197,24 @@  discard block
 block discarded – undo
9197 9197
 		} else $offset = '+00:00';
9198 9198
 
9199 9199
 		if ($globalDBdriver == 'mysql') {
9200
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9200
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9201 9201
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
9202 9202
 								GROUP BY hour_name 
9203 9203
 								ORDER BY hour_name ASC";
9204 9204
 		} else {
9205
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9205
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9206 9206
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
9207 9207
 								GROUP BY hour_name 
9208 9208
 								ORDER BY hour_name ASC";
9209 9209
 		}
9210 9210
 		
9211 9211
 		$sth = $this->db->prepare($query);
9212
-		$sth->execute(array(':country' => $country,':offset' => $offset));
9212
+		$sth->execute(array(':country' => $country, ':offset' => $offset));
9213 9213
       
9214 9214
 		$hour_array = array();
9215 9215
 		$temp_array = array();
9216 9216
         
9217
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9217
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9218 9218
 		{
9219 9219
 			$temp_array['hour_name'] = $row['hour_name'];
9220 9220
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9236,8 +9236,8 @@  discard block
 block discarded – undo
9236 9236
 	*/
9237 9237
 	public function countOverallAircrafts($filters = array())
9238 9238
 	{
9239
-		$filter_query = $this->getFilter($filters,true,true);
9240
-		$query  = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
9239
+		$filter_query = $this->getFilter($filters, true, true);
9240
+		$query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
9241 9241
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
9242 9242
 		$sth = $this->db->prepare($query);
9243 9243
 		$sth->execute();
@@ -9252,8 +9252,8 @@  discard block
 block discarded – undo
9252 9252
 	*/
9253 9253
 	public function countOverallArrival($filters = array())
9254 9254
 	{
9255
-		$filter_query = $this->getFilter($filters,true,true);
9256
-		$query  = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
9255
+		$filter_query = $this->getFilter($filters, true, true);
9256
+		$query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
9257 9257
                     FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''";
9258 9258
 		
9259 9259
 		$sth = $this->db->prepare($query);
@@ -9269,8 +9269,8 @@  discard block
 block discarded – undo
9269 9269
 	*/
9270 9270
 	public function countOverallPilots($filters = array())
9271 9271
 	{
9272
-		$filter_query = $this->getFilter($filters,true,true);
9273
-		$query  = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
9272
+		$filter_query = $this->getFilter($filters, true, true);
9273
+		$query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
9274 9274
                     FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''";
9275 9275
 		$sth = $this->db->prepare($query);
9276 9276
 		$sth->execute();
@@ -9285,8 +9285,8 @@  discard block
 block discarded – undo
9285 9285
 	*/
9286 9286
 	public function countOverallOwners($filters = array())
9287 9287
 	{
9288
-		$filter_query = $this->getFilter($filters,true,true);
9289
-		$query  = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
9288
+		$filter_query = $this->getFilter($filters, true, true);
9289
+		$query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
9290 9290
                     FROM spotter_output".$filter_query." spotter_output.owner_name <> ''";
9291 9291
 		$sth = $this->db->prepare($query);
9292 9292
 		$sth->execute();
@@ -9319,8 +9319,8 @@  discard block
 block discarded – undo
9319 9319
 	*/
9320 9320
 	public function countOverallMilitaryFlights($filters = array())
9321 9321
 	{
9322
-		$filter_query = $this->getFilter($filters,true,true);
9323
-		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
9322
+		$filter_query = $this->getFilter($filters, true, true);
9323
+		$query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
9324 9324
                     FROM airlines,spotter_output".$filter_query." spotter_output.airline_icao = airlines.icao AND airlines.type = 'military'";
9325 9325
       
9326 9326
 		$sth = $this->db->prepare($query);
@@ -9357,7 +9357,7 @@  discard block
 block discarded – undo
9357 9357
 	public function countAllHoursFromToday($filters = array())
9358 9358
 	{
9359 9359
 		global $globalTimezone, $globalDBdriver;
9360
-		$filter_query = $this->getFilter($filters,true,true);
9360
+		$filter_query = $this->getFilter($filters, true, true);
9361 9361
 		if ($globalTimezone != '') {
9362 9362
 			date_default_timezone_set($globalTimezone);
9363 9363
 			$datetime = new DateTime();
@@ -9365,12 +9365,12 @@  discard block
 block discarded – undo
9365 9365
 		} else $offset = '+00:00';
9366 9366
 
9367 9367
 		if ($globalDBdriver == 'mysql') {
9368
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9368
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9369 9369
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE()
9370 9370
 								GROUP BY hour_name 
9371 9371
 								ORDER BY hour_name ASC";
9372 9372
 		} else {
9373
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9373
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9374 9374
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date)
9375 9375
 								GROUP BY hour_name 
9376 9376
 								ORDER BY hour_name ASC";
@@ -9382,7 +9382,7 @@  discard block
 block discarded – undo
9382 9382
 		$hour_array = array();
9383 9383
 		$temp_array = array();
9384 9384
         
9385
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9385
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9386 9386
 		{
9387 9387
 			$temp_array['hour_name'] = $row['hour_name'];
9388 9388
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9401,14 +9401,14 @@  discard block
 block discarded – undo
9401 9401
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
9402 9402
 	{
9403 9403
 		global $global_query, $globalDBdriver, $globalTimezone;
9404
-		$filter_query = $this->getFilter($filters,true,true);
9404
+		$filter_query = $this->getFilter($filters, true, true);
9405 9405
 		date_default_timezone_set('UTC');
9406 9406
 		$limit_query = '';
9407 9407
 		if ($limit != "")
9408 9408
 		{
9409 9409
 			$limit_array = explode(",", $limit);
9410
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
9411
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
9410
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
9411
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
9412 9412
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
9413 9413
 			{
9414 9414
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
@@ -9461,7 +9461,7 @@  discard block
 block discarded – undo
9461 9461
 			    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')
9462 9462
 			    HAVING count(spotter_output.ident) > 5$orderby_query";
9463 9463
 			//echo $query;
9464
-			$spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone));
9464
+			$spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone));
9465 9465
 			/*
9466 9466
 			$sth = $this->db->prepare($query);
9467 9467
 			$sth->execute(array(':timezone' => $globalTimezone));
@@ -9480,9 +9480,9 @@  discard block
 block discarded – undo
9480 9480
 	*/
9481 9481
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
9482 9482
 	{
9483
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
9483
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
9484 9484
 
9485
-		$query  = "SELECT spotter_output.spotter_id
9485
+		$query = "SELECT spotter_output.spotter_id
9486 9486
 								FROM spotter_output 
9487 9487
 								WHERE spotter_output.flightaware_id = '".$flightaware_id."'";
9488 9488
         
@@ -9490,7 +9490,7 @@  discard block
 block discarded – undo
9490 9490
 		$sth = $this->db->prepare($query);
9491 9491
 		$sth->execute();
9492 9492
 
9493
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9493
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9494 9494
 		{
9495 9495
 			return $row['spotter_id'];
9496 9496
 		}
@@ -9515,23 +9515,23 @@  discard block
 block discarded – undo
9515 9515
 		}
9516 9516
 		
9517 9517
 		$current_date = date("Y-m-d H:i:s");
9518
-		$date = date("Y-m-d H:i:s",strtotime($dateString." UTC"));
9518
+		$date = date("Y-m-d H:i:s", strtotime($dateString." UTC"));
9519 9519
 		
9520 9520
 		$diff = abs(strtotime($current_date) - strtotime($date));
9521 9521
 
9522
-		$time_array['years'] = floor($diff / (365*60*60*24)); 
9522
+		$time_array['years'] = floor($diff/(365*60*60*24)); 
9523 9523
 		$years = $time_array['years'];
9524 9524
 		
9525
-		$time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
9525
+		$time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24));
9526 9526
 		$months = $time_array['months'];
9527 9527
 		
9528
-		$time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
9528
+		$time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24));
9529 9529
 		$days = $time_array['days'];
9530
-		$time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60));
9530
+		$time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60));
9531 9531
 		$hours = $time_array['hours'];
9532
-		$time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60);
9532
+		$time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60);
9533 9533
 		$minutes = $time_array['minutes'];
9534
-		$time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
9534
+		$time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
9535 9535
 		
9536 9536
 		return $time_array;	
9537 9537
 	}	
@@ -9557,63 +9557,63 @@  discard block
 block discarded – undo
9557 9557
 			$temp_array['direction_degree'] = $direction;
9558 9558
 			$temp_array['direction_shortname'] = "N";
9559 9559
 			$temp_array['direction_fullname'] = "North";
9560
-		} elseif ($direction >= 22.5 && $direction < 45){
9560
+		} elseif ($direction >= 22.5 && $direction < 45) {
9561 9561
 			$temp_array['direction_degree'] = $direction;
9562 9562
 			$temp_array['direction_shortname'] = "NNE";
9563 9563
 			$temp_array['direction_fullname'] = "North-Northeast";
9564
-		} elseif ($direction >= 45 && $direction < 67.5){
9564
+		} elseif ($direction >= 45 && $direction < 67.5) {
9565 9565
 			$temp_array['direction_degree'] = $direction;
9566 9566
 			$temp_array['direction_shortname'] = "NE";
9567 9567
 			$temp_array['direction_fullname'] = "Northeast";
9568
-		} elseif ($direction >= 67.5 && $direction < 90){
9568
+		} elseif ($direction >= 67.5 && $direction < 90) {
9569 9569
 			$temp_array['direction_degree'] = $direction;
9570 9570
 			$temp_array['direction_shortname'] = "ENE";
9571 9571
 			$temp_array['direction_fullname'] = "East-Northeast";
9572
-		} elseif ($direction >= 90 && $direction < 112.5){
9572
+		} elseif ($direction >= 90 && $direction < 112.5) {
9573 9573
 			$temp_array['direction_degree'] = $direction;
9574 9574
 			$temp_array['direction_shortname'] = "E";
9575 9575
 			$temp_array['direction_fullname'] = "East";
9576
-		} elseif ($direction >= 112.5 && $direction < 135){
9576
+		} elseif ($direction >= 112.5 && $direction < 135) {
9577 9577
 			$temp_array['direction_degree'] = $direction;
9578 9578
 			$temp_array['direction_shortname'] = "ESE";
9579 9579
 			$temp_array['direction_fullname'] = "East-Southeast";
9580
-		} elseif ($direction >= 135 && $direction < 157.5){
9580
+		} elseif ($direction >= 135 && $direction < 157.5) {
9581 9581
 			$temp_array['direction_degree'] = $direction;
9582 9582
 			$temp_array['direction_shortname'] = "SE";
9583 9583
 			$temp_array['direction_fullname'] = "Southeast";
9584
-		} elseif ($direction >= 157.5 && $direction < 180){
9584
+		} elseif ($direction >= 157.5 && $direction < 180) {
9585 9585
 			$temp_array['direction_degree'] = $direction;
9586 9586
 			$temp_array['direction_shortname'] = "SSE";
9587 9587
 			$temp_array['direction_fullname'] = "South-Southeast";
9588
-		} elseif ($direction >= 180 && $direction < 202.5){
9588
+		} elseif ($direction >= 180 && $direction < 202.5) {
9589 9589
 			$temp_array['direction_degree'] = $direction;
9590 9590
 			$temp_array['direction_shortname'] = "S";
9591 9591
 			$temp_array['direction_fullname'] = "South";
9592
-		} elseif ($direction >= 202.5 && $direction < 225){
9592
+		} elseif ($direction >= 202.5 && $direction < 225) {
9593 9593
 			$temp_array['direction_degree'] = $direction;
9594 9594
 			$temp_array['direction_shortname'] = "SSW";
9595 9595
 			$temp_array['direction_fullname'] = "South-Southwest";
9596
-		} elseif ($direction >= 225 && $direction < 247.5){
9596
+		} elseif ($direction >= 225 && $direction < 247.5) {
9597 9597
 			$temp_array['direction_degree'] = $direction;
9598 9598
 			$temp_array['direction_shortname'] = "SW";
9599 9599
 			$temp_array['direction_fullname'] = "Southwest";
9600
-		} elseif ($direction >= 247.5 && $direction < 270){
9600
+		} elseif ($direction >= 247.5 && $direction < 270) {
9601 9601
 			$temp_array['direction_degree'] = $direction;
9602 9602
 			$temp_array['direction_shortname'] = "WSW";
9603 9603
 			$temp_array['direction_fullname'] = "West-Southwest";
9604
-		} elseif ($direction >= 270 && $direction < 292.5){
9604
+		} elseif ($direction >= 270 && $direction < 292.5) {
9605 9605
 			$temp_array['direction_degree'] = $direction;
9606 9606
 			$temp_array['direction_shortname'] = "W";
9607 9607
 			$temp_array['direction_fullname'] = "West";
9608
-		} elseif ($direction >= 292.5 && $direction < 315){
9608
+		} elseif ($direction >= 292.5 && $direction < 315) {
9609 9609
 			$temp_array['direction_degree'] = $direction;
9610 9610
 			$temp_array['direction_shortname'] = "WNW";
9611 9611
 			$temp_array['direction_fullname'] = "West-Northwest";
9612
-		} elseif ($direction >= 315 && $direction < 337.5){
9612
+		} elseif ($direction >= 315 && $direction < 337.5) {
9613 9613
 			$temp_array['direction_degree'] = $direction;
9614 9614
 			$temp_array['direction_shortname'] = "NW";
9615 9615
 			$temp_array['direction_fullname'] = "Northwest";
9616
-		} elseif ($direction >= 337.5 && $direction < 360){
9616
+		} elseif ($direction >= 337.5 && $direction < 360) {
9617 9617
 			$temp_array['direction_degree'] = $direction;
9618 9618
 			$temp_array['direction_shortname'] = "NNW";
9619 9619
 			$temp_array['direction_fullname'] = "North-Northwest";
@@ -9666,9 +9666,9 @@  discard block
 block discarded – undo
9666 9666
 	*/
9667 9667
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
9668 9668
 	{
9669
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
9669
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
9670 9670
 	
9671
-		$query  = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
9671
+		$query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
9672 9672
 		
9673 9673
 		$sth = $this->db->prepare($query);
9674 9674
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -9691,9 +9691,9 @@  discard block
 block discarded – undo
9691 9691
 	*/
9692 9692
 	public function getAircraftTypeBymodeS($aircraft_modes)
9693 9693
 	{
9694
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
9694
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
9695 9695
 	
9696
-		$query  = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
9696
+		$query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1";
9697 9697
 		
9698 9698
 		$sth = $this->db->prepare($query);
9699 9699
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -9714,11 +9714,11 @@  discard block
 block discarded – undo
9714 9714
 	* @param Float $longitude longitute of the flight
9715 9715
 	* @return String the countrie
9716 9716
 	*/
9717
-	public function getCountryFromLatitudeLongitude($latitude,$longitude)
9717
+	public function getCountryFromLatitudeLongitude($latitude, $longitude)
9718 9718
 	{
9719 9719
 		global $globalDBdriver, $globalDebug;
9720
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9721
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9720
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
9721
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
9722 9722
 	
9723 9723
 		$Connection = new Connection($this->db);
9724 9724
 		if (!$Connection->tableExists('countries')) return '';
@@ -9758,7 +9758,7 @@  discard block
 block discarded – undo
9758 9758
 	public function getCountryFromISO2($iso2)
9759 9759
 	{
9760 9760
 		global $globalDBdriver, $globalDebug;
9761
-		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
9761
+		$iso2 = filter_var($iso2, FILTER_SANITIZE_STRING);
9762 9762
 	
9763 9763
 		$Connection = new Connection($this->db);
9764 9764
 		if (!$Connection->tableExists('countries')) return '';
@@ -9790,19 +9790,19 @@  discard block
 block discarded – undo
9790 9790
 	*/
9791 9791
 	public function convertAircraftRegistration($registration)
9792 9792
 	{
9793
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9793
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9794 9794
 		$registration_prefix = '';
9795 9795
 		$registration_1 = substr($registration, 0, 1);
9796 9796
 		$registration_2 = substr($registration, 0, 2);
9797 9797
 
9798 9798
 		//first get the prefix based on two characters
9799
-		$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
9799
+		$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
9800 9800
       
9801 9801
 		
9802 9802
 		$sth = $this->db->prepare($query);
9803 9803
 		$sth->execute(array(':registration_2' => $registration_2));
9804 9804
         
9805
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9805
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9806 9806
 		{
9807 9807
 			$registration_prefix = $row['registration_prefix'];
9808 9808
 		}
@@ -9810,11 +9810,11 @@  discard block
 block discarded – undo
9810 9810
 		//if we didn't find a two chracter prefix lets just search the one with one character
9811 9811
 		if ($registration_prefix == '')
9812 9812
 		{
9813
-			$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
9813
+			$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
9814 9814
 			$sth = $this->db->prepare($query);
9815 9815
 			$sth->execute(array(':registration_1' => $registration_1));
9816 9816
 	        
9817
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9817
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9818 9818
 			{
9819 9819
 				$registration_prefix = $row['registration_prefix'];
9820 9820
 			}
@@ -9828,7 +9828,7 @@  discard block
 block discarded – undo
9828 9828
 			} else {
9829 9829
 				$registration = preg_replace("/^(.{1})/", "$1-", $registration);
9830 9830
 			}
9831
-		} else if(strlen($registration_prefix) == 2){
9831
+		} else if (strlen($registration_prefix) == 2) {
9832 9832
 			if (0 === strpos($registration, 'N')) {
9833 9833
 				$registration = preg_replace("/^(.{2})/", "$1", $registration);
9834 9834
 			} else {
@@ -9847,17 +9847,17 @@  discard block
 block discarded – undo
9847 9847
 	*/
9848 9848
 	public function countryFromAircraftRegistration($registration)
9849 9849
 	{
9850
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9850
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9851 9851
 		
9852 9852
 		$registration_prefix = '';
9853
-		$registration_test = explode('-',$registration);
9853
+		$registration_test = explode('-', $registration);
9854 9854
 		$country = '';
9855 9855
 		if ($registration_test[0] != $registration) {
9856 9856
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9857 9857
 	      
9858 9858
 			$sth = $this->db->prepare($query);
9859 9859
 			$sth->execute(array(':registration_1' => $registration_test[0]));
9860
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9860
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9861 9861
 			{
9862 9862
 				//$registration_prefix = $row['registration_prefix'];
9863 9863
 				$country = $row['country'];
@@ -9868,13 +9868,13 @@  discard block
 block discarded – undo
9868 9868
 
9869 9869
 			$country = '';
9870 9870
 			//first get the prefix based on two characters
9871
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
9871
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
9872 9872
       
9873 9873
 			
9874 9874
 			$sth = $this->db->prepare($query);
9875 9875
 			$sth->execute(array(':registration_2' => $registration_2));
9876 9876
         
9877
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9877
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9878 9878
 			{
9879 9879
 				$registration_prefix = $row['registration_prefix'];
9880 9880
 				$country = $row['country'];
@@ -9883,12 +9883,12 @@  discard block
 block discarded – undo
9883 9883
 			//if we didn't find a two chracter prefix lets just search the one with one character
9884 9884
 			if ($registration_prefix == "")
9885 9885
 			{
9886
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9886
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9887 9887
 	      
9888 9888
 				$sth = $this->db->prepare($query);
9889 9889
 				$sth->execute(array(':registration_1' => $registration_1));
9890 9890
 	        
9891
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
9891
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9892 9892
 				{
9893 9893
 					//$registration_prefix = $row['registration_prefix'];
9894 9894
 					$country = $row['country'];
@@ -9908,13 +9908,13 @@  discard block
 block discarded – undo
9908 9908
 	*/
9909 9909
 	public function countryFromAircraftRegistrationCode($registration)
9910 9910
 	{
9911
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9911
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9912 9912
 		
9913 9913
 		$country = '';
9914
-		$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1";
9914
+		$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1";
9915 9915
 		$sth = $this->db->prepare($query);
9916 9916
 		$sth->execute(array(':registration' => $registration));
9917
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9917
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9918 9918
 		{
9919 9919
 			$country = $row['country'];
9920 9920
 		}
@@ -9927,9 +9927,9 @@  discard block
 block discarded – undo
9927 9927
 	* @param String $flightaware_id flightaware_id from spotter_output table
9928 9928
 	* @param String $highlight New highlight value
9929 9929
 	*/
9930
-	public function setHighlightFlight($flightaware_id,$highlight) {
9930
+	public function setHighlightFlight($flightaware_id, $highlight) {
9931 9931
 		
9932
-		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
9932
+		$query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
9933 9933
 		$sth = $this->db->prepare($query);
9934 9934
 		$sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight));
9935 9935
 	}
@@ -9958,7 +9958,7 @@  discard block
 block discarded – undo
9958 9958
 		
9959 9959
 		$bitly_data = json_decode($bitly_data);
9960 9960
 		$bitly_url = '';
9961
-		if ($bitly_data->status_txt = "OK"){
9961
+		if ($bitly_data->status_txt = "OK") {
9962 9962
 			$bitly_url = $bitly_data->data->url;
9963 9963
 		}
9964 9964
 
@@ -9968,7 +9968,7 @@  discard block
 block discarded – undo
9968 9968
 
9969 9969
 	public function getOrderBy()
9970 9970
 	{
9971
-		$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"));
9971
+		$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"));
9972 9972
 		
9973 9973
 		return $orderby;
9974 9974
 		
@@ -10102,14 +10102,14 @@  discard block
 block discarded – undo
10102 10102
 		}
10103 10103
 		$sth = $this->db->prepare($query);
10104 10104
 		$sth->execute();
10105
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10105
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10106 10106
 		{
10107 10107
 			$departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']);
10108 10108
 			$arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']);
10109 10109
 			if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) {
10110
-				$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";
10110
+				$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";
10111 10111
 				$sthu = $this->db->prepare($update_query);
10112
-				$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']));
10112
+				$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']));
10113 10113
 			}
10114 10114
 		}
10115 10115
 		
@@ -10122,7 +10122,7 @@  discard block
 block discarded – undo
10122 10122
 		}
10123 10123
 		$sth = $this->db->prepare($query);
10124 10124
 		$sth->execute();
10125
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10125
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10126 10126
 		{
10127 10127
 			if (is_numeric(substr($row['ident'], -1, 1)))
10128 10128
 			{
@@ -10131,11 +10131,11 @@  discard block
 block discarded – undo
10131 10131
 				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
10132 10132
 				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
10133 10133
 				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
10134
-				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
10134
+				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
10135 10135
 				if (isset($airline_array[0]['name'])) {
10136
-					$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";
10136
+					$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";
10137 10137
 					$sthu = $this->db->prepare($update_query);
10138
-					$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']));
10138
+					$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']));
10139 10139
 				}
10140 10140
 			}
10141 10141
 		}
@@ -10155,18 +10155,18 @@  discard block
 block discarded – undo
10155 10155
 		}
10156 10156
 		$sth = $this->db->prepare($query);
10157 10157
 		$sth->execute();
10158
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10158
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10159 10159
 		{
10160 10160
 			if ($row['aircraft_icao'] != '') {
10161 10161
 				$aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']);
10162
-				if ($row['registration'] != ""){
10162
+				if ($row['registration'] != "") {
10163 10163
 					$image_array = $Image->getSpotterImage($row['registration']);
10164 10164
 					if (!isset($image_array[0]['registration'])) {
10165 10165
 						$Image->addSpotterImage($row['registration']);
10166 10166
 					}
10167 10167
 				}
10168 10168
 				if (count($aircraft_name) > 0) {
10169
-					$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";
10169
+					$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";
10170 10170
 					$sthu = $this->db->prepare($update_query);
10171 10171
 					$sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id']));
10172 10172
 				}
@@ -10181,10 +10181,10 @@  discard block
 block discarded – undo
10181 10181
 		$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";
10182 10182
 		$sth = $this->db->prepare($query);
10183 10183
 		$sth->execute();
10184
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10184
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10185 10185
 		{
10186 10186
 			if ($row['last_latitude'] != '' && $row['last_longitude'] != '') {
10187
-				$closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist);
10187
+				$closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist);
10188 10188
 				$airport_icao = '';
10189 10189
 				 if (isset($closestAirports[0])) {
10190 10190
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
@@ -10198,7 +10198,7 @@  discard block
 block discarded – undo
10198 10198
 								break;
10199 10199
 							}
10200 10200
 						}
10201
-					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
10201
+					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) {
10202 10202
 						$airport_icao = $closestAirports[0]['icao'];
10203 10203
 						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";
10204 10204
 					} else {
@@ -10209,28 +10209,28 @@  discard block
 block discarded – undo
10209 10209
 				}
10210 10210
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
10211 10211
 					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
10212
-					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10212
+					$update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10213 10213
 					$sthu = $this->db->prepare($update_query);
10214
-					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
10214
+					$sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id']));
10215 10215
 				}
10216 10216
 			}
10217 10217
 		}
10218 10218
 	}
10219 10219
 	
10220
-	public function closestAirports($origLat,$origLon,$dist = 10) {
10220
+	public function closestAirports($origLat, $origLon, $dist = 10) {
10221 10221
 		global $globalDBdriver;
10222
-		$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
10222
+		$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
10223 10223
 /*
10224 10224
 		$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 
10225 10225
                       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)) 
10226 10226
                       having distance < $dist ORDER BY distance limit 100;";
10227 10227
 */
10228 10228
 		if ($globalDBdriver == 'mysql') {
10229
-			$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 
10229
+			$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 
10230 10230
 	                      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)) 
10231 10231
 	                      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;";
10232 10232
                 } else {
10233
-			$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 
10233
+			$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 
10234 10234
 	                      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)) 
10235 10235
 	                      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;";
10236 10236
     		}
Please login to merge, or discard this patch.