Completed
Push — master ( 5b2234...f7c0d7 )
by Yannick
07:17
created
require/class.METAR.php 3 patches
Indentation   +263 added lines, -263 removed lines patch added patch discarded remove patch
@@ -7,109 +7,109 @@  discard block
 block discarded – undo
7 7
 	public $db;
8 8
 	
9 9
 	protected $texts = Array(
10
-	    'MI' => 'Shallow',
11
-	    'PR' => 'Partial',
12
-	    'BC' => 'Low drifting',
13
-	    'BL' => 'Blowing',
14
-	    'SH' => 'Showers',
15
-	    'TS' => 'Thunderstorm',
16
-	    'FZ' => 'Freezing',
17
-	    'DZ' => 'Drizzle',
18
-	    'RA' => 'Rain',
19
-	    'SN' => 'Snow',
20
-	    'SG' => 'Snow Grains',
21
-	    'IC' => 'Ice crystals',
22
-	    'PL' => 'Ice pellets',
23
-	    'GR' => 'Hail',
24
-	    'GS' => 'Small hail',
25
-	    'UP' => 'Unknown',
26
-	    'BR' => 'Mist',
27
-	    'FG' => 'Fog',
28
-	    'FU' => 'Smoke',
29
-	    'VA' => 'Volcanic ash',
30
-	    'DU' => 'Widespread dust',
31
-	    'SA' => 'Sand',
32
-	    'HZ' => 'Haze',
33
-	    'PY' => 'Spray',
34
-	    'PO' => 'Well developed dust / sand whirls',
35
-	    'SQ' => 'Squalls',
36
-	    'FC' => 'Funnel clouds inc tornadoes or waterspouts',
37
-	    'SS' => 'Sandstorm',
38
-	    'DS' => 'Duststorm'
10
+		'MI' => 'Shallow',
11
+		'PR' => 'Partial',
12
+		'BC' => 'Low drifting',
13
+		'BL' => 'Blowing',
14
+		'SH' => 'Showers',
15
+		'TS' => 'Thunderstorm',
16
+		'FZ' => 'Freezing',
17
+		'DZ' => 'Drizzle',
18
+		'RA' => 'Rain',
19
+		'SN' => 'Snow',
20
+		'SG' => 'Snow Grains',
21
+		'IC' => 'Ice crystals',
22
+		'PL' => 'Ice pellets',
23
+		'GR' => 'Hail',
24
+		'GS' => 'Small hail',
25
+		'UP' => 'Unknown',
26
+		'BR' => 'Mist',
27
+		'FG' => 'Fog',
28
+		'FU' => 'Smoke',
29
+		'VA' => 'Volcanic ash',
30
+		'DU' => 'Widespread dust',
31
+		'SA' => 'Sand',
32
+		'HZ' => 'Haze',
33
+		'PY' => 'Spray',
34
+		'PO' => 'Well developed dust / sand whirls',
35
+		'SQ' => 'Squalls',
36
+		'FC' => 'Funnel clouds inc tornadoes or waterspouts',
37
+		'SS' => 'Sandstorm',
38
+		'DS' => 'Duststorm'
39 39
 	);
40 40
 	
41 41
 	public function __construct($dbc = null) {
42
-                $Connection = new Connection($dbc);
43
-                $this->db = $Connection->db;
44
-        }
42
+				$Connection = new Connection($dbc);
43
+				$this->db = $Connection->db;
44
+		}
45 45
 
46
-       public static function check_last_update() {
47
-    		global $globalDBdriver;
48
-    		if ($globalDBdriver == 'mysql') {
46
+	   public static function check_last_update() {
47
+			global $globalDBdriver;
48
+			if ($globalDBdriver == 'mysql') {
49 49
 			$query = "SELECT COUNT(*) as nb FROM config WHERE name = 'last_update_metar' AND value > DATE_SUB(NOW(), INTERVAL 20 MINUTE)";
50 50
 		} else {
51 51
 			$query = "SELECT COUNT(*) as nb FROM config WHERE name = 'last_update_metar' AND value::timestamp > CURRENT_TIMESTAMP - INTERVAL '20 MINUTES'";
52 52
 		}
53
-                try {
54
-                        $Connection = new Connection();
55
-                        $sth = $Connection->db->prepare($query);
56
-                        $sth->execute();
57
-                } catch(PDOException $e) {
58
-                        return "error : ".$e->getMessage();
59
-                }
60
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
61
-                $sth->closeCursor();
62
-                if ($row['nb'] > 0) return false;
63
-                else return true;
64
-        }
53
+				try {
54
+						$Connection = new Connection();
55
+						$sth = $Connection->db->prepare($query);
56
+						$sth->execute();
57
+				} catch(PDOException $e) {
58
+						return "error : ".$e->getMessage();
59
+				}
60
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
61
+				$sth->closeCursor();
62
+				if ($row['nb'] > 0) return false;
63
+				else return true;
64
+		}
65 65
 
66
-        public static function insert_last_update() {
67
-                $query = "DELETE FROM config WHERE name = 'last_update_metar';
66
+		public static function insert_last_update() {
67
+				$query = "DELETE FROM config WHERE name = 'last_update_metar';
68 68
                         INSERT INTO config (name,value) VALUES ('last_update_metar',NOW());";
69
-                try {
70
-                        $Connection = new Connection();
71
-                        $sth = $Connection->db->prepare($query);
72
-                        $sth->execute();
73
-                } catch(PDOException $e) {
74
-                        return "error : ".$e->getMessage();
75
-                }
76
-        }
69
+				try {
70
+						$Connection = new Connection();
71
+						$sth = $Connection->db->prepare($query);
72
+						$sth->execute();
73
+				} catch(PDOException $e) {
74
+						return "error : ".$e->getMessage();
75
+				}
76
+		}
77 77
 
78 78
 
79 79
         
80
-        public function parse($data) {
81
-    		//$data = str_replace(array('\n','\r','\r','\n'),'',$data);
82
-    		$codes = implode('|', array_keys($this->texts));
83
-    		$regWeather = '#^(\+|\-|VC)?(' . $codes . ')(' . $codes . ')?$#';
84
-    		//$pieces = explode(' ',$data);
85
-    		$pieces = preg_split('/\s/',$data);
86
-    		$pos = 0;
87
-    		if ($pieces[0] == 'METAR') $pos++;
88
-    		elseif ($pieces[0] == 'SPECI') $pos++;
89
-    		if (strlen($pieces[$pos]) != 4) $pos++;
90
-    		$result = array();
91
-    		$result['location'] = $pieces[$pos];
92
-    		$pos++;
93
-    		$result['dayofmonth'] = substr($pieces[$pos],0,2);
94
-    		$result['time'] = substr($pieces[$pos],2,4);
95
-    		$c = count($pieces);
96
-    		for($pos++; $pos < $c; $pos++) {
97
-    			$piece = $pieces[$pos];
98
-    			if ($piece == 'RMK') break;
99
-    			if ($piece == 'AUTO') $result['auto'] = true;
100
-    			if ($piece == 'COR') $result['correction'] = true;
101
-    			// Wind Speed
102
-    			if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) {
103
-    				$result['wind']['direction'] = (float)$matches[1];
80
+		public function parse($data) {
81
+			//$data = str_replace(array('\n','\r','\r','\n'),'',$data);
82
+			$codes = implode('|', array_keys($this->texts));
83
+			$regWeather = '#^(\+|\-|VC)?(' . $codes . ')(' . $codes . ')?$#';
84
+			//$pieces = explode(' ',$data);
85
+			$pieces = preg_split('/\s/',$data);
86
+			$pos = 0;
87
+			if ($pieces[0] == 'METAR') $pos++;
88
+			elseif ($pieces[0] == 'SPECI') $pos++;
89
+			if (strlen($pieces[$pos]) != 4) $pos++;
90
+			$result = array();
91
+			$result['location'] = $pieces[$pos];
92
+			$pos++;
93
+			$result['dayofmonth'] = substr($pieces[$pos],0,2);
94
+			$result['time'] = substr($pieces[$pos],2,4);
95
+			$c = count($pieces);
96
+			for($pos++; $pos < $c; $pos++) {
97
+				$piece = $pieces[$pos];
98
+				if ($piece == 'RMK') break;
99
+				if ($piece == 'AUTO') $result['auto'] = true;
100
+				if ($piece == 'COR') $result['correction'] = true;
101
+				// Wind Speed
102
+				if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) {
103
+					$result['wind']['direction'] = (float)$matches[1];
104 104
 				$result['wind']['unit'] = $matches[4];
105
-    				if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2);
106
-    				elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2);
107
-    				elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2);
105
+					if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2);
106
+					elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2);
107
+					elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2);
108 108
 				$result['wind']['gust'] = (float)$matches[3];
109 109
 				$result['wind']['unit'] = $matches[4];
110 110
 				$result['wind']['min_variation'] = array_key_exists(5,$matches) ? $matches[5] : 0;
111 111
 				$result['wind']['max_variation'] = array_key_exists(6,$matches) ? $matches[6] : 0;
112
-    			}
112
+				}
113 113
 
114 114
 /*    			if (preg_match('#^([0-9]{3})([0-9]{2})(G([0-9]{2}))?(KT|MPS)$#', $piece, $matches)) {
115 115
     				$result['wind_direction'] = (float)$matches[1];
@@ -126,35 +126,35 @@  discard block
 block discarded – undo
126 126
     				}
127 127
     			}
128 128
     			*/
129
-    			// Temperature
130
-    			if (preg_match('#^(M?[0-9]{2,})/(M?[0-9]{2,})$#', $piece, $matches)) {
131
-    				$temp = (float)$matches[1];
129
+				// Temperature
130
+				if (preg_match('#^(M?[0-9]{2,})/(M?[0-9]{2,})$#', $piece, $matches)) {
131
+					$temp = (float)$matches[1];
132 132
 				if ($matches[1]{0} == 'M') {
133 133
 					$temp = ((float)substr($matches[1], 1)) * -1;
134 134
 				}
135
-    				$result['temperature'] = $temp;
136
-    				$dew = (float)$matches[2];
135
+					$result['temperature'] = $temp;
136
+					$dew = (float)$matches[2];
137 137
 				if ($matches[2]{0} == 'M') {
138 138
 					$dew = ((float)substr($matches[2], 1)) * -1;
139 139
 				}
140 140
 				$result['dew'] = $dew;
141
-    			}
142
-    			// QNH
143
-    			if (preg_match('#^(A|Q)([0-9]{4})$#', $piece, $matches)) {
144
-    			// #^(Q|A)(////|[0-9]{4})( )#
145
-    				if ($matches[1] == 'Q') {
146
-    					// hPa
147
-    					$result['QNH'] = $matches[2];
148
-    				} else {
149
-    					// inHg
150
-    					$result['QNH'] = round(($matches[2] / 100)*33.86389,2);
151 141
 				}
152
-    				/*
142
+				// QNH
143
+				if (preg_match('#^(A|Q)([0-9]{4})$#', $piece, $matches)) {
144
+				// #^(Q|A)(////|[0-9]{4})( )#
145
+					if ($matches[1] == 'Q') {
146
+						// hPa
147
+						$result['QNH'] = $matches[2];
148
+					} else {
149
+						// inHg
150
+						$result['QNH'] = round(($matches[2] / 100)*33.86389,2);
151
+				}
152
+					/*
153 153
     				$result['QNH'] = $matches[1] == 'Q' ? $matches[2] : ($matches[2] / 100);
154 154
     				$result['QNH_format'] = $matches[1] == 'Q' ? 'hPa' : 'inHg';
155 155
     				*/
156
-    			}
157
-                     /*
156
+				}
157
+					 /*
158 158
     			// Wind Direction
159 159
     			if (preg_match('#^([0-9]{3})V([0-9]{3})$#', $piece, $matches)) {
160 160
     				$result['wind_direction'] = $matches[1];
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
     				$result['speed_variable'] = $matches[1];
166 166
     			}
167 167
     			*/
168
-    			// Visibility
169
-    			if (preg_match('#^([0-9]{4})|(([0-9]{1,4})SM)$#', $piece, $matches)) {
170
-    				if (isset($matches[3]) && strlen($matches[3]) > 0) {
168
+				// Visibility
169
+				if (preg_match('#^([0-9]{4})|(([0-9]{1,4})SM)$#', $piece, $matches)) {
170
+					if (isset($matches[3]) && strlen($matches[3]) > 0) {
171 171
 					$result['visibility'] = (float)$matches[3] * 1609.34;
172 172
 				} else {
173 173
 					if ($matches[1] == '9999') {
@@ -180,28 +180,28 @@  discard block
 block discarded – undo
180 180
 					$result['visibility'] = '> 10000';
181 181
 					$result['weather'] = "CAVOK";
182 182
 				}
183
-    			}
184
-    			// Cloud Coverage
185
-    			if (preg_match('#^(SKC|CLR|FEW|SCT|BKN|OVC|VV)([0-9]{3})(CB|TCU|CU|CI)?$#', $piece, $matches)) {
186
-    				//$this->addCloudCover($matches[1], ((float)$matches[2]) * 100, isset($matches[3]) ? $matches[3] : '');
187
-    				$type = $matches[1];
188
-    				$cloud = array();
189
-    				if ($type == 'SKC') $cloud['type'] = 'No cloud/Sky clear';
190
-    				elseif ($type == 'CLR') $cloud['type'] = 'No cloud below 12,000ft (3700m)';
191
-    				elseif ($type == 'NSC') $cloud['type'] = 'No significant cloud';
192
-    				elseif ($type == 'FEW') $cloud['type'] = 'Few';
193
-    				elseif ($type == 'SCT') $cloud['type'] = 'Scattered';
194
-    				elseif ($type == 'BKN') $cloud['type'] = 'Broken';
195
-    				elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage';
196
-    				elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility';
197
-    				$cloud['type_code'] = $type;
198
-    				$cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048);
199
-    				$cloud['significant'] = isset($matches[3]) ? $matches[3] : '';
200
-    				$result['cloud'][] = $cloud;
201
-    			}
202
-    			// RVR
203
-    			 if (preg_match('#^(R.+)/([M|P])?(\d{4})(?:V(\d+)|[UDN])?(FT)?$#', $piece, $matches)) {
204
-    				$rvr = array();
183
+				}
184
+				// Cloud Coverage
185
+				if (preg_match('#^(SKC|CLR|FEW|SCT|BKN|OVC|VV)([0-9]{3})(CB|TCU|CU|CI)?$#', $piece, $matches)) {
186
+					//$this->addCloudCover($matches[1], ((float)$matches[2]) * 100, isset($matches[3]) ? $matches[3] : '');
187
+					$type = $matches[1];
188
+					$cloud = array();
189
+					if ($type == 'SKC') $cloud['type'] = 'No cloud/Sky clear';
190
+					elseif ($type == 'CLR') $cloud['type'] = 'No cloud below 12,000ft (3700m)';
191
+					elseif ($type == 'NSC') $cloud['type'] = 'No significant cloud';
192
+					elseif ($type == 'FEW') $cloud['type'] = 'Few';
193
+					elseif ($type == 'SCT') $cloud['type'] = 'Scattered';
194
+					elseif ($type == 'BKN') $cloud['type'] = 'Broken';
195
+					elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage';
196
+					elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility';
197
+					$cloud['type_code'] = $type;
198
+					$cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048);
199
+					$cloud['significant'] = isset($matches[3]) ? $matches[3] : '';
200
+					$result['cloud'][] = $cloud;
201
+				}
202
+				// RVR
203
+				 if (preg_match('#^(R.+)/([M|P])?(\d{4})(?:V(\d+)|[UDN])?(FT)?$#', $piece, $matches)) {
204
+					$rvr = array();
205 205
 				$rvr['runway'] = $matches[1];
206 206
 				$rvr['assessment'] = $matches[2];
207 207
 				$rvr['rvr'] = $matches[3];
@@ -210,33 +210,33 @@  discard block
 block discarded – undo
210 210
 				$result['RVR'] = $rvr;
211 211
 			}
212 212
     			
213
-    			//if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) {
214
-    			if (preg_match('#^R(\d{2}[LRC]?)/([\d/])([\d/])([\d/]{2})([\d/]{2})$#', $piece, $matches)) {
215
-    				//print_r($matches);
216
-    				// https://github.com/davidmegginson/metar-taf/blob/master/Metar.php
217
-    				$result['RVR']['runway'] = $matches[1];
218
-        			$result['RVR']['deposits'] = $matches[2];
219
-        			$result['RVR']['extent'] = $matches[3];
220
-        			$result['RVR']['depth'] = $matches[4];
221
-        			$result['RVR']['friction'] = $matches[5];
222
-    			}
223
-    			if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) {
224
-    				//echo $piece;
225
-    				//print_r($matches);
226
-    				if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M');
227
-    				else $range = array('exact' => (float)$matches[2], 'unit' => 'M');
213
+				//if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) {
214
+				if (preg_match('#^R(\d{2}[LRC]?)/([\d/])([\d/])([\d/]{2})([\d/]{2})$#', $piece, $matches)) {
215
+					//print_r($matches);
216
+					// https://github.com/davidmegginson/metar-taf/blob/master/Metar.php
217
+					$result['RVR']['runway'] = $matches[1];
218
+					$result['RVR']['deposits'] = $matches[2];
219
+					$result['RVR']['extent'] = $matches[3];
220
+					$result['RVR']['depth'] = $matches[4];
221
+					$result['RVR']['friction'] = $matches[5];
222
+				}
223
+				if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) {
224
+					//echo $piece;
225
+					//print_r($matches);
226
+					if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M');
227
+					else $range = array('exact' => (float)$matches[2], 'unit' => 'M');
228 228
 				if (isset($matches[3])) {
229 229
 					$range = Array(
230
-					    'from' => (float)$matches[2],
231
-					    'to'   => (float)$matches[4],
232
-					    'unit' => $matches[5] ? 'FT' : 'M'
230
+						'from' => (float)$matches[2],
231
+						'to'   => (float)$matches[4],
232
+						'unit' => $matches[5] ? 'FT' : 'M'
233 233
 					);
234 234
 				}
235 235
 				$result['RVR'] = $matches[1];
236 236
 				$result['RVR_range'] = $range;
237
-    			}
238
-    			// Weather
239
-    			if (preg_match($regWeather, $piece, $matches)) {
237
+				}
238
+				// Weather
239
+				if (preg_match($regWeather, $piece, $matches)) {
240 240
 				$text = Array();
241 241
 				switch ($matches[1]) {
242 242
 					case '+':
@@ -259,35 +259,35 @@  discard block
 block discarded – undo
259 259
 				}
260 260
 				if (!isset($result['weather'])) $result['weather'] = implode(' ', $text);
261 261
 				else $result['weather'] = $result['weather'].' / '.implode(' ', $text);
262
-    			}
263
-    		}
264
-    		return $result;
262
+				}
263
+			}
264
+			return $result;
265 265
         
266
-        }
266
+		}
267 267
         
268 268
 	public function getMETAR($icao) {
269
-    		global $globalMETARcycle, $globalDBdriver;
270
-    		if (isset($globalMETARcycle) && $globalMETARcycle) {
271
-            		$query = "SELECT * FROM metar WHERE metar_location = :icao";
272
-                } else {
273
-            		if ($globalDBdriver == 'mysql') $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1";
274
-            		else $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1";
275
-                }
276
-                $query_values = array(':icao' => $icao);
277
-                 try {
278
-                        $sth = $this->db->prepare($query);
279
-                        $sth->execute($query_values);
280
-                } catch(PDOException $e) {
281
-                        return "error : ".$e->getMessage();
282
-                }
283
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
284
-                if ((!isset($globalMETARcycle) || $globalMETARcycle === false) && count($all) == 0) {
285
-            		$all = $this->downloadMETAR($icao);
286
-                }
287
-                return $all;
288
-        }
269
+			global $globalMETARcycle, $globalDBdriver;
270
+			if (isset($globalMETARcycle) && $globalMETARcycle) {
271
+					$query = "SELECT * FROM metar WHERE metar_location = :icao";
272
+				} else {
273
+					if ($globalDBdriver == 'mysql') $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1";
274
+					else $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1";
275
+				}
276
+				$query_values = array(':icao' => $icao);
277
+				 try {
278
+						$sth = $this->db->prepare($query);
279
+						$sth->execute($query_values);
280
+				} catch(PDOException $e) {
281
+						return "error : ".$e->getMessage();
282
+				}
283
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
284
+				if ((!isset($globalMETARcycle) || $globalMETARcycle === false) && count($all) == 0) {
285
+					$all = $this->downloadMETAR($icao);
286
+				}
287
+				return $all;
288
+		}
289 289
 
290
-       public function addMETAR($location,$metar,$date) {
290
+	   public function addMETAR($location,$metar,$date) {
291 291
 		global $globalDBdriver;
292 292
 		$date = date('Y-m-d H:i:s',strtotime($date));
293 293
 		if ($globalDBdriver == 'mysql') {
@@ -295,106 +295,106 @@  discard block
 block discarded – undo
295 295
 		} else {
296 296
 			$query = "UPDATE metar SET metar_date = :date, metar = metar WHERE metar_location = :location;INSERT INTO metar (metar_location,metar_date,metar) SELECT :location,:date,:metar WHERE NOT EXISTS (SELECT 1 FROM metar WHERE metar_location = :location);";
297 297
 		}
298
-                $query_values = array(':location' => $location,':date' => $date,':metar' => utf8_encode($metar));
299
-                 try {
300
-                        $sth = $this->db->prepare($query);
301
-                        $sth->execute($query_values);
302
-                } catch(PDOException $e) {
303
-                        return "error : ".$e->getMessage();
304
-                }
305
-        }
298
+				$query_values = array(':location' => $location,':date' => $date,':metar' => utf8_encode($metar));
299
+				 try {
300
+						$sth = $this->db->prepare($query);
301
+						$sth->execute($query_values);
302
+				} catch(PDOException $e) {
303
+						return "error : ".$e->getMessage();
304
+				}
305
+		}
306 306
 
307
-       public function deleteMETAR($id) {
308
-                $query = "DELETE FROM metar WHERE id = :id";
309
-                $query_values = array(':id' => $id);
310
-                 try {
311
-                        $sth = $this->db->prepare($query);
312
-                        $sth->execute($query_values);
313
-                } catch(PDOException $e) {
314
-                        return "error : ".$e->getMessage();
315
-                }
316
-        }
317
-       public function deleteAllMETARLocation() {
318
-                $query = "DELETE FROM metar";
319
-                 try {
320
-                        $sth = $this->db->prepare($query);
321
-                        $sth->execute();
322
-                } catch(PDOException $e) {
323
-                        return "error : ".$e->getMessage();
324
-                }
325
-        }
307
+	   public function deleteMETAR($id) {
308
+				$query = "DELETE FROM metar WHERE id = :id";
309
+				$query_values = array(':id' => $id);
310
+				 try {
311
+						$sth = $this->db->prepare($query);
312
+						$sth->execute($query_values);
313
+				} catch(PDOException $e) {
314
+						return "error : ".$e->getMessage();
315
+				}
316
+		}
317
+	   public function deleteAllMETARLocation() {
318
+				$query = "DELETE FROM metar";
319
+				 try {
320
+						$sth = $this->db->prepare($query);
321
+						$sth->execute();
322
+				} catch(PDOException $e) {
323
+						return "error : ".$e->getMessage();
324
+				}
325
+		}
326 326
         
327
-        public function addMETARCycle() {
328
-    		global $globalDebug, $globalIVAO, $globalTransaction;
329
-    		if (isset($globalDebug) && $globalDebug) echo "Downloading METAR cycle...";
330
-    		date_default_timezone_set("UTC");
331
-    		$Common = new Common();
332
-    		if (isset($globalIVAO) && $globalIVAO) {
333
-        		//$cycle = $Common->getData('http://wx.ivao.aero/metar.php');
327
+		public function addMETARCycle() {
328
+			global $globalDebug, $globalIVAO, $globalTransaction;
329
+			if (isset($globalDebug) && $globalDebug) echo "Downloading METAR cycle...";
330
+			date_default_timezone_set("UTC");
331
+			$Common = new Common();
332
+			if (isset($globalIVAO) && $globalIVAO) {
333
+				//$cycle = $Common->getData('http://wx.ivao.aero/metar.php');
334 334
 			$Common->download('http://wx.ivao.aero/metar.php',dirname(__FILE__).'/../install/tmp/ivaometar.txt');
335
-    			$handle = fopen(dirname(__FILE__).'/../install/tmp/ivaometar.txt',"r");
336
-    		} else {
335
+				$handle = fopen(dirname(__FILE__).'/../install/tmp/ivaometar.txt',"r");
336
+			} else {
337 337
 			//$cycle = $Common->getData('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT');
338 338
 			$Common->download('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT',dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT');
339
-    			$handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r");
340
-    		}
341
-    		if ($handle) {
339
+				$handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r");
340
+			}
341
+			if ($handle) {
342 342
 			if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB...";
343 343
 			$date = '';
344
-    			//foreach(explode("\n",$cycle) as $line) {
345
-    			if ($globalTransaction) $this->db->beginTransaction();
346
-	    		while(($line = fgets($handle,4096)) !== false) {
344
+				//foreach(explode("\n",$cycle) as $line) {
345
+				if ($globalTransaction) $this->db->beginTransaction();
346
+				while(($line = fgets($handle,4096)) !== false) {
347 347
 				if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) {
348 348
 					$date = $line;
349
-    				} elseif ($line != '') {
350
-    				    //$this->parse($line);
351
-    				    if ($date == '') $date = date('Y/m/d H:m');
352
-        			    $pos = 0;
353
-        			    $pieces = preg_split('/\s/',$line);
354
-        			    if ($pieces[0] == 'METAR') $pos++;
355
-        			    if (strlen($pieces[$pos]) != 4) $pos++;
356
-		        	    $location = $pieces[$pos];
357
-        	        	    echo $this->addMETAR($location,$line,$date);
358
-    				}
359
-    			}
360
-    			fclose($handle);
361
-    			if ($globalTransaction) $this->db->commit();
362
-    		}
363
-    		if (isset($globalDebug) && $globalDebug) echo "Done\n";
349
+					} elseif ($line != '') {
350
+						//$this->parse($line);
351
+						if ($date == '') $date = date('Y/m/d H:m');
352
+						$pos = 0;
353
+						$pieces = preg_split('/\s/',$line);
354
+						if ($pieces[0] == 'METAR') $pos++;
355
+						if (strlen($pieces[$pos]) != 4) $pos++;
356
+						$location = $pieces[$pos];
357
+							echo $this->addMETAR($location,$line,$date);
358
+					}
359
+				}
360
+				fclose($handle);
361
+				if ($globalTransaction) $this->db->commit();
362
+			}
363
+			if (isset($globalDebug) && $globalDebug) echo "Done\n";
364 364
         
365
-        }
366
-        public function downloadMETAR($icao) {
367
-    		global $globalMETARurl;
368
-    		if ($globalMETARurl == '') return array();
369
-    		date_default_timezone_set("UTC");
370
-    		$Common = new Common();
371
-    		$url = str_replace('{icao}',$icao,$globalMETARurl);
372
-    		$cycle = $Common->getData($url);
373
-    		$date = '';
374
-    		foreach(explode("\n",$cycle) as $line) {
375
-    			if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) {
376
-    				//echo "date : ".$line."\n";
377
-    				$date = $line;
378
-    			} 
379
-    			if ($line != '') {
380
-    			    //$this->parse($line);
381
-    			    //echo $line;
382
-    			    if ($date == '') $date = date('Y/m/d H:m');
383
-    			    $pos = 0;
384
-    			    $pieces = preg_split('/\s/',$line);
385
-    			    if ($pieces[0] == 'METAR') $pos++;
386
-    			    if (strlen($pieces[$pos]) != 4) $pos++;
387
-	        	    $location = $pieces[$pos];
388
-	        	    if (strlen($location == 4)) {
389
-	        		$this->addMETAR($location,$line,$date);
390
-	        		return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line));
391
-	        	    } else return array();
392
-    			}
393
-    			//echo $line."\n";
394
-    		}
395
-    		return array();
365
+		}
366
+		public function downloadMETAR($icao) {
367
+			global $globalMETARurl;
368
+			if ($globalMETARurl == '') return array();
369
+			date_default_timezone_set("UTC");
370
+			$Common = new Common();
371
+			$url = str_replace('{icao}',$icao,$globalMETARurl);
372
+			$cycle = $Common->getData($url);
373
+			$date = '';
374
+			foreach(explode("\n",$cycle) as $line) {
375
+				if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) {
376
+					//echo "date : ".$line."\n";
377
+					$date = $line;
378
+				} 
379
+				if ($line != '') {
380
+					//$this->parse($line);
381
+					//echo $line;
382
+					if ($date == '') $date = date('Y/m/d H:m');
383
+					$pos = 0;
384
+					$pieces = preg_split('/\s/',$line);
385
+					if ($pieces[0] == 'METAR') $pos++;
386
+					if (strlen($pieces[$pos]) != 4) $pos++;
387
+					$location = $pieces[$pos];
388
+					if (strlen($location == 4)) {
389
+					$this->addMETAR($location,$line,$date);
390
+					return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line));
391
+					} else return array();
392
+				}
393
+				//echo $line."\n";
394
+			}
395
+			return array();
396 396
         
397
-        }
397
+		}
398 398
 }
399 399
 /*
400 400
 $METAR = new METAR();
Please login to merge, or discard this patch.
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
                         $Connection = new Connection();
55 55
                         $sth = $Connection->db->prepare($query);
56 56
                         $sth->execute();
57
-                } catch(PDOException $e) {
57
+                } catch (PDOException $e) {
58 58
                         return "error : ".$e->getMessage();
59 59
                 }
60 60
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
                         $Connection = new Connection();
71 71
                         $sth = $Connection->db->prepare($query);
72 72
                         $sth->execute();
73
-                } catch(PDOException $e) {
73
+                } catch (PDOException $e) {
74 74
                         return "error : ".$e->getMessage();
75 75
                 }
76 76
         }
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
         public function parse($data) {
81 81
     		//$data = str_replace(array('\n','\r','\r','\n'),'',$data);
82 82
     		$codes = implode('|', array_keys($this->texts));
83
-    		$regWeather = '#^(\+|\-|VC)?(' . $codes . ')(' . $codes . ')?$#';
83
+    		$regWeather = '#^(\+|\-|VC)?('.$codes.')('.$codes.')?$#';
84 84
     		//$pieces = explode(' ',$data);
85
-    		$pieces = preg_split('/\s/',$data);
85
+    		$pieces = preg_split('/\s/', $data);
86 86
     		$pos = 0;
87 87
     		if ($pieces[0] == 'METAR') $pos++;
88 88
     		elseif ($pieces[0] == 'SPECI') $pos++;
@@ -90,25 +90,25 @@  discard block
 block discarded – undo
90 90
     		$result = array();
91 91
     		$result['location'] = $pieces[$pos];
92 92
     		$pos++;
93
-    		$result['dayofmonth'] = substr($pieces[$pos],0,2);
94
-    		$result['time'] = substr($pieces[$pos],2,4);
93
+    		$result['dayofmonth'] = substr($pieces[$pos], 0, 2);
94
+    		$result['time'] = substr($pieces[$pos], 2, 4);
95 95
     		$c = count($pieces);
96
-    		for($pos++; $pos < $c; $pos++) {
96
+    		for ($pos++; $pos < $c; $pos++) {
97 97
     			$piece = $pieces[$pos];
98 98
     			if ($piece == 'RMK') break;
99 99
     			if ($piece == 'AUTO') $result['auto'] = true;
100 100
     			if ($piece == 'COR') $result['correction'] = true;
101 101
     			// Wind Speed
102 102
     			if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) {
103
-    				$result['wind']['direction'] = (float)$matches[1];
103
+    				$result['wind']['direction'] = (float) $matches[1];
104 104
 				$result['wind']['unit'] = $matches[4];
105
-    				if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2);
106
-    				elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2);
107
-    				elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2);
108
-				$result['wind']['gust'] = (float)$matches[3];
105
+    				if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float) $matches[2])*0.51444444444, 2);
106
+    				elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float) $matches[2])*1000, 2);
107
+    				elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float) $matches[2]), 2);
108
+				$result['wind']['gust'] = (float) $matches[3];
109 109
 				$result['wind']['unit'] = $matches[4];
110
-				$result['wind']['min_variation'] = array_key_exists(5,$matches) ? $matches[5] : 0;
111
-				$result['wind']['max_variation'] = array_key_exists(6,$matches) ? $matches[6] : 0;
110
+				$result['wind']['min_variation'] = array_key_exists(5, $matches) ? $matches[5] : 0;
111
+				$result['wind']['max_variation'] = array_key_exists(6, $matches) ? $matches[6] : 0;
112 112
     			}
113 113
 
114 114
 /*    			if (preg_match('#^([0-9]{3})([0-9]{2})(G([0-9]{2}))?(KT|MPS)$#', $piece, $matches)) {
@@ -128,14 +128,14 @@  discard block
 block discarded – undo
128 128
     			*/
129 129
     			// Temperature
130 130
     			if (preg_match('#^(M?[0-9]{2,})/(M?[0-9]{2,})$#', $piece, $matches)) {
131
-    				$temp = (float)$matches[1];
131
+    				$temp = (float) $matches[1];
132 132
 				if ($matches[1]{0} == 'M') {
133
-					$temp = ((float)substr($matches[1], 1)) * -1;
133
+					$temp = ((float) substr($matches[1], 1))*-1;
134 134
 				}
135 135
     				$result['temperature'] = $temp;
136
-    				$dew = (float)$matches[2];
136
+    				$dew = (float) $matches[2];
137 137
 				if ($matches[2]{0} == 'M') {
138
-					$dew = ((float)substr($matches[2], 1)) * -1;
138
+					$dew = ((float) substr($matches[2], 1))*-1;
139 139
 				}
140 140
 				$result['dew'] = $dew;
141 141
     			}
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     					$result['QNH'] = $matches[2];
148 148
     				} else {
149 149
     					// inHg
150
-    					$result['QNH'] = round(($matches[2] / 100)*33.86389,2);
150
+    					$result['QNH'] = round(($matches[2]/100)*33.86389, 2);
151 151
 				}
152 152
     				/*
153 153
     				$result['QNH'] = $matches[1] == 'Q' ? $matches[2] : ($matches[2] / 100);
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
     			// Visibility
169 169
     			if (preg_match('#^([0-9]{4})|(([0-9]{1,4})SM)$#', $piece, $matches)) {
170 170
     				if (isset($matches[3]) && strlen($matches[3]) > 0) {
171
-					$result['visibility'] = (float)$matches[3] * 1609.34;
171
+					$result['visibility'] = (float) $matches[3]*1609.34;
172 172
 				} else {
173 173
 					if ($matches[1] == '9999') {
174 174
 						$result['visibility'] = '> 10000';
175 175
 					} else {
176
-						$result['visibility'] = (float)$matches[1];
176
+						$result['visibility'] = (float) $matches[1];
177 177
 					}
178 178
 				}
179 179
 				if (preg_match('#^CAVOK$#', $piece, $matches)) {
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
     				elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage';
196 196
     				elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility';
197 197
     				$cloud['type_code'] = $type;
198
-    				$cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048);
198
+    				$cloud['level'] = round(((float) $matches[2])*100*0.3048);
199 199
     				$cloud['significant'] = isset($matches[3]) ? $matches[3] : '';
200 200
     				$result['cloud'][] = $cloud;
201 201
     			}
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
 				$rvr['runway'] = $matches[1];
206 206
 				$rvr['assessment'] = $matches[2];
207 207
 				$rvr['rvr'] = $matches[3];
208
-				$rvr['rvr_max'] = array_key_exists(4,$matches) ? $matches[4] : 0;
209
-				$rvr['unit'] = array_key_exists(5,$matches) ? $matches[5] : '';
208
+				$rvr['rvr_max'] = array_key_exists(4, $matches) ? $matches[4] : 0;
209
+				$rvr['unit'] = array_key_exists(5, $matches) ? $matches[5] : '';
210 210
 				$result['RVR'] = $rvr;
211 211
 			}
212 212
     			
@@ -223,12 +223,12 @@  discard block
 block discarded – undo
223 223
     			if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) {
224 224
     				//echo $piece;
225 225
     				//print_r($matches);
226
-    				if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M');
227
-    				else $range = array('exact' => (float)$matches[2], 'unit' => 'M');
226
+    				if (isset($matches[5])) $range = array('exact' => (float) $matches[2], 'unit' => $matches[5] ? 'FT' : 'M');
227
+    				else $range = array('exact' => (float) $matches[2], 'unit' => 'M');
228 228
 				if (isset($matches[3])) {
229 229
 					$range = Array(
230
-					    'from' => (float)$matches[2],
231
-					    'to'   => (float)$matches[4],
230
+					    'from' => (float) $matches[2],
231
+					    'to'   => (float) $matches[4],
232 232
 					    'unit' => $matches[5] ? 'FT' : 'M'
233 233
 					);
234 234
 				}
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
                  try {
278 278
                         $sth = $this->db->prepare($query);
279 279
                         $sth->execute($query_values);
280
-                } catch(PDOException $e) {
280
+                } catch (PDOException $e) {
281 281
                         return "error : ".$e->getMessage();
282 282
                 }
283 283
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -287,19 +287,19 @@  discard block
 block discarded – undo
287 287
                 return $all;
288 288
         }
289 289
 
290
-       public function addMETAR($location,$metar,$date) {
290
+       public function addMETAR($location, $metar, $date) {
291 291
 		global $globalDBdriver;
292
-		$date = date('Y-m-d H:i:s',strtotime($date));
292
+		$date = date('Y-m-d H:i:s', strtotime($date));
293 293
 		if ($globalDBdriver == 'mysql') {
294 294
 			$query = "INSERT INTO metar (metar_location,metar_date,metar) VALUES (:location,:date,:metar) ON DUPLICATE KEY UPDATE metar_date = :date, metar = :metar";
295 295
 		} else {
296 296
 			$query = "UPDATE metar SET metar_date = :date, metar = metar WHERE metar_location = :location;INSERT INTO metar (metar_location,metar_date,metar) SELECT :location,:date,:metar WHERE NOT EXISTS (SELECT 1 FROM metar WHERE metar_location = :location);";
297 297
 		}
298
-                $query_values = array(':location' => $location,':date' => $date,':metar' => utf8_encode($metar));
298
+                $query_values = array(':location' => $location, ':date' => $date, ':metar' => utf8_encode($metar));
299 299
                  try {
300 300
                         $sth = $this->db->prepare($query);
301 301
                         $sth->execute($query_values);
302
-                } catch(PDOException $e) {
302
+                } catch (PDOException $e) {
303 303
                         return "error : ".$e->getMessage();
304 304
                 }
305 305
         }
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
                  try {
311 311
                         $sth = $this->db->prepare($query);
312 312
                         $sth->execute($query_values);
313
-                } catch(PDOException $e) {
313
+                } catch (PDOException $e) {
314 314
                         return "error : ".$e->getMessage();
315 315
                 }
316 316
         }
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
                  try {
320 320
                         $sth = $this->db->prepare($query);
321 321
                         $sth->execute();
322
-                } catch(PDOException $e) {
322
+                } catch (PDOException $e) {
323 323
                         return "error : ".$e->getMessage();
324 324
                 }
325 325
         }
@@ -331,30 +331,30 @@  discard block
 block discarded – undo
331 331
     		$Common = new Common();
332 332
     		if (isset($globalIVAO) && $globalIVAO) {
333 333
         		//$cycle = $Common->getData('http://wx.ivao.aero/metar.php');
334
-			$Common->download('http://wx.ivao.aero/metar.php',dirname(__FILE__).'/../install/tmp/ivaometar.txt');
335
-    			$handle = fopen(dirname(__FILE__).'/../install/tmp/ivaometar.txt',"r");
334
+			$Common->download('http://wx.ivao.aero/metar.php', dirname(__FILE__).'/../install/tmp/ivaometar.txt');
335
+    			$handle = fopen(dirname(__FILE__).'/../install/tmp/ivaometar.txt', "r");
336 336
     		} else {
337 337
 			//$cycle = $Common->getData('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT');
338
-			$Common->download('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT',dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT');
339
-    			$handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r");
338
+			$Common->download('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT', dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT');
339
+    			$handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT', "r");
340 340
     		}
341 341
     		if ($handle) {
342 342
 			if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB...";
343 343
 			$date = '';
344 344
     			//foreach(explode("\n",$cycle) as $line) {
345 345
     			if ($globalTransaction) $this->db->beginTransaction();
346
-	    		while(($line = fgets($handle,4096)) !== false) {
347
-				if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) {
346
+	    		while (($line = fgets($handle, 4096)) !== false) {
347
+				if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#', $line)) {
348 348
 					$date = $line;
349 349
     				} elseif ($line != '') {
350 350
     				    //$this->parse($line);
351 351
     				    if ($date == '') $date = date('Y/m/d H:m');
352 352
         			    $pos = 0;
353
-        			    $pieces = preg_split('/\s/',$line);
353
+        			    $pieces = preg_split('/\s/', $line);
354 354
         			    if ($pieces[0] == 'METAR') $pos++;
355 355
         			    if (strlen($pieces[$pos]) != 4) $pos++;
356 356
 		        	    $location = $pieces[$pos];
357
-        	        	    echo $this->addMETAR($location,$line,$date);
357
+        	        	    echo $this->addMETAR($location, $line, $date);
358 358
     				}
359 359
     			}
360 360
     			fclose($handle);
@@ -368,11 +368,11 @@  discard block
 block discarded – undo
368 368
     		if ($globalMETARurl == '') return array();
369 369
     		date_default_timezone_set("UTC");
370 370
     		$Common = new Common();
371
-    		$url = str_replace('{icao}',$icao,$globalMETARurl);
371
+    		$url = str_replace('{icao}', $icao, $globalMETARurl);
372 372
     		$cycle = $Common->getData($url);
373 373
     		$date = '';
374
-    		foreach(explode("\n",$cycle) as $line) {
375
-    			if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) {
374
+    		foreach (explode("\n", $cycle) as $line) {
375
+    			if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#', $line)) {
376 376
     				//echo "date : ".$line."\n";
377 377
     				$date = $line;
378 378
     			} 
@@ -381,12 +381,12 @@  discard block
 block discarded – undo
381 381
     			    //echo $line;
382 382
     			    if ($date == '') $date = date('Y/m/d H:m');
383 383
     			    $pos = 0;
384
-    			    $pieces = preg_split('/\s/',$line);
384
+    			    $pieces = preg_split('/\s/', $line);
385 385
     			    if ($pieces[0] == 'METAR') $pos++;
386 386
     			    if (strlen($pieces[$pos]) != 4) $pos++;
387 387
 	        	    $location = $pieces[$pos];
388 388
 	        	    if (strlen($location == 4)) {
389
-	        		$this->addMETAR($location,$line,$date);
389
+	        		$this->addMETAR($location, $line, $date);
390 390
 	        		return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line));
391 391
 	        	    } else return array();
392 392
     			}
Please login to merge, or discard this patch.
Braces   +100 added lines, -38 removed lines patch added patch discarded remove patch
@@ -59,8 +59,11 @@  discard block
 block discarded – undo
59 59
                 }
60 60
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
61 61
                 $sth->closeCursor();
62
-                if ($row['nb'] > 0) return false;
63
-                else return true;
62
+                if ($row['nb'] > 0) {
63
+                	return false;
64
+                } else {
65
+                	return true;
66
+                }
64 67
         }
65 68
 
66 69
         public static function insert_last_update() {
@@ -84,9 +87,14 @@  discard block
 block discarded – undo
84 87
     		//$pieces = explode(' ',$data);
85 88
     		$pieces = preg_split('/\s/',$data);
86 89
     		$pos = 0;
87
-    		if ($pieces[0] == 'METAR') $pos++;
88
-    		elseif ($pieces[0] == 'SPECI') $pos++;
89
-    		if (strlen($pieces[$pos]) != 4) $pos++;
90
+    		if ($pieces[0] == 'METAR') {
91
+    			$pos++;
92
+    		} elseif ($pieces[0] == 'SPECI') {
93
+    			$pos++;
94
+    		}
95
+    		if (strlen($pieces[$pos]) != 4) {
96
+    			$pos++;
97
+    		}
90 98
     		$result = array();
91 99
     		$result['location'] = $pieces[$pos];
92 100
     		$pos++;
@@ -95,16 +103,26 @@  discard block
 block discarded – undo
95 103
     		$c = count($pieces);
96 104
     		for($pos++; $pos < $c; $pos++) {
97 105
     			$piece = $pieces[$pos];
98
-    			if ($piece == 'RMK') break;
99
-    			if ($piece == 'AUTO') $result['auto'] = true;
100
-    			if ($piece == 'COR') $result['correction'] = true;
106
+    			if ($piece == 'RMK') {
107
+    				break;
108
+    			}
109
+    			if ($piece == 'AUTO') {
110
+    				$result['auto'] = true;
111
+    			}
112
+    			if ($piece == 'COR') {
113
+    				$result['correction'] = true;
114
+    			}
101 115
     			// Wind Speed
102 116
     			if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) {
103 117
     				$result['wind']['direction'] = (float)$matches[1];
104 118
 				$result['wind']['unit'] = $matches[4];
105
-    				if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2);
106
-    				elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2);
107
-    				elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2);
119
+    				if ($result['wind']['unit'] == 'KT') {
120
+    					$result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2);
121
+    				} elseif ($result['wind']['unit'] == 'KPH') {
122
+    					$result['wind']['speed'] = round(((float)$matches[2])*1000,2);
123
+    				} elseif ($result['wind']['unit'] == 'MPS') {
124
+    					$result['wind']['speed'] = round(((float)$matches[2]),2);
125
+    				}
108 126
 				$result['wind']['gust'] = (float)$matches[3];
109 127
 				$result['wind']['unit'] = $matches[4];
110 128
 				$result['wind']['min_variation'] = array_key_exists(5,$matches) ? $matches[5] : 0;
@@ -186,14 +204,23 @@  discard block
 block discarded – undo
186 204
     				//$this->addCloudCover($matches[1], ((float)$matches[2]) * 100, isset($matches[3]) ? $matches[3] : '');
187 205
     				$type = $matches[1];
188 206
     				$cloud = array();
189
-    				if ($type == 'SKC') $cloud['type'] = 'No cloud/Sky clear';
190
-    				elseif ($type == 'CLR') $cloud['type'] = 'No cloud below 12,000ft (3700m)';
191
-    				elseif ($type == 'NSC') $cloud['type'] = 'No significant cloud';
192
-    				elseif ($type == 'FEW') $cloud['type'] = 'Few';
193
-    				elseif ($type == 'SCT') $cloud['type'] = 'Scattered';
194
-    				elseif ($type == 'BKN') $cloud['type'] = 'Broken';
195
-    				elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage';
196
-    				elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility';
207
+    				if ($type == 'SKC') {
208
+    					$cloud['type'] = 'No cloud/Sky clear';
209
+    				} elseif ($type == 'CLR') {
210
+    					$cloud['type'] = 'No cloud below 12,000ft (3700m)';
211
+    				} elseif ($type == 'NSC') {
212
+    					$cloud['type'] = 'No significant cloud';
213
+    				} elseif ($type == 'FEW') {
214
+    					$cloud['type'] = 'Few';
215
+    				} elseif ($type == 'SCT') {
216
+    					$cloud['type'] = 'Scattered';
217
+    				} elseif ($type == 'BKN') {
218
+    					$cloud['type'] = 'Broken';
219
+    				} elseif ($type == 'OVC') {
220
+    					$cloud['type'] = 'Overcast/Full cloud coverage';
221
+    				} elseif ($type == 'VV') {
222
+    					$cloud['type'] = 'Vertical visibility';
223
+    				}
197 224
     				$cloud['type_code'] = $type;
198 225
     				$cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048);
199 226
     				$cloud['significant'] = isset($matches[3]) ? $matches[3] : '';
@@ -223,8 +250,11 @@  discard block
 block discarded – undo
223 250
     			if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) {
224 251
     				//echo $piece;
225 252
     				//print_r($matches);
226
-    				if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M');
227
-    				else $range = array('exact' => (float)$matches[2], 'unit' => 'M');
253
+    				if (isset($matches[5])) {
254
+    					$range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M');
255
+    				} else {
256
+    					$range = array('exact' => (float)$matches[2], 'unit' => 'M');
257
+    				}
228 258
 				if (isset($matches[3])) {
229 259
 					$range = Array(
230 260
 					    'from' => (float)$matches[2],
@@ -257,8 +287,11 @@  discard block
 block discarded – undo
257 287
 				if (isset($matches[3])) {
258 288
 					$text[] = $this->texts[$matches[3]];
259 289
 				}
260
-				if (!isset($result['weather'])) $result['weather'] = implode(' ', $text);
261
-				else $result['weather'] = $result['weather'].' / '.implode(' ', $text);
290
+				if (!isset($result['weather'])) {
291
+					$result['weather'] = implode(' ', $text);
292
+				} else {
293
+					$result['weather'] = $result['weather'].' / '.implode(' ', $text);
294
+				}
262 295
     			}
263 296
     		}
264 297
     		return $result;
@@ -270,8 +303,11 @@  discard block
 block discarded – undo
270 303
     		if (isset($globalMETARcycle) && $globalMETARcycle) {
271 304
             		$query = "SELECT * FROM metar WHERE metar_location = :icao";
272 305
                 } else {
273
-            		if ($globalDBdriver == 'mysql') $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1";
274
-            		else $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1";
306
+            		if ($globalDBdriver == 'mysql') {
307
+            			$query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1";
308
+            		} else {
309
+            			$query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1";
310
+            		}
275 311
                 }
276 312
                 $query_values = array(':icao' => $icao);
277 313
                  try {
@@ -326,7 +362,9 @@  discard block
 block discarded – undo
326 362
         
327 363
         public function addMETARCycle() {
328 364
     		global $globalDebug, $globalIVAO, $globalTransaction;
329
-    		if (isset($globalDebug) && $globalDebug) echo "Downloading METAR cycle...";
365
+    		if (isset($globalDebug) && $globalDebug) {
366
+    			echo "Downloading METAR cycle...";
367
+    		}
330 368
     		date_default_timezone_set("UTC");
331 369
     		$Common = new Common();
332 370
     		if (isset($globalIVAO) && $globalIVAO) {
@@ -339,33 +377,49 @@  discard block
 block discarded – undo
339 377
     			$handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r");
340 378
     		}
341 379
     		if ($handle) {
342
-			if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB...";
380
+			if (isset($globalDebug) && $globalDebug) {
381
+				echo "Done - Updating DB...";
382
+			}
343 383
 			$date = '';
344 384
     			//foreach(explode("\n",$cycle) as $line) {
345
-    			if ($globalTransaction) $this->db->beginTransaction();
385
+    			if ($globalTransaction) {
386
+    				$this->db->beginTransaction();
387
+    			}
346 388
 	    		while(($line = fgets($handle,4096)) !== false) {
347 389
 				if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) {
348 390
 					$date = $line;
349 391
     				} elseif ($line != '') {
350 392
     				    //$this->parse($line);
351
-    				    if ($date == '') $date = date('Y/m/d H:m');
393
+    				    if ($date == '') {
394
+    				    	$date = date('Y/m/d H:m');
395
+    				    }
352 396
         			    $pos = 0;
353 397
         			    $pieces = preg_split('/\s/',$line);
354
-        			    if ($pieces[0] == 'METAR') $pos++;
355
-        			    if (strlen($pieces[$pos]) != 4) $pos++;
398
+        			    if ($pieces[0] == 'METAR') {
399
+        			    	$pos++;
400
+        			    }
401
+        			    if (strlen($pieces[$pos]) != 4) {
402
+        			    	$pos++;
403
+        			    }
356 404
 		        	    $location = $pieces[$pos];
357 405
         	        	    echo $this->addMETAR($location,$line,$date);
358 406
     				}
359 407
     			}
360 408
     			fclose($handle);
361
-    			if ($globalTransaction) $this->db->commit();
409
+    			if ($globalTransaction) {
410
+    				$this->db->commit();
411
+    			}
412
+    		}
413
+    		if (isset($globalDebug) && $globalDebug) {
414
+    			echo "Done\n";
362 415
     		}
363
-    		if (isset($globalDebug) && $globalDebug) echo "Done\n";
364 416
         
365 417
         }
366 418
         public function downloadMETAR($icao) {
367 419
     		global $globalMETARurl;
368
-    		if ($globalMETARurl == '') return array();
420
+    		if ($globalMETARurl == '') {
421
+    			return array();
422
+    		}
369 423
     		date_default_timezone_set("UTC");
370 424
     		$Common = new Common();
371 425
     		$url = str_replace('{icao}',$icao,$globalMETARurl);
@@ -379,16 +433,24 @@  discard block
 block discarded – undo
379 433
     			if ($line != '') {
380 434
     			    //$this->parse($line);
381 435
     			    //echo $line;
382
-    			    if ($date == '') $date = date('Y/m/d H:m');
436
+    			    if ($date == '') {
437
+    			    	$date = date('Y/m/d H:m');
438
+    			    }
383 439
     			    $pos = 0;
384 440
     			    $pieces = preg_split('/\s/',$line);
385
-    			    if ($pieces[0] == 'METAR') $pos++;
386
-    			    if (strlen($pieces[$pos]) != 4) $pos++;
441
+    			    if ($pieces[0] == 'METAR') {
442
+    			    	$pos++;
443
+    			    }
444
+    			    if (strlen($pieces[$pos]) != 4) {
445
+    			    	$pos++;
446
+    			    }
387 447
 	        	    $location = $pieces[$pos];
388 448
 	        	    if (strlen($location == 4)) {
389 449
 	        		$this->addMETAR($location,$line,$date);
390 450
 	        		return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line));
391
-	        	    } else return array();
451
+	        	    } else {
452
+	        	    	return array();
453
+	        	    }
392 454
     			}
393 455
     			//echo $line."\n";
394 456
     		}
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
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	/**
58 58
 	* Get SQL query part for filter used
59 59
 	* @param Array $filter the filter
60
-	* @return Array the SQL part
60
+	* @return string the SQL part
61 61
 	*/
62 62
 	public function getFilter($filter = array(),$where = false,$and = false) {
63 63
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
@@ -10171,6 +10171,7 @@  discard block
 block discarded – undo
10171 10171
 	/**
10172 10172
 	* Counts all hours
10173 10173
 	*
10174
+	* @param string $orderby
10174 10175
 	* @return Array the hour list
10175 10176
 	*
10176 10177
 	*/
@@ -10236,6 +10237,7 @@  discard block
 block discarded – undo
10236 10237
 	/**
10237 10238
 	* Counts all hours
10238 10239
 	*
10240
+	* @param string $orderby
10239 10241
 	* @return Array the hour list
10240 10242
 	*
10241 10243
 	*/
@@ -11288,7 +11290,7 @@  discard block
 block discarded – undo
11288 11290
 	/**
11289 11291
 	* Parses the direction degrees to working
11290 11292
 	*
11291
-	* @param Float $direction the direction in degrees
11293
+	* @param integer $direction the direction in degrees
11292 11294
 	* @return Array the direction information
11293 11295
 	*
11294 11296
 	*/
Please login to merge, or discard this patch.
Indentation   +1454 added lines, -1454 removed lines patch added patch discarded remove patch
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 	}
56 56
 
57 57
 	/**
58
-	* Get SQL query part for filter used
59
-	* @param Array $filter the filter
60
-	* @return Array the SQL part
61
-	*/
58
+	 * Get SQL query part for filter used
59
+	 * @param Array $filter the filter
60
+	 * @return Array the SQL part
61
+	 */
62 62
 	public function getFilter($filter = array(),$where = false,$and = false) {
63 63
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
64 64
 		$filters = array();
@@ -166,14 +166,14 @@  discard block
 block discarded – undo
166 166
 	}
167 167
 
168 168
 	/**
169
-	* Executes the SQL statements to get the spotter information
170
-	*
171
-	* @param String $query the SQL query
172
-	* @param Array $params parameter of the query
173
-	* @param String $limitQuery the limit query
174
-	* @return Array the spotter information
175
-	*
176
-	*/
169
+	 * Executes the SQL statements to get the spotter information
170
+	 *
171
+	 * @param String $query the SQL query
172
+	 * @param Array $params parameter of the query
173
+	 * @param String $limitQuery the limit query
174
+	 * @return Array the spotter information
175
+	 *
176
+	 */
177 177
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
178 178
 	{
179 179
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
@@ -342,11 +342,11 @@  discard block
 block discarded – undo
342 342
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
343 343
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
344 344
 					} else $temp_array['aircraft_shadow'] = 'default.png';
345
-                                } else {
346
-                            		$temp_array['aircraft_shadow'] = 'default.png';
345
+								} else {
346
+									$temp_array['aircraft_shadow'] = 'default.png';
347 347
 					$temp_array['aircraft_name'] = 'N/A';
348 348
 					$temp_array['aircraft_manufacturer'] = 'N/A';
349
-                            	}
349
+								}
350 350
 			}
351 351
 			$fromsource = NULL;
352 352
 			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
@@ -542,11 +542,11 @@  discard block
 block discarded – undo
542 542
 	
543 543
 	
544 544
 	/**
545
-	* Gets all the spotter information
546
-	*
547
-	* @return Array the spotter information
548
-	*
549
-	*/
545
+	 * Gets all the spotter information
546
+	 *
547
+	 * @return Array the spotter information
548
+	 *
549
+	 */
550 550
 	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())
551 551
 	{
552 552
 		global $globalTimezone, $globalDBdriver;
@@ -893,11 +893,11 @@  discard block
 block discarded – undo
893 893
 	
894 894
 	
895 895
 	/**
896
-	* Gets all the spotter information based on the latest data entry
897
-	*
898
-	* @return Array the spotter information
899
-	*
900
-	*/
896
+	 * Gets all the spotter information based on the latest data entry
897
+	 *
898
+	 * @return Array the spotter information
899
+	 *
900
+	 */
901 901
 	public function getLatestSpotterData($limit = '', $sort = '', $filter = array())
902 902
 	{
903 903
 		global $global_query;
@@ -936,12 +936,12 @@  discard block
 block discarded – undo
936 936
 	}
937 937
     
938 938
     
939
-    /**
940
-	* Gets all the spotter information based on a user's latitude and longitude
941
-	*
942
-	* @return Array the spotter information
943
-	*
944
-	*/
939
+	/**
940
+	 * Gets all the spotter information based on a user's latitude and longitude
941
+	 *
942
+	 * @return Array the spotter information
943
+	 *
944
+	 */
945 945
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
946 946
 	{
947 947
 		date_default_timezone_set('UTC');
@@ -969,7 +969,7 @@  discard block
 block discarded – undo
969 969
 				return false;
970 970
 			}
971 971
 		}
972
-    		$additional_query = '';
972
+			$additional_query = '';
973 973
 		if ($interval != "")
974 974
 		{
975 975
 			if (!is_string($interval))
@@ -1009,12 +1009,12 @@  discard block
 block discarded – undo
1009 1009
 	}
1010 1010
     
1011 1011
     
1012
-    /**
1013
-	* Gets all the spotter information sorted by the newest aircraft type
1014
-	*
1015
-	* @return Array the spotter information
1016
-	*
1017
-	*/
1012
+	/**
1013
+	 * Gets all the spotter information sorted by the newest aircraft type
1014
+	 *
1015
+	 * @return Array the spotter information
1016
+	 *
1017
+	 */
1018 1018
 	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
1019 1019
 	{
1020 1020
 		global $global_query;
@@ -1055,11 +1055,11 @@  discard block
 block discarded – undo
1055 1055
     
1056 1056
     
1057 1057
 	/**
1058
-	* Gets all the spotter information sorted by the newest aircraft registration
1059
-	*
1060
-	* @return Array the spotter information
1061
-	*
1062
-	*/
1058
+	 * Gets all the spotter information sorted by the newest aircraft registration
1059
+	 *
1060
+	 * @return Array the spotter information
1061
+	 *
1062
+	 */
1063 1063
 	public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array())
1064 1064
 	{
1065 1065
 		global $global_query;
@@ -1099,11 +1099,11 @@  discard block
 block discarded – undo
1099 1099
 
1100 1100
 
1101 1101
 	/**
1102
-	* Gets all the spotter information sorted by the newest airline
1103
-	*
1104
-	* @return Array the spotter information
1105
-	*
1106
-	*/
1102
+	 * Gets all the spotter information sorted by the newest airline
1103
+	 *
1104
+	 * @return Array the spotter information
1105
+	 *
1106
+	 */
1107 1107
 	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1108 1108
 	{
1109 1109
 		global $global_query;
@@ -1142,12 +1142,12 @@  discard block
 block discarded – undo
1142 1142
 	}
1143 1143
     
1144 1144
     
1145
-    /**
1146
-	* Gets all the spotter information sorted by the newest departure airport
1147
-	*
1148
-	* @return Array the spotter information
1149
-	*
1150
-	*/
1145
+	/**
1146
+	 * Gets all the spotter information sorted by the newest departure airport
1147
+	 *
1148
+	 * @return Array the spotter information
1149
+	 *
1150
+	 */
1151 1151
 	public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array())
1152 1152
 	{
1153 1153
 		global $global_query;
@@ -1189,11 +1189,11 @@  discard block
 block discarded – undo
1189 1189
 
1190 1190
 
1191 1191
 	/**
1192
-	* Gets all the spotter information sorted by the newest arrival airport
1193
-	*
1194
-	* @return Array the spotter information
1195
-	*
1196
-	*/
1192
+	 * Gets all the spotter information sorted by the newest arrival airport
1193
+	 *
1194
+	 * @return Array the spotter information
1195
+	 *
1196
+	 */
1197 1197
 	public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array())
1198 1198
 	{
1199 1199
 		global $global_query;
@@ -1232,11 +1232,11 @@  discard block
 block discarded – undo
1232 1232
 	
1233 1233
 
1234 1234
 	/**
1235
-	* Gets all the spotter information based on the spotter id
1236
-	*
1237
-	* @return Array the spotter information
1238
-	*
1239
-	*/
1235
+	 * Gets all the spotter information based on the spotter id
1236
+	 *
1237
+	 * @return Array the spotter information
1238
+	 *
1239
+	 */
1240 1240
 	public function getSpotterDataByID($id = '')
1241 1241
 	{
1242 1242
 		global $global_query;
@@ -1258,11 +1258,11 @@  discard block
 block discarded – undo
1258 1258
 	
1259 1259
 	
1260 1260
 	/**
1261
-	* Gets all the spotter information based on the callsign
1262
-	*
1263
-	* @return Array the spotter information
1264
-	*
1265
-	*/
1261
+	 * Gets all the spotter information based on the callsign
1262
+	 *
1263
+	 * @return Array the spotter information
1264
+	 *
1265
+	 */
1266 1266
 	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '', $filter = array())
1267 1267
 	{
1268 1268
 		global $global_query;
@@ -1314,11 +1314,11 @@  discard block
 block discarded – undo
1314 1314
 	}
1315 1315
 	
1316 1316
 	/**
1317
-	* Gets all the spotter information based on the owner
1318
-	*
1319
-	* @return Array the spotter information
1320
-	*
1321
-	*/
1317
+	 * Gets all the spotter information based on the owner
1318
+	 *
1319
+	 * @return Array the spotter information
1320
+	 *
1321
+	 */
1322 1322
 	public function getSpotterDataByOwner($owner = '', $limit = '', $sort = '', $filter = array())
1323 1323
 	{
1324 1324
 		global $global_query;
@@ -1371,11 +1371,11 @@  discard block
 block discarded – undo
1371 1371
 	}
1372 1372
 	
1373 1373
 	/**
1374
-	* Gets all the spotter information based on the pilot
1375
-	*
1376
-	* @return Array the spotter information
1377
-	*
1378
-	*/
1374
+	 * Gets all the spotter information based on the pilot
1375
+	 *
1376
+	 * @return Array the spotter information
1377
+	 *
1378
+	 */
1379 1379
 	public function getSpotterDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array())
1380 1380
 	{
1381 1381
 		global $global_query;
@@ -1424,11 +1424,11 @@  discard block
 block discarded – undo
1424 1424
 	
1425 1425
 	
1426 1426
 	/**
1427
-	* Gets all the spotter information based on the aircraft type
1428
-	*
1429
-	* @return Array the spotter information
1430
-	*
1431
-	*/
1427
+	 * Gets all the spotter information based on the aircraft type
1428
+	 *
1429
+	 * @return Array the spotter information
1430
+	 *
1431
+	 */
1432 1432
 	public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array())
1433 1433
 	{
1434 1434
 		global $global_query;
@@ -1482,11 +1482,11 @@  discard block
 block discarded – undo
1482 1482
 	
1483 1483
 	
1484 1484
 	/**
1485
-	* Gets all the spotter information based on the aircraft registration
1486
-	*
1487
-	* @return Array the spotter information
1488
-	*
1489
-	*/
1485
+	 * Gets all the spotter information based on the aircraft registration
1486
+	 *
1487
+	 * @return Array the spotter information
1488
+	 *
1489
+	 */
1490 1490
 	public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array())
1491 1491
 	{
1492 1492
 		global $global_query;
@@ -1543,11 +1543,11 @@  discard block
 block discarded – undo
1543 1543
 	
1544 1544
 	
1545 1545
 	/**
1546
-	* Gets all the spotter information based on the airline
1547
-	*
1548
-	* @return Array the spotter information
1549
-	*
1550
-	*/
1546
+	 * Gets all the spotter information based on the airline
1547
+	 *
1548
+	 * @return Array the spotter information
1549
+	 *
1550
+	 */
1551 1551
 	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1552 1552
 	{
1553 1553
 		global $global_query;
@@ -1600,11 +1600,11 @@  discard block
 block discarded – undo
1600 1600
 	
1601 1601
 	
1602 1602
 	/**
1603
-	* Gets all the spotter information based on the airport
1604
-	*
1605
-	* @return Array the spotter information
1606
-	*
1607
-	*/
1603
+	 * Gets all the spotter information based on the airport
1604
+	 *
1605
+	 * @return Array the spotter information
1606
+	 *
1607
+	 */
1608 1608
 	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1609 1609
 	{
1610 1610
 		global $global_query;
@@ -1658,11 +1658,11 @@  discard block
 block discarded – undo
1658 1658
 
1659 1659
 
1660 1660
 	/**
1661
-	* Gets all the spotter information based on the date
1662
-	*
1663
-	* @return Array the spotter information
1664
-	*
1665
-	*/
1661
+	 * Gets all the spotter information based on the date
1662
+	 *
1663
+	 * @return Array the spotter information
1664
+	 *
1665
+	 */
1666 1666
 	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1667 1667
 	{
1668 1668
 		global $global_query, $globalTimezone, $globalDBdriver;
@@ -1726,11 +1726,11 @@  discard block
 block discarded – undo
1726 1726
 
1727 1727
 
1728 1728
 	/**
1729
-	* Gets all the spotter information based on the country name
1730
-	*
1731
-	* @return Array the spotter information
1732
-	*
1733
-	*/
1729
+	 * Gets all the spotter information based on the country name
1730
+	 *
1731
+	 * @return Array the spotter information
1732
+	 *
1733
+	 */
1734 1734
 	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1735 1735
 	{
1736 1736
 		global $global_query;
@@ -1784,11 +1784,11 @@  discard block
 block discarded – undo
1784 1784
 	
1785 1785
 	
1786 1786
 	/**
1787
-	* Gets all the spotter information based on the manufacturer name
1788
-	*
1789
-	* @return Array the spotter information
1790
-	*
1791
-	*/
1787
+	 * Gets all the spotter information based on the manufacturer name
1788
+	 *
1789
+	 * @return Array the spotter information
1790
+	 *
1791
+	 */
1792 1792
 	public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array())
1793 1793
 	{
1794 1794
 		global $global_query;
@@ -1844,13 +1844,13 @@  discard block
 block discarded – undo
1844 1844
   
1845 1845
   
1846 1846
 	/**
1847
-	* Gets a list of all aircraft that take a route
1848
-	*
1849
-	* @param String $departure_airport_icao ICAO code of departure airport
1850
-	* @param String $arrival_airport_icao ICAO code of arrival airport
1851
-	* @return Array the spotter information
1852
-	*
1853
-	*/
1847
+	 * Gets a list of all aircraft that take a route
1848
+	 *
1849
+	 * @param String $departure_airport_icao ICAO code of departure airport
1850
+	 * @param String $arrival_airport_icao ICAO code of arrival airport
1851
+	 * @return Array the spotter information
1852
+	 *
1853
+	 */
1854 1854
 	public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array())
1855 1855
 	{
1856 1856
 		global $global_query;
@@ -1919,11 +1919,11 @@  discard block
 block discarded – undo
1919 1919
 	
1920 1920
 	
1921 1921
 	/**
1922
-	* Gets all the spotter information based on the special column in the table
1923
-	*
1924
-	* @return Array the spotter information
1925
-	*
1926
-	*/
1922
+	 * Gets all the spotter information based on the special column in the table
1923
+	 *
1924
+	 * @return Array the spotter information
1925
+	 *
1926
+	 */
1927 1927
 	public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array())
1928 1928
 	{
1929 1929
 		global $global_query;
@@ -1962,11 +1962,11 @@  discard block
 block discarded – undo
1962 1962
 	}
1963 1963
 
1964 1964
 	/**
1965
-	* Gets all the highlight based on a aircraft registration
1966
-	*
1967
-	* @return String the highlight text
1968
-	*
1969
-	*/
1965
+	 * Gets all the highlight based on a aircraft registration
1966
+	 *
1967
+	 * @return String the highlight text
1968
+	 *
1969
+	 */
1970 1970
 	public function getHighlightByRegistration($registration,$filter = array())
1971 1971
 	{
1972 1972
 		global $global_query;
@@ -1988,13 +1988,13 @@  discard block
 block discarded – undo
1988 1988
 
1989 1989
 	
1990 1990
 	/**
1991
-	* Gets the squawk usage from squawk code
1992
-	*
1993
-	* @param String $squawk squawk code
1994
-	* @param String $country country
1995
-	* @return String usage
1996
-	*
1997
-	*/
1991
+	 * Gets the squawk usage from squawk code
1992
+	 *
1993
+	 * @param String $squawk squawk code
1994
+	 * @param String $country country
1995
+	 * @return String usage
1996
+	 *
1997
+	 */
1998 1998
 	public function getSquawkUsage($squawk = '',$country = 'FR')
1999 1999
 	{
2000 2000
 		
@@ -2015,12 +2015,12 @@  discard block
 block discarded – undo
2015 2015
 	}
2016 2016
 
2017 2017
 	/**
2018
-	* Gets the airport icao from the iata
2019
-	*
2020
-	* @param String $airport_iata the iata code of the airport
2021
-	* @return String airport iata
2022
-	*
2023
-	*/
2018
+	 * Gets the airport icao from the iata
2019
+	 *
2020
+	 * @param String $airport_iata the iata code of the airport
2021
+	 * @return String airport iata
2022
+	 *
2023
+	 */
2024 2024
 	public function getAirportIcao($airport_iata = '')
2025 2025
 	{
2026 2026
 		
@@ -2040,14 +2040,14 @@  discard block
 block discarded – undo
2040 2040
 	}
2041 2041
 
2042 2042
 	/**
2043
-	* Gets the airport distance
2044
-	*
2045
-	* @param String $airport_icao the icao code of the airport
2046
-	* @param Float $latitude the latitude
2047
-	* @param Float $longitude the longitude
2048
-	* @return Float distance to the airport
2049
-	*
2050
-	*/
2043
+	 * Gets the airport distance
2044
+	 *
2045
+	 * @param String $airport_icao the icao code of the airport
2046
+	 * @param Float $latitude the latitude
2047
+	 * @param Float $longitude the longitude
2048
+	 * @return Float distance to the airport
2049
+	 *
2050
+	 */
2051 2051
 	public function getAirportDistance($airport_icao,$latitude,$longitude)
2052 2052
 	{
2053 2053
 		
@@ -2068,12 +2068,12 @@  discard block
 block discarded – undo
2068 2068
 	}
2069 2069
 	
2070 2070
 	/**
2071
-	* Gets the airport info based on the icao
2072
-	*
2073
-	* @param String $airport the icao code of the airport
2074
-	* @return Array airport information
2075
-	*
2076
-	*/
2071
+	 * Gets the airport info based on the icao
2072
+	 *
2073
+	 * @param String $airport the icao code of the airport
2074
+	 * @return Array airport information
2075
+	 *
2076
+	 */
2077 2077
 	public function getAllAirportInfo($airport = '')
2078 2078
 	{
2079 2079
 		
@@ -2119,12 +2119,12 @@  discard block
 block discarded – undo
2119 2119
 	}
2120 2120
 	
2121 2121
 	/**
2122
-	* Gets the airport info based on the country
2123
-	*
2124
-	* @param Array $countries Airports countries
2125
-	* @return Array airport information
2126
-	*
2127
-	*/
2122
+	 * Gets the airport info based on the country
2123
+	 *
2124
+	 * @param Array $countries Airports countries
2125
+	 * @return Array airport information
2126
+	 *
2127
+	 */
2128 2128
 	public function getAllAirportInfobyCountry($countries)
2129 2129
 	{
2130 2130
 		$lst_countries = '';
@@ -2162,12 +2162,12 @@  discard block
 block discarded – undo
2162 2162
 	}
2163 2163
 	
2164 2164
 	/**
2165
-	* Gets airports info based on the coord
2166
-	*
2167
-	* @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
2168
-	* @return Array airport information
2169
-	*
2170
-	*/
2165
+	 * Gets airports info based on the coord
2166
+	 *
2167
+	 * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
2168
+	 * @return Array airport information
2169
+	 *
2170
+	 */
2171 2171
 	public function getAllAirportInfobyCoord($coord)
2172 2172
 	{
2173 2173
 		global $globalDBdriver;
@@ -2198,12 +2198,12 @@  discard block
 block discarded – undo
2198 2198
 	}
2199 2199
 
2200 2200
 	/**
2201
-	* Gets waypoints info based on the coord
2202
-	*
2203
-	* @param Array $coord waypoints coord
2204
-	* @return Array airport information
2205
-	*
2206
-	*/
2201
+	 * Gets waypoints info based on the coord
2202
+	 *
2203
+	 * @param Array $coord waypoints coord
2204
+	 * @return Array airport information
2205
+	 *
2206
+	 */
2207 2207
 	public function getAllWaypointsInfobyCoord($coord)
2208 2208
 	{
2209 2209
 		if (is_array($coord)) {
@@ -2237,12 +2237,12 @@  discard block
 block discarded – undo
2237 2237
 	
2238 2238
 	
2239 2239
 	/**
2240
-	* Gets the airline info based on the icao code or iata code
2241
-	*
2242
-	* @param String $airline_icao the iata code of the airport
2243
-	* @return Array airport information
2244
-	*
2245
-	*/
2240
+	 * Gets the airline info based on the icao code or iata code
2241
+	 *
2242
+	 * @param String $airline_icao the iata code of the airport
2243
+	 * @return Array airport information
2244
+	 *
2245
+	 */
2246 2246
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2247 2247
 	{
2248 2248
 		global $globalUseRealAirlines;
@@ -2273,7 +2273,7 @@  discard block
 block discarded – undo
2273 2273
 			} else {
2274 2274
 				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2275 2275
 			}
2276
-                        /*
2276
+						/*
2277 2277
 			$airline_array = array();
2278 2278
 			$temp_array = array();
2279 2279
 		
@@ -2306,12 +2306,12 @@  discard block
 block discarded – undo
2306 2306
 	}
2307 2307
 	
2308 2308
 	/**
2309
-	* Gets the airline info based on the airline name
2310
-	*
2311
-	* @param String $airline_name the name of the airline
2312
-	* @return Array airline information
2313
-	*
2314
-	*/
2309
+	 * Gets the airline info based on the airline name
2310
+	 *
2311
+	 * @param String $airline_name the name of the airline
2312
+	 * @return Array airline information
2313
+	 *
2314
+	 */
2315 2315
 	public function getAllAirlineInfoByName($airline_name, $fromsource = NULL)
2316 2316
 	{
2317 2317
 		global $globalUseRealAirlines;
@@ -2339,12 +2339,12 @@  discard block
 block discarded – undo
2339 2339
 	
2340 2340
 	
2341 2341
 	/**
2342
-	* Gets the aircraft info based on the aircraft type
2343
-	*
2344
-	* @param String $aircraft_type the aircraft type
2345
-	* @return Array aircraft information
2346
-	*
2347
-	*/
2342
+	 * Gets the aircraft info based on the aircraft type
2343
+	 *
2344
+	 * @param String $aircraft_type the aircraft type
2345
+	 * @return Array aircraft information
2346
+	 *
2347
+	 */
2348 2348
 	public function getAllAircraftInfo($aircraft_type)
2349 2349
 	{
2350 2350
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2376,12 +2376,12 @@  discard block
 block discarded – undo
2376 2376
 	}
2377 2377
 
2378 2378
 	/**
2379
-	* Gets the aircraft icao based on the aircraft name/type
2380
-	*
2381
-	* @param String $aircraft_type the aircraft type
2382
-	* @return String aircraft information
2383
-	*
2384
-	*/
2379
+	 * Gets the aircraft icao based on the aircraft name/type
2380
+	 *
2381
+	 * @param String $aircraft_type the aircraft type
2382
+	 * @return String aircraft information
2383
+	 *
2384
+	 */
2385 2385
 	public function getAircraftIcao($aircraft_type)
2386 2386
 	{
2387 2387
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2406,12 +2406,12 @@  discard block
 block discarded – undo
2406 2406
 	}
2407 2407
 	
2408 2408
 	/**
2409
-	* Gets the aircraft info based on the aircraft modes
2410
-	*
2411
-	* @param String $aircraft_modes the aircraft ident (hex)
2412
-	* @return String aircraft type
2413
-	*
2414
-	*/
2409
+	 * Gets the aircraft info based on the aircraft modes
2410
+	 *
2411
+	 * @param String $aircraft_modes the aircraft ident (hex)
2412
+	 * @return String aircraft type
2413
+	 *
2414
+	 */
2415 2415
 	public function getAllAircraftType($aircraft_modes,$source_type = '')
2416 2416
 	{
2417 2417
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -2438,12 +2438,12 @@  discard block
 block discarded – undo
2438 2438
 	}
2439 2439
 
2440 2440
 	/**
2441
-	* Gets the aircraft info based on the aircraft registration
2442
-	*
2443
-	* @param String $registration the aircraft registration
2444
-	* @return String aircraft type
2445
-	*
2446
-	*/
2441
+	 * Gets the aircraft info based on the aircraft registration
2442
+	 *
2443
+	 * @param String $registration the aircraft registration
2444
+	 * @return String aircraft type
2445
+	 *
2446
+	 */
2447 2447
 	public function getAllAircraftTypeByRegistration($registration)
2448 2448
 	{
2449 2449
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2461,12 +2461,12 @@  discard block
 block discarded – undo
2461 2461
 	}
2462 2462
 
2463 2463
 	/**
2464
-	* Gets the spotter_id and flightaware_id based on the aircraft registration
2465
-	*
2466
-	* @param String $registration the aircraft registration
2467
-	* @return Array spotter_id and flightaware_id
2468
-	*
2469
-	*/
2464
+	 * Gets the spotter_id and flightaware_id based on the aircraft registration
2465
+	 *
2466
+	 * @param String $registration the aircraft registration
2467
+	 * @return Array spotter_id and flightaware_id
2468
+	 *
2469
+	 */
2470 2470
 	public function getAllIDByRegistration($registration)
2471 2471
 	{
2472 2472
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2485,12 +2485,12 @@  discard block
 block discarded – undo
2485 2485
 	}
2486 2486
 
2487 2487
 	/**
2488
-	* Gets correct aircraft operator code
2489
-	*
2490
-	* @param String $operator the aircraft operator code (callsign)
2491
-	* @return String aircraft operator code
2492
-	*
2493
-	*/
2488
+	 * Gets correct aircraft operator code
2489
+	 *
2490
+	 * @param String $operator the aircraft operator code (callsign)
2491
+	 * @return String aircraft operator code
2492
+	 *
2493
+	 */
2494 2494
 	public function getOperator($operator)
2495 2495
 	{
2496 2496
 		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
@@ -2507,16 +2507,16 @@  discard block
 block discarded – undo
2507 2507
 	}
2508 2508
 
2509 2509
 	/**
2510
-	* Gets the aircraft route based on the aircraft callsign
2511
-	*
2512
-	* @param String $callsign the aircraft callsign
2513
-	* @return Array aircraft type
2514
-	*
2515
-	*/
2510
+	 * Gets the aircraft route based on the aircraft callsign
2511
+	 *
2512
+	 * @param String $callsign the aircraft callsign
2513
+	 * @return Array aircraft type
2514
+	 *
2515
+	 */
2516 2516
 	public function getRouteInfo($callsign)
2517 2517
 	{
2518 2518
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2519
-                if ($callsign == '') return array();
2519
+				if ($callsign == '') return array();
2520 2520
 		$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";
2521 2521
 		
2522 2522
 		$sth = $this->db->prepare($query);
@@ -2530,12 +2530,12 @@  discard block
 block discarded – undo
2530 2530
 	}
2531 2531
 	
2532 2532
 	/**
2533
-	* Gets the aircraft info based on the aircraft registration
2534
-	*
2535
-	* @param String $registration the aircraft registration
2536
-	* @return Array aircraft information
2537
-	*
2538
-	*/
2533
+	 * Gets the aircraft info based on the aircraft registration
2534
+	 *
2535
+	 * @param String $registration the aircraft registration
2536
+	 * @return Array aircraft information
2537
+	 *
2538
+	 */
2539 2539
 	public function getAircraftInfoByRegistration($registration)
2540 2540
 	{
2541 2541
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2562,12 +2562,12 @@  discard block
 block discarded – undo
2562 2562
 	}
2563 2563
 	
2564 2564
 	/**
2565
-	* Gets the aircraft owner & base based on the aircraft registration
2566
-	*
2567
-	* @param String $registration the aircraft registration
2568
-	* @return Array aircraft information
2569
-	*
2570
-	*/
2565
+	 * Gets the aircraft owner & base based on the aircraft registration
2566
+	 *
2567
+	 * @param String $registration the aircraft registration
2568
+	 * @return Array aircraft information
2569
+	 *
2570
+	 */
2571 2571
 	public function getAircraftOwnerByRegistration($registration)
2572 2572
 	{
2573 2573
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2584,11 +2584,11 @@  discard block
 block discarded – undo
2584 2584
 	
2585 2585
   
2586 2586
   /**
2587
-	* Gets all flights (but with only little info)
2588
-	*
2589
-	* @return Array basic flight information
2590
-	*
2591
-	*/
2587
+   * Gets all flights (but with only little info)
2588
+   *
2589
+   * @return Array basic flight information
2590
+   *
2591
+   */
2592 2592
 	public function getAllFlightsforSitemap()
2593 2593
 	{
2594 2594
 		//$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 ";
@@ -2596,7 +2596,7 @@  discard block
 block discarded – undo
2596 2596
 		
2597 2597
 		$sth = $this->db->prepare($query);
2598 2598
 		$sth->execute();
2599
-                  /*
2599
+				  /*
2600 2600
 		$flight_array = array();
2601 2601
 		$temp_array = array();
2602 2602
 		
@@ -2618,11 +2618,11 @@  discard block
 block discarded – undo
2618 2618
 	}
2619 2619
   
2620 2620
 	/**
2621
-	* Gets a list of all aircraft manufacturers
2622
-	*
2623
-	* @return Array list of aircraft types
2624
-	*
2625
-	*/
2621
+	 * Gets a list of all aircraft manufacturers
2622
+	 *
2623
+	 * @return Array list of aircraft types
2624
+	 *
2625
+	 */
2626 2626
 	public function getAllManufacturers()
2627 2627
 	{
2628 2628
 		/*
@@ -2651,11 +2651,11 @@  discard block
 block discarded – undo
2651 2651
   
2652 2652
   
2653 2653
   /**
2654
-	* Gets a list of all aircraft types
2655
-	*
2656
-	* @return Array list of aircraft types
2657
-	*
2658
-	*/
2654
+   * Gets a list of all aircraft types
2655
+   *
2656
+   * @return Array list of aircraft types
2657
+   *
2658
+   */
2659 2659
 	public function getAllAircraftTypes($filters = array())
2660 2660
 	{
2661 2661
 		/*
@@ -2690,11 +2690,11 @@  discard block
 block discarded – undo
2690 2690
 	
2691 2691
 	
2692 2692
 	/**
2693
-	* Gets a list of all aircraft registrations
2694
-	*
2695
-	* @return Array list of aircraft registrations
2696
-	*
2697
-	*/
2693
+	 * Gets a list of all aircraft registrations
2694
+	 *
2695
+	 * @return Array list of aircraft registrations
2696
+	 *
2697
+	 */
2698 2698
 	public function getAllAircraftRegistrations($filters = array())
2699 2699
 	{
2700 2700
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2719,12 +2719,12 @@  discard block
 block discarded – undo
2719 2719
 	}
2720 2720
 
2721 2721
 	/**
2722
-	* Gets all source name
2723
-	*
2724
-	* @param String type format of source
2725
-	* @return Array list of source name
2726
-	*
2727
-	*/
2722
+	 * Gets all source name
2723
+	 *
2724
+	 * @param String type format of source
2725
+	 * @return Array list of source name
2726
+	 *
2727
+	 */
2728 2728
 	public function getAllSourceName($type = '',$filters = array())
2729 2729
 	{
2730 2730
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2755,11 +2755,11 @@  discard block
 block discarded – undo
2755 2755
 
2756 2756
 
2757 2757
 	/**
2758
-	* Gets a list of all airline names
2759
-	*
2760
-	* @return Array list of airline names
2761
-	*
2762
-	*/
2758
+	 * Gets a list of all airline names
2759
+	 *
2760
+	 * @return Array list of airline names
2761
+	 *
2762
+	 */
2763 2763
 	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2764 2764
 	{
2765 2765
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2808,11 +2808,11 @@  discard block
 block discarded – undo
2808 2808
 	}
2809 2809
 	
2810 2810
 	/**
2811
-	* Gets a list of all alliance names
2812
-	*
2813
-	* @return Array list of alliance names
2814
-	*
2815
-	*/
2811
+	 * Gets a list of all alliance names
2812
+	 *
2813
+	 * @return Array list of alliance names
2814
+	 *
2815
+	 */
2816 2816
 	public function getAllAllianceNames($forsource = NULL,$filters = array())
2817 2817
 	{
2818 2818
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2837,11 +2837,11 @@  discard block
 block discarded – undo
2837 2837
 	}
2838 2838
 	
2839 2839
 	/**
2840
-	* Gets a list of all airline countries
2841
-	*
2842
-	* @return Array list of airline countries
2843
-	*
2844
-	*/
2840
+	 * Gets a list of all airline countries
2841
+	 *
2842
+	 * @return Array list of airline countries
2843
+	 *
2844
+	 */
2845 2845
 	public function getAllAirlineCountries($filters = array())
2846 2846
 	{
2847 2847
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2869,11 +2869,11 @@  discard block
 block discarded – undo
2869 2869
 	
2870 2870
 	
2871 2871
 	/**
2872
-	* Gets a list of all departure & arrival names
2873
-	*
2874
-	* @return Array list of airport names
2875
-	*
2876
-	*/
2872
+	 * Gets a list of all departure & arrival names
2873
+	 *
2874
+	 * @return Array list of airport names
2875
+	 *
2876
+	 */
2877 2877
 	public function getAllAirportNames($filters = array())
2878 2878
 	{
2879 2879
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2921,11 +2921,11 @@  discard block
 block discarded – undo
2921 2921
 	} 
2922 2922
 
2923 2923
 	/**
2924
-	* Gets a list of all owner names
2925
-	*
2926
-	* @return Array list of owner names
2927
-	*
2928
-	*/
2924
+	 * Gets a list of all owner names
2925
+	 *
2926
+	 * @return Array list of owner names
2927
+	 *
2928
+	 */
2929 2929
 	public function getAllOwnerNames($filters = array())
2930 2930
 	{
2931 2931
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2939,11 +2939,11 @@  discard block
 block discarded – undo
2939 2939
 	} 
2940 2940
 
2941 2941
 	/**
2942
-	* Gets a list of all pilot names and pilot ids
2943
-	*
2944
-	* @return Array list of pilot names and pilot ids
2945
-	*
2946
-	*/
2942
+	 * Gets a list of all pilot names and pilot ids
2943
+	 *
2944
+	 * @return Array list of pilot names and pilot ids
2945
+	 *
2946
+	 */
2947 2947
 	public function getAllPilotNames($filters = array())
2948 2948
 	{
2949 2949
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2958,11 +2958,11 @@  discard block
 block discarded – undo
2958 2958
 	
2959 2959
 	
2960 2960
 	/**
2961
-	* Gets a list of all departure & arrival airport countries
2962
-	*
2963
-	* @return Array list of airport countries
2964
-	*
2965
-	*/
2961
+	 * Gets a list of all departure & arrival airport countries
2962
+	 *
2963
+	 * @return Array list of airport countries
2964
+	 *
2965
+	 */
2966 2966
 	public function getAllAirportCountries($filters = array())
2967 2967
 	{
2968 2968
 		$airport_array = array();
@@ -3010,11 +3010,11 @@  discard block
 block discarded – undo
3010 3010
 	
3011 3011
 	
3012 3012
 	/**
3013
-	* Gets a list of all countries (airline, departure airport & arrival airport)
3014
-	*
3015
-	* @return Array list of countries
3016
-	*
3017
-	*/
3013
+	 * Gets a list of all countries (airline, departure airport & arrival airport)
3014
+	 *
3015
+	 * @return Array list of countries
3016
+	 *
3017
+	 */
3018 3018
 	public function getAllCountries($filters = array())
3019 3019
 	{
3020 3020
 		$Connection= new Connection($this->db);
@@ -3091,11 +3091,11 @@  discard block
 block discarded – undo
3091 3091
 	
3092 3092
 	
3093 3093
 	/**
3094
-	* Gets a list of all idents/callsigns
3095
-	*
3096
-	* @return Array list of ident/callsign names
3097
-	*
3098
-	*/
3094
+	 * Gets a list of all idents/callsigns
3095
+	 *
3096
+	 * @return Array list of ident/callsign names
3097
+	 *
3098
+	 */
3099 3099
 	public function getAllIdents($filters = array())
3100 3100
 	{
3101 3101
 		$filter_query = $this->getFilter($filters,true,true);
@@ -3119,9 +3119,9 @@  discard block
 block discarded – undo
3119 3119
 	}
3120 3120
 
3121 3121
 	/**
3122
-	* Get a list of flights from airport since 7 days
3123
-	* @return Array number, icao, name and city of airports
3124
-	*/
3122
+	 * Get a list of flights from airport since 7 days
3123
+	 * @return Array number, icao, name and city of airports
3124
+	 */
3125 3125
 
3126 3126
 	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
3127 3127
 		global $globalTimezone, $globalDBdriver;
@@ -3152,9 +3152,9 @@  discard block
 block discarded – undo
3152 3152
 	}
3153 3153
 
3154 3154
 	/**
3155
-	* Get a list of flights from airport since 7 days
3156
-	* @return Array number, icao, name and city of airports
3157
-	*/
3155
+	 * Get a list of flights from airport since 7 days
3156
+	 * @return Array number, icao, name and city of airports
3157
+	 */
3158 3158
 
3159 3159
 	public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') {
3160 3160
 		global $globalTimezone, $globalDBdriver;
@@ -3184,9 +3184,9 @@  discard block
 block discarded – undo
3184 3184
 	}
3185 3185
 
3186 3186
 	/**
3187
-	* Get a list of flights from detected airport since 7 days
3188
-	* @return Array number, icao, name and city of airports
3189
-	*/
3187
+	 * Get a list of flights from detected airport since 7 days
3188
+	 * @return Array number, icao, name and city of airports
3189
+	 */
3190 3190
 
3191 3191
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
3192 3192
 		global $globalTimezone, $globalDBdriver;
@@ -3224,9 +3224,9 @@  discard block
 block discarded – undo
3224 3224
 	}
3225 3225
 
3226 3226
 	/**
3227
-	* Get a list of flights from detected airport since 7 days
3228
-	* @return Array number, icao, name and city of airports
3229
-	*/
3227
+	 * Get a list of flights from detected airport since 7 days
3228
+	 * @return Array number, icao, name and city of airports
3229
+	 */
3230 3230
 
3231 3231
 	public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') {
3232 3232
 		global $globalTimezone, $globalDBdriver;
@@ -3268,9 +3268,9 @@  discard block
 block discarded – undo
3268 3268
 
3269 3269
 
3270 3270
 	/**
3271
-	* Get a list of flights to airport since 7 days
3272
-	* @return Array number, icao, name and city of airports
3273
-	*/
3271
+	 * Get a list of flights to airport since 7 days
3272
+	 * @return Array number, icao, name and city of airports
3273
+	 */
3274 3274
 
3275 3275
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
3276 3276
 		global $globalTimezone, $globalDBdriver;
@@ -3303,9 +3303,9 @@  discard block
 block discarded – undo
3303 3303
 
3304 3304
 
3305 3305
 	/**
3306
-	* Get a list of flights detected to airport since 7 days
3307
-	* @return Array number, icao, name and city of airports
3308
-	*/
3306
+	 * Get a list of flights detected to airport since 7 days
3307
+	 * @return Array number, icao, name and city of airports
3308
+	 */
3309 3309
 
3310 3310
 	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3311 3311
 		global $globalTimezone, $globalDBdriver;
@@ -3346,9 +3346,9 @@  discard block
 block discarded – undo
3346 3346
 
3347 3347
 
3348 3348
 	/**
3349
-	* Get a list of flights to airport since 7 days
3350
-	* @return Array number, icao, name and city of airports
3351
-	*/
3349
+	 * Get a list of flights to airport since 7 days
3350
+	 * @return Array number, icao, name and city of airports
3351
+	 */
3352 3352
 
3353 3353
 	public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') {
3354 3354
 		global $globalTimezone, $globalDBdriver;
@@ -3380,9 +3380,9 @@  discard block
 block discarded – undo
3380 3380
 
3381 3381
 
3382 3382
 	/**
3383
-	* Get a list of flights detected to airport since 7 days
3384
-	* @return Array number, icao, name and city of airports
3385
-	*/
3383
+	 * Get a list of flights detected to airport since 7 days
3384
+	 * @return Array number, icao, name and city of airports
3385
+	 */
3386 3386
 
3387 3387
 	public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') {
3388 3388
 		global $globalTimezone, $globalDBdriver;
@@ -3426,11 +3426,11 @@  discard block
 block discarded – undo
3426 3426
 
3427 3427
 
3428 3428
 	/**
3429
-	* Gets a list of all dates
3430
-	*
3431
-	* @return Array list of date names
3432
-	*
3433
-	*/
3429
+	 * Gets a list of all dates
3430
+	 *
3431
+	 * @return Array list of date names
3432
+	 *
3433
+	 */
3434 3434
 	public function getAllDates()
3435 3435
 	{
3436 3436
 		global $globalTimezone, $globalDBdriver;
@@ -3471,11 +3471,11 @@  discard block
 block discarded – undo
3471 3471
 	
3472 3472
 	
3473 3473
 	/**
3474
-	* Gets all route combinations
3475
-	*
3476
-	* @return Array the route list
3477
-	*
3478
-	*/
3474
+	 * Gets all route combinations
3475
+	 *
3476
+	 * @return Array the route list
3477
+	 *
3478
+	 */
3479 3479
 	public function getAllRoutes()
3480 3480
 	{
3481 3481
 		$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 
@@ -3501,13 +3501,13 @@  discard block
 block discarded – undo
3501 3501
 	}
3502 3502
 
3503 3503
 	/**
3504
-	* Update ident spotter data
3505
-	*
3506
-	* @param String $flightaware_id the ID from flightaware
3507
-	* @param String $ident the flight ident
3508
-	* @return String success or false
3509
-	*
3510
-	*/	
3504
+	 * Update ident spotter data
3505
+	 *
3506
+	 * @param String $flightaware_id the ID from flightaware
3507
+	 * @param String $ident the flight ident
3508
+	 * @return String success or false
3509
+	 *
3510
+	 */	
3511 3511
 	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3512 3512
 	{
3513 3513
 		if (!is_numeric(substr($ident, 0, 3)))
@@ -3528,14 +3528,14 @@  discard block
 block discarded – undo
3528 3528
 		} else {
3529 3529
 			$airline_array = $this->getAllAirlineInfo("NA");
3530 3530
 		}
3531
-                $airline_name = $airline_array[0]['name'];
3532
-                $airline_icao = $airline_array[0]['icao'];
3533
-                $airline_country = $airline_array[0]['country'];
3534
-                $airline_type = $airline_array[0]['type'];
3531
+				$airline_name = $airline_array[0]['name'];
3532
+				$airline_icao = $airline_array[0]['icao'];
3533
+				$airline_country = $airline_array[0]['country'];
3534
+				$airline_type = $airline_array[0]['type'];
3535 3535
 
3536 3536
 
3537 3537
 		$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';
3538
-                $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);
3538
+				$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);
3539 3539
 
3540 3540
 		try {
3541 3541
 			$sth = $this->db->prepare($query);
@@ -3548,19 +3548,19 @@  discard block
 block discarded – undo
3548 3548
 
3549 3549
 	}
3550 3550
 	/**
3551
-	* Update latest spotter data
3552
-	*
3553
-	* @param String $flightaware_id the ID from flightaware
3554
-	* @param String $ident the flight ident
3555
-	* @param String $arrival_airport_icao the arrival airport
3556
-	* @return String success or false
3557
-	*
3558
-	*/	
3551
+	 * Update latest spotter data
3552
+	 *
3553
+	 * @param String $flightaware_id the ID from flightaware
3554
+	 * @param String $ident the flight ident
3555
+	 * @param String $arrival_airport_icao the arrival airport
3556
+	 * @return String success or false
3557
+	 *
3558
+	 */	
3559 3559
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3560 3560
 	{
3561 3561
 		if ($groundspeed == '') $groundspeed = NULL;
3562 3562
 		$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';
3563
-                $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);
3563
+				$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);
3564 3564
 
3565 3565
 		try {
3566 3566
 			$sth = $this->db->prepare($query);
@@ -3574,32 +3574,32 @@  discard block
 block discarded – undo
3574 3574
 	}
3575 3575
 
3576 3576
 	/**
3577
-	* Adds a new spotter data
3578
-	*
3579
-	* @param String $flightaware_id the ID from flightaware
3580
-	* @param String $ident the flight ident
3581
-	* @param String $aircraft_icao the aircraft type
3582
-	* @param String $departure_airport_icao the departure airport
3583
-	* @param String $arrival_airport_icao the arrival airport
3584
-	* @param String $latitude latitude of flight
3585
-	* @param String $longitude latitude of flight
3586
-	* @param String $waypoints waypoints of flight
3587
-	* @param String $altitude altitude of flight
3588
-	* @param String $heading heading of flight
3589
-	* @param String $groundspeed speed of flight
3590
-	* @param String $date date of flight
3591
-	* @param String $departure_airport_time departure time of flight
3592
-	* @param String $arrival_airport_time arrival time of flight
3593
-	* @param String $squawk squawk code of flight
3594
-	* @param String $route_stop route stop of flight
3595
-	* @param String $highlight highlight or not
3596
-	* @param String $ModeS ModesS code of flight
3597
-	* @param String $registration registration code of flight
3598
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
3599
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
3600
-	* @param String $verticalrate vertival rate of flight
3601
-	* @return String success or false
3602
-	*/
3577
+	 * Adds a new spotter data
3578
+	 *
3579
+	 * @param String $flightaware_id the ID from flightaware
3580
+	 * @param String $ident the flight ident
3581
+	 * @param String $aircraft_icao the aircraft type
3582
+	 * @param String $departure_airport_icao the departure airport
3583
+	 * @param String $arrival_airport_icao the arrival airport
3584
+	 * @param String $latitude latitude of flight
3585
+	 * @param String $longitude latitude of flight
3586
+	 * @param String $waypoints waypoints of flight
3587
+	 * @param String $altitude altitude of flight
3588
+	 * @param String $heading heading of flight
3589
+	 * @param String $groundspeed speed of flight
3590
+	 * @param String $date date of flight
3591
+	 * @param String $departure_airport_time departure time of flight
3592
+	 * @param String $arrival_airport_time arrival time of flight
3593
+	 * @param String $squawk squawk code of flight
3594
+	 * @param String $route_stop route stop of flight
3595
+	 * @param String $highlight highlight or not
3596
+	 * @param String $ModeS ModesS code of flight
3597
+	 * @param String $registration registration code of flight
3598
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
3599
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
3600
+	 * @param String $verticalrate vertival rate of flight
3601
+	 * @return String success or false
3602
+	 */
3603 3603
 	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$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 = '',$source_type = '')
3604 3604
 	{
3605 3605
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
@@ -3814,8 +3814,8 @@  discard block
 block discarded – undo
3814 3814
     
3815 3815
 		if ($globalIVAO && $aircraft_icao != '')
3816 3816
 		{
3817
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3818
-            		else $airline_icao = '';
3817
+					if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3818
+					else $airline_icao = '';
3819 3819
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3820 3820
 			if (!isset($image_array[0]['registration']))
3821 3821
 			{
@@ -3846,53 +3846,53 @@  discard block
 block discarded – undo
3846 3846
 	
3847 3847
 		if (count($airline_array) == 0) 
3848 3848
 		{
3849
-                        $airline_array = $this->getAllAirlineInfo('NA');
3850
-                }
3851
-                if (count($aircraft_array) == 0) 
3852
-                {
3853
-                        $aircraft_array = $this->getAllAircraftInfo('NA');
3854
-                }
3855
-                if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3856
-                {
3857
-                        $departure_airport_array = $this->getAllAirportInfo('NA');
3858
-                }
3859
-                if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3860
-                {
3861
-                        $arrival_airport_array = $this->getAllAirportInfo('NA');
3862
-                }
3863
-                if ($registration == '') $registration = 'NA';
3864
-                if ($latitude == '' && $longitude == '') {
3865
-            		$latitude = 0;
3866
-            		$longitude = 0;
3867
-            	}
3868
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3869
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3870
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3871
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3872
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3873
-                $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) 
3849
+						$airline_array = $this->getAllAirlineInfo('NA');
3850
+				}
3851
+				if (count($aircraft_array) == 0) 
3852
+				{
3853
+						$aircraft_array = $this->getAllAircraftInfo('NA');
3854
+				}
3855
+				if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3856
+				{
3857
+						$departure_airport_array = $this->getAllAirportInfo('NA');
3858
+				}
3859
+				if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3860
+				{
3861
+						$arrival_airport_array = $this->getAllAirportInfo('NA');
3862
+				}
3863
+				if ($registration == '') $registration = 'NA';
3864
+				if ($latitude == '' && $longitude == '') {
3865
+					$latitude = 0;
3866
+					$longitude = 0;
3867
+				}
3868
+				if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3869
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3870
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3871
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3872
+				if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3873
+				$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) 
3874 3874
                 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)";
3875 3875
 
3876
-                $airline_name = $airline_array[0]['name'];
3877
-                $airline_icao = $airline_array[0]['icao'];
3878
-                $airline_country = $airline_array[0]['country'];
3879
-                $airline_type = $airline_array[0]['type'];
3876
+				$airline_name = $airline_array[0]['name'];
3877
+				$airline_icao = $airline_array[0]['icao'];
3878
+				$airline_country = $airline_array[0]['country'];
3879
+				$airline_type = $airline_array[0]['type'];
3880 3880
 		if ($airline_type == '') {
3881 3881
 			$timeelapsed = microtime(true);
3882 3882
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3883 3883
 			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3884 3884
 		}
3885 3885
 		if ($airline_type == null) $airline_type = '';
3886
-                $aircraft_type = $aircraft_array[0]['type'];
3887
-                $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3888
-                $departure_airport_name = $departure_airport_array[0]['name'];
3889
-	        $departure_airport_city = $departure_airport_array[0]['city'];
3890
-            	$departure_airport_country = $departure_airport_array[0]['country'];
3886
+				$aircraft_type = $aircraft_array[0]['type'];
3887
+				$aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3888
+				$departure_airport_name = $departure_airport_array[0]['name'];
3889
+			$departure_airport_city = $departure_airport_array[0]['city'];
3890
+				$departure_airport_country = $departure_airport_array[0]['country'];
3891 3891
                 
3892
-                $arrival_airport_name = $arrival_airport_array[0]['name'];
3893
-                $arrival_airport_city = $arrival_airport_array[0]['city'];
3894
-                $arrival_airport_country = $arrival_airport_array[0]['country'];
3895
-                $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);
3892
+				$arrival_airport_name = $arrival_airport_array[0]['name'];
3893
+				$arrival_airport_city = $arrival_airport_array[0]['city'];
3894
+				$arrival_airport_country = $arrival_airport_array[0]['country'];
3895
+				$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);
3896 3896
 
3897 3897
 		try {
3898 3898
 		        
@@ -3900,7 +3900,7 @@  discard block
 block discarded – undo
3900 3900
 			$sth->execute($query_values);
3901 3901
 			$this->db = null;
3902 3902
 		} catch (PDOException $e) {
3903
-		    return "error : ".$e->getMessage();
3903
+			return "error : ".$e->getMessage();
3904 3904
 		}
3905 3905
 		
3906 3906
 		return "success";
@@ -3909,11 +3909,11 @@  discard block
 block discarded – undo
3909 3909
 	
3910 3910
   
3911 3911
 	/**
3912
-	* Gets the aircraft ident within the last hour
3913
-	*
3914
-	* @return String the ident
3915
-	*
3916
-	*/
3912
+	 * Gets the aircraft ident within the last hour
3913
+	 *
3914
+	 * @return String the ident
3915
+	 *
3916
+	 */
3917 3917
 	public function getIdentFromLastHour($ident)
3918 3918
 	{
3919 3919
 		global $globalDBdriver, $globalTimezone;
@@ -3929,11 +3929,11 @@  discard block
 block discarded – undo
3929 3929
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3930 3930
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
3931 3931
 			$query_data = array(':ident' => $ident);
3932
-    		}
3932
+			}
3933 3933
 		
3934 3934
 		$sth = $this->db->prepare($query);
3935 3935
 		$sth->execute($query_data);
3936
-    		$ident_result='';
3936
+			$ident_result='';
3937 3937
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3938 3938
 		{
3939 3939
 			$ident_result = $row['ident'];
@@ -3944,11 +3944,11 @@  discard block
 block discarded – undo
3944 3944
 	
3945 3945
 	
3946 3946
 	/**
3947
-	* Gets the aircraft data from the last 20 seconds
3948
-	*
3949
-	* @return Array the spotter data
3950
-	*
3951
-	*/
3947
+	 * Gets the aircraft data from the last 20 seconds
3948
+	 *
3949
+	 * @return Array the spotter data
3950
+	 *
3951
+	 */
3952 3952
 	public function getRealTimeData($q = '')
3953 3953
 	{
3954 3954
 		global $globalDBdriver;
@@ -3992,11 +3992,11 @@  discard block
 block discarded – undo
3992 3992
 	
3993 3993
 	
3994 3994
 	 /**
3995
-	* Gets all airlines that have flown over
3996
-	*
3997
-	* @return Array the airline list
3998
-	*
3999
-	*/
3995
+	  * Gets all airlines that have flown over
3996
+	  *
3997
+	  * @return Array the airline list
3998
+	  *
3999
+	  */
4000 4000
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(), $year = '', $month = '', $day = '')
4001 4001
 	{
4002 4002
 		global $globalDBdriver;
@@ -4010,7 +4010,7 @@  discard block
 block discarded – undo
4010 4010
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4011 4011
 			}
4012 4012
 		}
4013
-                if ($sincedate != '') {
4013
+				if ($sincedate != '') {
4014 4014
 			if ($globalDBdriver == 'mysql') {
4015 4015
 				$query .= " AND spotter_output.date > '".$sincedate."'";
4016 4016
 			} else {
@@ -4064,26 +4064,26 @@  discard block
 block discarded – undo
4064 4064
 	}
4065 4065
 
4066 4066
 	 /**
4067
-	* Gets all pilots that have flown over
4068
-	*
4069
-	* @return Array the pilots list
4070
-	*
4071
-	*/
4067
+	  * Gets all pilots that have flown over
4068
+	  *
4069
+	  * @return Array the pilots list
4070
+	  *
4071
+	  */
4072 4072
 	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '',$day = '')
4073 4073
 	{
4074 4074
 		global $globalDBdriver;
4075 4075
 		$filter_query = $this->getFilter($filters,true,true);
4076 4076
 		$query  = "SELECT DISTINCT spotter_output.pilot_id, s.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4077 4077
 			FROM spotter_output LEFT JOIN (SELECT DISTINCT pilot_id, pilot_name, max(date) as date FROM spotter_output GROUP BY pilot_id, pilot_name) s ON s.pilot_id = spotter_output.pilot_id".$filter_query." spotter_output.pilot_id <> ''";
4078
-                if ($olderthanmonths > 0) {
4079
-            		if ($globalDBdriver == 'mysql') {
4078
+				if ($olderthanmonths > 0) {
4079
+					if ($globalDBdriver == 'mysql') {
4080 4080
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
4081 4081
 			} else {
4082 4082
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4083 4083
 			}
4084 4084
 		}
4085
-                if ($sincedate != '') {
4086
-            		if ($globalDBdriver == 'mysql') {
4085
+				if ($sincedate != '') {
4086
+					if ($globalDBdriver == 'mysql') {
4087 4087
 				$query .= " AND spotter_output.date > '".$sincedate."'";
4088 4088
 			} else {
4089 4089
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4138,25 +4138,25 @@  discard block
 block discarded – undo
4138 4138
 	}
4139 4139
 	
4140 4140
 	/**
4141
-	* Gets all pilots that have flown over
4142
-	*
4143
-	* @return Array the pilots list
4144
-	*
4145
-	*/
4141
+	 * Gets all pilots that have flown over
4142
+	 *
4143
+	 * @return Array the pilots list
4144
+	 *
4145
+	 */
4146 4146
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
4147 4147
 	{
4148 4148
 		global $globalDBdriver;
4149 4149
 		$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
4150 4150
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
4151
-                if ($olderthanmonths > 0) {
4152
-            		if ($globalDBdriver == 'mysql') {
4151
+				if ($olderthanmonths > 0) {
4152
+					if ($globalDBdriver == 'mysql') {
4153 4153
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
4154 4154
 			} else {
4155 4155
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
4156 4156
 			}
4157 4157
 		}
4158
-                if ($sincedate != '') {
4159
-            		if ($globalDBdriver == 'mysql') {
4158
+				if ($sincedate != '') {
4159
+					if ($globalDBdriver == 'mysql') {
4160 4160
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
4161 4161
 			} else {
4162 4162
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4185,26 +4185,26 @@  discard block
 block discarded – undo
4185 4185
 	}
4186 4186
 	
4187 4187
 	 /**
4188
-	* Gets all owner that have flown over
4189
-	*
4190
-	* @return Array the pilots list
4191
-	*
4192
-	*/
4188
+	  * Gets all owner that have flown over
4189
+	  *
4190
+	  * @return Array the pilots list
4191
+	  *
4192
+	  */
4193 4193
 	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4194 4194
 	{
4195 4195
 		global $globalDBdriver;
4196 4196
 		$filter_query = $this->getFilter($filters,true,true);
4197 4197
 		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4198 4198
 					FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL";
4199
-                if ($olderthanmonths > 0) {
4200
-            		if ($globalDBdriver == 'mysql') {
4199
+				if ($olderthanmonths > 0) {
4200
+					if ($globalDBdriver == 'mysql') {
4201 4201
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
4202 4202
 			} else {
4203 4203
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4204 4204
 			}
4205 4205
 		}
4206
-                if ($sincedate != '') {
4207
-            		if ($globalDBdriver == 'mysql') {
4206
+				if ($sincedate != '') {
4207
+					if ($globalDBdriver == 'mysql') {
4208 4208
 				$query .= " AND spotter_output.date > '".$sincedate."' ";
4209 4209
 			} else {
4210 4210
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4255,26 +4255,26 @@  discard block
 block discarded – undo
4255 4255
 	}
4256 4256
 	
4257 4257
 	 /**
4258
-	* Gets all owner that have flown over
4259
-	*
4260
-	* @return Array the pilots list
4261
-	*
4262
-	*/
4258
+	  * Gets all owner that have flown over
4259
+	  *
4260
+	  * @return Array the pilots list
4261
+	  *
4262
+	  */
4263 4263
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
4264 4264
 	{
4265 4265
 		global $globalDBdriver;
4266 4266
 		$filter_query = $this->getFilter($filters,true,true);
4267 4267
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4268 4268
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
4269
-                if ($olderthanmonths > 0) {
4270
-            		if ($globalDBdriver == 'mysql') {
4269
+				if ($olderthanmonths > 0) {
4270
+					if ($globalDBdriver == 'mysql') {
4271 4271
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
4272 4272
 			} else {
4273 4273
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
4274 4274
 			}
4275 4275
 		}
4276
-                if ($sincedate != '') {
4277
-            		if ($globalDBdriver == 'mysql') {
4276
+				if ($sincedate != '') {
4277
+					if ($globalDBdriver == 'mysql') {
4278 4278
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
4279 4279
 			} else {
4280 4280
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4301,11 +4301,11 @@  discard block
 block discarded – undo
4301 4301
 	}
4302 4302
 
4303 4303
 	/**
4304
-	* Gets all airlines that have flown over by aircraft
4305
-	*
4306
-	* @return Array the airline list
4307
-	*
4308
-	*/
4304
+	 * Gets all airlines that have flown over by aircraft
4305
+	 *
4306
+	 * @return Array the airline list
4307
+	 *
4308
+	 */
4309 4309
 	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
4310 4310
 	{
4311 4311
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -4337,11 +4337,11 @@  discard block
 block discarded – undo
4337 4337
 
4338 4338
 
4339 4339
 	/**
4340
-	* Gets all airline countries that have flown over by aircraft
4341
-	*
4342
-	* @return Array the airline country list
4343
-	*
4344
-	*/
4340
+	 * Gets all airline countries that have flown over by aircraft
4341
+	 *
4342
+	 * @return Array the airline country list
4343
+	 *
4344
+	 */
4345 4345
 	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
4346 4346
 	{
4347 4347
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -4373,11 +4373,11 @@  discard block
 block discarded – undo
4373 4373
 	
4374 4374
 	
4375 4375
 	/**
4376
-	* Gets all airlines that have flown over by airport
4377
-	*
4378
-	* @return Array the airline list
4379
-	*
4380
-	*/
4376
+	 * Gets all airlines that have flown over by airport
4377
+	 *
4378
+	 * @return Array the airline list
4379
+	 *
4380
+	 */
4381 4381
 	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4382 4382
 	{
4383 4383
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4408,11 +4408,11 @@  discard block
 block discarded – undo
4408 4408
 
4409 4409
 
4410 4410
 	/**
4411
-	* Gets all airline countries that have flown over by airport icao
4412
-	*
4413
-	* @return Array the airline country list
4414
-	*
4415
-	*/
4411
+	 * Gets all airline countries that have flown over by airport icao
4412
+	 *
4413
+	 * @return Array the airline country list
4414
+	 *
4415
+	 */
4416 4416
 	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4417 4417
 	{
4418 4418
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4442,11 +4442,11 @@  discard block
 block discarded – undo
4442 4442
 
4443 4443
 
4444 4444
 	/**
4445
-	* Gets all airlines that have flown over by aircraft manufacturer
4446
-	*
4447
-	* @return Array the airline list
4448
-	*
4449
-	*/
4445
+	 * Gets all airlines that have flown over by aircraft manufacturer
4446
+	 *
4447
+	 * @return Array the airline list
4448
+	 *
4449
+	 */
4450 4450
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4451 4451
 	{
4452 4452
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4477,11 +4477,11 @@  discard block
 block discarded – undo
4477 4477
 
4478 4478
 
4479 4479
 	/**
4480
-	* Gets all airline countries that have flown over by aircraft manufacturer
4481
-	*
4482
-	* @return Array the airline country list
4483
-	*
4484
-	*/
4480
+	 * Gets all airline countries that have flown over by aircraft manufacturer
4481
+	 *
4482
+	 * @return Array the airline country list
4483
+	 *
4484
+	 */
4485 4485
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4486 4486
 	{
4487 4487
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4510,11 +4510,11 @@  discard block
 block discarded – undo
4510 4510
 
4511 4511
 
4512 4512
 	/**
4513
-	* Gets all airlines that have flown over by date
4514
-	*
4515
-	* @return Array the airline list
4516
-	*
4517
-	*/
4513
+	 * Gets all airlines that have flown over by date
4514
+	 *
4515
+	 * @return Array the airline list
4516
+	 *
4517
+	 */
4518 4518
 	public function countAllAirlinesByDate($date,$filters = array())
4519 4519
 	{
4520 4520
 		global $globalTimezone, $globalDBdriver;
@@ -4558,11 +4558,11 @@  discard block
 block discarded – undo
4558 4558
 	
4559 4559
 	
4560 4560
 	/**
4561
-	* Gets all airline countries that have flown over by date
4562
-	*
4563
-	* @return Array the airline country list
4564
-	*
4565
-	*/
4561
+	 * Gets all airline countries that have flown over by date
4562
+	 *
4563
+	 * @return Array the airline country list
4564
+	 *
4565
+	 */
4566 4566
 	public function countAllAirlineCountriesByDate($date,$filters = array())
4567 4567
 	{
4568 4568
 		global $globalTimezone, $globalDBdriver;
@@ -4605,11 +4605,11 @@  discard block
 block discarded – undo
4605 4605
 
4606 4606
 
4607 4607
 	/**
4608
-	* Gets all airlines that have flown over by ident/callsign
4609
-	*
4610
-	* @return Array the airline list
4611
-	*
4612
-	*/
4608
+	 * Gets all airlines that have flown over by ident/callsign
4609
+	 *
4610
+	 * @return Array the airline list
4611
+	 *
4612
+	 */
4613 4613
 	public function countAllAirlinesByIdent($ident,$filters = array())
4614 4614
 	{
4615 4615
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4626,11 +4626,11 @@  discard block
 block discarded – undo
4626 4626
 	}
4627 4627
 
4628 4628
 	/**
4629
-	* Gets all airlines by owner
4630
-	*
4631
-	* @return Array the airline list
4632
-	*
4633
-	*/
4629
+	 * Gets all airlines by owner
4630
+	 *
4631
+	 * @return Array the airline list
4632
+	 *
4633
+	 */
4634 4634
 	public function countAllAirlinesByOwner($owner,$filters = array())
4635 4635
 	{
4636 4636
 		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
@@ -4647,11 +4647,11 @@  discard block
 block discarded – undo
4647 4647
 	}
4648 4648
 
4649 4649
 	/**
4650
-	* Gets flight duration by owner
4651
-	*
4652
-	* @return String Duration of all flights
4653
-	*
4654
-	*/
4650
+	 * Gets flight duration by owner
4651
+	 *
4652
+	 * @return String Duration of all flights
4653
+	 *
4654
+	 */
4655 4655
 	public function getFlightDurationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
4656 4656
 	{
4657 4657
 		global $globalDBdriver;
@@ -4698,11 +4698,11 @@  discard block
 block discarded – undo
4698 4698
 	}
4699 4699
 
4700 4700
 	/**
4701
-	* Count flights by owner
4702
-	*
4703
-	* @return String Duration of all flights
4704
-	*
4705
-	*/
4701
+	 * Count flights by owner
4702
+	 *
4703
+	 * @return String Duration of all flights
4704
+	 *
4705
+	 */
4706 4706
 	public function countFlightsByOwner($owner,$filters = array())
4707 4707
 	{
4708 4708
 		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
@@ -4718,11 +4718,11 @@  discard block
 block discarded – undo
4718 4718
 	}
4719 4719
 
4720 4720
 	/**
4721
-	* Count flights by pilot
4722
-	*
4723
-	* @return String Duration of all flights
4724
-	*
4725
-	*/
4721
+	 * Count flights by pilot
4722
+	 *
4723
+	 * @return String Duration of all flights
4724
+	 *
4725
+	 */
4726 4726
 	public function countFlightsByPilot($pilot,$filters = array())
4727 4727
 	{
4728 4728
 		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
@@ -4738,11 +4738,11 @@  discard block
 block discarded – undo
4738 4738
 	}
4739 4739
 
4740 4740
 	/**
4741
-	* Gets flight duration by pilot
4742
-	*
4743
-	* @return String Duration of all flights
4744
-	*
4745
-	*/
4741
+	 * Gets flight duration by pilot
4742
+	 *
4743
+	 * @return String Duration of all flights
4744
+	 *
4745
+	 */
4746 4746
 	public function getFlightDurationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
4747 4747
 	{
4748 4748
 		global $globalDBdriver;
@@ -4788,11 +4788,11 @@  discard block
 block discarded – undo
4788 4788
 	}
4789 4789
 
4790 4790
 	/**
4791
-	* Gets all airlines used by pilot
4792
-	*
4793
-	* @return Array the airline list
4794
-	*
4795
-	*/
4791
+	 * Gets all airlines used by pilot
4792
+	 *
4793
+	 * @return Array the airline list
4794
+	 *
4795
+	 */
4796 4796
 	public function countAllAirlinesByPilot($pilot,$filters = array())
4797 4797
 	{
4798 4798
 		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
@@ -4809,11 +4809,11 @@  discard block
 block discarded – undo
4809 4809
 	}
4810 4810
 
4811 4811
 	/**
4812
-	* Gets all airlines that have flown over by route
4813
-	*
4814
-	* @return Array the airline list
4815
-	*
4816
-	*/
4812
+	 * Gets all airlines that have flown over by route
4813
+	 *
4814
+	 * @return Array the airline list
4815
+	 *
4816
+	 */
4817 4817
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4818 4818
 	{
4819 4819
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4845,11 +4845,11 @@  discard block
 block discarded – undo
4845 4845
 	}
4846 4846
 
4847 4847
 	/**
4848
-	* Gets all airline countries that have flown over by route
4849
-	*
4850
-	* @return Array the airline country list
4851
-	*
4852
-	*/
4848
+	 * Gets all airline countries that have flown over by route
4849
+	 *
4850
+	 * @return Array the airline country list
4851
+	 *
4852
+	 */
4853 4853
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4854 4854
 	{
4855 4855
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4881,11 +4881,11 @@  discard block
 block discarded – undo
4881 4881
 
4882 4882
 
4883 4883
 	/**
4884
-	* Gets all airlines that have flown over by country
4885
-	*
4886
-	* @return Array the airline list
4887
-	*
4888
-	*/
4884
+	 * Gets all airlines that have flown over by country
4885
+	 *
4886
+	 * @return Array the airline list
4887
+	 *
4888
+	 */
4889 4889
 	public function countAllAirlinesByCountry($country,$filters = array())
4890 4890
 	{
4891 4891
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4915,11 +4915,11 @@  discard block
 block discarded – undo
4915 4915
 
4916 4916
 
4917 4917
 	/**
4918
-	* Gets all airline countries that have flown over by country
4919
-	*
4920
-	* @return Array the airline country list
4921
-	*
4922
-	*/
4918
+	 * Gets all airline countries that have flown over by country
4919
+	 *
4920
+	 * @return Array the airline country list
4921
+	 *
4922
+	 */
4923 4923
 	public function countAllAirlineCountriesByCountry($country,$filters = array())
4924 4924
 	{
4925 4925
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4948,11 +4948,11 @@  discard block
 block discarded – undo
4948 4948
 
4949 4949
 
4950 4950
 	/**
4951
-	* Gets all airlines countries
4952
-	*
4953
-	* @return Array the airline country list
4954
-	*
4955
-	*/
4951
+	 * Gets all airlines countries
4952
+	 *
4953
+	 * @return Array the airline country list
4954
+	 *
4955
+	 */
4956 4956
 	public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
4957 4957
 	{
4958 4958
 		global $globalDBdriver;
@@ -5008,11 +5008,11 @@  discard block
 block discarded – undo
5008 5008
 	}
5009 5009
 
5010 5010
 	/**
5011
-	* Gets all number of flight over countries
5012
-	*
5013
-	* @return Array the airline country list
5014
-	*
5015
-	*/
5011
+	 * Gets all number of flight over countries
5012
+	 *
5013
+	 * @return Array the airline country list
5014
+	 *
5015
+	 */
5016 5016
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5017 5017
 	{
5018 5018
 		global $globalDBdriver;
@@ -5034,15 +5034,15 @@  discard block
 block discarded – undo
5034 5034
 		$SpotterLive = new SpotterLive();
5035 5035
 		$filter_query = $SpotterLive->getFilter($filters,true,true);
5036 5036
 		$filter_query .= ' over_country IS NOT NULL';
5037
-                if ($olderthanmonths > 0) {
5037
+				if ($olderthanmonths > 0) {
5038 5038
 			if ($globalDBdriver == 'mysql') {
5039 5039
 				$filter_query .= ' AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5040 5040
 			} else {
5041 5041
 				$filter_query .= " AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5042 5042
 			}
5043 5043
 		}
5044
-                if ($sincedate != '') {
5045
-            		if ($globalDBdriver == 'mysql') {
5044
+				if ($sincedate != '') {
5045
+					if ($globalDBdriver == 'mysql') {
5046 5046
 				$filter_query .= " AND spotter_live.date > '".$sincedate."' ";
5047 5047
 			} else {
5048 5048
 				$filter_query .= " AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5072,11 +5072,11 @@  discard block
 block discarded – undo
5072 5072
 	
5073 5073
 	
5074 5074
 	/**
5075
-	* Gets all aircraft types that have flown over
5076
-	*
5077
-	* @return Array the aircraft list
5078
-	*
5079
-	*/
5075
+	 * Gets all aircraft types that have flown over
5076
+	 *
5077
+	 * @return Array the aircraft list
5078
+	 *
5079
+	 */
5080 5080
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
5081 5081
 	{
5082 5082
 		global $globalDBdriver;
@@ -5146,11 +5146,11 @@  discard block
 block discarded – undo
5146 5146
 	}
5147 5147
 
5148 5148
 	/**
5149
-	* Gets all aircraft types that have flown over by airline
5150
-	*
5151
-	* @return Array the aircraft list
5152
-	*
5153
-	*/
5149
+	 * Gets all aircraft types that have flown over by airline
5150
+	 *
5151
+	 * @return Array the aircraft list
5152
+	 *
5153
+	 */
5154 5154
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '')
5155 5155
 	{
5156 5156
 		global $globalDBdriver;
@@ -5221,11 +5221,11 @@  discard block
 block discarded – undo
5221 5221
 	}
5222 5222
 
5223 5223
 	/**
5224
-	* Gets all aircraft types that have flown over by months
5225
-	*
5226
-	* @return Array the aircraft list
5227
-	*
5228
-	*/
5224
+	 * Gets all aircraft types that have flown over by months
5225
+	 *
5226
+	 * @return Array the aircraft list
5227
+	 *
5228
+	 */
5229 5229
 	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5230 5230
 	{
5231 5231
 		global $globalDBdriver;
@@ -5269,11 +5269,11 @@  discard block
 block discarded – undo
5269 5269
 
5270 5270
 
5271 5271
 	/**
5272
-	* Gets all aircraft registration that have flown over by aircaft icao
5273
-	*
5274
-	* @return Array the aircraft list
5275
-	*
5276
-	*/
5272
+	 * Gets all aircraft registration that have flown over by aircaft icao
5273
+	 *
5274
+	 * @return Array the aircraft list
5275
+	 *
5276
+	 */
5277 5277
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
5278 5278
 	{
5279 5279
 		$Image = new Image($this->db);
@@ -5312,11 +5312,11 @@  discard block
 block discarded – undo
5312 5312
 
5313 5313
 
5314 5314
 	/**
5315
-	* Gets all aircraft types that have flown over by airline icao
5316
-	*
5317
-	* @return Array the aircraft list
5318
-	*
5319
-	*/
5315
+	 * Gets all aircraft types that have flown over by airline icao
5316
+	 *
5317
+	 * @return Array the aircraft list
5318
+	 *
5319
+	 */
5320 5320
 	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
5321 5321
 	{
5322 5322
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5345,11 +5345,11 @@  discard block
 block discarded – undo
5345 5345
 
5346 5346
 
5347 5347
 	/**
5348
-	* Gets all aircraft registration that have flown over by airline icao
5349
-	*
5350
-	* @return Array the aircraft list
5351
-	*
5352
-	*/
5348
+	 * Gets all aircraft registration that have flown over by airline icao
5349
+	 *
5350
+	 * @return Array the aircraft list
5351
+	 *
5352
+	 */
5353 5353
 	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
5354 5354
 	{
5355 5355
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5387,11 +5387,11 @@  discard block
 block discarded – undo
5387 5387
 
5388 5388
 
5389 5389
 	/**
5390
-	* Gets all aircraft manufacturer that have flown over by airline icao
5391
-	*
5392
-	* @return Array the aircraft list
5393
-	*
5394
-	*/
5390
+	 * Gets all aircraft manufacturer that have flown over by airline icao
5391
+	 *
5392
+	 * @return Array the aircraft list
5393
+	 *
5394
+	 */
5395 5395
 	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
5396 5396
 	{
5397 5397
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5419,11 +5419,11 @@  discard block
 block discarded – undo
5419 5419
 
5420 5420
 
5421 5421
 	/**
5422
-	* Gets all aircraft types that have flown over by airline icao
5423
-	*
5424
-	* @return Array the aircraft list
5425
-	*
5426
-	*/
5422
+	 * Gets all aircraft types that have flown over by airline icao
5423
+	 *
5424
+	 * @return Array the aircraft list
5425
+	 *
5426
+	 */
5427 5427
 	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
5428 5428
 	{
5429 5429
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5452,11 +5452,11 @@  discard block
 block discarded – undo
5452 5452
 
5453 5453
 
5454 5454
 	/**
5455
-	* Gets all aircraft registration that have flown over by airport icao
5456
-	*
5457
-	* @return Array the aircraft list
5458
-	*
5459
-	*/
5455
+	 * Gets all aircraft registration that have flown over by airport icao
5456
+	 *
5457
+	 * @return Array the aircraft list
5458
+	 *
5459
+	 */
5460 5460
 	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
5461 5461
 	{
5462 5462
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5493,11 +5493,11 @@  discard block
 block discarded – undo
5493 5493
 	
5494 5494
 	
5495 5495
 	/**
5496
-	* Gets all aircraft manufacturer that have flown over by airport icao
5497
-	*
5498
-	* @return Array the aircraft list
5499
-	*
5500
-	*/
5496
+	 * Gets all aircraft manufacturer that have flown over by airport icao
5497
+	 *
5498
+	 * @return Array the aircraft list
5499
+	 *
5500
+	 */
5501 5501
 	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
5502 5502
 	{
5503 5503
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5523,11 +5523,11 @@  discard block
 block discarded – undo
5523 5523
 	}
5524 5524
 
5525 5525
 	/**
5526
-	* Gets all aircraft types that have flown over by aircraft manufacturer
5527
-	*
5528
-	* @return Array the aircraft list
5529
-	*
5530
-	*/
5526
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
5527
+	 *
5528
+	 * @return Array the aircraft list
5529
+	 *
5530
+	 */
5531 5531
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
5532 5532
 	{
5533 5533
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5554,11 +5554,11 @@  discard block
 block discarded – undo
5554 5554
 
5555 5555
 
5556 5556
 	/**
5557
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
5558
-	*
5559
-	* @return Array the aircraft list
5560
-	*
5561
-	*/
5557
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
5558
+	 *
5559
+	 * @return Array the aircraft list
5560
+	 *
5561
+	 */
5562 5562
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
5563 5563
 	{
5564 5564
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5594,11 +5594,11 @@  discard block
 block discarded – undo
5594 5594
 	}
5595 5595
 
5596 5596
 	/**
5597
-	* Gets all aircraft types that have flown over by date
5598
-	*
5599
-	* @return Array the aircraft list
5600
-	*
5601
-	*/
5597
+	 * Gets all aircraft types that have flown over by date
5598
+	 *
5599
+	 * @return Array the aircraft list
5600
+	 *
5601
+	 */
5602 5602
 	public function countAllAircraftTypesByDate($date,$filters = array())
5603 5603
 	{
5604 5604
 		global $globalTimezone, $globalDBdriver;
@@ -5640,11 +5640,11 @@  discard block
 block discarded – undo
5640 5640
 
5641 5641
 
5642 5642
 	/**
5643
-	* Gets all aircraft registration that have flown over by date
5644
-	*
5645
-	* @return Array the aircraft list
5646
-	*
5647
-	*/
5643
+	 * Gets all aircraft registration that have flown over by date
5644
+	 *
5645
+	 * @return Array the aircraft list
5646
+	 *
5647
+	 */
5648 5648
 	public function countAllAircraftRegistrationByDate($date,$filters = array())
5649 5649
 	{
5650 5650
 		global $globalTimezone, $globalDBdriver;
@@ -5695,11 +5695,11 @@  discard block
 block discarded – undo
5695 5695
 
5696 5696
 
5697 5697
 	/**
5698
-	* Gets all aircraft manufacturer that have flown over by date
5699
-	*
5700
-	* @return Array the aircraft manufacturer list
5701
-	*
5702
-	*/
5698
+	 * Gets all aircraft manufacturer that have flown over by date
5699
+	 *
5700
+	 * @return Array the aircraft manufacturer list
5701
+	 *
5702
+	 */
5703 5703
 	public function countAllAircraftManufacturerByDate($date,$filters = array())
5704 5704
 	{
5705 5705
 		global $globalTimezone, $globalDBdriver;
@@ -5741,11 +5741,11 @@  discard block
 block discarded – undo
5741 5741
 
5742 5742
 
5743 5743
 	/**
5744
-	* Gets all aircraft types that have flown over by ident/callsign
5745
-	*
5746
-	* @return Array the aircraft list
5747
-	*
5748
-	*/
5744
+	 * Gets all aircraft types that have flown over by ident/callsign
5745
+	 *
5746
+	 * @return Array the aircraft list
5747
+	 *
5748
+	 */
5749 5749
 	public function countAllAircraftTypesByIdent($ident,$filters = array())
5750 5750
 	{
5751 5751
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5773,11 +5773,11 @@  discard block
 block discarded – undo
5773 5773
 	}
5774 5774
 
5775 5775
 	/**
5776
-	* Gets all aircraft types that have flown over by pilot
5777
-	*
5778
-	* @return Array the aircraft list
5779
-	*
5780
-	*/
5776
+	 * Gets all aircraft types that have flown over by pilot
5777
+	 *
5778
+	 * @return Array the aircraft list
5779
+	 *
5780
+	 */
5781 5781
 	public function countAllAircraftTypesByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
5782 5782
 	{
5783 5783
 		global $globalDBdriver;
@@ -5823,11 +5823,11 @@  discard block
 block discarded – undo
5823 5823
 	}
5824 5824
 
5825 5825
 	/**
5826
-	* Gets all aircraft types that have flown over by owner
5827
-	*
5828
-	* @return Array the aircraft list
5829
-	*
5830
-	*/
5826
+	 * Gets all aircraft types that have flown over by owner
5827
+	 *
5828
+	 * @return Array the aircraft list
5829
+	 *
5830
+	 */
5831 5831
 	public function countAllAircraftTypesByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
5832 5832
 	{
5833 5833
 		global $globalDBdriver;
@@ -5872,11 +5872,11 @@  discard block
 block discarded – undo
5872 5872
 	}
5873 5873
 
5874 5874
 	/**
5875
-	* Gets all aircraft registration that have flown over by ident/callsign
5876
-	*
5877
-	* @return Array the aircraft list
5878
-	*
5879
-	*/
5875
+	 * Gets all aircraft registration that have flown over by ident/callsign
5876
+	 *
5877
+	 * @return Array the aircraft list
5878
+	 *
5879
+	 */
5880 5880
 	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5881 5881
 	{
5882 5882
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5915,11 +5915,11 @@  discard block
 block discarded – undo
5915 5915
 	}
5916 5916
 
5917 5917
 	/**
5918
-	* Gets all aircraft registration that have flown over by owner
5919
-	*
5920
-	* @return Array the aircraft list
5921
-	*
5922
-	*/
5918
+	 * Gets all aircraft registration that have flown over by owner
5919
+	 *
5920
+	 * @return Array the aircraft list
5921
+	 *
5922
+	 */
5923 5923
 	public function countAllAircraftRegistrationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
5924 5924
 	{
5925 5925
 		global $globalDBdriver;
@@ -5990,11 +5990,11 @@  discard block
 block discarded – undo
5990 5990
 	}
5991 5991
 
5992 5992
 	/**
5993
-	* Gets all aircraft registration that have flown over by pilot
5994
-	*
5995
-	* @return Array the aircraft list
5996
-	*
5997
-	*/
5993
+	 * Gets all aircraft registration that have flown over by pilot
5994
+	 *
5995
+	 * @return Array the aircraft list
5996
+	 *
5997
+	 */
5998 5998
 	public function countAllAircraftRegistrationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
5999 5999
 	{
6000 6000
 		global $globalDBdriver;
@@ -6066,11 +6066,11 @@  discard block
 block discarded – undo
6066 6066
 
6067 6067
 
6068 6068
 	/**
6069
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
6070
-	*
6071
-	* @return Array the aircraft manufacturer list
6072
-	*
6073
-	*/
6069
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
6070
+	 *
6071
+	 * @return Array the aircraft manufacturer list
6072
+	 *
6073
+	 */
6074 6074
 	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
6075 6075
 	{
6076 6076
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6095,11 +6095,11 @@  discard block
 block discarded – undo
6095 6095
 	}
6096 6096
 
6097 6097
 	/**
6098
-	* Gets all aircraft manufacturer that have flown over by owner
6099
-	*
6100
-	* @return Array the aircraft manufacturer list
6101
-	*
6102
-	*/
6098
+	 * Gets all aircraft manufacturer that have flown over by owner
6099
+	 *
6100
+	 * @return Array the aircraft manufacturer list
6101
+	 *
6102
+	 */
6103 6103
 	public function countAllAircraftManufacturerByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
6104 6104
 	{
6105 6105
 		global $globalDBdriver;
@@ -6147,11 +6147,11 @@  discard block
 block discarded – undo
6147 6147
 	}
6148 6148
 
6149 6149
 	/**
6150
-	* Gets all aircraft manufacturer that have flown over by pilot
6151
-	*
6152
-	* @return Array the aircraft manufacturer list
6153
-	*
6154
-	*/
6150
+	 * Gets all aircraft manufacturer that have flown over by pilot
6151
+	 *
6152
+	 * @return Array the aircraft manufacturer list
6153
+	 *
6154
+	 */
6155 6155
 	public function countAllAircraftManufacturerByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
6156 6156
 	{
6157 6157
 		global $globalDBdriver;
@@ -6200,11 +6200,11 @@  discard block
 block discarded – undo
6200 6200
 
6201 6201
 
6202 6202
 	/**
6203
-	* Gets all aircraft types that have flown over by route
6204
-	*
6205
-	* @return Array the aircraft list
6206
-	*
6207
-	*/
6203
+	 * Gets all aircraft types that have flown over by route
6204
+	 *
6205
+	 * @return Array the aircraft list
6206
+	 *
6207
+	 */
6208 6208
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6209 6209
 	{
6210 6210
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6233,11 +6233,11 @@  discard block
 block discarded – undo
6233 6233
 	}
6234 6234
 
6235 6235
 	/**
6236
-	* Gets all aircraft registration that have flown over by route
6237
-	*
6238
-	* @return Array the aircraft list
6239
-	*
6240
-	*/
6236
+	 * Gets all aircraft registration that have flown over by route
6237
+	 *
6238
+	 * @return Array the aircraft list
6239
+	 *
6240
+	 */
6241 6241
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6242 6242
 	{
6243 6243
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6279,11 +6279,11 @@  discard block
 block discarded – undo
6279 6279
 	
6280 6280
 	
6281 6281
 	/**
6282
-	* Gets all aircraft manufacturer that have flown over by route
6283
-	*
6284
-	* @return Array the aircraft manufacturer list
6285
-	*
6286
-	*/
6282
+	 * Gets all aircraft manufacturer that have flown over by route
6283
+	 *
6284
+	 * @return Array the aircraft manufacturer list
6285
+	 *
6286
+	 */
6287 6287
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6288 6288
 	{
6289 6289
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6317,11 +6317,11 @@  discard block
 block discarded – undo
6317 6317
 	
6318 6318
 	
6319 6319
 	/**
6320
-	* Gets all aircraft types that have flown over by country
6321
-	*
6322
-	* @return Array the aircraft list
6323
-	*
6324
-	*/
6320
+	 * Gets all aircraft types that have flown over by country
6321
+	 *
6322
+	 * @return Array the aircraft list
6323
+	 *
6324
+	 */
6325 6325
 	public function countAllAircraftTypesByCountry($country,$filters = array())
6326 6326
 	{
6327 6327
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6352,11 +6352,11 @@  discard block
 block discarded – undo
6352 6352
 
6353 6353
 
6354 6354
 	/**
6355
-	* Gets all aircraft registration that have flown over by country
6356
-	*
6357
-	* @return Array the aircraft list
6358
-	*
6359
-	*/
6355
+	 * Gets all aircraft registration that have flown over by country
6356
+	 *
6357
+	 * @return Array the aircraft list
6358
+	 *
6359
+	 */
6360 6360
 	public function countAllAircraftRegistrationByCountry($country,$filters = array())
6361 6361
 	{
6362 6362
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6396,11 +6396,11 @@  discard block
 block discarded – undo
6396 6396
 	
6397 6397
 	
6398 6398
 	/**
6399
-	* Gets all aircraft manufacturer that have flown over by country
6400
-	*
6401
-	* @return Array the aircraft manufacturer list
6402
-	*
6403
-	*/
6399
+	 * Gets all aircraft manufacturer that have flown over by country
6400
+	 *
6401
+	 * @return Array the aircraft manufacturer list
6402
+	 *
6403
+	 */
6404 6404
 	public function countAllAircraftManufacturerByCountry($country,$filters = array())
6405 6405
 	{
6406 6406
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6431,18 +6431,18 @@  discard block
 block discarded – undo
6431 6431
 	
6432 6432
 	
6433 6433
 	/**
6434
-	* Gets all aircraft manufacturers that have flown over
6435
-	*
6436
-	* @return Array the aircraft list
6437
-	*
6438
-	*/
6434
+	 * Gets all aircraft manufacturers that have flown over
6435
+	 *
6436
+	 * @return Array the aircraft list
6437
+	 *
6438
+	 */
6439 6439
 	public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '')
6440 6440
 	{
6441 6441
 		global $globalDBdriver;
6442 6442
 		$filter_query = $this->getFilter($filters,true,true);
6443 6443
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6444 6444
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
6445
-                $query_values = array();
6445
+				$query_values = array();
6446 6446
 		if ($year != '') {
6447 6447
 			if ($globalDBdriver == 'mysql') {
6448 6448
 				$query .= " AND YEAR(spotter_output.date) = :year";
@@ -6495,11 +6495,11 @@  discard block
 block discarded – undo
6495 6495
 	
6496 6496
 	
6497 6497
 	/**
6498
-	* Gets all aircraft registrations that have flown over
6499
-	*
6500
-	* @return Array the aircraft list
6501
-	*
6502
-	*/
6498
+	 * Gets all aircraft registrations that have flown over
6499
+	 *
6500
+	 * @return Array the aircraft list
6501
+	 *
6502
+	 */
6503 6503
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
6504 6504
 	{
6505 6505
 		global $globalDBdriver;
@@ -6507,15 +6507,15 @@  discard block
 block discarded – undo
6507 6507
 		$filter_query = $this->getFilter($filters,true,true);
6508 6508
 		$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    
6509 6509
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
6510
-                if ($olderthanmonths > 0) {
6511
-            		if ($globalDBdriver == 'mysql') {
6510
+				if ($olderthanmonths > 0) {
6511
+					if ($globalDBdriver == 'mysql') {
6512 6512
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6513 6513
 			} else {
6514 6514
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6515 6515
 			}
6516 6516
 		}
6517
-                if ($sincedate != '') {
6518
-            		if ($globalDBdriver == 'mysql') {
6517
+				if ($sincedate != '') {
6518
+					if ($globalDBdriver == 'mysql') {
6519 6519
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6520 6520
 			} else {
6521 6521
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6580,11 +6580,11 @@  discard block
 block discarded – undo
6580 6580
 
6581 6581
 
6582 6582
 	/**
6583
-	* Gets all aircraft registrations that have flown over
6584
-	*
6585
-	* @return Array the aircraft list
6586
-	*
6587
-	*/
6583
+	 * Gets all aircraft registrations that have flown over
6584
+	 *
6585
+	 * @return Array the aircraft list
6586
+	 *
6587
+	 */
6588 6588
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
6589 6589
 	{
6590 6590
 		global $globalDBdriver;
@@ -6592,15 +6592,15 @@  discard block
 block discarded – undo
6592 6592
 		$Image = new Image($this->db);
6593 6593
 		$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    
6594 6594
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
6595
-                if ($olderthanmonths > 0) {
6596
-            		if ($globalDBdriver == 'mysql') {
6595
+				if ($olderthanmonths > 0) {
6596
+					if ($globalDBdriver == 'mysql') {
6597 6597
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6598 6598
 			} else {
6599 6599
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6600 6600
 			}
6601 6601
 		}
6602
-                if ($sincedate != '') {
6603
-            		if ($globalDBdriver == 'mysql') {
6602
+				if ($sincedate != '') {
6603
+					if ($globalDBdriver == 'mysql') {
6604 6604
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6605 6605
 			} else {
6606 6606
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6609,7 +6609,7 @@  discard block
 block discarded – undo
6609 6609
 
6610 6610
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6611 6611
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6612
-                $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";
6612
+				$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";
6613 6613
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6614 6614
 		
6615 6615
 		$sth = $this->db->prepare($query);
@@ -6641,26 +6641,26 @@  discard block
 block discarded – undo
6641 6641
 	
6642 6642
 	
6643 6643
 	/**
6644
-	* Gets all departure airports of the airplanes that have flown over
6645
-	*
6646
-	* @return Array the airport list
6647
-	*
6648
-	*/
6644
+	 * Gets all departure airports of the airplanes that have flown over
6645
+	 *
6646
+	 * @return Array the airport list
6647
+	 *
6648
+	 */
6649 6649
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6650 6650
 	{
6651 6651
 		global $globalDBdriver;
6652 6652
 		$filter_query = $this->getFilter($filters,true,true);
6653 6653
 		$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, airport.latitude, airport.longitude
6654 6654
 				FROM airport, spotter_output".$filter_query." airport.icao = spotter_output.departure_airport_icao AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
6655
-                if ($olderthanmonths > 0) {
6656
-            		if ($globalDBdriver == 'mysql') {
6655
+				if ($olderthanmonths > 0) {
6656
+					if ($globalDBdriver == 'mysql') {
6657 6657
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6658 6658
 			} else {
6659 6659
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6660 6660
 			}
6661
-                }
6662
-                if ($sincedate != '') {
6663
-            		if ($globalDBdriver == 'mysql') {
6661
+				}
6662
+				if ($sincedate != '') {
6663
+					if ($globalDBdriver == 'mysql') {
6664 6664
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6665 6665
 			} else {
6666 6666
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6694,7 +6694,7 @@  discard block
 block discarded – undo
6694 6694
 				$query_values = array_merge($query_values,array(':day' => $day));
6695 6695
 			}
6696 6696
 		}
6697
-                $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, airport.latitude, airport.longitude
6697
+				$query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, airport.latitude, airport.longitude
6698 6698
 				ORDER BY airport_departure_icao_count DESC";
6699 6699
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6700 6700
 
@@ -6718,35 +6718,35 @@  discard block
 block discarded – undo
6718 6718
 	}
6719 6719
 
6720 6720
 	/**
6721
-	* Gets all departure airports of the airplanes that have flown over
6722
-	*
6723
-	* @return Array the airport list
6724
-	*
6725
-	*/
6721
+	 * Gets all departure airports of the airplanes that have flown over
6722
+	 *
6723
+	 * @return Array the airport list
6724
+	 *
6725
+	 */
6726 6726
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6727 6727
 	{
6728 6728
 		global $globalDBdriver;
6729 6729
 		$filter_query = $this->getFilter($filters,true,true);
6730 6730
 		$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 
6731 6731
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' ";
6732
-                if ($olderthanmonths > 0) {
6733
-            		if ($globalDBdriver == 'mysql') {
6732
+				if ($olderthanmonths > 0) {
6733
+					if ($globalDBdriver == 'mysql') {
6734 6734
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6735 6735
 			} else {
6736 6736
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6737 6737
 			}
6738
-                }
6739
-                if ($sincedate != '') {
6740
-            		if ($globalDBdriver == 'mysql') {
6738
+				}
6739
+				if ($sincedate != '') {
6740
+					if ($globalDBdriver == 'mysql') {
6741 6741
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6742 6742
 			} else {
6743 6743
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6744 6744
 			}
6745 6745
 		}
6746 6746
 
6747
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6748
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6749
-                $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
6747
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6748
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6749
+				$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
6750 6750
 				ORDER BY airport_departure_icao_count DESC";
6751 6751
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6752 6752
       
@@ -6771,26 +6771,26 @@  discard block
 block discarded – undo
6771 6771
 	}
6772 6772
 
6773 6773
 	/**
6774
-	* Gets all detected departure airports of the airplanes that have flown over
6775
-	*
6776
-	* @return Array the airport list
6777
-	*
6778
-	*/
6774
+	 * Gets all detected departure airports of the airplanes that have flown over
6775
+	 *
6776
+	 * @return Array the airport list
6777
+	 *
6778
+	 */
6779 6779
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6780 6780
 	{
6781 6781
 		global $globalDBdriver;
6782 6782
 		$filter_query = $this->getFilter($filters,true,true);
6783 6783
 		$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, airport.latitude as departure_airport_latitude, airport.longitude as departure_airport.longitude
6784 6784
 				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";
6785
-                if ($olderthanmonths > 0) {
6786
-            		if ($globalDBdriver == 'mysql') {
6785
+				if ($olderthanmonths > 0) {
6786
+					if ($globalDBdriver == 'mysql') {
6787 6787
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6788 6788
 			} else {
6789 6789
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6790 6790
 			}
6791
-                }
6792
-                if ($sincedate != '') {
6793
-            		if ($globalDBdriver == 'mysql') {
6791
+				}
6792
+				if ($sincedate != '') {
6793
+					if ($globalDBdriver == 'mysql') {
6794 6794
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6795 6795
 			} else {
6796 6796
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6824,10 +6824,10 @@  discard block
 block discarded – undo
6824 6824
 				$query_values = array_merge($query_values,array(':day' => $day));
6825 6825
 			}
6826 6826
 		}
6827
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country, airport.latitude, airport.longitude
6827
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country, airport.latitude, airport.longitude
6828 6828
 				ORDER BY airport_departure_icao_count DESC";
6829 6829
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6830
-    		//echo $query;
6830
+			//echo $query;
6831 6831
 		$sth = $this->db->prepare($query);
6832 6832
 		$sth->execute($query_values);
6833 6833
       
@@ -6850,35 +6850,35 @@  discard block
 block discarded – undo
6850 6850
 	}
6851 6851
 	
6852 6852
 	/**
6853
-	* Gets all detected departure airports of the airplanes that have flown over
6854
-	*
6855
-	* @return Array the airport list
6856
-	*
6857
-	*/
6853
+	 * Gets all detected departure airports of the airplanes that have flown over
6854
+	 *
6855
+	 * @return Array the airport list
6856
+	 *
6857
+	 */
6858 6858
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6859 6859
 	{
6860 6860
 		global $globalDBdriver;
6861 6861
 		$filter_query = $this->getFilter($filters,true,true);
6862 6862
 		$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
6863 6863
 				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 ";
6864
-                if ($olderthanmonths > 0) {
6865
-            		if ($globalDBdriver == 'mysql') {
6864
+				if ($olderthanmonths > 0) {
6865
+					if ($globalDBdriver == 'mysql') {
6866 6866
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6867 6867
 			} else {
6868 6868
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6869 6869
 			}
6870
-                }
6871
-                if ($sincedate != '') {
6872
-            		if ($globalDBdriver == 'mysql') {
6870
+				}
6871
+				if ($sincedate != '') {
6872
+					if ($globalDBdriver == 'mysql') {
6873 6873
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6874 6874
 			} else {
6875 6875
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
6876 6876
 			}
6877 6877
 		}
6878 6878
 
6879
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6880
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6881
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6879
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6880
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6881
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6882 6882
 				ORDER BY airport_departure_icao_count DESC";
6883 6883
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6884 6884
       
@@ -6903,11 +6903,11 @@  discard block
 block discarded – undo
6903 6903
 	}	
6904 6904
 	
6905 6905
 	/**
6906
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
6907
-	*
6908
-	* @return Array the airport list
6909
-	*
6910
-	*/
6906
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
6907
+	 *
6908
+	 * @return Array the airport list
6909
+	 *
6910
+	 */
6911 6911
 	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
6912 6912
 	{
6913 6913
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6941,11 +6941,11 @@  discard block
 block discarded – undo
6941 6941
 	
6942 6942
 	
6943 6943
 	/**
6944
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
6945
-	*
6946
-	* @return Array the airport list
6947
-	*
6948
-	*/
6944
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
6945
+	 *
6946
+	 * @return Array the airport list
6947
+	 *
6948
+	 */
6949 6949
 	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
6950 6950
 	{
6951 6951
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6976,11 +6976,11 @@  discard block
 block discarded – undo
6976 6976
 	
6977 6977
 	
6978 6978
 	/**
6979
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
6980
-	*
6981
-	* @return Array the airport list
6982
-	*
6983
-	*/
6979
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
6980
+	 *
6981
+	 * @return Array the airport list
6982
+	 *
6983
+	 */
6984 6984
 	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
6985 6985
 	{
6986 6986
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7013,11 +7013,11 @@  discard block
 block discarded – undo
7013 7013
 	
7014 7014
 	
7015 7015
 	/**
7016
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7017
-	*
7018
-	* @return Array the airport list
7019
-	*
7020
-	*/
7016
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7017
+	 *
7018
+	 * @return Array the airport list
7019
+	 *
7020
+	 */
7021 7021
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
7022 7022
 	{
7023 7023
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7047,11 +7047,11 @@  discard block
 block discarded – undo
7047 7047
 	
7048 7048
 	
7049 7049
 	/**
7050
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
7051
-	*
7052
-	* @return Array the airport list
7053
-	*
7054
-	*/
7050
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
7051
+	 *
7052
+	 * @return Array the airport list
7053
+	 *
7054
+	 */
7055 7055
 	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
7056 7056
 	{
7057 7057
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7084,11 +7084,11 @@  discard block
 block discarded – undo
7084 7084
 	
7085 7085
 	
7086 7086
 	/**
7087
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
7088
-	*
7089
-	* @return Array the airport list
7090
-	*
7091
-	*/
7087
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
7088
+	 *
7089
+	 * @return Array the airport list
7090
+	 *
7091
+	 */
7092 7092
 	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
7093 7093
 	{
7094 7094
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7118,11 +7118,11 @@  discard block
 block discarded – undo
7118 7118
 	
7119 7119
 	
7120 7120
 	/**
7121
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
7122
-	*
7123
-	* @return Array the airport list
7124
-	*
7125
-	*/
7121
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
7122
+	 *
7123
+	 * @return Array the airport list
7124
+	 *
7125
+	 */
7126 7126
 	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
7127 7127
 	{
7128 7128
 		$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 departure airports by country of the airplanes that have flown over based on an airport icao
7159
-	*
7160
-	* @return Array the airport list
7161
-	*
7162
-	*/
7158
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
7159
+	 *
7160
+	 * @return Array the airport list
7161
+	 *
7162
+	 */
7163 7163
 	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
7164 7164
 	{
7165 7165
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7190,11 +7190,11 @@  discard block
 block discarded – undo
7190 7190
 	
7191 7191
 	
7192 7192
 	/**
7193
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
7194
-	*
7195
-	* @return Array the airport list
7196
-	*
7197
-	*/
7193
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
7194
+	 *
7195
+	 * @return Array the airport list
7196
+	 *
7197
+	 */
7198 7198
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
7199 7199
 	{
7200 7200
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7227,11 +7227,11 @@  discard block
 block discarded – undo
7227 7227
 	
7228 7228
 	
7229 7229
 	/**
7230
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
7231
-	*
7232
-	* @return Array the airport list
7233
-	*
7234
-	*/
7230
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
7231
+	 *
7232
+	 * @return Array the airport list
7233
+	 *
7234
+	 */
7235 7235
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$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
-	* Gets all departure airports of the airplanes that have flown over based on a date
7265
-	*
7266
-	* @return Array the airport list
7267
-	*
7268
-	*/
7264
+	 * Gets all departure airports of the airplanes that have flown over based on a date
7265
+	 *
7266
+	 * @return Array the airport list
7267
+	 *
7268
+	 */
7269 7269
 	public function countAllDepartureAirportsByDate($date,$filters = array())
7270 7270
 	{
7271 7271
 		global $globalTimezone, $globalDBdriver;
@@ -7311,11 +7311,11 @@  discard block
 block discarded – undo
7311 7311
 	
7312 7312
 	
7313 7313
 	/**
7314
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
7315
-	*
7316
-	* @return Array the airport list
7317
-	*
7318
-	*/
7314
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
7315
+	 *
7316
+	 * @return Array the airport list
7317
+	 *
7318
+	 */
7319 7319
 	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
7320 7320
 	{
7321 7321
 		global $globalTimezone, $globalDBdriver;
@@ -7358,11 +7358,11 @@  discard block
 block discarded – undo
7358 7358
 	
7359 7359
 	
7360 7360
 	/**
7361
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
7362
-	*
7363
-	* @return Array the airport list
7364
-	*
7365
-	*/
7361
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
7362
+	 *
7363
+	 * @return Array the airport list
7364
+	 *
7365
+	 */
7366 7366
 	public function countAllDepartureAirportsByIdent($ident,$filters = array())
7367 7367
 	{
7368 7368
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7394,11 +7394,11 @@  discard block
 block discarded – undo
7394 7394
 	}
7395 7395
 	
7396 7396
 	/**
7397
-	* Gets all departure airports of the airplanes that have flown over based on a owner
7398
-	*
7399
-	* @return Array the airport list
7400
-	*
7401
-	*/
7397
+	 * Gets all departure airports of the airplanes that have flown over based on a owner
7398
+	 *
7399
+	 * @return Array the airport list
7400
+	 *
7401
+	 */
7402 7402
 	public function countAllDepartureAirportsByOwner($owner,$filters = array())
7403 7403
 	{
7404 7404
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7430,11 +7430,11 @@  discard block
 block discarded – undo
7430 7430
 	}
7431 7431
 	
7432 7432
 	/**
7433
-	* Gets all departure airports of the airplanes that have flown over based on a pilot
7434
-	*
7435
-	* @return Array the airport list
7436
-	*
7437
-	*/
7433
+	 * Gets all departure airports of the airplanes that have flown over based on a pilot
7434
+	 *
7435
+	 * @return Array the airport list
7436
+	 *
7437
+	 */
7438 7438
 	public function countAllDepartureAirportsByPilot($pilot,$filters = array())
7439 7439
 	{
7440 7440
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7467,11 +7467,11 @@  discard block
 block discarded – undo
7467 7467
 	
7468 7468
 	
7469 7469
 	/**
7470
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
7471
-	*
7472
-	* @return Array the airport list
7473
-	*
7474
-	*/
7470
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
7471
+	 *
7472
+	 * @return Array the airport list
7473
+	 *
7474
+	 */
7475 7475
 	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
7476 7476
 	{
7477 7477
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7500,11 +7500,11 @@  discard block
 block discarded – undo
7500 7500
 	}
7501 7501
 	
7502 7502
 	/**
7503
-	* Gets all departure airports by country of the airplanes that have flown over based on owner
7504
-	*
7505
-	* @return Array the airport list
7506
-	*
7507
-	*/
7503
+	 * Gets all departure airports by country of the airplanes that have flown over based on owner
7504
+	 *
7505
+	 * @return Array the airport list
7506
+	 *
7507
+	 */
7508 7508
 	public function countAllDepartureAirportCountriesByOwner($owner,$filters = array())
7509 7509
 	{
7510 7510
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7520,11 +7520,11 @@  discard block
 block discarded – undo
7520 7520
 	}
7521 7521
 	
7522 7522
 	/**
7523
-	* Gets all departure airports by country of the airplanes that have flown over based on pilot
7524
-	*
7525
-	* @return Array the airport list
7526
-	*
7527
-	*/
7523
+	 * Gets all departure airports by country of the airplanes that have flown over based on pilot
7524
+	 *
7525
+	 * @return Array the airport list
7526
+	 *
7527
+	 */
7528 7528
 	public function countAllDepartureAirportCountriesByPilot($pilot,$filters = array())
7529 7529
 	{
7530 7530
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7542,11 +7542,11 @@  discard block
 block discarded – undo
7542 7542
 	
7543 7543
 	
7544 7544
 	/**
7545
-	* Gets all departure airports of the airplanes that have flown over based on a country
7546
-	*
7547
-	* @return Array the airport list
7548
-	*
7549
-	*/
7545
+	 * Gets all departure airports of the airplanes that have flown over based on a country
7546
+	 *
7547
+	 * @return Array the airport list
7548
+	 *
7549
+	 */
7550 7550
 	public function countAllDepartureAirportsByCountry($country,$filters = array())
7551 7551
 	{
7552 7552
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7580,11 +7580,11 @@  discard block
 block discarded – undo
7580 7580
 
7581 7581
 
7582 7582
 	/**
7583
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7584
-	*
7585
-	* @return Array the airport list
7586
-	*
7587
-	*/
7583
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7584
+	 *
7585
+	 * @return Array the airport list
7586
+	 *
7587
+	 */
7588 7588
 	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
7589 7589
 	{
7590 7590
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7614,31 +7614,31 @@  discard block
 block discarded – undo
7614 7614
 	
7615 7615
 
7616 7616
 	/**
7617
-	* Gets all arrival airports of the airplanes that have flown over
7618
-	*
7619
-	* @param Boolean $limit Limit result to 10 or not
7620
-	* @param Integer $olderthanmonths Only show result older than x months
7621
-	* @param String $sincedate Only show result since x date
7622
-	* @param Boolean $icaoaskey Show result by ICAO
7623
-	* @param Array $filters Filter used here
7624
-	* @return Array the airport list
7625
-	*
7626
-	*/
7617
+	 * Gets all arrival airports of the airplanes that have flown over
7618
+	 *
7619
+	 * @param Boolean $limit Limit result to 10 or not
7620
+	 * @param Integer $olderthanmonths Only show result older than x months
7621
+	 * @param String $sincedate Only show result since x date
7622
+	 * @param Boolean $icaoaskey Show result by ICAO
7623
+	 * @param Array $filters Filter used here
7624
+	 * @return Array the airport list
7625
+	 *
7626
+	 */
7627 7627
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7628 7628
 	{
7629 7629
 		global $globalDBdriver;
7630 7630
 		$filter_query = $this->getFilter($filters,true,true);
7631 7631
 		$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, airport.latitude as arrival_airport_latitude, airport.longitude as arrival_airport_longitude 
7632 7632
 				FROM airport, spotter_output".$filter_query." airport.icao = spotter_output.arrival_airport_icao AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
7633
-                if ($olderthanmonths > 0) {
7634
-            		if ($globalDBdriver == 'mysql') {
7633
+				if ($olderthanmonths > 0) {
7634
+					if ($globalDBdriver == 'mysql') {
7635 7635
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
7636 7636
 			} else {
7637 7637
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7638 7638
 			}
7639 7639
 		}
7640
-                if ($sincedate != '') {
7641
-            		if ($globalDBdriver == 'mysql') {
7640
+				if ($sincedate != '') {
7641
+					if ($globalDBdriver == 'mysql') {
7642 7642
 				$query .= " AND spotter_output.date > '".$sincedate."'";
7643 7643
 			} else {
7644 7644
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -7672,7 +7672,7 @@  discard block
 block discarded – undo
7672 7672
 				$query_values = array_merge($query_values,array(':day' => $day));
7673 7673
 			}
7674 7674
 		}
7675
-                $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, airport.latitude, airport.longitude
7675
+				$query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, airport.latitude, airport.longitude
7676 7676
 					ORDER BY airport_arrival_icao_count DESC";
7677 7677
 		if ($limit) $query .= " LIMIT 10";
7678 7678
       
@@ -7703,35 +7703,35 @@  discard block
 block discarded – undo
7703 7703
 	}
7704 7704
 
7705 7705
 	/**
7706
-	* Gets all arrival airports of the airplanes that have flown over
7707
-	*
7708
-	* @return Array the airport list
7709
-	*
7710
-	*/
7706
+	 * Gets all arrival airports of the airplanes that have flown over
7707
+	 *
7708
+	 * @return Array the airport list
7709
+	 *
7710
+	 */
7711 7711
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
7712 7712
 	{
7713 7713
 		global $globalDBdriver;
7714 7714
 		$filter_query = $this->getFilter($filters,true,true);
7715 7715
 		$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 
7716 7716
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' ";
7717
-                if ($olderthanmonths > 0) {
7718
-            		if ($globalDBdriver == 'mysql') {
7717
+				if ($olderthanmonths > 0) {
7718
+					if ($globalDBdriver == 'mysql') {
7719 7719
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
7720 7720
 			} else {
7721 7721
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7722 7722
 			}
7723 7723
 		}
7724
-                if ($sincedate != '') {
7725
-            		if ($globalDBdriver == 'mysql') {
7724
+				if ($sincedate != '') {
7725
+					if ($globalDBdriver == 'mysql') {
7726 7726
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
7727 7727
 			} else {
7728 7728
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7729 7729
 			}
7730 7730
 		}
7731 7731
 
7732
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7733
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7734
-                $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
7732
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7733
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7734
+				$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
7735 7735
 					ORDER BY airport_arrival_icao_count DESC";
7736 7736
 		if ($limit) $query .= " LIMIT 10";
7737 7737
       
@@ -7762,26 +7762,26 @@  discard block
 block discarded – undo
7762 7762
 
7763 7763
 
7764 7764
 	/**
7765
-	* Gets all detected arrival airports of the airplanes that have flown over
7766
-	*
7767
-	* @return Array the airport list
7768
-	*
7769
-	*/
7765
+	 * Gets all detected arrival airports of the airplanes that have flown over
7766
+	 *
7767
+	 * @return Array the airport list
7768
+	 *
7769
+	 */
7770 7770
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7771 7771
 	{
7772 7772
 		global $globalDBdriver;
7773 7773
 		$filter_query = $this->getFilter($filters,true,true);
7774 7774
 		$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, airport.latitude AS arrival_airport_latitude, airport.longitude AS arrival_airport_longitude 
7775 7775
 			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";
7776
-                if ($olderthanmonths > 0) {
7777
-            		if ($globalDBdriver == 'mysql') {
7776
+				if ($olderthanmonths > 0) {
7777
+					if ($globalDBdriver == 'mysql') {
7778 7778
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
7779 7779
 			} else {
7780 7780
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7781 7781
 			}
7782 7782
 		}
7783
-                if ($sincedate != '') {
7784
-            		if ($globalDBdriver == 'mysql') {
7783
+				if ($sincedate != '') {
7784
+					if ($globalDBdriver == 'mysql') {
7785 7785
 				$query .= " AND spotter_output.date > '".$sincedate."'";
7786 7786
 			} else {
7787 7787
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -7843,35 +7843,35 @@  discard block
 block discarded – undo
7843 7843
 	}
7844 7844
 	
7845 7845
 	/**
7846
-	* Gets all detected arrival airports of the airplanes that have flown over
7847
-	*
7848
-	* @return Array the airport list
7849
-	*
7850
-	*/
7846
+	 * Gets all detected arrival airports of the airplanes that have flown over
7847
+	 *
7848
+	 * @return Array the airport list
7849
+	 *
7850
+	 */
7851 7851
 	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
7852 7852
 	{
7853 7853
 		global $globalDBdriver;
7854 7854
 		$filter_query = $this->getFilter($filters,true,true);
7855 7855
 		$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 
7856 7856
 			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 ";
7857
-                if ($olderthanmonths > 0) {
7858
-            		if ($globalDBdriver == 'mysql') {
7857
+				if ($olderthanmonths > 0) {
7858
+					if ($globalDBdriver == 'mysql') {
7859 7859
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
7860 7860
 			} else {
7861 7861
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7862 7862
 			}
7863 7863
 		}
7864
-                if ($sincedate != '') {
7865
-            		if ($globalDBdriver == 'mysql') {
7864
+				if ($sincedate != '') {
7865
+					if ($globalDBdriver == 'mysql') {
7866 7866
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
7867 7867
 			} else {
7868 7868
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7869 7869
 			}
7870 7870
 		}
7871 7871
 
7872
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7873
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7874
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7872
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7873
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7874
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7875 7875
 					ORDER BY airport_arrival_icao_count DESC";
7876 7876
 		if ($limit) $query .= " LIMIT 10";
7877 7877
       
@@ -7901,11 +7901,11 @@  discard block
 block discarded – undo
7901 7901
 	}	
7902 7902
 	
7903 7903
 	/**
7904
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
7905
-	*
7906
-	* @return Array the airport list
7907
-	*
7908
-	*/
7904
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
7905
+	 *
7906
+	 * @return Array the airport list
7907
+	 *
7908
+	 */
7909 7909
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
7910 7910
 	{
7911 7911
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7937,11 +7937,11 @@  discard block
 block discarded – undo
7937 7937
 	
7938 7938
 	
7939 7939
 	/**
7940
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
7941
-	*
7942
-	* @return Array the airport list
7943
-	*
7944
-	*/
7940
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
7941
+	 *
7942
+	 * @return Array the airport list
7943
+	 *
7944
+	 */
7945 7945
 	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
7946 7946
 	{
7947 7947
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7972,11 +7972,11 @@  discard block
 block discarded – undo
7972 7972
 	
7973 7973
 	
7974 7974
 	/**
7975
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
7976
-	*
7977
-	* @return Array the airport list
7978
-	*
7979
-	*/
7975
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
7976
+	 *
7977
+	 * @return Array the airport list
7978
+	 *
7979
+	 */
7980 7980
 	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
7981 7981
 	{
7982 7982
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8010,11 +8010,11 @@  discard block
 block discarded – undo
8010 8010
 	
8011 8011
 	
8012 8012
 	/**
8013
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
8014
-	*
8015
-	* @return Array the airport list
8016
-	*
8017
-	*/
8013
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
8014
+	 *
8015
+	 * @return Array the airport list
8016
+	 *
8017
+	 */
8018 8018
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
8019 8019
 	{
8020 8020
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8044,11 +8044,11 @@  discard block
 block discarded – undo
8044 8044
 	
8045 8045
 	
8046 8046
 	/**
8047
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
8048
-	*
8049
-	* @return Array the airport list
8050
-	*
8051
-	*/
8047
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
8048
+	 *
8049
+	 * @return Array the airport list
8050
+	 *
8051
+	 */
8052 8052
 	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
8053 8053
 	{
8054 8054
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8082,11 +8082,11 @@  discard block
 block discarded – undo
8082 8082
 	
8083 8083
 	
8084 8084
 	/**
8085
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
8086
-	*
8087
-	* @return Array the airport list
8088
-	*
8089
-	*/
8085
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
8086
+	 *
8087
+	 * @return Array the airport list
8088
+	 *
8089
+	 */
8090 8090
 	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
8091 8091
 	{
8092 8092
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8117,11 +8117,11 @@  discard block
 block discarded – undo
8117 8117
 	
8118 8118
 	
8119 8119
 	/**
8120
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
8121
-	*
8122
-	* @return Array the airport list
8123
-	*
8124
-	*/
8120
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
8121
+	 *
8122
+	 * @return Array the airport list
8123
+	 *
8124
+	 */
8125 8125
 	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
8126 8126
 	{
8127 8127
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8154,11 +8154,11 @@  discard block
 block discarded – undo
8154 8154
 	
8155 8155
 	
8156 8156
 	/**
8157
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
8158
-	*
8159
-	* @return Array the airport list
8160
-	*
8161
-	*/
8157
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
8158
+	 *
8159
+	 * @return Array the airport list
8160
+	 *
8161
+	 */
8162 8162
 	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
8163 8163
 	{
8164 8164
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8188,11 +8188,11 @@  discard block
 block discarded – undo
8188 8188
 	
8189 8189
 	
8190 8190
 	/**
8191
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
8192
-	*
8193
-	* @return Array the airport list
8194
-	*
8195
-	*/
8191
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
8192
+	 *
8193
+	 * @return Array the airport list
8194
+	 *
8195
+	 */
8196 8196
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
8197 8197
 	{
8198 8198
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8226,11 +8226,11 @@  discard block
 block discarded – undo
8226 8226
 	
8227 8227
 	
8228 8228
 	/**
8229
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
8230
-	*
8231
-	* @return Array the airport list
8232
-	*
8233
-	*/
8229
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
8230
+	 *
8231
+	 * @return Array the airport list
8232
+	 *
8233
+	 */
8234 8234
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
8235 8235
 	{
8236 8236
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8261,11 +8261,11 @@  discard block
 block discarded – undo
8261 8261
 	
8262 8262
 	
8263 8263
 	/**
8264
-	* Gets all arrival airports of the airplanes that have flown over based on a date
8265
-	*
8266
-	* @return Array the airport list
8267
-	*
8268
-	*/
8264
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
8265
+	 *
8266
+	 * @return Array the airport list
8267
+	 *
8268
+	 */
8269 8269
 	public function countAllArrivalAirportsByDate($date,$filters = array())
8270 8270
 	{
8271 8271
 		global $globalTimezone, $globalDBdriver;
@@ -8311,11 +8311,11 @@  discard block
 block discarded – undo
8311 8311
 	
8312 8312
 	
8313 8313
 	/**
8314
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
8315
-	*
8316
-	* @return Array the airport list
8317
-	*
8318
-	*/
8314
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
8315
+	 *
8316
+	 * @return Array the airport list
8317
+	 *
8318
+	 */
8319 8319
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
8320 8320
 	{
8321 8321
 		global $globalTimezone, $globalDBdriver;
@@ -8358,11 +8358,11 @@  discard block
 block discarded – undo
8358 8358
 	
8359 8359
 	
8360 8360
 	/**
8361
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
8362
-	*
8363
-	* @return Array the airport list
8364
-	*
8365
-	*/
8361
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
8362
+	 *
8363
+	 * @return Array the airport list
8364
+	 *
8365
+	 */
8366 8366
 	public function countAllArrivalAirportsByIdent($ident,$filters = array())
8367 8367
 	{
8368 8368
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8394,11 +8394,11 @@  discard block
 block discarded – undo
8394 8394
 	}
8395 8395
 	
8396 8396
 	/**
8397
-	* Gets all arrival airports of the airplanes that have flown over based on a owner
8398
-	*
8399
-	* @return Array the airport list
8400
-	*
8401
-	*/
8397
+	 * Gets all arrival airports of the airplanes that have flown over based on a owner
8398
+	 *
8399
+	 * @return Array the airport list
8400
+	 *
8401
+	 */
8402 8402
 	public function countAllArrivalAirportsByOwner($owner,$filters = array())
8403 8403
 	{
8404 8404
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8429,11 +8429,11 @@  discard block
 block discarded – undo
8429 8429
 	}
8430 8430
 
8431 8431
 	/**
8432
-	* Gets all arrival airports of the airplanes that have flown over based on a pilot
8433
-	*
8434
-	* @return Array the airport list
8435
-	*
8436
-	*/
8432
+	 * Gets all arrival airports of the airplanes that have flown over based on a pilot
8433
+	 *
8434
+	 * @return Array the airport list
8435
+	 *
8436
+	 */
8437 8437
 	public function countAllArrivalAirportsByPilot($pilot,$filters = array())
8438 8438
 	{
8439 8439
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8464,11 +8464,11 @@  discard block
 block discarded – undo
8464 8464
 	}
8465 8465
 	
8466 8466
 	/**
8467
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
8468
-	*
8469
-	* @return Array the airport list
8470
-	*
8471
-	*/
8467
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
8468
+	 *
8469
+	 * @return Array the airport list
8470
+	 *
8471
+	 */
8472 8472
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
8473 8473
 	{
8474 8474
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8497,11 +8497,11 @@  discard block
 block discarded – undo
8497 8497
 	}
8498 8498
 	
8499 8499
 	/**
8500
-	* Gets all arrival airports by country of the airplanes that have flown over based on a owner
8501
-	*
8502
-	* @return Array the airport list
8503
-	*
8504
-	*/
8500
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a owner
8501
+	 *
8502
+	 * @return Array the airport list
8503
+	 *
8504
+	 */
8505 8505
 	public function countAllArrivalAirportCountriesByOwner($owner, $filters = array())
8506 8506
 	{
8507 8507
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8517,11 +8517,11 @@  discard block
 block discarded – undo
8517 8517
 	}
8518 8518
 	
8519 8519
 	/**
8520
-	* Gets all arrival airports by country of the airplanes that have flown over based on a pilot
8521
-	*
8522
-	* @return Array the airport list
8523
-	*
8524
-	*/
8520
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a pilot
8521
+	 *
8522
+	 * @return Array the airport list
8523
+	 *
8524
+	 */
8525 8525
 	public function countAllArrivalAirportCountriesByPilot($pilot, $filters = array())
8526 8526
 	{
8527 8527
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8539,11 +8539,11 @@  discard block
 block discarded – undo
8539 8539
 	
8540 8540
 	
8541 8541
 	/**
8542
-	* Gets all arrival airports of the airplanes that have flown over based on a country
8543
-	*
8544
-	* @return Array the airport list
8545
-	*
8546
-	*/
8542
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
8543
+	 *
8544
+	 * @return Array the airport list
8545
+	 *
8546
+	 */
8547 8547
 	public function countAllArrivalAirportsByCountry($country,$filters = array())
8548 8548
 	{
8549 8549
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8576,11 +8576,11 @@  discard block
 block discarded – undo
8576 8576
 	
8577 8577
 	
8578 8578
 	/**
8579
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
8580
-	*
8581
-	* @return Array the airport list
8582
-	*
8583
-	*/
8579
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
8580
+	 *
8581
+	 * @return Array the airport list
8582
+	 *
8583
+	 */
8584 8584
 	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
8585 8585
 	{
8586 8586
 		global $globalDBdriver;
@@ -8612,11 +8612,11 @@  discard block
 block discarded – undo
8612 8612
 
8613 8613
 
8614 8614
 	/**
8615
-	* Counts all airport departure countries
8616
-	*
8617
-	* @return Array the airport departure list
8618
-	*
8619
-	*/
8615
+	 * Counts all airport departure countries
8616
+	 *
8617
+	 * @return Array the airport departure list
8618
+	 *
8619
+	 */
8620 8620
 	public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '')
8621 8621
 	{
8622 8622
 		global $globalDBdriver;
@@ -8675,11 +8675,11 @@  discard block
 block discarded – undo
8675 8675
 	
8676 8676
 	
8677 8677
 	/**
8678
-	* Counts all airport arrival countries
8679
-	*
8680
-	* @return Array the airport arrival list
8681
-	*
8682
-	*/
8678
+	 * Counts all airport arrival countries
8679
+	 *
8680
+	 * @return Array the airport arrival list
8681
+	 *
8682
+	 */
8683 8683
 	public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '')
8684 8684
 	{
8685 8685
 		global $globalDBdriver;
@@ -8742,11 +8742,11 @@  discard block
 block discarded – undo
8742 8742
 
8743 8743
 
8744 8744
 	/**
8745
-	* Gets all route combinations
8746
-	*
8747
-	* @return Array the route list
8748
-	*
8749
-	*/
8745
+	 * Gets all route combinations
8746
+	 *
8747
+	 * @return Array the route list
8748
+	 *
8749
+	 */
8750 8750
 	public function countAllRoutes($filters = array())
8751 8751
 	{
8752 8752
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8785,11 +8785,11 @@  discard block
 block discarded – undo
8785 8785
 	
8786 8786
 	
8787 8787
 	/**
8788
-	* Gets all route combinations based on an aircraft
8789
-	*
8790
-	* @return Array the route list
8791
-	*
8792
-	*/
8788
+	 * Gets all route combinations based on an aircraft
8789
+	 *
8790
+	 * @return Array the route list
8791
+	 *
8792
+	 */
8793 8793
 	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
8794 8794
 	{
8795 8795
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8825,11 +8825,11 @@  discard block
 block discarded – undo
8825 8825
 	
8826 8826
 	
8827 8827
 	/**
8828
-	* Gets all route combinations based on an aircraft registration
8829
-	*
8830
-	* @return Array the route list
8831
-	*
8832
-	*/
8828
+	 * Gets all route combinations based on an aircraft registration
8829
+	 *
8830
+	 * @return Array the route list
8831
+	 *
8832
+	 */
8833 8833
 	public function countAllRoutesByRegistration($registration, $filters = array())
8834 8834
 	{
8835 8835
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8867,11 +8867,11 @@  discard block
 block discarded – undo
8867 8867
 	
8868 8868
 	
8869 8869
 	/**
8870
-	* Gets all route combinations based on an airline
8871
-	*
8872
-	* @return Array the route list
8873
-	*
8874
-	*/
8870
+	 * Gets all route combinations based on an airline
8871
+	 *
8872
+	 * @return Array the route list
8873
+	 *
8874
+	 */
8875 8875
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
8876 8876
 	{
8877 8877
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8909,11 +8909,11 @@  discard block
 block discarded – undo
8909 8909
 	
8910 8910
 	
8911 8911
 	/**
8912
-	* Gets all route combinations based on an airport
8913
-	*
8914
-	* @return Array the route list
8915
-	*
8916
-	*/
8912
+	 * Gets all route combinations based on an airport
8913
+	 *
8914
+	 * @return Array the route list
8915
+	 *
8916
+	 */
8917 8917
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
8918 8918
 	{
8919 8919
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8950,11 +8950,11 @@  discard block
 block discarded – undo
8950 8950
 	
8951 8951
 	
8952 8952
 	/**
8953
-	* Gets all route combinations based on an country
8954
-	*
8955
-	* @return Array the route list
8956
-	*
8957
-	*/
8953
+	 * Gets all route combinations based on an country
8954
+	 *
8955
+	 * @return Array the route list
8956
+	 *
8957
+	 */
8958 8958
 	public function countAllRoutesByCountry($country, $filters = array())
8959 8959
 	{
8960 8960
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8990,11 +8990,11 @@  discard block
 block discarded – undo
8990 8990
 
8991 8991
 
8992 8992
 	/**
8993
-	* Gets all route combinations based on an date
8994
-	*
8995
-	* @return Array the route list
8996
-	*
8997
-	*/
8993
+	 * Gets all route combinations based on an date
8994
+	 *
8995
+	 * @return Array the route list
8996
+	 *
8997
+	 */
8998 8998
 	public function countAllRoutesByDate($date, $filters = array())
8999 8999
 	{
9000 9000
 		global $globalTimezone, $globalDBdriver;
@@ -9044,11 +9044,11 @@  discard block
 block discarded – undo
9044 9044
 	
9045 9045
 	
9046 9046
 	/**
9047
-	* Gets all route combinations based on an ident/callsign
9048
-	*
9049
-	* @return Array the route list
9050
-	*
9051
-	*/
9047
+	 * Gets all route combinations based on an ident/callsign
9048
+	 *
9049
+	 * @return Array the route list
9050
+	 *
9051
+	 */
9052 9052
 	public function countAllRoutesByIdent($ident, $filters = array())
9053 9053
 	{
9054 9054
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9084,11 +9084,11 @@  discard block
 block discarded – undo
9084 9084
 	}
9085 9085
 	
9086 9086
 	/**
9087
-	* Gets all route combinations based on an owner
9088
-	*
9089
-	* @return Array the route list
9090
-	*
9091
-	*/
9087
+	 * Gets all route combinations based on an owner
9088
+	 *
9089
+	 * @return Array the route list
9090
+	 *
9091
+	 */
9092 9092
 	public function countAllRoutesByOwner($owner,$filters = array())
9093 9093
 	{
9094 9094
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9124,11 +9124,11 @@  discard block
 block discarded – undo
9124 9124
 	}
9125 9125
 	
9126 9126
 	/**
9127
-	* Gets all route combinations based on a pilot
9128
-	*
9129
-	* @return Array the route list
9130
-	*
9131
-	*/
9127
+	 * Gets all route combinations based on a pilot
9128
+	 *
9129
+	 * @return Array the route list
9130
+	 *
9131
+	 */
9132 9132
 	public function countAllRoutesByPilot($pilot,$filters = array())
9133 9133
 	{
9134 9134
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9165,11 +9165,11 @@  discard block
 block discarded – undo
9165 9165
 	
9166 9166
 	
9167 9167
 	/**
9168
-	* Gets all route combinations based on an manufacturer
9169
-	*
9170
-	* @return Array the route list
9171
-	*
9172
-	*/
9168
+	 * Gets all route combinations based on an manufacturer
9169
+	 *
9170
+	 * @return Array the route list
9171
+	 *
9172
+	 */
9173 9173
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
9174 9174
 	{
9175 9175
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9207,11 +9207,11 @@  discard block
 block discarded – undo
9207 9207
 	
9208 9208
 	
9209 9209
 	/**
9210
-	* Gets all route combinations with waypoints
9211
-	*
9212
-	* @return Array the route list
9213
-	*
9214
-	*/
9210
+	 * Gets all route combinations with waypoints
9211
+	 *
9212
+	 * @return Array the route list
9213
+	 *
9214
+	 */
9215 9215
 	public function countAllRoutesWithWaypoints($filters = array())
9216 9216
 	{
9217 9217
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9248,11 +9248,11 @@  discard block
 block discarded – undo
9248 9248
 	}
9249 9249
 	
9250 9250
 	/**
9251
-	* Gets all callsigns that have flown over
9252
-	*
9253
-	* @return Array the callsign list
9254
-	*
9255
-	*/
9251
+	 * Gets all callsigns that have flown over
9252
+	 *
9253
+	 * @return Array the callsign list
9254
+	 *
9255
+	 */
9256 9256
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
9257 9257
 	{
9258 9258
 		global $globalDBdriver;
@@ -9318,11 +9318,11 @@  discard block
 block discarded – undo
9318 9318
 	}
9319 9319
 
9320 9320
 	/**
9321
-	* Gets all callsigns that have flown over
9322
-	*
9323
-	* @return Array the callsign list
9324
-	*
9325
-	*/
9321
+	 * Gets all callsigns that have flown over
9322
+	 *
9323
+	 * @return Array the callsign list
9324
+	 *
9325
+	 */
9326 9326
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
9327 9327
 	{
9328 9328
 		global $globalDBdriver;
@@ -9363,11 +9363,11 @@  discard block
 block discarded – undo
9363 9363
 
9364 9364
 
9365 9365
 	/**
9366
-	* Counts all dates
9367
-	*
9368
-	* @return Array the date list
9369
-	*
9370
-	*/
9366
+	 * Counts all dates
9367
+	 *
9368
+	 * @return Array the date list
9369
+	 *
9370
+	 */
9371 9371
 	public function countAllDates($filters = array())
9372 9372
 	{
9373 9373
 		global $globalTimezone, $globalDBdriver;
@@ -9412,11 +9412,11 @@  discard block
 block discarded – undo
9412 9412
 	}
9413 9413
 	
9414 9414
 	/**
9415
-	* Counts all dates
9416
-	*
9417
-	* @return Array the date list
9418
-	*
9419
-	*/
9415
+	 * Counts all dates
9416
+	 *
9417
+	 * @return Array the date list
9418
+	 *
9419
+	 */
9420 9420
 	public function countAllDatesByAirlines($filters = array())
9421 9421
 	{
9422 9422
 		global $globalTimezone, $globalDBdriver;
@@ -9461,11 +9461,11 @@  discard block
 block discarded – undo
9461 9461
 	}	
9462 9462
 	
9463 9463
 	/**
9464
-	* Counts all dates during the last 7 days
9465
-	*
9466
-	* @return Array the date list
9467
-	*
9468
-	*/
9464
+	 * Counts all dates during the last 7 days
9465
+	 *
9466
+	 * @return Array the date list
9467
+	 *
9468
+	 */
9469 9469
 	public function countAllDatesLast7Days($filters = array())
9470 9470
 	{
9471 9471
 		global $globalTimezone, $globalDBdriver;
@@ -9487,7 +9487,7 @@  discard block
 block discarded – undo
9487 9487
 			$query .= " GROUP BY date_name 
9488 9488
 								ORDER BY date_name ASC";
9489 9489
 			$query_data = array(':offset' => $offset);
9490
-    		}
9490
+			}
9491 9491
 		
9492 9492
 		$sth = $this->db->prepare($query);
9493 9493
 		$sth->execute($query_data);
@@ -9507,11 +9507,11 @@  discard block
 block discarded – undo
9507 9507
 	}
9508 9508
 
9509 9509
 	/**
9510
-	* Counts all dates during the last month
9511
-	*
9512
-	* @return Array the date list
9513
-	*
9514
-	*/
9510
+	 * Counts all dates during the last month
9511
+	 *
9512
+	 * @return Array the date list
9513
+	 *
9514
+	 */
9515 9515
 	public function countAllDatesLastMonth($filters = array())
9516 9516
 	{
9517 9517
 		global $globalTimezone, $globalDBdriver;
@@ -9533,7 +9533,7 @@  discard block
 block discarded – undo
9533 9533
 			$query .= " GROUP BY date_name 
9534 9534
 								ORDER BY date_name ASC";
9535 9535
 			$query_data = array(':offset' => $offset);
9536
-    		}
9536
+			}
9537 9537
 		
9538 9538
 		$sth = $this->db->prepare($query);
9539 9539
 		$sth->execute($query_data);
@@ -9554,11 +9554,11 @@  discard block
 block discarded – undo
9554 9554
 
9555 9555
 
9556 9556
 	/**
9557
-	* Counts all dates during the last month
9558
-	*
9559
-	* @return Array the date list
9560
-	*
9561
-	*/
9557
+	 * Counts all dates during the last month
9558
+	 *
9559
+	 * @return Array the date list
9560
+	 *
9561
+	 */
9562 9562
 	public function countAllDatesLastMonthByAirlines($filters = array())
9563 9563
 	{
9564 9564
 		global $globalTimezone, $globalDBdriver;
@@ -9581,7 +9581,7 @@  discard block
 block discarded – undo
9581 9581
 								GROUP BY spotter_output.airline_icao, date_name 
9582 9582
 								ORDER BY date_name ASC";
9583 9583
 			$query_data = array(':offset' => $offset);
9584
-    		}
9584
+			}
9585 9585
 		
9586 9586
 		$sth = $this->db->prepare($query);
9587 9587
 		$sth->execute($query_data);
@@ -9603,11 +9603,11 @@  discard block
 block discarded – undo
9603 9603
 	
9604 9604
 
9605 9605
 	/**
9606
-	* Counts all month
9607
-	*
9608
-	* @return Array the month list
9609
-	*
9610
-	*/
9606
+	 * Counts all month
9607
+	 *
9608
+	 * @return Array the month list
9609
+	 *
9610
+	 */
9611 9611
 	public function countAllMonths($filters = array())
9612 9612
 	{
9613 9613
 		global $globalTimezone, $globalDBdriver;
@@ -9649,11 +9649,11 @@  discard block
 block discarded – undo
9649 9649
 	}
9650 9650
 
9651 9651
 	/**
9652
-	* Counts all month
9653
-	*
9654
-	* @return Array the month list
9655
-	*
9656
-	*/
9652
+	 * Counts all month
9653
+	 *
9654
+	 * @return Array the month list
9655
+	 *
9656
+	 */
9657 9657
 	public function countAllMonthsByAirlines($filters = array())
9658 9658
 	{
9659 9659
 		global $globalTimezone, $globalDBdriver;
@@ -9698,11 +9698,11 @@  discard block
 block discarded – undo
9698 9698
 	}
9699 9699
 
9700 9700
 	/**
9701
-	* Counts all military month
9702
-	*
9703
-	* @return Array the month list
9704
-	*
9705
-	*/
9701
+	 * Counts all military month
9702
+	 *
9703
+	 * @return Array the month list
9704
+	 *
9705
+	 */
9706 9706
 	public function countAllMilitaryMonths($filters = array())
9707 9707
 	{
9708 9708
 		global $globalTimezone, $globalDBdriver;
@@ -9743,11 +9743,11 @@  discard block
 block discarded – undo
9743 9743
 	}
9744 9744
 	
9745 9745
 	/**
9746
-	* Counts all month owners
9747
-	*
9748
-	* @return Array the month list
9749
-	*
9750
-	*/
9746
+	 * Counts all month owners
9747
+	 *
9748
+	 * @return Array the month list
9749
+	 *
9750
+	 */
9751 9751
 	public function countAllMonthsOwners($filters = array())
9752 9752
 	{
9753 9753
 		global $globalTimezone, $globalDBdriver;
@@ -9789,11 +9789,11 @@  discard block
 block discarded – undo
9789 9789
 	}
9790 9790
 	
9791 9791
 	/**
9792
-	* Counts all month owners
9793
-	*
9794
-	* @return Array the month list
9795
-	*
9796
-	*/
9792
+	 * Counts all month owners
9793
+	 *
9794
+	 * @return Array the month list
9795
+	 *
9796
+	 */
9797 9797
 	public function countAllMonthsOwnersByAirlines($filters = array())
9798 9798
 	{
9799 9799
 		global $globalTimezone, $globalDBdriver;
@@ -9836,11 +9836,11 @@  discard block
 block discarded – undo
9836 9836
 	}
9837 9837
 
9838 9838
 	/**
9839
-	* Counts all month pilot
9840
-	*
9841
-	* @return Array the month list
9842
-	*
9843
-	*/
9839
+	 * Counts all month pilot
9840
+	 *
9841
+	 * @return Array the month list
9842
+	 *
9843
+	 */
9844 9844
 	public function countAllMonthsPilots($filters = array())
9845 9845
 	{
9846 9846
 		global $globalTimezone, $globalDBdriver;
@@ -9882,11 +9882,11 @@  discard block
 block discarded – undo
9882 9882
 	}
9883 9883
 	
9884 9884
 	/**
9885
-	* Counts all month pilot
9886
-	*
9887
-	* @return Array the month list
9888
-	*
9889
-	*/
9885
+	 * Counts all month pilot
9886
+	 *
9887
+	 * @return Array the month list
9888
+	 *
9889
+	 */
9890 9890
 	public function countAllMonthsPilotsByAirlines($filters = array())
9891 9891
 	{
9892 9892
 		global $globalTimezone, $globalDBdriver;
@@ -9929,11 +9929,11 @@  discard block
 block discarded – undo
9929 9929
 	}
9930 9930
 
9931 9931
 	/**
9932
-	* Counts all month airline
9933
-	*
9934
-	* @return Array the month list
9935
-	*
9936
-	*/
9932
+	 * Counts all month airline
9933
+	 *
9934
+	 * @return Array the month list
9935
+	 *
9936
+	 */
9937 9937
 	public function countAllMonthsAirlines($filters = array())
9938 9938
 	{
9939 9939
 		global $globalTimezone, $globalDBdriver;
@@ -9975,11 +9975,11 @@  discard block
 block discarded – undo
9975 9975
 	}
9976 9976
 	
9977 9977
 	/**
9978
-	* Counts all month aircraft
9979
-	*
9980
-	* @return Array the month list
9981
-	*
9982
-	*/
9978
+	 * Counts all month aircraft
9979
+	 *
9980
+	 * @return Array the month list
9981
+	 *
9982
+	 */
9983 9983
 	public function countAllMonthsAircrafts($filters = array())
9984 9984
 	{
9985 9985
 		global $globalTimezone, $globalDBdriver;
@@ -10022,11 +10022,11 @@  discard block
 block discarded – undo
10022 10022
 	
10023 10023
 
10024 10024
 	/**
10025
-	* Counts all month aircraft
10026
-	*
10027
-	* @return Array the month list
10028
-	*
10029
-	*/
10025
+	 * Counts all month aircraft
10026
+	 *
10027
+	 * @return Array the month list
10028
+	 *
10029
+	 */
10030 10030
 	public function countAllMonthsAircraftsByAirlines($filters = array())
10031 10031
 	{
10032 10032
 		global $globalTimezone, $globalDBdriver;
@@ -10069,11 +10069,11 @@  discard block
 block discarded – undo
10069 10069
 	}
10070 10070
 
10071 10071
 	/**
10072
-	* Counts all month real arrival
10073
-	*
10074
-	* @return Array the month list
10075
-	*
10076
-	*/
10072
+	 * Counts all month real arrival
10073
+	 *
10074
+	 * @return Array the month list
10075
+	 *
10076
+	 */
10077 10077
 	public function countAllMonthsRealArrivals($filters = array())
10078 10078
 	{
10079 10079
 		global $globalTimezone, $globalDBdriver;
@@ -10116,11 +10116,11 @@  discard block
 block discarded – undo
10116 10116
 	
10117 10117
 
10118 10118
 	/**
10119
-	* Counts all month real arrival
10120
-	*
10121
-	* @return Array the month list
10122
-	*
10123
-	*/
10119
+	 * Counts all month real arrival
10120
+	 *
10121
+	 * @return Array the month list
10122
+	 *
10123
+	 */
10124 10124
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
10125 10125
 	{
10126 10126
 		global $globalTimezone, $globalDBdriver;
@@ -10164,11 +10164,11 @@  discard block
 block discarded – undo
10164 10164
 	
10165 10165
 
10166 10166
 	/**
10167
-	* Counts all dates during the last year
10168
-	*
10169
-	* @return Array the date list
10170
-	*
10171
-	*/
10167
+	 * Counts all dates during the last year
10168
+	 *
10169
+	 * @return Array the date list
10170
+	 *
10171
+	 */
10172 10172
 	public function countAllMonthsLastYear($filters)
10173 10173
 	{
10174 10174
 		global $globalTimezone, $globalDBdriver;
@@ -10190,7 +10190,7 @@  discard block
 block discarded – undo
10190 10190
 			$query .= " GROUP BY year_name, month_name
10191 10191
 								ORDER BY year_name, month_name ASC";
10192 10192
 			$query_data = array(':offset' => $offset);
10193
-    		}
10193
+			}
10194 10194
 		
10195 10195
 		$sth = $this->db->prepare($query);
10196 10196
 		$sth->execute($query_data);
@@ -10213,11 +10213,11 @@  discard block
 block discarded – undo
10213 10213
 	
10214 10214
 	
10215 10215
 	/**
10216
-	* Counts all hours
10217
-	*
10218
-	* @return Array the hour list
10219
-	*
10220
-	*/
10216
+	 * Counts all hours
10217
+	 *
10218
+	 * @return Array the hour list
10219
+	 *
10220
+	 */
10221 10221
 	public function countAllHours($orderby,$filters = array())
10222 10222
 	{
10223 10223
 		global $globalTimezone, $globalDBdriver;
@@ -10278,11 +10278,11 @@  discard block
 block discarded – undo
10278 10278
 	}
10279 10279
 	
10280 10280
 	/**
10281
-	* Counts all hours
10282
-	*
10283
-	* @return Array the hour list
10284
-	*
10285
-	*/
10281
+	 * Counts all hours
10282
+	 *
10283
+	 * @return Array the hour list
10284
+	 *
10285
+	 */
10286 10286
 	public function countAllHoursByAirlines($orderby, $filters = array())
10287 10287
 	{
10288 10288
 		global $globalTimezone, $globalDBdriver;
@@ -10345,11 +10345,11 @@  discard block
 block discarded – undo
10345 10345
 
10346 10346
 
10347 10347
 	/**
10348
-	* Counts all hours by airline
10349
-	*
10350
-	* @return Array the hour list
10351
-	*
10352
-	*/
10348
+	 * Counts all hours by airline
10349
+	 *
10350
+	 * @return Array the hour list
10351
+	 *
10352
+	 */
10353 10353
 	public function countAllHoursByAirline($airline_icao, $filters = array())
10354 10354
 	{
10355 10355
 		global $globalTimezone, $globalDBdriver;
@@ -10395,11 +10395,11 @@  discard block
 block discarded – undo
10395 10395
 	
10396 10396
 	
10397 10397
 	/**
10398
-	* Counts all hours by aircraft
10399
-	*
10400
-	* @return Array the hour list
10401
-	*
10402
-	*/
10398
+	 * Counts all hours by aircraft
10399
+	 *
10400
+	 * @return Array the hour list
10401
+	 *
10402
+	 */
10403 10403
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
10404 10404
 	{
10405 10405
 		global $globalTimezone, $globalDBdriver;
@@ -10442,11 +10442,11 @@  discard block
 block discarded – undo
10442 10442
 	
10443 10443
 	
10444 10444
 	/**
10445
-	* Counts all hours by aircraft registration
10446
-	*
10447
-	* @return Array the hour list
10448
-	*
10449
-	*/
10445
+	 * Counts all hours by aircraft registration
10446
+	 *
10447
+	 * @return Array the hour list
10448
+	 *
10449
+	 */
10450 10450
 	public function countAllHoursByRegistration($registration, $filters = array())
10451 10451
 	{
10452 10452
 		global $globalTimezone, $globalDBdriver;
@@ -10489,11 +10489,11 @@  discard block
 block discarded – undo
10489 10489
 	
10490 10490
 	
10491 10491
 	/**
10492
-	* Counts all hours by airport
10493
-	*
10494
-	* @return Array the hour list
10495
-	*
10496
-	*/
10492
+	 * Counts all hours by airport
10493
+	 *
10494
+	 * @return Array the hour list
10495
+	 *
10496
+	 */
10497 10497
 	public function countAllHoursByAirport($airport_icao, $filters = array())
10498 10498
 	{
10499 10499
 		global $globalTimezone, $globalDBdriver;
@@ -10537,11 +10537,11 @@  discard block
 block discarded – undo
10537 10537
 	
10538 10538
 	
10539 10539
 	/**
10540
-	* Counts all hours by manufacturer
10541
-	*
10542
-	* @return Array the hour list
10543
-	*
10544
-	*/
10540
+	 * Counts all hours by manufacturer
10541
+	 *
10542
+	 * @return Array the hour list
10543
+	 *
10544
+	 */
10545 10545
 	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
10546 10546
 	{
10547 10547
 		global $globalTimezone, $globalDBdriver;
@@ -10585,11 +10585,11 @@  discard block
 block discarded – undo
10585 10585
 	
10586 10586
 	
10587 10587
 	/**
10588
-	* Counts all hours by date
10589
-	*
10590
-	* @return Array the hour list
10591
-	*
10592
-	*/
10588
+	 * Counts all hours by date
10589
+	 *
10590
+	 * @return Array the hour list
10591
+	 *
10592
+	 */
10593 10593
 	public function countAllHoursByDate($date, $filters = array())
10594 10594
 	{
10595 10595
 		global $globalTimezone, $globalDBdriver;
@@ -10633,11 +10633,11 @@  discard block
 block discarded – undo
10633 10633
 	
10634 10634
 	
10635 10635
 	/**
10636
-	* Counts all hours by a ident/callsign
10637
-	*
10638
-	* @return Array the hour list
10639
-	*
10640
-	*/
10636
+	 * Counts all hours by a ident/callsign
10637
+	 *
10638
+	 * @return Array the hour list
10639
+	 *
10640
+	 */
10641 10641
 	public function countAllHoursByIdent($ident, $filters = array())
10642 10642
 	{
10643 10643
 		global $globalTimezone, $globalDBdriver;
@@ -10680,11 +10680,11 @@  discard block
 block discarded – undo
10680 10680
 	}
10681 10681
 	
10682 10682
 	/**
10683
-	* Counts all hours by a owner
10684
-	*
10685
-	* @return Array the hour list
10686
-	*
10687
-	*/
10683
+	 * Counts all hours by a owner
10684
+	 *
10685
+	 * @return Array the hour list
10686
+	 *
10687
+	 */
10688 10688
 	public function countAllHoursByOwner($owner, $filters = array())
10689 10689
 	{
10690 10690
 		global $globalTimezone, $globalDBdriver;
@@ -10727,11 +10727,11 @@  discard block
 block discarded – undo
10727 10727
 	}
10728 10728
 	
10729 10729
 	/**
10730
-	* Counts all hours by a pilot
10731
-	*
10732
-	* @return Array the hour list
10733
-	*
10734
-	*/
10730
+	 * Counts all hours by a pilot
10731
+	 *
10732
+	 * @return Array the hour list
10733
+	 *
10734
+	 */
10735 10735
 	public function countAllHoursByPilot($pilot, $filters = array())
10736 10736
 	{
10737 10737
 		global $globalTimezone, $globalDBdriver;
@@ -10776,11 +10776,11 @@  discard block
 block discarded – undo
10776 10776
 	
10777 10777
 	
10778 10778
 	/**
10779
-	* Counts all hours by route
10780
-	*
10781
-	* @return Array the hour list
10782
-	*
10783
-	*/
10779
+	 * Counts all hours by route
10780
+	 *
10781
+	 * @return Array the hour list
10782
+	 *
10783
+	 */
10784 10784
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
10785 10785
 	{
10786 10786
 		global $globalTimezone, $globalDBdriver;
@@ -10824,11 +10824,11 @@  discard block
 block discarded – undo
10824 10824
 	
10825 10825
 	
10826 10826
 	/**
10827
-	* Counts all hours by country
10828
-	*
10829
-	* @return Array the hour list
10830
-	*
10831
-	*/
10827
+	 * Counts all hours by country
10828
+	 *
10829
+	 * @return Array the hour list
10830
+	 *
10831
+	 */
10832 10832
 	public function countAllHoursByCountry($country, $filters = array())
10833 10833
 	{
10834 10834
 		global $globalTimezone, $globalDBdriver;
@@ -10873,11 +10873,11 @@  discard block
 block discarded – undo
10873 10873
 
10874 10874
 
10875 10875
 	/**
10876
-	* Counts all aircraft that have flown over
10877
-	*
10878
-	* @return Integer the number of aircrafts
10879
-	*
10880
-	*/
10876
+	 * Counts all aircraft that have flown over
10877
+	 *
10878
+	 * @return Integer the number of aircrafts
10879
+	 *
10880
+	 */
10881 10881
 	public function countOverallAircrafts($filters = array(),$year = '',$month = '')
10882 10882
 	{
10883 10883
 		global $globalDBdriver;
@@ -10910,11 +10910,11 @@  discard block
 block discarded – undo
10910 10910
 	}
10911 10911
 
10912 10912
 	/**
10913
-	* Counts all flight that really arrival
10914
-	*
10915
-	* @return Integer the number of aircrafts
10916
-	*
10917
-	*/
10913
+	 * Counts all flight that really arrival
10914
+	 *
10915
+	 * @return Integer the number of aircrafts
10916
+	 *
10917
+	 */
10918 10918
 	public function countOverallArrival($filters = array(),$year = '',$month = '')
10919 10919
 	{
10920 10920
 		global $globalDBdriver;
@@ -10947,11 +10947,11 @@  discard block
 block discarded – undo
10947 10947
 	}
10948 10948
 
10949 10949
 	/**
10950
-	* Counts all pilots that have flown over
10951
-	*
10952
-	* @return Integer the number of pilots
10953
-	*
10954
-	*/
10950
+	 * Counts all pilots that have flown over
10951
+	 *
10952
+	 * @return Integer the number of pilots
10953
+	 *
10954
+	 */
10955 10955
 	public function countOverallPilots($filters = array(),$year = '',$month = '')
10956 10956
 	{
10957 10957
 		global $globalDBdriver;
@@ -10983,11 +10983,11 @@  discard block
 block discarded – undo
10983 10983
 	}
10984 10984
 
10985 10985
 	/**
10986
-	* Counts all owners that have flown over
10987
-	*
10988
-	* @return Integer the number of owners
10989
-	*
10990
-	*/
10986
+	 * Counts all owners that have flown over
10987
+	 *
10988
+	 * @return Integer the number of owners
10989
+	 *
10990
+	 */
10991 10991
 	public function countOverallOwners($filters = array(),$year = '',$month = '')
10992 10992
 	{
10993 10993
 		global $globalDBdriver;
@@ -11020,11 +11020,11 @@  discard block
 block discarded – undo
11020 11020
 	
11021 11021
 	
11022 11022
 	/**
11023
-	* Counts all flights that have flown over
11024
-	*
11025
-	* @return Integer the number of flights
11026
-	*
11027
-	*/
11023
+	 * Counts all flights that have flown over
11024
+	 *
11025
+	 * @return Integer the number of flights
11026
+	 *
11027
+	 */
11028 11028
 	public function countOverallFlights($filters = array(),$year = '',$month = '')
11029 11029
 	{
11030 11030
 		global $globalDBdriver;
@@ -11058,11 +11058,11 @@  discard block
 block discarded – undo
11058 11058
 	}
11059 11059
 	
11060 11060
 	/**
11061
-	* Counts all military flights that have flown over
11062
-	*
11063
-	* @return Integer the number of flights
11064
-	*
11065
-	*/
11061
+	 * Counts all military flights that have flown over
11062
+	 *
11063
+	 * @return Integer the number of flights
11064
+	 *
11065
+	 */
11066 11066
 	public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '')
11067 11067
 	{
11068 11068
 		global $globalDBdriver;
@@ -11097,11 +11097,11 @@  discard block
 block discarded – undo
11097 11097
 	
11098 11098
 	
11099 11099
 	/**
11100
-	* Counts all airlines that have flown over
11101
-	*
11102
-	* @return Integer the number of airlines
11103
-	*
11104
-	*/
11100
+	 * Counts all airlines that have flown over
11101
+	 *
11102
+	 * @return Integer the number of airlines
11103
+	 *
11104
+	 */
11105 11105
 	public function countOverallAirlines($filters = array(),$year = '',$month = '')
11106 11106
 	{
11107 11107
 		global $globalDBdriver;
@@ -11128,8 +11128,8 @@  discard block
 block discarded – undo
11128 11128
 				$query_values = array_merge($query_values,array(':month' => $month));
11129 11129
 			}
11130 11130
 		}
11131
-                if ($query == '') $queryi .= $this->getFilter($filters);
11132
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11131
+				if ($query == '') $queryi .= $this->getFilter($filters);
11132
+				else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11133 11133
 
11134 11134
 
11135 11135
 		$sth = $this->db->prepare($queryi);
@@ -11139,11 +11139,11 @@  discard block
 block discarded – undo
11139 11139
 
11140 11140
   
11141 11141
 	/**
11142
-	* Counts all hours of today
11143
-	*
11144
-	* @return Array the hour list
11145
-	*
11146
-	*/
11142
+	 * Counts all hours of today
11143
+	 *
11144
+	 * @return Array the hour list
11145
+	 *
11146
+	 */
11147 11147
 	public function countAllHoursFromToday($filters = array())
11148 11148
 	{
11149 11149
 		global $globalTimezone, $globalDBdriver;
@@ -11183,11 +11183,11 @@  discard block
 block discarded – undo
11183 11183
 	}
11184 11184
     
11185 11185
 	/**
11186
-	* Gets all the spotter information based on calculated upcoming flights
11187
-	*
11188
-	* @return Array the spotter information
11189
-	*
11190
-	*/
11186
+	 * Gets all the spotter information based on calculated upcoming flights
11187
+	 *
11188
+	 * @return Array the spotter information
11189
+	 *
11190
+	 */
11191 11191
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
11192 11192
 	{
11193 11193
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -11262,12 +11262,12 @@  discard block
 block discarded – undo
11262 11262
 	}
11263 11263
     
11264 11264
     
11265
-     /**
11266
-	* Gets the Barrie Spotter ID based on the FlightAware ID
11267
-	*
11268
-	* @return Integer the Barrie Spotter ID
11265
+	 /**
11266
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
11267
+	  *
11268
+	  * @return Integer the Barrie Spotter ID
11269 11269
 q	*
11270
-	*/
11270
+	  */
11271 11271
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
11272 11272
 	{
11273 11273
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -11288,13 +11288,13 @@  discard block
 block discarded – undo
11288 11288
   
11289 11289
  
11290 11290
 	/**
11291
-	* Parses a date string
11292
-	*
11293
-	* @param String $dateString the date string
11294
-	* @param String $timezone the timezone of a user
11295
-	* @return Array the time information
11296
-	*
11297
-	*/
11291
+	 * Parses a date string
11292
+	 *
11293
+	 * @param String $dateString the date string
11294
+	 * @param String $timezone the timezone of a user
11295
+	 * @return Array the time information
11296
+	 *
11297
+	 */
11298 11298
 	public function parseDateString($dateString, $timezone = '')
11299 11299
 	{
11300 11300
 		$time_array = array();
@@ -11330,12 +11330,12 @@  discard block
 block discarded – undo
11330 11330
 	
11331 11331
 	
11332 11332
 	/**
11333
-	* Parses the direction degrees to working
11334
-	*
11335
-	* @param Float $direction the direction in degrees
11336
-	* @return Array the direction information
11337
-	*
11338
-	*/
11333
+	 * Parses the direction degrees to working
11334
+	 *
11335
+	 * @param Float $direction the direction in degrees
11336
+	 * @return Array the direction information
11337
+	 *
11338
+	 */
11339 11339
 	public function parseDirection($direction = 0)
11340 11340
 	{
11341 11341
 		if ($direction == '') $direction = 0;
@@ -11414,12 +11414,12 @@  discard block
 block discarded – undo
11414 11414
 	
11415 11415
 	
11416 11416
 	/**
11417
-	* Gets the aircraft registration
11418
-	*
11419
-	* @param String $flightaware_id the flight aware id
11420
-	* @return String the aircraft registration
11421
-	*
11422
-	*/
11417
+	 * Gets the aircraft registration
11418
+	 *
11419
+	 * @param String $flightaware_id the flight aware id
11420
+	 * @return String the aircraft registration
11421
+	 *
11422
+	 */
11423 11423
 	
11424 11424
 	public function getAircraftRegistration($flightaware_id)
11425 11425
 	{
@@ -11448,12 +11448,12 @@  discard block
 block discarded – undo
11448 11448
 
11449 11449
 
11450 11450
 	/**
11451
-	* Gets the aircraft registration from ModeS
11452
-	*
11453
-	* @param String $aircraft_modes the flight ModeS in hex
11454
-	* @return String the aircraft registration
11455
-	*
11456
-	*/
11451
+	 * Gets the aircraft registration from ModeS
11452
+	 *
11453
+	 * @param String $aircraft_modes the flight ModeS in hex
11454
+	 * @return String the aircraft registration
11455
+	 *
11456
+	 */
11457 11457
 	public function getAircraftRegistrationBymodeS($aircraft_modes, $source_type = '')
11458 11458
 	{
11459 11459
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -11469,8 +11469,8 @@  discard block
 block discarded – undo
11469 11469
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
11470 11470
 		$sth->closeCursor();
11471 11471
 		if (count($row) > 0) {
11472
-		    //return $row['Registration'];
11473
-		    return $row['registration'];
11472
+			//return $row['Registration'];
11473
+			return $row['registration'];
11474 11474
 		} elseif ($source_type == 'flarm') {
11475 11475
 			return $this->getAircraftRegistrationBymodeS($aircraft_modes);
11476 11476
 		} else return '';
@@ -11478,12 +11478,12 @@  discard block
 block discarded – undo
11478 11478
 	}
11479 11479
 
11480 11480
 	/**
11481
-	* Gets the aircraft type from ModeS
11482
-	*
11483
-	* @param String $aircraft_modes the flight ModeS in hex
11484
-	* @return String the aircraft type
11485
-	*
11486
-	*/
11481
+	 * Gets the aircraft type from ModeS
11482
+	 *
11483
+	 * @param String $aircraft_modes the flight ModeS in hex
11484
+	 * @return String the aircraft type
11485
+	 *
11486
+	 */
11487 11487
 	public function getAircraftTypeBymodeS($aircraft_modes,$source_type = '')
11488 11488
 	{
11489 11489
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -11509,12 +11509,12 @@  discard block
 block discarded – undo
11509 11509
 	}
11510 11510
 
11511 11511
 	/**
11512
-	* Gets Country from latitude/longitude
11513
-	*
11514
-	* @param Float $latitude latitute of the flight
11515
-	* @param Float $longitude longitute of the flight
11516
-	* @return String the countrie
11517
-	*/
11512
+	 * Gets Country from latitude/longitude
11513
+	 *
11514
+	 * @param Float $latitude latitute of the flight
11515
+	 * @param Float $longitude longitute of the flight
11516
+	 * @return String the countrie
11517
+	 */
11518 11518
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
11519 11519
 	{
11520 11520
 		global $globalDBdriver, $globalDebug;
@@ -11551,11 +11551,11 @@  discard block
 block discarded – undo
11551 11551
 	}
11552 11552
 
11553 11553
 	/**
11554
-	* Gets Country from iso2
11555
-	*
11556
-	* @param String $iso2 ISO2 country code
11557
-	* @return String the countrie
11558
-	*/
11554
+	 * Gets Country from iso2
11555
+	 *
11556
+	 * @param String $iso2 ISO2 country code
11557
+	 * @return String the countrie
11558
+	 */
11559 11559
 	public function getCountryFromISO2($iso2)
11560 11560
 	{
11561 11561
 		global $globalDBdriver, $globalDebug;
@@ -11583,12 +11583,12 @@  discard block
 block discarded – undo
11583 11583
 	}
11584 11584
 
11585 11585
 	/**
11586
-	* converts the registration code using the country prefix
11587
-	*
11588
-	* @param String $registration the aircraft registration
11589
-	* @return String the aircraft registration
11590
-	*
11591
-	*/
11586
+	 * converts the registration code using the country prefix
11587
+	 *
11588
+	 * @param String $registration the aircraft registration
11589
+	 * @return String the aircraft registration
11590
+	 *
11591
+	 */
11592 11592
 	public function convertAircraftRegistration($registration)
11593 11593
 	{
11594 11594
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11640,12 +11640,12 @@  discard block
 block discarded – undo
11640 11640
 	}
11641 11641
 
11642 11642
 	/**
11643
-	* Country from the registration code
11644
-	*
11645
-	* @param String $registration the aircraft registration
11646
-	* @return String the country
11647
-	*
11648
-	*/
11643
+	 * Country from the registration code
11644
+	 *
11645
+	 * @param String $registration the aircraft registration
11646
+	 * @return String the country
11647
+	 *
11648
+	 */
11649 11649
 	public function countryFromAircraftRegistration($registration)
11650 11650
 	{
11651 11651
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11664,8 +11664,8 @@  discard block
 block discarded – undo
11664 11664
 				$country = $row['country'];
11665 11665
 			}
11666 11666
 		} else {
11667
-    			$registration_1 = substr($registration, 0, 1);
11668
-		        $registration_2 = substr($registration, 0, 2);
11667
+				$registration_1 = substr($registration, 0, 1);
11668
+				$registration_2 = substr($registration, 0, 2);
11669 11669
 
11670 11670
 			$country = '';
11671 11671
 			//first get the prefix based on two characters
@@ -11701,12 +11701,12 @@  discard block
 block discarded – undo
11701 11701
 	}
11702 11702
 
11703 11703
 	/**
11704
-	* Registration prefix from the registration code
11705
-	*
11706
-	* @param String $registration the aircraft registration
11707
-	* @return String the registration prefix
11708
-	*
11709
-	*/
11704
+	 * Registration prefix from the registration code
11705
+	 *
11706
+	 * @param String $registration the aircraft registration
11707
+	 * @return String the registration prefix
11708
+	 *
11709
+	 */
11710 11710
 	public function registrationPrefixFromAircraftRegistration($registration)
11711 11711
 	{
11712 11712
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11725,8 +11725,8 @@  discard block
 block discarded – undo
11725 11725
 				//$country = $row['country'];
11726 11726
 			}
11727 11727
 		} else {
11728
-    			$registration_1 = substr($registration, 0, 1);
11729
-		        $registration_2 = substr($registration, 0, 2);
11728
+				$registration_1 = substr($registration, 0, 1);
11729
+				$registration_2 = substr($registration, 0, 2);
11730 11730
 
11731 11731
 			//first get the prefix based on two characters
11732 11732
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
@@ -11762,12 +11762,12 @@  discard block
 block discarded – undo
11762 11762
 
11763 11763
 
11764 11764
 	/**
11765
-	* Country from the registration code
11766
-	*
11767
-	* @param String $registration the aircraft registration
11768
-	* @return String the country
11769
-	*
11770
-	*/
11765
+	 * Country from the registration code
11766
+	 *
11767
+	 * @param String $registration the aircraft registration
11768
+	 * @return String the country
11769
+	 *
11770
+	 */
11771 11771
 	public function countryFromAircraftRegistrationCode($registration)
11772 11772
 	{
11773 11773
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11784,11 +11784,11 @@  discard block
 block discarded – undo
11784 11784
 	}
11785 11785
 	
11786 11786
 	/**
11787
-	* Set a new highlight value for a flight
11788
-	*
11789
-	* @param String $flightaware_id flightaware_id from spotter_output table
11790
-	* @param String $highlight New highlight value
11791
-	*/
11787
+	 * Set a new highlight value for a flight
11788
+	 *
11789
+	 * @param String $flightaware_id flightaware_id from spotter_output table
11790
+	 * @param String $highlight New highlight value
11791
+	 */
11792 11792
 	public function setHighlightFlight($flightaware_id,$highlight) {
11793 11793
 		
11794 11794
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -11797,12 +11797,12 @@  discard block
 block discarded – undo
11797 11797
 	}
11798 11798
 
11799 11799
 	/**
11800
-	* Set a new highlight value for a flight by Registration
11801
-	*
11802
-	* @param String $registration Registration of the aircraft
11803
-	* @param String $date Date of spotted aircraft
11804
-	* @param String $highlight New highlight value
11805
-	*/
11800
+	 * Set a new highlight value for a flight by Registration
11801
+	 *
11802
+	 * @param String $registration Registration of the aircraft
11803
+	 * @param String $date Date of spotted aircraft
11804
+	 * @param String $highlight New highlight value
11805
+	 */
11806 11806
 	public function setHighlightFlightByRegistration($registration,$highlight, $date = '') {
11807 11807
 		if ($date == '') {
11808 11808
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)";
@@ -11816,12 +11816,12 @@  discard block
 block discarded – undo
11816 11816
 	}
11817 11817
 	
11818 11818
 	/**
11819
-	* Gets the short url from bit.ly
11820
-	*
11821
-	* @param String $url the full url
11822
-	* @return String the bit.ly url
11823
-	*
11824
-	*/
11819
+	 * Gets the short url from bit.ly
11820
+	 *
11821
+	 * @param String $url the full url
11822
+	 * @return String the bit.ly url
11823
+	 *
11824
+	 */
11825 11825
 	public function getBitlyURL($url)
11826 11826
 	{
11827 11827
 		global $globalBitlyAccessToken;
@@ -12110,11 +12110,11 @@  discard block
 block discarded – undo
12110 12110
 			$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 
12111 12111
 	                      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)) 
12112 12112
 	                      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;";
12113
-                } else {
12113
+				} else {
12114 12114
 			$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 
12115 12115
 	                      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)) 
12116 12116
 	                      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;";
12117
-    		}
12117
+			}
12118 12118
 		$sth = $this->db->prepare($query);
12119 12119
 		$sth->execute();
12120 12120
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
Spacing   +1353 added lines, -1353 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 require_once(dirname(__FILE__).'/class.Image.php');
5 5
 $global_query = "SELECT spotter_output.* FROM spotter_output";
6 6
 
7
-class Spotter{
7
+class Spotter {
8 8
 	public $aircraft_correct_icaotype = array('CL64' => 'CL60',
9 9
 					'F9LX' => 'F900',
10 10
 					'K35T' => 'K35R',
@@ -59,62 +59,62 @@  discard block
 block discarded – undo
59 59
 	* @param Array $filter the filter
60 60
 	* @return Array the SQL part
61 61
 	*/
62
-	public function getFilter($filter = array(),$where = false,$and = false) {
62
+	public function getFilter($filter = array(), $where = false, $and = false) {
63 63
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
64 64
 		$filters = array();
65 65
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
66 66
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
67 67
 				$filters = $globalStatsFilters[$globalFilterName];
68 68
 			} else {
69
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
69
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
70 70
 			}
71 71
 		}
72 72
 		if (isset($filter[0]['source'])) {
73
-			$filters = array_merge($filters,$filter);
73
+			$filters = array_merge($filters, $filter);
74 74
 		}
75
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
75
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
76 76
 		$filter_query_join = '';
77 77
 		$filter_query_where = '';
78
-		foreach($filters as $flt) {
78
+		foreach ($filters as $flt) {
79 79
 			if (isset($flt['airlines']) && !empty($flt['airlines'])) {
80 80
 				if ($flt['airlines'][0] != '') {
81 81
 					if (isset($flt['source'])) {
82
-						$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'])."')) saf ON saf.flightaware_id = spotter_output.flightaware_id";
82
+						$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'])."')) saf ON saf.flightaware_id = spotter_output.flightaware_id";
83 83
 					} else {
84
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saf ON saf.flightaware_id = spotter_output.flightaware_id";
84
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saf ON saf.flightaware_id = spotter_output.flightaware_id";
85 85
 					}
86 86
 				}
87 87
 			}
88 88
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
89 89
 				if (isset($flt['source'])) {
90
-					$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'])."')) spf ON spf.flightaware_id = spotter_output.flightaware_id";
90
+					$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'])."')) spf ON spf.flightaware_id = spotter_output.flightaware_id";
91 91
 				} else {
92
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) spf ON spf.flightaware_id = spotter_output.flightaware_id";
92
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) spf ON spf.flightaware_id = spotter_output.flightaware_id";
93 93
 				}
94 94
 			}
95 95
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
96 96
 				if (isset($flt['source'])) {
97
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spfi ON spfi.flightaware_id = spotter_output.flightaware_id";
97
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spfi ON spfi.flightaware_id = spotter_output.flightaware_id";
98 98
 				} else {
99
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."')) spfi ON spfi.flightaware_id = spotter_output.flightaware_id";
99
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."')) spfi ON spfi.flightaware_id = spotter_output.flightaware_id";
100 100
 				}
101 101
 			}
102 102
 			if (isset($flt['registrations']) && !empty($flt['registrations'])) {
103 103
 				if (isset($flt['source'])) {
104
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_output.flightaware_id";
104
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_output.flightaware_id";
105 105
 				} else {
106
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_output.flightaware_id";
106
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_output.flightaware_id";
107 107
 				}
108 108
 			}
109 109
 			if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents']) && isset($flt['registrations']) && empty($flt['registrations'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) {
110 110
 				if (isset($flt['source'])) {
111
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) sf ON sf.flightaware_id = spotter_output.flightaware_id";
111
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) sf ON sf.flightaware_id = spotter_output.flightaware_id";
112 112
 				}
113 113
 			}
114 114
 		}
115 115
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
116 116
 			if ($filter['airlines'][0] != '') {
117
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) sof ON sof.flightaware_id = spotter_output.flightaware_id";
117
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) sof ON sof.flightaware_id = spotter_output.flightaware_id";
118 118
 			}
119 119
 		}
120 120
 		if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
@@ -124,16 +124,16 @@  discard block
 block discarded – undo
124 124
 			$filter_query_join .= " INNER JOIN (SELECT icao FROM airlines WHERE alliance = '".$filter['alliance']."') sal ON sal.icao = spotter_output.airline_icao ";
125 125
 		}
126 126
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
127
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) spid ON spid.flightaware_id = spotter_output.flightaware_id";
127
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) spid ON spid.flightaware_id = spotter_output.flightaware_id";
128 128
 			}
129 129
 		if (isset($filter['source']) && !empty($filter['source'])) {
130
-			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
130
+			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
131 131
 		}
132 132
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
133 133
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
134 134
 		}
135 135
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
136
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
136
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
137 137
 		}
138 138
 		if (isset($filter['year']) && $filter['year'] != '') {
139 139
 			if ($globalDBdriver == 'mysql') {
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
160 160
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
161 161
 		if ($filter_query_where != '') {
162
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
162
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
163 163
 		}
164 164
 		$filter_query = $filter_query_join.$filter_query_where;
165 165
 		return $filter_query;
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	* @return Array the spotter information
175 175
 	*
176 176
 	*/
177
-	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
177
+	public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false)
178 178
 	{
179 179
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
180 180
 		$Image = new Image($this->db);
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 			$sth = $this->db->prepare($query.$limitQuery);
205 205
 			$sth->execute($params);
206 206
 		} catch (PDOException $e) {
207
-			printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery);
207
+			printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery);
208 208
 			exit();
209 209
 		}
210 210
 		
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 		$spotter_array = array();
215 215
 		
216 216
 
217
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
217
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
218 218
 		{
219 219
 			$num_rows++;
220 220
 			$temp_array = array();
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
259 259
 			if (isset($row['route_stop']) && $row['route_stop'] != '') {
260 260
 				$temp_array['route_stop'] = $row['route_stop'];
261
-				$allroute = explode(' ',$row['route_stop']);
261
+				$allroute = explode(' ', $row['route_stop']);
262 262
 				foreach ($allroute as $route) {
263 263
 					$route_airport_array = $this->getAllAirportInfo($route);
264 264
 					if (isset($route_airport_array[0]['name'])) {
@@ -311,17 +311,17 @@  discard block
 block discarded – undo
311 311
 				{
312 312
 					$temp_array['date'] = "about ".$dateArray['hours']." hours ago";
313 313
 				} else {
314
-					$temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC"));
314
+					$temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC"));
315 315
 				}
316 316
 				$temp_array['date_minutes_past'] = $dateArray['minutes'];
317
-				$temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC"));
318
-				$temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC"));
317
+				$temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC"));
318
+				$temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC"));
319 319
 				$temp_array['date_unix'] = strtotime($row['date']." UTC");
320 320
 				if (isset($row['last_seen']) && $row['last_seen'] != '') {
321 321
 					if (strtotime($row['last_seen']) > strtotime($row['date'])) {
322 322
 						$temp_array['duration'] = strtotime($row['last_seen']) - strtotime($row['date']);
323
-						$temp_array['last_seen_date_iso_8601'] = date("c",strtotime($row['last_seen']." UTC"));
324
-						$temp_array['last_seen_date_rfc_2822'] = date("r",strtotime($row['last_seen']." UTC"));
323
+						$temp_array['last_seen_date_iso_8601'] = date("c", strtotime($row['last_seen']." UTC"));
324
+						$temp_array['last_seen_date_rfc_2822'] = date("r", strtotime($row['last_seen']." UTC"));
325 325
 						$temp_array['last_seen_date_unix'] = strtotime($row['last_seen']." UTC");
326 326
 					}
327 327
 				}
@@ -357,9 +357,9 @@  discard block
 block discarded – undo
357 357
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
358 358
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
359 359
 					if (is_numeric(substr($row['ident'], 2, 1))) {
360
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2),$fromsource);
360
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2), $fromsource);
361 361
 					} elseif (is_numeric(substr($row['ident'], 3, 1))) {
362
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
362
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
363 363
 					} else {
364 364
 						$airline_array = $this->getAllAirlineInfo('NA');
365 365
 					}
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 				}
397 397
 			}
398 398
 			if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') {
399
-				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'],3));
399
+				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'], 3));
400 400
 				//$acars_array = ACARS->getLiveAcarsData('BA40YL');
401 401
 				if (count($acars_array) > 0) {
402 402
 					$temp_array['acars'] = $acars_array;
@@ -413,11 +413,11 @@  discard block
 block discarded – undo
413 413
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
414 414
 			}
415 415
 
416
-			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
416
+			if ($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
417 417
 			{
418 418
 				if ($globalIVAO) {
419
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
420
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
419
+					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('', $temp_array['aircraft_type'], $temp_array['airline_icao']);
420
+					else $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type']);
421 421
 				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
422 422
 				if (count($image_array) > 0) {
423 423
 					$temp_array['image'] = $image_array[0]['image'];
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
442 442
 			}
443 443
 			
444
-			if ((!isset($globalIVAO) || ! $globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
444
+			if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
445 445
 				if ($schedules === true) {
446 446
 					$schedule_array = $Schedule->getSchedule($temp_array['ident']);
447 447
 					//print_r($schedule_array);
@@ -523,12 +523,12 @@  discard block
 block discarded – undo
523 523
 			if (isset($row['squawk'])) {
524 524
 				$temp_array['squawk'] = $row['squawk'];
525 525
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
526
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
527
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
526
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['country_iso2']);
527
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
528 528
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
529
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
530
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
531
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
529
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['over_country']);
530
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
531
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
532 532
 			}
533 533
     			
534 534
 			$temp_array['query_number_rows'] = $num_rows;
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 	* @return Array the spotter information
548 548
 	*
549 549
 	*/
550
-	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())
550
+	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())
551 551
 	{
552 552
 		global $globalTimezone, $globalDBdriver;
553 553
 		require_once(dirname(__FILE__).'/class.Translation.php');
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 
558 558
 		$query_values = array();
559 559
 		$additional_query = '';
560
-		$filter_query = $this->getFilter($filters,true,true);
560
+		$filter_query = $this->getFilter($filters, true, true);
561 561
 		if ($q != "")
562 562
 		{
563 563
 			if (!is_string($q))
@@ -565,8 +565,8 @@  discard block
 block discarded – undo
565 565
 				return false;
566 566
 			} else {
567 567
 				$q_array = explode(" ", $q);
568
-				foreach ($q_array as $q_item){
569
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
568
+				foreach ($q_array as $q_item) {
569
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
570 570
 					$additional_query .= " AND (";
571 571
 					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
572 572
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
@@ -598,37 +598,37 @@  discard block
 block discarded – undo
598 598
 
599 599
 		if ($registration != "")
600 600
 		{
601
-			$registration = filter_var($registration,FILTER_SANITIZE_STRING);
601
+			$registration = filter_var($registration, FILTER_SANITIZE_STRING);
602 602
 			if (!is_string($registration))
603 603
 			{
604 604
 				return false;
605 605
 			} else {
606 606
 				$additional_query .= " AND spotter_output.registration = :registration";
607
-				$query_values = array_merge($query_values,array(':registration' => $registration));
607
+				$query_values = array_merge($query_values, array(':registration' => $registration));
608 608
 			}
609 609
 		}
610 610
 
611 611
 		if ($aircraft_icao != "")
612 612
 		{
613
-			$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
613
+			$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
614 614
 			if (!is_string($aircraft_icao))
615 615
 			{
616 616
 				return false;
617 617
 			} else {
618 618
 				$additional_query .= " AND spotter_output.aircraft_icao = :aircraft_icao";
619
-				$query_values = array_merge($query_values,array(':aircraft_icao' => $aircraft_icao));
619
+				$query_values = array_merge($query_values, array(':aircraft_icao' => $aircraft_icao));
620 620
 			}
621 621
 		}
622 622
 
623 623
 		if ($aircraft_manufacturer != "")
624 624
 		{
625
-			$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
625
+			$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
626 626
 			if (!is_string($aircraft_manufacturer))
627 627
 			{
628 628
 				return false;
629 629
 			} else {
630 630
 				$additional_query .= " AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer";
631
-				$query_values = array_merge($query_values,array(':aircraft_manufacturer' => $aircraft_manufacturer));
631
+				$query_values = array_merge($query_values, array(':aircraft_manufacturer' => $aircraft_manufacturer));
632 632
 			}
633 633
 		}
634 634
 
@@ -644,25 +644,25 @@  discard block
 block discarded – undo
644 644
 
645 645
 		if ($airline_icao != "")
646 646
 		{
647
-			$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
647
+			$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
648 648
 			if (!is_string($airline_icao))
649 649
 			{
650 650
 				return false;
651 651
 			} else {
652 652
 				$additional_query .= " AND spotter_output.airline_icao = :airline_icao";
653
-				$query_values = array_merge($query_values,array(':airline_icao' => $airline_icao));
653
+				$query_values = array_merge($query_values, array(':airline_icao' => $airline_icao));
654 654
 			}
655 655
 		}
656 656
 
657 657
 		if ($airline_country != "")
658 658
 		{
659
-			$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
659
+			$airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING);
660 660
 			if (!is_string($airline_country))
661 661
 			{
662 662
 				return false;
663 663
 			} else {
664 664
 				$additional_query .= " AND spotter_output.airline_country = :airline_country";
665
-				$query_values = array_merge($query_values,array(':airline_country' => $airline_country));
665
+				$query_values = array_merge($query_values, array(':airline_country' => $airline_country));
666 666
 			}
667 667
 		}
668 668
 
@@ -689,31 +689,31 @@  discard block
 block discarded – undo
689 689
 
690 690
 		if ($airport != "")
691 691
 		{
692
-			$airport = filter_var($airport,FILTER_SANITIZE_STRING);
692
+			$airport = filter_var($airport, FILTER_SANITIZE_STRING);
693 693
 			if (!is_string($airport))
694 694
 			{
695 695
 				return false;
696 696
 			} else {
697 697
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :airport OR spotter_output.arrival_airport_icao = :airport)";
698
-				$query_values = array_merge($query_values,array(':airport' => $airport));
698
+				$query_values = array_merge($query_values, array(':airport' => $airport));
699 699
 			}
700 700
 		}
701 701
 
702 702
 		if ($airport_country != "")
703 703
 		{
704
-			$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
704
+			$airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING);
705 705
 			if (!is_string($airport_country))
706 706
 			{
707 707
 				return false;
708 708
 			} else {
709 709
 				$additional_query .= " AND (spotter_output.departure_airport_country = :airport_country OR spotter_output.arrival_airport_country = :airport_country)";
710
-				$query_values = array_merge($query_values,array(':airport_country' => $airport_country));
710
+				$query_values = array_merge($query_values, array(':airport_country' => $airport_country));
711 711
 			}
712 712
 		}
713 713
     
714 714
 		if ($callsign != "")
715 715
 		{
716
-			$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
716
+			$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
717 717
 			if (!is_string($callsign))
718 718
 			{
719 719
 				return false;
@@ -721,79 +721,79 @@  discard block
 block discarded – undo
721 721
 				$translate = $Translation->ident2icao($callsign);
722 722
 				if ($translate != $callsign) {
723 723
 					$additional_query .= " AND (spotter_output.ident = :callsign OR spotter_output.ident = :translate)";
724
-					$query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate));
724
+					$query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate));
725 725
 				} else {
726 726
 					$additional_query .= " AND spotter_output.ident = :callsign";
727
-					$query_values = array_merge($query_values,array(':callsign' => $callsign));
727
+					$query_values = array_merge($query_values, array(':callsign' => $callsign));
728 728
 				}
729 729
 			}
730 730
 		}
731 731
 
732 732
 		if ($owner != "")
733 733
 		{
734
-			$owner = filter_var($owner,FILTER_SANITIZE_STRING);
734
+			$owner = filter_var($owner, FILTER_SANITIZE_STRING);
735 735
 			if (!is_string($owner))
736 736
 			{
737 737
 				return false;
738 738
 			} else {
739 739
 				$additional_query .= " AND spotter_output.owner_name = :owner";
740
-				$query_values = array_merge($query_values,array(':owner' => $owner));
740
+				$query_values = array_merge($query_values, array(':owner' => $owner));
741 741
 			}
742 742
 		}
743 743
 
744 744
 		if ($pilot_name != "")
745 745
 		{
746
-			$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
746
+			$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
747 747
 			if (!is_string($pilot_name))
748 748
 			{
749 749
 				return false;
750 750
 			} else {
751 751
 				$additional_query .= " AND spotter_output.pilot_name = :pilot_name";
752
-				$query_values = array_merge($query_values,array(':pilot_name' => $pilot_name));
752
+				$query_values = array_merge($query_values, array(':pilot_name' => $pilot_name));
753 753
 			}
754 754
 		}
755 755
 
756 756
 		if ($pilot_id != "")
757 757
 		{
758
-			$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
758
+			$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
759 759
 			if (!is_string($pilot_id))
760 760
 			{
761 761
 				return false;
762 762
 			} else {
763 763
 				$additional_query .= " AND spotter_output.pilot_id = :pilot_id";
764
-				$query_values = array_merge($query_values,array(':pilot_id' => $pilot_id));
764
+				$query_values = array_merge($query_values, array(':pilot_id' => $pilot_id));
765 765
 			}
766 766
 		}
767 767
 
768 768
 		if ($departure_airport_route != "")
769 769
 		{
770
-			$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
770
+			$departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING);
771 771
 			if (!is_string($departure_airport_route))
772 772
 			{
773 773
 				return false;
774 774
 			} else {
775 775
 				$additional_query .= " AND spotter_output.departure_airport_icao = :departure_airport_route";
776
-				$query_values = array_merge($query_values,array(':departure_airport_route' => $departure_airport_route));
776
+				$query_values = array_merge($query_values, array(':departure_airport_route' => $departure_airport_route));
777 777
 			}
778 778
 		}
779 779
 
780 780
 		if ($arrival_airport_route != "")
781 781
 		{
782
-			$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
782
+			$arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING);
783 783
 			if (!is_string($arrival_airport_route))
784 784
 			{
785 785
 				return false;
786 786
 			} else {
787 787
 				$additional_query .= " AND spotter_output.arrival_airport_icao = :arrival_airport_route";
788
-				$query_values = array_merge($query_values,array(':arrival_airport_route' => $arrival_airport_route));
788
+				$query_values = array_merge($query_values, array(':arrival_airport_route' => $arrival_airport_route));
789 789
 			}
790 790
 		}
791 791
 
792 792
 		if ($altitude != "")
793 793
 		{
794 794
 			$altitude_array = explode(",", $altitude);
795
-			$altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
796
-			$altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
795
+			$altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
796
+			$altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
797 797
 
798 798
 			if ($altitude_array[1] != "")
799 799
 			{                
@@ -809,8 +809,8 @@  discard block
 block discarded – undo
809 809
 		if ($date_posted != "")
810 810
 		{
811 811
 			$date_array = explode(",", $date_posted);
812
-			$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
813
-			$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
812
+			$date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
813
+			$date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
814 814
 
815 815
 			if ($globalTimezone != '') {
816 816
 				date_default_timezone_set($globalTimezone);
@@ -841,8 +841,8 @@  discard block
 block discarded – undo
841 841
 		{
842 842
 			$limit_array = explode(",", $limit);
843 843
 			
844
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
845
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
844
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
845
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
846 846
 			
847 847
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
848 848
 			{
@@ -871,23 +871,23 @@  discard block
 block discarded – undo
871 871
 
872 872
 
873 873
 		if ($origLat != "" && $origLon != "" && $dist != "") {
874
-			$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
874
+			$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
875 875
 
876 876
 			if ($globalDBdriver == 'mysql') {
877
-				$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 
877
+				$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 
878 878
 						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)) 
879 879
 						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;
880 880
 			} else {
881
-				$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 
881
+				$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 
882 882
 						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)) 
883 883
 						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;
884 884
 			}
885 885
 		} else {		
886
-			$query  = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' 
886
+			$query = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' 
887 887
 					".$additional_query."
888 888
 					".$orderby_query;
889 889
 		}
890
-		$spotter_array = $this->getDataFromDB($query, $query_values,$limit_query);
890
+		$spotter_array = $this->getDataFromDB($query, $query_values, $limit_query);
891 891
 		return $spotter_array;
892 892
 	}
893 893
 	
@@ -910,8 +910,8 @@  discard block
 block discarded – undo
910 910
 		{
911 911
 			$limit_array = explode(",", $limit);
912 912
 			
913
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
914
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
913
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
914
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
915 915
 			
916 916
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
917 917
 			{
@@ -928,9 +928,9 @@  discard block
 block discarded – undo
928 928
 			$orderby_query = " ORDER BY spotter_output.date DESC";
929 929
 		}
930 930
 
931
-		$query  = $global_query.$filter_query." ".$orderby_query;
931
+		$query = $global_query.$filter_query." ".$orderby_query;
932 932
 
933
-		$spotter_array = $this->getDataFromDB($query, array(),$limit_query,true);
933
+		$spotter_array = $this->getDataFromDB($query, array(), $limit_query, true);
934 934
 
935 935
 		return $spotter_array;
936 936
 	}
@@ -976,34 +976,34 @@  discard block
 block discarded – undo
976 976
 			{
977 977
 				return false;
978 978
 			} else {
979
-				if ($interval == "30m"){
979
+				if ($interval == "30m") {
980 980
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) <= $this_output.date ';
981
-				} else if ($interval == "1h"){
981
+				} else if ($interval == "1h") {
982 982
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) <= $this_output.date ';
983
-				} else if ($interval == "3h"){
983
+				} else if ($interval == "3h") {
984 984
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 3 HOUR) <= $this_output.date ';
985
-				} else if ($interval == "6h"){
985
+				} else if ($interval == "6h") {
986 986
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 6 HOUR) <= $this_output.date ';
987
-				} else if ($interval == "12h"){
987
+				} else if ($interval == "12h") {
988 988
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 HOUR) <= $this_output.date ';
989
-				} else if ($interval == "24h"){
989
+				} else if ($interval == "24h") {
990 990
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 24 HOUR) <= $this_output.date ';
991
-				} else if ($interval == "7d"){
991
+				} else if ($interval == "7d") {
992 992
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) <= $this_output.date ';
993
-				} else if ($interval == "30d"){
993
+				} else if ($interval == "30d") {
994 994
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 DAY) <= $this_output.date ';
995 995
 				} 
996 996
 			}
997 997
 		}
998 998
 
999
-		$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 
999
+		$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 
1000 1000
                    WHERE spotter_output.latitude <> '' 
1001 1001
 				   AND spotter_output.longitude <> '' 
1002 1002
                    ".$additional_query."
1003 1003
                    HAVING distance < :radius  
1004 1004
 				   ORDER BY distance";
1005 1005
 
1006
-		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius),$limit_query);
1006
+		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius), $limit_query);
1007 1007
 
1008 1008
 		return $spotter_array;
1009 1009
 	}
@@ -1015,21 +1015,21 @@  discard block
 block discarded – undo
1015 1015
 	* @return Array the spotter information
1016 1016
 	*
1017 1017
 	*/
1018
-	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
1018
+	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '', $filter = array())
1019 1019
 	{
1020 1020
 		global $global_query;
1021 1021
 		
1022 1022
 		date_default_timezone_set('UTC');
1023 1023
 
1024
-		$filter_query = $this->getFilter($filter,true,true);
1024
+		$filter_query = $this->getFilter($filter, true, true);
1025 1025
 
1026 1026
 		$limit_query = '';
1027 1027
 		if ($limit != "")
1028 1028
 		{
1029 1029
 			$limit_array = explode(",", $limit);
1030 1030
 			
1031
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1032
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1031
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1032
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1033 1033
 			
1034 1034
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1035 1035
 			{
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1047 1047
 		}
1048 1048
 
1049
-		$query  = $global_query." ".$filter_query." spotter_output.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;
1049
+		$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;
1050 1050
 
1051 1051
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1052 1052
 
@@ -1065,15 +1065,15 @@  discard block
 block discarded – undo
1065 1065
 		global $global_query;
1066 1066
 		
1067 1067
 		date_default_timezone_set('UTC');
1068
-		$filter_query = $this->getFilter($filter,true,true);
1068
+		$filter_query = $this->getFilter($filter, true, true);
1069 1069
 
1070 1070
 		$limit_query = '';
1071 1071
 		if ($limit != "")
1072 1072
 		{
1073 1073
 			$limit_array = explode(",", $limit);
1074 1074
 			
1075
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1076
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1075
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1076
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1077 1077
 			
1078 1078
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1079 1079
 			{
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1091 1091
 		}
1092 1092
 
1093
-		$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;
1093
+		$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;
1094 1094
 
1095 1095
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1096 1096
 
@@ -1104,20 +1104,20 @@  discard block
 block discarded – undo
1104 1104
 	* @return Array the spotter information
1105 1105
 	*
1106 1106
 	*/
1107
-	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1107
+	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '', $filter = array())
1108 1108
 	{
1109 1109
 		global $global_query;
1110 1110
 		
1111 1111
 		date_default_timezone_set('UTC');
1112
-		$filter_query = $this->getFilter($filter,true,true);
1112
+		$filter_query = $this->getFilter($filter, true, true);
1113 1113
 		
1114 1114
 		$limit_query = '';
1115 1115
 		if ($limit != "")
1116 1116
 		{
1117 1117
 			$limit_array = explode(",", $limit);
1118 1118
 			
1119
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1120
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1119
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1120
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1121 1121
 			
1122 1122
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1123 1123
 			{
@@ -1134,7 +1134,7 @@  discard block
 block discarded – undo
1134 1134
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1135 1135
 		}
1136 1136
 
1137
-		$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;
1137
+		$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;
1138 1138
 
1139 1139
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1140 1140
 
@@ -1154,7 +1154,7 @@  discard block
 block discarded – undo
1154 1154
 		
1155 1155
 		date_default_timezone_set('UTC');
1156 1156
 		
1157
-		$filter_query = $this->getFilter($filter,true,true);
1157
+		$filter_query = $this->getFilter($filter, true, true);
1158 1158
 		
1159 1159
 		$limit_query = '';
1160 1160
 		
@@ -1162,8 +1162,8 @@  discard block
 block discarded – undo
1162 1162
 		{
1163 1163
 			$limit_array = explode(",", $limit);
1164 1164
 			
1165
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1166
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1165
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1166
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1167 1167
 			
1168 1168
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1169 1169
 			{
@@ -1180,7 +1180,7 @@  discard block
 block discarded – undo
1180 1180
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1181 1181
 		}
1182 1182
 
1183
-		$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;
1183
+		$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;
1184 1184
 
1185 1185
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1186 1186
 
@@ -1199,14 +1199,14 @@  discard block
 block discarded – undo
1199 1199
 		global $global_query;
1200 1200
 		
1201 1201
 		date_default_timezone_set('UTC');
1202
-		$filter_query = $this->getFilter($filter,true,true);
1202
+		$filter_query = $this->getFilter($filter, true, true);
1203 1203
 		$limit_query = '';
1204 1204
 		if ($limit != "")
1205 1205
 		{
1206 1206
 			$limit_array = explode(",", $limit);
1207 1207
 			
1208
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1209
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1208
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1209
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1210 1210
 			
1211 1211
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1212 1212
 			{
@@ -1223,7 +1223,7 @@  discard block
 block discarded – undo
1223 1223
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1224 1224
 		}
1225 1225
 
1226
-		$query  = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1226
+		$query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1227 1227
 
1228 1228
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1229 1229
 
@@ -1247,9 +1247,9 @@  discard block
 block discarded – undo
1247 1247
 		$query_values = array(':id' => $id);
1248 1248
 
1249 1249
 		//$query  = $global_query." WHERE spotter_output.ident <> '' ".$additional_query." ";
1250
-		$query  = $global_query." WHERE ".$additional_query." ";
1250
+		$query = $global_query." WHERE ".$additional_query." ";
1251 1251
 
1252
-		$spotter_array = $this->getDataFromDB($query,$query_values);
1252
+		$spotter_array = $this->getDataFromDB($query, $query_values);
1253 1253
 
1254 1254
 		return $spotter_array;
1255 1255
 	}
@@ -1272,7 +1272,7 @@  discard block
 block discarded – undo
1272 1272
 		$query_values = array();
1273 1273
 		$limit_query = '';
1274 1274
 		$additional_query = '';
1275
-		$filter_query = $this->getFilter($filter,true,true);
1275
+		$filter_query = $this->getFilter($filter, true, true);
1276 1276
 		if ($ident != "")
1277 1277
 		{
1278 1278
 			if (!is_string($ident))
@@ -1288,8 +1288,8 @@  discard block
 block discarded – undo
1288 1288
 		{
1289 1289
 			$limit_array = explode(",", $limit);
1290 1290
 			
1291
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1292
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1291
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1292
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1293 1293
 			
1294 1294
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1295 1295
 			{
@@ -1328,7 +1328,7 @@  discard block
 block discarded – undo
1328 1328
 		$query_values = array();
1329 1329
 		$limit_query = '';
1330 1330
 		$additional_query = '';
1331
-		$filter_query = $this->getFilter($filter,true,true);
1331
+		$filter_query = $this->getFilter($filter, true, true);
1332 1332
 		if ($owner != "")
1333 1333
 		{
1334 1334
 			if (!is_string($owner))
@@ -1344,8 +1344,8 @@  discard block
 block discarded – undo
1344 1344
 		{
1345 1345
 			$limit_array = explode(",", $limit);
1346 1346
 			
1347
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1348
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1347
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1348
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1349 1349
 			
1350 1350
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1351 1351
 			{
@@ -1385,7 +1385,7 @@  discard block
 block discarded – undo
1385 1385
 		$query_values = array();
1386 1386
 		$limit_query = '';
1387 1387
 		$additional_query = '';
1388
-		$filter_query = $this->getFilter($filter,true,true);
1388
+		$filter_query = $this->getFilter($filter, true, true);
1389 1389
 		if ($pilot != "")
1390 1390
 		{
1391 1391
 			$additional_query = " AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot)";
@@ -1396,8 +1396,8 @@  discard block
 block discarded – undo
1396 1396
 		{
1397 1397
 			$limit_array = explode(",", $limit);
1398 1398
 			
1399
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1400
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1399
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1400
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1401 1401
 			
1402 1402
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1403 1403
 			{
@@ -1438,7 +1438,7 @@  discard block
 block discarded – undo
1438 1438
 		$query_values = array();
1439 1439
 		$limit_query = '';
1440 1440
 		$additional_query = '';
1441
-		$filter_query = $this->getFilter($filter,true,true);
1441
+		$filter_query = $this->getFilter($filter, true, true);
1442 1442
 		
1443 1443
 		if ($aircraft_type != "")
1444 1444
 		{
@@ -1455,8 +1455,8 @@  discard block
 block discarded – undo
1455 1455
 		{
1456 1456
 			$limit_array = explode(",", $limit);
1457 1457
 			
1458
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1459
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1458
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1459
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1460 1460
 			
1461 1461
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1462 1462
 			{
@@ -1512,8 +1512,8 @@  discard block
 block discarded – undo
1512 1512
 		{
1513 1513
 			$limit_array = explode(",", $limit);
1514 1514
 			
1515
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1516
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1515
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1516
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1517 1517
 			
1518 1518
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1519 1519
 			{
@@ -1529,7 +1529,7 @@  discard block
 block discarded – undo
1529 1529
 		} else {
1530 1530
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1531 1531
 		}
1532
-		$filter_query = $this->getFilter($filter,true,true);
1532
+		$filter_query = $this->getFilter($filter, true, true);
1533 1533
 
1534 1534
 		//$query = $global_query.$filter_query." spotter_output.ident <> '' ".$additional_query." ".$orderby_query;
1535 1535
 		$query = $global_query.$filter_query." ".$additional_query." ".$orderby_query;
@@ -1548,7 +1548,7 @@  discard block
 block discarded – undo
1548 1548
 	* @return Array the spotter information
1549 1549
 	*
1550 1550
 	*/
1551
-	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1551
+	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '', $filters = array())
1552 1552
 	{
1553 1553
 		global $global_query;
1554 1554
 		
@@ -1557,7 +1557,7 @@  discard block
 block discarded – undo
1557 1557
 		$query_values = array();
1558 1558
 		$limit_query = '';
1559 1559
 		$additional_query = '';
1560
-		$filter_query = $this->getFilter($filters,true,true);
1560
+		$filter_query = $this->getFilter($filters, true, true);
1561 1561
 		
1562 1562
 		if ($airline != "")
1563 1563
 		{
@@ -1574,8 +1574,8 @@  discard block
 block discarded – undo
1574 1574
 		{
1575 1575
 			$limit_array = explode(",", $limit);
1576 1576
 			
1577
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1578
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1577
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1578
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1579 1579
 			
1580 1580
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1581 1581
 			{
@@ -1605,7 +1605,7 @@  discard block
 block discarded – undo
1605 1605
 	* @return Array the spotter information
1606 1606
 	*
1607 1607
 	*/
1608
-	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1608
+	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array())
1609 1609
 	{
1610 1610
 		global $global_query;
1611 1611
 		
@@ -1613,7 +1613,7 @@  discard block
 block discarded – undo
1613 1613
 		$query_values = array();
1614 1614
 		$limit_query = '';
1615 1615
 		$additional_query = '';
1616
-		$filter_query = $this->getFilter($filters,true,true);
1616
+		$filter_query = $this->getFilter($filters, true, true);
1617 1617
 		
1618 1618
 		if ($airport != "")
1619 1619
 		{
@@ -1630,8 +1630,8 @@  discard block
 block discarded – undo
1630 1630
 		{
1631 1631
 			$limit_array = explode(",", $limit);
1632 1632
 			
1633
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1634
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1633
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1634
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1635 1635
 			
1636 1636
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1637 1637
 			{
@@ -1663,7 +1663,7 @@  discard block
 block discarded – undo
1663 1663
 	* @return Array the spotter information
1664 1664
 	*
1665 1665
 	*/
1666
-	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1666
+	public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array())
1667 1667
 	{
1668 1668
 		global $global_query, $globalTimezone, $globalDBdriver;
1669 1669
 		
@@ -1671,7 +1671,7 @@  discard block
 block discarded – undo
1671 1671
 		$limit_query = '';
1672 1672
 		$additional_query = '';
1673 1673
 
1674
-		$filter_query = $this->getFilter($filter,true,true);
1674
+		$filter_query = $this->getFilter($filter, true, true);
1675 1675
 		
1676 1676
 		if ($date != "")
1677 1677
 		{
@@ -1700,8 +1700,8 @@  discard block
 block discarded – undo
1700 1700
 		{
1701 1701
 			$limit_array = explode(",", $limit);
1702 1702
 			
1703
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1704
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1703
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1704
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1705 1705
 			
1706 1706
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1707 1707
 			{
@@ -1731,7 +1731,7 @@  discard block
 block discarded – undo
1731 1731
 	* @return Array the spotter information
1732 1732
 	*
1733 1733
 	*/
1734
-	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1734
+	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '', $filters = array())
1735 1735
 	{
1736 1736
 		global $global_query;
1737 1737
 		
@@ -1740,7 +1740,7 @@  discard block
 block discarded – undo
1740 1740
 		$query_values = array();
1741 1741
 		$limit_query = '';
1742 1742
 		$additional_query = '';
1743
-		$filter_query = $this->getFilter($filters,true,true);
1743
+		$filter_query = $this->getFilter($filters, true, true);
1744 1744
 		if ($country != "")
1745 1745
 		{
1746 1746
 			if (!is_string($country))
@@ -1757,8 +1757,8 @@  discard block
 block discarded – undo
1757 1757
 		{
1758 1758
 			$limit_array = explode(",", $limit);
1759 1759
 			
1760
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1761
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1760
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1761
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1762 1762
 			
1763 1763
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1764 1764
 			{
@@ -1798,7 +1798,7 @@  discard block
 block discarded – undo
1798 1798
 		$query_values = array();
1799 1799
 		$additional_query = '';
1800 1800
 		$limit_query = '';
1801
-		$filter_query = $this->getFilter($filters,true,true);
1801
+		$filter_query = $this->getFilter($filters, true, true);
1802 1802
 		
1803 1803
 		if ($aircraft_manufacturer != "")
1804 1804
 		{
@@ -1815,8 +1815,8 @@  discard block
 block discarded – undo
1815 1815
 		{
1816 1816
 			$limit_array = explode(",", $limit);
1817 1817
 			
1818
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1819
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1818
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1819
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1820 1820
 			
1821 1821
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1822 1822
 			{
@@ -1858,14 +1858,14 @@  discard block
 block discarded – undo
1858 1858
 		$query_values = array();
1859 1859
 		$additional_query = '';
1860 1860
 		$limit_query = '';
1861
-		$filter_query = $this->getFilter($filters,true,true);
1861
+		$filter_query = $this->getFilter($filters, true, true);
1862 1862
 		if ($departure_airport_icao != "")
1863 1863
 		{
1864 1864
 			if (!is_string($departure_airport_icao))
1865 1865
 			{
1866 1866
 				return false;
1867 1867
 			} else {
1868
-				$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1868
+				$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1869 1869
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)";
1870 1870
 				//$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";
1871 1871
 				$query_values = array(':departure_airport_icao' => $departure_airport_icao);
@@ -1878,10 +1878,10 @@  discard block
 block discarded – undo
1878 1878
 			{
1879 1879
 				return false;
1880 1880
 			} else {
1881
-				$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1881
+				$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1882 1882
 				$additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)";
1883 1883
 				//$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)";
1884
-				$query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao));
1884
+				$query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao));
1885 1885
 			}
1886 1886
 		}
1887 1887
 		
@@ -1889,8 +1889,8 @@  discard block
 block discarded – undo
1889 1889
 		{
1890 1890
 			$limit_array = explode(",", $limit);
1891 1891
 			
1892
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1893
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1892
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1893
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1894 1894
 			
1895 1895
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1896 1896
 			{
@@ -1929,15 +1929,15 @@  discard block
 block discarded – undo
1929 1929
 		global $global_query;
1930 1930
 		
1931 1931
 		date_default_timezone_set('UTC');
1932
-		$filter_query = $this->getFilter($filter,true,true);
1932
+		$filter_query = $this->getFilter($filter, true, true);
1933 1933
 		$limit_query = '';
1934 1934
 		
1935 1935
 		if ($limit != "")
1936 1936
 		{
1937 1937
 			$limit_array = explode(",", $limit);
1938 1938
 			
1939
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1940
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1939
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1940
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1941 1941
 			
1942 1942
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1943 1943
 			{
@@ -1954,7 +1954,7 @@  discard block
 block discarded – undo
1954 1954
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1955 1955
 		}
1956 1956
 
1957
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1957
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1958 1958
 
1959 1959
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1960 1960
 
@@ -1967,19 +1967,19 @@  discard block
 block discarded – undo
1967 1967
 	* @return String the highlight text
1968 1968
 	*
1969 1969
 	*/
1970
-	public function getHighlightByRegistration($registration,$filter = array())
1970
+	public function getHighlightByRegistration($registration, $filter = array())
1971 1971
 	{
1972 1972
 		global $global_query;
1973 1973
 		
1974 1974
 		date_default_timezone_set('UTC');
1975
-		$filter_query = $this->getFilter($filter,true,true);
1976
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
1975
+		$filter_query = $this->getFilter($filter, true, true);
1976
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
1977 1977
 		
1978
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1978
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1979 1979
 		$sth = $this->db->prepare($query);
1980 1980
 		$sth->execute(array(':registration' => $registration));
1981 1981
 
1982
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1982
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1983 1983
 		{
1984 1984
 			$highlight = $row['highlight'];
1985 1985
 		}
@@ -1995,14 +1995,14 @@  discard block
 block discarded – undo
1995 1995
 	* @return String usage
1996 1996
 	*
1997 1997
 	*/
1998
-	public function getSquawkUsage($squawk = '',$country = 'FR')
1998
+	public function getSquawkUsage($squawk = '', $country = 'FR')
1999 1999
 	{
2000 2000
 		
2001
-		$squawk = filter_var($squawk,FILTER_SANITIZE_STRING);
2002
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
2001
+		$squawk = filter_var($squawk, FILTER_SANITIZE_STRING);
2002
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
2003 2003
 
2004 2004
 		$query  = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1";
2005
-		$query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country);
2005
+		$query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country);
2006 2006
 		
2007 2007
 		$sth = $this->db->prepare($query);
2008 2008
 		$sth->execute($query_values);
@@ -2024,9 +2024,9 @@  discard block
 block discarded – undo
2024 2024
 	public function getAirportIcao($airport_iata = '')
2025 2025
 	{
2026 2026
 		
2027
-		$airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING);
2027
+		$airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING);
2028 2028
 
2029
-		$query  = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
2029
+		$query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
2030 2030
 		$query_values = array(':airport' => $airport_iata);
2031 2031
 		
2032 2032
 		$sth = $this->db->prepare($query);
@@ -2048,12 +2048,12 @@  discard block
 block discarded – undo
2048 2048
 	* @return Float distance to the airport
2049 2049
 	*
2050 2050
 	*/
2051
-	public function getAirportDistance($airport_icao,$latitude,$longitude)
2051
+	public function getAirportDistance($airport_icao, $latitude, $longitude)
2052 2052
 	{
2053 2053
 		
2054
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
2054
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
2055 2055
 
2056
-		$query  = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
2056
+		$query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
2057 2057
 		$query_values = array(':airport' => $airport_icao);
2058 2058
 		$sth = $this->db->prepare($query);
2059 2059
 		$sth->execute($query_values);
@@ -2063,7 +2063,7 @@  discard block
 block discarded – undo
2063 2063
 			$airport_latitude = $row['latitude'];
2064 2064
 			$airport_longitude = $row['longitude'];
2065 2065
 			$Common = new Common();
2066
-			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
2066
+			return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude);
2067 2067
 		} else return '';
2068 2068
 	}
2069 2069
 	
@@ -2077,11 +2077,11 @@  discard block
 block discarded – undo
2077 2077
 	public function getAllAirportInfo($airport = '')
2078 2078
 	{
2079 2079
 		
2080
-		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
2080
+		$airport = filter_var($airport, FILTER_SANITIZE_STRING);
2081 2081
 
2082 2082
 		$query_values = array();
2083 2083
 		if ($airport == 'NA') {
2084
-			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' => ''));
2084
+			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' => ''));
2085 2085
 		} elseif ($airport == '') {
2086 2086
 			$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";
2087 2087
 		} else {
@@ -2129,14 +2129,14 @@  discard block
 block discarded – undo
2129 2129
 	{
2130 2130
 		$lst_countries = '';
2131 2131
 		foreach ($countries as $country) {
2132
-			$country = filter_var($country,FILTER_SANITIZE_STRING);
2132
+			$country = filter_var($country, FILTER_SANITIZE_STRING);
2133 2133
 			if ($lst_countries == '') {
2134 2134
 				$lst_countries = "'".$country."'";
2135 2135
 			} else {
2136 2136
 				$lst_countries .= ",'".$country."'";
2137 2137
 			}
2138 2138
 		}
2139
-		$query  = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
2139
+		$query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
2140 2140
 		
2141 2141
 		$sth = $this->db->prepare($query);
2142 2142
 		$sth->execute();
@@ -2144,7 +2144,7 @@  discard block
 block discarded – undo
2144 2144
 		$airport_array = array();
2145 2145
 		$temp_array = array();
2146 2146
 		
2147
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2147
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2148 2148
 		{
2149 2149
 			$temp_array['name'] = $row['name'];
2150 2150
 			$temp_array['city'] = $row['city'];
@@ -2172,10 +2172,10 @@  discard block
 block discarded – undo
2172 2172
 	{
2173 2173
 		global $globalDBdriver;
2174 2174
 		if (is_array($coord)) {
2175
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2176
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2177
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2178
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2175
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2176
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2177
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2178
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2179 2179
 		} else return array();
2180 2180
 		if ($globalDBdriver == 'mysql') {
2181 2181
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
@@ -2187,7 +2187,7 @@  discard block
 block discarded – undo
2187 2187
     
2188 2188
 		$airport_array = array();
2189 2189
 		
2190
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2190
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2191 2191
 		{
2192 2192
 			$temp_array = $row;
2193 2193
 
@@ -2207,13 +2207,13 @@  discard block
 block discarded – undo
2207 2207
 	public function getAllWaypointsInfobyCoord($coord)
2208 2208
 	{
2209 2209
 		if (is_array($coord)) {
2210
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2211
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2212
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2213
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2210
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2211
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2212
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2213
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2214 2214
 		} else return array();
2215 2215
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2216
-		$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.")";
2216
+		$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.")";
2217 2217
 		//$query  = "SELECT waypoints.* FROM waypoints";
2218 2218
 		//$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";
2219 2219
 		//$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;
@@ -2225,7 +2225,7 @@  discard block
 block discarded – undo
2225 2225
     
2226 2226
 		$waypoints_array = array();
2227 2227
 		
2228
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2228
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2229 2229
 		{
2230 2230
 			$temp_array = $row;
2231 2231
 
@@ -2247,10 +2247,10 @@  discard block
 block discarded – undo
2247 2247
 	{
2248 2248
 		global $globalUseRealAirlines;
2249 2249
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2250
-		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2250
+		$airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING));
2251 2251
 		if ($airline_icao == 'NA') {
2252 2252
 			$airline_array = array();
2253
-			$airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2253
+			$airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2254 2254
 			return $airline_array;
2255 2255
 		} else {
2256 2256
 			if (strlen($airline_icao) == 2) {
@@ -2271,7 +2271,7 @@  discard block
 block discarded – undo
2271 2271
 			if ($fromsource === NULL) {
2272 2272
 				$sth->execute(array(':airline_icao' => $airline_icao));
2273 2273
 			} else {
2274
-				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2274
+				$sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource));
2275 2275
 			}
2276 2276
                         /*
2277 2277
 			$airline_array = array();
@@ -2316,13 +2316,13 @@  discard block
 block discarded – undo
2316 2316
 	{
2317 2317
 		global $globalUseRealAirlines;
2318 2318
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2319
-		$airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING));
2320
-		$query  = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1";
2319
+		$airline_name = strtolower(filter_var($airline_name, FILTER_SANITIZE_STRING));
2320
+		$query = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1";
2321 2321
 		$sth = $this->db->prepare($query);
2322 2322
 		if ($fromsource === NULL) {
2323 2323
 			$sth->execute(array(':airline_name' => $airline_name));
2324 2324
 		} else {
2325
-			$sth->execute(array(':airline_name' => $airline_name,':fromsource' => $fromsource));
2325
+			$sth->execute(array(':airline_name' => $airline_name, ':fromsource' => $fromsource));
2326 2326
 		}
2327 2327
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2328 2328
 		if (empty($result) && $fromsource !== NULL) {
@@ -2347,12 +2347,12 @@  discard block
 block discarded – undo
2347 2347
 	*/
2348 2348
 	public function getAllAircraftInfo($aircraft_type)
2349 2349
 	{
2350
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2350
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2351 2351
 
2352 2352
 		if ($aircraft_type == 'NA') {
2353
-			return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2353
+			return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2354 2354
 		}
2355
-		$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";
2355
+		$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";
2356 2356
 		
2357 2357
 		$sth = $this->db->prepare($query);
2358 2358
 		$sth->execute(array(':aircraft_type' => $aircraft_type));
@@ -2384,7 +2384,7 @@  discard block
 block discarded – undo
2384 2384
 	*/
2385 2385
 	public function getAircraftIcao($aircraft_type)
2386 2386
 	{
2387
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2387
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2388 2388
 		$all_aircraft = array('737-300' => 'B733',
2389 2389
 				'777-200' => 'B772',
2390 2390
 				'777-200ER' => 'B772',
@@ -2396,10 +2396,10 @@  discard block
 block discarded – undo
2396 2396
 				'A380' => 'A388');
2397 2397
 		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2398 2398
 
2399
-		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2399
+		$query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2400 2400
 		$aircraft_type = strtoupper($aircraft_type);
2401 2401
 		$sth = $this->db->prepare($query);
2402
-		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2402
+		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,));
2403 2403
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2404 2404
 		if (isset($result[0]['icao'])) return $result[0]['icao'];
2405 2405
 		else return '';
@@ -2412,10 +2412,10 @@  discard block
 block discarded – undo
2412 2412
 	* @return String aircraft type
2413 2413
 	*
2414 2414
 	*/
2415
-	public function getAllAircraftType($aircraft_modes,$source_type = '')
2415
+	public function getAllAircraftType($aircraft_modes, $source_type = '')
2416 2416
 	{
2417
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
2418
-		$source_type = filter_var($source_type,FILTER_SANITIZE_STRING);
2417
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
2418
+		$source_type = filter_var($source_type, FILTER_SANITIZE_STRING);
2419 2419
 
2420 2420
 		if ($source_type == '' || $source_type == 'modes') {
2421 2421
 			$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes AND aircraft_modes.source_type = 'modes' ORDER BY FirstCreated DESC LIMIT 1";
@@ -2446,9 +2446,9 @@  discard block
 block discarded – undo
2446 2446
 	*/
2447 2447
 	public function getAllAircraftTypeByRegistration($registration)
2448 2448
 	{
2449
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2449
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2450 2450
 
2451
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1";
2451
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1";
2452 2452
 		
2453 2453
 		$sth = $this->db->prepare($query);
2454 2454
 		$sth->execute(array(':registration' => $registration));
@@ -2469,9 +2469,9 @@  discard block
 block discarded – undo
2469 2469
 	*/
2470 2470
 	public function getAllIDByRegistration($registration)
2471 2471
 	{
2472
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2472
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2473 2473
 
2474
-		$query  = "SELECT spotter_id,flightaware_id, date FROM spotter_output WHERE spotter_output.registration = :registration";
2474
+		$query = "SELECT spotter_id,flightaware_id, date FROM spotter_output WHERE spotter_output.registration = :registration";
2475 2475
 		
2476 2476
 		$sth = $this->db->prepare($query);
2477 2477
 		$sth->execute(array(':registration' => $registration));
@@ -2479,7 +2479,7 @@  discard block
 block discarded – undo
2479 2479
 		$idarray = array();
2480 2480
 		while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
2481 2481
 			$date = $row['date'];
2482
-			$idarray[$date] = array('flightaware_id' => $row['flightaware_id'],'spotter_id' => $row['spotter_id']);
2482
+			$idarray[$date] = array('flightaware_id' => $row['flightaware_id'], 'spotter_id' => $row['spotter_id']);
2483 2483
 		}
2484 2484
 		return $idarray;
2485 2485
 	}
@@ -2493,8 +2493,8 @@  discard block
 block discarded – undo
2493 2493
 	*/
2494 2494
 	public function getOperator($operator)
2495 2495
 	{
2496
-		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
2497
-		$query  = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2496
+		$operator = filter_var($operator, FILTER_SANITIZE_STRING);
2497
+		$query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2498 2498
 		
2499 2499
 		$sth = $this->db->prepare($query);
2500 2500
 		$sth->execute(array(':operator' => $operator));
@@ -2515,9 +2515,9 @@  discard block
 block discarded – undo
2515 2515
 	*/
2516 2516
 	public function getRouteInfo($callsign)
2517 2517
 	{
2518
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2518
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
2519 2519
                 if ($callsign == '') return array();
2520
-		$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";
2520
+		$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";
2521 2521
 		
2522 2522
 		$sth = $this->db->prepare($query);
2523 2523
 		$sth->execute(array(':callsign' => $callsign));
@@ -2538,9 +2538,9 @@  discard block
 block discarded – undo
2538 2538
 	*/
2539 2539
 	public function getAircraftInfoByRegistration($registration)
2540 2540
 	{
2541
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2541
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2542 2542
 
2543
-		$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";
2543
+		$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";
2544 2544
 		
2545 2545
 		$sth = $this->db->prepare($query);
2546 2546
 		$sth->execute(array(':registration' => $registration));
@@ -2548,7 +2548,7 @@  discard block
 block discarded – undo
2548 2548
 		$aircraft_array = array();
2549 2549
 		$temp_array = array();
2550 2550
 		
2551
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2551
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2552 2552
 		{
2553 2553
 			$temp_array['airline_icao'] = $row['airline_icao'];
2554 2554
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -2570,7 +2570,7 @@  discard block
 block discarded – undo
2570 2570
 	*/
2571 2571
 	public function getAircraftOwnerByRegistration($registration)
2572 2572
 	{
2573
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2573
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2574 2574
 		$Connection = new Connection($this->db);
2575 2575
 		if ($Connection->tableExists('aircraft_owner')) {
2576 2576
 			$query  = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1";
@@ -2592,7 +2592,7 @@  discard block
 block discarded – undo
2592 2592
 	public function getAllFlightsforSitemap()
2593 2593
 	{
2594 2594
 		//$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 ";
2595
-		$query  = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2595
+		$query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2596 2596
 		
2597 2597
 		$sth = $this->db->prepare($query);
2598 2598
 		$sth->execute();
@@ -2639,7 +2639,7 @@  discard block
 block discarded – undo
2639 2639
 		$manufacturer_array = array();
2640 2640
 		$temp_array = array();
2641 2641
 		
2642
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2642
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2643 2643
 		{
2644 2644
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
2645 2645
 
@@ -2676,7 +2676,7 @@  discard block
 block discarded – undo
2676 2676
 		$aircraft_array = array();
2677 2677
 		$temp_array = array();
2678 2678
 		
2679
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2679
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2680 2680
 		{
2681 2681
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
2682 2682
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
@@ -2697,8 +2697,8 @@  discard block
 block discarded – undo
2697 2697
 	*/
2698 2698
 	public function getAllAircraftRegistrations($filters = array())
2699 2699
 	{
2700
-		$filter_query = $this->getFilter($filters,true,true);
2701
-		$query  = "SELECT DISTINCT spotter_output.registration 
2700
+		$filter_query = $this->getFilter($filters, true, true);
2701
+		$query = "SELECT DISTINCT spotter_output.registration 
2702 2702
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' 
2703 2703
 				ORDER BY spotter_output.registration ASC";
2704 2704
 
@@ -2708,7 +2708,7 @@  discard block
 block discarded – undo
2708 2708
 		$aircraft_array = array();
2709 2709
 		$temp_array = array();
2710 2710
 		
2711
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2711
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2712 2712
 		{
2713 2713
 			$temp_array['registration'] = $row['registration'];
2714 2714
 
@@ -2725,11 +2725,11 @@  discard block
 block discarded – undo
2725 2725
 	* @return Array list of source name
2726 2726
 	*
2727 2727
 	*/
2728
-	public function getAllSourceName($type = '',$filters = array())
2728
+	public function getAllSourceName($type = '', $filters = array())
2729 2729
 	{
2730
-		$filter_query = $this->getFilter($filters,true,true);
2730
+		$filter_query = $this->getFilter($filters, true, true);
2731 2731
 		$query_values = array();
2732
-		$query  = "SELECT DISTINCT spotter_output.source_name 
2732
+		$query = "SELECT DISTINCT spotter_output.source_name 
2733 2733
 				FROM spotter_output".$filter_query." spotter_output.source_name <> ''";
2734 2734
 		if ($type != '') {
2735 2735
 			$query_values = array(':type' => $type);
@@ -2744,7 +2744,7 @@  discard block
 block discarded – undo
2744 2744
 		$source_array = array();
2745 2745
 		$temp_array = array();
2746 2746
 		
2747
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2747
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2748 2748
 		{
2749 2749
 			$temp_array['source_name'] = $row['source_name'];
2750 2750
 			$source_array[] = $temp_array;
@@ -2760,11 +2760,11 @@  discard block
 block discarded – undo
2760 2760
 	* @return Array list of airline names
2761 2761
 	*
2762 2762
 	*/
2763
-	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2763
+	public function getAllAirlineNames($airline_type = '', $forsource = NULL, $filters = array())
2764 2764
 	{
2765
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2766
-		$filter_query = $this->getFilter($filters,true,true);
2767
-		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
2765
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2766
+		$filter_query = $this->getFilter($filters, true, true);
2767
+		$airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
2768 2768
 		if ($airline_type == '' || $airline_type == 'all') {
2769 2769
 			/*
2770 2770
 			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
@@ -2783,7 +2783,7 @@  discard block
 block discarded – undo
2783 2783
 				$query_data = array(':forsource' => $forsource);
2784 2784
 			}
2785 2785
 		} else {
2786
-			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2786
+			$query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2787 2787
 					FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
2788 2788
 					AND spotter_output.airline_type = :airline_type 
2789 2789
 					ORDER BY spotter_output.airline_icao ASC";
@@ -2796,7 +2796,7 @@  discard block
 block discarded – undo
2796 2796
 		$airline_array = array();
2797 2797
 		$temp_array = array();
2798 2798
 		
2799
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2799
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2800 2800
 		{
2801 2801
 			$temp_array['airline_icao'] = $row['airline_icao'];
2802 2802
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -2813,10 +2813,10 @@  discard block
 block discarded – undo
2813 2813
 	* @return Array list of alliance names
2814 2814
 	*
2815 2815
 	*/
2816
-	public function getAllAllianceNames($forsource = NULL,$filters = array())
2816
+	public function getAllAllianceNames($forsource = NULL, $filters = array())
2817 2817
 	{
2818
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2819
-		$filter_query = $this->getFilter($filters,true,true);
2818
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2819
+		$filter_query = $this->getFilter($filters, true, true);
2820 2820
 		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2821 2821
 		elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2822 2822
 		elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
@@ -2844,8 +2844,8 @@  discard block
 block discarded – undo
2844 2844
 	*/
2845 2845
 	public function getAllAirlineCountries($filters = array())
2846 2846
 	{
2847
-		$filter_query = $this->getFilter($filters,true,true);
2848
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2847
+		$filter_query = $this->getFilter($filters, true, true);
2848
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2849 2849
 				FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2850 2850
 				ORDER BY spotter_output.airline_country ASC";
2851 2851
 		
@@ -2856,7 +2856,7 @@  discard block
 block discarded – undo
2856 2856
 		$airline_array = array();
2857 2857
 		$temp_array = array();
2858 2858
 		
2859
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2859
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2860 2860
 		{
2861 2861
 			$temp_array['airline_country'] = $row['airline_country'];
2862 2862
 
@@ -2876,9 +2876,9 @@  discard block
 block discarded – undo
2876 2876
 	*/
2877 2877
 	public function getAllAirportNames($filters = array())
2878 2878
 	{
2879
-		$filter_query = $this->getFilter($filters,true,true);
2879
+		$filter_query = $this->getFilter($filters, true, true);
2880 2880
 		$airport_array = array();
2881
-		$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
2881
+		$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
2882 2882
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' 
2883 2883
 				ORDER BY spotter_output.departure_airport_city ASC";
2884 2884
 		
@@ -2887,7 +2887,7 @@  discard block
 block discarded – undo
2887 2887
 		$sth->execute();
2888 2888
 
2889 2889
 		$temp_array = array();
2890
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2890
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2891 2891
 		{
2892 2892
 			$temp_array['airport_icao'] = $row['airport_icao'];
2893 2893
 			$temp_array['airport_name'] = $row['airport_name'];
@@ -2897,14 +2897,14 @@  discard block
 block discarded – undo
2897 2897
 			$airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array;
2898 2898
 		}
2899 2899
 
2900
-		$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
2900
+		$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
2901 2901
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' 
2902 2902
 								ORDER BY spotter_output.arrival_airport_city ASC";
2903 2903
 					
2904 2904
 		$sth = $this->db->prepare($query);
2905 2905
 		$sth->execute();
2906 2906
 
2907
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2907
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2908 2908
 			{
2909 2909
 		//	if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao'])
2910 2910
 		//	{
@@ -2928,8 +2928,8 @@  discard block
 block discarded – undo
2928 2928
 	*/
2929 2929
 	public function getAllOwnerNames($filters = array())
2930 2930
 	{
2931
-		$filter_query = $this->getFilter($filters,true,true);
2932
-		$query  = "SELECT DISTINCT spotter_output.owner_name
2931
+		$filter_query = $this->getFilter($filters, true, true);
2932
+		$query = "SELECT DISTINCT spotter_output.owner_name
2933 2933
 				FROM spotter_output".$filter_query." spotter_output.owner_name <> '' 
2934 2934
 				ORDER BY spotter_output.owner_name ASC";
2935 2935
 		
@@ -2946,8 +2946,8 @@  discard block
 block discarded – undo
2946 2946
 	*/
2947 2947
 	public function getAllPilotNames($filters = array())
2948 2948
 	{
2949
-		$filter_query = $this->getFilter($filters,true,true);
2950
-		$query  = "SELECT DISTINCT spotter_output.pilot_name, spotter_output.pilot_id
2949
+		$filter_query = $this->getFilter($filters, true, true);
2950
+		$query = "SELECT DISTINCT spotter_output.pilot_name, spotter_output.pilot_id
2951 2951
 				FROM spotter_output".$filter_query." spotter_output.pilot_name <> '' 
2952 2952
 				ORDER BY spotter_output.pilot_name ASC";
2953 2953
 		
@@ -2980,21 +2980,21 @@  discard block
 block discarded – undo
2980 2980
    
2981 2981
 		$temp_array = array();
2982 2982
 		
2983
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2983
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2984 2984
 		{
2985 2985
 			$temp_array['airport_country'] = $row['airport_country'];
2986 2986
 
2987 2987
 			$airport_array[$row['airport_country']] = $temp_array;
2988 2988
 		}
2989
-		$filter_query = $this->getFilter($filters,true,true);
2990
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2989
+		$filter_query = $this->getFilter($filters, true, true);
2990
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2991 2991
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2992 2992
 								ORDER BY spotter_output.arrival_airport_country ASC";
2993 2993
 					
2994 2994
 		$sth = $this->db->prepare($query);
2995 2995
 		$sth->execute();
2996 2996
 		
2997
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2997
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2998 2998
 		{
2999 2999
 			if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country'])
3000 3000
 			{
@@ -3017,9 +3017,9 @@  discard block
 block discarded – undo
3017 3017
 	*/
3018 3018
 	public function getAllCountries($filters = array())
3019 3019
 	{
3020
-		$Connection= new Connection($this->db);
3020
+		$Connection = new Connection($this->db);
3021 3021
 		if ($Connection->tableExists('countries')) {
3022
-			$query  = "SELECT countries.name AS airport_country
3022
+			$query = "SELECT countries.name AS airport_country
3023 3023
 				FROM countries
3024 3024
 				ORDER BY countries.name ASC";
3025 3025
 			$sth = $this->db->prepare($query);
@@ -3028,14 +3028,14 @@  discard block
 block discarded – undo
3028 3028
 			$temp_array = array();
3029 3029
 			$country_array = array();
3030 3030
 		
3031
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
3031
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3032 3032
 			{
3033 3033
 				$temp_array['country'] = $row['airport_country'];
3034 3034
 				$country_array[$row['airport_country']] = $temp_array;
3035 3035
 			}
3036 3036
 		} else {
3037
-			$filter_query = $this->getFilter($filters,true,true);
3038
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
3037
+			$filter_query = $this->getFilter($filters, true, true);
3038
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
3039 3039
 								FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' 
3040 3040
 								ORDER BY spotter_output.departure_airport_country ASC";
3041 3041
 
@@ -3044,20 +3044,20 @@  discard block
 block discarded – undo
3044 3044
    
3045 3045
 			$temp_array = array();
3046 3046
 			$country_array = array();
3047
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
3047
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3048 3048
 			{
3049 3049
 				$temp_array['country'] = $row['airport_country'];
3050 3050
 				$country_array[$row['airport_country']] = $temp_array;
3051 3051
 			}
3052 3052
 
3053
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
3053
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
3054 3054
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
3055 3055
 								ORDER BY spotter_output.arrival_airport_country ASC";
3056 3056
 					
3057 3057
 		$sth = $this->db->prepare($query);
3058 3058
 		$sth->execute();
3059 3059
 		
3060
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3060
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3061 3061
 		{
3062 3062
 			if ($country_array[$row['airport_country']]['country'] != $row['airport_country'])
3063 3063
 			{
@@ -3067,14 +3067,14 @@  discard block
 block discarded – undo
3067 3067
 			}
3068 3068
 		}
3069 3069
 		
3070
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
3070
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
3071 3071
 								FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
3072 3072
 								ORDER BY spotter_output.airline_country ASC";
3073 3073
 					
3074 3074
 		$sth = $this->db->prepare($query);
3075 3075
 		$sth->execute();
3076 3076
 		
3077
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3077
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3078 3078
 		{
3079 3079
 			if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country'])
3080 3080
 			{
@@ -3098,8 +3098,8 @@  discard block
 block discarded – undo
3098 3098
 	*/
3099 3099
 	public function getAllIdents($filters = array())
3100 3100
 	{
3101
-		$filter_query = $this->getFilter($filters,true,true);
3102
-		$query  = "SELECT DISTINCT spotter_output.ident
3101
+		$filter_query = $this->getFilter($filters, true, true);
3102
+		$query = "SELECT DISTINCT spotter_output.ident
3103 3103
 								FROM spotter_output".$filter_query." spotter_output.ident <> '' 
3104 3104
 								ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0";
3105 3105
 
@@ -3109,7 +3109,7 @@  discard block
 block discarded – undo
3109 3109
 		$ident_array = array();
3110 3110
 		$temp_array = array();
3111 3111
 		
3112
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3112
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3113 3113
 		{
3114 3114
 			$temp_array['ident'] = $row['ident'];
3115 3115
 			$ident_array[] = $temp_array;
@@ -3123,9 +3123,9 @@  discard block
 block discarded – undo
3123 3123
 	* @return Array number, icao, name and city of airports
3124 3124
 	*/
3125 3125
 
3126
-	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
3126
+	public function getLast7DaysAirportsDeparture($airport_icao = '', $filters = array()) {
3127 3127
 		global $globalTimezone, $globalDBdriver;
3128
-		$filter_query = $this->getFilter($filters,true,true);
3128
+		$filter_query = $this->getFilter($filters, true, true);
3129 3129
 		if ($globalTimezone != '') {
3130 3130
 			date_default_timezone_set($globalTimezone);
3131 3131
 			$datetime = new DateTime();
@@ -3190,7 +3190,7 @@  discard block
 block discarded – undo
3190 3190
 
3191 3191
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
3192 3192
 		global $globalTimezone, $globalDBdriver;
3193
-		$filter_query = $this->getFilter($filters,true,true);
3193
+		$filter_query = $this->getFilter($filters, true, true);
3194 3194
 		if ($globalTimezone != '') {
3195 3195
 			date_default_timezone_set($globalTimezone);
3196 3196
 			$datetime = new DateTime();
@@ -3274,7 +3274,7 @@  discard block
 block discarded – undo
3274 3274
 
3275 3275
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
3276 3276
 		global $globalTimezone, $globalDBdriver;
3277
-		$filter_query = $this->getFilter($filters,true,true);
3277
+		$filter_query = $this->getFilter($filters, true, true);
3278 3278
 		if ($globalTimezone != '') {
3279 3279
 			date_default_timezone_set($globalTimezone);
3280 3280
 			$datetime = new DateTime();
@@ -3307,9 +3307,9 @@  discard block
 block discarded – undo
3307 3307
 	* @return Array number, icao, name and city of airports
3308 3308
 	*/
3309 3309
 
3310
-	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3310
+	public function getLast7DaysDetectedAirportsArrival($airport_icao = '', $filters = array()) {
3311 3311
 		global $globalTimezone, $globalDBdriver;
3312
-		$filter_query = $this->getFilter($filters,true,true);
3312
+		$filter_query = $this->getFilter($filters, true, true);
3313 3313
 		if ($globalTimezone != '') {
3314 3314
 			date_default_timezone_set($globalTimezone);
3315 3315
 			$datetime = new DateTime();
@@ -3441,12 +3441,12 @@  discard block
 block discarded – undo
3441 3441
 		} else $offset = '+00:00';
3442 3442
 
3443 3443
 		if ($globalDBdriver == 'mysql') {
3444
-			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3444
+			$query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3445 3445
 								FROM spotter_output
3446 3446
 								WHERE spotter_output.date <> '' 
3447 3447
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
3448 3448
 		} else {
3449
-			$query  = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3449
+			$query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3450 3450
 								FROM spotter_output
3451 3451
 								WHERE spotter_output.date <> '' 
3452 3452
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
@@ -3458,7 +3458,7 @@  discard block
 block discarded – undo
3458 3458
 		$date_array = array();
3459 3459
 		$temp_array = array();
3460 3460
 		
3461
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3461
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3462 3462
 		{
3463 3463
 			$temp_array['date'] = $row['date'];
3464 3464
 
@@ -3478,7 +3478,7 @@  discard block
 block discarded – undo
3478 3478
 	*/
3479 3479
 	public function getAllRoutes()
3480 3480
 	{
3481
-		$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 
3481
+		$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 
3482 3482
 				FROM spotter_output
3483 3483
 				WHERE spotter_output.ident <> '' 
3484 3484
 				GROUP BY route
@@ -3489,7 +3489,7 @@  discard block
 block discarded – undo
3489 3489
 
3490 3490
 		$routes_array = array();
3491 3491
 		$temp_array = array();
3492
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3492
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3493 3493
 		{
3494 3494
 			$temp_array['route'] = $row['route'];
3495 3495
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -3508,21 +3508,21 @@  discard block
 block discarded – undo
3508 3508
 	* @return String success or false
3509 3509
 	*
3510 3510
 	*/	
3511
-	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3511
+	public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL)
3512 3512
 	{
3513 3513
 		if (!is_numeric(substr($ident, 0, 3)))
3514 3514
 		{
3515 3515
 			if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3516
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3516
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3517 3517
 			} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3518
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3518
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3519 3519
 			} else {
3520 3520
 				$airline_array = $this->getAllAirlineInfo("NA");
3521 3521
 			}
3522 3522
 			if (count($airline_array) == 0) {
3523 3523
 				$airline_array = $this->getAllAirlineInfo("NA");
3524 3524
 			}
3525
-			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3525
+			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3526 3526
 				$airline_array = $this->getAllAirlineInfo("NA");
3527 3527
 			}
3528 3528
 		} else {
@@ -3535,7 +3535,7 @@  discard block
 block discarded – undo
3535 3535
 
3536 3536
 
3537 3537
 		$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';
3538
-                $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);
3538
+                $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);
3539 3539
 
3540 3540
 		try {
3541 3541
 			$sth = $this->db->prepare($query);
@@ -3556,11 +3556,11 @@  discard block
 block discarded – undo
3556 3556
 	* @return String success or false
3557 3557
 	*
3558 3558
 	*/	
3559
-	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3559
+	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '')
3560 3560
 	{
3561 3561
 		if ($groundspeed == '') $groundspeed = NULL;
3562 3562
 		$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';
3563
-                $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);
3563
+                $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);
3564 3564
 
3565 3565
 		try {
3566 3566
 			$sth = $this->db->prepare($query);
@@ -3600,7 +3600,7 @@  discard block
 block discarded – undo
3600 3600
 	* @param String $verticalrate vertival rate of flight
3601 3601
 	* @return String success or false
3602 3602
 	*/
3603
-	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$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 = '',$source_type = '')
3603
+	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '', $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 = '', $source_type = '')
3604 3604
 	{
3605 3605
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
3606 3606
 		
@@ -3623,14 +3623,14 @@  discard block
 block discarded – undo
3623 3623
 			} else {
3624 3624
 				if ($ModeS != '') {
3625 3625
 					$timeelapsed = microtime(true);
3626
-					$registration = $this->getAircraftRegistrationBymodeS($ModeS,$source_type);
3627
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3626
+					$registration = $this->getAircraftRegistrationBymodeS($ModeS, $source_type);
3627
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3628 3628
 				} else {
3629
-					$myhex = explode('-',$flightaware_id);
3629
+					$myhex = explode('-', $flightaware_id);
3630 3630
 					if (count($myhex) > 0) {
3631 3631
 						$timeelapsed = microtime(true);
3632
-						$registration = $this->getAircraftRegistrationBymodeS($myhex[0],$source_type);
3633
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3632
+						$registration = $this->getAircraftRegistrationBymodeS($myhex[0], $source_type);
3633
+						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3634 3634
 					}
3635 3635
 				}
3636 3636
 			}
@@ -3652,24 +3652,24 @@  discard block
 block discarded – undo
3652 3652
 				{
3653 3653
 					$timeelapsed = microtime(true);
3654 3654
 					if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3655
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3655
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3656 3656
 					} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3657
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3657
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3658 3658
 					} else {
3659 3659
 						$airline_array = $this->getAllAirlineInfo("NA");
3660 3660
 					}
3661 3661
 					if (count($airline_array) == 0) {
3662 3662
 						$airline_array = $this->getAllAirlineInfo("NA");
3663 3663
 					}
3664
-					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3664
+					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3665 3665
 						$airline_array = $this->getAllAirlineInfo("NA");
3666 3666
 					}
3667
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3667
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3668 3668
 
3669 3669
 				} else {
3670 3670
 					$timeelapsed = microtime(true);
3671 3671
 					$airline_array = $this->getAllAirlineInfo("NA");
3672
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3672
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3673 3673
 				}
3674 3674
 			}
3675 3675
 		} else $airline_array = array();
@@ -3686,27 +3686,27 @@  discard block
 block discarded – undo
3686 3686
 				{
3687 3687
 					$timeelapsed = microtime(true);
3688 3688
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3689
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3689
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3690 3690
 				} else {
3691 3691
 					$timeelapsed = microtime(true);
3692 3692
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3693
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3693
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3694 3694
 				}
3695 3695
 			}
3696 3696
 		} else {
3697 3697
 			if ($ModeS != '') {
3698 3698
 				$timeelapsed = microtime(true);
3699
-				$aircraft_icao = $this->getAllAircraftType($ModeS,$source_type);
3700
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3699
+				$aircraft_icao = $this->getAllAircraftType($ModeS, $source_type);
3700
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3701 3701
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3702 3702
 				{
3703 3703
 					$timeelapsed = microtime(true);
3704 3704
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3705
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3705
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3706 3706
 				} else {
3707 3707
 					$timeelapsed = microtime(true);
3708 3708
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3709
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3709
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3710 3710
 				}
3711 3711
 			}
3712 3712
 		}
@@ -3722,7 +3722,7 @@  discard block
 block discarded – undo
3722 3722
 			} else {
3723 3723
 				$timeelapsed = microtime(true);
3724 3724
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3725
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3725
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3726 3726
 			}
3727 3727
 		}
3728 3728
 		
@@ -3737,7 +3737,7 @@  discard block
 block discarded – undo
3737 3737
 			} else {
3738 3738
 				$timeelapsed = microtime(true);
3739 3739
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3740
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3740
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3741 3741
 			}
3742 3742
 		}
3743 3743
 
@@ -3790,7 +3790,7 @@  discard block
 block discarded – undo
3790 3790
 		}
3791 3791
 
3792 3792
     
3793
-		if ($date == "" || strtotime($date) < time()-20*60)
3793
+		if ($date == "" || strtotime($date) < time() - 20*60)
3794 3794
 		{
3795 3795
 			$date = date("Y-m-d H:i:s", time());
3796 3796
 		}
@@ -3800,7 +3800,7 @@  discard block
 block discarded – undo
3800 3800
 		{
3801 3801
 			$timeelapsed = microtime(true);
3802 3802
 			$image_array = $Image->getSpotterImage($registration);
3803
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3803
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3804 3804
 			if (!isset($image_array[0]['registration']))
3805 3805
 			{
3806 3806
 				//echo "Add image !!!! \n";
@@ -3808,7 +3808,7 @@  discard block
 block discarded – undo
3808 3808
 			}
3809 3809
 			$timeelapsed = microtime(true);
3810 3810
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3811
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3811
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3812 3812
 			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3813 3813
 		}
3814 3814
     
@@ -3816,33 +3816,33 @@  discard block
 block discarded – undo
3816 3816
 		{
3817 3817
             		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3818 3818
             		else $airline_icao = '';
3819
-			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3819
+			$image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao);
3820 3820
 			if (!isset($image_array[0]['registration']))
3821 3821
 			{
3822 3822
 				//echo "Add image !!!! \n";
3823
-				$Image->addSpotterImage('',$aircraft_icao,$airline_icao);
3823
+				$Image->addSpotterImage('', $aircraft_icao, $airline_icao);
3824 3824
 			}
3825 3825
 		}
3826 3826
     
3827
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
3828
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
3829
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
3830
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3831
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
3832
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
3833
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3834
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3835
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
3836
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3837
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
3838
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3839
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
3840
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
3841
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
3842
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
3843
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
3844
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
3845
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
3827
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
3828
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
3829
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
3830
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3831
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
3832
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
3833
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3834
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3835
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
3836
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3837
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
3838
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3839
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
3840
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
3841
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
3842
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
3843
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
3844
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
3845
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
3846 3846
 	
3847 3847
 		if (count($airline_array) == 0) 
3848 3848
 		{
@@ -3870,7 +3870,7 @@  discard block
 block discarded – undo
3870 3870
                 if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3871 3871
                 if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3872 3872
                 if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3873
-                $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) 
3873
+                $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) 
3874 3874
                 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)";
3875 3875
 
3876 3876
                 $airline_name = $airline_array[0]['name'];
@@ -3880,7 +3880,7 @@  discard block
 block discarded – undo
3880 3880
 		if ($airline_type == '') {
3881 3881
 			$timeelapsed = microtime(true);
3882 3882
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3883
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3883
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3884 3884
 		}
3885 3885
 		if ($airline_type == null) $airline_type = '';
3886 3886
                 $aircraft_type = $aircraft_array[0]['type'];
@@ -3892,7 +3892,7 @@  discard block
 block discarded – undo
3892 3892
                 $arrival_airport_name = $arrival_airport_array[0]['name'];
3893 3893
                 $arrival_airport_city = $arrival_airport_array[0]['city'];
3894 3894
                 $arrival_airport_country = $arrival_airport_array[0]['country'];
3895
-                $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);
3895
+                $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);
3896 3896
 
3897 3897
 		try {
3898 3898
 		        
@@ -3918,13 +3918,13 @@  discard block
 block discarded – undo
3918 3918
 	{
3919 3919
 		global $globalDBdriver, $globalTimezone;
3920 3920
 		if ($globalDBdriver == 'mysql') {
3921
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3921
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3922 3922
 								WHERE spotter_output.ident = :ident 
3923 3923
 								AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
3924 3924
 								AND spotter_output.date < UTC_TIMESTAMP()";
3925 3925
 			$query_data = array(':ident' => $ident);
3926 3926
 		} else {
3927
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3927
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3928 3928
 								WHERE spotter_output.ident = :ident 
3929 3929
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3930 3930
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
@@ -3933,8 +3933,8 @@  discard block
 block discarded – undo
3933 3933
 		
3934 3934
 		$sth = $this->db->prepare($query);
3935 3935
 		$sth->execute($query_data);
3936
-    		$ident_result='';
3937
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3936
+    		$ident_result = '';
3937
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3938 3938
 		{
3939 3939
 			$ident_result = $row['ident'];
3940 3940
 		}
@@ -3960,8 +3960,8 @@  discard block
 block discarded – undo
3960 3960
 				return false;
3961 3961
 			} else {
3962 3962
 				$q_array = explode(" ", $q);
3963
-				foreach ($q_array as $q_item){
3964
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
3963
+				foreach ($q_array as $q_item) {
3964
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
3965 3965
 					$additional_query .= " AND (";
3966 3966
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
3967 3967
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
@@ -3976,11 +3976,11 @@  discard block
 block discarded – undo
3976 3976
 			}
3977 3977
 		}
3978 3978
 		if ($globalDBdriver == 'mysql') {
3979
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3979
+			$query = "SELECT spotter_output.* FROM spotter_output 
3980 3980
 				WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
3981 3981
 				AND spotter_output.date < UTC_TIMESTAMP()";
3982 3982
 		} else {
3983
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3983
+			$query = "SELECT spotter_output.* FROM spotter_output 
3984 3984
 				WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
3985 3985
 				AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
3986 3986
 		}
@@ -3997,11 +3997,11 @@  discard block
 block discarded – undo
3997 3997
 	* @return Array the airline list
3998 3998
 	*
3999 3999
 	*/
4000
-	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(), $year = '', $month = '', $day = '')
4000
+	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4001 4001
 	{
4002 4002
 		global $globalDBdriver;
4003
-		$filter_query = $this->getFilter($filters,true,true);
4004
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4003
+		$filter_query = $this->getFilter($filters, true, true);
4004
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4005 4005
 		 			FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA'";
4006 4006
 		if ($olderthanmonths > 0) {
4007 4007
 			if ($globalDBdriver == 'mysql') {
@@ -4021,28 +4021,28 @@  discard block
 block discarded – undo
4021 4021
 		if ($year != '') {
4022 4022
 			if ($globalDBdriver == 'mysql') {
4023 4023
 				$query .= " AND YEAR(spotter_output.date) = :year";
4024
-				$query_values = array_merge($query_values,array(':year' => $year));
4024
+				$query_values = array_merge($query_values, array(':year' => $year));
4025 4025
 			} else {
4026 4026
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4027
-				$query_values = array_merge($query_values,array(':year' => $year));
4027
+				$query_values = array_merge($query_values, array(':year' => $year));
4028 4028
 			}
4029 4029
 		}
4030 4030
 		if ($month != '') {
4031 4031
 			if ($globalDBdriver == 'mysql') {
4032 4032
 				$query .= " AND MONTH(spotter_output.date) = :month";
4033
-				$query_values = array_merge($query_values,array(':month' => $month));
4033
+				$query_values = array_merge($query_values, array(':month' => $month));
4034 4034
 			} else {
4035 4035
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4036
-				$query_values = array_merge($query_values,array(':month' => $month));
4036
+				$query_values = array_merge($query_values, array(':month' => $month));
4037 4037
 			}
4038 4038
 		}
4039 4039
 		if ($day != '') {
4040 4040
 			if ($globalDBdriver == 'mysql') {
4041 4041
 				$query .= " AND DAY(spotter_output.date) = :day";
4042
-				$query_values = array_merge($query_values,array(':day' => $day));
4042
+				$query_values = array_merge($query_values, array(':day' => $day));
4043 4043
 			} else {
4044 4044
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4045
-				$query_values = array_merge($query_values,array(':day' => $day));
4045
+				$query_values = array_merge($query_values, array(':day' => $day));
4046 4046
 			}
4047 4047
 		}
4048 4048
 		$query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
@@ -4052,7 +4052,7 @@  discard block
 block discarded – undo
4052 4052
 		$sth->execute($query_values);
4053 4053
 		$airline_array = array();
4054 4054
 		$temp_array = array();
4055
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4055
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4056 4056
 		{
4057 4057
 			$temp_array['airline_name'] = $row['airline_name'];
4058 4058
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4069,11 +4069,11 @@  discard block
 block discarded – undo
4069 4069
 	* @return Array the pilots list
4070 4070
 	*
4071 4071
 	*/
4072
-	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '',$day = '')
4072
+	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4073 4073
 	{
4074 4074
 		global $globalDBdriver;
4075
-		$filter_query = $this->getFilter($filters,true,true);
4076
-		$query  = "SELECT DISTINCT spotter_output.pilot_id, s.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4075
+		$filter_query = $this->getFilter($filters, true, true);
4076
+		$query = "SELECT DISTINCT spotter_output.pilot_id, s.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4077 4077
 			FROM spotter_output LEFT JOIN (SELECT DISTINCT pilot_id, pilot_name, max(date) as date FROM spotter_output GROUP BY pilot_id, pilot_name) s ON s.pilot_id = spotter_output.pilot_id".$filter_query." spotter_output.pilot_id <> ''";
4078 4078
                 if ($olderthanmonths > 0) {
4079 4079
             		if ($globalDBdriver == 'mysql') {
@@ -4093,28 +4093,28 @@  discard block
 block discarded – undo
4093 4093
 		if ($year != '') {
4094 4094
 			if ($globalDBdriver == 'mysql') {
4095 4095
 				$query .= " AND YEAR(spotter_output.date) = :year";
4096
-				$query_values = array_merge($query_values,array(':year' => $year));
4096
+				$query_values = array_merge($query_values, array(':year' => $year));
4097 4097
 			} else {
4098 4098
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4099
-				$query_values = array_merge($query_values,array(':year' => $year));
4099
+				$query_values = array_merge($query_values, array(':year' => $year));
4100 4100
 			}
4101 4101
 		}
4102 4102
 		if ($month != '') {
4103 4103
 			if ($globalDBdriver == 'mysql') {
4104 4104
 				$query .= " AND MONTH(spotter_output.date) = :month";
4105
-				$query_values = array_merge($query_values,array(':month' => $month));
4105
+				$query_values = array_merge($query_values, array(':month' => $month));
4106 4106
 			} else {
4107 4107
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4108
-				$query_values = array_merge($query_values,array(':month' => $month));
4108
+				$query_values = array_merge($query_values, array(':month' => $month));
4109 4109
 			}
4110 4110
 		}
4111 4111
 		if ($day != '') {
4112 4112
 			if ($globalDBdriver == 'mysql') {
4113 4113
 				$query .= " AND DAY(spotter_output.date) = :day";
4114
-				$query_values = array_merge($query_values,array(':day' => $day));
4114
+				$query_values = array_merge($query_values, array(':day' => $day));
4115 4115
 			} else {
4116 4116
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4117
-				$query_values = array_merge($query_values,array(':day' => $day));
4117
+				$query_values = array_merge($query_values, array(':day' => $day));
4118 4118
 			}
4119 4119
 		}
4120 4120
 		
@@ -4126,7 +4126,7 @@  discard block
 block discarded – undo
4126 4126
 		$sth->execute($query_values);
4127 4127
 		$airline_array = array();
4128 4128
 		$temp_array = array();
4129
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4129
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4130 4130
 		{
4131 4131
 			$temp_array['pilot_name'] = $row['pilot_name'];
4132 4132
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -4146,7 +4146,7 @@  discard block
 block discarded – undo
4146 4146
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
4147 4147
 	{
4148 4148
 		global $globalDBdriver;
4149
-		$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
4149
+		$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
4150 4150
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
4151 4151
                 if ($olderthanmonths > 0) {
4152 4152
             		if ($globalDBdriver == 'mysql') {
@@ -4172,7 +4172,7 @@  discard block
 block discarded – undo
4172 4172
 		$airline_array = array();
4173 4173
 		$temp_array = array();
4174 4174
         
4175
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4175
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4176 4176
 		{
4177 4177
 			$temp_array['pilot_name'] = $row['pilot_name'];
4178 4178
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -4190,11 +4190,11 @@  discard block
 block discarded – undo
4190 4190
 	* @return Array the pilots list
4191 4191
 	*
4192 4192
 	*/
4193
-	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4193
+	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4194 4194
 	{
4195 4195
 		global $globalDBdriver;
4196
-		$filter_query = $this->getFilter($filters,true,true);
4197
-		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4196
+		$filter_query = $this->getFilter($filters, true, true);
4197
+		$query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4198 4198
 					FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL";
4199 4199
                 if ($olderthanmonths > 0) {
4200 4200
             		if ($globalDBdriver == 'mysql') {
@@ -4214,28 +4214,28 @@  discard block
 block discarded – undo
4214 4214
 		if ($year != '') {
4215 4215
 			if ($globalDBdriver == 'mysql') {
4216 4216
 				$query .= " AND YEAR(spotter_output.date) = :year";
4217
-				$query_values = array_merge($query_values,array(':year' => $year));
4217
+				$query_values = array_merge($query_values, array(':year' => $year));
4218 4218
 			} else {
4219 4219
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4220
-				$query_values = array_merge($query_values,array(':year' => $year));
4220
+				$query_values = array_merge($query_values, array(':year' => $year));
4221 4221
 			}
4222 4222
 		}
4223 4223
 		if ($month != '') {
4224 4224
 			if ($globalDBdriver == 'mysql') {
4225 4225
 				$query .= " AND MONTH(spotter_output.date) = :month";
4226
-				$query_values = array_merge($query_values,array(':month' => $month));
4226
+				$query_values = array_merge($query_values, array(':month' => $month));
4227 4227
 			} else {
4228 4228
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4229
-				$query_values = array_merge($query_values,array(':month' => $month));
4229
+				$query_values = array_merge($query_values, array(':month' => $month));
4230 4230
 			}
4231 4231
 		}
4232 4232
 		if ($day != '') {
4233 4233
 			if ($globalDBdriver == 'mysql') {
4234 4234
 				$query .= " AND DAY(spotter_output.date) = :day";
4235
-				$query_values = array_merge($query_values,array(':day' => $day));
4235
+				$query_values = array_merge($query_values, array(':day' => $day));
4236 4236
 			} else {
4237 4237
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4238
-				$query_values = array_merge($query_values,array(':day' => $day));
4238
+				$query_values = array_merge($query_values, array(':day' => $day));
4239 4239
 			}
4240 4240
 		}
4241 4241
 		$query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
@@ -4245,7 +4245,7 @@  discard block
 block discarded – undo
4245 4245
 		$sth->execute($query_values);
4246 4246
 		$airline_array = array();
4247 4247
 		$temp_array = array();
4248
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4248
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4249 4249
 		{
4250 4250
 			$temp_array['owner_name'] = $row['owner_name'];
4251 4251
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -4260,11 +4260,11 @@  discard block
 block discarded – undo
4260 4260
 	* @return Array the pilots list
4261 4261
 	*
4262 4262
 	*/
4263
-	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
4263
+	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4264 4264
 	{
4265 4265
 		global $globalDBdriver;
4266
-		$filter_query = $this->getFilter($filters,true,true);
4267
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4266
+		$filter_query = $this->getFilter($filters, true, true);
4267
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4268 4268
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
4269 4269
                 if ($olderthanmonths > 0) {
4270 4270
             		if ($globalDBdriver == 'mysql') {
@@ -4290,7 +4290,7 @@  discard block
 block discarded – undo
4290 4290
 		$airline_array = array();
4291 4291
 		$temp_array = array();
4292 4292
         
4293
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4293
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4294 4294
 		{
4295 4295
 			$temp_array['owner_name'] = $row['owner_name'];
4296 4296
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -4306,11 +4306,11 @@  discard block
 block discarded – undo
4306 4306
 	* @return Array the airline list
4307 4307
 	*
4308 4308
 	*/
4309
-	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
4309
+	public function countAllAirlinesByAircraft($aircraft_icao, $filters = array())
4310 4310
 	{
4311
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4312
-		$filter_query = $this->getFilter($filters,true,true);
4313
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4311
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4312
+		$filter_query = $this->getFilter($filters, true, true);
4313
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4314 4314
 		 	    FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
4315 4315
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4316 4316
 			    ORDER BY airline_count DESC";
@@ -4322,7 +4322,7 @@  discard block
 block discarded – undo
4322 4322
 		$airline_array = array();
4323 4323
 		$temp_array = array();
4324 4324
         
4325
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4325
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4326 4326
 		{
4327 4327
 			$temp_array['airline_name'] = $row['airline_name'];
4328 4328
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4342,11 +4342,11 @@  discard block
 block discarded – undo
4342 4342
 	* @return Array the airline country list
4343 4343
 	*
4344 4344
 	*/
4345
-	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
4345
+	public function countAllAirlineCountriesByAircraft($aircraft_icao, $filters = array())
4346 4346
 	{
4347
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4348
-		$filter_query = $this->getFilter($filters,true,true);
4349
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4347
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4348
+		$filter_query = $this->getFilter($filters, true, true);
4349
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4350 4350
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
4351 4351
                     GROUP BY spotter_output.airline_country
4352 4352
 					ORDER BY airline_country_count DESC
@@ -4359,7 +4359,7 @@  discard block
 block discarded – undo
4359 4359
 		$airline_country_array = array();
4360 4360
 		$temp_array = array();
4361 4361
         
4362
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4362
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4363 4363
 		{
4364 4364
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4365 4365
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4378,11 +4378,11 @@  discard block
 block discarded – undo
4378 4378
 	* @return Array the airline list
4379 4379
 	*
4380 4380
 	*/
4381
-	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4381
+	public function countAllAirlinesByAirport($airport_icao, $filters = array())
4382 4382
 	{
4383
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4384
-		$filter_query = $this->getFilter($filters,true,true);
4385
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4383
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4384
+		$filter_query = $this->getFilter($filters, true, true);
4385
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4386 4386
 		    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 ) 
4387 4387
                     GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country
4388 4388
 		    ORDER BY airline_count DESC";
@@ -4394,7 +4394,7 @@  discard block
 block discarded – undo
4394 4394
 		$airline_array = array();
4395 4395
 		$temp_array = array();
4396 4396
         
4397
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4397
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4398 4398
 		{
4399 4399
 			$temp_array['airline_name'] = $row['airline_name'];
4400 4400
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4413,11 +4413,11 @@  discard block
 block discarded – undo
4413 4413
 	* @return Array the airline country list
4414 4414
 	*
4415 4415
 	*/
4416
-	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4416
+	public function countAllAirlineCountriesByAirport($airport_icao, $filters = array())
4417 4417
 	{
4418
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4419
-		$filter_query = $this->getFilter($filters,true,true);
4420
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4418
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4419
+		$filter_query = $this->getFilter($filters, true, true);
4420
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4421 4421
 		 			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 )
4422 4422
 					GROUP BY spotter_output.airline_country
4423 4423
 					ORDER BY airline_country_count DESC
@@ -4430,7 +4430,7 @@  discard block
 block discarded – undo
4430 4430
 		$airline_country_array = array();
4431 4431
 		$temp_array = array();
4432 4432
         
4433
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4433
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4434 4434
 		{
4435 4435
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4436 4436
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4447,11 +4447,11 @@  discard block
 block discarded – undo
4447 4447
 	* @return Array the airline list
4448 4448
 	*
4449 4449
 	*/
4450
-	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4450
+	public function countAllAirlinesByManufacturer($aircraft_manufacturer, $filters = array())
4451 4451
 	{
4452
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4453
-		$filter_query = $this->getFilter($filters,true,true);
4454
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4452
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4453
+		$filter_query = $this->getFilter($filters, true, true);
4454
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4455 4455
 		 			FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4456 4456
 					GROUP BY spotter_output.airline_name
4457 4457
 					ORDER BY airline_count DESC";
@@ -4462,7 +4462,7 @@  discard block
 block discarded – undo
4462 4462
 		$airline_array = array();
4463 4463
 		$temp_array = array();
4464 4464
         
4465
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4465
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4466 4466
 		{
4467 4467
 			$temp_array['airline_name'] = $row['airline_name'];
4468 4468
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4482,11 +4482,11 @@  discard block
 block discarded – undo
4482 4482
 	* @return Array the airline country list
4483 4483
 	*
4484 4484
 	*/
4485
-	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4485
+	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer, $filters = array())
4486 4486
 	{
4487
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4488
-		$filter_query = $this->getFilter($filters,true,true);
4489
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4487
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4488
+		$filter_query = $this->getFilter($filters, true, true);
4489
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4490 4490
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4491 4491
 					GROUP BY spotter_output.airline_country
4492 4492
 					ORDER BY airline_country_count DESC
@@ -4499,7 +4499,7 @@  discard block
 block discarded – undo
4499 4499
 		$airline_country_array = array();
4500 4500
 		$temp_array = array();
4501 4501
         
4502
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4502
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4503 4503
 		{
4504 4504
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4505 4505
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4515,11 +4515,11 @@  discard block
 block discarded – undo
4515 4515
 	* @return Array the airline list
4516 4516
 	*
4517 4517
 	*/
4518
-	public function countAllAirlinesByDate($date,$filters = array())
4518
+	public function countAllAirlinesByDate($date, $filters = array())
4519 4519
 	{
4520 4520
 		global $globalTimezone, $globalDBdriver;
4521
-		$filter_query = $this->getFilter($filters,true,true);
4522
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4521
+		$filter_query = $this->getFilter($filters, true, true);
4522
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4523 4523
 		if ($globalTimezone != '') {
4524 4524
 			date_default_timezone_set($globalTimezone);
4525 4525
 			$datetime = new DateTime($date);
@@ -4527,12 +4527,12 @@  discard block
 block discarded – undo
4527 4527
 		} else $offset = '+00:00';
4528 4528
 
4529 4529
 		if ($globalDBdriver == 'mysql') {
4530
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4530
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4531 4531
 		 			FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4532 4532
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country 
4533 4533
 					ORDER BY airline_count DESC";
4534 4534
 		} else {
4535
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4535
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4536 4536
 		 			FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4537 4537
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country
4538 4538
 					ORDER BY airline_count DESC";
@@ -4543,7 +4543,7 @@  discard block
 block discarded – undo
4543 4543
 
4544 4544
 		$airline_array = array();
4545 4545
 		$temp_array = array();
4546
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4546
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4547 4547
 		{
4548 4548
 			$temp_array['airline_name'] = $row['airline_name'];
4549 4549
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4563,11 +4563,11 @@  discard block
 block discarded – undo
4563 4563
 	* @return Array the airline country list
4564 4564
 	*
4565 4565
 	*/
4566
-	public function countAllAirlineCountriesByDate($date,$filters = array())
4566
+	public function countAllAirlineCountriesByDate($date, $filters = array())
4567 4567
 	{
4568 4568
 		global $globalTimezone, $globalDBdriver;
4569
-		$filter_query = $this->getFilter($filters,true,true);
4570
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4569
+		$filter_query = $this->getFilter($filters, true, true);
4570
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4571 4571
 		if ($globalTimezone != '') {
4572 4572
 			date_default_timezone_set($globalTimezone);
4573 4573
 			$datetime = new DateTime($date);
@@ -4575,13 +4575,13 @@  discard block
 block discarded – undo
4575 4575
 		} else $offset = '+00:00';
4576 4576
 		
4577 4577
 		if ($globalDBdriver == 'mysql') {
4578
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4578
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4579 4579
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4580 4580
 					GROUP BY spotter_output.airline_country
4581 4581
 					ORDER BY airline_country_count DESC
4582 4582
 					LIMIT 10 OFFSET 0";
4583 4583
 		} else {
4584
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4584
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4585 4585
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4586 4586
 					GROUP BY spotter_output.airline_country
4587 4587
 					ORDER BY airline_country_count DESC
@@ -4593,7 +4593,7 @@  discard block
 block discarded – undo
4593 4593
  
4594 4594
 		$airline_country_array = array();
4595 4595
 		$temp_array = array();
4596
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4596
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4597 4597
 		{
4598 4598
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4599 4599
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4610,11 +4610,11 @@  discard block
 block discarded – undo
4610 4610
 	* @return Array the airline list
4611 4611
 	*
4612 4612
 	*/
4613
-	public function countAllAirlinesByIdent($ident,$filters = array())
4613
+	public function countAllAirlinesByIdent($ident, $filters = array())
4614 4614
 	{
4615
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4616
-		$filter_query = $this->getFilter($filters,true,true);
4617
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4615
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4616
+		$filter_query = $this->getFilter($filters, true, true);
4617
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4618 4618
 		 		FROM spotter_output".$filter_query." spotter_output.ident = :ident  
4619 4619
 				GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country
4620 4620
 				ORDER BY airline_count DESC";
@@ -4631,11 +4631,11 @@  discard block
 block discarded – undo
4631 4631
 	* @return Array the airline list
4632 4632
 	*
4633 4633
 	*/
4634
-	public function countAllAirlinesByOwner($owner,$filters = array())
4634
+	public function countAllAirlinesByOwner($owner, $filters = array())
4635 4635
 	{
4636
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
4637
-		$filter_query = $this->getFilter($filters,true,true);
4638
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4636
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
4637
+		$filter_query = $this->getFilter($filters, true, true);
4638
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4639 4639
 		 		FROM spotter_output".$filter_query." spotter_output.owner_name = :owner  
4640 4640
 				GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country
4641 4641
 				ORDER BY airline_count DESC";
@@ -4652,47 +4652,47 @@  discard block
 block discarded – undo
4652 4652
 	* @return String Duration of all flights
4653 4653
 	*
4654 4654
 	*/
4655
-	public function getFlightDurationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
4655
+	public function getFlightDurationByOwner($owner, $filters = array(), $year = '', $month = '', $day = '')
4656 4656
 	{
4657 4657
 		global $globalDBdriver;
4658
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
4659
-		$filter_query = $this->getFilter($filters,true,true);
4660
-		$query  = "SELECT SUM(last_seen - date) AS duration 
4658
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
4659
+		$filter_query = $this->getFilter($filters, true, true);
4660
+		$query = "SELECT SUM(last_seen - date) AS duration 
4661 4661
 				FROM spotter_output".$filter_query." spotter_output.owner_name = :owner 
4662 4662
 				AND last_seen > date";
4663 4663
 		$query_values = array();
4664 4664
 		if ($year != '') {
4665 4665
 			if ($globalDBdriver == 'mysql') {
4666 4666
 				$query .= " AND YEAR(spotter_output.date) = :year";
4667
-				$query_values = array_merge($query_values,array(':year' => $year));
4667
+				$query_values = array_merge($query_values, array(':year' => $year));
4668 4668
 			} else {
4669 4669
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4670
-				$query_values = array_merge($query_values,array(':year' => $year));
4670
+				$query_values = array_merge($query_values, array(':year' => $year));
4671 4671
 			}
4672 4672
 		}
4673 4673
 		if ($month != '') {
4674 4674
 			if ($globalDBdriver == 'mysql') {
4675 4675
 				$query .= " AND MONTH(spotter_output.date) = :month";
4676
-				$query_values = array_merge($query_values,array(':month' => $month));
4676
+				$query_values = array_merge($query_values, array(':month' => $month));
4677 4677
 			} else {
4678 4678
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4679
-				$query_values = array_merge($query_values,array(':month' => $month));
4679
+				$query_values = array_merge($query_values, array(':month' => $month));
4680 4680
 			}
4681 4681
 		}
4682 4682
 		if ($day != '') {
4683 4683
 			if ($globalDBdriver == 'mysql') {
4684 4684
 				$query .= " AND DAY(spotter_output.date) = :day";
4685
-				$query_values = array_merge($query_values,array(':day' => $day));
4685
+				$query_values = array_merge($query_values, array(':day' => $day));
4686 4686
 			} else {
4687 4687
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4688
-				$query_values = array_merge($query_values,array(':day' => $day));
4688
+				$query_values = array_merge($query_values, array(':day' => $day));
4689 4689
 			}
4690 4690
 		}
4691
-		$query_values = array_merge($query_values,array(':owner' => $owner));
4691
+		$query_values = array_merge($query_values, array(':owner' => $owner));
4692 4692
 		$sth = $this->db->prepare($query);
4693 4693
 		$sth->execute($query_values);
4694 4694
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
4695
-		if (is_numeric($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']);
4695
+		if (is_numeric($result[0]['duration'])) return gmdate('H:i:s', $result[0]['duration']);
4696 4696
 		elseif ($result[0]['duration'] == '') return 0;
4697 4697
 		else return $result[0]['duration'];
4698 4698
 	}
@@ -4703,14 +4703,14 @@  discard block
 block discarded – undo
4703 4703
 	* @return String Duration of all flights
4704 4704
 	*
4705 4705
 	*/
4706
-	public function countFlightsByOwner($owner,$filters = array())
4706
+	public function countFlightsByOwner($owner, $filters = array())
4707 4707
 	{
4708
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
4709
-		$filter_query = $this->getFilter($filters,true,true);
4710
-		$query  = "SELECT COUNT(*) AS nb 
4708
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
4709
+		$filter_query = $this->getFilter($filters, true, true);
4710
+		$query = "SELECT COUNT(*) AS nb 
4711 4711
 				FROM spotter_output".$filter_query." spotter_output.owner_name = :owner";
4712 4712
 		$query_values = array();
4713
-		$query_values = array_merge($query_values,array(':owner' => $owner));
4713
+		$query_values = array_merge($query_values, array(':owner' => $owner));
4714 4714
 		$sth = $this->db->prepare($query);
4715 4715
 		$sth->execute($query_values);
4716 4716
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -4723,14 +4723,14 @@  discard block
 block discarded – undo
4723 4723
 	* @return String Duration of all flights
4724 4724
 	*
4725 4725
 	*/
4726
-	public function countFlightsByPilot($pilot,$filters = array())
4726
+	public function countFlightsByPilot($pilot, $filters = array())
4727 4727
 	{
4728
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
4729
-		$filter_query = $this->getFilter($filters,true,true);
4730
-		$query  = "SELECT COUNT(*) AS nb 
4728
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
4729
+		$filter_query = $this->getFilter($filters, true, true);
4730
+		$query = "SELECT COUNT(*) AS nb 
4731 4731
 				FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilod_id = :pilot)";
4732 4732
 		$query_values = array();
4733
-		$query_values = array_merge($query_values,array(':pilot' => $pilot));
4733
+		$query_values = array_merge($query_values, array(':pilot' => $pilot));
4734 4734
 		$sth = $this->db->prepare($query);
4735 4735
 		$sth->execute($query_values);
4736 4736
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -4743,47 +4743,47 @@  discard block
 block discarded – undo
4743 4743
 	* @return String Duration of all flights
4744 4744
 	*
4745 4745
 	*/
4746
-	public function getFlightDurationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
4746
+	public function getFlightDurationByPilot($pilot, $filters = array(), $year = '', $month = '', $day = '')
4747 4747
 	{
4748 4748
 		global $globalDBdriver;
4749
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
4750
-		$filter_query = $this->getFilter($filters,true,true);
4751
-		$query  = "SELECT SUM(last_seen - date) AS duration 
4749
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
4750
+		$filter_query = $this->getFilter($filters, true, true);
4751
+		$query = "SELECT SUM(last_seen - date) AS duration 
4752 4752
 		 		FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
4753 4753
 		 		AND last_seen > date";
4754 4754
 		$query_values = array();
4755 4755
 		if ($year != '') {
4756 4756
 			if ($globalDBdriver == 'mysql') {
4757 4757
 				$query .= " AND YEAR(spotter_output.date) = :year";
4758
-				$query_values = array_merge($query_values,array(':year' => $year));
4758
+				$query_values = array_merge($query_values, array(':year' => $year));
4759 4759
 			} else {
4760 4760
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4761
-				$query_values = array_merge($query_values,array(':year' => $year));
4761
+				$query_values = array_merge($query_values, array(':year' => $year));
4762 4762
 			}
4763 4763
 		}
4764 4764
 		if ($month != '') {
4765 4765
 			if ($globalDBdriver == 'mysql') {
4766 4766
 				$query .= " AND MONTH(spotter_output.date) = :month";
4767
-				$query_values = array_merge($query_values,array(':month' => $month));
4767
+				$query_values = array_merge($query_values, array(':month' => $month));
4768 4768
 			} else {
4769 4769
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4770
-				$query_values = array_merge($query_values,array(':month' => $month));
4770
+				$query_values = array_merge($query_values, array(':month' => $month));
4771 4771
 			}
4772 4772
 		}
4773 4773
 		if ($day != '') {
4774 4774
 			if ($globalDBdriver == 'mysql') {
4775 4775
 				$query .= " AND DAY(spotter_output.date) = :day";
4776
-				$query_values = array_merge($query_values,array(':day' => $day));
4776
+				$query_values = array_merge($query_values, array(':day' => $day));
4777 4777
 			} else {
4778 4778
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4779
-				$query_values = array_merge($query_values,array(':day' => $day));
4779
+				$query_values = array_merge($query_values, array(':day' => $day));
4780 4780
 			}
4781 4781
 		}
4782
-		$query_values = array_merge($query_values,array(':pilot' => $pilot));
4782
+		$query_values = array_merge($query_values, array(':pilot' => $pilot));
4783 4783
 		$sth = $this->db->prepare($query);
4784 4784
 		$sth->execute($query_values);
4785 4785
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
4786
-		if (is_int($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']);
4786
+		if (is_int($result[0]['duration'])) return gmdate('H:i:s', $result[0]['duration']);
4787 4787
 		else return $result[0]['duration'];
4788 4788
 	}
4789 4789
 
@@ -4793,11 +4793,11 @@  discard block
 block discarded – undo
4793 4793
 	* @return Array the airline list
4794 4794
 	*
4795 4795
 	*/
4796
-	public function countAllAirlinesByPilot($pilot,$filters = array())
4796
+	public function countAllAirlinesByPilot($pilot, $filters = array())
4797 4797
 	{
4798
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
4799
-		$filter_query = $this->getFilter($filters,true,true);
4800
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4798
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
4799
+		$filter_query = $this->getFilter($filters, true, true);
4800
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4801 4801
 		 		FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
4802 4802
 				GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country
4803 4803
 				ORDER BY airline_count DESC";
@@ -4814,25 +4814,25 @@  discard block
 block discarded – undo
4814 4814
 	* @return Array the airline list
4815 4815
 	*
4816 4816
 	*/
4817
-	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4817
+	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4818 4818
 	{
4819
-		$filter_query = $this->getFilter($filters,true,true);
4820
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4821
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4819
+		$filter_query = $this->getFilter($filters, true, true);
4820
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4821
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4822 4822
 
4823
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4823
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4824 4824
 		 			FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4825 4825
 					GROUP BY spotter_output.airline_name
4826 4826
 					ORDER BY airline_count DESC";
4827 4827
       
4828 4828
 		
4829 4829
 		$sth = $this->db->prepare($query);
4830
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4830
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4831 4831
       
4832 4832
 		$airline_array = array();
4833 4833
 		$temp_array = array();
4834 4834
         
4835
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4835
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4836 4836
 		{
4837 4837
 			$temp_array['airline_name'] = $row['airline_name'];
4838 4838
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4850,13 +4850,13 @@  discard block
 block discarded – undo
4850 4850
 	* @return Array the airline country list
4851 4851
 	*
4852 4852
 	*/
4853
-	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4853
+	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4854 4854
 	{
4855
-		$filter_query = $this->getFilter($filters,true,true);
4856
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4857
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4855
+		$filter_query = $this->getFilter($filters, true, true);
4856
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4857
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4858 4858
       
4859
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4859
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4860 4860
 		 		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) 
4861 4861
 				GROUP BY spotter_output.airline_country
4862 4862
 				ORDER BY airline_country_count DESC
@@ -4864,11 +4864,11 @@  discard block
 block discarded – undo
4864 4864
       
4865 4865
 		
4866 4866
 		$sth = $this->db->prepare($query);
4867
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4867
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4868 4868
       
4869 4869
 		$airline_country_array = array();
4870 4870
 		$temp_array = array();
4871
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4871
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4872 4872
 		{
4873 4873
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4874 4874
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4886,11 +4886,11 @@  discard block
 block discarded – undo
4886 4886
 	* @return Array the airline list
4887 4887
 	*
4888 4888
 	*/
4889
-	public function countAllAirlinesByCountry($country,$filters = array())
4889
+	public function countAllAirlinesByCountry($country, $filters = array())
4890 4890
 	{
4891
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4892
-		$filter_query = $this->getFilter($filters,true,true);
4893
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4891
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4892
+		$filter_query = $this->getFilter($filters, true, true);
4893
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4894 4894
 		 	    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
4895 4895
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4896 4896
 			    ORDER BY airline_count DESC";
@@ -4901,7 +4901,7 @@  discard block
 block discarded – undo
4901 4901
 
4902 4902
 		$airline_array = array();
4903 4903
 		$temp_array = array();
4904
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4904
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4905 4905
 		{
4906 4906
 			$temp_array['airline_name'] = $row['airline_name'];
4907 4907
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4920,11 +4920,11 @@  discard block
 block discarded – undo
4920 4920
 	* @return Array the airline country list
4921 4921
 	*
4922 4922
 	*/
4923
-	public function countAllAirlineCountriesByCountry($country,$filters = array())
4923
+	public function countAllAirlineCountriesByCountry($country, $filters = array())
4924 4924
 	{
4925
-		$filter_query = $this->getFilter($filters,true,true);
4926
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4927
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4925
+		$filter_query = $this->getFilter($filters, true, true);
4926
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4927
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4928 4928
 		 		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 
4929 4929
 				GROUP BY spotter_output.airline_country
4930 4930
 				ORDER BY airline_country_count DESC
@@ -4936,7 +4936,7 @@  discard block
 block discarded – undo
4936 4936
 
4937 4937
 		$airline_country_array = array();
4938 4938
 		$temp_array = array();
4939
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4939
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4940 4940
 		{
4941 4941
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4942 4942
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4956,35 +4956,35 @@  discard block
 block discarded – undo
4956 4956
 	public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
4957 4957
 	{
4958 4958
 		global $globalDBdriver;
4959
-		$filter_query = $this->getFilter($filters,true,true);
4960
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count, countries.iso3 AS airline_country_iso3
4959
+		$filter_query = $this->getFilter($filters, true, true);
4960
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count, countries.iso3 AS airline_country_iso3
4961 4961
 		 			FROM countries, spotter_output".$filter_query." countries.name = spotter_output.airline_country AND spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA'";
4962 4962
 		$query_values = array();
4963 4963
 		if ($year != '') {
4964 4964
 			if ($globalDBdriver == 'mysql') {
4965 4965
 				$query .= " AND YEAR(spotter_output.date) = :year";
4966
-				$query_values = array_merge($query_values,array(':year' => $year));
4966
+				$query_values = array_merge($query_values, array(':year' => $year));
4967 4967
 			} else {
4968 4968
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4969
-				$query_values = array_merge($query_values,array(':year' => $year));
4969
+				$query_values = array_merge($query_values, array(':year' => $year));
4970 4970
 			}
4971 4971
 		}
4972 4972
 		if ($month != '') {
4973 4973
 			if ($globalDBdriver == 'mysql') {
4974 4974
 				$query .= " AND MONTH(spotter_output.date) = :month";
4975
-				$query_values = array_merge($query_values,array(':month' => $month));
4975
+				$query_values = array_merge($query_values, array(':month' => $month));
4976 4976
 			} else {
4977 4977
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4978
-				$query_values = array_merge($query_values,array(':month' => $month));
4978
+				$query_values = array_merge($query_values, array(':month' => $month));
4979 4979
 			}
4980 4980
 		}
4981 4981
 		if ($day != '') {
4982 4982
 			if ($globalDBdriver == 'mysql') {
4983 4983
 				$query .= " AND DAY(spotter_output.date) = :day";
4984
-				$query_values = array_merge($query_values,array(':day' => $day));
4984
+				$query_values = array_merge($query_values, array(':day' => $day));
4985 4985
 			} else {
4986 4986
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4987
-				$query_values = array_merge($query_values,array(':day' => $day));
4987
+				$query_values = array_merge($query_values, array(':day' => $day));
4988 4988
 			}
4989 4989
 		}
4990 4990
 		$query .= " GROUP BY spotter_output.airline_country, countries.iso3
@@ -4996,7 +4996,7 @@  discard block
 block discarded – undo
4996 4996
 
4997 4997
 		$airline_array = array();
4998 4998
 		$temp_array = array();
4999
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4999
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5000 5000
 		{
5001 5001
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
5002 5002
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -5013,11 +5013,11 @@  discard block
 block discarded – undo
5013 5013
 	* @return Array the airline country list
5014 5014
 	*
5015 5015
 	*/
5016
-	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5016
+	public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5017 5017
 	{
5018 5018
 		global $globalDBdriver;
5019 5019
 		//$filter_query = $this->getFilter($filters,true,true);
5020
-		$Connection= new Connection($this->db);
5020
+		$Connection = new Connection($this->db);
5021 5021
 		if (!$Connection->tableExists('countries')) return array();
5022 5022
 		/*
5023 5023
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -5032,7 +5032,7 @@  discard block
 block discarded – undo
5032 5032
 */
5033 5033
 		require_once('class.SpotterLive.php');
5034 5034
 		$SpotterLive = new SpotterLive();
5035
-		$filter_query = $SpotterLive->getFilter($filters,true,true);
5035
+		$filter_query = $SpotterLive->getFilter($filters, true, true);
5036 5036
 		$filter_query .= ' over_country IS NOT NULL';
5037 5037
                 if ($olderthanmonths > 0) {
5038 5038
 			if ($globalDBdriver == 'mysql') {
@@ -5059,7 +5059,7 @@  discard block
 block discarded – undo
5059 5059
 		$flight_array = array();
5060 5060
 		$temp_array = array();
5061 5061
         
5062
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5062
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5063 5063
 		{
5064 5064
 			$temp_array['flight_count'] = $row['nb'];
5065 5065
 			$temp_array['flight_country'] = $row['name'];
@@ -5077,11 +5077,11 @@  discard block
 block discarded – undo
5077 5077
 	* @return Array the aircraft list
5078 5078
 	*
5079 5079
 	*/
5080
-	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
5080
+	public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
5081 5081
 	{
5082 5082
 		global $globalDBdriver;
5083
-		$filter_query = $this->getFilter($filters,true,true);
5084
-		$query  = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5083
+		$filter_query = $this->getFilter($filters, true, true);
5084
+		$query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5085 5085
 		    FROM spotter_output ".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> ''";
5086 5086
 		if ($olderthanmonths > 0) {
5087 5087
 			if ($globalDBdriver == 'mysql') {
@@ -5101,28 +5101,28 @@  discard block
 block discarded – undo
5101 5101
 		if ($year != '') {
5102 5102
 			if ($globalDBdriver == 'mysql') {
5103 5103
 				$query .= " AND YEAR(spotter_output.date) = :year";
5104
-				$query_values = array_merge($query_values,array(':year' => $year));
5104
+				$query_values = array_merge($query_values, array(':year' => $year));
5105 5105
 			} else {
5106 5106
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5107
-				$query_values = array_merge($query_values,array(':year' => $year));
5107
+				$query_values = array_merge($query_values, array(':year' => $year));
5108 5108
 			}
5109 5109
 		}
5110 5110
 		if ($month != '') {
5111 5111
 			if ($globalDBdriver == 'mysql') {
5112 5112
 				$query .= " AND MONTH(spotter_output.date) = :month";
5113
-				$query_values = array_merge($query_values,array(':month' => $month));
5113
+				$query_values = array_merge($query_values, array(':month' => $month));
5114 5114
 			} else {
5115 5115
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5116
-				$query_values = array_merge($query_values,array(':month' => $month));
5116
+				$query_values = array_merge($query_values, array(':month' => $month));
5117 5117
 			}
5118 5118
 		}
5119 5119
 		if ($day != '') {
5120 5120
 			if ($globalDBdriver == 'mysql') {
5121 5121
 				$query .= " AND DAY(spotter_output.date) = :day";
5122
-				$query_values = array_merge($query_values,array(':day' => $day));
5122
+				$query_values = array_merge($query_values, array(':day' => $day));
5123 5123
 			} else {
5124 5124
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5125
-				$query_values = array_merge($query_values,array(':day' => $day));
5125
+				$query_values = array_merge($query_values, array(':day' => $day));
5126 5126
 			}
5127 5127
 		}
5128 5128
 
@@ -5134,7 +5134,7 @@  discard block
 block discarded – undo
5134 5134
 
5135 5135
 		$aircraft_array = array();
5136 5136
 		$temp_array = array();
5137
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5137
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5138 5138
 		{
5139 5139
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5140 5140
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5151,11 +5151,11 @@  discard block
 block discarded – undo
5151 5151
 	* @return Array the aircraft list
5152 5152
 	*
5153 5153
 	*/
5154
-	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '')
5154
+	public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
5155 5155
 	{
5156 5156
 		global $globalDBdriver;
5157
-		$filter_query = $this->getFilter($filters,true,true);
5158
-		$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 
5157
+		$filter_query = $this->getFilter($filters, true, true);
5158
+		$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 
5159 5159
 		    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'";
5160 5160
 		if ($olderthanmonths > 0) {
5161 5161
 			if ($globalDBdriver == 'mysql') {
@@ -5175,28 +5175,28 @@  discard block
 block discarded – undo
5175 5175
 		if ($year != '') {
5176 5176
 			if ($globalDBdriver == 'mysql') {
5177 5177
 				$query .= " AND YEAR(spotter_output.date) = :year";
5178
-				$query_values = array_merge($query_values,array(':year' => $year));
5178
+				$query_values = array_merge($query_values, array(':year' => $year));
5179 5179
 			} else {
5180 5180
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5181
-				$query_values = array_merge($query_values,array(':year' => $year));
5181
+				$query_values = array_merge($query_values, array(':year' => $year));
5182 5182
 			}
5183 5183
 		}
5184 5184
 		if ($month != '') {
5185 5185
 			if ($globalDBdriver == 'mysql') {
5186 5186
 				$query .= " AND MONTH(spotter_output.date) = :month";
5187
-				$query_values = array_merge($query_values,array(':month' => $month));
5187
+				$query_values = array_merge($query_values, array(':month' => $month));
5188 5188
 			} else {
5189 5189
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5190
-				$query_values = array_merge($query_values,array(':month' => $month));
5190
+				$query_values = array_merge($query_values, array(':month' => $month));
5191 5191
 			}
5192 5192
 		}
5193 5193
 		if ($day != '') {
5194 5194
 			if ($globalDBdriver == 'mysql') {
5195 5195
 				$query .= " AND DAY(spotter_output.date) = :day";
5196
-				$query_values = array_merge($query_values,array(':day' => $day));
5196
+				$query_values = array_merge($query_values, array(':day' => $day));
5197 5197
 			} else {
5198 5198
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5199
-				$query_values = array_merge($query_values,array(':day' => $day));
5199
+				$query_values = array_merge($query_values, array(':day' => $day));
5200 5200
 			}
5201 5201
 		}
5202 5202
 
@@ -5208,7 +5208,7 @@  discard block
 block discarded – undo
5208 5208
 
5209 5209
 		$aircraft_array = array();
5210 5210
 		$temp_array = array();
5211
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5211
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5212 5212
 		{
5213 5213
 			$temp_array['airline_icao'] = $row['airline_icao'];
5214 5214
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -5226,11 +5226,11 @@  discard block
 block discarded – undo
5226 5226
 	* @return Array the aircraft list
5227 5227
 	*
5228 5228
 	*/
5229
-	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5229
+	public function countAllAircraftTypesByMonths($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5230 5230
 	{
5231 5231
 		global $globalDBdriver;
5232
-		$filter_query = $this->getFilter($filters,true,true);
5233
-		$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 
5232
+		$filter_query = $this->getFilter($filters, true, true);
5233
+		$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 
5234 5234
 		    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' ";
5235 5235
 		if ($olderthanmonths > 0) {
5236 5236
 			if ($globalDBdriver == 'mysql') {
@@ -5255,7 +5255,7 @@  discard block
 block discarded – undo
5255 5255
 
5256 5256
 		$aircraft_array = array();
5257 5257
 		$temp_array = array();
5258
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5258
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5259 5259
 		{
5260 5260
 			//$temp_array['airline_icao'] = $row['airline_icao'];
5261 5261
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -5274,13 +5274,13 @@  discard block
 block discarded – undo
5274 5274
 	* @return Array the aircraft list
5275 5275
 	*
5276 5276
 	*/
5277
-	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
5277
+	public function countAllAircraftRegistrationByAircraft($aircraft_icao, $filters = array())
5278 5278
 	{
5279 5279
 		$Image = new Image($this->db);
5280
-		$filter_query = $this->getFilter($filters,true,true);
5281
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5280
+		$filter_query = $this->getFilter($filters, true, true);
5281
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5282 5282
 
5283
-		$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  
5283
+		$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  
5284 5284
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao  
5285 5285
 				GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5286 5286
 				ORDER BY registration_count DESC";
@@ -5291,14 +5291,14 @@  discard block
 block discarded – undo
5291 5291
 		$aircraft_array = array();
5292 5292
 		$temp_array = array();
5293 5293
         
5294
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5294
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5295 5295
 		{
5296 5296
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5297 5297
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5298 5298
 			$temp_array['registration'] = $row['registration'];
5299 5299
 			$temp_array['airline_name'] = $row['airline_name'];
5300 5300
 			$temp_array['image_thumbnail'] = "";
5301
-			if($row['registration'] != "")
5301
+			if ($row['registration'] != "")
5302 5302
 			{
5303 5303
 				$image_array = $Image->getSpotterImage($row['registration']);
5304 5304
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5317,11 +5317,11 @@  discard block
 block discarded – undo
5317 5317
 	* @return Array the aircraft list
5318 5318
 	*
5319 5319
 	*/
5320
-	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
5320
+	public function countAllAircraftTypesByAirline($airline_icao, $filters = array())
5321 5321
 	{
5322
-		$filter_query = $this->getFilter($filters,true,true);
5323
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5324
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5322
+		$filter_query = $this->getFilter($filters, true, true);
5323
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5324
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5325 5325
 			    FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao 
5326 5326
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5327 5327
 			    ORDER BY aircraft_icao_count DESC";
@@ -5332,7 +5332,7 @@  discard block
 block discarded – undo
5332 5332
 		$aircraft_array = array();
5333 5333
 		$temp_array = array();
5334 5334
 
5335
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5335
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5336 5336
 		{
5337 5337
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5338 5338
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5350,13 +5350,13 @@  discard block
 block discarded – undo
5350 5350
 	* @return Array the aircraft list
5351 5351
 	*
5352 5352
 	*/
5353
-	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
5353
+	public function countAllAircraftRegistrationByAirline($airline_icao, $filters = array())
5354 5354
 	{
5355
-		$filter_query = $this->getFilter($filters,true,true);
5355
+		$filter_query = $this->getFilter($filters, true, true);
5356 5356
 		$Image = new Image($this->db);
5357
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5357
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5358 5358
 
5359
-		$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 
5359
+		$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 
5360 5360
 			    FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao 
5361 5361
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
5362 5362
 			    ORDER BY registration_count DESC";
@@ -5366,14 +5366,14 @@  discard block
 block discarded – undo
5366 5366
 
5367 5367
 		$aircraft_array = array();
5368 5368
 		$temp_array = array();
5369
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5369
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5370 5370
 		{
5371 5371
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5372 5372
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5373 5373
 			$temp_array['registration'] = $row['registration'];
5374 5374
 			$temp_array['airline_name'] = $row['airline_name'];
5375 5375
 			$temp_array['image_thumbnail'] = "";
5376
-			if($row['registration'] != "")
5376
+			if ($row['registration'] != "")
5377 5377
 			{
5378 5378
 				$image_array = $Image->getSpotterImage($row['registration']);
5379 5379
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5392,11 +5392,11 @@  discard block
 block discarded – undo
5392 5392
 	* @return Array the aircraft list
5393 5393
 	*
5394 5394
 	*/
5395
-	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
5395
+	public function countAllAircraftManufacturerByAirline($airline_icao, $filters = array())
5396 5396
 	{
5397
-		$filter_query = $this->getFilter($filters,true,true);
5398
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5399
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5397
+		$filter_query = $this->getFilter($filters, true, true);
5398
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5399
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5400 5400
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao 
5401 5401
 				GROUP BY spotter_output.aircraft_manufacturer 
5402 5402
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -5407,7 +5407,7 @@  discard block
 block discarded – undo
5407 5407
 		$aircraft_array = array();
5408 5408
 		$temp_array = array();
5409 5409
 
5410
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5410
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5411 5411
 		{
5412 5412
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5413 5413
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5424,12 +5424,12 @@  discard block
 block discarded – undo
5424 5424
 	* @return Array the aircraft list
5425 5425
 	*
5426 5426
 	*/
5427
-	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
5427
+	public function countAllAircraftTypesByAirport($airport_icao, $filters = array())
5428 5428
 	{
5429
-		$filter_query = $this->getFilter($filters,true,true);
5430
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5429
+		$filter_query = $this->getFilter($filters, true, true);
5430
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5431 5431
 
5432
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5432
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5433 5433
 				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) 
5434 5434
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5435 5435
 				ORDER BY aircraft_icao_count DESC";
@@ -5439,7 +5439,7 @@  discard block
 block discarded – undo
5439 5439
 
5440 5440
 		$aircraft_array = array();
5441 5441
 		$temp_array = array();
5442
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5442
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5443 5443
 		{
5444 5444
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5445 5445
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5457,13 +5457,13 @@  discard block
 block discarded – undo
5457 5457
 	* @return Array the aircraft list
5458 5458
 	*
5459 5459
 	*/
5460
-	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
5460
+	public function countAllAircraftRegistrationByAirport($airport_icao, $filters = array())
5461 5461
 	{
5462
-		$filter_query = $this->getFilter($filters,true,true);
5462
+		$filter_query = $this->getFilter($filters, true, true);
5463 5463
 		$Image = new Image($this->db);
5464
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5464
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5465 5465
 
5466
-		$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  
5466
+		$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  
5467 5467
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)   
5468 5468
                     GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5469 5469
 		    ORDER BY registration_count DESC";
@@ -5473,14 +5473,14 @@  discard block
 block discarded – undo
5473 5473
 
5474 5474
 		$aircraft_array = array();
5475 5475
 		$temp_array = array();
5476
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5476
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5477 5477
 		{
5478 5478
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5479 5479
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5480 5480
 			$temp_array['registration'] = $row['registration'];
5481 5481
 			$temp_array['airline_name'] = $row['airline_name'];
5482 5482
 			$temp_array['image_thumbnail'] = "";
5483
-			if($row['registration'] != "")
5483
+			if ($row['registration'] != "")
5484 5484
 			{
5485 5485
 				$image_array = $Image->getSpotterImage($row['registration']);
5486 5486
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5498,11 +5498,11 @@  discard block
 block discarded – undo
5498 5498
 	* @return Array the aircraft list
5499 5499
 	*
5500 5500
 	*/
5501
-	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
5501
+	public function countAllAircraftManufacturerByAirport($airport_icao, $filters = array())
5502 5502
 	{
5503
-		$filter_query = $this->getFilter($filters,true,true);
5504
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5505
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5503
+		$filter_query = $this->getFilter($filters, true, true);
5504
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5505
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5506 5506
                     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)  
5507 5507
                     GROUP BY spotter_output.aircraft_manufacturer 
5508 5508
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5513,7 +5513,7 @@  discard block
 block discarded – undo
5513 5513
 
5514 5514
 		$aircraft_array = array();
5515 5515
 		$temp_array = array();
5516
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5516
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5517 5517
 		{
5518 5518
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5519 5519
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5528,12 +5528,12 @@  discard block
 block discarded – undo
5528 5528
 	* @return Array the aircraft list
5529 5529
 	*
5530 5530
 	*/
5531
-	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
5531
+	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer, $filters = array())
5532 5532
 	{
5533
-		$filter_query = $this->getFilter($filters,true,true);
5534
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5533
+		$filter_query = $this->getFilter($filters, true, true);
5534
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5535 5535
 
5536
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5536
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5537 5537
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
5538 5538
                     GROUP BY spotter_output.aircraft_name 
5539 5539
 					ORDER BY aircraft_icao_count DESC";
@@ -5542,7 +5542,7 @@  discard block
 block discarded – undo
5542 5542
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
5543 5543
 		$aircraft_array = array();
5544 5544
 		$temp_array = array();
5545
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5545
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5546 5546
 		{
5547 5547
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5548 5548
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5561,11 +5561,11 @@  discard block
 block discarded – undo
5561 5561
 	*/
5562 5562
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
5563 5563
 	{
5564
-		$filter_query = $this->getFilter($filters,true,true);
5564
+		$filter_query = $this->getFilter($filters, true, true);
5565 5565
 		$Image = new Image($this->db);
5566
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5566
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5567 5567
 
5568
-		$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   
5568
+		$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   
5569 5569
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
5570 5570
                     GROUP BY spotter_output.registration 
5571 5571
 					ORDER BY registration_count DESC";
@@ -5575,14 +5575,14 @@  discard block
 block discarded – undo
5575 5575
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
5576 5576
 		$aircraft_array = array();
5577 5577
 		$temp_array = array();
5578
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5578
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5579 5579
 		{
5580 5580
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5581 5581
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5582 5582
 			$temp_array['registration'] = $row['registration'];
5583 5583
 			$temp_array['airline_name'] = $row['airline_name'];
5584 5584
 			$temp_array['image_thumbnail'] = "";
5585
-			if($row['registration'] != "")
5585
+			if ($row['registration'] != "")
5586 5586
 			{
5587 5587
 				$image_array = $Image->getSpotterImage($row['registration']);
5588 5588
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5599,11 +5599,11 @@  discard block
 block discarded – undo
5599 5599
 	* @return Array the aircraft list
5600 5600
 	*
5601 5601
 	*/
5602
-	public function countAllAircraftTypesByDate($date,$filters = array())
5602
+	public function countAllAircraftTypesByDate($date, $filters = array())
5603 5603
 	{
5604 5604
 		global $globalTimezone, $globalDBdriver;
5605
-		$filter_query = $this->getFilter($filters,true,true);
5606
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5605
+		$filter_query = $this->getFilter($filters, true, true);
5606
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5607 5607
 		if ($globalTimezone != '') {
5608 5608
 			date_default_timezone_set($globalTimezone);
5609 5609
 			$datetime = new DateTime($date);
@@ -5611,12 +5611,12 @@  discard block
 block discarded – undo
5611 5611
 		} else $offset = '+00:00';
5612 5612
 
5613 5613
 		if ($globalDBdriver == 'mysql') {
5614
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5614
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5615 5615
 					FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
5616 5616
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5617 5617
 					ORDER BY aircraft_icao_count DESC";
5618 5618
 		} else {
5619
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5619
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5620 5620
 					FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
5621 5621
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5622 5622
 					ORDER BY aircraft_icao_count DESC";
@@ -5627,7 +5627,7 @@  discard block
 block discarded – undo
5627 5627
 
5628 5628
 		$aircraft_array = array();
5629 5629
 		$temp_array = array();
5630
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5630
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5631 5631
 		{
5632 5632
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5633 5633
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5645,12 +5645,12 @@  discard block
 block discarded – undo
5645 5645
 	* @return Array the aircraft list
5646 5646
 	*
5647 5647
 	*/
5648
-	public function countAllAircraftRegistrationByDate($date,$filters = array())
5648
+	public function countAllAircraftRegistrationByDate($date, $filters = array())
5649 5649
 	{
5650 5650
 		global $globalTimezone, $globalDBdriver;
5651
-		$filter_query = $this->getFilter($filters,true,true);
5651
+		$filter_query = $this->getFilter($filters, true, true);
5652 5652
 		$Image = new Image($this->db);
5653
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5653
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5654 5654
 		if ($globalTimezone != '') {
5655 5655
 			date_default_timezone_set($globalTimezone);
5656 5656
 			$datetime = new DateTime($date);
@@ -5658,12 +5658,12 @@  discard block
 block discarded – undo
5658 5658
 		} else $offset = '+00:00';
5659 5659
 
5660 5660
 		if ($globalDBdriver == 'mysql') {
5661
-			$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 
5661
+			$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 
5662 5662
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
5663 5663
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5664 5664
 					ORDER BY registration_count DESC";
5665 5665
 		} else {
5666
-			$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    
5666
+			$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    
5667 5667
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5668 5668
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5669 5669
 					ORDER BY registration_count DESC";
@@ -5674,14 +5674,14 @@  discard block
 block discarded – undo
5674 5674
 
5675 5675
 		$aircraft_array = array();
5676 5676
 		$temp_array = array();
5677
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5677
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5678 5678
 		{
5679 5679
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5680 5680
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5681 5681
 			$temp_array['registration'] = $row['registration'];
5682 5682
 			$temp_array['airline_name'] = $row['airline_name'];
5683 5683
 			$temp_array['image_thumbnail'] = "";
5684
-			if($row['registration'] != "")
5684
+			if ($row['registration'] != "")
5685 5685
 			{
5686 5686
 				$image_array = $Image->getSpotterImage($row['registration']);
5687 5687
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5700,11 +5700,11 @@  discard block
 block discarded – undo
5700 5700
 	* @return Array the aircraft manufacturer list
5701 5701
 	*
5702 5702
 	*/
5703
-	public function countAllAircraftManufacturerByDate($date,$filters = array())
5703
+	public function countAllAircraftManufacturerByDate($date, $filters = array())
5704 5704
 	{
5705 5705
 		global $globalTimezone, $globalDBdriver;
5706
-		$filter_query = $this->getFilter($filters,true,true);
5707
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5706
+		$filter_query = $this->getFilter($filters, true, true);
5707
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5708 5708
 		if ($globalTimezone != '') {
5709 5709
 			date_default_timezone_set($globalTimezone);
5710 5710
 			$datetime = new DateTime($date);
@@ -5712,12 +5712,12 @@  discard block
 block discarded – undo
5712 5712
 		} else $offset = '+00:00';
5713 5713
 
5714 5714
 		if ($globalDBdriver == 'mysql') {
5715
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5715
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5716 5716
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
5717 5717
 				GROUP BY spotter_output.aircraft_manufacturer 
5718 5718
 				ORDER BY aircraft_manufacturer_count DESC";
5719 5719
 		} else {
5720
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5720
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5721 5721
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5722 5722
 				GROUP BY spotter_output.aircraft_manufacturer 
5723 5723
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -5729,7 +5729,7 @@  discard block
 block discarded – undo
5729 5729
 		$aircraft_array = array();
5730 5730
 		$temp_array = array();
5731 5731
 
5732
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5732
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5733 5733
 		{
5734 5734
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5735 5735
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5746,11 +5746,11 @@  discard block
 block discarded – undo
5746 5746
 	* @return Array the aircraft list
5747 5747
 	*
5748 5748
 	*/
5749
-	public function countAllAircraftTypesByIdent($ident,$filters = array())
5749
+	public function countAllAircraftTypesByIdent($ident, $filters = array())
5750 5750
 	{
5751
-		$filter_query = $this->getFilter($filters,true,true);
5752
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5753
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5751
+		$filter_query = $this->getFilter($filters, true, true);
5752
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5753
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5754 5754
 				FROM spotter_output".$filter_query." spotter_output.ident = :ident 
5755 5755
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
5756 5756
 				ORDER BY aircraft_icao_count DESC";
@@ -5761,7 +5761,7 @@  discard block
 block discarded – undo
5761 5761
 		$aircraft_array = array();
5762 5762
 		$temp_array = array();
5763 5763
 
5764
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5764
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5765 5765
 		{
5766 5766
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5767 5767
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5778,45 +5778,45 @@  discard block
 block discarded – undo
5778 5778
 	* @return Array the aircraft list
5779 5779
 	*
5780 5780
 	*/
5781
-	public function countAllAircraftTypesByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
5781
+	public function countAllAircraftTypesByPilot($pilot, $filters = array(), $year = '', $month = '', $day = '')
5782 5782
 	{
5783 5783
 		global $globalDBdriver;
5784
-		$filter_query = $this->getFilter($filters,true,true);
5785
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
5786
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5784
+		$filter_query = $this->getFilter($filters, true, true);
5785
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
5786
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5787 5787
 				FROM spotter_output".$filter_query." (spotter_output.pilot_id = :pilot OR spotter_output.pilot_name = :pilot)";
5788 5788
 		$query_values = array();
5789 5789
 		if ($year != '') {
5790 5790
 			if ($globalDBdriver == 'mysql') {
5791 5791
 				$query .= " AND YEAR(spotter_output.date) = :year";
5792
-				$query_values = array_merge($query_values,array(':year' => $year));
5792
+				$query_values = array_merge($query_values, array(':year' => $year));
5793 5793
 			} else {
5794 5794
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5795
-				$query_values = array_merge($query_values,array(':year' => $year));
5795
+				$query_values = array_merge($query_values, array(':year' => $year));
5796 5796
 			}
5797 5797
 		}
5798 5798
 		if ($month != '') {
5799 5799
 			if ($globalDBdriver == 'mysql') {
5800 5800
 				$query .= " AND MONTH(spotter_output.date) = :month";
5801
-				$query_values = array_merge($query_values,array(':month' => $month));
5801
+				$query_values = array_merge($query_values, array(':month' => $month));
5802 5802
 			} else {
5803 5803
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5804
-				$query_values = array_merge($query_values,array(':month' => $month));
5804
+				$query_values = array_merge($query_values, array(':month' => $month));
5805 5805
 			}
5806 5806
 		}
5807 5807
 		if ($day != '') {
5808 5808
 			if ($globalDBdriver == 'mysql') {
5809 5809
 				$query .= " AND DAY(spotter_output.date) = :day";
5810
-				$query_values = array_merge($query_values,array(':day' => $day));
5810
+				$query_values = array_merge($query_values, array(':day' => $day));
5811 5811
 			} else {
5812 5812
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5813
-				$query_values = array_merge($query_values,array(':day' => $day));
5813
+				$query_values = array_merge($query_values, array(':day' => $day));
5814 5814
 			}
5815 5815
 		}
5816 5816
 
5817 5817
 		$query .= " GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
5818 5818
 				ORDER BY aircraft_icao_count DESC";
5819
-		$query_values = array_merge($query_values,array(':pilot' => $pilot));
5819
+		$query_values = array_merge($query_values, array(':pilot' => $pilot));
5820 5820
 		$sth = $this->db->prepare($query);
5821 5821
 		$sth->execute($query_values);
5822 5822
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -5828,44 +5828,44 @@  discard block
 block discarded – undo
5828 5828
 	* @return Array the aircraft list
5829 5829
 	*
5830 5830
 	*/
5831
-	public function countAllAircraftTypesByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
5831
+	public function countAllAircraftTypesByOwner($owner, $filters = array(), $year = '', $month = '', $day = '')
5832 5832
 	{
5833 5833
 		global $globalDBdriver;
5834
-		$filter_query = $this->getFilter($filters,true,true);
5835
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
5836
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5834
+		$filter_query = $this->getFilter($filters, true, true);
5835
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
5836
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5837 5837
 				FROM spotter_output".$filter_query." spotter_output.owner_name = :owner";
5838 5838
 		$query_values = array();
5839 5839
 		if ($year != '') {
5840 5840
 			if ($globalDBdriver == 'mysql') {
5841 5841
 				$query .= " AND YEAR(spotter_output.date) = :year";
5842
-				$query_values = array_merge($query_values,array(':year' => $year));
5842
+				$query_values = array_merge($query_values, array(':year' => $year));
5843 5843
 			} else {
5844 5844
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5845
-				$query_values = array_merge($query_values,array(':year' => $year));
5845
+				$query_values = array_merge($query_values, array(':year' => $year));
5846 5846
 			}
5847 5847
 		}
5848 5848
 		if ($month != '') {
5849 5849
 			if ($globalDBdriver == 'mysql') {
5850 5850
 				$query .= " AND MONTH(spotter_output.date) = :month";
5851
-				$query_values = array_merge($query_values,array(':month' => $month));
5851
+				$query_values = array_merge($query_values, array(':month' => $month));
5852 5852
 			} else {
5853 5853
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5854
-				$query_values = array_merge($query_values,array(':month' => $month));
5854
+				$query_values = array_merge($query_values, array(':month' => $month));
5855 5855
 			}
5856 5856
 		}
5857 5857
 		if ($day != '') {
5858 5858
 			if ($globalDBdriver == 'mysql') {
5859 5859
 				$query .= " AND DAY(spotter_output.date) = :day";
5860
-				$query_values = array_merge($query_values,array(':day' => $day));
5860
+				$query_values = array_merge($query_values, array(':day' => $day));
5861 5861
 			} else {
5862 5862
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5863
-				$query_values = array_merge($query_values,array(':day' => $day));
5863
+				$query_values = array_merge($query_values, array(':day' => $day));
5864 5864
 			}
5865 5865
 		}
5866 5866
 		$query .= " GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.aircraft_icao
5867 5867
 				ORDER BY aircraft_icao_count DESC";
5868
-		$query_values = array_merge($query_values,array(':owner' => $owner));
5868
+		$query_values = array_merge($query_values, array(':owner' => $owner));
5869 5869
 		$sth = $this->db->prepare($query);
5870 5870
 		$sth->execute($query_values);
5871 5871
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -5877,13 +5877,13 @@  discard block
 block discarded – undo
5877 5877
 	* @return Array the aircraft list
5878 5878
 	*
5879 5879
 	*/
5880
-	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5880
+	public function countAllAircraftRegistrationByIdent($ident, $filters = array())
5881 5881
 	{
5882
-		$filter_query = $this->getFilter($filters,true,true);
5882
+		$filter_query = $this->getFilter($filters, true, true);
5883 5883
 		$Image = new Image($this->db);
5884
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5884
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5885 5885
 
5886
-		$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  
5886
+		$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  
5887 5887
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.ident = :ident   
5888 5888
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
5889 5889
 		    ORDER BY registration_count DESC";
@@ -5895,14 +5895,14 @@  discard block
 block discarded – undo
5895 5895
 		$aircraft_array = array();
5896 5896
 		$temp_array = array();
5897 5897
         
5898
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5898
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5899 5899
 		{
5900 5900
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5901 5901
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5902 5902
 			$temp_array['registration'] = $row['registration'];
5903 5903
 			$temp_array['airline_name'] = $row['airline_name'];
5904 5904
 			$temp_array['image_thumbnail'] = "";
5905
-			if($row['registration'] != "")
5905
+			if ($row['registration'] != "")
5906 5906
 			{
5907 5907
 				$image_array = $Image->getSpotterImage($row['registration']);
5908 5908
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5920,44 +5920,44 @@  discard block
 block discarded – undo
5920 5920
 	* @return Array the aircraft list
5921 5921
 	*
5922 5922
 	*/
5923
-	public function countAllAircraftRegistrationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
5923
+	public function countAllAircraftRegistrationByOwner($owner, $filters = array(), $year = '', $month = '', $day = '')
5924 5924
 	{
5925 5925
 		global $globalDBdriver;
5926
-		$filter_query = $this->getFilter($filters,true,true);
5926
+		$filter_query = $this->getFilter($filters, true, true);
5927 5927
 		$Image = new Image($this->db);
5928
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
5928
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
5929 5929
 
5930
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name  
5930
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name  
5931 5931
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.owner_name = :owner";
5932 5932
 		$query_values = array();
5933 5933
 		if ($year != '') {
5934 5934
 			if ($globalDBdriver == 'mysql') {
5935 5935
 				$query .= " AND YEAR(spotter_output.date) = :year";
5936
-				$query_values = array_merge($query_values,array(':year' => $year));
5936
+				$query_values = array_merge($query_values, array(':year' => $year));
5937 5937
 			} else {
5938 5938
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5939
-				$query_values = array_merge($query_values,array(':year' => $year));
5939
+				$query_values = array_merge($query_values, array(':year' => $year));
5940 5940
 			}
5941 5941
 		}
5942 5942
 		if ($month != '') {
5943 5943
 			if ($globalDBdriver == 'mysql') {
5944 5944
 				$query .= " AND MONTH(spotter_output.date) = :month";
5945
-				$query_values = array_merge($query_values,array(':month' => $month));
5945
+				$query_values = array_merge($query_values, array(':month' => $month));
5946 5946
 			} else {
5947 5947
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5948
-				$query_values = array_merge($query_values,array(':month' => $month));
5948
+				$query_values = array_merge($query_values, array(':month' => $month));
5949 5949
 			}
5950 5950
 		}
5951 5951
 		if ($day != '') {
5952 5952
 			if ($globalDBdriver == 'mysql') {
5953 5953
 				$query .= " AND DAY(spotter_output.date) = :day";
5954
-				$query_values = array_merge($query_values,array(':day' => $day));
5954
+				$query_values = array_merge($query_values, array(':day' => $day));
5955 5955
 			} else {
5956 5956
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5957
-				$query_values = array_merge($query_values,array(':day' => $day));
5957
+				$query_values = array_merge($query_values, array(':day' => $day));
5958 5958
 			}
5959 5959
 		}
5960
-		$query_values = array_merge($query_values,array(':owner' => $owner));
5960
+		$query_values = array_merge($query_values, array(':owner' => $owner));
5961 5961
 
5962 5962
 		$query .= " GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_name
5963 5963
 		    ORDER BY registration_count DESC";
@@ -5969,7 +5969,7 @@  discard block
 block discarded – undo
5969 5969
 		$aircraft_array = array();
5970 5970
 		$temp_array = array();
5971 5971
         
5972
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5972
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5973 5973
 		{
5974 5974
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5975 5975
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5977,7 +5977,7 @@  discard block
 block discarded – undo
5977 5977
 			$temp_array['registration'] = $row['registration'];
5978 5978
 			$temp_array['airline_name'] = $row['airline_name'];
5979 5979
 			$temp_array['image_thumbnail'] = "";
5980
-			if($row['registration'] != "")
5980
+			if ($row['registration'] != "")
5981 5981
 			{
5982 5982
 				$image_array = $Image->getSpotterImage($row['registration']);
5983 5983
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5995,44 +5995,44 @@  discard block
 block discarded – undo
5995 5995
 	* @return Array the aircraft list
5996 5996
 	*
5997 5997
 	*/
5998
-	public function countAllAircraftRegistrationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
5998
+	public function countAllAircraftRegistrationByPilot($pilot, $filters = array(), $year = '', $month = '', $day = '')
5999 5999
 	{
6000 6000
 		global $globalDBdriver;
6001
-		$filter_query = $this->getFilter($filters,true,true);
6001
+		$filter_query = $this->getFilter($filters, true, true);
6002 6002
 		$Image = new Image($this->db);
6003
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
6003
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
6004 6004
 
6005
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name  
6005
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name  
6006 6006
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot)";
6007 6007
 		$query_values = array();
6008 6008
 		if ($year != '') {
6009 6009
 			if ($globalDBdriver == 'mysql') {
6010 6010
 				$query .= " AND YEAR(spotter_output.date) = :year";
6011
-				$query_values = array_merge($query_values,array(':year' => $year));
6011
+				$query_values = array_merge($query_values, array(':year' => $year));
6012 6012
 			} else {
6013 6013
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6014
-				$query_values = array_merge($query_values,array(':year' => $year));
6014
+				$query_values = array_merge($query_values, array(':year' => $year));
6015 6015
 			}
6016 6016
 		}
6017 6017
 		if ($month != '') {
6018 6018
 			if ($globalDBdriver == 'mysql') {
6019 6019
 				$query .= " AND MONTH(spotter_output.date) = :month";
6020
-				$query_values = array_merge($query_values,array(':month' => $month));
6020
+				$query_values = array_merge($query_values, array(':month' => $month));
6021 6021
 			} else {
6022 6022
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6023
-				$query_values = array_merge($query_values,array(':month' => $month));
6023
+				$query_values = array_merge($query_values, array(':month' => $month));
6024 6024
 			}
6025 6025
 		}
6026 6026
 		if ($day != '') {
6027 6027
 			if ($globalDBdriver == 'mysql') {
6028 6028
 				$query .= " AND DAY(spotter_output.date) = :day";
6029
-				$query_values = array_merge($query_values,array(':day' => $day));
6029
+				$query_values = array_merge($query_values, array(':day' => $day));
6030 6030
 			} else {
6031 6031
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6032
-				$query_values = array_merge($query_values,array(':day' => $day));
6032
+				$query_values = array_merge($query_values, array(':day' => $day));
6033 6033
 			}
6034 6034
 		}
6035
-		$query_values = array_merge($query_values,array(':pilot' => $pilot));
6035
+		$query_values = array_merge($query_values, array(':pilot' => $pilot));
6036 6036
 
6037 6037
 		$query .= " GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_name
6038 6038
 		    ORDER BY registration_count DESC";
@@ -6044,7 +6044,7 @@  discard block
 block discarded – undo
6044 6044
 		$aircraft_array = array();
6045 6045
 		$temp_array = array();
6046 6046
         
6047
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6047
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6048 6048
 		{
6049 6049
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6050 6050
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -6052,7 +6052,7 @@  discard block
 block discarded – undo
6052 6052
 			$temp_array['registration'] = $row['registration'];
6053 6053
 			$temp_array['airline_name'] = $row['airline_name'];
6054 6054
 			$temp_array['image_thumbnail'] = "";
6055
-			if($row['registration'] != "")
6055
+			if ($row['registration'] != "")
6056 6056
 			{
6057 6057
 				$image_array = $Image->getSpotterImage($row['registration']);
6058 6058
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6071,11 +6071,11 @@  discard block
 block discarded – undo
6071 6071
 	* @return Array the aircraft manufacturer list
6072 6072
 	*
6073 6073
 	*/
6074
-	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
6074
+	public function countAllAircraftManufacturerByIdent($ident, $filters = array())
6075 6075
 	{
6076
-		$filter_query = $this->getFilter($filters,true,true);
6077
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6078
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6076
+		$filter_query = $this->getFilter($filters, true, true);
6077
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6078
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6079 6079
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident  
6080 6080
                     GROUP BY spotter_output.aircraft_manufacturer 
6081 6081
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -6085,7 +6085,7 @@  discard block
 block discarded – undo
6085 6085
 		$sth->execute(array(':ident' => $ident));
6086 6086
 		$aircraft_array = array();
6087 6087
 		$temp_array = array();
6088
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6088
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6089 6089
 		{
6090 6090
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
6091 6091
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -6100,42 +6100,42 @@  discard block
 block discarded – undo
6100 6100
 	* @return Array the aircraft manufacturer list
6101 6101
 	*
6102 6102
 	*/
6103
-	public function countAllAircraftManufacturerByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
6103
+	public function countAllAircraftManufacturerByOwner($owner, $filters = array(), $year = '', $month = '', $day = '')
6104 6104
 	{
6105 6105
 		global $globalDBdriver;
6106
-		$filter_query = $this->getFilter($filters,true,true);
6107
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
6108
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6106
+		$filter_query = $this->getFilter($filters, true, true);
6107
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
6108
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6109 6109
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.owner_name = :owner";
6110 6110
 		$query_values = array();
6111 6111
 		if ($year != '') {
6112 6112
 			if ($globalDBdriver == 'mysql') {
6113 6113
 				$query .= " AND YEAR(spotter_output.date) = :year";
6114
-				$query_values = array_merge($query_values,array(':year' => $year));
6114
+				$query_values = array_merge($query_values, array(':year' => $year));
6115 6115
 			} else {
6116 6116
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6117
-				$query_values = array_merge($query_values,array(':year' => $year));
6117
+				$query_values = array_merge($query_values, array(':year' => $year));
6118 6118
 			}
6119 6119
 		}
6120 6120
 		if ($month != '') {
6121 6121
 			if ($globalDBdriver == 'mysql') {
6122 6122
 				$query .= " AND MONTH(spotter_output.date) = :month";
6123
-				$query_values = array_merge($query_values,array(':month' => $month));
6123
+				$query_values = array_merge($query_values, array(':month' => $month));
6124 6124
 			} else {
6125 6125
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6126
-				$query_values = array_merge($query_values,array(':month' => $month));
6126
+				$query_values = array_merge($query_values, array(':month' => $month));
6127 6127
 			}
6128 6128
 		}
6129 6129
 		if ($day != '') {
6130 6130
 			if ($globalDBdriver == 'mysql') {
6131 6131
 				$query .= " AND DAY(spotter_output.date) = :day";
6132
-				$query_values = array_merge($query_values,array(':day' => $day));
6132
+				$query_values = array_merge($query_values, array(':day' => $day));
6133 6133
 			} else {
6134 6134
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6135
-				$query_values = array_merge($query_values,array(':day' => $day));
6135
+				$query_values = array_merge($query_values, array(':day' => $day));
6136 6136
 			}
6137 6137
 		}
6138
-		$query_values = array_merge($query_values,array(':owner' => $owner));
6138
+		$query_values = array_merge($query_values, array(':owner' => $owner));
6139 6139
 
6140 6140
 		$query .= " GROUP BY spotter_output.aircraft_manufacturer 
6141 6141
 		    ORDER BY aircraft_manufacturer_count DESC";
@@ -6152,42 +6152,42 @@  discard block
 block discarded – undo
6152 6152
 	* @return Array the aircraft manufacturer list
6153 6153
 	*
6154 6154
 	*/
6155
-	public function countAllAircraftManufacturerByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
6155
+	public function countAllAircraftManufacturerByPilot($pilot, $filters = array(), $year = '', $month = '', $day = '')
6156 6156
 	{
6157 6157
 		global $globalDBdriver;
6158
-		$filter_query = $this->getFilter($filters,true,true);
6159
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
6160
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6158
+		$filter_query = $this->getFilter($filters, true, true);
6159
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
6160
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6161 6161
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot)";
6162 6162
 		$query_values = array();
6163 6163
 		if ($year != '') {
6164 6164
 			if ($globalDBdriver == 'mysql') {
6165 6165
 				$query .= " AND YEAR(spotter_output.date) = :year";
6166
-				$query_values = array_merge($query_values,array(':year' => $year));
6166
+				$query_values = array_merge($query_values, array(':year' => $year));
6167 6167
 			} else {
6168 6168
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6169
-				$query_values = array_merge($query_values,array(':year' => $year));
6169
+				$query_values = array_merge($query_values, array(':year' => $year));
6170 6170
 			}
6171 6171
 		}
6172 6172
 		if ($month != '') {
6173 6173
 			if ($globalDBdriver == 'mysql') {
6174 6174
 				$query .= " AND MONTH(spotter_output.date) = :month";
6175
-				$query_values = array_merge($query_values,array(':month' => $month));
6175
+				$query_values = array_merge($query_values, array(':month' => $month));
6176 6176
 			} else {
6177 6177
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6178
-				$query_values = array_merge($query_values,array(':month' => $month));
6178
+				$query_values = array_merge($query_values, array(':month' => $month));
6179 6179
 			}
6180 6180
 		}
6181 6181
 		if ($day != '') {
6182 6182
 			if ($globalDBdriver == 'mysql') {
6183 6183
 				$query .= " AND DAY(spotter_output.date) = :day";
6184
-				$query_values = array_merge($query_values,array(':day' => $day));
6184
+				$query_values = array_merge($query_values, array(':day' => $day));
6185 6185
 			} else {
6186 6186
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6187
-				$query_values = array_merge($query_values,array(':day' => $day));
6187
+				$query_values = array_merge($query_values, array(':day' => $day));
6188 6188
 			}
6189 6189
 		}
6190
-		$query_values = array_merge($query_values,array(':pilot' => $pilot));
6190
+		$query_values = array_merge($query_values, array(':pilot' => $pilot));
6191 6191
 
6192 6192
 		$query .= " GROUP BY spotter_output.aircraft_manufacturer 
6193 6193
 		    ORDER BY aircraft_manufacturer_count DESC";
@@ -6205,24 +6205,24 @@  discard block
 block discarded – undo
6205 6205
 	* @return Array the aircraft list
6206 6206
 	*
6207 6207
 	*/
6208
-	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6208
+	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
6209 6209
 	{
6210
-		$filter_query = $this->getFilter($filters,true,true);
6211
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
6212
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
6210
+		$filter_query = $this->getFilter($filters, true, true);
6211
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
6212
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
6213 6213
 		
6214 6214
 
6215
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
6215
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
6216 6216
                     FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
6217 6217
                     GROUP BY spotter_output.aircraft_name 
6218 6218
 					ORDER BY aircraft_icao_count DESC";
6219 6219
  
6220 6220
 		
6221 6221
 		$sth = $this->db->prepare($query);
6222
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
6222
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
6223 6223
 		$aircraft_array = array();
6224 6224
 		$temp_array = array();
6225
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6225
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6226 6226
 		{
6227 6227
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6228 6228
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -6238,33 +6238,33 @@  discard block
 block discarded – undo
6238 6238
 	* @return Array the aircraft list
6239 6239
 	*
6240 6240
 	*/
6241
-	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6241
+	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
6242 6242
 	{
6243
-		$filter_query = $this->getFilter($filters,true,true);
6243
+		$filter_query = $this->getFilter($filters, true, true);
6244 6244
 		$Image = new Image($this->db);
6245
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
6246
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
6245
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
6246
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
6247 6247
 
6248
-		$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   
6248
+		$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   
6249 6249
                     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)   
6250 6250
                     GROUP BY spotter_output.registration 
6251 6251
 					ORDER BY registration_count DESC";
6252 6252
 
6253 6253
 		
6254 6254
 		$sth = $this->db->prepare($query);
6255
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
6255
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
6256 6256
       
6257 6257
 		$aircraft_array = array();
6258 6258
 		$temp_array = array();
6259 6259
         
6260
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6260
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6261 6261
 		{
6262 6262
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6263 6263
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6264 6264
 			$temp_array['registration'] = $row['registration'];
6265 6265
 			$temp_array['airline_name'] = $row['airline_name'];
6266 6266
 			$temp_array['image_thumbnail'] = "";
6267
-			if($row['registration'] != "")
6267
+			if ($row['registration'] != "")
6268 6268
 			{
6269 6269
 				$image_array = $Image->getSpotterImage($row['registration']);
6270 6270
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6284,25 +6284,25 @@  discard block
 block discarded – undo
6284 6284
 	* @return Array the aircraft manufacturer list
6285 6285
 	*
6286 6286
 	*/
6287
-	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6287
+	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
6288 6288
 	{
6289
-		$filter_query = $this->getFilter($filters,true,true);
6290
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
6291
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
6289
+		$filter_query = $this->getFilter($filters, true, true);
6290
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
6291
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
6292 6292
 
6293
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6293
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6294 6294
                     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) 
6295 6295
                     GROUP BY spotter_output.aircraft_manufacturer 
6296 6296
 					ORDER BY aircraft_manufacturer_count DESC";
6297 6297
 
6298 6298
 		
6299 6299
 		$sth = $this->db->prepare($query);
6300
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
6300
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
6301 6301
       
6302 6302
 		$aircraft_array = array();
6303 6303
 		$temp_array = array();
6304 6304
         
6305
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6305
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6306 6306
 		{
6307 6307
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
6308 6308
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -6322,11 +6322,11 @@  discard block
 block discarded – undo
6322 6322
 	* @return Array the aircraft list
6323 6323
 	*
6324 6324
 	*/
6325
-	public function countAllAircraftTypesByCountry($country,$filters = array())
6325
+	public function countAllAircraftTypesByCountry($country, $filters = array())
6326 6326
 	{
6327
-		$filter_query = $this->getFilter($filters,true,true);
6328
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6329
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
6327
+		$filter_query = $this->getFilter($filters, true, true);
6328
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6329
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
6330 6330
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
6331 6331
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
6332 6332
 			    ORDER BY aircraft_icao_count DESC";
@@ -6338,7 +6338,7 @@  discard block
 block discarded – undo
6338 6338
 		$aircraft_array = array();
6339 6339
 		$temp_array = array();
6340 6340
         
6341
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6341
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6342 6342
 		{
6343 6343
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6344 6344
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -6357,12 +6357,12 @@  discard block
 block discarded – undo
6357 6357
 	* @return Array the aircraft list
6358 6358
 	*
6359 6359
 	*/
6360
-	public function countAllAircraftRegistrationByCountry($country,$filters = array())
6360
+	public function countAllAircraftRegistrationByCountry($country, $filters = array())
6361 6361
 	{
6362
-		$filter_query = $this->getFilter($filters,true,true);
6362
+		$filter_query = $this->getFilter($filters, true, true);
6363 6363
 		$Image = new Image($this->db);
6364
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6365
-		$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 
6364
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6365
+		$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 
6366 6366
 			    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)    
6367 6367
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
6368 6368
 			    ORDER BY registration_count DESC";
@@ -6374,14 +6374,14 @@  discard block
 block discarded – undo
6374 6374
 		$aircraft_array = array();
6375 6375
 		$temp_array = array();
6376 6376
         
6377
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6377
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6378 6378
 		{
6379 6379
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6380 6380
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6381 6381
 			$temp_array['registration'] = $row['registration'];
6382 6382
 			$temp_array['airline_name'] = $row['airline_name'];
6383 6383
 			$temp_array['image_thumbnail'] = "";
6384
-			if($row['registration'] != "")
6384
+			if ($row['registration'] != "")
6385 6385
 			{
6386 6386
 				$image_array = $Image->getSpotterImage($row['registration']);
6387 6387
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6401,11 +6401,11 @@  discard block
 block discarded – undo
6401 6401
 	* @return Array the aircraft manufacturer list
6402 6402
 	*
6403 6403
 	*/
6404
-	public function countAllAircraftManufacturerByCountry($country,$filters = array())
6404
+	public function countAllAircraftManufacturerByCountry($country, $filters = array())
6405 6405
 	{
6406
-		$filter_query = $this->getFilter($filters,true,true);
6407
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6408
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6406
+		$filter_query = $this->getFilter($filters, true, true);
6407
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6408
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6409 6409
                     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) 
6410 6410
                     GROUP BY spotter_output.aircraft_manufacturer 
6411 6411
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -6417,7 +6417,7 @@  discard block
 block discarded – undo
6417 6417
 		$aircraft_array = array();
6418 6418
 		$temp_array = array();
6419 6419
         
6420
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6420
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6421 6421
 		{
6422 6422
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
6423 6423
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -6436,38 +6436,38 @@  discard block
 block discarded – undo
6436 6436
 	* @return Array the aircraft list
6437 6437
 	*
6438 6438
 	*/
6439
-	public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '')
6439
+	public function countAllAircraftManufacturers($filters = array(), $year = '', $month = '', $day = '')
6440 6440
 	{
6441 6441
 		global $globalDBdriver;
6442
-		$filter_query = $this->getFilter($filters,true,true);
6443
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6442
+		$filter_query = $this->getFilter($filters, true, true);
6443
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6444 6444
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
6445 6445
                 $query_values = array();
6446 6446
 		if ($year != '') {
6447 6447
 			if ($globalDBdriver == 'mysql') {
6448 6448
 				$query .= " AND YEAR(spotter_output.date) = :year";
6449
-				$query_values = array_merge($query_values,array(':year' => $year));
6449
+				$query_values = array_merge($query_values, array(':year' => $year));
6450 6450
 			} else {
6451 6451
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6452
-				$query_values = array_merge($query_values,array(':year' => $year));
6452
+				$query_values = array_merge($query_values, array(':year' => $year));
6453 6453
 			}
6454 6454
 		}
6455 6455
 		if ($month != '') {
6456 6456
 			if ($globalDBdriver == 'mysql') {
6457 6457
 				$query .= " AND MONTH(spotter_output.date) = :month";
6458
-				$query_values = array_merge($query_values,array(':month' => $month));
6458
+				$query_values = array_merge($query_values, array(':month' => $month));
6459 6459
 			} else {
6460 6460
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6461
-				$query_values = array_merge($query_values,array(':month' => $month));
6461
+				$query_values = array_merge($query_values, array(':month' => $month));
6462 6462
 			}
6463 6463
 		}
6464 6464
 		if ($day != '') {
6465 6465
 			if ($globalDBdriver == 'mysql') {
6466 6466
 				$query .= " AND DAY(spotter_output.date) = :day";
6467
-				$query_values = array_merge($query_values,array(':day' => $day));
6467
+				$query_values = array_merge($query_values, array(':day' => $day));
6468 6468
 			} else {
6469 6469
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6470
-				$query_values = array_merge($query_values,array(':day' => $day));
6470
+				$query_values = array_merge($query_values, array(':day' => $day));
6471 6471
 			}
6472 6472
 		}
6473 6473
 		$query .= " GROUP BY spotter_output.aircraft_manufacturer
@@ -6481,7 +6481,7 @@  discard block
 block discarded – undo
6481 6481
 		$manufacturer_array = array();
6482 6482
 		$temp_array = array();
6483 6483
         
6484
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6484
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6485 6485
 		{
6486 6486
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
6487 6487
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -6500,12 +6500,12 @@  discard block
 block discarded – undo
6500 6500
 	* @return Array the aircraft list
6501 6501
 	*
6502 6502
 	*/
6503
-	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
6503
+	public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
6504 6504
 	{
6505 6505
 		global $globalDBdriver;
6506 6506
 		$Image = new Image($this->db);
6507
-		$filter_query = $this->getFilter($filters,true,true);
6508
-		$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    
6507
+		$filter_query = $this->getFilter($filters, true, true);
6508
+		$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    
6509 6509
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
6510 6510
                 if ($olderthanmonths > 0) {
6511 6511
             		if ($globalDBdriver == 'mysql') {
@@ -6525,28 +6525,28 @@  discard block
 block discarded – undo
6525 6525
 		if ($year != '') {
6526 6526
 			if ($globalDBdriver == 'mysql') {
6527 6527
 				$query .= " AND YEAR(spotter_output.date) = :year";
6528
-				$query_values = array_merge($query_values,array(':year' => $year));
6528
+				$query_values = array_merge($query_values, array(':year' => $year));
6529 6529
 			} else {
6530 6530
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6531
-				$query_values = array_merge($query_values,array(':year' => $year));
6531
+				$query_values = array_merge($query_values, array(':year' => $year));
6532 6532
 			}
6533 6533
 		}
6534 6534
 		if ($month != '') {
6535 6535
 			if ($globalDBdriver == 'mysql') {
6536 6536
 				$query .= " AND MONTH(spotter_output.date) = :month";
6537
-				$query_values = array_merge($query_values,array(':month' => $month));
6537
+				$query_values = array_merge($query_values, array(':month' => $month));
6538 6538
 			} else {
6539 6539
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6540
-				$query_values = array_merge($query_values,array(':month' => $month));
6540
+				$query_values = array_merge($query_values, array(':month' => $month));
6541 6541
 			}
6542 6542
 		}
6543 6543
 		if ($day != '') {
6544 6544
 			if ($globalDBdriver == 'mysql') {
6545 6545
 				$query .= " AND DAY(spotter_output.date) = :day";
6546
-				$query_values = array_merge($query_values,array(':day' => $day));
6546
+				$query_values = array_merge($query_values, array(':day' => $day));
6547 6547
 			} else {
6548 6548
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6549
-				$query_values = array_merge($query_values,array(':day' => $day));
6549
+				$query_values = array_merge($query_values, array(':day' => $day));
6550 6550
 			}
6551 6551
 		}
6552 6552
 		$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
@@ -6558,7 +6558,7 @@  discard block
 block discarded – undo
6558 6558
 		$aircraft_array = array();
6559 6559
 		$temp_array = array();
6560 6560
         
6561
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6561
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6562 6562
 		{
6563 6563
 			$temp_array['registration'] = $row['registration'];
6564 6564
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -6566,7 +6566,7 @@  discard block
 block discarded – undo
6566 6566
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6567 6567
 			$temp_array['airline_name'] = $row['airline_name'];
6568 6568
 			$temp_array['image_thumbnail'] = "";
6569
-			if($row['registration'] != "")
6569
+			if ($row['registration'] != "")
6570 6570
 			{
6571 6571
 				$image_array = $Image->getSpotterImage($row['registration']);
6572 6572
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6585,12 +6585,12 @@  discard block
 block discarded – undo
6585 6585
 	* @return Array the aircraft list
6586 6586
 	*
6587 6587
 	*/
6588
-	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
6588
+	public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
6589 6589
 	{
6590 6590
 		global $globalDBdriver;
6591
-		$filter_query = $this->getFilter($filters,true,true);
6591
+		$filter_query = $this->getFilter($filters, true, true);
6592 6592
 		$Image = new Image($this->db);
6593
-		$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    
6593
+		$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    
6594 6594
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
6595 6595
                 if ($olderthanmonths > 0) {
6596 6596
             		if ($globalDBdriver == 'mysql') {
@@ -6618,7 +6618,7 @@  discard block
 block discarded – undo
6618 6618
 		$aircraft_array = array();
6619 6619
 		$temp_array = array();
6620 6620
         
6621
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6621
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6622 6622
 		{
6623 6623
 			$temp_array['registration'] = $row['registration'];
6624 6624
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -6627,7 +6627,7 @@  discard block
 block discarded – undo
6627 6627
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6628 6628
 			$temp_array['airline_name'] = $row['airline_name'];
6629 6629
 			$temp_array['image_thumbnail'] = "";
6630
-			if($row['registration'] != "")
6630
+			if ($row['registration'] != "")
6631 6631
 			{
6632 6632
 				$image_array = $Image->getSpotterImage($row['registration']);
6633 6633
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6646,11 +6646,11 @@  discard block
 block discarded – undo
6646 6646
 	* @return Array the airport list
6647 6647
 	*
6648 6648
 	*/
6649
-	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6649
+	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
6650 6650
 	{
6651 6651
 		global $globalDBdriver;
6652
-		$filter_query = $this->getFilter($filters,true,true);
6653
-		$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, airport.latitude, airport.longitude
6652
+		$filter_query = $this->getFilter($filters, true, true);
6653
+		$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, airport.latitude, airport.longitude
6654 6654
 				FROM airport, spotter_output".$filter_query." airport.icao = spotter_output.departure_airport_icao AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
6655 6655
                 if ($olderthanmonths > 0) {
6656 6656
             		if ($globalDBdriver == 'mysql') {
@@ -6670,28 +6670,28 @@  discard block
 block discarded – undo
6670 6670
 		if ($year != '') {
6671 6671
 			if ($globalDBdriver == 'mysql') {
6672 6672
 				$query .= " AND YEAR(spotter_output.date) = :year";
6673
-				$query_values = array_merge($query_values,array(':year' => $year));
6673
+				$query_values = array_merge($query_values, array(':year' => $year));
6674 6674
 			} else {
6675 6675
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6676
-				$query_values = array_merge($query_values,array(':year' => $year));
6676
+				$query_values = array_merge($query_values, array(':year' => $year));
6677 6677
 			}
6678 6678
 		}
6679 6679
 		if ($month != '') {
6680 6680
 			if ($globalDBdriver == 'mysql') {
6681 6681
 				$query .= " AND MONTH(spotter_output.date) = :month";
6682
-				$query_values = array_merge($query_values,array(':month' => $month));
6682
+				$query_values = array_merge($query_values, array(':month' => $month));
6683 6683
 			} else {
6684 6684
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6685
-				$query_values = array_merge($query_values,array(':month' => $month));
6685
+				$query_values = array_merge($query_values, array(':month' => $month));
6686 6686
 			}
6687 6687
 		}
6688 6688
 		if ($day != '') {
6689 6689
 			if ($globalDBdriver == 'mysql') {
6690 6690
 				$query .= " AND DAY(spotter_output.date) = :day";
6691
-				$query_values = array_merge($query_values,array(':day' => $day));
6691
+				$query_values = array_merge($query_values, array(':day' => $day));
6692 6692
 			} else {
6693 6693
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6694
-				$query_values = array_merge($query_values,array(':day' => $day));
6694
+				$query_values = array_merge($query_values, array(':day' => $day));
6695 6695
 			}
6696 6696
 		}
6697 6697
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, airport.latitude, airport.longitude
@@ -6703,7 +6703,7 @@  discard block
 block discarded – undo
6703 6703
 
6704 6704
 		$airport_array = array();
6705 6705
 		$temp_array = array();
6706
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6706
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6707 6707
 		{
6708 6708
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6709 6709
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6723,11 +6723,11 @@  discard block
 block discarded – undo
6723 6723
 	* @return Array the airport list
6724 6724
 	*
6725 6725
 	*/
6726
-	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6726
+	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
6727 6727
 	{
6728 6728
 		global $globalDBdriver;
6729
-		$filter_query = $this->getFilter($filters,true,true);
6730
-		$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 
6729
+		$filter_query = $this->getFilter($filters, true, true);
6730
+		$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 
6731 6731
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' ";
6732 6732
                 if ($olderthanmonths > 0) {
6733 6733
             		if ($globalDBdriver == 'mysql') {
@@ -6756,7 +6756,7 @@  discard block
 block discarded – undo
6756 6756
 		$airport_array = array();
6757 6757
 		$temp_array = array();
6758 6758
         
6759
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6759
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6760 6760
 		{
6761 6761
 			$temp_array['airline_icao'] = $row['airline_icao'];
6762 6762
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -6776,11 +6776,11 @@  discard block
 block discarded – undo
6776 6776
 	* @return Array the airport list
6777 6777
 	*
6778 6778
 	*/
6779
-	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6779
+	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
6780 6780
 	{
6781 6781
 		global $globalDBdriver;
6782
-		$filter_query = $this->getFilter($filters,true,true);
6783
-		$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, airport.latitude as departure_airport_latitude, airport.longitude as departure_airport.longitude
6782
+		$filter_query = $this->getFilter($filters, true, true);
6783
+		$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, airport.latitude as departure_airport_latitude, airport.longitude as departure_airport.longitude
6784 6784
 				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";
6785 6785
                 if ($olderthanmonths > 0) {
6786 6786
             		if ($globalDBdriver == 'mysql') {
@@ -6800,28 +6800,28 @@  discard block
 block discarded – undo
6800 6800
 		if ($year != '') {
6801 6801
 			if ($globalDBdriver == 'mysql') {
6802 6802
 				$query .= " AND YEAR(spotter_output.date) = :year";
6803
-				$query_values = array_merge($query_values,array(':year' => $year));
6803
+				$query_values = array_merge($query_values, array(':year' => $year));
6804 6804
 			} else {
6805 6805
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6806
-				$query_values = array_merge($query_values,array(':year' => $year));
6806
+				$query_values = array_merge($query_values, array(':year' => $year));
6807 6807
 			}
6808 6808
 		}
6809 6809
 		if ($month != '') {
6810 6810
 			if ($globalDBdriver == 'mysql') {
6811 6811
 				$query .= " AND MONTH(spotter_output.date) = :month";
6812
-				$query_values = array_merge($query_values,array(':month' => $month));
6812
+				$query_values = array_merge($query_values, array(':month' => $month));
6813 6813
 			} else {
6814 6814
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6815
-				$query_values = array_merge($query_values,array(':month' => $month));
6815
+				$query_values = array_merge($query_values, array(':month' => $month));
6816 6816
 			}
6817 6817
 		}
6818 6818
 		if ($day != '') {
6819 6819
 			if ($globalDBdriver == 'mysql') {
6820 6820
 				$query .= " AND DAY(spotter_output.date) = :day";
6821
-				$query_values = array_merge($query_values,array(':day' => $day));
6821
+				$query_values = array_merge($query_values, array(':day' => $day));
6822 6822
 			} else {
6823 6823
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6824
-				$query_values = array_merge($query_values,array(':day' => $day));
6824
+				$query_values = array_merge($query_values, array(':day' => $day));
6825 6825
 			}
6826 6826
 		}
6827 6827
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country, airport.latitude, airport.longitude
@@ -6834,7 +6834,7 @@  discard block
 block discarded – undo
6834 6834
 		$airport_array = array();
6835 6835
 		$temp_array = array();
6836 6836
         
6837
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6837
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6838 6838
 		{
6839 6839
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6840 6840
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6855,11 +6855,11 @@  discard block
 block discarded – undo
6855 6855
 	* @return Array the airport list
6856 6856
 	*
6857 6857
 	*/
6858
-	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6858
+	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
6859 6859
 	{
6860 6860
 		global $globalDBdriver;
6861
-		$filter_query = $this->getFilter($filters,true,true);
6862
-		$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
6861
+		$filter_query = $this->getFilter($filters, true, true);
6862
+		$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
6863 6863
 				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 ";
6864 6864
                 if ($olderthanmonths > 0) {
6865 6865
             		if ($globalDBdriver == 'mysql') {
@@ -6888,7 +6888,7 @@  discard block
 block discarded – undo
6888 6888
 		$airport_array = array();
6889 6889
 		$temp_array = array();
6890 6890
         
6891
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6891
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6892 6892
 		{
6893 6893
 			$temp_array['airline_icao'] = $row['airline_icao'];
6894 6894
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -6908,11 +6908,11 @@  discard block
 block discarded – undo
6908 6908
 	* @return Array the airport list
6909 6909
 	*
6910 6910
 	*/
6911
-	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
6911
+	public function countAllDepartureAirportsByAirline($airline_icao, $filters = array())
6912 6912
 	{
6913
-		$filter_query = $this->getFilter($filters,true,true);
6914
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6915
-		$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 
6913
+		$filter_query = $this->getFilter($filters, true, true);
6914
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6915
+		$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 
6916 6916
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao AND spotter_output.departure_airport_icao <> '' 
6917 6917
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6918 6918
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6924,7 +6924,7 @@  discard block
 block discarded – undo
6924 6924
 		$airport_array = array();
6925 6925
 		$temp_array = array();
6926 6926
         
6927
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6927
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6928 6928
 		{
6929 6929
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6930 6930
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6946,11 +6946,11 @@  discard block
 block discarded – undo
6946 6946
 	* @return Array the airport list
6947 6947
 	*
6948 6948
 	*/
6949
-	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
6949
+	public function countAllDepartureAirportCountriesByAirline($airline_icao, $filters = array())
6950 6950
 	{
6951
-		$filter_query = $this->getFilter($filters,true,true);
6952
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6953
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6951
+		$filter_query = $this->getFilter($filters, true, true);
6952
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6953
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6954 6954
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
6955 6955
                     GROUP BY spotter_output.departure_airport_country
6956 6956
 					ORDER BY airport_departure_country_count DESC";
@@ -6962,7 +6962,7 @@  discard block
 block discarded – undo
6962 6962
 		$airport_array = array();
6963 6963
 		$temp_array = array();
6964 6964
         
6965
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6965
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6966 6966
 		{
6967 6967
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6968 6968
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6981,11 +6981,11 @@  discard block
 block discarded – undo
6981 6981
 	* @return Array the airport list
6982 6982
 	*
6983 6983
 	*/
6984
-	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
6984
+	public function countAllDepartureAirportsByAircraft($aircraft_icao, $filters = array())
6985 6985
 	{
6986
-		$filter_query = $this->getFilter($filters,true,true);
6987
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6988
-		$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 
6986
+		$filter_query = $this->getFilter($filters, true, true);
6987
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6988
+		$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 
6989 6989
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao AND spotter_output.departure_airport_icao <> '' 
6990 6990
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6991 6991
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6997,7 +6997,7 @@  discard block
 block discarded – undo
6997 6997
 		$airport_array = array();
6998 6998
 		$temp_array = array();
6999 6999
         
7000
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7000
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7001 7001
 		{
7002 7002
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7003 7003
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7018,11 +7018,11 @@  discard block
 block discarded – undo
7018 7018
 	* @return Array the airport list
7019 7019
 	*
7020 7020
 	*/
7021
-	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
7021
+	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao, $filters = array())
7022 7022
 	{
7023
-		$filter_query = $this->getFilter($filters,true,true);
7024
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7025
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7023
+		$filter_query = $this->getFilter($filters, true, true);
7024
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7025
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7026 7026
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
7027 7027
                     GROUP BY spotter_output.departure_airport_country
7028 7028
 					ORDER BY airport_departure_country_count DESC";
@@ -7034,7 +7034,7 @@  discard block
 block discarded – undo
7034 7034
 		$airport_array = array();
7035 7035
 		$temp_array = array();
7036 7036
         
7037
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7037
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7038 7038
 		{
7039 7039
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7040 7040
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7052,11 +7052,11 @@  discard block
 block discarded – undo
7052 7052
 	* @return Array the airport list
7053 7053
 	*
7054 7054
 	*/
7055
-	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
7055
+	public function countAllDepartureAirportsByRegistration($registration, $filters = array())
7056 7056
 	{
7057
-		$filter_query = $this->getFilter($filters,true,true);
7058
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
7059
-		$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 
7057
+		$filter_query = $this->getFilter($filters, true, true);
7058
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7059
+		$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 
7060 7060
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.registration = :registration AND spotter_output.departure_airport_icao <> '' 
7061 7061
                     GROUP BY spotter_output.departure_airport_icao
7062 7062
 					ORDER BY airport_departure_icao_count DESC";
@@ -7068,7 +7068,7 @@  discard block
 block discarded – undo
7068 7068
 		$airport_array = array();
7069 7069
 		$temp_array = array();
7070 7070
         
7071
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7071
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7072 7072
 		{
7073 7073
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7074 7074
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7089,11 +7089,11 @@  discard block
 block discarded – undo
7089 7089
 	* @return Array the airport list
7090 7090
 	*
7091 7091
 	*/
7092
-	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
7092
+	public function countAllDepartureAirportCountriesByRegistration($registration, $filters = array())
7093 7093
 	{
7094
-		$filter_query = $this->getFilter($filters,true,true);
7095
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
7096
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7094
+		$filter_query = $this->getFilter($filters, true, true);
7095
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7096
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7097 7097
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration 
7098 7098
                     GROUP BY spotter_output.departure_airport_country
7099 7099
 					ORDER BY airport_departure_country_count DESC";
@@ -7105,7 +7105,7 @@  discard block
 block discarded – undo
7105 7105
 		$airport_array = array();
7106 7106
 		$temp_array = array();
7107 7107
         
7108
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7108
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7109 7109
 		{
7110 7110
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7111 7111
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7123,11 +7123,11 @@  discard block
 block discarded – undo
7123 7123
 	* @return Array the airport list
7124 7124
 	*
7125 7125
 	*/
7126
-	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
7126
+	public function countAllDepartureAirportsByAirport($airport_icao, $filters = array())
7127 7127
 	{
7128
-		$filter_query = $this->getFilter($filters,true,true);
7129
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7130
-		$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 
7128
+		$filter_query = $this->getFilter($filters, true, true);
7129
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7130
+		$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 
7131 7131
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao = :airport_icao AND spotter_output.departure_airport_icao <> '' 
7132 7132
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7133 7133
 			    ORDER BY airport_departure_icao_count DESC";
@@ -7139,7 +7139,7 @@  discard block
 block discarded – undo
7139 7139
 		$airport_array = array();
7140 7140
 		$temp_array = array();
7141 7141
         
7142
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7142
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7143 7143
 		{
7144 7144
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7145 7145
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7160,11 +7160,11 @@  discard block
 block discarded – undo
7160 7160
 	* @return Array the airport list
7161 7161
 	*
7162 7162
 	*/
7163
-	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
7163
+	public function countAllDepartureAirportCountriesByAirport($airport_icao, $filters = array())
7164 7164
 	{
7165
-		$filter_query = $this->getFilter($filters,true,true);
7166
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7167
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7165
+		$filter_query = $this->getFilter($filters, true, true);
7166
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7167
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7168 7168
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao 
7169 7169
                     GROUP BY spotter_output.departure_airport_country
7170 7170
 					ORDER BY airport_departure_country_count DESC";
@@ -7176,7 +7176,7 @@  discard block
 block discarded – undo
7176 7176
 		$airport_array = array();
7177 7177
 		$temp_array = array();
7178 7178
         
7179
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7179
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7180 7180
 		{
7181 7181
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7182 7182
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7195,11 +7195,11 @@  discard block
 block discarded – undo
7195 7195
 	* @return Array the airport list
7196 7196
 	*
7197 7197
 	*/
7198
-	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
7198
+	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer, $filters = array())
7199 7199
 	{
7200
-		$filter_query = $this->getFilter($filters,true,true);
7201
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7202
-		$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 
7200
+		$filter_query = $this->getFilter($filters, true, true);
7201
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7202
+		$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 
7203 7203
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer AND spotter_output.departure_airport_icao <> '' 
7204 7204
                     GROUP BY spotter_output.departure_airport_icao
7205 7205
 					ORDER BY airport_departure_icao_count DESC";
@@ -7211,7 +7211,7 @@  discard block
 block discarded – undo
7211 7211
 		$airport_array = array();
7212 7212
 		$temp_array = array();
7213 7213
         
7214
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7214
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7215 7215
 		{
7216 7216
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7217 7217
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7232,11 +7232,11 @@  discard block
 block discarded – undo
7232 7232
 	* @return Array the airport list
7233 7233
 	*
7234 7234
 	*/
7235
-	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
7235
+	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
7236 7236
 	{
7237
-		$filter_query = $this->getFilter($filters,true,true);
7238
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7239
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7237
+		$filter_query = $this->getFilter($filters, true, true);
7238
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7239
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7240 7240
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
7241 7241
                     GROUP BY spotter_output.departure_airport_country
7242 7242
 					ORDER BY airport_departure_country_count DESC";
@@ -7248,7 +7248,7 @@  discard block
 block discarded – undo
7248 7248
 		$airport_array = array();
7249 7249
 		$temp_array = array();
7250 7250
         
7251
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7251
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7252 7252
 		{
7253 7253
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7254 7254
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7266,11 +7266,11 @@  discard block
 block discarded – undo
7266 7266
 	* @return Array the airport list
7267 7267
 	*
7268 7268
 	*/
7269
-	public function countAllDepartureAirportsByDate($date,$filters = array())
7269
+	public function countAllDepartureAirportsByDate($date, $filters = array())
7270 7270
 	{
7271 7271
 		global $globalTimezone, $globalDBdriver;
7272
-		$filter_query = $this->getFilter($filters,true,true);
7273
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7272
+		$filter_query = $this->getFilter($filters, true, true);
7273
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7274 7274
 		if ($globalTimezone != '') {
7275 7275
 			date_default_timezone_set($globalTimezone);
7276 7276
 			$datetime = new DateTime($date);
@@ -7278,12 +7278,12 @@  discard block
 block discarded – undo
7278 7278
 		} else $offset = '+00:00';
7279 7279
 
7280 7280
 		if ($globalDBdriver == 'mysql') {
7281
-			$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 
7281
+			$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 
7282 7282
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
7283 7283
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7284 7284
 					ORDER BY airport_departure_icao_count DESC";
7285 7285
 		} else {
7286
-			$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 
7286
+			$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 
7287 7287
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
7288 7288
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7289 7289
 					ORDER BY airport_departure_icao_count DESC";
@@ -7295,7 +7295,7 @@  discard block
 block discarded – undo
7295 7295
 		$airport_array = array();
7296 7296
 		$temp_array = array();
7297 7297
         
7298
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7298
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7299 7299
 		{
7300 7300
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7301 7301
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7316,11 +7316,11 @@  discard block
 block discarded – undo
7316 7316
 	* @return Array the airport list
7317 7317
 	*
7318 7318
 	*/
7319
-	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
7319
+	public function countAllDepartureAirportCountriesByDate($date, $filters = array())
7320 7320
 	{
7321 7321
 		global $globalTimezone, $globalDBdriver;
7322
-		$filter_query = $this->getFilter($filters,true,true);
7323
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7322
+		$filter_query = $this->getFilter($filters, true, true);
7323
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7324 7324
 		if ($globalTimezone != '') {
7325 7325
 			date_default_timezone_set($globalTimezone);
7326 7326
 			$datetime = new DateTime($date);
@@ -7328,12 +7328,12 @@  discard block
 block discarded – undo
7328 7328
 		} else $offset = '+00:00';
7329 7329
 
7330 7330
 		if ($globalDBdriver == 'mysql') {
7331
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7331
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7332 7332
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
7333 7333
 					GROUP BY spotter_output.departure_airport_country
7334 7334
 					ORDER BY airport_departure_country_count DESC";
7335 7335
 		} else {
7336
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7336
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7337 7337
 					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 
7338 7338
 					GROUP BY spotter_output.departure_airport_country
7339 7339
 					ORDER BY airport_departure_country_count DESC";
@@ -7345,7 +7345,7 @@  discard block
 block discarded – undo
7345 7345
 		$airport_array = array();
7346 7346
 		$temp_array = array();
7347 7347
         
7348
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7348
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7349 7349
 		{
7350 7350
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7351 7351
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7363,11 +7363,11 @@  discard block
 block discarded – undo
7363 7363
 	* @return Array the airport list
7364 7364
 	*
7365 7365
 	*/
7366
-	public function countAllDepartureAirportsByIdent($ident,$filters = array())
7366
+	public function countAllDepartureAirportsByIdent($ident, $filters = array())
7367 7367
 	{
7368
-		$filter_query = $this->getFilter($filters,true,true);
7369
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7370
-		$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 
7368
+		$filter_query = $this->getFilter($filters, true, true);
7369
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7370
+		$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 
7371 7371
 		    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND spotter_output.ident = :ident 
7372 7372
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7373 7373
 		    ORDER BY airport_departure_icao_count DESC";
@@ -7379,7 +7379,7 @@  discard block
 block discarded – undo
7379 7379
 		$airport_array = array();
7380 7380
 		$temp_array = array();
7381 7381
         
7382
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7382
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7383 7383
 		{
7384 7384
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7385 7385
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7399,11 +7399,11 @@  discard block
 block discarded – undo
7399 7399
 	* @return Array the airport list
7400 7400
 	*
7401 7401
 	*/
7402
-	public function countAllDepartureAirportsByOwner($owner,$filters = array())
7402
+	public function countAllDepartureAirportsByOwner($owner, $filters = array())
7403 7403
 	{
7404
-		$filter_query = $this->getFilter($filters,true,true);
7405
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
7406
-		$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 
7404
+		$filter_query = $this->getFilter($filters, true, true);
7405
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
7406
+		$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 
7407 7407
 		    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND spotter_output.owner_name = :owner 
7408 7408
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7409 7409
 		    ORDER BY airport_departure_icao_count DESC";
@@ -7415,7 +7415,7 @@  discard block
 block discarded – undo
7415 7415
 		$airport_array = array();
7416 7416
 		$temp_array = array();
7417 7417
         
7418
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7418
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7419 7419
 		{
7420 7420
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7421 7421
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7435,11 +7435,11 @@  discard block
 block discarded – undo
7435 7435
 	* @return Array the airport list
7436 7436
 	*
7437 7437
 	*/
7438
-	public function countAllDepartureAirportsByPilot($pilot,$filters = array())
7438
+	public function countAllDepartureAirportsByPilot($pilot, $filters = array())
7439 7439
 	{
7440
-		$filter_query = $this->getFilter($filters,true,true);
7441
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
7442
-		$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 
7440
+		$filter_query = $this->getFilter($filters, true, true);
7441
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
7442
+		$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 
7443 7443
 		    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
7444 7444
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7445 7445
 		    ORDER BY airport_departure_icao_count DESC";
@@ -7450,7 +7450,7 @@  discard block
 block discarded – undo
7450 7450
 		$airport_array = array();
7451 7451
 		$temp_array = array();
7452 7452
         
7453
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7453
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7454 7454
 		{
7455 7455
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7456 7456
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7472,11 +7472,11 @@  discard block
 block discarded – undo
7472 7472
 	* @return Array the airport list
7473 7473
 	*
7474 7474
 	*/
7475
-	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
7475
+	public function countAllDepartureAirportCountriesByIdent($ident, $filters = array())
7476 7476
 	{
7477
-		$filter_query = $this->getFilter($filters,true,true);
7478
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7479
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7477
+		$filter_query = $this->getFilter($filters, true, true);
7478
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7479
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7480 7480
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident 
7481 7481
                     GROUP BY spotter_output.departure_airport_country
7482 7482
 					ORDER BY airport_departure_country_count DESC";
@@ -7488,7 +7488,7 @@  discard block
 block discarded – undo
7488 7488
 		$airport_array = array();
7489 7489
 		$temp_array = array();
7490 7490
         
7491
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7491
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7492 7492
 		{
7493 7493
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7494 7494
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7505,11 +7505,11 @@  discard block
 block discarded – undo
7505 7505
 	* @return Array the airport list
7506 7506
 	*
7507 7507
 	*/
7508
-	public function countAllDepartureAirportCountriesByOwner($owner,$filters = array())
7508
+	public function countAllDepartureAirportCountriesByOwner($owner, $filters = array())
7509 7509
 	{
7510
-		$filter_query = $this->getFilter($filters,true,true);
7511
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
7512
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7510
+		$filter_query = $this->getFilter($filters, true, true);
7511
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
7512
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7513 7513
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.owner_name = :owner 
7514 7514
 			GROUP BY spotter_output.departure_airport_country
7515 7515
 			ORDER BY airport_departure_country_count DESC";
@@ -7525,11 +7525,11 @@  discard block
 block discarded – undo
7525 7525
 	* @return Array the airport list
7526 7526
 	*
7527 7527
 	*/
7528
-	public function countAllDepartureAirportCountriesByPilot($pilot,$filters = array())
7528
+	public function countAllDepartureAirportCountriesByPilot($pilot, $filters = array())
7529 7529
 	{
7530
-		$filter_query = $this->getFilter($filters,true,true);
7531
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
7532
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7530
+		$filter_query = $this->getFilter($filters, true, true);
7531
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
7532
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7533 7533
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
7534 7534
 			GROUP BY spotter_output.departure_airport_country
7535 7535
 			ORDER BY airport_departure_country_count DESC";
@@ -7547,12 +7547,12 @@  discard block
 block discarded – undo
7547 7547
 	* @return Array the airport list
7548 7548
 	*
7549 7549
 	*/
7550
-	public function countAllDepartureAirportsByCountry($country,$filters = array())
7550
+	public function countAllDepartureAirportsByCountry($country, $filters = array())
7551 7551
 	{
7552
-		$filter_query = $this->getFilter($filters,true,true);
7553
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7552
+		$filter_query = $this->getFilter($filters, true, true);
7553
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7554 7554
 
7555
-		$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 
7555
+		$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 
7556 7556
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
7557 7557
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7558 7558
 			    ORDER BY airport_departure_icao_count DESC";
@@ -7564,7 +7564,7 @@  discard block
 block discarded – undo
7564 7564
 		$airport_array = array();
7565 7565
 		$temp_array = array();
7566 7566
         
7567
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7567
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7568 7568
 		{
7569 7569
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7570 7570
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7585,11 +7585,11 @@  discard block
 block discarded – undo
7585 7585
 	* @return Array the airport list
7586 7586
 	*
7587 7587
 	*/
7588
-	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
7588
+	public function countAllDepartureAirportCountriesByCountry($country, $filters = array())
7589 7589
 	{
7590
-		$filter_query = $this->getFilter($filters,true,true);
7591
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7592
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7590
+		$filter_query = $this->getFilter($filters, true, true);
7591
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7592
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7593 7593
 			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 
7594 7594
                     GROUP BY spotter_output.departure_airport_country
7595 7595
 					ORDER BY airport_departure_country_count DESC";
@@ -7601,7 +7601,7 @@  discard block
 block discarded – undo
7601 7601
 		$airport_array = array();
7602 7602
 		$temp_array = array();
7603 7603
         
7604
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7604
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7605 7605
 		{
7606 7606
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7607 7607
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7624,11 +7624,11 @@  discard block
 block discarded – undo
7624 7624
 	* @return Array the airport list
7625 7625
 	*
7626 7626
 	*/
7627
-	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7627
+	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array(), $year = '', $month = '', $day = '')
7628 7628
 	{
7629 7629
 		global $globalDBdriver;
7630
-		$filter_query = $this->getFilter($filters,true,true);
7631
-		$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, airport.latitude as arrival_airport_latitude, airport.longitude as arrival_airport_longitude 
7630
+		$filter_query = $this->getFilter($filters, true, true);
7631
+		$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, airport.latitude as arrival_airport_latitude, airport.longitude as arrival_airport_longitude 
7632 7632
 				FROM airport, spotter_output".$filter_query." airport.icao = spotter_output.arrival_airport_icao AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
7633 7633
                 if ($olderthanmonths > 0) {
7634 7634
             		if ($globalDBdriver == 'mysql') {
@@ -7648,28 +7648,28 @@  discard block
 block discarded – undo
7648 7648
 		if ($year != '') {
7649 7649
 			if ($globalDBdriver == 'mysql') {
7650 7650
 				$query .= " AND YEAR(spotter_output.date) = :year";
7651
-				$query_values = array_merge($query_values,array(':year' => $year));
7651
+				$query_values = array_merge($query_values, array(':year' => $year));
7652 7652
 			} else {
7653 7653
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
7654
-				$query_values = array_merge($query_values,array(':year' => $year));
7654
+				$query_values = array_merge($query_values, array(':year' => $year));
7655 7655
 			}
7656 7656
 		}
7657 7657
 		if ($month != '') {
7658 7658
 			if ($globalDBdriver == 'mysql') {
7659 7659
 				$query .= " AND MONTH(spotter_output.date) = :month";
7660
-				$query_values = array_merge($query_values,array(':month' => $month));
7660
+				$query_values = array_merge($query_values, array(':month' => $month));
7661 7661
 			} else {
7662 7662
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
7663
-				$query_values = array_merge($query_values,array(':month' => $month));
7663
+				$query_values = array_merge($query_values, array(':month' => $month));
7664 7664
 			}
7665 7665
 		}
7666 7666
 		if ($day != '') {
7667 7667
 			if ($globalDBdriver == 'mysql') {
7668 7668
 				$query .= " AND DAY(spotter_output.date) = :day";
7669
-				$query_values = array_merge($query_values,array(':day' => $day));
7669
+				$query_values = array_merge($query_values, array(':day' => $day));
7670 7670
 			} else {
7671 7671
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
7672
-				$query_values = array_merge($query_values,array(':day' => $day));
7672
+				$query_values = array_merge($query_values, array(':day' => $day));
7673 7673
 			}
7674 7674
 		}
7675 7675
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, airport.latitude, airport.longitude
@@ -7683,7 +7683,7 @@  discard block
 block discarded – undo
7683 7683
 		$airport_array = array();
7684 7684
 		$temp_array = array();
7685 7685
         
7686
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7686
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7687 7687
 		{
7688 7688
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7689 7689
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7708,11 +7708,11 @@  discard block
 block discarded – undo
7708 7708
 	* @return Array the airport list
7709 7709
 	*
7710 7710
 	*/
7711
-	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
7711
+	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
7712 7712
 	{
7713 7713
 		global $globalDBdriver;
7714
-		$filter_query = $this->getFilter($filters,true,true);
7715
-		$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 
7714
+		$filter_query = $this->getFilter($filters, true, true);
7715
+		$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 
7716 7716
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' ";
7717 7717
                 if ($olderthanmonths > 0) {
7718 7718
             		if ($globalDBdriver == 'mysql') {
@@ -7742,7 +7742,7 @@  discard block
 block discarded – undo
7742 7742
 		$airport_array = array();
7743 7743
 		$temp_array = array();
7744 7744
         
7745
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7745
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7746 7746
 		{
7747 7747
 			$temp_array['airline_icao'] = $row['airline_icao'];
7748 7748
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
@@ -7767,11 +7767,11 @@  discard block
 block discarded – undo
7767 7767
 	* @return Array the airport list
7768 7768
 	*
7769 7769
 	*/
7770
-	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7770
+	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array(), $year = '', $month = '', $day = '')
7771 7771
 	{
7772 7772
 		global $globalDBdriver;
7773
-		$filter_query = $this->getFilter($filters,true,true);
7774
-		$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, airport.latitude AS arrival_airport_latitude, airport.longitude AS arrival_airport_longitude 
7773
+		$filter_query = $this->getFilter($filters, true, true);
7774
+		$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, airport.latitude AS arrival_airport_latitude, airport.longitude AS arrival_airport_longitude 
7775 7775
 			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";
7776 7776
                 if ($olderthanmonths > 0) {
7777 7777
             		if ($globalDBdriver == 'mysql') {
@@ -7791,28 +7791,28 @@  discard block
 block discarded – undo
7791 7791
 		if ($year != '') {
7792 7792
 			if ($globalDBdriver == 'mysql') {
7793 7793
 				$query .= " AND YEAR(spotter_output.date) = :year";
7794
-				$query_values = array_merge($query_values,array(':year' => $year));
7794
+				$query_values = array_merge($query_values, array(':year' => $year));
7795 7795
 			} else {
7796 7796
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
7797
-				$query_values = array_merge($query_values,array(':year' => $year));
7797
+				$query_values = array_merge($query_values, array(':year' => $year));
7798 7798
 			}
7799 7799
 		}
7800 7800
 		if ($month != '') {
7801 7801
 			if ($globalDBdriver == 'mysql') {
7802 7802
 				$query .= " AND MONTH(spotter_output.date) = :month";
7803
-				$query_values = array_merge($query_values,array(':month' => $month));
7803
+				$query_values = array_merge($query_values, array(':month' => $month));
7804 7804
 			} else {
7805 7805
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
7806
-				$query_values = array_merge($query_values,array(':month' => $month));
7806
+				$query_values = array_merge($query_values, array(':month' => $month));
7807 7807
 			}
7808 7808
 		}
7809 7809
 		if ($day != '') {
7810 7810
 			if ($globalDBdriver == 'mysql') {
7811 7811
 				$query .= " AND DAY(spotter_output.date) = :day";
7812
-				$query_values = array_merge($query_values,array(':day' => $day));
7812
+				$query_values = array_merge($query_values, array(':day' => $day));
7813 7813
 			} else {
7814 7814
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
7815
-				$query_values = array_merge($query_values,array(':day' => $day));
7815
+				$query_values = array_merge($query_values, array(':day' => $day));
7816 7816
 			}
7817 7817
 		}
7818 7818
 		$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country, airport.latitude, airport.longitude
@@ -7825,7 +7825,7 @@  discard block
 block discarded – undo
7825 7825
       
7826 7826
 		$airport_array = array();
7827 7827
 		$temp_array = array();
7828
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7828
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7829 7829
 		{
7830 7830
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7831 7831
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7848,11 +7848,11 @@  discard block
 block discarded – undo
7848 7848
 	* @return Array the airport list
7849 7849
 	*
7850 7850
 	*/
7851
-	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
7851
+	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
7852 7852
 	{
7853 7853
 		global $globalDBdriver;
7854
-		$filter_query = $this->getFilter($filters,true,true);
7855
-		$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 
7854
+		$filter_query = $this->getFilter($filters, true, true);
7855
+		$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 
7856 7856
 			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 ";
7857 7857
                 if ($olderthanmonths > 0) {
7858 7858
             		if ($globalDBdriver == 'mysql') {
@@ -7882,7 +7882,7 @@  discard block
 block discarded – undo
7882 7882
 		$airport_array = array();
7883 7883
 		$temp_array = array();
7884 7884
         
7885
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7885
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7886 7886
 		{
7887 7887
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7888 7888
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7908,9 +7908,9 @@  discard block
 block discarded – undo
7908 7908
 	*/
7909 7909
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
7910 7910
 	{
7911
-		$filter_query = $this->getFilter($filters,true,true);
7912
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7913
-		$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 
7911
+		$filter_query = $this->getFilter($filters, true, true);
7912
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7913
+		$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 
7914 7914
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.airline_icao = :airline_icao 
7915 7915
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7916 7916
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7921,7 +7921,7 @@  discard block
 block discarded – undo
7921 7921
 		$airport_array = array();
7922 7922
 		$temp_array = array();
7923 7923
         
7924
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7924
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7925 7925
 		{
7926 7926
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7927 7927
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7942,12 +7942,12 @@  discard block
 block discarded – undo
7942 7942
 	* @return Array the airport list
7943 7943
 	*
7944 7944
 	*/
7945
-	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
7945
+	public function countAllArrivalAirportCountriesByAirline($airline_icao, $filters = array())
7946 7946
 	{
7947
-		$filter_query = $this->getFilter($filters,true,true);
7948
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7947
+		$filter_query = $this->getFilter($filters, true, true);
7948
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7949 7949
 					
7950
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7950
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7951 7951
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
7952 7952
                     GROUP BY spotter_output.arrival_airport_country
7953 7953
 					ORDER BY airport_arrival_country_count DESC";
@@ -7959,7 +7959,7 @@  discard block
 block discarded – undo
7959 7959
 		$airport_array = array();
7960 7960
 		$temp_array = array();
7961 7961
         
7962
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7962
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7963 7963
 		{
7964 7964
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7965 7965
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7977,11 +7977,11 @@  discard block
 block discarded – undo
7977 7977
 	* @return Array the airport list
7978 7978
 	*
7979 7979
 	*/
7980
-	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
7980
+	public function countAllArrivalAirportsByAircraft($aircraft_icao, $filters = array())
7981 7981
 	{
7982
-		$filter_query = $this->getFilter($filters,true,true);
7983
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7984
-		$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 
7982
+		$filter_query = $this->getFilter($filters, true, true);
7983
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7984
+		$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 
7985 7985
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
7986 7986
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7987 7987
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7993,7 +7993,7 @@  discard block
 block discarded – undo
7993 7993
 		$airport_array = array();
7994 7994
 		$temp_array = array();
7995 7995
         
7996
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7996
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7997 7997
 		{
7998 7998
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7999 7999
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8015,11 +8015,11 @@  discard block
 block discarded – undo
8015 8015
 	* @return Array the airport list
8016 8016
 	*
8017 8017
 	*/
8018
-	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
8018
+	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao, $filters = array())
8019 8019
 	{
8020
-		$filter_query = $this->getFilter($filters,true,true);
8021
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
8022
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8020
+		$filter_query = $this->getFilter($filters, true, true);
8021
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
8022
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8023 8023
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
8024 8024
                     GROUP BY spotter_output.arrival_airport_country
8025 8025
 					ORDER BY airport_arrival_country_count DESC";
@@ -8031,7 +8031,7 @@  discard block
 block discarded – undo
8031 8031
 		$airport_array = array();
8032 8032
 		$temp_array = array();
8033 8033
         
8034
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8034
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8035 8035
 		{
8036 8036
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8037 8037
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8049,12 +8049,12 @@  discard block
 block discarded – undo
8049 8049
 	* @return Array the airport list
8050 8050
 	*
8051 8051
 	*/
8052
-	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
8052
+	public function countAllArrivalAirportsByRegistration($registration, $filters = array())
8053 8053
 	{
8054
-		$filter_query = $this->getFilter($filters,true,true);
8055
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
8054
+		$filter_query = $this->getFilter($filters, true, true);
8055
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8056 8056
 
8057
-		$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 
8057
+		$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 
8058 8058
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.registration = :registration 
8059 8059
                     GROUP BY spotter_output.arrival_airport_icao
8060 8060
 					ORDER BY airport_arrival_icao_count DESC";
@@ -8066,7 +8066,7 @@  discard block
 block discarded – undo
8066 8066
 		$airport_array = array();
8067 8067
 		$temp_array = array();
8068 8068
         
8069
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8069
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8070 8070
 		{
8071 8071
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8072 8072
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8087,11 +8087,11 @@  discard block
 block discarded – undo
8087 8087
 	* @return Array the airport list
8088 8088
 	*
8089 8089
 	*/
8090
-	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
8090
+	public function countAllArrivalAirportCountriesByRegistration($registration, $filters = array())
8091 8091
 	{
8092
-		$filter_query = $this->getFilter($filters,true,true);
8093
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
8094
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8092
+		$filter_query = $this->getFilter($filters, true, true);
8093
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8094
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8095 8095
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration 
8096 8096
                     GROUP BY spotter_output.arrival_airport_country
8097 8097
 					ORDER BY airport_arrival_country_count DESC";
@@ -8103,7 +8103,7 @@  discard block
 block discarded – undo
8103 8103
 		$airport_array = array();
8104 8104
 		$temp_array = array();
8105 8105
         
8106
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8106
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8107 8107
 		{
8108 8108
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8109 8109
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8122,11 +8122,11 @@  discard block
 block discarded – undo
8122 8122
 	* @return Array the airport list
8123 8123
 	*
8124 8124
 	*/
8125
-	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
8125
+	public function countAllArrivalAirportsByAirport($airport_icao, $filters = array())
8126 8126
 	{
8127
-		$filter_query = $this->getFilter($filters,true,true);
8128
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8129
-		$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 
8127
+		$filter_query = $this->getFilter($filters, true, true);
8128
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8129
+		$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 
8130 8130
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.departure_airport_icao = :airport_icao 
8131 8131
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8132 8132
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -8138,7 +8138,7 @@  discard block
 block discarded – undo
8138 8138
 		$airport_array = array();
8139 8139
 		$temp_array = array();
8140 8140
         
8141
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8141
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8142 8142
 		{
8143 8143
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8144 8144
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8159,11 +8159,11 @@  discard block
 block discarded – undo
8159 8159
 	* @return Array the airport list
8160 8160
 	*
8161 8161
 	*/
8162
-	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
8162
+	public function countAllArrivalAirportCountriesByAirport($airport_icao, $filters = array())
8163 8163
 	{
8164
-		$filter_query = $this->getFilter($filters,true,true);
8165
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8166
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8164
+		$filter_query = $this->getFilter($filters, true, true);
8165
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8166
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8167 8167
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao 
8168 8168
                     GROUP BY spotter_output.arrival_airport_country
8169 8169
 					ORDER BY airport_arrival_country_count DESC";
@@ -8175,7 +8175,7 @@  discard block
 block discarded – undo
8175 8175
 		$airport_array = array();
8176 8176
 		$temp_array = array();
8177 8177
         
8178
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8178
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8179 8179
 		{
8180 8180
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8181 8181
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8193,11 +8193,11 @@  discard block
 block discarded – undo
8193 8193
 	* @return Array the airport list
8194 8194
 	*
8195 8195
 	*/
8196
-	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
8196
+	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer, $filters = array())
8197 8197
 	{
8198
-		$filter_query = $this->getFilter($filters,true,true);
8199
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
8200
-		$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 
8198
+		$filter_query = $this->getFilter($filters, true, true);
8199
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
8200
+		$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 
8201 8201
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
8202 8202
                     GROUP BY spotter_output.arrival_airport_icao
8203 8203
 					ORDER BY airport_arrival_icao_count DESC";
@@ -8209,7 +8209,7 @@  discard block
 block discarded – undo
8209 8209
 		$airport_array = array();
8210 8210
 		$temp_array = array();
8211 8211
         
8212
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8212
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8213 8213
 		{
8214 8214
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8215 8215
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8231,11 +8231,11 @@  discard block
 block discarded – undo
8231 8231
 	* @return Array the airport list
8232 8232
 	*
8233 8233
 	*/
8234
-	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
8234
+	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
8235 8235
 	{
8236
-		$filter_query = $this->getFilter($filters,true,true);
8237
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
8238
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8236
+		$filter_query = $this->getFilter($filters, true, true);
8237
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
8238
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8239 8239
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
8240 8240
                     GROUP BY spotter_output.arrival_airport_country
8241 8241
 					ORDER BY airport_arrival_country_count DESC";
@@ -8247,7 +8247,7 @@  discard block
 block discarded – undo
8247 8247
 		$airport_array = array();
8248 8248
 		$temp_array = array();
8249 8249
         
8250
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8250
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8251 8251
 		{
8252 8252
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8253 8253
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8266,11 +8266,11 @@  discard block
 block discarded – undo
8266 8266
 	* @return Array the airport list
8267 8267
 	*
8268 8268
 	*/
8269
-	public function countAllArrivalAirportsByDate($date,$filters = array())
8269
+	public function countAllArrivalAirportsByDate($date, $filters = array())
8270 8270
 	{
8271 8271
 		global $globalTimezone, $globalDBdriver;
8272
-		$filter_query = $this->getFilter($filters,true,true);
8273
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
8272
+		$filter_query = $this->getFilter($filters, true, true);
8273
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
8274 8274
 		if ($globalTimezone != '') {
8275 8275
 			date_default_timezone_set($globalTimezone);
8276 8276
 			$datetime = new DateTime($date);
@@ -8278,12 +8278,12 @@  discard block
 block discarded – undo
8278 8278
 		} else $offset = '+00:00';
8279 8279
 
8280 8280
 		if ($globalDBdriver == 'mysql') {
8281
-			$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 
8281
+			$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 
8282 8282
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
8283 8283
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8284 8284
 					ORDER BY airport_arrival_icao_count DESC";
8285 8285
 		} else {
8286
-			$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 
8286
+			$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 
8287 8287
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
8288 8288
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8289 8289
 					ORDER BY airport_arrival_icao_count DESC";
@@ -8295,7 +8295,7 @@  discard block
 block discarded – undo
8295 8295
 		$airport_array = array();
8296 8296
 		$temp_array = array();
8297 8297
         
8298
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8298
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8299 8299
 		{
8300 8300
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8301 8301
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8319,8 +8319,8 @@  discard block
 block discarded – undo
8319 8319
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
8320 8320
 	{
8321 8321
 		global $globalTimezone, $globalDBdriver;
8322
-		$filter_query = $this->getFilter($filters,true,true);
8323
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
8322
+		$filter_query = $this->getFilter($filters, true, true);
8323
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
8324 8324
 		if ($globalTimezone != '') {
8325 8325
 			date_default_timezone_set($globalTimezone);
8326 8326
 			$datetime = new DateTime($date);
@@ -8328,12 +8328,12 @@  discard block
 block discarded – undo
8328 8328
 		} else $offset = '+00:00';
8329 8329
 
8330 8330
 		if ($globalDBdriver == 'mysql') {
8331
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8331
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8332 8332
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
8333 8333
 					GROUP BY spotter_output.arrival_airport_country
8334 8334
 					ORDER BY airport_arrival_country_count DESC";
8335 8335
 		} else {
8336
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8336
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8337 8337
 					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 
8338 8338
 					GROUP BY spotter_output.arrival_airport_country
8339 8339
 					ORDER BY airport_arrival_country_count DESC";
@@ -8345,7 +8345,7 @@  discard block
 block discarded – undo
8345 8345
 		$airport_array = array();
8346 8346
 		$temp_array = array();
8347 8347
         
8348
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8348
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8349 8349
 		{
8350 8350
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8351 8351
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8363,11 +8363,11 @@  discard block
 block discarded – undo
8363 8363
 	* @return Array the airport list
8364 8364
 	*
8365 8365
 	*/
8366
-	public function countAllArrivalAirportsByIdent($ident,$filters = array())
8366
+	public function countAllArrivalAirportsByIdent($ident, $filters = array())
8367 8367
 	{
8368
-		$filter_query = $this->getFilter($filters,true,true);
8369
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
8370
-		$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 
8368
+		$filter_query = $this->getFilter($filters, true, true);
8369
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
8370
+		$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 
8371 8371
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.ident = :ident  
8372 8372
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8373 8373
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -8379,7 +8379,7 @@  discard block
 block discarded – undo
8379 8379
 		$airport_array = array();
8380 8380
 		$temp_array = array();
8381 8381
         
8382
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8382
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8383 8383
 		{
8384 8384
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8385 8385
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8399,11 +8399,11 @@  discard block
 block discarded – undo
8399 8399
 	* @return Array the airport list
8400 8400
 	*
8401 8401
 	*/
8402
-	public function countAllArrivalAirportsByOwner($owner,$filters = array())
8402
+	public function countAllArrivalAirportsByOwner($owner, $filters = array())
8403 8403
 	{
8404
-		$filter_query = $this->getFilter($filters,true,true);
8405
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
8406
-		$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 
8404
+		$filter_query = $this->getFilter($filters, true, true);
8405
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
8406
+		$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 
8407 8407
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.owner_name = :owner 
8408 8408
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8409 8409
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -8414,7 +8414,7 @@  discard block
 block discarded – undo
8414 8414
 		$airport_array = array();
8415 8415
 		$temp_array = array();
8416 8416
         
8417
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8417
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8418 8418
 		{
8419 8419
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8420 8420
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8434,11 +8434,11 @@  discard block
 block discarded – undo
8434 8434
 	* @return Array the airport list
8435 8435
 	*
8436 8436
 	*/
8437
-	public function countAllArrivalAirportsByPilot($pilot,$filters = array())
8437
+	public function countAllArrivalAirportsByPilot($pilot, $filters = array())
8438 8438
 	{
8439
-		$filter_query = $this->getFilter($filters,true,true);
8440
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
8441
-		$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 
8439
+		$filter_query = $this->getFilter($filters, true, true);
8440
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
8441
+		$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 
8442 8442
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
8443 8443
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8444 8444
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -8449,7 +8449,7 @@  discard block
 block discarded – undo
8449 8449
 		$airport_array = array();
8450 8450
 		$temp_array = array();
8451 8451
         
8452
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8452
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8453 8453
 		{
8454 8454
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8455 8455
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8471,9 +8471,9 @@  discard block
 block discarded – undo
8471 8471
 	*/
8472 8472
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
8473 8473
 	{
8474
-		$filter_query = $this->getFilter($filters,true,true);
8475
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
8476
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8474
+		$filter_query = $this->getFilter($filters, true, true);
8475
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
8476
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8477 8477
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident 
8478 8478
                     GROUP BY spotter_output.arrival_airport_country
8479 8479
 					ORDER BY airport_arrival_country_count DESC";
@@ -8485,7 +8485,7 @@  discard block
 block discarded – undo
8485 8485
 		$airport_array = array();
8486 8486
 		$temp_array = array();
8487 8487
         
8488
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8488
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8489 8489
 		{
8490 8490
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8491 8491
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8504,9 +8504,9 @@  discard block
 block discarded – undo
8504 8504
 	*/
8505 8505
 	public function countAllArrivalAirportCountriesByOwner($owner, $filters = array())
8506 8506
 	{
8507
-		$filter_query = $this->getFilter($filters,true,true);
8508
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
8509
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8507
+		$filter_query = $this->getFilter($filters, true, true);
8508
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
8509
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8510 8510
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.owner_name = :owner 
8511 8511
                     GROUP BY spotter_output.arrival_airport_country
8512 8512
 		    ORDER BY airport_arrival_country_count DESC";
@@ -8524,9 +8524,9 @@  discard block
 block discarded – undo
8524 8524
 	*/
8525 8525
 	public function countAllArrivalAirportCountriesByPilot($pilot, $filters = array())
8526 8526
 	{
8527
-		$filter_query = $this->getFilter($filters,true,true);
8528
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
8529
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8527
+		$filter_query = $this->getFilter($filters, true, true);
8528
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
8529
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8530 8530
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
8531 8531
                     GROUP BY spotter_output.arrival_airport_country
8532 8532
 		    ORDER BY airport_arrival_country_count DESC";
@@ -8544,11 +8544,11 @@  discard block
 block discarded – undo
8544 8544
 	* @return Array the airport list
8545 8545
 	*
8546 8546
 	*/
8547
-	public function countAllArrivalAirportsByCountry($country,$filters = array())
8547
+	public function countAllArrivalAirportsByCountry($country, $filters = array())
8548 8548
 	{
8549
-		$filter_query = $this->getFilter($filters,true,true);
8550
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
8551
-		$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 
8549
+		$filter_query = $this->getFilter($filters, true, true);
8550
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
8551
+		$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 
8552 8552
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
8553 8553
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8554 8554
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -8560,7 +8560,7 @@  discard block
 block discarded – undo
8560 8560
 		$airport_array = array();
8561 8561
 		$temp_array = array();
8562 8562
         
8563
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8563
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8564 8564
 		{
8565 8565
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8566 8566
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8581,12 +8581,12 @@  discard block
 block discarded – undo
8581 8581
 	* @return Array the airport list
8582 8582
 	*
8583 8583
 	*/
8584
-	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
8584
+	public function countAllArrivalAirportCountriesByCountry($country, $filters = array())
8585 8585
 	{
8586 8586
 		global $globalDBdriver;
8587
-		$filter_query = $this->getFilter($filters,true,true);
8588
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
8589
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8587
+		$filter_query = $this->getFilter($filters, true, true);
8588
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
8589
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8590 8590
 			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 
8591 8591
                     GROUP BY spotter_output.arrival_airport_country
8592 8592
 					ORDER BY airport_arrival_country_count DESC";
@@ -8598,7 +8598,7 @@  discard block
 block discarded – undo
8598 8598
 		$airport_array = array();
8599 8599
 		$temp_array = array();
8600 8600
         
8601
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8601
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8602 8602
 		{
8603 8603
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8604 8604
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8617,38 +8617,38 @@  discard block
 block discarded – undo
8617 8617
 	* @return Array the airport departure list
8618 8618
 	*
8619 8619
 	*/
8620
-	public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '')
8620
+	public function countAllDepartureCountries($filters = array(), $year = '', $month = '', $day = '')
8621 8621
 	{
8622 8622
 		global $globalDBdriver;
8623
-		$filter_query = $this->getFilter($filters,true,true);
8624
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count, countries.iso3 AS airport_departure_country_iso3 
8623
+		$filter_query = $this->getFilter($filters, true, true);
8624
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count, countries.iso3 AS airport_departure_country_iso3 
8625 8625
 				FROM countries,spotter_output".$filter_query." countries.name = spotter_output.departure_airport_country AND spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
8626 8626
 		$query_values = array();
8627 8627
 		if ($year != '') {
8628 8628
 			if ($globalDBdriver == 'mysql') {
8629 8629
 				$query .= " AND YEAR(spotter_output.date) = :year";
8630
-				$query_values = array_merge($query_values,array(':year' => $year));
8630
+				$query_values = array_merge($query_values, array(':year' => $year));
8631 8631
 			} else {
8632 8632
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
8633
-				$query_values = array_merge($query_values,array(':year' => $year));
8633
+				$query_values = array_merge($query_values, array(':year' => $year));
8634 8634
 			}
8635 8635
 		}
8636 8636
 		if ($month != '') {
8637 8637
 			if ($globalDBdriver == 'mysql') {
8638 8638
 				$query .= " AND MONTH(spotter_output.date) = :month";
8639
-				$query_values = array_merge($query_values,array(':month' => $month));
8639
+				$query_values = array_merge($query_values, array(':month' => $month));
8640 8640
 			} else {
8641 8641
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
8642
-				$query_values = array_merge($query_values,array(':month' => $month));
8642
+				$query_values = array_merge($query_values, array(':month' => $month));
8643 8643
 			}
8644 8644
 		}
8645 8645
 		if ($day != '') {
8646 8646
 			if ($globalDBdriver == 'mysql') {
8647 8647
 				$query .= " AND DAY(spotter_output.date) = :day";
8648
-				$query_values = array_merge($query_values,array(':day' => $day));
8648
+				$query_values = array_merge($query_values, array(':day' => $day));
8649 8649
 			} else {
8650 8650
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
8651
-				$query_values = array_merge($query_values,array(':day' => $day));
8651
+				$query_values = array_merge($query_values, array(':day' => $day));
8652 8652
 			}
8653 8653
 		}
8654 8654
 		$query .= " GROUP BY spotter_output.departure_airport_country, countries.iso3
@@ -8662,7 +8662,7 @@  discard block
 block discarded – undo
8662 8662
 		$airport_array = array();
8663 8663
 		$temp_array = array();
8664 8664
         
8665
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8665
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8666 8666
 		{
8667 8667
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
8668 8668
 			$temp_array['airport_departure_country'] = $row['departure_airport_country'];
@@ -8680,38 +8680,38 @@  discard block
 block discarded – undo
8680 8680
 	* @return Array the airport arrival list
8681 8681
 	*
8682 8682
 	*/
8683
-	public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '')
8683
+	public function countAllArrivalCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
8684 8684
 	{
8685 8685
 		global $globalDBdriver;
8686
-		$filter_query = $this->getFilter($filters,true,true);
8687
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 
8686
+		$filter_query = $this->getFilter($filters, true, true);
8687
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 
8688 8688
 			FROM countries, spotter_output".$filter_query." countries.name = spotter_output.arrival_airport_country AND spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
8689 8689
 		$query_values = array();
8690 8690
 		if ($year != '') {
8691 8691
 			if ($globalDBdriver == 'mysql') {
8692 8692
 				$query .= " AND YEAR(spotter_output.date) = :year";
8693
-				$query_values = array_merge($query_values,array(':year' => $year));
8693
+				$query_values = array_merge($query_values, array(':year' => $year));
8694 8694
 			} else {
8695 8695
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
8696
-				$query_values = array_merge($query_values,array(':year' => $year));
8696
+				$query_values = array_merge($query_values, array(':year' => $year));
8697 8697
 			}
8698 8698
 		}
8699 8699
 		if ($month != '') {
8700 8700
 			if ($globalDBdriver == 'mysql') {
8701 8701
 				$query .= " AND MONTH(spotter_output.date) = :month";
8702
-				$query_values = array_merge($query_values,array(':month' => $month));
8702
+				$query_values = array_merge($query_values, array(':month' => $month));
8703 8703
 			} else {
8704 8704
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
8705
-				$query_values = array_merge($query_values,array(':month' => $month));
8705
+				$query_values = array_merge($query_values, array(':month' => $month));
8706 8706
 			}
8707 8707
 		}
8708 8708
 		if ($day != '') {
8709 8709
 			if ($globalDBdriver == 'mysql') {
8710 8710
 				$query .= " AND DAY(spotter_output.date) = :day";
8711
-				$query_values = array_merge($query_values,array(':day' => $day));
8711
+				$query_values = array_merge($query_values, array(':day' => $day));
8712 8712
 			} else {
8713 8713
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
8714
-				$query_values = array_merge($query_values,array(':day' => $day));
8714
+				$query_values = array_merge($query_values, array(':day' => $day));
8715 8715
 			}
8716 8716
 		}
8717 8717
 		$query .= " GROUP BY spotter_output.arrival_airport_country, countries.iso3
@@ -8725,7 +8725,7 @@  discard block
 block discarded – undo
8725 8725
 		$airport_array = array();
8726 8726
 		$temp_array = array();
8727 8727
         
8728
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8728
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8729 8729
 		{
8730 8730
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
8731 8731
 			$temp_array['airport_arrival_country'] = $row['arrival_airport_country'];
@@ -8749,8 +8749,8 @@  discard block
 block discarded – undo
8749 8749
 	*/
8750 8750
 	public function countAllRoutes($filters = array())
8751 8751
 	{
8752
-		$filter_query = $this->getFilter($filters,true,true);
8753
-		$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
8752
+		$filter_query = $this->getFilter($filters, true, true);
8753
+		$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
8754 8754
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''
8755 8755
                     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
8756 8756
                     ORDER BY route_count DESC
@@ -8763,7 +8763,7 @@  discard block
 block discarded – undo
8763 8763
 		$routes_array = array();
8764 8764
 		$temp_array = array();
8765 8765
         
8766
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8766
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8767 8767
 		{
8768 8768
 			$temp_array['route_count'] = $row['route_count'];
8769 8769
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8790,11 +8790,11 @@  discard block
 block discarded – undo
8790 8790
 	* @return Array the route list
8791 8791
 	*
8792 8792
 	*/
8793
-	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
8793
+	public function countAllRoutesByAircraft($aircraft_icao, $filters = array())
8794 8794
 	{
8795
-		$filter_query = $this->getFilter($filters,true,true);
8796
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
8797
-		$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
8795
+		$filter_query = $this->getFilter($filters, true, true);
8796
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
8797
+		$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
8798 8798
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
8799 8799
 			    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 
8800 8800
 			    ORDER BY route_count DESC";
@@ -8805,7 +8805,7 @@  discard block
 block discarded – undo
8805 8805
 		$routes_array = array();
8806 8806
 		$temp_array = array();
8807 8807
         
8808
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8808
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8809 8809
 		{
8810 8810
 			$temp_array['route_count'] = $row['route_count'];
8811 8811
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8832,9 +8832,9 @@  discard block
 block discarded – undo
8832 8832
 	*/
8833 8833
 	public function countAllRoutesByRegistration($registration, $filters = array())
8834 8834
 	{
8835
-		$filter_query = $this->getFilter($filters,true,true);
8835
+		$filter_query = $this->getFilter($filters, true, true);
8836 8836
 		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8837
-		$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
8837
+		$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
8838 8838
 			FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.registration = :registration 
8839 8839
                     GROUP BY route
8840 8840
                     ORDER BY route_count DESC";
@@ -8846,7 +8846,7 @@  discard block
 block discarded – undo
8846 8846
 		$routes_array = array();
8847 8847
 		$temp_array = array();
8848 8848
         
8849
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8849
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8850 8850
 		{
8851 8851
 			$temp_array['route_count'] = $row['route_count'];
8852 8852
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8874,9 +8874,9 @@  discard block
 block discarded – undo
8874 8874
 	*/
8875 8875
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
8876 8876
 	{
8877
-		$filter_query = $this->getFilter($filters,true,true);
8878
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8879
-		$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
8877
+		$filter_query = $this->getFilter($filters, true, true);
8878
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
8879
+		$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
8880 8880
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao 
8881 8881
 			    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 
8882 8882
 			    ORDER BY route_count DESC";
@@ -8888,7 +8888,7 @@  discard block
 block discarded – undo
8888 8888
 		$routes_array = array();
8889 8889
 		$temp_array = array();
8890 8890
         
8891
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8891
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8892 8892
 		{
8893 8893
 			$temp_array['route_count'] = $row['route_count'];
8894 8894
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8916,9 +8916,9 @@  discard block
 block discarded – undo
8916 8916
 	*/
8917 8917
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
8918 8918
 	{
8919
-		$filter_query = $this->getFilter($filters,true,true);
8920
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8921
-		$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
8919
+		$filter_query = $this->getFilter($filters, true, true);
8920
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8921
+		$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
8922 8922
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
8923 8923
 			    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 
8924 8924
 			    ORDER BY route_count DESC";
@@ -8929,7 +8929,7 @@  discard block
 block discarded – undo
8929 8929
 		$routes_array = array();
8930 8930
 		$temp_array = array();
8931 8931
         
8932
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8932
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8933 8933
 		{
8934 8934
 			$temp_array['route_count'] = $row['route_count'];
8935 8935
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8957,9 +8957,9 @@  discard block
 block discarded – undo
8957 8957
 	*/
8958 8958
 	public function countAllRoutesByCountry($country, $filters = array())
8959 8959
 	{
8960
-		$filter_query = $this->getFilter($filters,true,true);
8961
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
8962
-		$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
8960
+		$filter_query = $this->getFilter($filters, true, true);
8961
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
8962
+		$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
8963 8963
 			    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 
8964 8964
 			    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 
8965 8965
 			    ORDER BY route_count DESC";
@@ -8970,7 +8970,7 @@  discard block
 block discarded – undo
8970 8970
 		$routes_array = array();
8971 8971
 		$temp_array = array();
8972 8972
         
8973
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8973
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8974 8974
 		{
8975 8975
 			$temp_array['route_count'] = $row['route_count'];
8976 8976
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8998,8 +8998,8 @@  discard block
 block discarded – undo
8998 8998
 	public function countAllRoutesByDate($date, $filters = array())
8999 8999
 	{
9000 9000
 		global $globalTimezone, $globalDBdriver;
9001
-		$filter_query = $this->getFilter($filters,true,true);
9002
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
9001
+		$filter_query = $this->getFilter($filters, true, true);
9002
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
9003 9003
 		if ($globalTimezone != '') {
9004 9004
 			date_default_timezone_set($globalTimezone);
9005 9005
 			$datetime = new DateTime($date);
@@ -9007,12 +9007,12 @@  discard block
 block discarded – undo
9007 9007
 		} else $offset = '+00:00';
9008 9008
 		
9009 9009
 		if ($globalDBdriver == 'mysql') {
9010
-			$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
9010
+			$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
9011 9011
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
9012 9012
 				    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
9013 9013
 				    ORDER BY route_count DESC";
9014 9014
 		} else {
9015
-			$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
9015
+			$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
9016 9016
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
9017 9017
 				    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
9018 9018
 				    ORDER BY route_count DESC";
@@ -9024,7 +9024,7 @@  discard block
 block discarded – undo
9024 9024
 		$routes_array = array();
9025 9025
 		$temp_array = array();
9026 9026
         
9027
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9027
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9028 9028
 		{
9029 9029
 			$temp_array['route_count'] = $row['route_count'];
9030 9030
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -9051,9 +9051,9 @@  discard block
 block discarded – undo
9051 9051
 	*/
9052 9052
 	public function countAllRoutesByIdent($ident, $filters = array())
9053 9053
 	{
9054
-		$filter_query = $this->getFilter($filters,true,true);
9055
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
9056
-		$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
9054
+		$filter_query = $this->getFilter($filters, true, true);
9055
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
9056
+		$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
9057 9057
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.ident = :ident   
9058 9058
                     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
9059 9059
                     ORDER BY route_count DESC";
@@ -9065,7 +9065,7 @@  discard block
 block discarded – undo
9065 9065
 		$routes_array = array();
9066 9066
 		$temp_array = array();
9067 9067
         
9068
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9068
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9069 9069
 		{
9070 9070
 			$temp_array['route_count'] = $row['route_count'];
9071 9071
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -9089,11 +9089,11 @@  discard block
 block discarded – undo
9089 9089
 	* @return Array the route list
9090 9090
 	*
9091 9091
 	*/
9092
-	public function countAllRoutesByOwner($owner,$filters = array())
9092
+	public function countAllRoutesByOwner($owner, $filters = array())
9093 9093
 	{
9094
-		$filter_query = $this->getFilter($filters,true,true);
9095
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
9096
-		$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
9094
+		$filter_query = $this->getFilter($filters, true, true);
9095
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
9096
+		$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
9097 9097
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.owner_name = :owner 
9098 9098
                     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
9099 9099
                     ORDER BY route_count DESC";
@@ -9105,7 +9105,7 @@  discard block
 block discarded – undo
9105 9105
 		$routes_array = array();
9106 9106
 		$temp_array = array();
9107 9107
         
9108
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9108
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9109 9109
 		{
9110 9110
 			$temp_array['route_count'] = $row['route_count'];
9111 9111
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -9129,11 +9129,11 @@  discard block
 block discarded – undo
9129 9129
 	* @return Array the route list
9130 9130
 	*
9131 9131
 	*/
9132
-	public function countAllRoutesByPilot($pilot,$filters = array())
9132
+	public function countAllRoutesByPilot($pilot, $filters = array())
9133 9133
 	{
9134
-		$filter_query = $this->getFilter($filters,true,true);
9135
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
9136
-		$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
9134
+		$filter_query = $this->getFilter($filters, true, true);
9135
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
9136
+		$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
9137 9137
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
9138 9138
                     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
9139 9139
                     ORDER BY route_count DESC";
@@ -9145,7 +9145,7 @@  discard block
 block discarded – undo
9145 9145
 		$routes_array = array();
9146 9146
 		$temp_array = array();
9147 9147
         
9148
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9148
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9149 9149
 		{
9150 9150
 			$temp_array['route_count'] = $row['route_count'];
9151 9151
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -9172,9 +9172,9 @@  discard block
 block discarded – undo
9172 9172
 	*/
9173 9173
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
9174 9174
 	{
9175
-		$filter_query = $this->getFilter($filters,true,true);
9176
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
9177
-		$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
9175
+		$filter_query = $this->getFilter($filters, true, true);
9176
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
9177
+		$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
9178 9178
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
9179 9179
                     GROUP BY route
9180 9180
                     ORDER BY route_count DESC";
@@ -9186,7 +9186,7 @@  discard block
 block discarded – undo
9186 9186
 		$routes_array = array();
9187 9187
 		$temp_array = array();
9188 9188
         
9189
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9189
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9190 9190
 		{
9191 9191
 			$temp_array['route_count'] = $row['route_count'];
9192 9192
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -9214,8 +9214,8 @@  discard block
 block discarded – undo
9214 9214
 	*/
9215 9215
 	public function countAllRoutesWithWaypoints($filters = array())
9216 9216
 	{
9217
-		$filter_query = $this->getFilter($filters,true,true);
9218
-		$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
9217
+		$filter_query = $this->getFilter($filters, true, true);
9218
+		$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
9219 9219
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.waypoints <> '' 
9220 9220
                     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
9221 9221
                     ORDER BY route_count DESC
@@ -9228,7 +9228,7 @@  discard block
 block discarded – undo
9228 9228
 		$routes_array = array();
9229 9229
 		$temp_array = array();
9230 9230
         
9231
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9231
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9232 9232
 		{
9233 9233
 			$temp_array['spotter_id'] = $row['spotter_id'];
9234 9234
 			$temp_array['route_count'] = $row['route_count'];
@@ -9253,11 +9253,11 @@  discard block
 block discarded – undo
9253 9253
 	* @return Array the callsign list
9254 9254
 	*
9255 9255
 	*/
9256
-	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
9256
+	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
9257 9257
 	{
9258 9258
 		global $globalDBdriver;
9259
-		$filter_query = $this->getFilter($filters,true,true);
9260
-		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
9259
+		$filter_query = $this->getFilter($filters, true, true);
9260
+		$query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
9261 9261
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
9262 9262
 		 if ($olderthanmonths > 0) {
9263 9263
 			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
@@ -9271,28 +9271,28 @@  discard block
 block discarded – undo
9271 9271
 		if ($year != '') {
9272 9272
 			if ($globalDBdriver == 'mysql') {
9273 9273
 				$query .= " AND YEAR(spotter_output.date) = :year";
9274
-				$query_values = array_merge($query_values,array(':year' => $year));
9274
+				$query_values = array_merge($query_values, array(':year' => $year));
9275 9275
 			} else {
9276 9276
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
9277
-				$query_values = array_merge($query_values,array(':year' => $year));
9277
+				$query_values = array_merge($query_values, array(':year' => $year));
9278 9278
 			}
9279 9279
 		}
9280 9280
 		if ($month != '') {
9281 9281
 			if ($globalDBdriver == 'mysql') {
9282 9282
 				$query .= " AND MONTH(spotter_output.date) = :month";
9283
-				$query_values = array_merge($query_values,array(':month' => $month));
9283
+				$query_values = array_merge($query_values, array(':month' => $month));
9284 9284
 			} else {
9285 9285
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
9286
-				$query_values = array_merge($query_values,array(':month' => $month));
9286
+				$query_values = array_merge($query_values, array(':month' => $month));
9287 9287
 			}
9288 9288
 		}
9289 9289
 		if ($day != '') {
9290 9290
 			if ($globalDBdriver == 'mysql') {
9291 9291
 				$query .= " AND DAY(spotter_output.date) = :day";
9292
-				$query_values = array_merge($query_values,array(':day' => $day));
9292
+				$query_values = array_merge($query_values, array(':day' => $day));
9293 9293
 			} else {
9294 9294
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
9295
-				$query_values = array_merge($query_values,array(':day' => $day));
9295
+				$query_values = array_merge($query_values, array(':day' => $day));
9296 9296
 			}
9297 9297
 		}
9298 9298
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
@@ -9304,7 +9304,7 @@  discard block
 block discarded – undo
9304 9304
 		$callsign_array = array();
9305 9305
 		$temp_array = array();
9306 9306
         
9307
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9307
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9308 9308
 		{
9309 9309
 			$temp_array['callsign_icao'] = $row['ident'];
9310 9310
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -9326,8 +9326,8 @@  discard block
 block discarded – undo
9326 9326
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
9327 9327
 	{
9328 9328
 		global $globalDBdriver;
9329
-		$filter_query = $this->getFilter($filters,true,true);
9330
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
9329
+		$filter_query = $this->getFilter($filters, true, true);
9330
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
9331 9331
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
9332 9332
 		 if ($olderthanmonths > 0) {
9333 9333
 			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
@@ -9346,7 +9346,7 @@  discard block
 block discarded – undo
9346 9346
 		$callsign_array = array();
9347 9347
 		$temp_array = array();
9348 9348
         
9349
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9349
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9350 9350
 		{
9351 9351
 			$temp_array['callsign_icao'] = $row['ident'];
9352 9352
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -9400,7 +9400,7 @@  discard block
 block discarded – undo
9400 9400
 		$date_array = array();
9401 9401
 		$temp_array = array();
9402 9402
         
9403
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9403
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9404 9404
 		{
9405 9405
 			$temp_array['date_name'] = $row['date_name'];
9406 9406
 			$temp_array['date_count'] = $row['date_count'];
@@ -9425,15 +9425,15 @@  discard block
 block discarded – undo
9425 9425
 			$datetime = new DateTime();
9426 9426
 			$offset = $datetime->format('P');
9427 9427
 		} else $offset = '+00:00';
9428
-		$filter_query = $this->getFilter($filters,true,true);
9428
+		$filter_query = $this->getFilter($filters, true, true);
9429 9429
 		if ($globalDBdriver == 'mysql') {
9430
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9430
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9431 9431
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
9432 9432
 								GROUP BY spotter_output.airline_icao, date_name 
9433 9433
 								ORDER BY date_count DESC
9434 9434
 								LIMIT 10 OFFSET 0";
9435 9435
 		} else {
9436
-			$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
9436
+			$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
9437 9437
 								FROM spotter_output 
9438 9438
 								WHERE spotter_output.airline_icao <> '' 
9439 9439
 								GROUP BY spotter_output.airline_icao, date_name 
@@ -9448,7 +9448,7 @@  discard block
 block discarded – undo
9448 9448
 		$date_array = array();
9449 9449
 		$temp_array = array();
9450 9450
         
9451
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9451
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9452 9452
 		{
9453 9453
 			$temp_array['date_name'] = $row['date_name'];
9454 9454
 			$temp_array['date_count'] = $row['date_count'];
@@ -9474,7 +9474,7 @@  discard block
 block discarded – undo
9474 9474
 			$datetime = new DateTime();
9475 9475
 			$offset = $datetime->format('P');
9476 9476
 		} else $offset = '+00:00';
9477
-		$filter_query = $this->getFilter($filters,true,true);
9477
+		$filter_query = $this->getFilter($filters, true, true);
9478 9478
 		if ($globalDBdriver == 'mysql') {
9479 9479
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9480 9480
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -9495,7 +9495,7 @@  discard block
 block discarded – undo
9495 9495
 		$date_array = array();
9496 9496
 		$temp_array = array();
9497 9497
         
9498
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9498
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9499 9499
 		{
9500 9500
 			$temp_array['date_name'] = $row['date_name'];
9501 9501
 			$temp_array['date_count'] = $row['date_count'];
@@ -9520,7 +9520,7 @@  discard block
 block discarded – undo
9520 9520
 			$datetime = new DateTime();
9521 9521
 			$offset = $datetime->format('P');
9522 9522
 		} else $offset = '+00:00';
9523
-		$filter_query = $this->getFilter($filters,true,true);
9523
+		$filter_query = $this->getFilter($filters, true, true);
9524 9524
 		if ($globalDBdriver == 'mysql') {
9525 9525
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9526 9526
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)";
@@ -9541,7 +9541,7 @@  discard block
 block discarded – undo
9541 9541
 		$date_array = array();
9542 9542
 		$temp_array = array();
9543 9543
         
9544
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9544
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9545 9545
 		{
9546 9546
 			$temp_array['date_name'] = $row['date_name'];
9547 9547
 			$temp_array['date_count'] = $row['date_count'];
@@ -9562,7 +9562,7 @@  discard block
 block discarded – undo
9562 9562
 	public function countAllDatesLastMonthByAirlines($filters = array())
9563 9563
 	{
9564 9564
 		global $globalTimezone, $globalDBdriver;
9565
-		$filter_query = $this->getFilter($filters,true,true);
9565
+		$filter_query = $this->getFilter($filters, true, true);
9566 9566
 		if ($globalTimezone != '') {
9567 9567
 			date_default_timezone_set($globalTimezone);
9568 9568
 			$datetime = new DateTime();
@@ -9570,13 +9570,13 @@  discard block
 block discarded – undo
9570 9570
 		} else $offset = '+00:00';
9571 9571
 		
9572 9572
 		if ($globalDBdriver == 'mysql') {
9573
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9573
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9574 9574
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)
9575 9575
 								GROUP BY spotter_output.airline_icao, date_name 
9576 9576
 								ORDER BY spotter_output.date ASC";
9577 9577
 			$query_data = array(':offset' => $offset);
9578 9578
 		} else {
9579
-			$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
9579
+			$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
9580 9580
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS'
9581 9581
 								GROUP BY spotter_output.airline_icao, date_name 
9582 9582
 								ORDER BY date_name ASC";
@@ -9589,7 +9589,7 @@  discard block
 block discarded – undo
9589 9589
 		$date_array = array();
9590 9590
 		$temp_array = array();
9591 9591
         
9592
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9592
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9593 9593
 		{
9594 9594
 			$temp_array['date_name'] = $row['date_name'];
9595 9595
 			$temp_array['date_count'] = $row['date_count'];
@@ -9636,7 +9636,7 @@  discard block
 block discarded – undo
9636 9636
 		$date_array = array();
9637 9637
 		$temp_array = array();
9638 9638
         
9639
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9639
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9640 9640
 		{
9641 9641
 			$temp_array['month_name'] = $row['month_name'];
9642 9642
 			$temp_array['year_name'] = $row['year_name'];
@@ -9657,7 +9657,7 @@  discard block
 block discarded – undo
9657 9657
 	public function countAllMonthsByAirlines($filters = array())
9658 9658
 	{
9659 9659
 		global $globalTimezone, $globalDBdriver;
9660
-		$filter_query = $this->getFilter($filters,true,true);
9660
+		$filter_query = $this->getFilter($filters, true, true);
9661 9661
 		if ($globalTimezone != '') {
9662 9662
 			date_default_timezone_set($globalTimezone);
9663 9663
 			$datetime = new DateTime();
@@ -9665,12 +9665,12 @@  discard block
 block discarded – undo
9665 9665
 		} else $offset = '+00:00';
9666 9666
 
9667 9667
 		if ($globalDBdriver == 'mysql') {
9668
-			$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
9668
+			$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
9669 9669
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
9670 9670
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
9671 9671
 								ORDER BY date_count DESC";
9672 9672
 		} else {
9673
-			$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
9673
+			$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
9674 9674
 								FROM spotter_output 
9675 9675
 								WHERE spotter_output.airline_icao <> '' 
9676 9676
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
@@ -9684,7 +9684,7 @@  discard block
 block discarded – undo
9684 9684
 		$date_array = array();
9685 9685
 		$temp_array = array();
9686 9686
         
9687
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9687
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9688 9688
 		{
9689 9689
 			$temp_array['month_name'] = $row['month_name'];
9690 9690
 			$temp_array['year_name'] = $row['year_name'];
@@ -9711,14 +9711,14 @@  discard block
 block discarded – undo
9711 9711
 			$datetime = new DateTime();
9712 9712
 			$offset = $datetime->format('P');
9713 9713
 		} else $offset = '+00:00';
9714
-		$filter_query = $this->getFilter($filters,true,true);
9714
+		$filter_query = $this->getFilter($filters, true, true);
9715 9715
 		if ($globalDBdriver == 'mysql') {
9716
-			$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
9716
+			$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
9717 9717
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
9718 9718
 								GROUP BY year_name, month_name 
9719 9719
 								ORDER BY date_count DESC";
9720 9720
 		} else {
9721
-			$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
9721
+			$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
9722 9722
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
9723 9723
 								GROUP BY year_name, month_name 
9724 9724
 								ORDER BY date_count DESC";
@@ -9730,7 +9730,7 @@  discard block
 block discarded – undo
9730 9730
 		$date_array = array();
9731 9731
 		$temp_array = array();
9732 9732
         
9733
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9733
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9734 9734
 		{
9735 9735
 			$temp_array['month_name'] = $row['month_name'];
9736 9736
 			$temp_array['year_name'] = $row['year_name'];
@@ -9756,15 +9756,15 @@  discard block
 block discarded – undo
9756 9756
 			$datetime = new DateTime();
9757 9757
 			$offset = $datetime->format('P');
9758 9758
 		} else $offset = '+00:00';
9759
-		$filter_query = $this->getFilter($filters,true,true);
9759
+		$filter_query = $this->getFilter($filters, true, true);
9760 9760
 
9761 9761
 		if ($globalDBdriver == 'mysql') {
9762
-			$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
9762
+			$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
9763 9763
 								FROM spotter_output".$filter_query." owner_name <> ''
9764 9764
 								GROUP BY year_name, month_name
9765 9765
 								ORDER BY date_count DESC";
9766 9766
 		} else {
9767
-			$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
9767
+			$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
9768 9768
 								FROM spotter_output".$filter_query." owner_name <> ''
9769 9769
 								GROUP BY year_name, month_name
9770 9770
 								ORDER BY date_count DESC";
@@ -9776,7 +9776,7 @@  discard block
 block discarded – undo
9776 9776
 		$date_array = array();
9777 9777
 		$temp_array = array();
9778 9778
         
9779
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9779
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9780 9780
 		{
9781 9781
 			$temp_array['month_name'] = $row['month_name'];
9782 9782
 			$temp_array['year_name'] = $row['year_name'];
@@ -9797,7 +9797,7 @@  discard block
 block discarded – undo
9797 9797
 	public function countAllMonthsOwnersByAirlines($filters = array())
9798 9798
 	{
9799 9799
 		global $globalTimezone, $globalDBdriver;
9800
-		$filter_query = $this->getFilter($filters,true,true);
9800
+		$filter_query = $this->getFilter($filters, true, true);
9801 9801
 		if ($globalTimezone != '') {
9802 9802
 			date_default_timezone_set($globalTimezone);
9803 9803
 			$datetime = new DateTime();
@@ -9805,12 +9805,12 @@  discard block
 block discarded – undo
9805 9805
 		} else $offset = '+00:00';
9806 9806
 
9807 9807
 		if ($globalDBdriver == 'mysql') {
9808
-			$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
9808
+			$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
9809 9809
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
9810 9810
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9811 9811
 								ORDER BY date_count DESC";
9812 9812
 		} else {
9813
-			$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
9813
+			$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
9814 9814
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
9815 9815
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9816 9816
 								ORDER BY date_count DESC";
@@ -9822,7 +9822,7 @@  discard block
 block discarded – undo
9822 9822
 		$date_array = array();
9823 9823
 		$temp_array = array();
9824 9824
         
9825
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9825
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9826 9826
 		{
9827 9827
 			$temp_array['month_name'] = $row['month_name'];
9828 9828
 			$temp_array['year_name'] = $row['year_name'];
@@ -9849,15 +9849,15 @@  discard block
 block discarded – undo
9849 9849
 			$datetime = new DateTime();
9850 9850
 			$offset = $datetime->format('P');
9851 9851
 		} else $offset = '+00:00';
9852
-		$filter_query = $this->getFilter($filters,true,true);
9852
+		$filter_query = $this->getFilter($filters, true, true);
9853 9853
 
9854 9854
 		if ($globalDBdriver == 'mysql') {
9855
-			$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
9855
+			$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
9856 9856
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
9857 9857
 								GROUP BY year_name, month_name
9858 9858
 								ORDER BY date_count DESC";
9859 9859
 		} else {
9860
-			$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
9860
+			$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
9861 9861
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
9862 9862
 								GROUP BY year_name, month_name
9863 9863
 								ORDER BY date_count DESC";
@@ -9869,7 +9869,7 @@  discard block
 block discarded – undo
9869 9869
 		$date_array = array();
9870 9870
 		$temp_array = array();
9871 9871
         
9872
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9872
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9873 9873
 		{
9874 9874
 			$temp_array['month_name'] = $row['month_name'];
9875 9875
 			$temp_array['year_name'] = $row['year_name'];
@@ -9890,7 +9890,7 @@  discard block
 block discarded – undo
9890 9890
 	public function countAllMonthsPilotsByAirlines($filters = array())
9891 9891
 	{
9892 9892
 		global $globalTimezone, $globalDBdriver;
9893
-		$filter_query = $this->getFilter($filters,true,true);
9893
+		$filter_query = $this->getFilter($filters, true, true);
9894 9894
 		if ($globalTimezone != '') {
9895 9895
 			date_default_timezone_set($globalTimezone);
9896 9896
 			$datetime = new DateTime();
@@ -9898,12 +9898,12 @@  discard block
 block discarded – undo
9898 9898
 		} else $offset = '+00:00';
9899 9899
 
9900 9900
 		if ($globalDBdriver == 'mysql') {
9901
-			$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
9901
+			$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
9902 9902
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
9903 9903
 								GROUP BY spotter_output.airline_icao,year_name, month_name
9904 9904
 								ORDER BY date_count DESC";
9905 9905
 		} else {
9906
-			$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
9906
+			$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
9907 9907
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
9908 9908
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9909 9909
 								ORDER BY date_count DESC";
@@ -9915,7 +9915,7 @@  discard block
 block discarded – undo
9915 9915
 		$date_array = array();
9916 9916
 		$temp_array = array();
9917 9917
         
9918
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9918
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9919 9919
 		{
9920 9920
 			$temp_array['month_name'] = $row['month_name'];
9921 9921
 			$temp_array['year_name'] = $row['year_name'];
@@ -9937,7 +9937,7 @@  discard block
 block discarded – undo
9937 9937
 	public function countAllMonthsAirlines($filters = array())
9938 9938
 	{
9939 9939
 		global $globalTimezone, $globalDBdriver;
9940
-		$filter_query = $this->getFilter($filters,true,true);
9940
+		$filter_query = $this->getFilter($filters, true, true);
9941 9941
 		if ($globalTimezone != '') {
9942 9942
 			date_default_timezone_set($globalTimezone);
9943 9943
 			$datetime = new DateTime();
@@ -9945,12 +9945,12 @@  discard block
 block discarded – undo
9945 9945
 		} else $offset = '+00:00';
9946 9946
 
9947 9947
 		if ($globalDBdriver == 'mysql') {
9948
-			$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
9948
+			$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
9949 9949
 								FROM spotter_output".$filter_query." airline_icao <> '' 
9950 9950
 								GROUP BY year_name, month_name
9951 9951
 								ORDER BY date_count DESC";
9952 9952
 		} else {
9953
-			$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
9953
+			$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
9954 9954
 								FROM spotter_output".$filter_query." airline_icao <> '' 
9955 9955
 								GROUP BY year_name, month_name
9956 9956
 								ORDER BY date_count DESC";
@@ -9962,7 +9962,7 @@  discard block
 block discarded – undo
9962 9962
 		$date_array = array();
9963 9963
 		$temp_array = array();
9964 9964
         
9965
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9965
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9966 9966
 		{
9967 9967
 			$temp_array['month_name'] = $row['month_name'];
9968 9968
 			$temp_array['year_name'] = $row['year_name'];
@@ -9988,15 +9988,15 @@  discard block
 block discarded – undo
9988 9988
 			$datetime = new DateTime();
9989 9989
 			$offset = $datetime->format('P');
9990 9990
 		} else $offset = '+00:00';
9991
-		$filter_query = $this->getFilter($filters,true,true);
9991
+		$filter_query = $this->getFilter($filters, true, true);
9992 9992
 
9993 9993
 		if ($globalDBdriver == 'mysql') {
9994
-			$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
9994
+			$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
9995 9995
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
9996 9996
 								GROUP BY year_name, month_name
9997 9997
 								ORDER BY date_count DESC";
9998 9998
 		} else {
9999
-			$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
9999
+			$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
10000 10000
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
10001 10001
 								GROUP BY year_name, month_name
10002 10002
 								ORDER BY date_count DESC";
@@ -10008,7 +10008,7 @@  discard block
 block discarded – undo
10008 10008
 		$date_array = array();
10009 10009
 		$temp_array = array();
10010 10010
         
10011
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10011
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10012 10012
 		{
10013 10013
 			$temp_array['month_name'] = $row['month_name'];
10014 10014
 			$temp_array['year_name'] = $row['year_name'];
@@ -10030,7 +10030,7 @@  discard block
 block discarded – undo
10030 10030
 	public function countAllMonthsAircraftsByAirlines($filters = array())
10031 10031
 	{
10032 10032
 		global $globalTimezone, $globalDBdriver;
10033
-		$filter_query = $this->getFilter($filters,true,true);
10033
+		$filter_query = $this->getFilter($filters, true, true);
10034 10034
 		if ($globalTimezone != '') {
10035 10035
 			date_default_timezone_set($globalTimezone);
10036 10036
 			$datetime = new DateTime();
@@ -10038,12 +10038,12 @@  discard block
 block discarded – undo
10038 10038
 		} else $offset = '+00:00';
10039 10039
 
10040 10040
 		if ($globalDBdriver == 'mysql') {
10041
-			$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
10041
+			$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
10042 10042
 								FROM spotter_output".$filter_query." aircraft_icao <> ''  AND spotter_output.airline_icao <> '' 
10043 10043
 								GROUP BY spotter_output.airline_icao, year_name, month_name
10044 10044
 								ORDER BY date_count DESC";
10045 10045
 		} else {
10046
-			$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
10046
+			$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
10047 10047
 								FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' 
10048 10048
 								GROUP BY spotter_output.airline_icao, year_name, month_name
10049 10049
 								ORDER BY date_count DESC";
@@ -10055,7 +10055,7 @@  discard block
 block discarded – undo
10055 10055
 		$date_array = array();
10056 10056
 		$temp_array = array();
10057 10057
         
10058
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10058
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10059 10059
 		{
10060 10060
 			$temp_array['month_name'] = $row['month_name'];
10061 10061
 			$temp_array['year_name'] = $row['year_name'];
@@ -10082,15 +10082,15 @@  discard block
 block discarded – undo
10082 10082
 			$datetime = new DateTime();
10083 10083
 			$offset = $datetime->format('P');
10084 10084
 		} else $offset = '+00:00';
10085
-		$filter_query = $this->getFilter($filters,true,true);
10085
+		$filter_query = $this->getFilter($filters, true, true);
10086 10086
 
10087 10087
 		if ($globalDBdriver == 'mysql') {
10088
-			$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
10088
+			$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
10089 10089
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
10090 10090
 								GROUP BY year_name, month_name
10091 10091
 								ORDER BY date_count DESC";
10092 10092
 		} else {
10093
-			$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
10093
+			$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
10094 10094
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
10095 10095
 								GROUP BY year_name, month_name
10096 10096
 								ORDER BY date_count DESC";
@@ -10102,7 +10102,7 @@  discard block
 block discarded – undo
10102 10102
 		$date_array = array();
10103 10103
 		$temp_array = array();
10104 10104
         
10105
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10105
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10106 10106
 		{
10107 10107
 			$temp_array['month_name'] = $row['month_name'];
10108 10108
 			$temp_array['year_name'] = $row['year_name'];
@@ -10124,7 +10124,7 @@  discard block
 block discarded – undo
10124 10124
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
10125 10125
 	{
10126 10126
 		global $globalTimezone, $globalDBdriver;
10127
-		$filter_query = $this->getFilter($filters,true,true);
10127
+		$filter_query = $this->getFilter($filters, true, true);
10128 10128
 		if ($globalTimezone != '') {
10129 10129
 			date_default_timezone_set($globalTimezone);
10130 10130
 			$datetime = new DateTime();
@@ -10132,12 +10132,12 @@  discard block
 block discarded – undo
10132 10132
 		} else $offset = '+00:00';
10133 10133
 
10134 10134
 		if ($globalDBdriver == 'mysql') {
10135
-			$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
10135
+			$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
10136 10136
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
10137 10137
 								GROUP BY spotter_output.airline_icao, year_name, month_name
10138 10138
 								ORDER BY date_count DESC";
10139 10139
 		} else {
10140
-			$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
10140
+			$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
10141 10141
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
10142 10142
 								GROUP BY spotter_output.airline_icao, year_name, month_name
10143 10143
 								ORDER BY date_count DESC";
@@ -10149,7 +10149,7 @@  discard block
 block discarded – undo
10149 10149
 		$date_array = array();
10150 10150
 		$temp_array = array();
10151 10151
         
10152
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10152
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10153 10153
 		{
10154 10154
 			$temp_array['month_name'] = $row['month_name'];
10155 10155
 			$temp_array['year_name'] = $row['year_name'];
@@ -10177,7 +10177,7 @@  discard block
 block discarded – undo
10177 10177
 			$datetime = new DateTime();
10178 10178
 			$offset = $datetime->format('P');
10179 10179
 		} else $offset = '+00:00';
10180
-		$filter_query = $this->getFilter($filters,true,true);
10180
+		$filter_query = $this->getFilter($filters, true, true);
10181 10181
 		if ($globalDBdriver == 'mysql') {
10182 10182
 			$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
10183 10183
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
@@ -10198,7 +10198,7 @@  discard block
 block discarded – undo
10198 10198
 		$date_array = array();
10199 10199
 		$temp_array = array();
10200 10200
         
10201
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10201
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10202 10202
 		{
10203 10203
 			$temp_array['year_name'] = $row['year_name'];
10204 10204
 			$temp_array['month_name'] = $row['month_name'];
@@ -10218,7 +10218,7 @@  discard block
 block discarded – undo
10218 10218
 	* @return Array the hour list
10219 10219
 	*
10220 10220
 	*/
10221
-	public function countAllHours($orderby,$filters = array())
10221
+	public function countAllHours($orderby, $filters = array())
10222 10222
 	{
10223 10223
 		global $globalTimezone, $globalDBdriver;
10224 10224
 		if ($globalTimezone != '') {
@@ -10266,7 +10266,7 @@  discard block
 block discarded – undo
10266 10266
 		$hour_array = array();
10267 10267
 		$temp_array = array();
10268 10268
         
10269
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10269
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10270 10270
 		{
10271 10271
 			$temp_array['hour_name'] = $row['hour_name'];
10272 10272
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10286,7 +10286,7 @@  discard block
 block discarded – undo
10286 10286
 	public function countAllHoursByAirlines($orderby, $filters = array())
10287 10287
 	{
10288 10288
 		global $globalTimezone, $globalDBdriver;
10289
-		$filter_query = $this->getFilter($filters,true,true);
10289
+		$filter_query = $this->getFilter($filters, true, true);
10290 10290
 		if ($globalTimezone != '') {
10291 10291
 			date_default_timezone_set($globalTimezone);
10292 10292
 			$datetime = new DateTime();
@@ -10304,7 +10304,7 @@  discard block
 block discarded – undo
10304 10304
 		}
10305 10305
 		
10306 10306
 		if ($globalDBdriver == 'mysql') {
10307
-			$query  = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10307
+			$query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10308 10308
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
10309 10309
 								GROUP BY spotter_output.airline_icao, hour_name 
10310 10310
 								".$orderby_sql;
@@ -10317,7 +10317,7 @@  discard block
 block discarded – undo
10317 10317
   */    
10318 10318
 		$query_data = array(':offset' => $offset);
10319 10319
 		} else {
10320
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10320
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10321 10321
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
10322 10322
 								GROUP BY spotter_output.airline_icao, hour_name 
10323 10323
 								".$orderby_sql;
@@ -10330,7 +10330,7 @@  discard block
 block discarded – undo
10330 10330
 		$hour_array = array();
10331 10331
 		$temp_array = array();
10332 10332
         
10333
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10333
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10334 10334
 		{
10335 10335
 			$temp_array['hour_name'] = $row['hour_name'];
10336 10336
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10353,34 +10353,34 @@  discard block
 block discarded – undo
10353 10353
 	public function countAllHoursByAirline($airline_icao, $filters = array())
10354 10354
 	{
10355 10355
 		global $globalTimezone, $globalDBdriver;
10356
-		$filter_query = $this->getFilter($filters,true,true);
10356
+		$filter_query = $this->getFilter($filters, true, true);
10357 10357
 		if ($globalTimezone != '') {
10358 10358
 			date_default_timezone_set($globalTimezone);
10359 10359
 			$datetime = new DateTime();
10360 10360
 			$offset = $datetime->format('P');
10361 10361
 		} else $offset = '+00:00';
10362 10362
 
10363
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
10363
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
10364 10364
 
10365 10365
 		if ($globalDBdriver == 'mysql') {
10366
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10366
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10367 10367
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
10368 10368
 								GROUP BY hour_name 
10369 10369
 								ORDER BY hour_name ASC";
10370 10370
 		} else {
10371
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10371
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10372 10372
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
10373 10373
 								GROUP BY hour_name 
10374 10374
 								ORDER BY hour_name ASC";
10375 10375
 		}
10376 10376
 		
10377 10377
 		$sth = $this->db->prepare($query);
10378
-		$sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset));
10378
+		$sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset));
10379 10379
       
10380 10380
 		$hour_array = array();
10381 10381
 		$temp_array = array();
10382 10382
         
10383
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10383
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10384 10384
 		{
10385 10385
 			$temp_array['hour_name'] = $row['hour_name'];
10386 10386
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10403,8 +10403,8 @@  discard block
 block discarded – undo
10403 10403
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
10404 10404
 	{
10405 10405
 		global $globalTimezone, $globalDBdriver;
10406
-		$filter_query = $this->getFilter($filters,true,true);
10407
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
10406
+		$filter_query = $this->getFilter($filters, true, true);
10407
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
10408 10408
 		if ($globalTimezone != '') {
10409 10409
 			date_default_timezone_set($globalTimezone);
10410 10410
 			$datetime = new DateTime();
@@ -10412,24 +10412,24 @@  discard block
 block discarded – undo
10412 10412
 		} else $offset = '+00:00';
10413 10413
 
10414 10414
 		if ($globalDBdriver == 'mysql') {
10415
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10415
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10416 10416
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
10417 10417
 								GROUP BY hour_name 
10418 10418
 								ORDER BY hour_name ASC";
10419 10419
 		} else {
10420
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10420
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10421 10421
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
10422 10422
 								GROUP BY hour_name 
10423 10423
 								ORDER BY hour_name ASC";
10424 10424
 		}
10425 10425
 		
10426 10426
 		$sth = $this->db->prepare($query);
10427
-		$sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset));
10427
+		$sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset));
10428 10428
       
10429 10429
 		$hour_array = array();
10430 10430
 		$temp_array = array();
10431 10431
         
10432
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10432
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10433 10433
 		{
10434 10434
 			$temp_array['hour_name'] = $row['hour_name'];
10435 10435
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10450,8 +10450,8 @@  discard block
 block discarded – undo
10450 10450
 	public function countAllHoursByRegistration($registration, $filters = array())
10451 10451
 	{
10452 10452
 		global $globalTimezone, $globalDBdriver;
10453
-		$filter_query = $this->getFilter($filters,true,true);
10454
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
10453
+		$filter_query = $this->getFilter($filters, true, true);
10454
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
10455 10455
 		if ($globalTimezone != '') {
10456 10456
 			date_default_timezone_set($globalTimezone);
10457 10457
 			$datetime = new DateTime();
@@ -10459,24 +10459,24 @@  discard block
 block discarded – undo
10459 10459
 		} else $offset = '+00:00';
10460 10460
 
10461 10461
 		if ($globalDBdriver == 'mysql') {
10462
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10462
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10463 10463
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
10464 10464
 								GROUP BY hour_name 
10465 10465
 								ORDER BY hour_name ASC";
10466 10466
 		} else {
10467
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10467
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10468 10468
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
10469 10469
 								GROUP BY hour_name 
10470 10470
 								ORDER BY hour_name ASC";
10471 10471
 		}
10472 10472
 		
10473 10473
 		$sth = $this->db->prepare($query);
10474
-		$sth->execute(array(':registration' => $registration,':offset' => $offset));
10474
+		$sth->execute(array(':registration' => $registration, ':offset' => $offset));
10475 10475
       
10476 10476
 		$hour_array = array();
10477 10477
 		$temp_array = array();
10478 10478
         
10479
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10479
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10480 10480
 		{
10481 10481
 			$temp_array['hour_name'] = $row['hour_name'];
10482 10482
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10497,8 +10497,8 @@  discard block
 block discarded – undo
10497 10497
 	public function countAllHoursByAirport($airport_icao, $filters = array())
10498 10498
 	{
10499 10499
 		global $globalTimezone, $globalDBdriver;
10500
-		$filter_query = $this->getFilter($filters,true,true);
10501
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
10500
+		$filter_query = $this->getFilter($filters, true, true);
10501
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
10502 10502
 		if ($globalTimezone != '') {
10503 10503
 			date_default_timezone_set($globalTimezone);
10504 10504
 			$datetime = new DateTime();
@@ -10506,24 +10506,24 @@  discard block
 block discarded – undo
10506 10506
 		} else $offset = '+00:00';
10507 10507
 
10508 10508
 		if ($globalDBdriver == 'mysql') {
10509
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10509
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10510 10510
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
10511 10511
 								GROUP BY hour_name 
10512 10512
 								ORDER BY hour_name ASC";
10513 10513
 		} else {
10514
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10514
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10515 10515
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
10516 10516
 								GROUP BY hour_name 
10517 10517
 								ORDER BY hour_name ASC";
10518 10518
 		}
10519 10519
 		
10520 10520
 		$sth = $this->db->prepare($query);
10521
-		$sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset));
10521
+		$sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset));
10522 10522
       
10523 10523
 		$hour_array = array();
10524 10524
 		$temp_array = array();
10525 10525
         
10526
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10526
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10527 10527
 		{
10528 10528
 			$temp_array['hour_name'] = $row['hour_name'];
10529 10529
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10542,11 +10542,11 @@  discard block
 block discarded – undo
10542 10542
 	* @return Array the hour list
10543 10543
 	*
10544 10544
 	*/
10545
-	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
10545
+	public function countAllHoursByManufacturer($aircraft_manufacturer, $filters = array())
10546 10546
 	{
10547 10547
 		global $globalTimezone, $globalDBdriver;
10548
-		$filter_query = $this->getFilter($filters,true,true);
10549
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
10548
+		$filter_query = $this->getFilter($filters, true, true);
10549
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
10550 10550
 		if ($globalTimezone != '') {
10551 10551
 			date_default_timezone_set($globalTimezone);
10552 10552
 			$datetime = new DateTime();
@@ -10554,24 +10554,24 @@  discard block
 block discarded – undo
10554 10554
 		} else $offset = '+00:00';
10555 10555
 
10556 10556
 		if ($globalDBdriver == 'mysql') {
10557
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10557
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10558 10558
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
10559 10559
 								GROUP BY hour_name 
10560 10560
 								ORDER BY hour_name ASC";
10561 10561
 		} else {
10562
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10562
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10563 10563
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
10564 10564
 								GROUP BY hour_name 
10565 10565
 								ORDER BY hour_name ASC";
10566 10566
 		}
10567 10567
 		
10568 10568
 		$sth = $this->db->prepare($query);
10569
-		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset));
10569
+		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset));
10570 10570
       
10571 10571
 		$hour_array = array();
10572 10572
 		$temp_array = array();
10573 10573
         
10574
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10574
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10575 10575
 		{
10576 10576
 			$temp_array['hour_name'] = $row['hour_name'];
10577 10577
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10593,8 +10593,8 @@  discard block
 block discarded – undo
10593 10593
 	public function countAllHoursByDate($date, $filters = array())
10594 10594
 	{
10595 10595
 		global $globalTimezone, $globalDBdriver;
10596
-		$filter_query = $this->getFilter($filters,true,true);
10597
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
10596
+		$filter_query = $this->getFilter($filters, true, true);
10597
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
10598 10598
 		if ($globalTimezone != '') {
10599 10599
 			date_default_timezone_set($globalTimezone);
10600 10600
 			$datetime = new DateTime($date);
@@ -10602,12 +10602,12 @@  discard block
 block discarded – undo
10602 10602
 		} else $offset = '+00:00';
10603 10603
 
10604 10604
 		if ($globalDBdriver == 'mysql') {
10605
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10605
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10606 10606
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
10607 10607
 								GROUP BY hour_name 
10608 10608
 								ORDER BY hour_name ASC";
10609 10609
 		} else {
10610
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10610
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10611 10611
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date
10612 10612
 								GROUP BY hour_name 
10613 10613
 								ORDER BY hour_name ASC";
@@ -10619,7 +10619,7 @@  discard block
 block discarded – undo
10619 10619
 		$hour_array = array();
10620 10620
 		$temp_array = array();
10621 10621
         
10622
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10622
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10623 10623
 		{
10624 10624
 			$temp_array['hour_name'] = $row['hour_name'];
10625 10625
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10641,8 +10641,8 @@  discard block
 block discarded – undo
10641 10641
 	public function countAllHoursByIdent($ident, $filters = array())
10642 10642
 	{
10643 10643
 		global $globalTimezone, $globalDBdriver;
10644
-		$filter_query = $this->getFilter($filters,true,true);
10645
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
10644
+		$filter_query = $this->getFilter($filters, true, true);
10645
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
10646 10646
 		if ($globalTimezone != '') {
10647 10647
 			date_default_timezone_set($globalTimezone);
10648 10648
 			$datetime = new DateTime();
@@ -10650,12 +10650,12 @@  discard block
 block discarded – undo
10650 10650
 		} else $offset = '+00:00';
10651 10651
 
10652 10652
 		if ($globalDBdriver == 'mysql') {
10653
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10653
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10654 10654
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
10655 10655
 								GROUP BY hour_name 
10656 10656
 								ORDER BY hour_name ASC";
10657 10657
 		} else {
10658
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10658
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10659 10659
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
10660 10660
 								GROUP BY hour_name 
10661 10661
 								ORDER BY hour_name ASC";
@@ -10663,12 +10663,12 @@  discard block
 block discarded – undo
10663 10663
       
10664 10664
 		
10665 10665
 		$sth = $this->db->prepare($query);
10666
-		$sth->execute(array(':ident' => $ident,':offset' => $offset));
10666
+		$sth->execute(array(':ident' => $ident, ':offset' => $offset));
10667 10667
       
10668 10668
 		$hour_array = array();
10669 10669
 		$temp_array = array();
10670 10670
         
10671
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10671
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10672 10672
 		{
10673 10673
 			$temp_array['hour_name'] = $row['hour_name'];
10674 10674
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10688,8 +10688,8 @@  discard block
 block discarded – undo
10688 10688
 	public function countAllHoursByOwner($owner, $filters = array())
10689 10689
 	{
10690 10690
 		global $globalTimezone, $globalDBdriver;
10691
-		$filter_query = $this->getFilter($filters,true,true);
10692
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
10691
+		$filter_query = $this->getFilter($filters, true, true);
10692
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
10693 10693
 		if ($globalTimezone != '') {
10694 10694
 			date_default_timezone_set($globalTimezone);
10695 10695
 			$datetime = new DateTime();
@@ -10697,12 +10697,12 @@  discard block
 block discarded – undo
10697 10697
 		} else $offset = '+00:00';
10698 10698
 
10699 10699
 		if ($globalDBdriver == 'mysql') {
10700
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10700
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10701 10701
 								FROM spotter_output".$filter_query." spotter_output.owner_name = :owner 
10702 10702
 								GROUP BY hour_name 
10703 10703
 								ORDER BY hour_name ASC";
10704 10704
 		} else {
10705
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10705
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10706 10706
 								FROM spotter_output".$filter_query." spotter_output.owner_name = :owner 
10707 10707
 								GROUP BY hour_name 
10708 10708
 								ORDER BY hour_name ASC";
@@ -10710,12 +10710,12 @@  discard block
 block discarded – undo
10710 10710
       
10711 10711
 		
10712 10712
 		$sth = $this->db->prepare($query);
10713
-		$sth->execute(array(':owner' => $owner,':offset' => $offset));
10713
+		$sth->execute(array(':owner' => $owner, ':offset' => $offset));
10714 10714
       
10715 10715
 		$hour_array = array();
10716 10716
 		$temp_array = array();
10717 10717
         
10718
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10718
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10719 10719
 		{
10720 10720
 			$temp_array['hour_name'] = $row['hour_name'];
10721 10721
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10735,8 +10735,8 @@  discard block
 block discarded – undo
10735 10735
 	public function countAllHoursByPilot($pilot, $filters = array())
10736 10736
 	{
10737 10737
 		global $globalTimezone, $globalDBdriver;
10738
-		$filter_query = $this->getFilter($filters,true,true);
10739
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
10738
+		$filter_query = $this->getFilter($filters, true, true);
10739
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
10740 10740
 		if ($globalTimezone != '') {
10741 10741
 			date_default_timezone_set($globalTimezone);
10742 10742
 			$datetime = new DateTime();
@@ -10744,12 +10744,12 @@  discard block
 block discarded – undo
10744 10744
 		} else $offset = '+00:00';
10745 10745
 
10746 10746
 		if ($globalDBdriver == 'mysql') {
10747
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10747
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10748 10748
 								FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
10749 10749
 								GROUP BY hour_name 
10750 10750
 								ORDER BY hour_name ASC";
10751 10751
 		} else {
10752
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10752
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10753 10753
 								FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
10754 10754
 								GROUP BY hour_name 
10755 10755
 								ORDER BY hour_name ASC";
@@ -10757,12 +10757,12 @@  discard block
 block discarded – undo
10757 10757
       
10758 10758
 		
10759 10759
 		$sth = $this->db->prepare($query);
10760
-		$sth->execute(array(':pilot' => $pilot,':offset' => $offset));
10760
+		$sth->execute(array(':pilot' => $pilot, ':offset' => $offset));
10761 10761
       
10762 10762
 		$hour_array = array();
10763 10763
 		$temp_array = array();
10764 10764
         
10765
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10765
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10766 10766
 		{
10767 10767
 			$temp_array['hour_name'] = $row['hour_name'];
10768 10768
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10781,12 +10781,12 @@  discard block
 block discarded – undo
10781 10781
 	* @return Array the hour list
10782 10782
 	*
10783 10783
 	*/
10784
-	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
10784
+	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
10785 10785
 	{
10786 10786
 		global $globalTimezone, $globalDBdriver;
10787
-		$filter_query = $this->getFilter($filters,true,true);
10788
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
10789
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
10787
+		$filter_query = $this->getFilter($filters, true, true);
10788
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
10789
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
10790 10790
 		if ($globalTimezone != '') {
10791 10791
 			date_default_timezone_set($globalTimezone);
10792 10792
 			$datetime = new DateTime();
@@ -10794,24 +10794,24 @@  discard block
 block discarded – undo
10794 10794
 		} else $offset = '+00:00';
10795 10795
 
10796 10796
 		if ($globalDBdriver == 'mysql') {
10797
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10797
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10798 10798
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
10799 10799
 								GROUP BY hour_name 
10800 10800
 								ORDER BY hour_name ASC";
10801 10801
 		} else {
10802
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10802
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10803 10803
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
10804 10804
 								GROUP BY hour_name 
10805 10805
 								ORDER BY hour_name ASC";
10806 10806
 		}
10807 10807
 		
10808 10808
 		$sth = $this->db->prepare($query);
10809
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset));
10809
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset));
10810 10810
       
10811 10811
 		$hour_array = array();
10812 10812
 		$temp_array = array();
10813 10813
         
10814
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10814
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10815 10815
 		{
10816 10816
 			$temp_array['hour_name'] = $row['hour_name'];
10817 10817
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10832,8 +10832,8 @@  discard block
 block discarded – undo
10832 10832
 	public function countAllHoursByCountry($country, $filters = array())
10833 10833
 	{
10834 10834
 		global $globalTimezone, $globalDBdriver;
10835
-		$filter_query = $this->getFilter($filters,true,true);
10836
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
10835
+		$filter_query = $this->getFilter($filters, true, true);
10836
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
10837 10837
 		if ($globalTimezone != '') {
10838 10838
 			date_default_timezone_set($globalTimezone);
10839 10839
 			$datetime = new DateTime();
@@ -10841,24 +10841,24 @@  discard block
 block discarded – undo
10841 10841
 		} else $offset = '+00:00';
10842 10842
 
10843 10843
 		if ($globalDBdriver == 'mysql') {
10844
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10844
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10845 10845
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
10846 10846
 								GROUP BY hour_name 
10847 10847
 								ORDER BY hour_name ASC";
10848 10848
 		} else {
10849
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10849
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10850 10850
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
10851 10851
 								GROUP BY hour_name 
10852 10852
 								ORDER BY hour_name ASC";
10853 10853
 		}
10854 10854
 		
10855 10855
 		$sth = $this->db->prepare($query);
10856
-		$sth->execute(array(':country' => $country,':offset' => $offset));
10856
+		$sth->execute(array(':country' => $country, ':offset' => $offset));
10857 10857
       
10858 10858
 		$hour_array = array();
10859 10859
 		$temp_array = array();
10860 10860
         
10861
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10861
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10862 10862
 		{
10863 10863
 			$temp_array['hour_name'] = $row['hour_name'];
10864 10864
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10878,29 +10878,29 @@  discard block
 block discarded – undo
10878 10878
 	* @return Integer the number of aircrafts
10879 10879
 	*
10880 10880
 	*/
10881
-	public function countOverallAircrafts($filters = array(),$year = '',$month = '')
10881
+	public function countOverallAircrafts($filters = array(), $year = '', $month = '')
10882 10882
 	{
10883 10883
 		global $globalDBdriver;
10884
-		$filter_query = $this->getFilter($filters,true,true);
10885
-		$query  = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
10884
+		$filter_query = $this->getFilter($filters, true, true);
10885
+		$query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
10886 10886
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
10887 10887
 		$query_values = array();
10888 10888
 		if ($year != '') {
10889 10889
 			if ($globalDBdriver == 'mysql') {
10890 10890
 				$query .= " AND YEAR(spotter_output.date) = :year";
10891
-				$query_values = array_merge($query_values,array(':year' => $year));
10891
+				$query_values = array_merge($query_values, array(':year' => $year));
10892 10892
 			} else {
10893 10893
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10894
-				$query_values = array_merge($query_values,array(':year' => $year));
10894
+				$query_values = array_merge($query_values, array(':year' => $year));
10895 10895
 			}
10896 10896
 		}
10897 10897
 		if ($month != '') {
10898 10898
 			if ($globalDBdriver == 'mysql') {
10899 10899
 				$query .= " AND MONTH(spotter_output.date) = :month";
10900
-				$query_values = array_merge($query_values,array(':month' => $month));
10900
+				$query_values = array_merge($query_values, array(':month' => $month));
10901 10901
 			} else {
10902 10902
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10903
-				$query_values = array_merge($query_values,array(':month' => $month));
10903
+				$query_values = array_merge($query_values, array(':month' => $month));
10904 10904
 			}
10905 10905
 		}
10906 10906
 
@@ -10915,29 +10915,29 @@  discard block
 block discarded – undo
10915 10915
 	* @return Integer the number of aircrafts
10916 10916
 	*
10917 10917
 	*/
10918
-	public function countOverallArrival($filters = array(),$year = '',$month = '')
10918
+	public function countOverallArrival($filters = array(), $year = '', $month = '')
10919 10919
 	{
10920 10920
 		global $globalDBdriver;
10921
-		$filter_query = $this->getFilter($filters,true,true);
10922
-		$query  = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
10921
+		$filter_query = $this->getFilter($filters, true, true);
10922
+		$query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
10923 10923
                     FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''";
10924 10924
 		$query_values = array();
10925 10925
 		if ($year != '') {
10926 10926
 			if ($globalDBdriver == 'mysql') {
10927 10927
 				$query .= " AND YEAR(spotter_output.date) = :year";
10928
-				$query_values = array_merge($query_values,array(':year' => $year));
10928
+				$query_values = array_merge($query_values, array(':year' => $year));
10929 10929
 			} else {
10930 10930
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10931
-				$query_values = array_merge($query_values,array(':year' => $year));
10931
+				$query_values = array_merge($query_values, array(':year' => $year));
10932 10932
 			}
10933 10933
 		}
10934 10934
 		if ($month != '') {
10935 10935
 			if ($globalDBdriver == 'mysql') {
10936 10936
 				$query .= " AND MONTH(spotter_output.date) = :month";
10937
-				$query_values = array_merge($query_values,array(':month' => $month));
10937
+				$query_values = array_merge($query_values, array(':month' => $month));
10938 10938
 			} else {
10939 10939
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10940
-				$query_values = array_merge($query_values,array(':month' => $month));
10940
+				$query_values = array_merge($query_values, array(':month' => $month));
10941 10941
 			}
10942 10942
 		}
10943 10943
 		
@@ -10952,29 +10952,29 @@  discard block
 block discarded – undo
10952 10952
 	* @return Integer the number of pilots
10953 10953
 	*
10954 10954
 	*/
10955
-	public function countOverallPilots($filters = array(),$year = '',$month = '')
10955
+	public function countOverallPilots($filters = array(), $year = '', $month = '')
10956 10956
 	{
10957 10957
 		global $globalDBdriver;
10958
-		$filter_query = $this->getFilter($filters,true,true);
10959
-		$query  = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
10958
+		$filter_query = $this->getFilter($filters, true, true);
10959
+		$query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
10960 10960
                     FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''";
10961 10961
 		$query_values = array();
10962 10962
 		if ($year != '') {
10963 10963
 			if ($globalDBdriver == 'mysql') {
10964 10964
 				$query .= " AND YEAR(spotter_output.date) = :year";
10965
-				$query_values = array_merge($query_values,array(':year' => $year));
10965
+				$query_values = array_merge($query_values, array(':year' => $year));
10966 10966
 			} else {
10967 10967
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10968
-				$query_values = array_merge($query_values,array(':year' => $year));
10968
+				$query_values = array_merge($query_values, array(':year' => $year));
10969 10969
 			}
10970 10970
 		}
10971 10971
 		if ($month != '') {
10972 10972
 			if ($globalDBdriver == 'mysql') {
10973 10973
 				$query .= " AND MONTH(spotter_output.date) = :month";
10974
-				$query_values = array_merge($query_values,array(':month' => $month));
10974
+				$query_values = array_merge($query_values, array(':month' => $month));
10975 10975
 			} else {
10976 10976
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10977
-				$query_values = array_merge($query_values,array(':month' => $month));
10977
+				$query_values = array_merge($query_values, array(':month' => $month));
10978 10978
 			}
10979 10979
 		}
10980 10980
 		$sth = $this->db->prepare($query);
@@ -10988,29 +10988,29 @@  discard block
 block discarded – undo
10988 10988
 	* @return Integer the number of owners
10989 10989
 	*
10990 10990
 	*/
10991
-	public function countOverallOwners($filters = array(),$year = '',$month = '')
10991
+	public function countOverallOwners($filters = array(), $year = '', $month = '')
10992 10992
 	{
10993 10993
 		global $globalDBdriver;
10994
-		$filter_query = $this->getFilter($filters,true,true);
10995
-		$query  = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
10994
+		$filter_query = $this->getFilter($filters, true, true);
10995
+		$query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
10996 10996
                     FROM spotter_output".$filter_query." spotter_output.owner_name <> ''";
10997 10997
 		$query_values = array();
10998 10998
 		if ($year != '') {
10999 10999
 			if ($globalDBdriver == 'mysql') {
11000 11000
 				$query .= " AND YEAR(spotter_output.date) = :year";
11001
-				$query_values = array_merge($query_values,array(':year' => $year));
11001
+				$query_values = array_merge($query_values, array(':year' => $year));
11002 11002
 			} else {
11003 11003
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
11004
-				$query_values = array_merge($query_values,array(':year' => $year));
11004
+				$query_values = array_merge($query_values, array(':year' => $year));
11005 11005
 			}
11006 11006
 		}
11007 11007
 		if ($month != '') {
11008 11008
 			if ($globalDBdriver == 'mysql') {
11009 11009
 				$query .= " AND MONTH(spotter_output.date) = :month";
11010
-				$query_values = array_merge($query_values,array(':month' => $month));
11010
+				$query_values = array_merge($query_values, array(':month' => $month));
11011 11011
 			} else {
11012 11012
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
11013
-				$query_values = array_merge($query_values,array(':month' => $month));
11013
+				$query_values = array_merge($query_values, array(':month' => $month));
11014 11014
 			}
11015 11015
 		}
11016 11016
 		$sth = $this->db->prepare($query);
@@ -11025,32 +11025,32 @@  discard block
 block discarded – undo
11025 11025
 	* @return Integer the number of flights
11026 11026
 	*
11027 11027
 	*/
11028
-	public function countOverallFlights($filters = array(),$year = '',$month = '')
11028
+	public function countOverallFlights($filters = array(), $year = '', $month = '')
11029 11029
 	{
11030 11030
 		global $globalDBdriver;
11031
-		$queryi  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count FROM spotter_output";
11031
+		$queryi = "SELECT COUNT(spotter_output.spotter_id) AS flight_count FROM spotter_output";
11032 11032
 		$query_values = array();
11033 11033
 		$query = '';
11034 11034
 		if ($year != '') {
11035 11035
 			if ($globalDBdriver == 'mysql') {
11036 11036
 				$query .= " AND YEAR(spotter_output.date) = :year";
11037
-				$query_values = array_merge($query_values,array(':year' => $year));
11037
+				$query_values = array_merge($query_values, array(':year' => $year));
11038 11038
 			} else {
11039 11039
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
11040
-				$query_values = array_merge($query_values,array(':year' => $year));
11040
+				$query_values = array_merge($query_values, array(':year' => $year));
11041 11041
 			}
11042 11042
 		}
11043 11043
 		if ($month != '') {
11044 11044
 			if ($globalDBdriver == 'mysql') {
11045 11045
 				$query .= " AND MONTH(spotter_output.date) = :month";
11046
-				$query_values = array_merge($query_values,array(':month' => $month));
11046
+				$query_values = array_merge($query_values, array(':month' => $month));
11047 11047
 			} else {
11048 11048
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
11049
-				$query_values = array_merge($query_values,array(':month' => $month));
11049
+				$query_values = array_merge($query_values, array(':month' => $month));
11050 11050
 			}
11051 11051
 		}
11052 11052
 		if (empty($query_values)) $queryi .= $this->getFilter($filters);
11053
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11053
+		else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
11054 11054
 		
11055 11055
 		$sth = $this->db->prepare($queryi);
11056 11056
 		$sth->execute($query_values);
@@ -11063,29 +11063,29 @@  discard block
 block discarded – undo
11063 11063
 	* @return Integer the number of flights
11064 11064
 	*
11065 11065
 	*/
11066
-	public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '')
11066
+	public function countOverallMilitaryFlights($filters = array(), $year = '', $month = '')
11067 11067
 	{
11068 11068
 		global $globalDBdriver;
11069
-		$filter_query = $this->getFilter($filters,true,true);
11070
-		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
11069
+		$filter_query = $this->getFilter($filters, true, true);
11070
+		$query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
11071 11071
                     FROM airlines,spotter_output".$filter_query." spotter_output.airline_icao = airlines.icao AND airlines.type = 'military'";
11072 11072
 		$query_values = array();
11073 11073
 		if ($year != '') {
11074 11074
 			if ($globalDBdriver == 'mysql') {
11075 11075
 				$query .= " AND YEAR(spotter_output.date) = :year";
11076
-				$query_values = array_merge($query_values,array(':year' => $year));
11076
+				$query_values = array_merge($query_values, array(':year' => $year));
11077 11077
 			} else {
11078 11078
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
11079
-				$query_values = array_merge($query_values,array(':year' => $year));
11079
+				$query_values = array_merge($query_values, array(':year' => $year));
11080 11080
 			}
11081 11081
 		}
11082 11082
 		if ($month != '') {
11083 11083
 			if ($globalDBdriver == 'mysql') {
11084 11084
 				$query .= " AND MONTH(spotter_output.date) = :month";
11085
-				$query_values = array_merge($query_values,array(':month' => $month));
11085
+				$query_values = array_merge($query_values, array(':month' => $month));
11086 11086
 			} else {
11087 11087
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
11088
-				$query_values = array_merge($query_values,array(':month' => $month));
11088
+				$query_values = array_merge($query_values, array(':month' => $month));
11089 11089
 			}
11090 11090
 		}
11091 11091
       
@@ -11102,10 +11102,10 @@  discard block
 block discarded – undo
11102 11102
 	* @return Integer the number of airlines
11103 11103
 	*
11104 11104
 	*/
11105
-	public function countOverallAirlines($filters = array(),$year = '',$month = '')
11105
+	public function countOverallAirlines($filters = array(), $year = '', $month = '')
11106 11106
 	{
11107 11107
 		global $globalDBdriver;
11108
-		$queryi  = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
11108
+		$queryi = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
11109 11109
 							FROM spotter_output";
11110 11110
       
11111 11111
 		$query_values = array();
@@ -11113,23 +11113,23 @@  discard block
 block discarded – undo
11113 11113
 		if ($year != '') {
11114 11114
 			if ($globalDBdriver == 'mysql') {
11115 11115
 				$query .= " AND YEAR(spotter_output.date) = :year";
11116
-				$query_values = array_merge($query_values,array(':year' => $year));
11116
+				$query_values = array_merge($query_values, array(':year' => $year));
11117 11117
 			} else {
11118 11118
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
11119
-				$query_values = array_merge($query_values,array(':year' => $year));
11119
+				$query_values = array_merge($query_values, array(':year' => $year));
11120 11120
 			}
11121 11121
 		}
11122 11122
 		if ($month != '') {
11123 11123
 			if ($globalDBdriver == 'mysql') {
11124 11124
 				$query .= " AND MONTH(spotter_output.date) = :month";
11125
-				$query_values = array_merge($query_values,array(':month' => $month));
11125
+				$query_values = array_merge($query_values, array(':month' => $month));
11126 11126
 			} else {
11127 11127
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
11128
-				$query_values = array_merge($query_values,array(':month' => $month));
11128
+				$query_values = array_merge($query_values, array(':month' => $month));
11129 11129
 			}
11130 11130
 		}
11131 11131
                 if ($query == '') $queryi .= $this->getFilter($filters);
11132
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11132
+                else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
11133 11133
 
11134 11134
 
11135 11135
 		$sth = $this->db->prepare($queryi);
@@ -11147,7 +11147,7 @@  discard block
 block discarded – undo
11147 11147
 	public function countAllHoursFromToday($filters = array())
11148 11148
 	{
11149 11149
 		global $globalTimezone, $globalDBdriver;
11150
-		$filter_query = $this->getFilter($filters,true,true);
11150
+		$filter_query = $this->getFilter($filters, true, true);
11151 11151
 		if ($globalTimezone != '') {
11152 11152
 			date_default_timezone_set($globalTimezone);
11153 11153
 			$datetime = new DateTime();
@@ -11155,12 +11155,12 @@  discard block
 block discarded – undo
11155 11155
 		} else $offset = '+00:00';
11156 11156
 
11157 11157
 		if ($globalDBdriver == 'mysql') {
11158
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
11158
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
11159 11159
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE()
11160 11160
 								GROUP BY hour_name 
11161 11161
 								ORDER BY hour_name ASC";
11162 11162
 		} else {
11163
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
11163
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
11164 11164
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date)
11165 11165
 								GROUP BY hour_name 
11166 11166
 								ORDER BY hour_name ASC";
@@ -11172,7 +11172,7 @@  discard block
 block discarded – undo
11172 11172
 		$hour_array = array();
11173 11173
 		$temp_array = array();
11174 11174
         
11175
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11175
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11176 11176
 		{
11177 11177
 			$temp_array['hour_name'] = $row['hour_name'];
11178 11178
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -11191,14 +11191,14 @@  discard block
 block discarded – undo
11191 11191
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
11192 11192
 	{
11193 11193
 		global $global_query, $globalDBdriver, $globalTimezone;
11194
-		$filter_query = $this->getFilter($filters,true,true);
11194
+		$filter_query = $this->getFilter($filters, true, true);
11195 11195
 		date_default_timezone_set('UTC');
11196 11196
 		$limit_query = '';
11197 11197
 		if ($limit != "")
11198 11198
 		{
11199 11199
 			$limit_array = explode(",", $limit);
11200
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
11201
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
11200
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
11201
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
11202 11202
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
11203 11203
 			{
11204 11204
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
@@ -11251,7 +11251,7 @@  discard block
 block discarded – undo
11251 11251
 			    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')
11252 11252
 			    HAVING count(spotter_output.ident) > 5$orderby_query";
11253 11253
 			//echo $query;
11254
-			$spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone));
11254
+			$spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone));
11255 11255
 			/*
11256 11256
 			$sth = $this->db->prepare($query);
11257 11257
 			$sth->execute(array(':timezone' => $globalTimezone));
@@ -11270,9 +11270,9 @@  discard block
 block discarded – undo
11270 11270
 	*/
11271 11271
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
11272 11272
 	{
11273
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
11273
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
11274 11274
 
11275
-		$query  = "SELECT spotter_output.spotter_id
11275
+		$query = "SELECT spotter_output.spotter_id
11276 11276
 								FROM spotter_output 
11277 11277
 								WHERE spotter_output.flightaware_id = '".$flightaware_id."'";
11278 11278
         
@@ -11280,7 +11280,7 @@  discard block
 block discarded – undo
11280 11280
 		$sth = $this->db->prepare($query);
11281 11281
 		$sth->execute();
11282 11282
 
11283
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11283
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11284 11284
 		{
11285 11285
 			return $row['spotter_id'];
11286 11286
 		}
@@ -11305,23 +11305,23 @@  discard block
 block discarded – undo
11305 11305
 		}
11306 11306
 		
11307 11307
 		$current_date = date("Y-m-d H:i:s");
11308
-		$date = date("Y-m-d H:i:s",strtotime($dateString." UTC"));
11308
+		$date = date("Y-m-d H:i:s", strtotime($dateString." UTC"));
11309 11309
 		
11310 11310
 		$diff = abs(strtotime($current_date) - strtotime($date));
11311 11311
 
11312
-		$time_array['years'] = floor($diff / (365*60*60*24)); 
11312
+		$time_array['years'] = floor($diff/(365*60*60*24)); 
11313 11313
 		$years = $time_array['years'];
11314 11314
 		
11315
-		$time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
11315
+		$time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24));
11316 11316
 		$months = $time_array['months'];
11317 11317
 		
11318
-		$time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
11318
+		$time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24));
11319 11319
 		$days = $time_array['days'];
11320
-		$time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60));
11320
+		$time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60));
11321 11321
 		$hours = $time_array['hours'];
11322
-		$time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60);
11322
+		$time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60);
11323 11323
 		$minutes = $time_array['minutes'];
11324
-		$time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
11324
+		$time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
11325 11325
 		
11326 11326
 		return $time_array;	
11327 11327
 	}	
@@ -11347,63 +11347,63 @@  discard block
 block discarded – undo
11347 11347
 			$temp_array['direction_degree'] = $direction;
11348 11348
 			$temp_array['direction_shortname'] = "N";
11349 11349
 			$temp_array['direction_fullname'] = "North";
11350
-		} elseif ($direction >= 22.5 && $direction < 45){
11350
+		} elseif ($direction >= 22.5 && $direction < 45) {
11351 11351
 			$temp_array['direction_degree'] = $direction;
11352 11352
 			$temp_array['direction_shortname'] = "NNE";
11353 11353
 			$temp_array['direction_fullname'] = "North-Northeast";
11354
-		} elseif ($direction >= 45 && $direction < 67.5){
11354
+		} elseif ($direction >= 45 && $direction < 67.5) {
11355 11355
 			$temp_array['direction_degree'] = $direction;
11356 11356
 			$temp_array['direction_shortname'] = "NE";
11357 11357
 			$temp_array['direction_fullname'] = "Northeast";
11358
-		} elseif ($direction >= 67.5 && $direction < 90){
11358
+		} elseif ($direction >= 67.5 && $direction < 90) {
11359 11359
 			$temp_array['direction_degree'] = $direction;
11360 11360
 			$temp_array['direction_shortname'] = "ENE";
11361 11361
 			$temp_array['direction_fullname'] = "East-Northeast";
11362
-		} elseif ($direction >= 90 && $direction < 112.5){
11362
+		} elseif ($direction >= 90 && $direction < 112.5) {
11363 11363
 			$temp_array['direction_degree'] = $direction;
11364 11364
 			$temp_array['direction_shortname'] = "E";
11365 11365
 			$temp_array['direction_fullname'] = "East";
11366
-		} elseif ($direction >= 112.5 && $direction < 135){
11366
+		} elseif ($direction >= 112.5 && $direction < 135) {
11367 11367
 			$temp_array['direction_degree'] = $direction;
11368 11368
 			$temp_array['direction_shortname'] = "ESE";
11369 11369
 			$temp_array['direction_fullname'] = "East-Southeast";
11370
-		} elseif ($direction >= 135 && $direction < 157.5){
11370
+		} elseif ($direction >= 135 && $direction < 157.5) {
11371 11371
 			$temp_array['direction_degree'] = $direction;
11372 11372
 			$temp_array['direction_shortname'] = "SE";
11373 11373
 			$temp_array['direction_fullname'] = "Southeast";
11374
-		} elseif ($direction >= 157.5 && $direction < 180){
11374
+		} elseif ($direction >= 157.5 && $direction < 180) {
11375 11375
 			$temp_array['direction_degree'] = $direction;
11376 11376
 			$temp_array['direction_shortname'] = "SSE";
11377 11377
 			$temp_array['direction_fullname'] = "South-Southeast";
11378
-		} elseif ($direction >= 180 && $direction < 202.5){
11378
+		} elseif ($direction >= 180 && $direction < 202.5) {
11379 11379
 			$temp_array['direction_degree'] = $direction;
11380 11380
 			$temp_array['direction_shortname'] = "S";
11381 11381
 			$temp_array['direction_fullname'] = "South";
11382
-		} elseif ($direction >= 202.5 && $direction < 225){
11382
+		} elseif ($direction >= 202.5 && $direction < 225) {
11383 11383
 			$temp_array['direction_degree'] = $direction;
11384 11384
 			$temp_array['direction_shortname'] = "SSW";
11385 11385
 			$temp_array['direction_fullname'] = "South-Southwest";
11386
-		} elseif ($direction >= 225 && $direction < 247.5){
11386
+		} elseif ($direction >= 225 && $direction < 247.5) {
11387 11387
 			$temp_array['direction_degree'] = $direction;
11388 11388
 			$temp_array['direction_shortname'] = "SW";
11389 11389
 			$temp_array['direction_fullname'] = "Southwest";
11390
-		} elseif ($direction >= 247.5 && $direction < 270){
11390
+		} elseif ($direction >= 247.5 && $direction < 270) {
11391 11391
 			$temp_array['direction_degree'] = $direction;
11392 11392
 			$temp_array['direction_shortname'] = "WSW";
11393 11393
 			$temp_array['direction_fullname'] = "West-Southwest";
11394
-		} elseif ($direction >= 270 && $direction < 292.5){
11394
+		} elseif ($direction >= 270 && $direction < 292.5) {
11395 11395
 			$temp_array['direction_degree'] = $direction;
11396 11396
 			$temp_array['direction_shortname'] = "W";
11397 11397
 			$temp_array['direction_fullname'] = "West";
11398
-		} elseif ($direction >= 292.5 && $direction < 315){
11398
+		} elseif ($direction >= 292.5 && $direction < 315) {
11399 11399
 			$temp_array['direction_degree'] = $direction;
11400 11400
 			$temp_array['direction_shortname'] = "WNW";
11401 11401
 			$temp_array['direction_fullname'] = "West-Northwest";
11402
-		} elseif ($direction >= 315 && $direction < 337.5){
11402
+		} elseif ($direction >= 315 && $direction < 337.5) {
11403 11403
 			$temp_array['direction_degree'] = $direction;
11404 11404
 			$temp_array['direction_shortname'] = "NW";
11405 11405
 			$temp_array['direction_fullname'] = "Northwest";
11406
-		} elseif ($direction >= 337.5 && $direction < 360){
11406
+		} elseif ($direction >= 337.5 && $direction < 360) {
11407 11407
 			$temp_array['direction_degree'] = $direction;
11408 11408
 			$temp_array['direction_shortname'] = "NNW";
11409 11409
 			$temp_array['direction_fullname'] = "North-Northwest";
@@ -11456,8 +11456,8 @@  discard block
 block discarded – undo
11456 11456
 	*/
11457 11457
 	public function getAircraftRegistrationBymodeS($aircraft_modes, $source_type = '')
11458 11458
 	{
11459
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
11460
-		$source_type = filter_var($source_type,FILTER_SANITIZE_STRING);
11459
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
11460
+		$source_type = filter_var($source_type, FILTER_SANITIZE_STRING);
11461 11461
 		if ($source_type == '' || $source_type == 'modes') {
11462 11462
 			$query  = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes AND aircraft_modes.source_type = 'modes' ORDER BY FirstCreated DESC LIMIT 1";
11463 11463
 		} else {
@@ -11484,10 +11484,10 @@  discard block
 block discarded – undo
11484 11484
 	* @return String the aircraft type
11485 11485
 	*
11486 11486
 	*/
11487
-	public function getAircraftTypeBymodeS($aircraft_modes,$source_type = '')
11487
+	public function getAircraftTypeBymodeS($aircraft_modes, $source_type = '')
11488 11488
 	{
11489
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
11490
-		$source_type = filter_var($source_type,FILTER_SANITIZE_STRING);
11489
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
11490
+		$source_type = filter_var($source_type, FILTER_SANITIZE_STRING);
11491 11491
 		if ($source_type == '' || $source_type == 'modes') {
11492 11492
 			$query  = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes AND aircraft_modes.source_type = 'modes' ORDER BY FirstCreated DESC LIMIT 1";
11493 11493
 		} else {
@@ -11515,11 +11515,11 @@  discard block
 block discarded – undo
11515 11515
 	* @param Float $longitude longitute of the flight
11516 11516
 	* @return String the countrie
11517 11517
 	*/
11518
-	public function getCountryFromLatitudeLongitude($latitude,$longitude)
11518
+	public function getCountryFromLatitudeLongitude($latitude, $longitude)
11519 11519
 	{
11520 11520
 		global $globalDBdriver, $globalDebug;
11521
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
11522
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
11521
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
11522
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
11523 11523
 	
11524 11524
 		$Connection = new Connection($this->db);
11525 11525
 		if (!$Connection->tableExists('countries')) return '';
@@ -11559,7 +11559,7 @@  discard block
 block discarded – undo
11559 11559
 	public function getCountryFromISO2($iso2)
11560 11560
 	{
11561 11561
 		global $globalDBdriver, $globalDebug;
11562
-		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
11562
+		$iso2 = filter_var($iso2, FILTER_SANITIZE_STRING);
11563 11563
 	
11564 11564
 		$Connection = new Connection($this->db);
11565 11565
 		if (!$Connection->tableExists('countries')) return '';
@@ -11591,19 +11591,19 @@  discard block
 block discarded – undo
11591 11591
 	*/
11592 11592
 	public function convertAircraftRegistration($registration)
11593 11593
 	{
11594
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11594
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11595 11595
 		$registration_prefix = '';
11596 11596
 		$registration_1 = substr($registration, 0, 1);
11597 11597
 		$registration_2 = substr($registration, 0, 2);
11598 11598
 
11599 11599
 		//first get the prefix based on two characters
11600
-		$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
11600
+		$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
11601 11601
       
11602 11602
 		
11603 11603
 		$sth = $this->db->prepare($query);
11604 11604
 		$sth->execute(array(':registration_2' => $registration_2));
11605 11605
         
11606
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11606
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11607 11607
 		{
11608 11608
 			$registration_prefix = $row['registration_prefix'];
11609 11609
 		}
@@ -11611,11 +11611,11 @@  discard block
 block discarded – undo
11611 11611
 		//if we didn't find a two chracter prefix lets just search the one with one character
11612 11612
 		if ($registration_prefix == '')
11613 11613
 		{
11614
-			$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
11614
+			$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
11615 11615
 			$sth = $this->db->prepare($query);
11616 11616
 			$sth->execute(array(':registration_1' => $registration_1));
11617 11617
 	        
11618
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11618
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11619 11619
 			{
11620 11620
 				$registration_prefix = $row['registration_prefix'];
11621 11621
 			}
@@ -11629,7 +11629,7 @@  discard block
 block discarded – undo
11629 11629
 			} else {
11630 11630
 				$registration = preg_replace("/^(.{1})/", "$1-", $registration);
11631 11631
 			}
11632
-		} else if(strlen($registration_prefix) == 2){
11632
+		} else if (strlen($registration_prefix) == 2) {
11633 11633
 			if (0 === strpos($registration, 'N')) {
11634 11634
 				$registration = preg_replace("/^(.{2})/", "$1", $registration);
11635 11635
 			} else {
@@ -11648,17 +11648,17 @@  discard block
 block discarded – undo
11648 11648
 	*/
11649 11649
 	public function countryFromAircraftRegistration($registration)
11650 11650
 	{
11651
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11651
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11652 11652
 		
11653 11653
 		$registration_prefix = '';
11654
-		$registration_test = explode('-',$registration);
11654
+		$registration_test = explode('-', $registration);
11655 11655
 		$country = '';
11656 11656
 		if ($registration_test[0] != $registration) {
11657 11657
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11658 11658
 	      
11659 11659
 			$sth = $this->db->prepare($query);
11660 11660
 			$sth->execute(array(':registration_1' => $registration_test[0]));
11661
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11661
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11662 11662
 			{
11663 11663
 				//$registration_prefix = $row['registration_prefix'];
11664 11664
 				$country = $row['country'];
@@ -11669,13 +11669,13 @@  discard block
 block discarded – undo
11669 11669
 
11670 11670
 			$country = '';
11671 11671
 			//first get the prefix based on two characters
11672
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11672
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11673 11673
       
11674 11674
 			
11675 11675
 			$sth = $this->db->prepare($query);
11676 11676
 			$sth->execute(array(':registration_2' => $registration_2));
11677 11677
         
11678
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11678
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11679 11679
 			{
11680 11680
 				$registration_prefix = $row['registration_prefix'];
11681 11681
 				$country = $row['country'];
@@ -11684,12 +11684,12 @@  discard block
 block discarded – undo
11684 11684
 			//if we didn't find a two chracter prefix lets just search the one with one character
11685 11685
 			if ($registration_prefix == "")
11686 11686
 			{
11687
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11687
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11688 11688
 	      
11689 11689
 				$sth = $this->db->prepare($query);
11690 11690
 				$sth->execute(array(':registration_1' => $registration_1));
11691 11691
 	        
11692
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
11692
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11693 11693
 				{
11694 11694
 					//$registration_prefix = $row['registration_prefix'];
11695 11695
 					$country = $row['country'];
@@ -11709,17 +11709,17 @@  discard block
 block discarded – undo
11709 11709
 	*/
11710 11710
 	public function registrationPrefixFromAircraftRegistration($registration)
11711 11711
 	{
11712
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11712
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11713 11713
 		
11714 11714
 		$registration_prefix = '';
11715
-		$registration_test = explode('-',$registration);
11715
+		$registration_test = explode('-', $registration);
11716 11716
 		//$country = '';
11717 11717
 		if ($registration_test[0] != $registration) {
11718
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11718
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11719 11719
 	      
11720 11720
 			$sth = $this->db->prepare($query);
11721 11721
 			$sth->execute(array(':registration_1' => $registration_test[0]));
11722
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11722
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11723 11723
 			{
11724 11724
 				$registration_prefix = $row['registration_prefix'];
11725 11725
 				//$country = $row['country'];
@@ -11729,13 +11729,13 @@  discard block
 block discarded – undo
11729 11729
 		        $registration_2 = substr($registration, 0, 2);
11730 11730
 
11731 11731
 			//first get the prefix based on two characters
11732
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11732
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11733 11733
       
11734 11734
 			
11735 11735
 			$sth = $this->db->prepare($query);
11736 11736
 			$sth->execute(array(':registration_2' => $registration_2));
11737 11737
         
11738
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11738
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11739 11739
 			{
11740 11740
 				$registration_prefix = $row['registration_prefix'];
11741 11741
 				//$country = $row['country'];
@@ -11744,12 +11744,12 @@  discard block
 block discarded – undo
11744 11744
 			//if we didn't find a two chracter prefix lets just search the one with one character
11745 11745
 			if ($registration_prefix == "")
11746 11746
 			{
11747
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11747
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11748 11748
 	      
11749 11749
 				$sth = $this->db->prepare($query);
11750 11750
 				$sth->execute(array(':registration_1' => $registration_1));
11751 11751
 	        
11752
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
11752
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11753 11753
 				{
11754 11754
 					$registration_prefix = $row['registration_prefix'];
11755 11755
 					//$country = $row['country'];
@@ -11770,13 +11770,13 @@  discard block
 block discarded – undo
11770 11770
 	*/
11771 11771
 	public function countryFromAircraftRegistrationCode($registration)
11772 11772
 	{
11773
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11773
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11774 11774
 		
11775 11775
 		$country = '';
11776
-		$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1";
11776
+		$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1";
11777 11777
 		$sth = $this->db->prepare($query);
11778 11778
 		$sth->execute(array(':registration' => $registration));
11779
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11779
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11780 11780
 		{
11781 11781
 			$country = $row['country'];
11782 11782
 		}
@@ -11789,9 +11789,9 @@  discard block
 block discarded – undo
11789 11789
 	* @param String $flightaware_id flightaware_id from spotter_output table
11790 11790
 	* @param String $highlight New highlight value
11791 11791
 	*/
11792
-	public function setHighlightFlight($flightaware_id,$highlight) {
11792
+	public function setHighlightFlight($flightaware_id, $highlight) {
11793 11793
 		
11794
-		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
11794
+		$query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
11795 11795
 		$sth = $this->db->prepare($query);
11796 11796
 		$sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight));
11797 11797
 	}
@@ -11803,13 +11803,13 @@  discard block
 block discarded – undo
11803 11803
 	* @param String $date Date of spotted aircraft
11804 11804
 	* @param String $highlight New highlight value
11805 11805
 	*/
11806
-	public function setHighlightFlightByRegistration($registration,$highlight, $date = '') {
11806
+	public function setHighlightFlightByRegistration($registration, $highlight, $date = '') {
11807 11807
 		if ($date == '') {
11808 11808
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)";
11809 11809
 			$query_values = array(':registration' => $registration, ':highlight' => $highlight);
11810 11810
 		} else {
11811 11811
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE registration = :registration AND date(date) = :date";
11812
-			$query_values = array(':registration' => $registration, ':highlight' => $highlight,':date' => $date);
11812
+			$query_values = array(':registration' => $registration, ':highlight' => $highlight, ':date' => $date);
11813 11813
 		}
11814 11814
 		$sth = $this->db->prepare($query);
11815 11815
 		$sth->execute($query_values);
@@ -11839,7 +11839,7 @@  discard block
 block discarded – undo
11839 11839
 		
11840 11840
 		$bitly_data = json_decode($bitly_data);
11841 11841
 		$bitly_url = '';
11842
-		if ($bitly_data->status_txt = "OK"){
11842
+		if ($bitly_data->status_txt = "OK") {
11843 11843
 			$bitly_url = $bitly_data->data->url;
11844 11844
 		}
11845 11845
 
@@ -11849,7 +11849,7 @@  discard block
 block discarded – undo
11849 11849
 
11850 11850
 	public function getOrderBy()
11851 11851
 	{
11852
-		$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"));
11852
+		$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"));
11853 11853
 		
11854 11854
 		return $orderby;
11855 11855
 		
@@ -11983,14 +11983,14 @@  discard block
 block discarded – undo
11983 11983
 		}
11984 11984
 		$sth = $this->db->prepare($query);
11985 11985
 		$sth->execute();
11986
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11986
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11987 11987
 		{
11988 11988
 			$departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']);
11989 11989
 			$arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']);
11990 11990
 			if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) {
11991
-				$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";
11991
+				$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";
11992 11992
 				$sthu = $this->db->prepare($update_query);
11993
-				$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']));
11993
+				$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']));
11994 11994
 			}
11995 11995
 		}
11996 11996
 		
@@ -12003,7 +12003,7 @@  discard block
 block discarded – undo
12003 12003
 		}
12004 12004
 		$sth = $this->db->prepare($query);
12005 12005
 		$sth->execute();
12006
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
12006
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
12007 12007
 		{
12008 12008
 			if (is_numeric(substr($row['ident'], -1, 1)))
12009 12009
 			{
@@ -12012,11 +12012,11 @@  discard block
 block discarded – undo
12012 12012
 				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
12013 12013
 				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
12014 12014
 				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
12015
-				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
12015
+				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
12016 12016
 				if (isset($airline_array[0]['name'])) {
12017
-					$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";
12017
+					$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";
12018 12018
 					$sthu = $this->db->prepare($update_query);
12019
-					$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']));
12019
+					$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']));
12020 12020
 				}
12021 12021
 			}
12022 12022
 		}
@@ -12036,18 +12036,18 @@  discard block
 block discarded – undo
12036 12036
 		}
12037 12037
 		$sth = $this->db->prepare($query);
12038 12038
 		$sth->execute();
12039
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
12039
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
12040 12040
 		{
12041 12041
 			if ($row['aircraft_icao'] != '') {
12042 12042
 				$aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']);
12043
-				if ($row['registration'] != ""){
12043
+				if ($row['registration'] != "") {
12044 12044
 					$image_array = $Image->getSpotterImage($row['registration']);
12045 12045
 					if (!isset($image_array[0]['registration'])) {
12046 12046
 						$Image->addSpotterImage($row['registration']);
12047 12047
 					}
12048 12048
 				}
12049 12049
 				if (count($aircraft_name) > 0) {
12050
-					$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";
12050
+					$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";
12051 12051
 					$sthu = $this->db->prepare($update_query);
12052 12052
 					$sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id']));
12053 12053
 				}
@@ -12062,10 +12062,10 @@  discard block
 block discarded – undo
12062 12062
 		$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";
12063 12063
 		$sth = $this->db->prepare($query);
12064 12064
 		$sth->execute();
12065
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
12065
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
12066 12066
 		{
12067 12067
 			if ($row['last_latitude'] != '' && $row['last_longitude'] != '') {
12068
-				$closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist);
12068
+				$closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist);
12069 12069
 				$airport_icao = '';
12070 12070
 				 if (isset($closestAirports[0])) {
12071 12071
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
@@ -12079,7 +12079,7 @@  discard block
 block discarded – undo
12079 12079
 								break;
12080 12080
 							}
12081 12081
 						}
12082
-					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
12082
+					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) {
12083 12083
 						$airport_icao = $closestAirports[0]['icao'];
12084 12084
 						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";
12085 12085
 					} else {
@@ -12090,28 +12090,28 @@  discard block
 block discarded – undo
12090 12090
 				}
12091 12091
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
12092 12092
 					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
12093
-					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
12093
+					$update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
12094 12094
 					$sthu = $this->db->prepare($update_query);
12095
-					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
12095
+					$sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id']));
12096 12096
 				}
12097 12097
 			}
12098 12098
 		}
12099 12099
 	}
12100 12100
 	
12101
-	public function closestAirports($origLat,$origLon,$dist = 10) {
12101
+	public function closestAirports($origLat, $origLon, $dist = 10) {
12102 12102
 		global $globalDBdriver;
12103
-		$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
12103
+		$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
12104 12104
 /*
12105 12105
 		$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 
12106 12106
                       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)) 
12107 12107
                       having distance < $dist ORDER BY distance limit 100;";
12108 12108
 */
12109 12109
 		if ($globalDBdriver == 'mysql') {
12110
-			$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 
12110
+			$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 
12111 12111
 	                      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)) 
12112 12112
 	                      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;";
12113 12113
                 } else {
12114
-			$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 
12114
+			$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 
12115 12115
 	                      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)) 
12116 12116
 	                      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;";
12117 12117
     		}
Please login to merge, or discard this patch.
Braces   +735 added lines, -257 removed lines patch added patch discarded remove patch
@@ -72,7 +72,9 @@  discard block
 block discarded – undo
72 72
 		if (isset($filter[0]['source'])) {
73 73
 			$filters = array_merge($filters,$filter);
74 74
 		}
75
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
75
+		if (is_array($globalFilter)) {
76
+			$filter = array_merge($filter,$globalFilter);
77
+		}
76 78
 		$filter_query_join = '';
77 79
 		$filter_query_where = '';
78 80
 		foreach($filters as $flt) {
@@ -156,8 +158,11 @@  discard block
 block discarded – undo
156 158
 				$filter_query_where .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'";
157 159
 			}
158 160
 		}
159
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
160
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
161
+		if ($filter_query_where == '' && $where) {
162
+			$filter_query_where = ' WHERE';
163
+		} elseif ($filter_query_where != '' && $and) {
164
+			$filter_query_where .= ' AND';
165
+		}
161 166
 		if ($filter_query_where != '') {
162 167
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
163 168
 		}
@@ -180,10 +185,18 @@  discard block
 block discarded – undo
180 185
 		$Image = new Image($this->db);
181 186
 		$Schedule = new Schedule($this->db);
182 187
 		$ACARS = new ACARS($this->db);
183
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
184
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
185
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
186
-		if (!isset($globalVAM)) $globalVAM = FALSE;
188
+		if (!isset($globalIVAO)) {
189
+			$globalIVAO = FALSE;
190
+		}
191
+		if (!isset($globalVATSIM)) {
192
+			$globalVATSIM = FALSE;
193
+		}
194
+		if (!isset($globalphpVMS)) {
195
+			$globalphpVMS = FALSE;
196
+		}
197
+		if (!isset($globalVAM)) {
198
+			$globalVAM = FALSE;
199
+		}
187 200
 		date_default_timezone_set('UTC');
188 201
 		
189 202
 		if (!is_string($query))
@@ -230,21 +243,35 @@  discard block
 block discarded – undo
230 243
 			} else {
231 244
 				$temp_array['spotter_id'] = '';
232 245
 			}
233
-			if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id'];
234
-			if (isset($row['modes'])) $temp_array['modes'] = $row['modes'];
246
+			if (isset($row['flightaware_id'])) {
247
+				$temp_array['flightaware_id'] = $row['flightaware_id'];
248
+			}
249
+			if (isset($row['modes'])) {
250
+				$temp_array['modes'] = $row['modes'];
251
+			}
235 252
 			$temp_array['ident'] = $row['ident'];
236 253
 			if (isset($row['registration']) && $row['registration'] != '') {
237 254
 				$temp_array['registration'] = $row['registration'];
238 255
 			} elseif (isset($temp_array['modes'])) {
239 256
 				$temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']);
240
-			} else $temp_array['registration'] = '';
241
-			if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao'];
257
+			} else {
258
+				$temp_array['registration'] = '';
259
+			}
260
+			if (isset($row['aircraft_icao'])) {
261
+				$temp_array['aircraft_type'] = $row['aircraft_icao'];
262
+			}
242 263
 			
243 264
 			$temp_array['departure_airport'] = $row['departure_airport_icao'];
244 265
 			$temp_array['arrival_airport'] = $row['arrival_airport_icao'];
245
-			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
246
-			if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude'];
247
-			if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude'];
266
+			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) {
267
+				$temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
268
+			}
269
+			if (isset($row['latitude'])) {
270
+				$temp_array['latitude'] = $row['latitude'];
271
+			}
272
+			if (isset($row['longitude'])) {
273
+				$temp_array['longitude'] = $row['longitude'];
274
+			}
248 275
 			/*
249 276
 			if (Connection->tableExists('countries')) {
250 277
 				$country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']);
@@ -254,8 +281,12 @@  discard block
 block discarded – undo
254 281
 				}
255 282
 			}
256 283
 			*/
257
-			if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints'];
258
-			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
284
+			if (isset($row['waypoints'])) {
285
+				$temp_array['waypoints'] = $row['waypoints'];
286
+			}
287
+			if (isset($row['format_source'])) {
288
+				$temp_array['format_source'] = $row['format_source'];
289
+			}
259 290
 			if (isset($row['route_stop']) && $row['route_stop'] != '') {
260 291
 				$temp_array['route_stop'] = $row['route_stop'];
261 292
 				$allroute = explode(' ',$row['route_stop']);
@@ -271,13 +302,19 @@  discard block
 block discarded – undo
271 302
 					}
272 303
 				}
273 304
 			}
274
-			if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude'];
305
+			if (isset($row['altitude'])) {
306
+				$temp_array['altitude'] = $row['altitude'];
307
+			}
275 308
 			if (isset($row['heading'])) {
276 309
 				$temp_array['heading'] = $row['heading'];
277 310
 				$heading_direction = $this->parseDirection($row['heading']);
278
-				if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
311
+				if (isset($heading_direction[0]['direction_fullname'])) {
312
+					$temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
313
+				}
314
+			}
315
+			if (isset($row['ground_speed'])) {
316
+				$temp_array['ground_speed'] = $row['ground_speed'];
279 317
 			}
280
-			if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed'];
281 318
 			$temp_array['image'] = "";
282 319
 			$temp_array['image_thumbnail'] = "";
283 320
 			$temp_array['image_source'] = "";
@@ -285,7 +322,9 @@  discard block
 block discarded – undo
285 322
  
286 323
 			if (isset($row['highlight'])) {
287 324
 				$temp_array['highlight'] = $row['highlight'];
288
-			} else $temp_array['highlight'] = '';
325
+			} else {
326
+				$temp_array['highlight'] = '';
327
+			}
289 328
 			
290 329
 			if (isset($row['date'])) {
291 330
 				$dateArray = $this->parseDateString($row['date']);
@@ -341,7 +380,9 @@  discard block
 block discarded – undo
341 380
 				
342 381
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
343 382
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
344
-					} else $temp_array['aircraft_shadow'] = 'default.png';
383
+					} else {
384
+						$temp_array['aircraft_shadow'] = 'default.png';
385
+					}
345 386
                                 } else {
346 387
                             		$temp_array['aircraft_shadow'] = 'default.png';
347 388
 					$temp_array['aircraft_name'] = 'N/A';
@@ -349,11 +390,17 @@  discard block
 block discarded – undo
349 390
                             	}
350 391
 			}
351 392
 			$fromsource = NULL;
352
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
353
-			elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
354
-			elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
355
-			elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
356
-			elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
393
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
394
+				$fromsource = $globalAirlinesSource;
395
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
396
+				$fromsource = 'vatsim';
397
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
398
+				$fromsource = 'ivao';
399
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
400
+				$fromsource = 'vatsim';
401
+			} elseif (isset($globalIVAO) && $globalIVAO) {
402
+				$fromsource = 'ivao';
403
+			}
357 404
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
358 405
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
359 406
 					if (is_numeric(substr($row['ident'], 2, 1))) {
@@ -376,12 +423,18 @@  discard block
 block discarded – undo
376 423
 				}
377 424
 			} else {
378 425
 				$temp_array['airline_icao'] = $row['airline_icao'];
379
-				if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata'];
380
-				else $temp_array['airline_iata'] = 'N/A';
426
+				if (isset($row['airline_iata'])) {
427
+					$temp_array['airline_iata'] = $row['airline_iata'];
428
+				} else {
429
+					$temp_array['airline_iata'] = 'N/A';
430
+				}
381 431
 				$temp_array['airline_name'] = $row['airline_name'];
382 432
 				$temp_array['airline_country'] = $row['airline_country'];
383
-				if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign'];
384
-				else $temp_array['airline_callsign'] = 'N/A';
433
+				if (isset($row['airline_callsign'])) {
434
+					$temp_array['airline_callsign'] = $row['airline_callsign'];
435
+				} else {
436
+					$temp_array['airline_callsign'] = 'N/A';
437
+				}
385 438
 				$temp_array['airline_type'] = $row['airline_type'];
386 439
 				if ($temp_array['airline_icao'] != '' && $temp_array['airline_iata'] == 'N/A') {
387 440
 					$airline_array = $this->getAllAirlineInfo($temp_array['airline_icao']);
@@ -408,7 +461,9 @@  discard block
 block discarded – undo
408 461
 			}
409 462
 			if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) {
410 463
 				$owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']);
411
-				if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
464
+				if ($owner_info['owner'] != '') {
465
+					$temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
466
+				}
412 467
 				$temp_array['aircraft_base'] = $owner_info['base'];
413 468
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
414 469
 			}
@@ -416,9 +471,14 @@  discard block
 block discarded – undo
416 471
 			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
417 472
 			{
418 473
 				if ($globalIVAO) {
419
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
420
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
421
-				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
474
+					if (isset($temp_array['airline_icao'])) {
475
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
476
+					} else {
477
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
478
+					}
479
+				} else {
480
+					$image_array = $Image->getSpotterImage($temp_array['registration']);
481
+				}
422 482
 				if (count($image_array) > 0) {
423 483
 					$temp_array['image'] = $image_array[0]['image'];
424 484
 					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -470,7 +530,9 @@  discard block
 block discarded – undo
470 530
 			//if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') {
471 531
 			if ($row['departure_airport_icao'] != '') {
472 532
 				$departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']);
473
-				if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA');
533
+				if (!isset($departure_airport_array[0]['name'])) {
534
+					$departure_airport_array = $this->getAllAirportInfo('NA');
535
+				}
474 536
 			/*
475 537
 			} elseif ($row['departure_airport_name'] != '') {
476 538
 				$temp_array['departure_airport_name'] = $row['departure_airport_name'];
@@ -478,7 +540,9 @@  discard block
 block discarded – undo
478 540
 				$temp_array['departure_airport_country'] = $row['departure_airport_country'];
479 541
 				$temp_array['departure_airport_icao'] = $row['departure_airport_icao'];
480 542
 			*/
481
-			} else $departure_airport_array = $this->getAllAirportInfo('NA');
543
+			} else {
544
+				$departure_airport_array = $this->getAllAirportInfo('NA');
545
+			}
482 546
 			if (isset($departure_airport_array[0]['name'])) {
483 547
 				$temp_array['departure_airport_name'] = $departure_airport_array[0]['name'];
484 548
 				$temp_array['departure_airport_city'] = $departure_airport_array[0]['city'];
@@ -498,8 +562,12 @@  discard block
 block discarded – undo
498 562
 			
499 563
 			if ($row['arrival_airport_icao'] != '') {
500 564
 				$arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']);
501
-				if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA');
502
-			} else $arrival_airport_array = $this->getAllAirportInfo('NA');
565
+				if (count($arrival_airport_array) == 0) {
566
+					$arrival_airport_array = $this->getAllAirportInfo('NA');
567
+				}
568
+			} else {
569
+				$arrival_airport_array = $this->getAllAirportInfo('NA');
570
+			}
503 571
 			if (isset($arrival_airport_array[0]['name'])) {
504 572
 				$temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name'];
505 573
 				$temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city'];
@@ -515,27 +583,45 @@  discard block
 block discarded – undo
515 583
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
516 584
 			}
517 585
 			*/
518
-			if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id'];
519
-			if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name'];
520
-			if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name'];
521
-			if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country'];
522
-			if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance'];
586
+			if (isset($row['pilot_id']) && $row['pilot_id'] != '') {
587
+				$temp_array['pilot_id'] = $row['pilot_id'];
588
+			}
589
+			if (isset($row['pilot_name']) && $row['pilot_name'] != '') {
590
+				$temp_array['pilot_name'] = $row['pilot_name'];
591
+			}
592
+			if (isset($row['source_name']) && $row['source_name'] != '') {
593
+				$temp_array['source_name'] = $row['source_name'];
594
+			}
595
+			if (isset($row['over_country']) && $row['over_country'] != '') {
596
+				$temp_array['over_country'] = $row['over_country'];
597
+			}
598
+			if (isset($row['distance']) && $row['distance'] != '') {
599
+				$temp_array['distance'] = $row['distance'];
600
+			}
523 601
 			if (isset($row['squawk'])) {
524 602
 				$temp_array['squawk'] = $row['squawk'];
525 603
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
526 604
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
527
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
605
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
606
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
607
+					}
528 608
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
529 609
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
530
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
531
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
610
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
611
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
612
+					}
613
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) {
614
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
615
+				}
532 616
 			}
533 617
     			
534 618
 			$temp_array['query_number_rows'] = $num_rows;
535 619
 			
536 620
 			$spotter_array[] = $temp_array;
537 621
 		}
538
-		if ($num_rows == 0) return array();
622
+		if ($num_rows == 0) {
623
+			return array();
624
+		}
539 625
 		$spotter_array[0]['query_number_rows'] = $num_rows;
540 626
 		return $spotter_array;
541 627
 	}	
@@ -568,7 +654,9 @@  discard block
 block discarded – undo
568 654
 				foreach ($q_array as $q_item){
569 655
 					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
570 656
 					$additional_query .= " AND (";
571
-					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
657
+					if (is_int($q_item)) {
658
+						$additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
659
+					}
572 660
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
573 661
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
574 662
 					$additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR ";
@@ -589,7 +677,9 @@  discard block
 block discarded – undo
589 677
 					$additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR ";
590 678
 					$additional_query .= "(spotter_output.ident like '%".$q_item."%') OR ";
591 679
 					$translate = $Translation->ident2icao($q_item);
592
-					if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
680
+					if ($translate != $q_item) {
681
+						$additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
682
+					}
593 683
 					$additional_query .= "(spotter_output.highlight like '%".$q_item."%')";
594 684
 					$additional_query .= ")";
595 685
 				}
@@ -816,7 +906,9 @@  discard block
 block discarded – undo
816 906
 				date_default_timezone_set($globalTimezone);
817 907
 				$datetime = new DateTime();
818 908
 				$offset = $datetime->format('P');
819
-			} else $offset = '+00:00';
909
+			} else {
910
+				$offset = '+00:00';
911
+			}
820 912
 
821 913
 			if ($date_array[1] != "")
822 914
 			{
@@ -848,8 +940,12 @@  discard block
 block discarded – undo
848 940
 			{
849 941
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
850 942
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
851
-			} else $limit_query = "";
852
-		} else $limit_query = "";
943
+			} else {
944
+				$limit_query = "";
945
+			}
946
+		} else {
947
+			$limit_query = "";
948
+		}
853 949
 
854 950
 
855 951
 		if ($sort != "")
@@ -917,8 +1013,12 @@  discard block
 block discarded – undo
917 1013
 			{
918 1014
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
919 1015
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
920
-			} else $limit_query = "";
921
-		} else $limit_query = "";
1016
+			} else {
1017
+				$limit_query = "";
1018
+			}
1019
+		} else {
1020
+			$limit_query = "";
1021
+		}
922 1022
 		
923 1023
 		if ($sort != "")
924 1024
 		{
@@ -1242,7 +1342,9 @@  discard block
 block discarded – undo
1242 1342
 		global $global_query;
1243 1343
 		
1244 1344
 		date_default_timezone_set('UTC');
1245
-		if ($id == '') return array();
1345
+		if ($id == '') {
1346
+			return array();
1347
+		}
1246 1348
 		$additional_query = "spotter_output.spotter_id = :id";
1247 1349
 		$query_values = array(':id' => $id);
1248 1350
 
@@ -1357,8 +1459,11 @@  discard block
 block discarded – undo
1357 1459
 		if ($sort != "")
1358 1460
 		{
1359 1461
 			$search_orderby_array = $this->getOrderBy();
1360
-			if (isset($search_orderby_array[$sort]['sql'])) $orderby_query = $search_orderby_array[$sort]['sql'];
1361
-			else $orderby_query = " ORDER BY spotter_output.date DESC";
1462
+			if (isset($search_orderby_array[$sort]['sql'])) {
1463
+				$orderby_query = $search_orderby_array[$sort]['sql'];
1464
+			} else {
1465
+				$orderby_query = " ORDER BY spotter_output.date DESC";
1466
+			}
1362 1467
 		} else {
1363 1468
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1364 1469
 		}
@@ -1983,7 +2088,9 @@  discard block
 block discarded – undo
1983 2088
 		{
1984 2089
 			$highlight = $row['highlight'];
1985 2090
 		}
1986
-		if (isset($highlight)) return $highlight;
2091
+		if (isset($highlight)) {
2092
+			return $highlight;
2093
+		}
1987 2094
 	}
1988 2095
 
1989 2096
 	
@@ -2011,7 +2118,9 @@  discard block
 block discarded – undo
2011 2118
 		$sth->closeCursor();
2012 2119
 		if (count($row) > 0) {
2013 2120
 			return $row['usage'];
2014
-		} else return '';
2121
+		} else {
2122
+			return '';
2123
+		}
2015 2124
 	}
2016 2125
 
2017 2126
 	/**
@@ -2036,7 +2145,9 @@  discard block
 block discarded – undo
2036 2145
 		$sth->closeCursor();
2037 2146
 		if (count($row) > 0) {
2038 2147
 			return $row['icao'];
2039
-		} else return '';
2148
+		} else {
2149
+			return '';
2150
+		}
2040 2151
 	}
2041 2152
 
2042 2153
 	/**
@@ -2064,7 +2175,9 @@  discard block
 block discarded – undo
2064 2175
 			$airport_longitude = $row['longitude'];
2065 2176
 			$Common = new Common();
2066 2177
 			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
2067
-		} else return '';
2178
+		} else {
2179
+			return '';
2180
+		}
2068 2181
 	}
2069 2182
 	
2070 2183
 	/**
@@ -2176,7 +2289,9 @@  discard block
 block discarded – undo
2176 2289
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2177 2290
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2178 2291
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2179
-		} else return array();
2292
+		} else {
2293
+			return array();
2294
+		}
2180 2295
 		if ($globalDBdriver == 'mysql') {
2181 2296
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
2182 2297
 		} else {
@@ -2211,7 +2326,9 @@  discard block
 block discarded – undo
2211 2326
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2212 2327
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2213 2328
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2214
-		} else return array();
2329
+		} else {
2330
+			return array();
2331
+		}
2215 2332
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2216 2333
 		$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.")";
2217 2334
 		//$query  = "SELECT waypoints.* FROM waypoints";
@@ -2246,7 +2363,9 @@  discard block
 block discarded – undo
2246 2363
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2247 2364
 	{
2248 2365
 		global $globalUseRealAirlines;
2249
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2366
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2367
+			$fromsource = NULL;
2368
+		}
2250 2369
 		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2251 2370
 		if ($airline_icao == 'NA') {
2252 2371
 			$airline_array = array();
@@ -2315,7 +2434,9 @@  discard block
 block discarded – undo
2315 2434
 	public function getAllAirlineInfoByName($airline_name, $fromsource = NULL)
2316 2435
 	{
2317 2436
 		global $globalUseRealAirlines;
2318
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2437
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2438
+			$fromsource = NULL;
2439
+		}
2319 2440
 		$airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING));
2320 2441
 		$query  = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1";
2321 2442
 		$sth = $this->db->prepare($query);
@@ -2331,7 +2452,9 @@  discard block
 block discarded – undo
2331 2452
 			$sth->execute(array(':fromsource' => $fromsource));
2332 2453
 			$row = $sth->fetch(PDO::FETCH_ASSOC);
2333 2454
 			$sth->closeCursor();
2334
-			if ($row['nb'] == 0) $result = $this->getAllAirlineInfoByName($airline_name);
2455
+			if ($row['nb'] == 0) {
2456
+				$result = $this->getAllAirlineInfoByName($airline_name);
2457
+			}
2335 2458
 		}
2336 2459
 		return $result;
2337 2460
 	}
@@ -2394,15 +2517,20 @@  discard block
 block discarded – undo
2394 2517
 				'A320-211' => 'A320',
2395 2518
 				'747-8i' => 'B748',
2396 2519
 				'A380' => 'A388');
2397
-		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2520
+		if (isset($all_aircraft[$aircraft_type])) {
2521
+			return $all_aircraft[$aircraft_type];
2522
+		}
2398 2523
 
2399 2524
 		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2400 2525
 		$aircraft_type = strtoupper($aircraft_type);
2401 2526
 		$sth = $this->db->prepare($query);
2402 2527
 		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2403 2528
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2404
-		if (isset($result[0]['icao'])) return $result[0]['icao'];
2405
-		else return '';
2529
+		if (isset($result[0]['icao'])) {
2530
+			return $result[0]['icao'];
2531
+		} else {
2532
+			return '';
2533
+		}
2406 2534
 	}
2407 2535
 	
2408 2536
 	/**
@@ -2430,11 +2558,15 @@  discard block
 block discarded – undo
2430 2558
 		$sth->closeCursor();
2431 2559
 		if (isset($row['icaotypecode'])) {
2432 2560
 			$icao = $row['icaotypecode'];
2433
-			if (isset($this->aircraft_correct_icaotype[$icao])) $icao = $this->aircraft_correct_icaotype[$icao];
2561
+			if (isset($this->aircraft_correct_icaotype[$icao])) {
2562
+				$icao = $this->aircraft_correct_icaotype[$icao];
2563
+			}
2434 2564
 			return $icao;
2435 2565
 		} elseif ($source_type == 'flarm') {
2436 2566
 			return $this->getAllAircraftType($aircraft_modes);
2437
-		} else  return '';
2567
+		} else {
2568
+			return '';
2569
+		}
2438 2570
 	}
2439 2571
 
2440 2572
 	/**
@@ -2457,7 +2589,9 @@  discard block
 block discarded – undo
2457 2589
 		$sth->closeCursor();
2458 2590
 		if (isset($row['icaotypecode'])) {
2459 2591
 			return $row['icaotypecode'];
2460
-		} else return '';
2592
+		} else {
2593
+			return '';
2594
+		}
2461 2595
 	}
2462 2596
 
2463 2597
 	/**
@@ -2503,7 +2637,9 @@  discard block
 block discarded – undo
2503 2637
 		$sth->closeCursor();
2504 2638
 		if (isset($row['operator_correct'])) {
2505 2639
 			return $row['operator_correct'];
2506
-		} else return $operator;
2640
+		} else {
2641
+			return $operator;
2642
+		}
2507 2643
 	}
2508 2644
 
2509 2645
 	/**
@@ -2516,7 +2652,9 @@  discard block
 block discarded – undo
2516 2652
 	public function getRouteInfo($callsign)
2517 2653
 	{
2518 2654
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2519
-                if ($callsign == '') return array();
2655
+                if ($callsign == '') {
2656
+                	return array();
2657
+                }
2520 2658
 		$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";
2521 2659
 		
2522 2660
 		$sth = $this->db->prepare($query);
@@ -2526,7 +2664,9 @@  discard block
 block discarded – undo
2526 2664
 		$sth->closeCursor();
2527 2665
 		if (count($row) > 0) {
2528 2666
 			return $row;
2529
-		} else return array();
2667
+		} else {
2668
+			return array();
2669
+		}
2530 2670
 	}
2531 2671
 	
2532 2672
 	/**
@@ -2579,7 +2719,9 @@  discard block
 block discarded – undo
2579 2719
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
2580 2720
 			$sth->closeCursor();
2581 2721
 			return $result;
2582
-		} else return array();
2722
+		} else {
2723
+			return array();
2724
+		}
2583 2725
 	}
2584 2726
 	
2585 2727
   
@@ -2738,8 +2880,11 @@  discard block
 block discarded – undo
2738 2880
 		$query .= " ORDER BY spotter_output.source_name ASC";
2739 2881
 
2740 2882
 		$sth = $this->db->prepare($query);
2741
-		if (!empty($query_values)) $sth->execute($query_values);
2742
-		else $sth->execute();
2883
+		if (!empty($query_values)) {
2884
+			$sth->execute($query_values);
2885
+		} else {
2886
+			$sth->execute();
2887
+		}
2743 2888
 
2744 2889
 		$source_array = array();
2745 2890
 		$temp_array = array();
@@ -2772,9 +2917,13 @@  discard block
 block discarded – undo
2772 2917
 								WHERE spotter_output.airline_icao <> '' 
2773 2918
 								ORDER BY spotter_output.airline_name ASC";
2774 2919
 			*/
2775
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2776
-			elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2777
-			elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2920
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2921
+				$forsource = $globalAirlinesSource;
2922
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
2923
+				$forsource = 'vatsim';
2924
+			} elseif (isset($globalIVAO) && $globalIVAO) {
2925
+				$forsource = 'ivao';
2926
+			}
2778 2927
 			if ($forsource === NULL) {
2779 2928
 				$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";
2780 2929
 				$query_data = array();
@@ -2817,9 +2966,13 @@  discard block
 block discarded – undo
2817 2966
 	{
2818 2967
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2819 2968
 		$filter_query = $this->getFilter($filters,true,true);
2820
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2821
-		elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2822
-		elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2969
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2970
+			$forsource = $globalAirlinesSource;
2971
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
2972
+			$forsource = 'vatsim';
2973
+		} elseif (isset($globalIVAO) && $globalIVAO) {
2974
+			$forsource = 'ivao';
2975
+		}
2823 2976
 		if ($forsource === NULL) {
2824 2977
 			$query = "SELECT DISTINCT alliance FROM airlines WHERE alliance IS NOT NULL AND forsource IS NULL ORDER BY alliance ASC";
2825 2978
 			$query_data = array();
@@ -3130,7 +3283,9 @@  discard block
 block discarded – undo
3130 3283
 			date_default_timezone_set($globalTimezone);
3131 3284
 			$datetime = new DateTime();
3132 3285
 			$offset = $datetime->format('P');
3133
-		} else $offset = '+00:00';
3286
+		} else {
3287
+			$offset = '+00:00';
3288
+		}
3134 3289
 		if ($airport_icao == '') {
3135 3290
 			if ($globalDBdriver == 'mysql') {
3136 3291
 				$query = "SELECT COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' GROUP BY departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -3162,7 +3317,9 @@  discard block
 block discarded – undo
3162 3317
 			date_default_timezone_set($globalTimezone);
3163 3318
 			$datetime = new DateTime();
3164 3319
 			$offset = $datetime->format('P');
3165
-		} else $offset = '+00:00';
3320
+		} else {
3321
+			$offset = '+00:00';
3322
+		}
3166 3323
 		if ($airport_icao == '') {
3167 3324
 			if ($globalDBdriver == 'mysql') {
3168 3325
 				$query = "SELECT spotter_output.airline_icao, COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -3195,7 +3352,9 @@  discard block
 block discarded – undo
3195 3352
 			date_default_timezone_set($globalTimezone);
3196 3353
 			$datetime = new DateTime();
3197 3354
 			$offset = $datetime->format('P');
3198
-		} else $offset = '+00:00';
3355
+		} else {
3356
+			$offset = '+00:00';
3357
+		}
3199 3358
 		if ($airport_icao == '') {
3200 3359
 			if ($globalDBdriver == 'mysql') {
3201 3360
 				$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 
@@ -3234,7 +3393,9 @@  discard block
 block discarded – undo
3234 3393
 			date_default_timezone_set($globalTimezone);
3235 3394
 			$datetime = new DateTime();
3236 3395
 			$offset = $datetime->format('P');
3237
-		} else $offset = '+00:00';
3396
+		} else {
3397
+			$offset = '+00:00';
3398
+		}
3238 3399
 		if ($airport_icao == '') {
3239 3400
 			if ($globalDBdriver == 'mysql') {
3240 3401
 				$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 
@@ -3279,7 +3440,9 @@  discard block
 block discarded – undo
3279 3440
 			date_default_timezone_set($globalTimezone);
3280 3441
 			$datetime = new DateTime();
3281 3442
 			$offset = $datetime->format('P');
3282
-		} else $offset = '+00:00';
3443
+		} else {
3444
+			$offset = '+00:00';
3445
+		}
3283 3446
 		if ($airport_icao == '') {
3284 3447
 			if ($globalDBdriver == 'mysql') {
3285 3448
 				$query = "SELECT COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' GROUP BY arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -3314,7 +3477,9 @@  discard block
 block discarded – undo
3314 3477
 			date_default_timezone_set($globalTimezone);
3315 3478
 			$datetime = new DateTime();
3316 3479
 			$offset = $datetime->format('P');
3317
-		} else $offset = '+00:00';
3480
+		} else {
3481
+			$offset = '+00:00';
3482
+		}
3318 3483
 		if ($airport_icao == '') {
3319 3484
 			if ($globalDBdriver == 'mysql') {
3320 3485
 				$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 
@@ -3356,7 +3521,9 @@  discard block
 block discarded – undo
3356 3521
 			date_default_timezone_set($globalTimezone);
3357 3522
 			$datetime = new DateTime();
3358 3523
 			$offset = $datetime->format('P');
3359
-		} else $offset = '+00:00';
3524
+		} else {
3525
+			$offset = '+00:00';
3526
+		}
3360 3527
 		if ($airport_icao == '') {
3361 3528
 			if ($globalDBdriver == 'mysql') {
3362 3529
 				$query = "SELECT spotter_output.airline_icao, COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -3390,7 +3557,9 @@  discard block
 block discarded – undo
3390 3557
 			date_default_timezone_set($globalTimezone);
3391 3558
 			$datetime = new DateTime();
3392 3559
 			$offset = $datetime->format('P');
3393
-		} else $offset = '+00:00';
3560
+		} else {
3561
+			$offset = '+00:00';
3562
+		}
3394 3563
 		if ($airport_icao == '') {
3395 3564
 			if ($globalDBdriver == 'mysql') {
3396 3565
 				$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 
@@ -3438,7 +3607,9 @@  discard block
 block discarded – undo
3438 3607
 			date_default_timezone_set($globalTimezone);
3439 3608
 			$datetime = new DateTime();
3440 3609
 			$offset = $datetime->format('P');
3441
-		} else $offset = '+00:00';
3610
+		} else {
3611
+			$offset = '+00:00';
3612
+		}
3442 3613
 
3443 3614
 		if ($globalDBdriver == 'mysql') {
3444 3615
 			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
@@ -3558,7 +3729,9 @@  discard block
 block discarded – undo
3558 3729
 	*/	
3559 3730
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3560 3731
 	{
3561
-		if ($groundspeed == '') $groundspeed = NULL;
3732
+		if ($groundspeed == '') {
3733
+			$groundspeed = NULL;
3734
+		}
3562 3735
 		$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';
3563 3736
                 $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);
3564 3737
 
@@ -3608,10 +3781,18 @@  discard block
 block discarded – undo
3608 3781
 		$Image = new Image($this->db);
3609 3782
 		$Common = new Common();
3610 3783
 		
3611
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
3612
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
3613
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
3614
-		if (!isset($globalVAM)) $globalVAM = FALSE;
3784
+		if (!isset($globalIVAO)) {
3785
+			$globalIVAO = FALSE;
3786
+		}
3787
+		if (!isset($globalVATSIM)) {
3788
+			$globalVATSIM = FALSE;
3789
+		}
3790
+		if (!isset($globalphpVMS)) {
3791
+			$globalphpVMS = FALSE;
3792
+		}
3793
+		if (!isset($globalVAM)) {
3794
+			$globalVAM = FALSE;
3795
+		}
3615 3796
 		date_default_timezone_set('UTC');
3616 3797
 		
3617 3798
 		//getting the registration
@@ -3624,23 +3805,33 @@  discard block
 block discarded – undo
3624 3805
 				if ($ModeS != '') {
3625 3806
 					$timeelapsed = microtime(true);
3626 3807
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS,$source_type);
3627
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3808
+					if ($globalDebugTimeElapsed) {
3809
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3810
+					}
3628 3811
 				} else {
3629 3812
 					$myhex = explode('-',$flightaware_id);
3630 3813
 					if (count($myhex) > 0) {
3631 3814
 						$timeelapsed = microtime(true);
3632 3815
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0],$source_type);
3633
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3816
+						if ($globalDebugTimeElapsed) {
3817
+							echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3818
+						}
3634 3819
 					}
3635 3820
 				}
3636 3821
 			}
3637 3822
 		}
3638 3823
 		$fromsource = NULL;
3639
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
3640
-		elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim';
3641
-		elseif ($format_source == 'whazzup') $fromsource = 'ivao';
3642
-		elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
3643
-		elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
3824
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
3825
+			$fromsource = $globalAirlinesSource;
3826
+		} elseif ($format_source == 'vatsimtxt') {
3827
+			$fromsource = 'vatsim';
3828
+		} elseif ($format_source == 'whazzup') {
3829
+			$fromsource = 'ivao';
3830
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
3831
+			$fromsource = 'vatsim';
3832
+		} elseif (isset($globalIVAO) && $globalIVAO) {
3833
+			$fromsource = 'ivao';
3834
+		}
3644 3835
 		//getting the airline information
3645 3836
 		if ($ident != "")
3646 3837
 		{
@@ -3664,15 +3855,21 @@  discard block
 block discarded – undo
3664 3855
 					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3665 3856
 						$airline_array = $this->getAllAirlineInfo("NA");
3666 3857
 					}
3667
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3858
+					if ($globalDebugTimeElapsed) {
3859
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3860
+					}
3668 3861
 
3669 3862
 				} else {
3670 3863
 					$timeelapsed = microtime(true);
3671 3864
 					$airline_array = $this->getAllAirlineInfo("NA");
3672
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3865
+					if ($globalDebugTimeElapsed) {
3866
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3867
+					}
3673 3868
 				}
3674 3869
 			}
3675
-		} else $airline_array = array();
3870
+		} else {
3871
+			$airline_array = array();
3872
+		}
3676 3873
 		
3677 3874
 		//getting the aircraft information
3678 3875
 		$aircraft_array = array();
@@ -3686,27 +3883,37 @@  discard block
 block discarded – undo
3686 3883
 				{
3687 3884
 					$timeelapsed = microtime(true);
3688 3885
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3689
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3886
+					if ($globalDebugTimeElapsed) {
3887
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3888
+					}
3690 3889
 				} else {
3691 3890
 					$timeelapsed = microtime(true);
3692 3891
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3693
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3892
+					if ($globalDebugTimeElapsed) {
3893
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3894
+					}
3694 3895
 				}
3695 3896
 			}
3696 3897
 		} else {
3697 3898
 			if ($ModeS != '') {
3698 3899
 				$timeelapsed = microtime(true);
3699 3900
 				$aircraft_icao = $this->getAllAircraftType($ModeS,$source_type);
3700
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3901
+				if ($globalDebugTimeElapsed) {
3902
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3903
+				}
3701 3904
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3702 3905
 				{
3703 3906
 					$timeelapsed = microtime(true);
3704 3907
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3705
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3908
+					if ($globalDebugTimeElapsed) {
3909
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3910
+					}
3706 3911
 				} else {
3707 3912
 					$timeelapsed = microtime(true);
3708 3913
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3709
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3914
+					if ($globalDebugTimeElapsed) {
3915
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3916
+					}
3710 3917
 				}
3711 3918
 			}
3712 3919
 		}
@@ -3722,7 +3929,9 @@  discard block
 block discarded – undo
3722 3929
 			} else {
3723 3930
 				$timeelapsed = microtime(true);
3724 3931
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3725
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3932
+				if ($globalDebugTimeElapsed) {
3933
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3934
+				}
3726 3935
 			}
3727 3936
 		}
3728 3937
 		
@@ -3737,7 +3946,9 @@  discard block
 block discarded – undo
3737 3946
 			} else {
3738 3947
 				$timeelapsed = microtime(true);
3739 3948
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3740
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3949
+				if ($globalDebugTimeElapsed) {
3950
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3951
+				}
3741 3952
 			}
3742 3953
 		}
3743 3954
 
@@ -3771,7 +3982,9 @@  discard block
 block discarded – undo
3771 3982
 			{
3772 3983
 				return false;
3773 3984
 			}
3774
-		} else $altitude = 0;
3985
+		} else {
3986
+			$altitude = 0;
3987
+		}
3775 3988
 		
3776 3989
 		if ($heading != "")
3777 3990
 		{
@@ -3800,7 +4013,9 @@  discard block
 block discarded – undo
3800 4013
 		{
3801 4014
 			$timeelapsed = microtime(true);
3802 4015
 			$image_array = $Image->getSpotterImage($registration);
3803
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4016
+			if ($globalDebugTimeElapsed) {
4017
+				echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4018
+			}
3804 4019
 			if (!isset($image_array[0]['registration']))
3805 4020
 			{
3806 4021
 				//echo "Add image !!!! \n";
@@ -3808,14 +4023,21 @@  discard block
 block discarded – undo
3808 4023
 			}
3809 4024
 			$timeelapsed = microtime(true);
3810 4025
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3811
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3812
-			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
4026
+			if ($globalDebugTimeElapsed) {
4027
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4028
+			}
4029
+			if ($owner_info['owner'] != '') {
4030
+				$aircraft_owner = ucwords(strtolower($owner_info['owner']));
4031
+			}
3813 4032
 		}
3814 4033
     
3815 4034
 		if ($globalIVAO && $aircraft_icao != '')
3816 4035
 		{
3817
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3818
-            		else $airline_icao = '';
4036
+            		if (isset($airline_array[0]['icao'])) {
4037
+            			$airline_icao = $airline_array[0]['icao'];
4038
+            		} else {
4039
+            			$airline_icao = '';
4040
+            		}
3819 4041
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3820 4042
 			if (!isset($image_array[0]['registration']))
3821 4043
 			{
@@ -3860,16 +4082,28 @@  discard block
 block discarded – undo
3860 4082
                 {
3861 4083
                         $arrival_airport_array = $this->getAllAirportInfo('NA');
3862 4084
                 }
3863
-                if ($registration == '') $registration = 'NA';
4085
+                if ($registration == '') {
4086
+                	$registration = 'NA';
4087
+                }
3864 4088
                 if ($latitude == '' && $longitude == '') {
3865 4089
             		$latitude = 0;
3866 4090
             		$longitude = 0;
3867 4091
             	}
3868
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3869
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3870
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3871
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3872
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
4092
+                if ($squawk == '' || $Common->isInteger($squawk) === false) {
4093
+                	$squawk = NULL;
4094
+                }
4095
+                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) {
4096
+                	$verticalrate = NULL;
4097
+                }
4098
+                if ($heading == '' || $Common->isInteger($heading) === false) {
4099
+                	$heading = 0;
4100
+                }
4101
+                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) {
4102
+                	$groundspeed = 0;
4103
+                }
4104
+                if (!isset($aircraft_owner)) {
4105
+                	$aircraft_owner = NULL;
4106
+                }
3873 4107
                 $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) 
3874 4108
                 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)";
3875 4109
 
@@ -3880,9 +4114,13 @@  discard block
 block discarded – undo
3880 4114
 		if ($airline_type == '') {
3881 4115
 			$timeelapsed = microtime(true);
3882 4116
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3883
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4117
+			if ($globalDebugTimeElapsed) {
4118
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
4119
+			}
4120
+		}
4121
+		if ($airline_type == null) {
4122
+			$airline_type = '';
3884 4123
 		}
3885
-		if ($airline_type == null) $airline_type = '';
3886 4124
                 $aircraft_type = $aircraft_array[0]['type'];
3887 4125
                 $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3888 4126
                 $departure_airport_name = $departure_airport_array[0]['name'];
@@ -4046,7 +4284,9 @@  discard block
 block discarded – undo
4046 4284
 			}
4047 4285
 		}
4048 4286
 		$query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
4049
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4287
+		if ($limit) {
4288
+			$query .= " LIMIT 10 OFFSET 0";
4289
+		}
4050 4290
 
4051 4291
 		$sth = $this->db->prepare($query);
4052 4292
 		$sth->execute($query_values);
@@ -4119,7 +4359,9 @@  discard block
 block discarded – undo
4119 4359
 		}
4120 4360
 		
4121 4361
 		$query .= " GROUP BY spotter_output.pilot_id,s.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC";
4122
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4362
+		if ($limit) {
4363
+			$query .= " LIMIT 10 OFFSET 0";
4364
+		}
4123 4365
       
4124 4366
 		
4125 4367
 		$sth = $this->db->prepare($query);
@@ -4163,7 +4405,9 @@  discard block
 block discarded – undo
4163 4405
 			}
4164 4406
 		}
4165 4407
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC";
4166
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4408
+		if ($limit) {
4409
+			$query .= " LIMIT 10 OFFSET 0";
4410
+		}
4167 4411
       
4168 4412
 		
4169 4413
 		$sth = $this->db->prepare($query);
@@ -4239,7 +4483,9 @@  discard block
 block discarded – undo
4239 4483
 			}
4240 4484
 		}
4241 4485
 		$query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
4242
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4486
+		if ($limit) {
4487
+			$query .= " LIMIT 10 OFFSET 0";
4488
+		}
4243 4489
 		
4244 4490
 		$sth = $this->db->prepare($query);
4245 4491
 		$sth->execute($query_values);
@@ -4281,7 +4527,9 @@  discard block
 block discarded – undo
4281 4527
 			}
4282 4528
 		}
4283 4529
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC";
4284
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4530
+		if ($limit) {
4531
+			$query .= " LIMIT 10 OFFSET 0";
4532
+		}
4285 4533
       
4286 4534
 		
4287 4535
 		$sth = $this->db->prepare($query);
@@ -4524,7 +4772,9 @@  discard block
 block discarded – undo
4524 4772
 			date_default_timezone_set($globalTimezone);
4525 4773
 			$datetime = new DateTime($date);
4526 4774
 			$offset = $datetime->format('P');
4527
-		} else $offset = '+00:00';
4775
+		} else {
4776
+			$offset = '+00:00';
4777
+		}
4528 4778
 
4529 4779
 		if ($globalDBdriver == 'mysql') {
4530 4780
 			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
@@ -4572,7 +4822,9 @@  discard block
 block discarded – undo
4572 4822
 			date_default_timezone_set($globalTimezone);
4573 4823
 			$datetime = new DateTime($date);
4574 4824
 			$offset = $datetime->format('P');
4575
-		} else $offset = '+00:00';
4825
+		} else {
4826
+			$offset = '+00:00';
4827
+		}
4576 4828
 		
4577 4829
 		if ($globalDBdriver == 'mysql') {
4578 4830
 			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
@@ -4692,9 +4944,13 @@  discard block
 block discarded – undo
4692 4944
 		$sth = $this->db->prepare($query);
4693 4945
 		$sth->execute($query_values);
4694 4946
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
4695
-		if (is_numeric($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']);
4696
-		elseif ($result[0]['duration'] == '') return 0;
4697
-		else return $result[0]['duration'];
4947
+		if (is_numeric($result[0]['duration'])) {
4948
+			return gmdate('H:i:s',$result[0]['duration']);
4949
+		} elseif ($result[0]['duration'] == '') {
4950
+			return 0;
4951
+		} else {
4952
+			return $result[0]['duration'];
4953
+		}
4698 4954
 	}
4699 4955
 
4700 4956
 	/**
@@ -4783,8 +5039,11 @@  discard block
 block discarded – undo
4783 5039
 		$sth = $this->db->prepare($query);
4784 5040
 		$sth->execute($query_values);
4785 5041
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
4786
-		if (is_int($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']);
4787
-		else return $result[0]['duration'];
5042
+		if (is_int($result[0]['duration'])) {
5043
+			return gmdate('H:i:s',$result[0]['duration']);
5044
+		} else {
5045
+			return $result[0]['duration'];
5046
+		}
4788 5047
 	}
4789 5048
 
4790 5049
 	/**
@@ -4989,7 +5248,9 @@  discard block
 block discarded – undo
4989 5248
 		}
4990 5249
 		$query .= " GROUP BY spotter_output.airline_country, countries.iso3
4991 5250
 					ORDER BY airline_country_count DESC";
4992
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5251
+		if ($limit) {
5252
+			$query .= " LIMIT 10 OFFSET 0";
5253
+		}
4993 5254
       
4994 5255
 		$sth = $this->db->prepare($query);
4995 5256
 		$sth->execute($query_values);
@@ -5018,7 +5279,9 @@  discard block
 block discarded – undo
5018 5279
 		global $globalDBdriver;
5019 5280
 		//$filter_query = $this->getFilter($filters,true,true);
5020 5281
 		$Connection= new Connection($this->db);
5021
-		if (!$Connection->tableExists('countries')) return array();
5282
+		if (!$Connection->tableExists('countries')) {
5283
+			return array();
5284
+		}
5022 5285
 		/*
5023 5286
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
5024 5287
 					FROM countries c, spotter_output s
@@ -5050,7 +5313,9 @@  discard block
 block discarded – undo
5050 5313
 		}
5051 5314
 		$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 ";
5052 5315
 		$query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC";
5053
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5316
+		if ($limit) {
5317
+			$query .= " LIMIT 10 OFFSET 0";
5318
+		}
5054 5319
       
5055 5320
 		
5056 5321
 		$sth = $this->db->prepare($query);
@@ -5127,7 +5392,9 @@  discard block
 block discarded – undo
5127 5392
 		}
5128 5393
 
5129 5394
 		$query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
5130
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5395
+		if ($limit) {
5396
+			$query .= " LIMIT 10 OFFSET 0";
5397
+		}
5131 5398
  
5132 5399
 		$sth = $this->db->prepare($query);
5133 5400
 		$sth->execute($query_values);
@@ -5201,7 +5468,9 @@  discard block
 block discarded – undo
5201 5468
 		}
5202 5469
 
5203 5470
 		$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";
5204
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5471
+		if ($limit) {
5472
+			$query .= " LIMIT 10 OFFSET 0";
5473
+		}
5205 5474
  
5206 5475
 		$sth = $this->db->prepare($query);
5207 5476
 		$sth->execute($query_values);
@@ -5248,7 +5517,9 @@  discard block
 block discarded – undo
5248 5517
 		}
5249 5518
 
5250 5519
 		$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";
5251
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5520
+		if ($limit) {
5521
+			$query .= " LIMIT 10 OFFSET 0";
5522
+		}
5252 5523
  
5253 5524
 		$sth = $this->db->prepare($query);
5254 5525
 		$sth->execute();
@@ -5301,7 +5572,9 @@  discard block
 block discarded – undo
5301 5572
 			if($row['registration'] != "")
5302 5573
 			{
5303 5574
 				$image_array = $Image->getSpotterImage($row['registration']);
5304
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5575
+				if (isset($image_array[0]['image_thumbnail'])) {
5576
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5577
+				}
5305 5578
 			}
5306 5579
 			$temp_array['registration_count'] = $row['registration_count'];
5307 5580
 
@@ -5376,7 +5649,9 @@  discard block
 block discarded – undo
5376 5649
 			if($row['registration'] != "")
5377 5650
 			{
5378 5651
 				$image_array = $Image->getSpotterImage($row['registration']);
5379
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5652
+				if (isset($image_array[0]['image_thumbnail'])) {
5653
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5654
+				}
5380 5655
 			}
5381 5656
 			$temp_array['registration_count'] = $row['registration_count'];
5382 5657
 
@@ -5483,7 +5758,9 @@  discard block
 block discarded – undo
5483 5758
 			if($row['registration'] != "")
5484 5759
 			{
5485 5760
 				$image_array = $Image->getSpotterImage($row['registration']);
5486
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5761
+				if (isset($image_array[0]['image_thumbnail'])) {
5762
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5763
+				}
5487 5764
 			}
5488 5765
 			$temp_array['registration_count'] = $row['registration_count'];
5489 5766
 			$aircraft_array[] = $temp_array;
@@ -5608,7 +5885,9 @@  discard block
 block discarded – undo
5608 5885
 			date_default_timezone_set($globalTimezone);
5609 5886
 			$datetime = new DateTime($date);
5610 5887
 			$offset = $datetime->format('P');
5611
-		} else $offset = '+00:00';
5888
+		} else {
5889
+			$offset = '+00:00';
5890
+		}
5612 5891
 
5613 5892
 		if ($globalDBdriver == 'mysql') {
5614 5893
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
@@ -5655,7 +5934,9 @@  discard block
 block discarded – undo
5655 5934
 			date_default_timezone_set($globalTimezone);
5656 5935
 			$datetime = new DateTime($date);
5657 5936
 			$offset = $datetime->format('P');
5658
-		} else $offset = '+00:00';
5937
+		} else {
5938
+			$offset = '+00:00';
5939
+		}
5659 5940
 
5660 5941
 		if ($globalDBdriver == 'mysql') {
5661 5942
 			$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 
@@ -5684,7 +5965,9 @@  discard block
 block discarded – undo
5684 5965
 			if($row['registration'] != "")
5685 5966
 			{
5686 5967
 				$image_array = $Image->getSpotterImage($row['registration']);
5687
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5968
+				if (isset($image_array[0]['image_thumbnail'])) {
5969
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5970
+				}
5688 5971
 			}
5689 5972
 			$temp_array['registration_count'] = $row['registration_count'];
5690 5973
  
@@ -5709,7 +5992,9 @@  discard block
 block discarded – undo
5709 5992
 			date_default_timezone_set($globalTimezone);
5710 5993
 			$datetime = new DateTime($date);
5711 5994
 			$offset = $datetime->format('P');
5712
-		} else $offset = '+00:00';
5995
+		} else {
5996
+			$offset = '+00:00';
5997
+		}
5713 5998
 
5714 5999
 		if ($globalDBdriver == 'mysql') {
5715 6000
 			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
@@ -5905,8 +6190,11 @@  discard block
 block discarded – undo
5905 6190
 			if($row['registration'] != "")
5906 6191
 			{
5907 6192
 				$image_array = $Image->getSpotterImage($row['registration']);
5908
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5909
-				else $temp_array['image_thumbnail'] = '';
6193
+				if (isset($image_array[0]['image_thumbnail'])) {
6194
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6195
+				} else {
6196
+					$temp_array['image_thumbnail'] = '';
6197
+				}
5910 6198
 			}
5911 6199
 			$temp_array['registration_count'] = $row['registration_count'];
5912 6200
 			$aircraft_array[] = $temp_array;
@@ -5980,8 +6268,11 @@  discard block
 block discarded – undo
5980 6268
 			if($row['registration'] != "")
5981 6269
 			{
5982 6270
 				$image_array = $Image->getSpotterImage($row['registration']);
5983
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5984
-				else $temp_array['image_thumbnail'] = '';
6271
+				if (isset($image_array[0]['image_thumbnail'])) {
6272
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6273
+				} else {
6274
+					$temp_array['image_thumbnail'] = '';
6275
+				}
5985 6276
 			}
5986 6277
 			$temp_array['registration_count'] = $row['registration_count'];
5987 6278
 			$aircraft_array[] = $temp_array;
@@ -6055,8 +6346,11 @@  discard block
 block discarded – undo
6055 6346
 			if($row['registration'] != "")
6056 6347
 			{
6057 6348
 				$image_array = $Image->getSpotterImage($row['registration']);
6058
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6059
-				else $temp_array['image_thumbnail'] = '';
6349
+				if (isset($image_array[0]['image_thumbnail'])) {
6350
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6351
+				} else {
6352
+					$temp_array['image_thumbnail'] = '';
6353
+				}
6060 6354
 			}
6061 6355
 			$temp_array['registration_count'] = $row['registration_count'];
6062 6356
 			$aircraft_array[] = $temp_array;
@@ -6267,7 +6561,9 @@  discard block
 block discarded – undo
6267 6561
 			if($row['registration'] != "")
6268 6562
 			{
6269 6563
 				$image_array = $Image->getSpotterImage($row['registration']);
6270
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6564
+				if (isset($image_array[0]['image_thumbnail'])) {
6565
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6566
+				}
6271 6567
 			}
6272 6568
 			$temp_array['registration_count'] = $row['registration_count'];
6273 6569
           
@@ -6384,7 +6680,9 @@  discard block
 block discarded – undo
6384 6680
 			if($row['registration'] != "")
6385 6681
 			{
6386 6682
 				$image_array = $Image->getSpotterImage($row['registration']);
6387
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6683
+				if (isset($image_array[0]['image_thumbnail'])) {
6684
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6685
+				}
6388 6686
 			}
6389 6687
 			$temp_array['registration_count'] = $row['registration_count'];
6390 6688
           
@@ -6550,7 +6848,9 @@  discard block
 block discarded – undo
6550 6848
 			}
6551 6849
 		}
6552 6850
 		$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
6553
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6851
+		if ($limit) {
6852
+			$query .= " LIMIT 10 OFFSET 0";
6853
+		}
6554 6854
 		
6555 6855
 		$sth = $this->db->prepare($query);
6556 6856
 		$sth->execute($query_values);
@@ -6569,7 +6869,9 @@  discard block
 block discarded – undo
6569 6869
 			if($row['registration'] != "")
6570 6870
 			{
6571 6871
 				$image_array = $Image->getSpotterImage($row['registration']);
6572
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6872
+				if (isset($image_array[0]['image_thumbnail'])) {
6873
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6874
+				}
6573 6875
 			}
6574 6876
           
6575 6877
 			$aircraft_array[] = $temp_array;
@@ -6610,7 +6912,9 @@  discard block
 block discarded – undo
6610 6912
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6611 6913
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6612 6914
                 $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";
6613
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6915
+		if ($limit) {
6916
+			$query .= " LIMIT 10 OFFSET 0";
6917
+		}
6614 6918
 		
6615 6919
 		$sth = $this->db->prepare($query);
6616 6920
 		$sth->execute();
@@ -6630,7 +6934,9 @@  discard block
 block discarded – undo
6630 6934
 			if($row['registration'] != "")
6631 6935
 			{
6632 6936
 				$image_array = $Image->getSpotterImage($row['registration']);
6633
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6937
+				if (isset($image_array[0]['image_thumbnail'])) {
6938
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
6939
+				}
6634 6940
 			}
6635 6941
           
6636 6942
 			$aircraft_array[] = $temp_array;
@@ -6696,7 +7002,9 @@  discard block
 block discarded – undo
6696 7002
 		}
6697 7003
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, airport.latitude, airport.longitude
6698 7004
 				ORDER BY airport_departure_icao_count DESC";
6699
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7005
+		if ($limit) {
7006
+			$query .= " LIMIT 10 OFFSET 0";
7007
+		}
6700 7008
 
6701 7009
 		$sth = $this->db->prepare($query);
6702 7010
 		$sth->execute($query_values);
@@ -6748,7 +7056,9 @@  discard block
 block discarded – undo
6748 7056
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6749 7057
                 $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
6750 7058
 				ORDER BY airport_departure_icao_count DESC";
6751
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7059
+		if ($limit) {
7060
+			$query .= " LIMIT 10 OFFSET 0";
7061
+		}
6752 7062
       
6753 7063
 		$sth = $this->db->prepare($query);
6754 7064
 		$sth->execute();
@@ -6826,7 +7136,9 @@  discard block
 block discarded – undo
6826 7136
 		}
6827 7137
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country, airport.latitude, airport.longitude
6828 7138
 				ORDER BY airport_departure_icao_count DESC";
6829
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7139
+		if ($limit) {
7140
+			$query .= " LIMIT 10 OFFSET 0";
7141
+		}
6830 7142
     		//echo $query;
6831 7143
 		$sth = $this->db->prepare($query);
6832 7144
 		$sth->execute($query_values);
@@ -6880,7 +7192,9 @@  discard block
 block discarded – undo
6880 7192
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6881 7193
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6882 7194
 				ORDER BY airport_departure_icao_count DESC";
6883
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7195
+		if ($limit) {
7196
+			$query .= " LIMIT 10 OFFSET 0";
7197
+		}
6884 7198
       
6885 7199
 		$sth = $this->db->prepare($query);
6886 7200
 		$sth->execute();
@@ -7275,7 +7589,9 @@  discard block
 block discarded – undo
7275 7589
 			date_default_timezone_set($globalTimezone);
7276 7590
 			$datetime = new DateTime($date);
7277 7591
 			$offset = $datetime->format('P');
7278
-		} else $offset = '+00:00';
7592
+		} else {
7593
+			$offset = '+00:00';
7594
+		}
7279 7595
 
7280 7596
 		if ($globalDBdriver == 'mysql') {
7281 7597
 			$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 
@@ -7325,7 +7641,9 @@  discard block
 block discarded – undo
7325 7641
 			date_default_timezone_set($globalTimezone);
7326 7642
 			$datetime = new DateTime($date);
7327 7643
 			$offset = $datetime->format('P');
7328
-		} else $offset = '+00:00';
7644
+		} else {
7645
+			$offset = '+00:00';
7646
+		}
7329 7647
 
7330 7648
 		if ($globalDBdriver == 'mysql') {
7331 7649
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
@@ -7674,7 +7992,9 @@  discard block
 block discarded – undo
7674 7992
 		}
7675 7993
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, airport.latitude, airport.longitude
7676 7994
 					ORDER BY airport_arrival_icao_count DESC";
7677
-		if ($limit) $query .= " LIMIT 10";
7995
+		if ($limit) {
7996
+			$query .= " LIMIT 10";
7997
+		}
7678 7998
       
7679 7999
 		
7680 8000
 		$sth = $this->db->prepare($query);
@@ -7696,7 +8016,9 @@  discard block
 block discarded – undo
7696 8016
 			if ($icaoaskey) {
7697 8017
 				$icao = $row['arrival_airport_icao'];
7698 8018
 				$airport_array[$icao] = $temp_array;
7699
-			} else $airport_array[] = $temp_array;
8019
+			} else {
8020
+				$airport_array[] = $temp_array;
8021
+			}
7700 8022
 		}
7701 8023
 
7702 8024
 		return $airport_array;
@@ -7733,7 +8055,9 @@  discard block
 block discarded – undo
7733 8055
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7734 8056
                 $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
7735 8057
 					ORDER BY airport_arrival_icao_count DESC";
7736
-		if ($limit) $query .= " LIMIT 10";
8058
+		if ($limit) {
8059
+			$query .= " LIMIT 10";
8060
+		}
7737 8061
       
7738 8062
 		
7739 8063
 		$sth = $this->db->prepare($query);
@@ -7754,7 +8078,9 @@  discard block
 block discarded – undo
7754 8078
 			if ($icaoaskey) {
7755 8079
 				$icao = $row['arrival_airport_icao'];
7756 8080
 				$airport_array[$icao] = $temp_array;
7757
-			} else $airport_array[] = $temp_array;
8081
+			} else {
8082
+				$airport_array[] = $temp_array;
8083
+			}
7758 8084
 		}
7759 8085
 
7760 8086
 		return $airport_array;
@@ -7817,7 +8143,9 @@  discard block
 block discarded – undo
7817 8143
 		}
7818 8144
 		$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country, airport.latitude, airport.longitude
7819 8145
 					ORDER BY airport_arrival_icao_count DESC";
7820
-		if ($limit) $query .= " LIMIT 10";
8146
+		if ($limit) {
8147
+			$query .= " LIMIT 10";
8148
+		}
7821 8149
       
7822 8150
 		
7823 8151
 		$sth = $this->db->prepare($query);
@@ -7836,7 +8164,9 @@  discard block
 block discarded – undo
7836 8164
 			if ($icaoaskey) {
7837 8165
 				$icao = $row['arrival_airport_icao'];
7838 8166
 				$airport_array[$icao] = $temp_array;
7839
-			} else $airport_array[] = $temp_array;
8167
+			} else {
8168
+				$airport_array[] = $temp_array;
8169
+			}
7840 8170
 		}
7841 8171
 
7842 8172
 		return $airport_array;
@@ -7873,7 +8203,9 @@  discard block
 block discarded – undo
7873 8203
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7874 8204
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7875 8205
 					ORDER BY airport_arrival_icao_count DESC";
7876
-		if ($limit) $query .= " LIMIT 10";
8206
+		if ($limit) {
8207
+			$query .= " LIMIT 10";
8208
+		}
7877 8209
       
7878 8210
 		
7879 8211
 		$sth = $this->db->prepare($query);
@@ -7894,7 +8226,9 @@  discard block
 block discarded – undo
7894 8226
 			if ($icaoaskey) {
7895 8227
 				$icao = $row['arrival_airport_icao'];
7896 8228
 				$airport_array[$icao] = $temp_array;
7897
-			} else $airport_array[] = $temp_array;
8229
+			} else {
8230
+				$airport_array[] = $temp_array;
8231
+			}
7898 8232
 		}
7899 8233
 
7900 8234
 		return $airport_array;
@@ -8275,7 +8609,9 @@  discard block
 block discarded – undo
8275 8609
 			date_default_timezone_set($globalTimezone);
8276 8610
 			$datetime = new DateTime($date);
8277 8611
 			$offset = $datetime->format('P');
8278
-		} else $offset = '+00:00';
8612
+		} else {
8613
+			$offset = '+00:00';
8614
+		}
8279 8615
 
8280 8616
 		if ($globalDBdriver == 'mysql') {
8281 8617
 			$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 
@@ -8325,7 +8661,9 @@  discard block
 block discarded – undo
8325 8661
 			date_default_timezone_set($globalTimezone);
8326 8662
 			$datetime = new DateTime($date);
8327 8663
 			$offset = $datetime->format('P');
8328
-		} else $offset = '+00:00';
8664
+		} else {
8665
+			$offset = '+00:00';
8666
+		}
8329 8667
 
8330 8668
 		if ($globalDBdriver == 'mysql') {
8331 8669
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
@@ -8716,7 +9054,9 @@  discard block
 block discarded – undo
8716 9054
 		}
8717 9055
 		$query .= " GROUP BY spotter_output.arrival_airport_country, countries.iso3
8718 9056
 					ORDER BY airport_arrival_country_count DESC";
8719
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
9057
+		if ($limit) {
9058
+			$query .= " LIMIT 10 OFFSET 0";
9059
+		}
8720 9060
       
8721 9061
 		
8722 9062
 		$sth = $this->db->prepare($query);
@@ -9004,7 +9344,9 @@  discard block
 block discarded – undo
9004 9344
 			date_default_timezone_set($globalTimezone);
9005 9345
 			$datetime = new DateTime($date);
9006 9346
 			$offset = $datetime->format('P');
9007
-		} else $offset = '+00:00';
9347
+		} else {
9348
+			$offset = '+00:00';
9349
+		}
9008 9350
 		
9009 9351
 		if ($globalDBdriver == 'mysql') {
9010 9352
 			$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
@@ -9260,12 +9602,18 @@  discard block
 block discarded – undo
9260 9602
 		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
9261 9603
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
9262 9604
 		 if ($olderthanmonths > 0) {
9263
-			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
9264
-			else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
9605
+			if ($globalDBdriver == 'mysql') {
9606
+				$query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
9607
+			} else {
9608
+				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
9609
+			}
9265 9610
 		}
9266 9611
 		if ($sincedate != '') {
9267
-			if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'";
9268
-			else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
9612
+			if ($globalDBdriver == 'mysql') {
9613
+				$query .= " AND spotter_output.date > '".$sincedate."'";
9614
+			} else {
9615
+				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
9616
+			}
9269 9617
 		}
9270 9618
 		$query_values = array();
9271 9619
 		if ($year != '') {
@@ -9296,7 +9644,9 @@  discard block
 block discarded – undo
9296 9644
 			}
9297 9645
 		}
9298 9646
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
9299
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
9647
+		if ($limit) {
9648
+			$query .= " LIMIT 10 OFFSET 0";
9649
+		}
9300 9650
       		
9301 9651
 		$sth = $this->db->prepare($query);
9302 9652
 		$sth->execute($query_values);
@@ -9330,15 +9680,23 @@  discard block
 block discarded – undo
9330 9680
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
9331 9681
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
9332 9682
 		 if ($olderthanmonths > 0) {
9333
-			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
9334
-			else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
9683
+			if ($globalDBdriver == 'mysql') {
9684
+				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
9685
+			} else {
9686
+				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
9687
+			}
9335 9688
 		}
9336 9689
 		if ($sincedate != '') {
9337
-			if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' ";
9338
-			else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
9690
+			if ($globalDBdriver == 'mysql') {
9691
+				$query .= "AND spotter_output.date > '".$sincedate."' ";
9692
+			} else {
9693
+				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
9694
+			}
9339 9695
 		}
9340 9696
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
9341
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
9697
+		if ($limit) {
9698
+			$query .= " LIMIT 10 OFFSET 0";
9699
+		}
9342 9700
       		
9343 9701
 		$sth = $this->db->prepare($query);
9344 9702
 		$sth->execute();
@@ -9375,7 +9733,9 @@  discard block
 block discarded – undo
9375 9733
 			date_default_timezone_set($globalTimezone);
9376 9734
 			$datetime = new DateTime();
9377 9735
 			$offset = $datetime->format('P');
9378
-		} else $offset = '+00:00';
9736
+		} else {
9737
+			$offset = '+00:00';
9738
+		}
9379 9739
 
9380 9740
 		if ($globalDBdriver == 'mysql') {
9381 9741
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9424,7 +9784,9 @@  discard block
 block discarded – undo
9424 9784
 			date_default_timezone_set($globalTimezone);
9425 9785
 			$datetime = new DateTime();
9426 9786
 			$offset = $datetime->format('P');
9427
-		} else $offset = '+00:00';
9787
+		} else {
9788
+			$offset = '+00:00';
9789
+		}
9428 9790
 		$filter_query = $this->getFilter($filters,true,true);
9429 9791
 		if ($globalDBdriver == 'mysql') {
9430 9792
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9473,7 +9835,9 @@  discard block
 block discarded – undo
9473 9835
 			date_default_timezone_set($globalTimezone);
9474 9836
 			$datetime = new DateTime();
9475 9837
 			$offset = $datetime->format('P');
9476
-		} else $offset = '+00:00';
9838
+		} else {
9839
+			$offset = '+00:00';
9840
+		}
9477 9841
 		$filter_query = $this->getFilter($filters,true,true);
9478 9842
 		if ($globalDBdriver == 'mysql') {
9479 9843
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9519,7 +9883,9 @@  discard block
 block discarded – undo
9519 9883
 			date_default_timezone_set($globalTimezone);
9520 9884
 			$datetime = new DateTime();
9521 9885
 			$offset = $datetime->format('P');
9522
-		} else $offset = '+00:00';
9886
+		} else {
9887
+			$offset = '+00:00';
9888
+		}
9523 9889
 		$filter_query = $this->getFilter($filters,true,true);
9524 9890
 		if ($globalDBdriver == 'mysql') {
9525 9891
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9567,7 +9933,9 @@  discard block
 block discarded – undo
9567 9933
 			date_default_timezone_set($globalTimezone);
9568 9934
 			$datetime = new DateTime();
9569 9935
 			$offset = $datetime->format('P');
9570
-		} else $offset = '+00:00';
9936
+		} else {
9937
+			$offset = '+00:00';
9938
+		}
9571 9939
 		
9572 9940
 		if ($globalDBdriver == 'mysql') {
9573 9941
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -9615,7 +9983,9 @@  discard block
 block discarded – undo
9615 9983
 			date_default_timezone_set($globalTimezone);
9616 9984
 			$datetime = new DateTime();
9617 9985
 			$offset = $datetime->format('P');
9618
-		} else $offset = '+00:00';
9986
+		} else {
9987
+			$offset = '+00:00';
9988
+		}
9619 9989
 
9620 9990
 		if ($globalDBdriver == 'mysql') {
9621 9991
 			$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
@@ -9662,7 +10032,9 @@  discard block
 block discarded – undo
9662 10032
 			date_default_timezone_set($globalTimezone);
9663 10033
 			$datetime = new DateTime();
9664 10034
 			$offset = $datetime->format('P');
9665
-		} else $offset = '+00:00';
10035
+		} else {
10036
+			$offset = '+00:00';
10037
+		}
9666 10038
 
9667 10039
 		if ($globalDBdriver == 'mysql') {
9668 10040
 			$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
@@ -9710,7 +10082,9 @@  discard block
 block discarded – undo
9710 10082
 			date_default_timezone_set($globalTimezone);
9711 10083
 			$datetime = new DateTime();
9712 10084
 			$offset = $datetime->format('P');
9713
-		} else $offset = '+00:00';
10085
+		} else {
10086
+			$offset = '+00:00';
10087
+		}
9714 10088
 		$filter_query = $this->getFilter($filters,true,true);
9715 10089
 		if ($globalDBdriver == 'mysql') {
9716 10090
 			$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
@@ -9755,7 +10129,9 @@  discard block
 block discarded – undo
9755 10129
 			date_default_timezone_set($globalTimezone);
9756 10130
 			$datetime = new DateTime();
9757 10131
 			$offset = $datetime->format('P');
9758
-		} else $offset = '+00:00';
10132
+		} else {
10133
+			$offset = '+00:00';
10134
+		}
9759 10135
 		$filter_query = $this->getFilter($filters,true,true);
9760 10136
 
9761 10137
 		if ($globalDBdriver == 'mysql') {
@@ -9802,7 +10178,9 @@  discard block
 block discarded – undo
9802 10178
 			date_default_timezone_set($globalTimezone);
9803 10179
 			$datetime = new DateTime();
9804 10180
 			$offset = $datetime->format('P');
9805
-		} else $offset = '+00:00';
10181
+		} else {
10182
+			$offset = '+00:00';
10183
+		}
9806 10184
 
9807 10185
 		if ($globalDBdriver == 'mysql') {
9808 10186
 			$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
@@ -9848,7 +10226,9 @@  discard block
 block discarded – undo
9848 10226
 			date_default_timezone_set($globalTimezone);
9849 10227
 			$datetime = new DateTime();
9850 10228
 			$offset = $datetime->format('P');
9851
-		} else $offset = '+00:00';
10229
+		} else {
10230
+			$offset = '+00:00';
10231
+		}
9852 10232
 		$filter_query = $this->getFilter($filters,true,true);
9853 10233
 
9854 10234
 		if ($globalDBdriver == 'mysql') {
@@ -9895,7 +10275,9 @@  discard block
 block discarded – undo
9895 10275
 			date_default_timezone_set($globalTimezone);
9896 10276
 			$datetime = new DateTime();
9897 10277
 			$offset = $datetime->format('P');
9898
-		} else $offset = '+00:00';
10278
+		} else {
10279
+			$offset = '+00:00';
10280
+		}
9899 10281
 
9900 10282
 		if ($globalDBdriver == 'mysql') {
9901 10283
 			$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
@@ -9942,7 +10324,9 @@  discard block
 block discarded – undo
9942 10324
 			date_default_timezone_set($globalTimezone);
9943 10325
 			$datetime = new DateTime();
9944 10326
 			$offset = $datetime->format('P');
9945
-		} else $offset = '+00:00';
10327
+		} else {
10328
+			$offset = '+00:00';
10329
+		}
9946 10330
 
9947 10331
 		if ($globalDBdriver == 'mysql') {
9948 10332
 			$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
@@ -9987,7 +10371,9 @@  discard block
 block discarded – undo
9987 10371
 			date_default_timezone_set($globalTimezone);
9988 10372
 			$datetime = new DateTime();
9989 10373
 			$offset = $datetime->format('P');
9990
-		} else $offset = '+00:00';
10374
+		} else {
10375
+			$offset = '+00:00';
10376
+		}
9991 10377
 		$filter_query = $this->getFilter($filters,true,true);
9992 10378
 
9993 10379
 		if ($globalDBdriver == 'mysql') {
@@ -10035,7 +10421,9 @@  discard block
 block discarded – undo
10035 10421
 			date_default_timezone_set($globalTimezone);
10036 10422
 			$datetime = new DateTime();
10037 10423
 			$offset = $datetime->format('P');
10038
-		} else $offset = '+00:00';
10424
+		} else {
10425
+			$offset = '+00:00';
10426
+		}
10039 10427
 
10040 10428
 		if ($globalDBdriver == 'mysql') {
10041 10429
 			$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
@@ -10081,7 +10469,9 @@  discard block
 block discarded – undo
10081 10469
 			date_default_timezone_set($globalTimezone);
10082 10470
 			$datetime = new DateTime();
10083 10471
 			$offset = $datetime->format('P');
10084
-		} else $offset = '+00:00';
10472
+		} else {
10473
+			$offset = '+00:00';
10474
+		}
10085 10475
 		$filter_query = $this->getFilter($filters,true,true);
10086 10476
 
10087 10477
 		if ($globalDBdriver == 'mysql') {
@@ -10129,7 +10519,9 @@  discard block
 block discarded – undo
10129 10519
 			date_default_timezone_set($globalTimezone);
10130 10520
 			$datetime = new DateTime();
10131 10521
 			$offset = $datetime->format('P');
10132
-		} else $offset = '+00:00';
10522
+		} else {
10523
+			$offset = '+00:00';
10524
+		}
10133 10525
 
10134 10526
 		if ($globalDBdriver == 'mysql') {
10135 10527
 			$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
@@ -10176,7 +10568,9 @@  discard block
 block discarded – undo
10176 10568
 			date_default_timezone_set($globalTimezone);
10177 10569
 			$datetime = new DateTime();
10178 10570
 			$offset = $datetime->format('P');
10179
-		} else $offset = '+00:00';
10571
+		} else {
10572
+			$offset = '+00:00';
10573
+		}
10180 10574
 		$filter_query = $this->getFilter($filters,true,true);
10181 10575
 		if ($globalDBdriver == 'mysql') {
10182 10576
 			$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
@@ -10225,7 +10619,9 @@  discard block
 block discarded – undo
10225 10619
 			date_default_timezone_set($globalTimezone);
10226 10620
 			$datetime = new DateTime();
10227 10621
 			$offset = $datetime->format('P');
10228
-		} else $offset = '+00:00';
10622
+		} else {
10623
+			$offset = '+00:00';
10624
+		}
10229 10625
 
10230 10626
 		$orderby_sql = '';
10231 10627
 		if ($orderby == "hour")
@@ -10291,7 +10687,9 @@  discard block
 block discarded – undo
10291 10687
 			date_default_timezone_set($globalTimezone);
10292 10688
 			$datetime = new DateTime();
10293 10689
 			$offset = $datetime->format('P');
10294
-		} else $offset = '+00:00';
10690
+		} else {
10691
+			$offset = '+00:00';
10692
+		}
10295 10693
 
10296 10694
 		$orderby_sql = '';
10297 10695
 		if ($orderby == "hour")
@@ -10358,7 +10756,9 @@  discard block
 block discarded – undo
10358 10756
 			date_default_timezone_set($globalTimezone);
10359 10757
 			$datetime = new DateTime();
10360 10758
 			$offset = $datetime->format('P');
10361
-		} else $offset = '+00:00';
10759
+		} else {
10760
+			$offset = '+00:00';
10761
+		}
10362 10762
 
10363 10763
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
10364 10764
 
@@ -10409,7 +10809,9 @@  discard block
 block discarded – undo
10409 10809
 			date_default_timezone_set($globalTimezone);
10410 10810
 			$datetime = new DateTime();
10411 10811
 			$offset = $datetime->format('P');
10412
-		} else $offset = '+00:00';
10812
+		} else {
10813
+			$offset = '+00:00';
10814
+		}
10413 10815
 
10414 10816
 		if ($globalDBdriver == 'mysql') {
10415 10817
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10456,7 +10858,9 @@  discard block
 block discarded – undo
10456 10858
 			date_default_timezone_set($globalTimezone);
10457 10859
 			$datetime = new DateTime();
10458 10860
 			$offset = $datetime->format('P');
10459
-		} else $offset = '+00:00';
10861
+		} else {
10862
+			$offset = '+00:00';
10863
+		}
10460 10864
 
10461 10865
 		if ($globalDBdriver == 'mysql') {
10462 10866
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10503,7 +10907,9 @@  discard block
 block discarded – undo
10503 10907
 			date_default_timezone_set($globalTimezone);
10504 10908
 			$datetime = new DateTime();
10505 10909
 			$offset = $datetime->format('P');
10506
-		} else $offset = '+00:00';
10910
+		} else {
10911
+			$offset = '+00:00';
10912
+		}
10507 10913
 
10508 10914
 		if ($globalDBdriver == 'mysql') {
10509 10915
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10551,7 +10957,9 @@  discard block
 block discarded – undo
10551 10957
 			date_default_timezone_set($globalTimezone);
10552 10958
 			$datetime = new DateTime();
10553 10959
 			$offset = $datetime->format('P');
10554
-		} else $offset = '+00:00';
10960
+		} else {
10961
+			$offset = '+00:00';
10962
+		}
10555 10963
 
10556 10964
 		if ($globalDBdriver == 'mysql') {
10557 10965
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10599,7 +11007,9 @@  discard block
 block discarded – undo
10599 11007
 			date_default_timezone_set($globalTimezone);
10600 11008
 			$datetime = new DateTime($date);
10601 11009
 			$offset = $datetime->format('P');
10602
-		} else $offset = '+00:00';
11010
+		} else {
11011
+			$offset = '+00:00';
11012
+		}
10603 11013
 
10604 11014
 		if ($globalDBdriver == 'mysql') {
10605 11015
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10647,7 +11057,9 @@  discard block
 block discarded – undo
10647 11057
 			date_default_timezone_set($globalTimezone);
10648 11058
 			$datetime = new DateTime();
10649 11059
 			$offset = $datetime->format('P');
10650
-		} else $offset = '+00:00';
11060
+		} else {
11061
+			$offset = '+00:00';
11062
+		}
10651 11063
 
10652 11064
 		if ($globalDBdriver == 'mysql') {
10653 11065
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10694,7 +11106,9 @@  discard block
 block discarded – undo
10694 11106
 			date_default_timezone_set($globalTimezone);
10695 11107
 			$datetime = new DateTime();
10696 11108
 			$offset = $datetime->format('P');
10697
-		} else $offset = '+00:00';
11109
+		} else {
11110
+			$offset = '+00:00';
11111
+		}
10698 11112
 
10699 11113
 		if ($globalDBdriver == 'mysql') {
10700 11114
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10741,7 +11155,9 @@  discard block
 block discarded – undo
10741 11155
 			date_default_timezone_set($globalTimezone);
10742 11156
 			$datetime = new DateTime();
10743 11157
 			$offset = $datetime->format('P');
10744
-		} else $offset = '+00:00';
11158
+		} else {
11159
+			$offset = '+00:00';
11160
+		}
10745 11161
 
10746 11162
 		if ($globalDBdriver == 'mysql') {
10747 11163
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10791,7 +11207,9 @@  discard block
 block discarded – undo
10791 11207
 			date_default_timezone_set($globalTimezone);
10792 11208
 			$datetime = new DateTime();
10793 11209
 			$offset = $datetime->format('P');
10794
-		} else $offset = '+00:00';
11210
+		} else {
11211
+			$offset = '+00:00';
11212
+		}
10795 11213
 
10796 11214
 		if ($globalDBdriver == 'mysql') {
10797 11215
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -10838,7 +11256,9 @@  discard block
 block discarded – undo
10838 11256
 			date_default_timezone_set($globalTimezone);
10839 11257
 			$datetime = new DateTime();
10840 11258
 			$offset = $datetime->format('P');
10841
-		} else $offset = '+00:00';
11259
+		} else {
11260
+			$offset = '+00:00';
11261
+		}
10842 11262
 
10843 11263
 		if ($globalDBdriver == 'mysql') {
10844 11264
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -11049,8 +11469,11 @@  discard block
 block discarded – undo
11049 11469
 				$query_values = array_merge($query_values,array(':month' => $month));
11050 11470
 			}
11051 11471
 		}
11052
-		if (empty($query_values)) $queryi .= $this->getFilter($filters);
11053
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11472
+		if (empty($query_values)) {
11473
+			$queryi .= $this->getFilter($filters);
11474
+		} else {
11475
+			$queryi .= $this->getFilter($filters,true,true).substr($query,4);
11476
+		}
11054 11477
 		
11055 11478
 		$sth = $this->db->prepare($queryi);
11056 11479
 		$sth->execute($query_values);
@@ -11128,8 +11551,11 @@  discard block
 block discarded – undo
11128 11551
 				$query_values = array_merge($query_values,array(':month' => $month));
11129 11552
 			}
11130 11553
 		}
11131
-                if ($query == '') $queryi .= $this->getFilter($filters);
11132
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11554
+                if ($query == '') {
11555
+                	$queryi .= $this->getFilter($filters);
11556
+                } else {
11557
+                	$queryi .= $this->getFilter($filters,true,true).substr($query,4);
11558
+                }
11133 11559
 
11134 11560
 
11135 11561
 		$sth = $this->db->prepare($queryi);
@@ -11152,7 +11578,9 @@  discard block
 block discarded – undo
11152 11578
 			date_default_timezone_set($globalTimezone);
11153 11579
 			$datetime = new DateTime();
11154 11580
 			$offset = $datetime->format('P');
11155
-		} else $offset = '+00:00';
11581
+		} else {
11582
+			$offset = '+00:00';
11583
+		}
11156 11584
 
11157 11585
 		if ($globalDBdriver == 'mysql') {
11158 11586
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -11338,7 +11766,9 @@  discard block
 block discarded – undo
11338 11766
 	*/
11339 11767
 	public function parseDirection($direction = 0)
11340 11768
 	{
11341
-		if ($direction == '') $direction = 0;
11769
+		if ($direction == '') {
11770
+			$direction = 0;
11771
+		}
11342 11772
 		$direction_array = array();
11343 11773
 		$temp_array = array();
11344 11774
 
@@ -11439,7 +11869,9 @@  discard block
 block discarded – undo
11439 11869
 		if (isset($result->AirlineFlightInfoResult))
11440 11870
 		{
11441 11871
 			$registration = $result->AirlineFlightInfoResult->tailnumber;
11442
-		} else return '';
11872
+		} else {
11873
+			return '';
11874
+		}
11443 11875
 		
11444 11876
 		$registration = $this->convertAircraftRegistration($registration);
11445 11877
 		
@@ -11473,7 +11905,9 @@  discard block
 block discarded – undo
11473 11905
 		    return $row['registration'];
11474 11906
 		} elseif ($source_type == 'flarm') {
11475 11907
 			return $this->getAircraftRegistrationBymodeS($aircraft_modes);
11476
-		} else return '';
11908
+		} else {
11909
+			return '';
11910
+		}
11477 11911
 	
11478 11912
 	}
11479 11913
 
@@ -11500,11 +11934,16 @@  discard block
 block discarded – undo
11500 11934
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
11501 11935
 		$sth->closeCursor();
11502 11936
 		if (count($row) > 0) {
11503
-			if ($row['type_flight'] == null) return '';
11504
-			else return $row['type_flight'];
11937
+			if ($row['type_flight'] == null) {
11938
+				return '';
11939
+			} else {
11940
+				return $row['type_flight'];
11941
+			}
11505 11942
 		} elseif ($source_type == 'flarm') {
11506 11943
 			return $this->getAircraftTypeBymodeS($aircraft_modes);
11507
-		} else return '';
11944
+		} else {
11945
+			return '';
11946
+		}
11508 11947
 	
11509 11948
 	}
11510 11949
 
@@ -11522,7 +11961,9 @@  discard block
 block discarded – undo
11522 11961
 		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
11523 11962
 	
11524 11963
 		$Connection = new Connection($this->db);
11525
-		if (!$Connection->tableExists('countries')) return '';
11964
+		if (!$Connection->tableExists('countries')) {
11965
+			return '';
11966
+		}
11526 11967
 	
11527 11968
 		try {
11528 11969
 			/*
@@ -11542,9 +11983,13 @@  discard block
 block discarded – undo
11542 11983
 			$sth->closeCursor();
11543 11984
 			if (count($row) > 0) {
11544 11985
 				return $row;
11545
-			} else return '';
11986
+			} else {
11987
+				return '';
11988
+			}
11546 11989
 		} catch (PDOException $e) {
11547
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
11990
+			if (isset($globalDebug) && $globalDebug) {
11991
+				echo 'Error : '.$e->getMessage()."\n";
11992
+			}
11548 11993
 			return '';
11549 11994
 		}
11550 11995
 	
@@ -11562,7 +12007,9 @@  discard block
 block discarded – undo
11562 12007
 		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
11563 12008
 	
11564 12009
 		$Connection = new Connection($this->db);
11565
-		if (!$Connection->tableExists('countries')) return '';
12010
+		if (!$Connection->tableExists('countries')) {
12011
+			return '';
12012
+		}
11566 12013
 	
11567 12014
 		try {
11568 12015
 			$query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1";
@@ -11574,9 +12021,13 @@  discard block
 block discarded – undo
11574 12021
 			$sth->closeCursor();
11575 12022
 			if (count($row) > 0) {
11576 12023
 				return $row;
11577
-			} else return '';
12024
+			} else {
12025
+				return '';
12026
+			}
11578 12027
 		} catch (PDOException $e) {
11579
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
12028
+			if (isset($globalDebug) && $globalDebug) {
12029
+				echo 'Error : '.$e->getMessage()."\n";
12030
+			}
11580 12031
 			return '';
11581 12032
 		}
11582 12033
 	
@@ -11826,7 +12277,9 @@  discard block
 block discarded – undo
11826 12277
 	{
11827 12278
 		global $globalBitlyAccessToken;
11828 12279
 		
11829
-		if ($globalBitlyAccessToken == '') return $url;
12280
+		if ($globalBitlyAccessToken == '') {
12281
+			return $url;
12282
+		}
11830 12283
         
11831 12284
 		$google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url;
11832 12285
 		
@@ -11975,7 +12428,9 @@  discard block
 block discarded – undo
11975 12428
 		
11976 12429
 
11977 12430
 		// routes
11978
-		if ($globalDebug) print "Routes...\n";
12431
+		if ($globalDebug) {
12432
+			print "Routes...\n";
12433
+		}
11979 12434
 		if ($globalDBdriver == 'mysql') {
11980 12435
 			$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)";
11981 12436
 		} else {
@@ -11994,7 +12449,9 @@  discard block
 block discarded – undo
11994 12449
 			}
11995 12450
 		}
11996 12451
 		
11997
-		if ($globalDebug) print "Airlines...\n";
12452
+		if ($globalDebug) {
12453
+			print "Airlines...\n";
12454
+		}
11998 12455
 		//airlines
11999 12456
 		if ($globalDBdriver == 'mysql') {
12000 12457
 			$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)";
@@ -12008,10 +12465,15 @@  discard block
 block discarded – undo
12008 12465
 			if (is_numeric(substr($row['ident'], -1, 1)))
12009 12466
 			{
12010 12467
 				$fromsource = NULL;
12011
-				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
12012
-				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
12013
-				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
12014
-				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
12468
+				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
12469
+					$fromsource = 'vatsim';
12470
+				} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
12471
+					$fromsource = 'ivao';
12472
+				} elseif (isset($globalVATSIM) && $globalVATSIM) {
12473
+					$fromsource = 'vatsim';
12474
+				} elseif (isset($globalIVAO) && $globalIVAO) {
12475
+					$fromsource = 'ivao';
12476
+				}
12015 12477
 				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
12016 12478
 				if (isset($airline_array[0]['name'])) {
12017 12479
 					$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";
@@ -12021,13 +12483,17 @@  discard block
 block discarded – undo
12021 12483
 			}
12022 12484
 		}
12023 12485
 
12024
-		if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n";
12486
+		if ($globalDebug) {
12487
+			print "Remove Duplicate in aircraft_modes...\n";
12488
+		}
12025 12489
 		//duplicate modes
12026 12490
 		$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";
12027 12491
 		$sth = $this->db->prepare($query);
12028 12492
 		$sth->execute();
12029 12493
 		
12030
-		if ($globalDebug) print "Aircraft...\n";
12494
+		if ($globalDebug) {
12495
+			print "Aircraft...\n";
12496
+		}
12031 12497
 		//aircraft
12032 12498
 		if ($globalDBdriver == 'mysql') {
12033 12499
 			$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)";
@@ -12070,26 +12536,38 @@  discard block
 block discarded – undo
12070 12536
 				 if (isset($closestAirports[0])) {
12071 12537
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
12072 12538
 						$airport_icao = $closestAirports[0]['icao'];
12073
-						if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12539
+						if ($globalDebug) {
12540
+							echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12541
+						}
12074 12542
 					} elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') {
12075 12543
 						foreach ($closestAirports as $airport) {
12076 12544
 							if ($row['arrival_airport_icao'] == $airport['icao']) {
12077 12545
 								$airport_icao = $airport['icao'];
12078
-								if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12546
+								if ($globalDebug) {
12547
+									echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
12548
+								}
12079 12549
 								break;
12080 12550
 							}
12081 12551
 						}
12082 12552
 					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
12083 12553
 						$airport_icao = $closestAirports[0]['icao'];
12084
-						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";
12554
+						if ($globalDebug) {
12555
+							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";
12556
+						}
12085 12557
 					} else {
12086
-						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";
12558
+						if ($globalDebug) {
12559
+							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";
12560
+						}
12087 12561
 					}
12088 12562
 				} else {
12089
-					if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
12563
+					if ($globalDebug) {
12564
+						echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
12565
+					}
12090 12566
 				}
12091 12567
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
12092
-					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
12568
+					if ($globalDebug) {
12569
+						echo "Updating airport to ".$airport_icao."...\n";
12570
+					}
12093 12571
 					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
12094 12572
 					$sthu = $this->db->prepare($update_query);
12095 12573
 					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
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, $globalStatsFilters, $globalFilterName, $globalDBdriver;
Please login to merge, or discard this patch.
Braces   +71 added lines, -24 removed lines patch added patch discarded remove patch
@@ -29,7 +29,9 @@  discard block
 block discarded – undo
29 29
 		if (isset($filter[0]['source'])) {
30 30
 			$filters = array_merge($filters,$filter);
31 31
 		}
32
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
32
+		if (is_array($globalFilter)) {
33
+			$filter = array_merge($filter,$globalFilter);
34
+		}
33 35
 		$filter_query_join = '';
34 36
 		$filter_query_where = '';
35 37
 		foreach($filters as $flt) {
@@ -111,8 +113,11 @@  discard block
 block discarded – undo
111 113
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
112 114
 			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
113 115
 		}
114
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
115
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
116
+		if ($filter_query_where == '' && $where) {
117
+			$filter_query_where = ' WHERE';
118
+		} elseif ($filter_query_where != '' && $and) {
119
+			$filter_query_where .= ' AND';
120
+		}
116 121
 		if ($filter_query_where != '') {
117 122
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
118 123
 		}
@@ -154,7 +159,9 @@  discard block
 block discarded – undo
154 159
 			}
155 160
 		}
156 161
 
157
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
162
+		if (!isset($globalLiveInterval)) {
163
+			$globalLiveInterval = '200';
164
+		}
158 165
 		if ($globalDBdriver == 'mysql') {
159 166
 			//$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";
160 167
 			$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;
@@ -179,7 +186,9 @@  discard block
 block discarded – undo
179 186
 
180 187
 		$filter_query = $this->getFilter($filter,true,true);
181 188
 
182
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
189
+		if (!isset($globalLiveInterval)) {
190
+			$globalLiveInterval = '200';
191
+		}
183 192
 		if ($globalDBdriver == 'mysql') {
184 193
 //			$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";
185 194
 //			$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';
@@ -236,7 +245,9 @@  discard block
 block discarded – undo
236 245
 
237 246
 		$filter_query = $this->getFilter($filter,true,true);
238 247
 
239
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
248
+		if (!isset($globalLiveInterval)) {
249
+			$globalLiveInterval = '200';
250
+		}
240 251
 		if ($globalDBdriver == 'mysql') {
241 252
 /*
242 253
 			$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 
@@ -280,7 +291,9 @@  discard block
 block discarded – undo
280 291
 		global $globalDBdriver, $globalLiveInterval;
281 292
 		$filter_query = $this->getFilter($filter,true,true);
282 293
 
283
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
294
+		if (!isset($globalLiveInterval)) {
295
+			$globalLiveInterval = '200';
296
+		}
284 297
 		if ($globalDBdriver == 'mysql') {
285 298
 			//$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;
286 299
 			$query = 'SELECT COUNT(DISTINCT spotter_live.flightaware_id) as nb FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
@@ -310,7 +323,9 @@  discard block
 block discarded – undo
310 323
 	{
311 324
 		global $globalDBdriver, $globalLiveInterval;
312 325
 		$Spotter = new Spotter($this->db);
313
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
326
+		if (!isset($globalLiveInterval)) {
327
+			$globalLiveInterval = '200';
328
+		}
314 329
 		$filter_query = $this->getFilter($filter);
315 330
 
316 331
 		if (is_array($coord)) {
@@ -318,7 +333,9 @@  discard block
 block discarded – undo
318 333
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
319 334
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
320 335
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
321
-		} else return array();
336
+		} else {
337
+			return array();
338
+		}
322 339
 		if ($globalDBdriver == 'mysql') {
323 340
 			//$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.")";
324 341
 			$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;
@@ -509,11 +526,15 @@  discard block
 block discarded – undo
509 526
 		//$query  = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date';
510 527
 		if ($globalDBdriver == 'mysql') {
511 528
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
512
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
529
+			if ($liveinterval) {
530
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
531
+			}
513 532
 			$query .= ' ORDER BY date';
514 533
 		} else {
515 534
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
516
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
535
+			if ($liveinterval) {
536
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
537
+			}
517 538
 			$query .= ' ORDER BY date';
518 539
 		}
519 540
 
@@ -608,7 +629,9 @@  discard block
 block discarded – undo
608 629
 				$i++;
609 630
 				$j++;
610 631
 				if ($j == 30) {
611
-					if ($globalDebug) echo ".";
632
+					if ($globalDebug) {
633
+						echo ".";
634
+					}
612 635
 				    	try {
613 636
 						
614 637
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -915,7 +938,9 @@  discard block
 block discarded – undo
915 938
 			{
916 939
 				return false;
917 940
 			}
918
-		} else return '';
941
+		} else {
942
+			return '';
943
+		}
919 944
 
920 945
 		if ($longitude != '')
921 946
 		{
@@ -923,7 +948,9 @@  discard block
 block discarded – undo
923 948
 			{
924 949
 				return false;
925 950
 			}
926
-		} else return '';
951
+		} else {
952
+			return '';
953
+		}
927 954
 
928 955
 		if ($waypoints != '')
929 956
 		{
@@ -939,7 +966,9 @@  discard block
 block discarded – undo
939 966
 			{
940 967
 				return false;
941 968
 			}
942
-		} else $altitude = 0;
969
+		} else {
970
+			$altitude = 0;
971
+		}
943 972
 
944 973
 		if ($heading != '')
945 974
 		{
@@ -947,7 +976,9 @@  discard block
 block discarded – undo
947 976
 			{
948 977
 				return false;
949 978
 			}
950
-		} else $heading = 0;
979
+		} else {
980
+			$heading = 0;
981
+		}
951 982
 
952 983
 		if ($groundspeed != '')
953 984
 		{
@@ -955,9 +986,13 @@  discard block
 block discarded – undo
955 986
 			{
956 987
 				return false;
957 988
 			}
958
-		} else $groundspeed = 0;
989
+		} else {
990
+			$groundspeed = 0;
991
+		}
959 992
 		date_default_timezone_set('UTC');
960
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
993
+		if ($date == '') {
994
+			$date = date("Y-m-d H:i:s", time());
995
+		}
961 996
 
962 997
         
963 998
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -1001,10 +1036,18 @@  discard block
 block discarded – undo
1001 1036
 		$arrival_airport_country = '';
1002 1037
 		
1003 1038
             	
1004
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1005
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1006
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1007
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1039
+            	if ($squawk == '' || $Common->isInteger($squawk) === false ) {
1040
+            		$squawk = NULL;
1041
+            	}
1042
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) {
1043
+            		$verticalrate = NULL;
1044
+            	}
1045
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
1046
+            		$groundspeed = 0;
1047
+            	}
1048
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
1049
+            		$heading = 0;
1050
+            	}
1008 1051
             	
1009 1052
 		$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) 
1010 1053
 		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)';
@@ -1018,10 +1061,14 @@  discard block
 block discarded – undo
1018 1061
                 	return "error : ".$e->getMessage();
1019 1062
                 }
1020 1063
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1021
-		    if ($globalDebug) echo '(Add to SBS archive : ';
1064
+		    if ($globalDebug) {
1065
+		    	echo '(Add to SBS archive : ';
1066
+		    }
1022 1067
 		    $SpotterArchive = new SpotterArchive($this->db);
1023 1068
 		    $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);
1024
-		    if ($globalDebug) echo $result.')';
1069
+		    if ($globalDebug) {
1070
+		    	echo $result.')';
1071
+		    }
1025 1072
 		}
1026 1073
 		return "success";
1027 1074
 
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, $globalDBdriver;
21 21
 		$filters = array();
@@ -128,11 +128,11 @@  discard block
 block discarded – undo
128 128
 	}
129 129
 
130 130
 	/**
131
-	* Gets all the spotter information based on the latest data entry
132
-	*
133
-	* @return Array the spotter information
134
-	*
135
-	*/
131
+	 * Gets all the spotter information based on the latest data entry
132
+	 *
133
+	 * @return Array the spotter information
134
+	 *
135
+	 */
136 136
 	public function getLiveSpotterData($limit = '', $sort = '', $filter = array())
137 137
 	{
138 138
 		global $globalDBdriver, $globalLiveInterval;
@@ -174,11 +174,11 @@  discard block
 block discarded – undo
174 174
 	}
175 175
 
176 176
 	/**
177
-	* Gets Minimal Live Spotter data
178
-	*
179
-	* @return Array the spotter information
180
-	*
181
-	*/
177
+	 * Gets Minimal Live Spotter data
178
+	 *
179
+	 * @return Array the spotter information
180
+	 *
181
+	 */
182 182
 	public function getMinLiveSpotterData($filter = array())
183 183
 	{
184 184
 		global $globalDBdriver, $globalLiveInterval;
@@ -231,11 +231,11 @@  discard block
 block discarded – undo
231 231
 	}
232 232
 
233 233
 	/**
234
-	* Gets Minimal Live Spotter data since xx seconds
235
-	*
236
-	* @return Array the spotter information
237
-	*
238
-	*/
234
+	 * Gets Minimal Live Spotter data since xx seconds
235
+	 *
236
+	 * @return Array the spotter information
237
+	 *
238
+	 */
239 239
 	public function getMinLastLiveSpotterData($filter = array())
240 240
 	{
241 241
 		global $globalDBdriver, $globalLiveInterval;
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 			$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 
254 254
 			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' 
255 255
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
256
-                } else {
256
+				} else {
257 257
 /*
258 258
 			$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 
259 259
 			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' 
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 //			echo $query;
266 266
 		}
267 267
 
268
-    		try {
268
+			try {
269 269
 			$sth = $this->db->prepare($query);
270 270
 			$sth->execute();
271 271
 		} catch(PDOException $e) {
@@ -277,11 +277,11 @@  discard block
 block discarded – undo
277 277
 	}
278 278
 
279 279
 	/**
280
-	* Gets number of latest data entry
281
-	*
282
-	* @return String number of entry
283
-	*
284
-	*/
280
+	 * Gets number of latest data entry
281
+	 *
282
+	 * @return String number of entry
283
+	 *
284
+	 */
285 285
 	public function getLiveSpotterCount($filter = array())
286 286
 	{
287 287
 		global $globalDBdriver, $globalLiveInterval;
@@ -308,11 +308,11 @@  discard block
 block discarded – undo
308 308
 	}
309 309
 
310 310
 	/**
311
-	* Gets all the spotter information based on the latest data entry and coord
312
-	*
313
-	* @return Array the spotter information
314
-	*
315
-	*/
311
+	 * Gets all the spotter information based on the latest data entry and coord
312
+	 *
313
+	 * @return Array the spotter information
314
+	 *
315
+	 */
316 316
 	public function getLiveSpotterDatabyCoord($coord, $filter = array())
317 317
 	{
318 318
 		global $globalDBdriver, $globalLiveInterval;
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
 	}
338 338
 
339 339
 	/**
340
-	* Gets all the spotter information based on a user's latitude and longitude
341
-	*
342
-	* @return Array the spotter information
343
-	*
344
-	*/
340
+	 * Gets all the spotter information based on a user's latitude and longitude
341
+	 *
342
+	 * @return Array the spotter information
343
+	 *
344
+	 */
345 345
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
346 346
 	{
347 347
 		$Spotter = new Spotter($this->db);
@@ -351,145 +351,145 @@  discard block
 block discarded – undo
351 351
 				return false;
352 352
 			}
353 353
 		}
354
-        if ($lng != '')
355
-                {
356
-                        if (!is_numeric($lng))
357
-                        {
358
-                                return false;
359
-                        }
360
-                }
361
-
362
-                if ($radius != '')
363
-                {
364
-                        if (!is_numeric($radius))
365
-                        {
366
-                                return false;
367
-                        }
368
-                }
354
+		if ($lng != '')
355
+				{
356
+						if (!is_numeric($lng))
357
+						{
358
+								return false;
359
+						}
360
+				}
361
+
362
+				if ($radius != '')
363
+				{
364
+						if (!is_numeric($radius))
365
+						{
366
+								return false;
367
+						}
368
+				}
369 369
 		$additional_query = '';
370
-        if ($interval != '')
371
-                {
372
-                        if (!is_string($interval))
373
-                        {
374
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
375
-			        return false;
376
-                        } else {
377
-                if ($interval == '1m')
378
-                {
379
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
380
-                } else if ($interval == '15m'){
381
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
382
-                } 
383
-            }
384
-                } else {
385
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
386
-        }
387
-
388
-                $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 
370
+		if ($interval != '')
371
+				{
372
+						if (!is_string($interval))
373
+						{
374
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
375
+					return false;
376
+						} else {
377
+				if ($interval == '1m')
378
+				{
379
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
380
+				} else if ($interval == '15m'){
381
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
382
+				} 
383
+			}
384
+				} else {
385
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
386
+		}
387
+
388
+				$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 
389 389
                    WHERE spotter_live.latitude <> '' 
390 390
                                    AND spotter_live.longitude <> '' 
391 391
                    ".$additional_query."
392 392
                    HAVING distance < :radius  
393 393
                                    ORDER BY distance";
394 394
 
395
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
395
+				$spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
396 396
 
397
-                return $spotter_array;
398
-        }
397
+				return $spotter_array;
398
+		}
399 399
 
400 400
     
401
-        /**
402
-	* Gets all the spotter information based on a particular callsign
403
-	*
404
-	* @return Array the spotter information
405
-	*
406
-	*/
401
+		/**
402
+		 * Gets all the spotter information based on a particular callsign
403
+		 *
404
+		 * @return Array the spotter information
405
+		 *
406
+		 */
407 407
 	public function getLastLiveSpotterDataByIdent($ident)
408 408
 	{
409 409
 		$Spotter = new Spotter($this->db);
410 410
 		date_default_timezone_set('UTC');
411 411
 
412 412
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
413
-                $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';
413
+				$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';
414 414
 
415 415
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
416 416
 
417 417
 		return $spotter_array;
418 418
 	}
419 419
 
420
-        /**
421
-	* Gets all the spotter information based on a particular callsign
422
-	*
423
-	* @return Array the spotter information
424
-	*
425
-	*/
420
+		/**
421
+		 * Gets all the spotter information based on a particular callsign
422
+		 *
423
+		 * @return Array the spotter information
424
+		 *
425
+		 */
426 426
 	public function getDateLiveSpotterDataByIdent($ident,$date)
427 427
 	{
428 428
 		$Spotter = new Spotter($this->db);
429 429
 		date_default_timezone_set('UTC');
430 430
 
431 431
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
432
-                $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';
432
+				$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';
433 433
 
434
-                $date = date('c',$date);
434
+				$date = date('c',$date);
435 435
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
436 436
 
437 437
 		return $spotter_array;
438 438
 	}
439 439
 
440
-        /**
441
-	* Gets last spotter information based on a particular callsign
442
-	*
443
-	* @return Array the spotter information
444
-	*
445
-	*/
440
+		/**
441
+		 * Gets last spotter information based on a particular callsign
442
+		 *
443
+		 * @return Array the spotter information
444
+		 *
445
+		 */
446 446
 	public function getLastLiveSpotterDataById($id)
447 447
 	{
448 448
 		$Spotter = new Spotter($this->db);
449 449
 		date_default_timezone_set('UTC');
450 450
 
451 451
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
452
-                $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';
452
+				$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';
453 453
 
454 454
 		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true);
455 455
 
456 456
 		return $spotter_array;
457 457
 	}
458 458
 
459
-        /**
460
-	* Gets last spotter information based on a particular callsign
461
-	*
462
-	* @return Array the spotter information
463
-	*
464
-	*/
459
+		/**
460
+		 * Gets last spotter information based on a particular callsign
461
+		 *
462
+		 * @return Array the spotter information
463
+		 *
464
+		 */
465 465
 	public function getDateLiveSpotterDataById($id,$date)
466 466
 	{
467 467
 		$Spotter = new Spotter($this->db);
468 468
 		date_default_timezone_set('UTC');
469 469
 
470 470
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
471
-                $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';
472
-                $date = date('c',$date);
471
+				$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';
472
+				$date = date('c',$date);
473 473
 		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
474 474
 
475 475
 		return $spotter_array;
476 476
 	}
477 477
 
478
-        /**
479
-	* Gets altitude information based on a particular callsign
480
-	*
481
-	* @return Array the spotter information
482
-	*
483
-	*/
478
+		/**
479
+		 * Gets altitude information based on a particular callsign
480
+		 *
481
+		 * @return Array the spotter information
482
+		 *
483
+		 */
484 484
 	public function getAltitudeLiveSpotterDataByIdent($ident)
485 485
 	{
486 486
 
487 487
 		date_default_timezone_set('UTC');
488 488
 
489 489
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
490
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
490
+				$query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
491 491
 
492
-    		try {
492
+			try {
493 493
 			
494 494
 			$sth = $this->db->prepare($query);
495 495
 			$sth->execute(array(':ident' => $ident));
@@ -502,12 +502,12 @@  discard block
 block discarded – undo
502 502
 		return $spotter_array;
503 503
 	}
504 504
 
505
-        /**
506
-	* Gets all the spotter information based on a particular id
507
-	*
508
-	* @return Array the spotter information
509
-	*
510
-	*/
505
+		/**
506
+		 * Gets all the spotter information based on a particular id
507
+		 *
508
+		 * @return Array the spotter information
509
+		 *
510
+		 */
511 511
 	public function getAllLiveSpotterDataById($id,$liveinterval = false)
512 512
 	{
513 513
 		global $globalDBdriver, $globalLiveInterval;
@@ -535,18 +535,18 @@  discard block
 block discarded – undo
535 535
 		return $spotter_array;
536 536
 	}
537 537
 
538
-        /**
539
-	* Gets all the spotter information based on a particular ident
540
-	*
541
-	* @return Array the spotter information
542
-	*
543
-	*/
538
+		/**
539
+		 * Gets all the spotter information based on a particular ident
540
+		 *
541
+		 * @return Array the spotter information
542
+		 *
543
+		 */
544 544
 	public function getAllLiveSpotterDataByIdent($ident)
545 545
 	{
546 546
 		date_default_timezone_set('UTC');
547 547
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
548 548
 		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
549
-    		try {
549
+			try {
550 550
 			
551 551
 			$sth = $this->db->prepare($query);
552 552
 			$sth->execute(array(':ident' => $ident));
@@ -560,23 +560,23 @@  discard block
 block discarded – undo
560 560
 
561 561
 
562 562
 	/**
563
-	* Deletes all info in the table
564
-	*
565
-	* @return String success or false
566
-	*
567
-	*/
563
+	 * Deletes all info in the table
564
+	 *
565
+	 * @return String success or false
566
+	 *
567
+	 */
568 568
 	public function deleteLiveSpotterData()
569 569
 	{
570 570
 		global $globalDBdriver;
571 571
 		if ($globalDBdriver == 'mysql') {
572 572
 			//$query  = "DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= spotter_live.date";
573 573
 			$query  = 'DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= spotter_live.date';
574
-            		//$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)";
574
+					//$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)";
575 575
 		} else {
576 576
 			$query  = "DELETE FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date";
577 577
 		}
578 578
         
579
-    		try {
579
+			try {
580 580
 			
581 581
 			$sth = $this->db->prepare($query);
582 582
 			$sth->execute();
@@ -588,18 +588,18 @@  discard block
 block discarded – undo
588 588
 	}
589 589
 
590 590
 	/**
591
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
592
-	*
593
-	* @return String success or false
594
-	*
595
-	*/
591
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
592
+	 *
593
+	 * @return String success or false
594
+	 *
595
+	 */
596 596
 	public function deleteLiveSpotterDataNotUpdated()
597 597
 	{
598 598
 		global $globalDBdriver, $globalDebug;
599 599
 		if ($globalDBdriver == 'mysql') {
600 600
 			//$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';
601
-    			$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";
602
-    			try {
601
+				$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";
602
+				try {
603 603
 				
604 604
 				$sth = $this->db->prepare($query);
605 605
 				$sth->execute();
@@ -607,8 +607,8 @@  discard block
 block discarded – undo
607 607
 				return "error";
608 608
 			}
609 609
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
610
-                        $i = 0;
611
-                        $j =0;
610
+						$i = 0;
611
+						$j =0;
612 612
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
613 613
 			foreach($all as $row)
614 614
 			{
@@ -616,20 +616,20 @@  discard block
 block discarded – undo
616 616
 				$j++;
617 617
 				if ($j == 30) {
618 618
 					if ($globalDebug) echo ".";
619
-				    	try {
619
+						try {
620 620
 						
621 621
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
622 622
 						$sth->execute();
623 623
 					} catch(PDOException $e) {
624 624
 						return "error";
625 625
 					}
626
-                                	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
627
-                                	$j = 0;
626
+									$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
627
+									$j = 0;
628 628
 				}
629 629
 				$query_delete .= "'".$row['flightaware_id']."',";
630 630
 			}
631 631
 			if ($i > 0) {
632
-    				try {
632
+					try {
633 633
 					
634 634
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
635 635
 					$sth->execute();
@@ -640,9 +640,9 @@  discard block
 block discarded – undo
640 640
 			return "success";
641 641
 		} elseif ($globalDBdriver == 'pgsql') {
642 642
 			//$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";
643
-    			//$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";
644
-    			$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)";
645
-    			try {
643
+				//$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";
644
+				$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)";
645
+				try {
646 646
 				
647 647
 				$sth = $this->db->prepare($query);
648 648
 				$sth->execute();
@@ -686,17 +686,17 @@  discard block
 block discarded – undo
686 686
 	}
687 687
 
688 688
 	/**
689
-	* Deletes all info in the table for an ident
690
-	*
691
-	* @return String success or false
692
-	*
693
-	*/
689
+	 * Deletes all info in the table for an ident
690
+	 *
691
+	 * @return String success or false
692
+	 *
693
+	 */
694 694
 	public function deleteLiveSpotterDataByIdent($ident)
695 695
 	{
696 696
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
697 697
 		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
698 698
         
699
-    		try {
699
+			try {
700 700
 			
701 701
 			$sth = $this->db->prepare($query);
702 702
 			$sth->execute(array(':ident' => $ident));
@@ -708,17 +708,17 @@  discard block
 block discarded – undo
708 708
 	}
709 709
 
710 710
 	/**
711
-	* Deletes all info in the table for an id
712
-	*
713
-	* @return String success or false
714
-	*
715
-	*/
711
+	 * Deletes all info in the table for an id
712
+	 *
713
+	 * @return String success or false
714
+	 *
715
+	 */
716 716
 	public function deleteLiveSpotterDataById($id)
717 717
 	{
718 718
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
719 719
 		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
720 720
         
721
-    		try {
721
+			try {
722 722
 			
723 723
 			$sth = $this->db->prepare($query);
724 724
 			$sth->execute(array(':id' => $id));
@@ -731,11 +731,11 @@  discard block
 block discarded – undo
731 731
 
732 732
 
733 733
 	/**
734
-	* Gets the aircraft ident within the last hour
735
-	*
736
-	* @return String the ident
737
-	*
738
-	*/
734
+	 * Gets the aircraft ident within the last hour
735
+	 *
736
+	 * @return String the ident
737
+	 *
738
+	 */
739 739
 	public function getIdentFromLastHour($ident)
740 740
 	{
741 741
 		global $globalDBdriver, $globalTimezone;
@@ -761,14 +761,14 @@  discard block
 block discarded – undo
761 761
 			$ident_result = $row['ident'];
762 762
 		}
763 763
 		return $ident_result;
764
-        }
764
+		}
765 765
 
766 766
 	/**
767
-	* Check recent aircraft
768
-	*
769
-	* @return String the ident
770
-	*
771
-	*/
767
+	 * Check recent aircraft
768
+	 *
769
+	 * @return String the ident
770
+	 *
771
+	 */
772 772
 	public function checkIdentRecent($ident)
773 773
 	{
774 774
 		global $globalDBdriver, $globalTimezone;
@@ -794,14 +794,14 @@  discard block
 block discarded – undo
794 794
 			$ident_result = $row['flightaware_id'];
795 795
 		}
796 796
 		return $ident_result;
797
-        }
797
+		}
798 798
 
799 799
 	/**
800
-	* Check recent aircraft by id
801
-	*
802
-	* @return String the ident
803
-	*
804
-	*/
800
+	 * Check recent aircraft by id
801
+	 *
802
+	 * @return String the ident
803
+	 *
804
+	 */
805 805
 	public function checkIdRecent($id)
806 806
 	{
807 807
 		global $globalDBdriver, $globalTimezone;
@@ -827,14 +827,14 @@  discard block
 block discarded – undo
827 827
 			$ident_result = $row['flightaware_id'];
828 828
 		}
829 829
 		return $ident_result;
830
-        }
830
+		}
831 831
 
832 832
 	/**
833
-	* Check recent aircraft by ModeS
834
-	*
835
-	* @return String the ModeS
836
-	*
837
-	*/
833
+	 * Check recent aircraft by ModeS
834
+	 *
835
+	 * @return String the ModeS
836
+	 *
837
+	 */
838 838
 	public function checkModeSRecent($modes)
839 839
 	{
840 840
 		global $globalDBdriver, $globalTimezone;
@@ -861,19 +861,19 @@  discard block
 block discarded – undo
861 861
 			$ident_result = $row['flightaware_id'];
862 862
 		}
863 863
 		return $ident_result;
864
-        }
864
+		}
865 865
 
866 866
 	/**
867
-	* Adds a new spotter data
868
-	*
869
-	* @param String $flightaware_id the ID from flightaware
870
-	* @param String $ident the flight ident
871
-	* @param String $aircraft_icao the aircraft type
872
-	* @param String $departure_airport_icao the departure airport
873
-	* @param String $arrival_airport_icao the arrival airport
874
-	* @return String success or false
875
-	*
876
-	*/
867
+	 * Adds a new spotter data
868
+	 *
869
+	 * @param String $flightaware_id the ID from flightaware
870
+	 * @param String $ident the flight ident
871
+	 * @param String $aircraft_icao the aircraft type
872
+	 * @param String $departure_airport_icao the departure airport
873
+	 * @param String $arrival_airport_icao the arrival airport
874
+	 * @return String success or false
875
+	 *
876
+	 */
877 877
 	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$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 = '')
878 878
 	{
879 879
 		global $globalURL, $globalArchive, $globalDebug;
@@ -1008,10 +1008,10 @@  discard block
 block discarded – undo
1008 1008
 		$arrival_airport_country = '';
1009 1009
 		
1010 1010
             	
1011
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1012
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1013
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1014
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1011
+				if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1012
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1013
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1014
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1015 1015
             	
1016 1016
 		$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) 
1017 1017
 		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)';
@@ -1021,14 +1021,14 @@  discard block
 block discarded – undo
1021 1021
 			
1022 1022
 			$sth = $this->db->prepare($query);
1023 1023
 			$sth->execute($query_values);
1024
-                } catch(PDOException $e) {
1025
-                	return "error : ".$e->getMessage();
1026
-                }
1024
+				} catch(PDOException $e) {
1025
+					return "error : ".$e->getMessage();
1026
+				}
1027 1027
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1028
-		    if ($globalDebug) echo '(Add to SBS archive : ';
1029
-		    $SpotterArchive = new SpotterArchive($this->db);
1030
-		    $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);
1031
-		    if ($globalDebug) echo $result.')';
1028
+			if ($globalDebug) echo '(Add to SBS archive : ';
1029
+			$SpotterArchive = new SpotterArchive($this->db);
1030
+			$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);
1031
+			if ($globalDebug) echo $result.')';
1032 1032
 		}
1033 1033
 		return "success";
1034 1034
 
Please login to merge, or discard this patch.
Spacing   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -16,62 +16,62 @@  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, $globalDBdriver;
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 29
 		if (isset($filter[0]['source'])) {
30
-			$filters = array_merge($filters,$filter);
30
+			$filters = array_merge($filters, $filter);
31 31
 		}
32
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
32
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
33 33
 		$filter_query_join = '';
34 34
 		$filter_query_where = '';
35
-		foreach($filters as $flt) {
35
+		foreach ($filters as $flt) {
36 36
 			if (isset($flt['airlines']) && !empty($flt['airlines'])) {
37 37
 				if ($flt['airlines'][0] != '') {
38 38
 					if (isset($flt['source'])) {
39
-						$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'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
39
+						$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'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
40 40
 					} else {
41
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
41
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
42 42
 					}
43 43
 				}
44 44
 			}
45 45
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
46 46
 				if (isset($flt['source'])) {
47
-					$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'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
47
+					$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'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
48 48
 				} else {
49
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
49
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
50 50
 				}
51 51
 			}
52 52
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
53 53
 				if (isset($flt['source'])) {
54
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
54
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
55 55
 				} else {
56
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
56
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
57 57
 				}
58 58
 			}
59 59
 			if (isset($flt['registrations']) && !empty($flt['registrations'])) {
60 60
 				if (isset($flt['source'])) {
61
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
61
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
62 62
 				} else {
63
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
63
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
64 64
 				}
65 65
 			}
66 66
 			if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) {
67 67
 				if (isset($flt['source'])) {
68
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id";
68
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id";
69 69
 				}
70 70
 			}
71 71
 		}
72 72
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
73 73
 			if ($filter['airlines'][0] != '') {
74
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id";
74
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id";
75 75
 			}
76 76
 		}
77 77
 		if (isset($filter['alliance']) && !empty($filter['alliance'])) {
@@ -81,10 +81,10 @@  discard block
 block discarded – undo
81 81
 			$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 ";
82 82
 		}
83 83
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
84
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id";
84
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id";
85 85
 		}
86 86
 		if (isset($filter['source']) && !empty($filter['source'])) {
87
-			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
87
+			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
88 88
 		}
89 89
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
90 90
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
@@ -113,15 +113,15 @@  discard block
 block discarded – undo
113 113
 					$filter_query_date .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'";
114 114
 				}
115 115
 			}
116
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id";
116
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id";
117 117
 		}
118 118
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
119
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
119
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
120 120
 		}
121 121
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
122 122
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
123 123
 		if ($filter_query_where != '') {
124
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
124
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
125 125
 		}
126 126
 		$filter_query = $filter_query_join.$filter_query_where;
127 127
 		return $filter_query;
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 		if ($limit != '')
145 145
 		{
146 146
 			$limit_array = explode(',', $limit);
147
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
148
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
147
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
148
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
149 149
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
150 150
 			{
151 151
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 		} else {
169 169
 			$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;
170 170
 		}
171
-		$spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true);
171
+		$spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true);
172 172
 
173 173
 		return $spotter_array;
174 174
 	}
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 		global $globalDBdriver, $globalLiveInterval;
185 185
 		date_default_timezone_set('UTC');
186 186
 
187
-		$filter_query = $this->getFilter($filter,true,true);
187
+		$filter_query = $this->getFilter($filter, true, true);
188 188
 
189 189
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
190 190
 		if ($globalDBdriver == 'mysql') {
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 			$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 
196 196
 			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";
197 197
 */
198
-			$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 
198
+			$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 
199 199
 			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";
200 200
 
201 201
 //			$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;
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 			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'";
211 211
 */
212 212
 
213
-			$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 
213
+			$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 214
 			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'";
215 215
 
216 216
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 		try {
222 222
 			$sth = $this->db->prepare($query);
223 223
 			$sth->execute();
224
-		} catch(PDOException $e) {
224
+		} catch (PDOException $e) {
225 225
 			echo $e->getMessage();
226 226
 			die;
227 227
 		}
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 		global $globalDBdriver, $globalLiveInterval;
242 242
 		date_default_timezone_set('UTC');
243 243
 
244
-		$filter_query = $this->getFilter($filter,true,true);
244
+		$filter_query = $this->getFilter($filter, true, true);
245 245
 
246 246
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
247 247
 		if ($globalDBdriver == 'mysql') {
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 			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' 
251 251
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
252 252
 */
253
-			$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 
253
+			$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 
254 254
 			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' 
255 255
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
256 256
                 } else {
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 			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' 
260 260
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
261 261
 */
262
-			$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 
262
+			$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 
263 263
 			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' 
264 264
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
265 265
 //			echo $query;
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
     		try {
269 269
 			$sth = $this->db->prepare($query);
270 270
 			$sth->execute();
271
-		} catch(PDOException $e) {
271
+		} catch (PDOException $e) {
272 272
 			echo $e->getMessage();
273 273
 			die;
274 274
 		}
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 	public function getLiveSpotterCount($filter = array())
286 286
 	{
287 287
 		global $globalDBdriver, $globalLiveInterval;
288
-		$filter_query = $this->getFilter($filter,true,true);
288
+		$filter_query = $this->getFilter($filter, true, true);
289 289
 
290 290
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
291 291
 		if ($globalDBdriver == 'mysql') {
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 		try {
299 299
 			$sth = $this->db->prepare($query);
300 300
 			$sth->execute();
301
-		} catch(PDOException $e) {
301
+		} catch (PDOException $e) {
302 302
 			echo $e->getMessage();
303 303
 			die;
304 304
 		}
@@ -321,10 +321,10 @@  discard block
 block discarded – undo
321 321
 		$filter_query = $this->getFilter($filter);
322 322
 
323 323
 		if (is_array($coord)) {
324
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
325
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
326
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
327
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
324
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
325
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
326
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
327
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
328 328
 		} else return array();
329 329
 		if ($globalDBdriver == 'mysql') {
330 330
 			//$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.")";
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
                 if ($interval == '1m')
378 378
                 {
379 379
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
380
-                } else if ($interval == '15m'){
380
+                } else if ($interval == '15m') {
381 381
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
382 382
                 } 
383 383
             }
@@ -385,14 +385,14 @@  discard block
 block discarded – undo
385 385
          $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
386 386
         }
387 387
 
388
-                $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 
388
+                $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 
389 389
                    WHERE spotter_live.latitude <> '' 
390 390
                                    AND spotter_live.longitude <> '' 
391 391
                    ".$additional_query."
392 392
                    HAVING distance < :radius  
393 393
                                    ORDER BY distance";
394 394
 
395
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
395
+                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius));
396 396
 
397 397
                 return $spotter_array;
398 398
         }
@@ -410,9 +410,9 @@  discard block
 block discarded – undo
410 410
 		date_default_timezone_set('UTC');
411 411
 
412 412
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
413
-                $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';
413
+                $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';
414 414
 
415
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
415
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true);
416 416
 
417 417
 		return $spotter_array;
418 418
 	}
@@ -423,16 +423,16 @@  discard block
 block discarded – undo
423 423
 	* @return Array the spotter information
424 424
 	*
425 425
 	*/
426
-	public function getDateLiveSpotterDataByIdent($ident,$date)
426
+	public function getDateLiveSpotterDataByIdent($ident, $date)
427 427
 	{
428 428
 		$Spotter = new Spotter($this->db);
429 429
 		date_default_timezone_set('UTC');
430 430
 
431 431
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
432
-                $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';
432
+                $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';
433 433
 
434
-                $date = date('c',$date);
435
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
434
+                $date = date('c', $date);
435
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
436 436
 
437 437
 		return $spotter_array;
438 438
 	}
@@ -449,9 +449,9 @@  discard block
 block discarded – undo
449 449
 		date_default_timezone_set('UTC');
450 450
 
451 451
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
452
-                $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';
452
+                $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';
453 453
 
454
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true);
454
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true);
455 455
 
456 456
 		return $spotter_array;
457 457
 	}
@@ -462,15 +462,15 @@  discard block
 block discarded – undo
462 462
 	* @return Array the spotter information
463 463
 	*
464 464
 	*/
465
-	public function getDateLiveSpotterDataById($id,$date)
465
+	public function getDateLiveSpotterDataById($id, $date)
466 466
 	{
467 467
 		$Spotter = new Spotter($this->db);
468 468
 		date_default_timezone_set('UTC');
469 469
 
470 470
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
471
-                $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';
472
-                $date = date('c',$date);
473
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
471
+                $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';
472
+                $date = date('c', $date);
473
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true);
474 474
 
475 475
 		return $spotter_array;
476 476
 	}
@@ -487,13 +487,13 @@  discard block
 block discarded – undo
487 487
 		date_default_timezone_set('UTC');
488 488
 
489 489
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
490
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
490
+                $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
491 491
 
492 492
     		try {
493 493
 			
494 494
 			$sth = $this->db->prepare($query);
495 495
 			$sth->execute(array(':ident' => $ident));
496
-		} catch(PDOException $e) {
496
+		} catch (PDOException $e) {
497 497
 			echo $e->getMessage();
498 498
 			die;
499 499
 		}
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 	* @return Array the spotter information
509 509
 	*
510 510
 	*/
511
-	public function getAllLiveSpotterDataById($id,$liveinterval = false)
511
+	public function getAllLiveSpotterDataById($id, $liveinterval = false)
512 512
 	{
513 513
 		global $globalDBdriver, $globalLiveInterval;
514 514
 		date_default_timezone_set('UTC');
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 		try {
528 528
 			$sth = $this->db->prepare($query);
529 529
 			$sth->execute(array(':id' => $id));
530
-		} catch(PDOException $e) {
530
+		} catch (PDOException $e) {
531 531
 			echo $e->getMessage();
532 532
 			die;
533 533
 		}
@@ -545,12 +545,12 @@  discard block
 block discarded – undo
545 545
 	{
546 546
 		date_default_timezone_set('UTC');
547 547
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
548
-		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
548
+		$query = self::$global_query.' WHERE spotter_live.ident = :ident';
549 549
     		try {
550 550
 			
551 551
 			$sth = $this->db->prepare($query);
552 552
 			$sth->execute(array(':ident' => $ident));
553
-		} catch(PDOException $e) {
553
+		} catch (PDOException $e) {
554 554
 			echo $e->getMessage();
555 555
 			die;
556 556
 		}
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 			
581 581
 			$sth = $this->db->prepare($query);
582 582
 			$sth->execute();
583
-		} catch(PDOException $e) {
583
+		} catch (PDOException $e) {
584 584
 			return "error";
585 585
 		}
586 586
 
@@ -603,14 +603,14 @@  discard block
 block discarded – undo
603 603
 				
604 604
 				$sth = $this->db->prepare($query);
605 605
 				$sth->execute();
606
-			} catch(PDOException $e) {
606
+			} catch (PDOException $e) {
607 607
 				return "error";
608 608
 			}
609 609
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
610 610
                         $i = 0;
611
-                        $j =0;
611
+                        $j = 0;
612 612
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
613
-			foreach($all as $row)
613
+			foreach ($all as $row)
614 614
 			{
615 615
 				$i++;
616 616
 				$j++;
@@ -618,9 +618,9 @@  discard block
 block discarded – undo
618 618
 					if ($globalDebug) echo ".";
619 619
 				    	try {
620 620
 						
621
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
621
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
622 622
 						$sth->execute();
623
-					} catch(PDOException $e) {
623
+					} catch (PDOException $e) {
624 624
 						return "error";
625 625
 					}
626 626
                                 	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
@@ -631,9 +631,9 @@  discard block
 block discarded – undo
631 631
 			if ($i > 0) {
632 632
     				try {
633 633
 					
634
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
634
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
635 635
 					$sth->execute();
636
-				} catch(PDOException $e) {
636
+				} catch (PDOException $e) {
637 637
 					return "error";
638 638
 				}
639 639
 			}
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 				
647 647
 				$sth = $this->db->prepare($query);
648 648
 				$sth->execute();
649
-			} catch(PDOException $e) {
649
+			} catch (PDOException $e) {
650 650
 				return "error";
651 651
 			}
652 652
 /*			$query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN (";
@@ -694,13 +694,13 @@  discard block
 block discarded – undo
694 694
 	public function deleteLiveSpotterDataByIdent($ident)
695 695
 	{
696 696
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
697
-		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
697
+		$query = 'DELETE FROM spotter_live WHERE ident = :ident';
698 698
         
699 699
     		try {
700 700
 			
701 701
 			$sth = $this->db->prepare($query);
702 702
 			$sth->execute(array(':ident' => $ident));
703
-		} catch(PDOException $e) {
703
+		} catch (PDOException $e) {
704 704
 			return "error";
705 705
 		}
706 706
 
@@ -716,13 +716,13 @@  discard block
 block discarded – undo
716 716
 	public function deleteLiveSpotterDataById($id)
717 717
 	{
718 718
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
719
-		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
719
+		$query = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
720 720
         
721 721
     		try {
722 722
 			
723 723
 			$sth = $this->db->prepare($query);
724 724
 			$sth->execute(array(':id' => $id));
725
-		} catch(PDOException $e) {
725
+		} catch (PDOException $e) {
726 726
 			return "error";
727 727
 		}
728 728
 
@@ -740,13 +740,13 @@  discard block
 block discarded – undo
740 740
 	{
741 741
 		global $globalDBdriver, $globalTimezone;
742 742
 		if ($globalDBdriver == 'mysql') {
743
-			$query  = 'SELECT spotter_live.ident FROM spotter_live 
743
+			$query = 'SELECT spotter_live.ident FROM spotter_live 
744 744
 				WHERE spotter_live.ident = :ident 
745 745
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
746 746
 				AND spotter_live.date < UTC_TIMESTAMP()';
747 747
 			$query_data = array(':ident' => $ident);
748 748
 		} else {
749
-			$query  = "SELECT spotter_live.ident FROM spotter_live 
749
+			$query = "SELECT spotter_live.ident FROM spotter_live 
750 750
 				WHERE spotter_live.ident = :ident 
751 751
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
752 752
 				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -755,8 +755,8 @@  discard block
 block discarded – undo
755 755
 		
756 756
 		$sth = $this->db->prepare($query);
757 757
 		$sth->execute($query_data);
758
-		$ident_result='';
759
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
758
+		$ident_result = '';
759
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
760 760
 		{
761 761
 			$ident_result = $row['ident'];
762 762
 		}
@@ -773,13 +773,13 @@  discard block
 block discarded – undo
773 773
 	{
774 774
 		global $globalDBdriver, $globalTimezone;
775 775
 		if ($globalDBdriver == 'mysql') {
776
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
776
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
777 777
 				WHERE spotter_live.ident = :ident 
778 778
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
779 779
 //				AND spotter_live.date < UTC_TIMESTAMP()";
780 780
 			$query_data = array(':ident' => $ident);
781 781
 		} else {
782
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
782
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
783 783
 				WHERE spotter_live.ident = :ident 
784 784
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'";
785 785
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -788,8 +788,8 @@  discard block
 block discarded – undo
788 788
 		
789 789
 		$sth = $this->db->prepare($query);
790 790
 		$sth->execute($query_data);
791
-		$ident_result='';
792
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
791
+		$ident_result = '';
792
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
793 793
 		{
794 794
 			$ident_result = $row['flightaware_id'];
795 795
 		}
@@ -806,13 +806,13 @@  discard block
 block discarded – undo
806 806
 	{
807 807
 		global $globalDBdriver, $globalTimezone;
808 808
 		if ($globalDBdriver == 'mysql') {
809
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
809
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
810 810
 				WHERE spotter_live.flightaware_id = :id 
811 811
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
812 812
 //				AND spotter_live.date < UTC_TIMESTAMP()";
813 813
 			$query_data = array(':id' => $id);
814 814
 		} else {
815
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
815
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
816 816
 				WHERE spotter_live.flightaware_id = :id 
817 817
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
818 818
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -821,8 +821,8 @@  discard block
 block discarded – undo
821 821
 		
822 822
 		$sth = $this->db->prepare($query);
823 823
 		$sth->execute($query_data);
824
-		$ident_result='';
825
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
824
+		$ident_result = '';
825
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
826 826
 		{
827 827
 			$ident_result = $row['flightaware_id'];
828 828
 		}
@@ -839,13 +839,13 @@  discard block
 block discarded – undo
839 839
 	{
840 840
 		global $globalDBdriver, $globalTimezone;
841 841
 		if ($globalDBdriver == 'mysql') {
842
-			$query  = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
842
+			$query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
843 843
 				WHERE spotter_live.ModeS = :modes 
844 844
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
845 845
 //				AND spotter_live.date < UTC_TIMESTAMP()";
846 846
 			$query_data = array(':modes' => $modes);
847 847
 		} else {
848
-			$query  = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
848
+			$query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
849 849
 				WHERE spotter_live.ModeS = :modes 
850 850
 				AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '30 MINUTE'";
851 851
 //			//	AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
@@ -854,8 +854,8 @@  discard block
 block discarded – undo
854 854
 		
855 855
 		$sth = $this->db->prepare($query);
856 856
 		$sth->execute($query_data);
857
-		$ident_result='';
858
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
857
+		$ident_result = '';
858
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
859 859
 		{
860 860
 			//$ident_result = $row['spotter_live_id'];
861 861
 			$ident_result = $row['flightaware_id'];
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
 	* @return String success or false
875 875
 	*
876 876
 	*/
877
-	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$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 = '')
877
+	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '', $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 = '')
878 878
 	{
879 879
 		global $globalURL, $globalArchive, $globalDebug;
880 880
 		$Common = new Common();
@@ -967,26 +967,26 @@  discard block
 block discarded – undo
967 967
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
968 968
 
969 969
         
970
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
971
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
972
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
973
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
974
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
975
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
976
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
977
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
978
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
979
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
980
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
981
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
982
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
983
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
984
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
985
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
986
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
987
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
988
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
989
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
970
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
971
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
972
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
973
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
974
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
975
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
976
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
977
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
978
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
979
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
980
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
981
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
982
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
983
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
984
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
985
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
986
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
987
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
988
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
989
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
990 990
 
991 991
 		$airline_name = '';
992 992
 		$airline_icao = '';
@@ -1008,26 +1008,26 @@  discard block
 block discarded – undo
1008 1008
 		$arrival_airport_country = '';
1009 1009
 		
1010 1010
             	
1011
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1012
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1013
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1014
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1011
+            	if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
1012
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
1013
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
1014
+            	if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
1015 1015
             	
1016
-		$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) 
1016
+		$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) 
1017 1017
 		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)';
1018 1018
 
1019
-		$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);
1019
+		$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);
1020 1020
 		try {
1021 1021
 			
1022 1022
 			$sth = $this->db->prepare($query);
1023 1023
 			$sth->execute($query_values);
1024
-                } catch(PDOException $e) {
1024
+                } catch (PDOException $e) {
1025 1025
                 	return "error : ".$e->getMessage();
1026 1026
                 }
1027 1027
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1028 1028
 		    if ($globalDebug) echo '(Add to SBS archive : ';
1029 1029
 		    $SpotterArchive = new SpotterArchive($this->db);
1030
-		    $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);
1030
+		    $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);
1031 1031
 		    if ($globalDebug) echo $result.')';
1032 1032
 		}
1033 1033
 		return "success";
@@ -1036,7 +1036,7 @@  discard block
 block discarded – undo
1036 1036
 
1037 1037
 	public function getOrderBy()
1038 1038
 	{
1039
-		$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"));
1039
+		$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"));
1040 1040
 		return $orderby;
1041 1041
 	}
1042 1042
 
Please login to merge, or discard this patch.
require/class.SpotterArchive.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
     /**
12 12
     * Get SQL query part for filter used
13 13
     * @param Array $filter the filter
14
-    * @return Array the SQL part
14
+    * @return string the SQL part
15 15
     */
16 16
     public function getFilter($filter = array(),$where = false,$and = false) {
17 17
 	global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
Please login to merge, or discard this patch.
Braces   +37 added lines, -13 removed lines patch added patch discarded remove patch
@@ -26,7 +26,9 @@  discard block
 block discarded – undo
26 26
 	if (isset($filter[0]['source'])) {
27 27
 		$filters = array_merge($filters,$filter);
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) {
@@ -99,8 +101,11 @@  discard block
 block discarded – undo
99 101
 	    }
100 102
 	    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id";
101 103
 	}
102
-	if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
103
-	elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
104
+	if ($filter_query_where == '' && $where) {
105
+		$filter_query_where = ' WHERE';
106
+	} elseif ($filter_query_where != '' && $and) {
107
+		$filter_query_where .= ' AND';
108
+	}
104 109
 	if ($filter_query_where != '') {
105 110
 		$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
106 111
 	}
@@ -114,10 +119,17 @@  discard block
 block discarded – undo
114 119
 		if ($over_country == '') {
115 120
 			$Spotter = new Spotter($this->db);
116 121
 			$data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude);
117
-			if (!empty($data_country)) $country = $data_country['iso2'];
118
-			else $country = '';
119
-		} else $country = $over_country;
120
-		if ($airline_type === NULL) $airline_type ='';
122
+			if (!empty($data_country)) {
123
+				$country = $data_country['iso2'];
124
+			} else {
125
+				$country = '';
126
+			}
127
+		} else {
128
+			$country = $over_country;
129
+		}
130
+		if ($airline_type === NULL) {
131
+			$airline_type ='';
132
+		}
121 133
 	
122 134
 		//if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n";
123 135
 		//else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n";
@@ -620,7 +632,9 @@  discard block
 block discarded – undo
620 632
 		    $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR ";
621 633
 		    $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR ";
622 634
 		    $translate = $Translation->ident2icao($q_item);
623
-		    if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
635
+		    if ($translate != $q_item) {
636
+		    	$additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
637
+		    }
624 638
 		    $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')";
625 639
 		    $additional_query .= ")";
626 640
 		}
@@ -838,7 +852,9 @@  discard block
 block discarded – undo
838 852
 		date_default_timezone_set($globalTimezone);
839 853
 		$datetime = new DateTime();
840 854
 		$offset = $datetime->format('P');
841
-	    } else $offset = '+00:00';
855
+	    } else {
856
+	    	$offset = '+00:00';
857
+	    }
842 858
 
843 859
 
844 860
 	    if ($date_array[1] != "")
@@ -1114,9 +1130,13 @@  discard block
 block discarded – undo
1114 1130
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1115 1131
 			}
1116 1132
 		}
1117
-                if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1133
+                if ($sincedate != '') {
1134
+                	$query .= "AND date > '".$sincedate."' ";
1135
+                }
1118 1136
 	$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1119
-	if ($limit) $query .= " LIMIT 0,10";
1137
+	if ($limit) {
1138
+		$query .= " LIMIT 0,10";
1139
+	}
1120 1140
       
1121 1141
 	
1122 1142
 	$sth = $this->db->prepare($query);
@@ -1160,9 +1180,13 @@  discard block
 block discarded – undo
1160 1180
 				$query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1161 1181
 			}
1162 1182
 		}
1163
-                if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1183
+                if ($sincedate != '') {
1184
+                	$query .= "AND s.date > '".$sincedate."' ";
1185
+                }
1164 1186
 	$query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1165
-	if ($limit) $query .= " LIMIT 0,10";
1187
+	if ($limit) {
1188
+		$query .= " LIMIT 0,10";
1189
+	}
1166 1190
       
1167 1191
 	
1168 1192
 	$sth = $this->db->prepare($query);
Please login to merge, or discard this patch.
Indentation   +653 added lines, -653 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@  discard block
 block discarded – undo
8 8
 		$this->db = $Connection->db;
9 9
 	}
10 10
 
11
-    /**
12
-    * Get SQL query part for filter used
13
-    * @param Array $filter the filter
14
-    * @return Array the SQL part
15
-    */
16
-    public function getFilter($filter = array(),$where = false,$and = false) {
11
+	/**
12
+	 * Get SQL query part for filter used
13
+	 * @param Array $filter the filter
14
+	 * @return Array the SQL part
15
+	 */
16
+	public function getFilter($filter = array(),$where = false,$and = false) {
17 17
 	global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
18 18
 	$filters = array();
19 19
 	if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
@@ -30,88 +30,88 @@  discard block
 block discarded – undo
30 30
 	$filter_query_join = '';
31 31
 	$filter_query_where = '';
32 32
 	foreach($filters as $flt) {
33
-	    if (isset($flt['airlines']) && !empty($flt['airlines'])) {
33
+		if (isset($flt['airlines']) && !empty($flt['airlines'])) {
34 34
 		if ($flt['airlines'][0] != '') {
35
-		    if (isset($flt['source'])) {
35
+			if (isset($flt['source'])) {
36 36
 			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id";
37
-		    } else {
37
+			} else {
38 38
 			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id";
39
-		    }
39
+			}
40
+		}
40 41
 		}
41
-	    }
42
-	    if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
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_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id";
44
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id";
45 45
 		} else {
46
-		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id";
46
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id";
47 47
 		}
48
-	    }
49
-	    if (isset($flt['idents']) && !empty($flt['idents'])) {
48
+		}
49
+		if (isset($flt['idents']) && !empty($flt['idents'])) {
50 50
 		if (isset($flt['source'])) {
51
-		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id";
51
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id";
52 52
 		} else {
53
-		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id";
53
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id";
54
+		}
54 55
 		}
55
-	    }
56
-	    if (isset($flt['registrations']) && !empty($flt['registrations'])) {
56
+		if (isset($flt['registrations']) && !empty($flt['registrations'])) {
57 57
 		if (isset($flt['source'])) {
58
-		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id";
58
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id";
59 59
 		} else {
60
-		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id";
60
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id";
61
+		}
61 62
 		}
62
-	    }
63
-	    if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents']) && isset($flt['registrations']) && empty($flt['registrations'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) {
63
+		if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents']) && isset($flt['registrations']) && empty($flt['registrations'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) {
64 64
 		if (isset($flt['source'])) {
65
-		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saa ON saa.flightaware_id = spotter_archive_output.flightaware_id";
65
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saa ON saa.flightaware_id = spotter_archive_output.flightaware_id";
66
+		}
66 67
 		}
67
-	    }
68 68
 	}
69 69
 	if (isset($filter['airlines']) && !empty($filter['airlines'])) {
70
-	    if ($filter['airlines'][0] != '') {
70
+		if ($filter['airlines'][0] != '') {
71 71
 		$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) saf ON saf.flightaware_id = spotter_archive_output.flightaware_id";
72
-	    }
72
+		}
73 73
 	}
74 74
 	
75 75
 	if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
76
-	    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive_output.flightaware_id ";
76
+		$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive_output.flightaware_id ";
77 77
 	}
78 78
 	if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
79
-	    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id";
79
+		$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id";
80 80
 	}
81 81
 	if (isset($filter['source']) && !empty($filter['source'])) {
82
-	    $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
82
+		$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
83 83
 	}
84 84
 	if (isset($filter['ident']) && !empty($filter['ident'])) {
85
-	    $filter_query_where .= " AND ident = '".$filter['ident']."'";
85
+		$filter_query_where .= " AND ident = '".$filter['ident']."'";
86 86
 	}
87 87
 	if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
88 88
 		$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
89 89
 	}
90 90
 	if ((isset($filter['year']) && $filter['year'] != '') || (isset($filter['month']) && $filter['month'] != '') || (isset($filter['day']) && $filter['day'] != '')) {
91
-	    $filter_query_date = '';
91
+		$filter_query_date = '';
92 92
 	    
93
-	    if (isset($filter['year']) && $filter['year'] != '') {
93
+		if (isset($filter['year']) && $filter['year'] != '') {
94 94
 		if ($globalDBdriver == 'mysql') {
95
-		    $filter_query_date .= " AND YEAR(spotter_archive_output.date) = '".$filter['year']."'";
95
+			$filter_query_date .= " AND YEAR(spotter_archive_output.date) = '".$filter['year']."'";
96 96
 		} else {
97
-		    $filter_query_date .= " AND EXTRACT(YEAR FROM spotter_archive_output.date) = '".$filter['year']."'";
97
+			$filter_query_date .= " AND EXTRACT(YEAR FROM spotter_archive_output.date) = '".$filter['year']."'";
98
+		}
98 99
 		}
99
-	    }
100
-	    if (isset($filter['month']) && $filter['month'] != '') {
100
+		if (isset($filter['month']) && $filter['month'] != '') {
101 101
 		if ($globalDBdriver == 'mysql') {
102
-		    $filter_query_date .= " AND MONTH(spotter_archive_output.date) = '".$filter['month']."'";
102
+			$filter_query_date .= " AND MONTH(spotter_archive_output.date) = '".$filter['month']."'";
103 103
 		} else {
104
-		    $filter_query_date .= " AND EXTRACT(MONTH FROM spotter_archive_output.date) = '".$filter['month']."'";
104
+			$filter_query_date .= " AND EXTRACT(MONTH FROM spotter_archive_output.date) = '".$filter['month']."'";
105 105
 		}
106
-	    }
107
-	    if (isset($filter['day']) && $filter['day'] != '') {
106
+		}
107
+		if (isset($filter['day']) && $filter['day'] != '') {
108 108
 		if ($globalDBdriver == 'mysql') {
109
-		    $filter_query_date .= " AND DAY(spotter_archive_output.date) = '".$filter['day']."'";
109
+			$filter_query_date .= " AND DAY(spotter_archive_output.date) = '".$filter['day']."'";
110 110
 		} else {
111
-		    $filter_query_date .= " AND EXTRACT(DAY FROM spotter_archive_output.date) = '".$filter['day']."'";
111
+			$filter_query_date .= " AND EXTRACT(DAY FROM spotter_archive_output.date) = '".$filter['day']."'";
112
+		}
112 113
 		}
113
-	    }
114
-	    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id";
114
+		$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id";
115 115
 	}
116 116
 	if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
117 117
 	elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	}
121 121
 	$filter_query = $filter_query_join.$filter_query_where;
122 122
 	return $filter_query;
123
-    }
123
+	}
124 124
 
125 125
 	// Spotter_archive
126 126
 	public function 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 = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '',$verticalrate = '',$format_source = '', $source_name = '', $over_country = '') {
@@ -151,44 +151,44 @@  discard block
 block discarded – undo
151 151
 	}
152 152
 
153 153
 
154
-        /**
155
-        * Gets all the spotter information based on a particular callsign
156
-        *
157
-        * @return Array the spotter information
158
-        *
159
-        */
160
-        public function getLastArchiveSpotterDataByIdent($ident)
161
-        {
154
+		/**
155
+		 * Gets all the spotter information based on a particular callsign
156
+		 *
157
+		 * @return Array the spotter information
158
+		 *
159
+		 */
160
+		public function getLastArchiveSpotterDataByIdent($ident)
161
+		{
162 162
 		$Spotter = new Spotter($this->db);
163
-                date_default_timezone_set('UTC');
163
+				date_default_timezone_set('UTC');
164 164
 
165
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
166
-                //$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
167
-                $query  = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
165
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
166
+				//$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
167
+				$query  = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
168 168
 
169
-                $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident));
169
+				$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident));
170 170
 
171
-                return $spotter_array;
172
-        }
171
+				return $spotter_array;
172
+		}
173 173
 
174 174
 
175
-        /**
176
-        * Gets last the spotter information based on a particular id
177
-        *
178
-        * @return Array the spotter information
179
-        *
180
-        */
181
-        public function getLastArchiveSpotterDataById($id)
182
-        {
183
-    		$Spotter = new Spotter($this->db);
184
-                date_default_timezone_set('UTC');
185
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
186
-                //$query  = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id";
187
-                //$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
188
-                $query  = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1";
175
+		/**
176
+		 * Gets last the spotter information based on a particular id
177
+		 *
178
+		 * @return Array the spotter information
179
+		 *
180
+		 */
181
+		public function getLastArchiveSpotterDataById($id)
182
+		{
183
+			$Spotter = new Spotter($this->db);
184
+				date_default_timezone_set('UTC');
185
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
186
+				//$query  = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id";
187
+				//$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
188
+				$query  = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1";
189 189
 
190 190
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
191
-                  /*
191
+				  /*
192 192
                 try {
193 193
                         $Connection = new Connection();
194 194
                         $sth = Connection->$db->prepare($query);
@@ -198,232 +198,232 @@  discard block
 block discarded – undo
198 198
                 }
199 199
                 $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC);
200 200
                 */
201
-                $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id));
202
-
203
-                return $spotter_array;
204
-        }
205
-
206
-        /**
207
-        * Gets all the spotter information based on a particular id
208
-        *
209
-        * @return Array the spotter information
210
-        *
211
-        */
212
-        public function getAllArchiveSpotterDataById($id)
213
-        {
214
-                date_default_timezone_set('UTC');
215
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
216
-                $query  = $this->global_query." WHERE spotter_archive.flightaware_id = :id";
201
+				$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id));
202
+
203
+				return $spotter_array;
204
+		}
205
+
206
+		/**
207
+		 * Gets all the spotter information based on a particular id
208
+		 *
209
+		 * @return Array the spotter information
210
+		 *
211
+		 */
212
+		public function getAllArchiveSpotterDataById($id)
213
+		{
214
+				date_default_timezone_set('UTC');
215
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
216
+				$query  = $this->global_query." WHERE spotter_archive.flightaware_id = :id";
217 217
 
218 218
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
219 219
 
220
-                try {
221
-                        $sth = $this->db->prepare($query);
222
-                        $sth->execute(array(':id' => $id));
223
-                } catch(PDOException $e) {
224
-                        echo $e->getMessage();
225
-                        die;
226
-                }
227
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
228
-
229
-                return $spotter_array;
230
-        }
231
-
232
-        /**
233
-        * Gets coordinate & time spotter information based on a particular id
234
-        *
235
-        * @return Array the spotter information
236
-        *
237
-        */
238
-        public function getCoordArchiveSpotterDataById($id)
239
-        {
240
-                date_default_timezone_set('UTC');
241
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
242
-                $query  = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
220
+				try {
221
+						$sth = $this->db->prepare($query);
222
+						$sth->execute(array(':id' => $id));
223
+				} catch(PDOException $e) {
224
+						echo $e->getMessage();
225
+						die;
226
+				}
227
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
228
+
229
+				return $spotter_array;
230
+		}
231
+
232
+		/**
233
+		 * Gets coordinate & time spotter information based on a particular id
234
+		 *
235
+		 * @return Array the spotter information
236
+		 *
237
+		 */
238
+		public function getCoordArchiveSpotterDataById($id)
239
+		{
240
+				date_default_timezone_set('UTC');
241
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
242
+				$query  = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
243 243
 
244 244
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
245 245
 
246
-                try {
247
-                        $sth = $this->db->prepare($query);
248
-                        $sth->execute(array(':id' => $id));
249
-                } catch(PDOException $e) {
250
-                        echo $e->getMessage();
251
-                        die;
252
-                }
253
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
246
+				try {
247
+						$sth = $this->db->prepare($query);
248
+						$sth->execute(array(':id' => $id));
249
+				} catch(PDOException $e) {
250
+						echo $e->getMessage();
251
+						die;
252
+				}
253
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
254 254
 
255
-                return $spotter_array;
256
-        }
255
+				return $spotter_array;
256
+		}
257 257
 
258 258
 
259
-        /**
260
-        * Gets altitude information based on a particular callsign
261
-        *
262
-        * @return Array the spotter information
263
-        *
264
-        */
265
-        public function getAltitudeArchiveSpotterDataByIdent($ident)
266
-        {
259
+		/**
260
+		 * Gets altitude information based on a particular callsign
261
+		 *
262
+		 * @return Array the spotter information
263
+		 *
264
+		 */
265
+		public function getAltitudeArchiveSpotterDataByIdent($ident)
266
+		{
267 267
 
268
-                date_default_timezone_set('UTC');
268
+				date_default_timezone_set('UTC');
269 269
 
270
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
271
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
270
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
271
+				$query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
272 272
 
273
-                try {
274
-                        $sth = $this->db->prepare($query);
275
-                        $sth->execute(array(':ident' => $ident));
276
-                } catch(PDOException $e) {
277
-                        echo $e->getMessage();
278
-                        die;
279
-                }
280
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
273
+				try {
274
+						$sth = $this->db->prepare($query);
275
+						$sth->execute(array(':ident' => $ident));
276
+				} catch(PDOException $e) {
277
+						echo $e->getMessage();
278
+						die;
279
+				}
280
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
281 281
 
282
-                return $spotter_array;
283
-        }
282
+				return $spotter_array;
283
+		}
284 284
 
285
-        /**
286
-        * Gets altitude information based on a particular id
287
-        *
288
-        * @return Array the spotter information
289
-        *
290
-        */
291
-        public function getAltitudeArchiveSpotterDataById($id)
292
-        {
285
+		/**
286
+		 * Gets altitude information based on a particular id
287
+		 *
288
+		 * @return Array the spotter information
289
+		 *
290
+		 */
291
+		public function getAltitudeArchiveSpotterDataById($id)
292
+		{
293 293
 
294
-                date_default_timezone_set('UTC');
294
+				date_default_timezone_set('UTC');
295 295
 
296
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
297
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
296
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
297
+				$query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
298 298
 
299
-                try {
300
-                        $sth = $this->db->prepare($query);
301
-                        $sth->execute(array(':id' => $id));
302
-                } catch(PDOException $e) {
303
-                        echo $e->getMessage();
304
-                        die;
305
-                }
306
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
299
+				try {
300
+						$sth = $this->db->prepare($query);
301
+						$sth->execute(array(':id' => $id));
302
+				} catch(PDOException $e) {
303
+						echo $e->getMessage();
304
+						die;
305
+				}
306
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
307 307
 
308
-                return $spotter_array;
309
-        }
308
+				return $spotter_array;
309
+		}
310 310
 
311
-        /**
312
-        * Gets altitude & speed information based on a particular id
313
-        *
314
-        * @return Array the spotter information
315
-        *
316
-        */
317
-        public function getAltitudeSpeedArchiveSpotterDataById($id)
318
-        {
311
+		/**
312
+		 * Gets altitude & speed information based on a particular id
313
+		 *
314
+		 * @return Array the spotter information
315
+		 *
316
+		 */
317
+		public function getAltitudeSpeedArchiveSpotterDataById($id)
318
+		{
319 319
 
320
-                date_default_timezone_set('UTC');
320
+				date_default_timezone_set('UTC');
321 321
 
322
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
323
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date";
322
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
323
+				$query  = "SELECT spotter_archive.altitude, spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date";
324 324
 
325
-                try {
326
-                        $sth = $this->db->prepare($query);
327
-                        $sth->execute(array(':id' => $id));
328
-                } catch(PDOException $e) {
329
-                        echo $e->getMessage();
330
-                        die;
331
-                }
332
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
325
+				try {
326
+						$sth = $this->db->prepare($query);
327
+						$sth->execute(array(':id' => $id));
328
+				} catch(PDOException $e) {
329
+						echo $e->getMessage();
330
+						die;
331
+				}
332
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
333 333
 
334
-                return $spotter_array;
335
-        }
334
+				return $spotter_array;
335
+		}
336 336
 
337 337
 
338
-        /**
339
-        * Gets altitude information based on a particular callsign
340
-        *
341
-        * @return Array the spotter information
342
-        *
343
-        */
344
-        public function getLastAltitudeArchiveSpotterDataByIdent($ident)
345
-        {
338
+		/**
339
+		 * Gets altitude information based on a particular callsign
340
+		 *
341
+		 * @return Array the spotter information
342
+		 *
343
+		 */
344
+		public function getLastAltitudeArchiveSpotterDataByIdent($ident)
345
+		{
346 346
 
347
-                date_default_timezone_set('UTC');
347
+				date_default_timezone_set('UTC');
348 348
 
349
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
350
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
349
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
350
+				$query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
351 351
 //                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident";
352 352
 
353
-                try {
354
-                        $sth = $this->db->prepare($query);
355
-                        $sth->execute(array(':ident' => $ident));
356
-                } catch(PDOException $e) {
357
-                        echo $e->getMessage();
358
-                        die;
359
-                }
360
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
353
+				try {
354
+						$sth = $this->db->prepare($query);
355
+						$sth->execute(array(':ident' => $ident));
356
+				} catch(PDOException $e) {
357
+						echo $e->getMessage();
358
+						die;
359
+				}
360
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
361 361
 
362
-                return $spotter_array;
363
-        }
362
+				return $spotter_array;
363
+		}
364 364
 
365 365
 
366 366
 
367
-       /**
368
-        * Gets all the archive spotter information
369
-        *
370
-        * @return Array the spotter information
371
-        *
372
-        */
373
-        public function getSpotterArchiveData($ident,$flightaware_id,$date)
374
-        {
375
-    		$Spotter = new Spotter($this->db);
376
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
377
-                $query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
367
+	   /**
368
+	    * Gets all the archive spotter information
369
+	    *
370
+	    * @return Array the spotter information
371
+	    *
372
+	    */
373
+		public function getSpotterArchiveData($ident,$flightaware_id,$date)
374
+		{
375
+			$Spotter = new Spotter($this->db);
376
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
377
+				$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
378 378
 
379
-                $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%'));
379
+				$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%'));
380 380
 
381
-                return $spotter_array;
382
-        }
381
+				return $spotter_array;
382
+		}
383 383
         
384
-        public function deleteSpotterArchiveTrackData()
385
-        {
384
+		public function deleteSpotterArchiveTrackData()
385
+		{
386 386
 		global $globalArchiveKeepTrackMonths;
387
-                date_default_timezone_set('UTC');
387
+				date_default_timezone_set('UTC');
388 388
 		$query = 'DELETE FROM spotter_archive WHERE spotter_archive.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$globalArchiveKeepTrackMonths.' MONTH)';
389
-                try {
390
-                        $sth = $this->db->prepare($query);
391
-                        $sth->execute();
392
-                } catch(PDOException $e) {
393
-                        echo $e->getMessage();
394
-                        die;
395
-                }
389
+				try {
390
+						$sth = $this->db->prepare($query);
391
+						$sth->execute();
392
+				} catch(PDOException $e) {
393
+						echo $e->getMessage();
394
+						die;
395
+				}
396 396
 	}
397 397
 
398 398
 	/**
399
-        * Gets Minimal Live Spotter data
400
-        *
401
-        * @return Array the spotter information
402
-        *
403
-        */
404
-        public function getMinLiveSpotterData($begindate,$enddate,$filter = array())
405
-        {
406
-                global $globalDBdriver, $globalLiveInterval;
407
-                date_default_timezone_set('UTC');
408
-
409
-                $filter_query = '';
410
-                if (isset($filter['source']) && !empty($filter['source'])) {
411
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
412
-                }
413
-                // Use spotter_output also ?
414
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
415
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
416
-                }
417
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
418
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
419
-                }
420
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
421
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
422
-                }
423
-
424
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
425
-                if ($globalDBdriver == 'mysql') {
426
-                        /*
399
+	 * Gets Minimal Live Spotter data
400
+	 *
401
+	 * @return Array the spotter information
402
+	 *
403
+	 */
404
+		public function getMinLiveSpotterData($begindate,$enddate,$filter = array())
405
+		{
406
+				global $globalDBdriver, $globalLiveInterval;
407
+				date_default_timezone_set('UTC');
408
+
409
+				$filter_query = '';
410
+				if (isset($filter['source']) && !empty($filter['source'])) {
411
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
412
+				}
413
+				// Use spotter_output also ?
414
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
415
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
416
+				}
417
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
418
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
419
+				}
420
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
421
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
422
+				}
423
+
424
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
425
+				if ($globalDBdriver == 'mysql') {
426
+						/*
427 427
                         $query  = 'SELECT a.aircraft_shadow, spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk 
428 428
                     		    FROM spotter_archive 
429 429
                     		    INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao';
@@ -442,56 +442,56 @@  discard block
 block discarded – undo
442 442
 				    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao
443 443
 				    WHERE spotter_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' 
444 444
                         	    '.$filter_query.' ORDER BY flightaware_id';
445
-                } else {
446
-                        //$query  = 'SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao';
447
-                        $query  = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
445
+				} else {
446
+						//$query  = 'SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao';
447
+						$query  = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
448 448
                         	    FROM spotter_archive 
449 449
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao
450 450
                         	    WHERE spotter_archive.date >= '."'".$begindate."'".' AND spotter_archive.date <= '."'".$enddate."'".'
451 451
                         	    '.$filter_query.' ORDER BY flightaware_id';
452
-                }
453
-                //echo $query;
454
-                try {
455
-                        $sth = $this->db->prepare($query);
456
-                        $sth->execute();
457
-                } catch(PDOException $e) {
458
-                        echo $e->getMessage();
459
-                        die;
460
-                }
461
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
462
-
463
-                return $spotter_array;
464
-        }
452
+				}
453
+				//echo $query;
454
+				try {
455
+						$sth = $this->db->prepare($query);
456
+						$sth->execute();
457
+				} catch(PDOException $e) {
458
+						echo $e->getMessage();
459
+						die;
460
+				}
461
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
462
+
463
+				return $spotter_array;
464
+		}
465 465
 
466 466
 	/**
467
-        * Gets Minimal Live Spotter data
468
-        *
469
-        * @return Array the spotter information
470
-        *
471
-        */
472
-        public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array())
473
-        {
474
-                global $globalDBdriver, $globalLiveInterval;
475
-                date_default_timezone_set('UTC');
476
-
477
-                $filter_query = '';
478
-                if (isset($filter['source']) && !empty($filter['source'])) {
479
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
480
-                }
481
-                // Should use spotter_output also ?
482
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
483
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
484
-                }
485
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
486
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
487
-                }
488
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
489
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
490
-                }
491
-
492
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
493
-                if ($globalDBdriver == 'mysql') {
494
-                        /*
467
+	 * Gets Minimal Live Spotter data
468
+	 *
469
+	 * @return Array the spotter information
470
+	 *
471
+	 */
472
+		public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array())
473
+		{
474
+				global $globalDBdriver, $globalLiveInterval;
475
+				date_default_timezone_set('UTC');
476
+
477
+				$filter_query = '';
478
+				if (isset($filter['source']) && !empty($filter['source'])) {
479
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
480
+				}
481
+				// Should use spotter_output also ?
482
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
483
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
484
+				}
485
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
486
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
487
+				}
488
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
489
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
490
+				}
491
+
492
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
493
+				if ($globalDBdriver == 'mysql') {
494
+						/*
495 495
                         $query  = 'SELECT a.aircraft_shadow, spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk 
496 496
                     		    FROM spotter_archive 
497 497
                     		    INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao';
@@ -502,95 +502,95 @@  discard block
 block discarded – undo
502 502
 				    WHERE (spotter_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') 
503 503
                         	    '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow';
504 504
 
505
-                } else {
506
-                        //$query  = 'SELECT spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow FROM spotter_archive_output INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive_output.flightaware_id = s.flightaware_id AND spotter_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao';
507
-                       /*
505
+				} else {
506
+						//$query  = 'SELECT spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow FROM spotter_archive_output INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive_output.flightaware_id = s.flightaware_id AND spotter_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao';
507
+					   /*
508 508
                         $query  = 'SELECT spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow
509 509
                         	    FROM spotter_archive_output 
510 510
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao
511 511
                         	    WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".'
512 512
                         	    '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow';
513 513
                         */
514
-                        $query  = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow
514
+						$query  = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow
515 515
                         	    FROM spotter_archive_output 
516 516
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao
517 517
                         	    WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".'
518 518
                         	    '.$filter_query.' LIMIT 200 OFFSET 0';
519 519
 //                        	    .' GROUP BY spotter_output.flightaware_id, spotter_output.ident, spotter_output.aircraft_icao, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao, spotter_output.latitude, spotter_output.longitude, spotter_output.altitude, spotter_output.heading, spotter_output.ground_speed, spotter_output.squawk, a.aircraft_shadow';
520 520
                         	    
521
-                }
522
-                //echo $query;
523
-                try {
524
-                        $sth = $this->db->prepare($query);
525
-                        $sth->execute();
526
-                } catch(PDOException $e) {
527
-                        echo $e->getMessage();
528
-                        die;
529
-                }
530
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
531
-
532
-                return $spotter_array;
533
-        }
521
+				}
522
+				//echo $query;
523
+				try {
524
+						$sth = $this->db->prepare($query);
525
+						$sth->execute();
526
+				} catch(PDOException $e) {
527
+						echo $e->getMessage();
528
+						die;
529
+				}
530
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
531
+
532
+				return $spotter_array;
533
+		}
534 534
 
535 535
 	 /**
536
-        * Gets count Live Spotter data
537
-        *
538
-        * @return Array the spotter information
539
-        *
540
-        */
541
-        public function getLiveSpotterCount($begindate,$enddate,$filter = array())
542
-        {
543
-                global $globalDBdriver, $globalLiveInterval;
544
-                date_default_timezone_set('UTC');
545
-
546
-                $filter_query = '';
547
-                if (isset($filter['source']) && !empty($filter['source'])) {
548
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
549
-                }
550
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
551
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
552
-                }
553
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
554
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
555
-                }
556
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
557
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
558
-                }
559
-
560
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
561
-                if ($globalDBdriver == 'mysql') {
536
+	  * Gets count Live Spotter data
537
+	  *
538
+	  * @return Array the spotter information
539
+	  *
540
+	  */
541
+		public function getLiveSpotterCount($begindate,$enddate,$filter = array())
542
+		{
543
+				global $globalDBdriver, $globalLiveInterval;
544
+				date_default_timezone_set('UTC');
545
+
546
+				$filter_query = '';
547
+				if (isset($filter['source']) && !empty($filter['source'])) {
548
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
549
+				}
550
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
551
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
552
+				}
553
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
554
+						$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
555
+				}
556
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
557
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
558
+				}
559
+
560
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
561
+				if ($globalDBdriver == 'mysql') {
562 562
 			$query = 'SELECT COUNT(DISTINCT flightaware_id) as nb 
563 563
 			FROM spotter_archive l 
564 564
 			WHERE (l.date BETWEEN DATE_SUB('."'".$begindate."'".',INTERVAL '.$globalLiveInterval.' SECOND) AND '."'".$begindate."'".')'.$filter_query;
565
-                } else {
565
+				} else {
566 566
 			$query = 'SELECT COUNT(DISTINCT flightaware_id) as nb FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."' - INTERVAL '".$globalLiveInterval." SECONDS' AND "."'".$enddate."'".')'.$filter_query;
567
-                }
568
-                //echo $query;
569
-                try {
570
-                        $sth = $this->db->prepare($query);
571
-                        $sth->execute();
572
-                } catch(PDOException $e) {
573
-                        echo $e->getMessage();
574
-                        die;
575
-                }
567
+				}
568
+				//echo $query;
569
+				try {
570
+						$sth = $this->db->prepare($query);
571
+						$sth->execute();
572
+				} catch(PDOException $e) {
573
+						echo $e->getMessage();
574
+						die;
575
+				}
576 576
 		$result = $sth->fetch(PDO::FETCH_ASSOC);
577 577
 		$sth->closeCursor();
578
-                return $result['nb'];
578
+				return $result['nb'];
579 579
 
580
-        }
580
+		}
581 581
 
582 582
 
583 583
 
584 584
 	// Spotter_Archive_output
585 585
 	
586
-    /**
587
-    * Gets all the spotter information
588
-    *
589
-    * @return Array the spotter information
590
-    *
591
-    */
592
-    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())
593
-    {
586
+	/**
587
+	 * Gets all the spotter information
588
+	 *
589
+	 * @return Array the spotter information
590
+	 *
591
+	 */
592
+	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())
593
+	{
594 594
 	global $globalTimezone, $globalDBdriver;
595 595
 	require_once(dirname(__FILE__).'/class.Translation.php');
596 596
 	$Translation = new Translation();
@@ -604,159 +604,159 @@  discard block
 block discarded – undo
604 604
 	$filter_query = $this->getFilter($filters);
605 605
 	if ($q != "")
606 606
 	{
607
-	    if (!is_string($q))
608
-	    {
607
+		if (!is_string($q))
608
+		{
609 609
 		return false;
610
-	    } else {
610
+		} else {
611 611
 	        
612 612
 		$q_array = explode(" ", $q);
613 613
 		
614 614
 		foreach ($q_array as $q_item){
615
-		    $additional_query .= " AND (";
616
-		    $additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR ";
617
-		    $additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR ";
618
-		    $additional_query .= "(spotter_archive_output.aircraft_name like '%".$q_item."%') OR ";
619
-		    $additional_query .= "(spotter_archive_output.aircraft_manufacturer like '%".$q_item."%') OR ";
620
-		    $additional_query .= "(spotter_archive_output.airline_icao like '%".$q_item."%') OR ";
621
-		    $additional_query .= "(spotter_archive_output.airline_name like '%".$q_item."%') OR ";
622
-		    $additional_query .= "(spotter_archive_output.airline_country like '%".$q_item."%') OR ";
623
-		    $additional_query .= "(spotter_archive_output.departure_airport_icao like '%".$q_item."%') OR ";
624
-		    $additional_query .= "(spotter_archive_output.departure_airport_name like '%".$q_item."%') OR ";
625
-		    $additional_query .= "(spotter_archive_output.departure_airport_city like '%".$q_item."%') OR ";
626
-		    $additional_query .= "(spotter_archive_output.departure_airport_country like '%".$q_item."%') OR ";
627
-		    $additional_query .= "(spotter_archive_output.arrival_airport_icao like '%".$q_item."%') OR ";
628
-		    $additional_query .= "(spotter_archive_output.arrival_airport_name like '%".$q_item."%') OR ";
629
-		    $additional_query .= "(spotter_archive_output.arrival_airport_city like '%".$q_item."%') OR ";
630
-		    $additional_query .= "(spotter_archive_output.arrival_airport_country like '%".$q_item."%') OR ";
631
-		    $additional_query .= "(spotter_archive_output.registration like '%".$q_item."%') OR ";
632
-		    $additional_query .= "(spotter_archive_output.owner_name like '%".$q_item."%') OR ";
633
-		    $additional_query .= "(spotter_archive_output.pilot_id like '%".$q_item."%') OR ";
634
-		    $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR ";
635
-		    $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR ";
636
-		    $translate = $Translation->ident2icao($q_item);
637
-		    if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
638
-		    $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')";
639
-		    $additional_query .= ")";
640
-		}
641
-	    }
615
+			$additional_query .= " AND (";
616
+			$additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR ";
617
+			$additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR ";
618
+			$additional_query .= "(spotter_archive_output.aircraft_name like '%".$q_item."%') OR ";
619
+			$additional_query .= "(spotter_archive_output.aircraft_manufacturer like '%".$q_item."%') OR ";
620
+			$additional_query .= "(spotter_archive_output.airline_icao like '%".$q_item."%') OR ";
621
+			$additional_query .= "(spotter_archive_output.airline_name like '%".$q_item."%') OR ";
622
+			$additional_query .= "(spotter_archive_output.airline_country like '%".$q_item."%') OR ";
623
+			$additional_query .= "(spotter_archive_output.departure_airport_icao like '%".$q_item."%') OR ";
624
+			$additional_query .= "(spotter_archive_output.departure_airport_name like '%".$q_item."%') OR ";
625
+			$additional_query .= "(spotter_archive_output.departure_airport_city like '%".$q_item."%') OR ";
626
+			$additional_query .= "(spotter_archive_output.departure_airport_country like '%".$q_item."%') OR ";
627
+			$additional_query .= "(spotter_archive_output.arrival_airport_icao like '%".$q_item."%') OR ";
628
+			$additional_query .= "(spotter_archive_output.arrival_airport_name like '%".$q_item."%') OR ";
629
+			$additional_query .= "(spotter_archive_output.arrival_airport_city like '%".$q_item."%') OR ";
630
+			$additional_query .= "(spotter_archive_output.arrival_airport_country like '%".$q_item."%') OR ";
631
+			$additional_query .= "(spotter_archive_output.registration like '%".$q_item."%') OR ";
632
+			$additional_query .= "(spotter_archive_output.owner_name like '%".$q_item."%') OR ";
633
+			$additional_query .= "(spotter_archive_output.pilot_id like '%".$q_item."%') OR ";
634
+			$additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR ";
635
+			$additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR ";
636
+			$translate = $Translation->ident2icao($q_item);
637
+			if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
638
+			$additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')";
639
+			$additional_query .= ")";
640
+		}
641
+		}
642 642
 	}
643 643
 	
644 644
 	if ($registration != "")
645 645
 	{
646
-	    $registration = filter_var($registration,FILTER_SANITIZE_STRING);
647
-	    if (!is_string($registration))
648
-	    {
646
+		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
647
+		if (!is_string($registration))
648
+		{
649 649
 		return false;
650
-	    } else {
650
+		} else {
651 651
 		$additional_query .= " AND (spotter_archive_output.registration = '".$registration."')";
652
-	    }
652
+		}
653 653
 	}
654 654
 	
655 655
 	if ($aircraft_icao != "")
656 656
 	{
657
-	    $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
658
-	    if (!is_string($aircraft_icao))
659
-	    {
657
+		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
658
+		if (!is_string($aircraft_icao))
659
+		{
660 660
 		return false;
661
-	    } else {
661
+		} else {
662 662
 		$additional_query .= " AND (spotter_archive_output.aircraft_icao = '".$aircraft_icao."')";
663
-	    }
663
+		}
664 664
 	}
665 665
 	
666 666
 	if ($aircraft_manufacturer != "")
667 667
 	{
668
-	    $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
669
-	    if (!is_string($aircraft_manufacturer))
670
-	    {
668
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
669
+		if (!is_string($aircraft_manufacturer))
670
+		{
671 671
 		return false;
672
-	    } else {
672
+		} else {
673 673
 		$additional_query .= " AND (spotter_archive_output.aircraft_manufacturer = '".$aircraft_manufacturer."')";
674
-	    }
674
+		}
675 675
 	}
676 676
 	
677 677
 	if ($highlights == "true")
678 678
 	{
679
-	    if (!is_string($highlights))
680
-	    {
679
+		if (!is_string($highlights))
680
+		{
681 681
 		return false;
682
-	    } else {
682
+		} else {
683 683
 		$additional_query .= " AND (spotter_archive_output.highlight <> '')";
684
-	    }
684
+		}
685 685
 	}
686 686
 	
687 687
 	if ($airline_icao != "")
688 688
 	{
689
-	    $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
690
-	    if (!is_string($airline_icao))
691
-	    {
689
+		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
690
+		if (!is_string($airline_icao))
691
+		{
692 692
 		return false;
693
-	    } else {
693
+		} else {
694 694
 		$additional_query .= " AND (spotter_archive_output.airline_icao = '".$airline_icao."')";
695
-	    }
695
+		}
696 696
 	}
697 697
 	
698 698
 	if ($airline_country != "")
699 699
 	{
700
-	    $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
701
-	    if (!is_string($airline_country))
702
-	    {
700
+		$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
701
+		if (!is_string($airline_country))
702
+		{
703 703
 		return false;
704
-	    } else {
704
+		} else {
705 705
 		$additional_query .= " AND (spotter_archive_output.airline_country = '".$airline_country."')";
706
-	    }
706
+		}
707 707
 	}
708 708
 	
709 709
 	if ($airline_type != "")
710 710
 	{
711
-	    $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
712
-	    if (!is_string($airline_type))
713
-	    {
711
+		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
712
+		if (!is_string($airline_type))
713
+		{
714 714
 		return false;
715
-	    } else {
715
+		} else {
716 716
 		if ($airline_type == "passenger")
717 717
 		{
718
-		    $additional_query .= " AND (spotter_archive_output.airline_type = 'passenger')";
718
+			$additional_query .= " AND (spotter_archive_output.airline_type = 'passenger')";
719 719
 		}
720 720
 		if ($airline_type == "cargo")
721 721
 		{
722
-		    $additional_query .= " AND (spotter_archive_output.airline_type = 'cargo')";
722
+			$additional_query .= " AND (spotter_archive_output.airline_type = 'cargo')";
723 723
 		}
724 724
 		if ($airline_type == "military")
725 725
 		{
726
-		    $additional_query .= " AND (spotter_archive_output.airline_type = 'military')";
726
+			$additional_query .= " AND (spotter_archive_output.airline_type = 'military')";
727
+		}
727 728
 		}
728
-	    }
729 729
 	}
730 730
 	
731 731
 	if ($airport != "")
732 732
 	{
733
-	    $airport = filter_var($airport,FILTER_SANITIZE_STRING);
734
-	    if (!is_string($airport))
735
-	    {
733
+		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
734
+		if (!is_string($airport))
735
+		{
736 736
 		return false;
737
-	    } else {
737
+		} else {
738 738
 		$additional_query .= " AND ((spotter_archive_output.departure_airport_icao = '".$airport."') OR (spotter_archive_output.arrival_airport_icao = '".$airport."'))";
739
-	    }
739
+		}
740 740
 	}
741 741
 	
742 742
 	if ($airport_country != "")
743 743
 	{
744
-	    $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
745
-	    if (!is_string($airport_country))
746
-	    {
744
+		$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
745
+		if (!is_string($airport_country))
746
+		{
747 747
 		return false;
748
-	    } else {
748
+		} else {
749 749
 		$additional_query .= " AND ((spotter_archive_output.departure_airport_country = '".$airport_country."') OR (spotter_archive_output.arrival_airport_country = '".$airport_country."'))";
750
-	    }
750
+		}
751 751
 	}
752 752
     
753 753
 	if ($callsign != "")
754 754
 	{
755
-	    $callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
756
-	    if (!is_string($callsign))
757
-	    {
755
+		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
756
+		if (!is_string($callsign))
757
+		{
758 758
 		return false;
759
-	    } else {
759
+		} else {
760 760
 		$translate = $Translation->ident2icao($callsign);
761 761
 		if ($translate != $callsign) {
762 762
 			$additional_query .= " AND (spotter_archive_output.ident = :callsign OR spotter_archive_output.ident = :translate)";
@@ -764,99 +764,99 @@  discard block
 block discarded – undo
764 764
 		} else {
765 765
 			$additional_query .= " AND (spotter_archive_output.ident = '".$callsign."')";
766 766
 		}
767
-	    }
767
+		}
768 768
 	}
769 769
 
770 770
 	if ($owner != "")
771 771
 	{
772
-	    $owner = filter_var($owner,FILTER_SANITIZE_STRING);
773
-	    if (!is_string($owner))
774
-	    {
772
+		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
773
+		if (!is_string($owner))
774
+		{
775 775
 		return false;
776
-	    } else {
776
+		} else {
777 777
 		$additional_query .= " AND (spotter_archive_output.owner_name = '".$owner."')";
778
-	    }
778
+		}
779 779
 	}
780 780
 
781 781
 	if ($pilot_name != "")
782 782
 	{
783
-	    $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
784
-	    if (!is_string($pilot_name))
785
-	    {
783
+		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
784
+		if (!is_string($pilot_name))
785
+		{
786 786
 		return false;
787
-	    } else {
787
+		} else {
788 788
 		$additional_query .= " AND (spotter_archive_output.pilot_name = '".$pilot_name."')";
789
-	    }
789
+		}
790 790
 	}
791 791
 	
792 792
 	if ($pilot_id != "")
793 793
 	{
794
-	    $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
795
-	    if (!is_string($pilot_id))
796
-	    {
794
+		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
795
+		if (!is_string($pilot_id))
796
+		{
797 797
 		return false;
798
-	    } else {
798
+		} else {
799 799
 		$additional_query .= " AND (spotter_archive_output.pilot_id = '".$pilot_id."')";
800
-	    }
800
+		}
801 801
 	}
802 802
 	
803 803
 	if ($departure_airport_route != "")
804 804
 	{
805
-	    $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
806
-	    if (!is_string($departure_airport_route))
807
-	    {
805
+		$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
806
+		if (!is_string($departure_airport_route))
807
+		{
808 808
 		return false;
809
-	    } else {
809
+		} else {
810 810
 		$additional_query .= " AND (spotter_archive_output.departure_airport_icao = '".$departure_airport_route."')";
811
-	    }
811
+		}
812 812
 	}
813 813
 	
814 814
 	if ($arrival_airport_route != "")
815 815
 	{
816
-	    $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
817
-	    if (!is_string($arrival_airport_route))
818
-	    {
816
+		$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
817
+		if (!is_string($arrival_airport_route))
818
+		{
819 819
 		return false;
820
-	    } else {
820
+		} else {
821 821
 		$additional_query .= " AND (spotter_archive_output.arrival_airport_icao = '".$arrival_airport_route."')";
822
-	    }
822
+		}
823 823
 	}
824 824
 	
825 825
 	if ($altitude != "")
826 826
 	{
827
-	    $altitude_array = explode(",", $altitude);
827
+		$altitude_array = explode(",", $altitude);
828 828
 	    
829
-	    $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
830
-	    $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
829
+		$altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
830
+		$altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
831 831
 	    
832 832
 
833
-	    if ($altitude_array[1] != "")
834
-	    {                
833
+		if ($altitude_array[1] != "")
834
+		{                
835 835
 		$altitude_array[0] = substr($altitude_array[0], 0, -2);
836 836
 		$altitude_array[1] = substr($altitude_array[1], 0, -2);
837 837
 		$additional_query .= " AND altitude BETWEEN '".$altitude_array[0]."' AND '".$altitude_array[1]."' ";
838
-	    } else {
838
+		} else {
839 839
 		$altitude_array[0] = substr($altitude_array[0], 0, -2);
840 840
 		$additional_query .= " AND altitude <= '".$altitude_array[0]."' ";
841
-	    }
841
+		}
842 842
 	}
843 843
 	
844 844
 	if ($date_posted != "")
845 845
 	{
846
-	    $date_array = explode(",", $date_posted);
846
+		$date_array = explode(",", $date_posted);
847 847
 	    
848
-	    $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
849
-	    $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
848
+		$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
849
+		$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
850 850
 	    
851
-	    if ($globalTimezone != '') {
851
+		if ($globalTimezone != '') {
852 852
 		date_default_timezone_set($globalTimezone);
853 853
 		$datetime = new DateTime();
854 854
 		$offset = $datetime->format('P');
855
-	    } else $offset = '+00:00';
855
+		} else $offset = '+00:00';
856 856
 
857 857
 
858
-	    if ($date_array[1] != "")
859
-	    {                
858
+		if ($date_array[1] != "")
859
+		{                
860 860
 		$date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0]));
861 861
 		$date_array[1] = date("Y-m-d H:i:s", strtotime($date_array[1]));
862 862
 		if ($globalDBdriver == 'mysql') {
@@ -864,28 +864,28 @@  discard block
 block discarded – undo
864 864
 		} else {
865 865
 			$additional_query .= " AND spotter_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." >= CAST('".$date_array[0]."' AS TIMESTAMP) AND spotter_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." <= CAST('".$date_array[1]."' AS TIMESTAMP) ";
866 866
 		}
867
-	    } else {
867
+		} else {
868 868
 		$date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0]));
869
-                if ($globalDBdriver == 'mysql') {
869
+				if ($globalDBdriver == 'mysql') {
870 870
 			$additional_query .= " AND TIMESTAMP(CONVERT_TZ(spotter_archive_output.date,'+00:00', '".$offset."')) >= '".$date_array[0]."' ";
871 871
 		} else {
872 872
 			$additional_query .= " AND spotter_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." >= CAST('".$date_array[0]."' AS TIMESTAMP) ";
873 873
 		}
874
-	    }
874
+		}
875 875
 	}
876 876
 	
877 877
 	if ($limit != "")
878 878
 	{
879
-	    $limit_array = explode(",", $limit);
879
+		$limit_array = explode(",", $limit);
880 880
 	    
881
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
882
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
881
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
882
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
883 883
 	    
884
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
885
-	    {
884
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
885
+		{
886 886
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
887 887
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
888
-	    }
888
+		}
889 889
 	}
890 890
 	
891 891
 
@@ -916,33 +916,33 @@  discard block
 block discarded – undo
916 916
 	$spotter_array = $Spotter->getDataFromDB($query, $query_values,$limit_query);
917 917
 
918 918
 	return $spotter_array;
919
-    }
919
+	}
920 920
 
921
-    public function deleteSpotterArchiveData()
922
-    {
921
+	public function deleteSpotterArchiveData()
922
+	{
923 923
 		global $globalArchiveKeepMonths, $globalDBdriver;
924
-                date_default_timezone_set('UTC');
925
-                if ($globalDBdriver == 'mysql') {
924
+				date_default_timezone_set('UTC');
925
+				if ($globalDBdriver == 'mysql') {
926 926
 			$query = 'DELETE FROM spotter_archive_output WHERE spotter_archive_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$globalArchiveKeepMonths.' MONTH)';
927 927
 		} else {
928 928
 			$query = "DELETE FROM spotter_archive_output WHERE spotter_archive_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveKeepMonths." MONTH'";
929 929
 		}
930
-                try {
931
-                        $sth = $this->db->prepare($query);
932
-                        $sth->execute();
933
-                } catch(PDOException $e) {
934
-                        return "error";
935
-                }
930
+				try {
931
+						$sth = $this->db->prepare($query);
932
+						$sth->execute();
933
+				} catch(PDOException $e) {
934
+						return "error";
935
+				}
936 936
 	}
937 937
 
938
-    /**
939
-    * Gets all the spotter information based on the callsign
940
-    *
941
-    * @return Array the spotter information
942
-    *
943
-    */
944
-    public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
945
-    {
938
+	/**
939
+	 * Gets all the spotter information based on the callsign
940
+	 *
941
+	 * @return Array the spotter information
942
+	 *
943
+	 */
944
+	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
945
+	{
946 946
 	$global_query = "SELECT spotter_archive_output.* FROM spotter_archive_output";
947 947
 	
948 948
 	date_default_timezone_set('UTC');
@@ -954,35 +954,35 @@  discard block
 block discarded – undo
954 954
 	
955 955
 	if ($ident != "")
956 956
 	{
957
-	    if (!is_string($ident))
958
-	    {
957
+		if (!is_string($ident))
958
+		{
959 959
 		return false;
960
-	    } else {
960
+		} else {
961 961
 		$additional_query = " AND (spotter_archive_output.ident = :ident)";
962 962
 		$query_values = array(':ident' => $ident);
963
-	    }
963
+		}
964 964
 	}
965 965
 	
966 966
 	if ($limit != "")
967 967
 	{
968
-	    $limit_array = explode(",", $limit);
968
+		$limit_array = explode(",", $limit);
969 969
 	    
970
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
971
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
970
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
971
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
972 972
 	    
973
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
974
-	    {
973
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
974
+		{
975 975
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
976 976
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
977
-	    }
977
+		}
978 978
 	}
979 979
 
980 980
 	if ($sort != "")
981 981
 	{
982
-	    $search_orderby_array = $Spotter->getOrderBy();
983
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
982
+		$search_orderby_array = $Spotter->getOrderBy();
983
+		$orderby_query = $search_orderby_array[$sort]['sql'];
984 984
 	} else {
985
-	    $orderby_query = " ORDER BY spotter_archive_output.date DESC";
985
+		$orderby_query = " ORDER BY spotter_archive_output.date DESC";
986 986
 	}
987 987
 
988 988
 	$query = $global_query." WHERE spotter_archive_output.ident <> '' ".$additional_query." ".$orderby_query;
@@ -990,17 +990,17 @@  discard block
 block discarded – undo
990 990
 	$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
991 991
 
992 992
 	return $spotter_array;
993
-    }
993
+	}
994 994
 
995 995
 
996
-    /**
997
-    * Gets all the spotter information based on the owner
998
-    *
999
-    * @return Array the spotter information
1000
-    *
1001
-    */
1002
-    public function getSpotterDataByOwner($owner = '', $limit = '', $sort = '', $filter = array())
1003
-    {
996
+	/**
997
+	 * Gets all the spotter information based on the owner
998
+	 *
999
+	 * @return Array the spotter information
1000
+	 *
1001
+	 */
1002
+	public function getSpotterDataByOwner($owner = '', $limit = '', $sort = '', $filter = array())
1003
+	{
1004 1004
 	$global_query = "SELECT spotter_archive_output.* FROM spotter_archive_output";
1005 1005
 	
1006 1006
 	date_default_timezone_set('UTC');
@@ -1013,35 +1013,35 @@  discard block
 block discarded – undo
1013 1013
 	
1014 1014
 	if ($owner != "")
1015 1015
 	{
1016
-	    if (!is_string($owner))
1017
-	    {
1016
+		if (!is_string($owner))
1017
+		{
1018 1018
 		return false;
1019
-	    } else {
1019
+		} else {
1020 1020
 		$additional_query = " AND (spotter_archive_output.owner_name = :owner)";
1021 1021
 		$query_values = array(':owner' => $owner);
1022
-	    }
1022
+		}
1023 1023
 	}
1024 1024
 	
1025 1025
 	if ($limit != "")
1026 1026
 	{
1027
-	    $limit_array = explode(",", $limit);
1027
+		$limit_array = explode(",", $limit);
1028 1028
 	    
1029
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1030
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1029
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1030
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1031 1031
 	    
1032
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1033
-	    {
1032
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1033
+		{
1034 1034
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
1035 1035
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
1036
-	    }
1036
+		}
1037 1037
 	}
1038 1038
 
1039 1039
 	if ($sort != "")
1040 1040
 	{
1041
-	    $search_orderby_array = $Spotter->getOrderBy();
1042
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
1041
+		$search_orderby_array = $Spotter->getOrderBy();
1042
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1043 1043
 	} else {
1044
-	    $orderby_query = " ORDER BY spotter_archive_output.date DESC";
1044
+		$orderby_query = " ORDER BY spotter_archive_output.date DESC";
1045 1045
 	}
1046 1046
 
1047 1047
 	$query = $global_query.$filter_query." spotter_archive_output.owner_name <> '' ".$additional_query." ".$orderby_query;
@@ -1049,16 +1049,16 @@  discard block
 block discarded – undo
1049 1049
 	$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
1050 1050
 
1051 1051
 	return $spotter_array;
1052
-    }
1053
-
1054
-    /**
1055
-    * Gets all the spotter information based on the pilot
1056
-    *
1057
-    * @return Array the spotter information
1058
-    *
1059
-    */
1060
-    public function getSpotterDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array())
1061
-    {
1052
+	}
1053
+
1054
+	/**
1055
+	 * Gets all the spotter information based on the pilot
1056
+	 *
1057
+	 * @return Array the spotter information
1058
+	 *
1059
+	 */
1060
+	public function getSpotterDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array())
1061
+	{
1062 1062
 	$global_query = "SELECT spotter_archive_output.* FROM spotter_archive_output";
1063 1063
 	
1064 1064
 	date_default_timezone_set('UTC');
@@ -1077,24 +1077,24 @@  discard block
 block discarded – undo
1077 1077
 	
1078 1078
 	if ($limit != "")
1079 1079
 	{
1080
-	    $limit_array = explode(",", $limit);
1080
+		$limit_array = explode(",", $limit);
1081 1081
 	    
1082
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1083
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1082
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1083
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1084 1084
 	    
1085
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1086
-	    {
1085
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1086
+		{
1087 1087
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
1088 1088
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
1089
-	    }
1089
+		}
1090 1090
 	}
1091 1091
 
1092 1092
 	if ($sort != "")
1093 1093
 	{
1094
-	    $search_orderby_array = $Spotter->getOrderBy();
1095
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
1094
+		$search_orderby_array = $Spotter->getOrderBy();
1095
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1096 1096
 	} else {
1097
-	    $orderby_query = " ORDER BY spotter_archive_output.date DESC";
1097
+		$orderby_query = " ORDER BY spotter_archive_output.date DESC";
1098 1098
 	}
1099 1099
 
1100 1100
 	$query = $global_query.$filter_query." spotter_archive_output.pilot_name <> '' ".$additional_query." ".$orderby_query;
@@ -1102,16 +1102,16 @@  discard block
 block discarded – undo
1102 1102
 	$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
1103 1103
 
1104 1104
 	return $spotter_array;
1105
-    }
1106
-
1107
-    /**
1108
-    * Gets all number of flight over countries
1109
-    *
1110
-    * @return Array the airline country list
1111
-    *
1112
-    */
1113
-    public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1114
-    {
1105
+	}
1106
+
1107
+	/**
1108
+	 * Gets all number of flight over countries
1109
+	 *
1110
+	 * @return Array the airline country list
1111
+	 *
1112
+	 */
1113
+	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1114
+	{
1115 1115
 	global $globalDBdriver;
1116 1116
 	/*
1117 1117
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -1121,14 +1121,14 @@  discard block
 block discarded – undo
1121 1121
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb
1122 1122
 		    FROM countries c, spotter_archive s
1123 1123
 		    WHERE c.iso2 = s.over_country ";
1124
-                if ($olderthanmonths > 0) {
1125
-            		if ($globalDBdriver == 'mysql') {
1124
+				if ($olderthanmonths > 0) {
1125
+					if ($globalDBdriver == 'mysql') {
1126 1126
 				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
1127 1127
 			} else {
1128 1128
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1129 1129
 			}
1130 1130
 		}
1131
-                if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1131
+				if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1132 1132
 	$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1133 1133
 	if ($limit) $query .= " LIMIT 0,10";
1134 1134
       
@@ -1141,23 +1141,23 @@  discard block
 block discarded – undo
1141 1141
         
1142 1142
 	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1143 1143
 	{
1144
-	    $temp_array['flight_count'] = $row['nb'];
1145
-	    $temp_array['flight_country'] = $row['name'];
1146
-	    $temp_array['flight_country_iso3'] = $row['iso3'];
1147
-	    $temp_array['flight_country_iso2'] = $row['iso2'];
1148
-	    $flight_array[] = $temp_array;
1144
+		$temp_array['flight_count'] = $row['nb'];
1145
+		$temp_array['flight_country'] = $row['name'];
1146
+		$temp_array['flight_country_iso3'] = $row['iso3'];
1147
+		$temp_array['flight_country_iso2'] = $row['iso2'];
1148
+		$flight_array[] = $temp_array;
1149 1149
 	}
1150 1150
 	return $flight_array;
1151
-    }
1152
-
1153
-    /**
1154
-    * Gets all number of flight over countries
1155
-    *
1156
-    * @return Array the airline country list
1157
-    *
1158
-    */
1159
-    public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
1160
-    {
1151
+	}
1152
+
1153
+	/**
1154
+	 * Gets all number of flight over countries
1155
+	 *
1156
+	 * @return Array the airline country list
1157
+	 *
1158
+	 */
1159
+	public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
1160
+	{
1161 1161
 	global $globalDBdriver;
1162 1162
 	/*
1163 1163
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -1167,14 +1167,14 @@  discard block
 block discarded – undo
1167 1167
 	$query = "SELECT o.airline_icao,c.name, c.iso3, c.iso2, count(c.name) as nb
1168 1168
 		    FROM countries c, spotter_archive s, spotter_output o
1169 1169
 		    WHERE c.iso2 = s.over_country AND o.airline_icao <> '' AND o.flightaware_id = s.flightaware_id ";
1170
-                if ($olderthanmonths > 0) {
1171
-            		if ($globalDBdriver == 'mysql') {
1170
+				if ($olderthanmonths > 0) {
1171
+					if ($globalDBdriver == 'mysql') {
1172 1172
 				$query .= 'AND s.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
1173 1173
 			} else {
1174 1174
 				$query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1175 1175
 			}
1176 1176
 		}
1177
-                if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1177
+				if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1178 1178
 	$query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1179 1179
 	if ($limit) $query .= " LIMIT 0,10";
1180 1180
       
@@ -1187,24 +1187,24 @@  discard block
 block discarded – undo
1187 1187
         
1188 1188
 	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1189 1189
 	{
1190
-	    $temp_array['airline_icao'] = $row['airline_icao'];
1191
-	    $temp_array['flight_count'] = $row['nb'];
1192
-	    $temp_array['flight_country'] = $row['name'];
1193
-	    $temp_array['flight_country_iso3'] = $row['iso3'];
1194
-	    $temp_array['flight_country_iso2'] = $row['iso2'];
1195
-	    $flight_array[] = $temp_array;
1190
+		$temp_array['airline_icao'] = $row['airline_icao'];
1191
+		$temp_array['flight_count'] = $row['nb'];
1192
+		$temp_array['flight_country'] = $row['name'];
1193
+		$temp_array['flight_country_iso3'] = $row['iso3'];
1194
+		$temp_array['flight_country_iso2'] = $row['iso2'];
1195
+		$flight_array[] = $temp_array;
1196 1196
 	}
1197 1197
 	return $flight_array;
1198
-    }
1199
-
1200
-    /**
1201
-    * Gets last spotter information based on a particular callsign
1202
-    *
1203
-    * @return Array the spotter information
1204
-    *
1205
-    */
1206
-    public function getDateArchiveSpotterDataById($id,$date)
1207
-    {
1198
+	}
1199
+
1200
+	/**
1201
+	 * Gets last spotter information based on a particular callsign
1202
+	 *
1203
+	 * @return Array the spotter information
1204
+	 *
1205
+	 */
1206
+	public function getDateArchiveSpotterDataById($id,$date)
1207
+	{
1208 1208
 	$Spotter = new Spotter($this->db);
1209 1209
 	date_default_timezone_set('UTC');
1210 1210
 	$id = filter_var($id, FILTER_SANITIZE_STRING);
@@ -1212,16 +1212,16 @@  discard block
 block discarded – undo
1212 1212
 	$date = date('c',$date);
1213 1213
 	$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date));
1214 1214
 	return $spotter_array;
1215
-    }
1216
-
1217
-    /**
1218
-    * Gets all the spotter information based on a particular callsign
1219
-    *
1220
-    * @return Array the spotter information
1221
-    *
1222
-    */
1223
-    public function getDateArchiveSpotterDataByIdent($ident,$date)
1224
-    {
1215
+	}
1216
+
1217
+	/**
1218
+	 * Gets all the spotter information based on a particular callsign
1219
+	 *
1220
+	 * @return Array the spotter information
1221
+	 *
1222
+	 */
1223
+	public function getDateArchiveSpotterDataByIdent($ident,$date)
1224
+	{
1225 1225
 	$Spotter = new Spotter($this->db);
1226 1226
 	date_default_timezone_set('UTC');
1227 1227
 	$ident = filter_var($ident, FILTER_SANITIZE_STRING);
@@ -1229,16 +1229,16 @@  discard block
 block discarded – undo
1229 1229
 	$date = date('c',$date);
1230 1230
 	$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
1231 1231
 	return $spotter_array;
1232
-    }
1233
-
1234
-    /**
1235
-    * Gets all the spotter information based on the airport
1236
-    *
1237
-    * @return Array the spotter information
1238
-    *
1239
-    */
1240
-    public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1241
-    {
1232
+	}
1233
+
1234
+	/**
1235
+	 * Gets all the spotter information based on the airport
1236
+	 *
1237
+	 * @return Array the spotter information
1238
+	 *
1239
+	 */
1240
+	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1241
+	{
1242 1242
 	global $global_query;
1243 1243
 	$Spotter = new Spotter();
1244 1244
 	date_default_timezone_set('UTC');
@@ -1249,35 +1249,35 @@  discard block
 block discarded – undo
1249 1249
 	
1250 1250
 	if ($airport != "")
1251 1251
 	{
1252
-	    if (!is_string($airport))
1253
-	    {
1252
+		if (!is_string($airport))
1253
+		{
1254 1254
 		return false;
1255
-	    } else {
1255
+		} else {
1256 1256
 		$additional_query .= " AND ((spotter_archive_output.departure_airport_icao = :airport) OR (spotter_archive_output.arrival_airport_icao = :airport))";
1257 1257
 		$query_values = array(':airport' => $airport);
1258
-	    }
1258
+		}
1259 1259
 	}
1260 1260
 	
1261 1261
 	if ($limit != "")
1262 1262
 	{
1263
-	    $limit_array = explode(",", $limit);
1263
+		$limit_array = explode(",", $limit);
1264 1264
 	    
1265
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1266
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1265
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1266
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1267 1267
 	    
1268
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1269
-	    {
1268
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1269
+		{
1270 1270
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
1271 1271
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
1272
-	    }
1272
+		}
1273 1273
 	}
1274 1274
 	
1275 1275
 	if ($sort != "")
1276 1276
 	{
1277
-	    $search_orderby_array = $Spotter->getOrderBy();
1278
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
1277
+		$search_orderby_array = $Spotter->getOrderBy();
1278
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1279 1279
 	} else {
1280
-	    $orderby_query = " ORDER BY spotter_archive_output.date DESC";
1280
+		$orderby_query = " ORDER BY spotter_archive_output.date DESC";
1281 1281
 	}
1282 1282
 
1283 1283
 	$query = $global_query.$filter_query." spotter_archive_output.ident <> '' ".$additional_query." AND ((spotter_archive_output.departure_airport_icao <> 'NA') AND (spotter_archive_output.arrival_airport_icao <> 'NA')) ".$orderby_query;
@@ -1285,6 +1285,6 @@  discard block
 block discarded – undo
1285 1285
 	$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
1286 1286
 
1287 1287
 	return $spotter_array;
1288
-    }
1288
+	}
1289 1289
 }
1290 1290
 ?>
1291 1291
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -13,62 +13,62 @@  discard block
 block discarded – undo
13 13
     * @param Array $filter the filter
14 14
     * @return Array the SQL part
15 15
     */
16
-    public function getFilter($filter = array(),$where = false,$and = false) {
16
+    public function getFilter($filter = array(), $where = false, $and = false) {
17 17
 	global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
18 18
 	$filters = array();
19 19
 	if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
20 20
 		if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
21 21
 			$filters = $globalStatsFilters[$globalFilterName];
22 22
 		} else {
23
-			$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
23
+			$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
24 24
 		}
25 25
 	}
26 26
 	if (isset($filter[0]['source'])) {
27
-		$filters = array_merge($filters,$filter);
27
+		$filters = array_merge($filters, $filter);
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_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id";
36
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id";
37 37
 		    } else {
38
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id";
38
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saff ON saff.flightaware_id = spotter_archive_output.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_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id";
44
+		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id";
45 45
 		} else {
46
-		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id";
46
+		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id";
47 47
 		}
48 48
 	    }
49 49
 	    if (isset($flt['idents']) && !empty($flt['idents'])) {
50 50
 		if (isset($flt['source'])) {
51
-		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id";
51
+		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id";
52 52
 		} else {
53
-		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id";
53
+		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','", $flt['idents'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id";
54 54
 		}
55 55
 	    }
56 56
 	    if (isset($flt['registrations']) && !empty($flt['registrations'])) {
57 57
 		if (isset($flt['source'])) {
58
-		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id";
58
+		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id";
59 59
 		} else {
60
-		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id";
60
+		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id";
61 61
 		}
62 62
 	    }
63 63
 	    if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents']) && isset($flt['registrations']) && empty($flt['registrations'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) {
64 64
 		if (isset($flt['source'])) {
65
-		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saa ON saa.flightaware_id = spotter_archive_output.flightaware_id";
65
+		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saa ON saa.flightaware_id = spotter_archive_output.flightaware_id";
66 66
 		}
67 67
 	    }
68 68
 	}
69 69
 	if (isset($filter['airlines']) && !empty($filter['airlines'])) {
70 70
 	    if ($filter['airlines'][0] != '') {
71
-		$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) saf ON saf.flightaware_id = spotter_archive_output.flightaware_id";
71
+		$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) saf ON saf.flightaware_id = spotter_archive_output.flightaware_id";
72 72
 	    }
73 73
 	}
74 74
 	
@@ -76,16 +76,16 @@  discard block
 block discarded – undo
76 76
 	    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive_output.flightaware_id ";
77 77
 	}
78 78
 	if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
79
-	    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id";
79
+	    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id";
80 80
 	}
81 81
 	if (isset($filter['source']) && !empty($filter['source'])) {
82
-	    $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
82
+	    $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
83 83
 	}
84 84
 	if (isset($filter['ident']) && !empty($filter['ident'])) {
85 85
 	    $filter_query_where .= " AND ident = '".$filter['ident']."'";
86 86
 	}
87 87
 	if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
88
-		$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
88
+		$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
89 89
 	}
90 90
 	if ((isset($filter['year']) && $filter['year'] != '') || (isset($filter['month']) && $filter['month'] != '') || (isset($filter['day']) && $filter['day'] != '')) {
91 91
 	    $filter_query_date = '';
@@ -111,40 +111,40 @@  discard block
 block discarded – undo
111 111
 		    $filter_query_date .= " AND EXTRACT(DAY FROM spotter_archive_output.date) = '".$filter['day']."'";
112 112
 		}
113 113
 	    }
114
-	    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id";
114
+	    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id";
115 115
 	}
116 116
 	if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
117 117
 	elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
118 118
 	if ($filter_query_where != '') {
119
-		$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
119
+		$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
120 120
 	}
121 121
 	$filter_query = $filter_query_join.$filter_query_where;
122 122
 	return $filter_query;
123 123
     }
124 124
 
125 125
 	// Spotter_archive
126
-	public function 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 = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '',$verticalrate = '',$format_source = '', $source_name = '', $over_country = '') {
126
+	public function 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 = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $format_source = '', $source_name = '', $over_country = '') {
127 127
 		require_once(dirname(__FILE__).'/class.Spotter.php');
128 128
 		if ($over_country == '') {
129 129
 			$Spotter = new Spotter($this->db);
130
-			$data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude);
130
+			$data_country = $Spotter->getCountryFromLatitudeLongitude($latitude, $longitude);
131 131
 			if (!empty($data_country)) $country = $data_country['iso2'];
132 132
 			else $country = '';
133 133
 		} else $country = $over_country;
134
-		if ($airline_type === NULL) $airline_type ='';
134
+		if ($airline_type === NULL) $airline_type = '';
135 135
 	
136 136
 		//if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n";
137 137
 		//else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n";
138 138
 
139 139
 		// Route is not added in spotter_archive
140
-		$query  = "INSERT INTO spotter_archive (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, ground_speed, squawk, ModeS, pilot_id, pilot_name, verticalrate,format_source,over_country,source_name)
140
+		$query = "INSERT INTO spotter_archive (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, ground_speed, squawk, ModeS, pilot_id, pilot_name, verticalrate,format_source,over_country,source_name)
141 141
 		        VALUES (: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, :ground_speed, :squawk, :ModeS, :pilot_id, :pilot_name, :verticalrate, :format_source, :over_country, :source_name)";
142 142
 
143
-		$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_name' => $aircraft_name, ':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, ':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date,':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name);
143
+		$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_name' => $aircraft_name, ':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, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name);
144 144
 		try {
145 145
 			$sth = $this->db->prepare($query);
146 146
 			$sth->execute($query_values);
147
-		} catch(PDOException $e) {
147
+		} catch (PDOException $e) {
148 148
 			return "error : ".$e->getMessage();
149 149
 		}
150 150
 		return "success";
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
 
165 165
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
166 166
                 //$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
167
-                $query  = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
167
+                $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
168 168
 
169
-                $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident));
169
+                $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident));
170 170
 
171 171
                 return $spotter_array;
172 172
         }
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
186 186
                 //$query  = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id";
187 187
                 //$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
188
-                $query  = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1";
188
+                $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1";
189 189
 
190 190
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
191 191
                   /*
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
                 }
199 199
                 $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC);
200 200
                 */
201
-                $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id));
201
+                $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id));
202 202
 
203 203
                 return $spotter_array;
204 204
         }
@@ -213,14 +213,14 @@  discard block
 block discarded – undo
213 213
         {
214 214
                 date_default_timezone_set('UTC');
215 215
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
216
-                $query  = $this->global_query." WHERE spotter_archive.flightaware_id = :id";
216
+                $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id";
217 217
 
218 218
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
219 219
 
220 220
                 try {
221 221
                         $sth = $this->db->prepare($query);
222 222
                         $sth->execute(array(':id' => $id));
223
-                } catch(PDOException $e) {
223
+                } catch (PDOException $e) {
224 224
                         echo $e->getMessage();
225 225
                         die;
226 226
                 }
@@ -239,14 +239,14 @@  discard block
 block discarded – undo
239 239
         {
240 240
                 date_default_timezone_set('UTC');
241 241
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
242
-                $query  = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
242
+                $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
243 243
 
244 244
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
245 245
 
246 246
                 try {
247 247
                         $sth = $this->db->prepare($query);
248 248
                         $sth->execute(array(':id' => $id));
249
-                } catch(PDOException $e) {
249
+                } catch (PDOException $e) {
250 250
                         echo $e->getMessage();
251 251
                         die;
252 252
                 }
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
                 date_default_timezone_set('UTC');
269 269
 
270 270
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
271
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
271
+                $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
272 272
 
273 273
                 try {
274 274
                         $sth = $this->db->prepare($query);
275 275
                         $sth->execute(array(':ident' => $ident));
276
-                } catch(PDOException $e) {
276
+                } catch (PDOException $e) {
277 277
                         echo $e->getMessage();
278 278
                         die;
279 279
                 }
@@ -294,12 +294,12 @@  discard block
 block discarded – undo
294 294
                 date_default_timezone_set('UTC');
295 295
 
296 296
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
297
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
297
+                $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
298 298
 
299 299
                 try {
300 300
                         $sth = $this->db->prepare($query);
301 301
                         $sth->execute(array(':id' => $id));
302
-                } catch(PDOException $e) {
302
+                } catch (PDOException $e) {
303 303
                         echo $e->getMessage();
304 304
                         die;
305 305
                 }
@@ -320,12 +320,12 @@  discard block
 block discarded – undo
320 320
                 date_default_timezone_set('UTC');
321 321
 
322 322
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
323
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date";
323
+                $query = "SELECT spotter_archive.altitude, spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date";
324 324
 
325 325
                 try {
326 326
                         $sth = $this->db->prepare($query);
327 327
                         $sth->execute(array(':id' => $id));
328
-                } catch(PDOException $e) {
328
+                } catch (PDOException $e) {
329 329
                         echo $e->getMessage();
330 330
                         die;
331 331
                 }
@@ -347,13 +347,13 @@  discard block
 block discarded – undo
347 347
                 date_default_timezone_set('UTC');
348 348
 
349 349
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
350
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
350
+                $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
351 351
 //                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident";
352 352
 
353 353
                 try {
354 354
                         $sth = $this->db->prepare($query);
355 355
                         $sth->execute(array(':ident' => $ident));
356
-                } catch(PDOException $e) {
356
+                } catch (PDOException $e) {
357 357
                         echo $e->getMessage();
358 358
                         die;
359 359
                 }
@@ -370,13 +370,13 @@  discard block
 block discarded – undo
370 370
         * @return Array the spotter information
371 371
         *
372 372
         */
373
-        public function getSpotterArchiveData($ident,$flightaware_id,$date)
373
+        public function getSpotterArchiveData($ident, $flightaware_id, $date)
374 374
         {
375 375
     		$Spotter = new Spotter($this->db);
376 376
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
377
-                $query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
377
+                $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
378 378
 
379
-                $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%'));
379
+                $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':flightaware_id' => $flightaware_id, ':date' => $date.'%'));
380 380
 
381 381
                 return $spotter_array;
382 382
         }
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
                 try {
390 390
                         $sth = $this->db->prepare($query);
391 391
                         $sth->execute();
392
-                } catch(PDOException $e) {
392
+                } catch (PDOException $e) {
393 393
                         echo $e->getMessage();
394 394
                         die;
395 395
                 }
@@ -401,24 +401,24 @@  discard block
 block discarded – undo
401 401
         * @return Array the spotter information
402 402
         *
403 403
         */
404
-        public function getMinLiveSpotterData($begindate,$enddate,$filter = array())
404
+        public function getMinLiveSpotterData($begindate, $enddate, $filter = array())
405 405
         {
406 406
                 global $globalDBdriver, $globalLiveInterval;
407 407
                 date_default_timezone_set('UTC');
408 408
 
409 409
                 $filter_query = '';
410 410
                 if (isset($filter['source']) && !empty($filter['source'])) {
411
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
411
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
412 412
                 }
413 413
                 // Use spotter_output also ?
414 414
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
415
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
415
+                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
416 416
                 }
417 417
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
418 418
                         $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
419 419
                 }
420 420
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
421
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
421
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
422 422
                 }
423 423
 
424 424
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -437,14 +437,14 @@  discard block
 block discarded – undo
437 437
 						GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id 
438 438
 				    AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao';
439 439
 */
440
-			$query  = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
440
+			$query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
441 441
 				    FROM spotter_archive 
442 442
 				    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao
443 443
 				    WHERE spotter_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' 
444 444
                         	    '.$filter_query.' ORDER BY flightaware_id';
445 445
                 } else {
446 446
                         //$query  = 'SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao';
447
-                        $query  = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
447
+                        $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
448 448
                         	    FROM spotter_archive 
449 449
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao
450 450
                         	    WHERE spotter_archive.date >= '."'".$begindate."'".' AND spotter_archive.date <= '."'".$enddate."'".'
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
                 try {
455 455
                         $sth = $this->db->prepare($query);
456 456
                         $sth->execute();
457
-                } catch(PDOException $e) {
457
+                } catch (PDOException $e) {
458 458
                         echo $e->getMessage();
459 459
                         die;
460 460
                 }
@@ -469,24 +469,24 @@  discard block
 block discarded – undo
469 469
         * @return Array the spotter information
470 470
         *
471 471
         */
472
-        public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array())
472
+        public function getMinLiveSpotterDataPlayback($begindate, $enddate, $filter = array())
473 473
         {
474 474
                 global $globalDBdriver, $globalLiveInterval;
475 475
                 date_default_timezone_set('UTC');
476 476
 
477 477
                 $filter_query = '';
478 478
                 if (isset($filter['source']) && !empty($filter['source'])) {
479
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
479
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
480 480
                 }
481 481
                 // Should use spotter_output also ?
482 482
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
483
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
483
+                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
484 484
                 }
485 485
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
486 486
                         $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
487 487
                 }
488 488
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
489
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
489
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
490 490
                 }
491 491
 
492 492
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
                     		    FROM spotter_archive 
497 497
                     		    INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao';
498 498
 			*/
499
-			$query  = 'SELECT a.aircraft_shadow, spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk 
499
+			$query = 'SELECT a.aircraft_shadow, spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk 
500 500
 				    FROM spotter_archive_output 
501 501
 				    LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive_output.aircraft_icao = a.icao 
502 502
 				    WHERE (spotter_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') 
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
                         	    WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".'
512 512
                         	    '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow';
513 513
                         */
514
-                        $query  = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow
514
+                        $query = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow
515 515
                         	    FROM spotter_archive_output 
516 516
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao
517 517
                         	    WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".'
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
                 try {
524 524
                         $sth = $this->db->prepare($query);
525 525
                         $sth->execute();
526
-                } catch(PDOException $e) {
526
+                } catch (PDOException $e) {
527 527
                         echo $e->getMessage();
528 528
                         die;
529 529
                 }
@@ -538,23 +538,23 @@  discard block
 block discarded – undo
538 538
         * @return Array the spotter information
539 539
         *
540 540
         */
541
-        public function getLiveSpotterCount($begindate,$enddate,$filter = array())
541
+        public function getLiveSpotterCount($begindate, $enddate, $filter = array())
542 542
         {
543 543
                 global $globalDBdriver, $globalLiveInterval;
544 544
                 date_default_timezone_set('UTC');
545 545
 
546 546
                 $filter_query = '';
547 547
                 if (isset($filter['source']) && !empty($filter['source'])) {
548
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
548
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
549 549
                 }
550 550
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
551
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
551
+                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
552 552
                 }
553 553
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
554 554
                         $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
555 555
                 }
556 556
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
557
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
557
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
558 558
                 }
559 559
 
560 560
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
                 try {
570 570
                         $sth = $this->db->prepare($query);
571 571
                         $sth->execute();
572
-                } catch(PDOException $e) {
572
+                } catch (PDOException $e) {
573 573
                         echo $e->getMessage();
574 574
                         die;
575 575
                 }
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
     * @return Array the spotter information
590 590
     *
591 591
     */
592
-    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())
592
+    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())
593 593
     {
594 594
 	global $globalTimezone, $globalDBdriver;
595 595
 	require_once(dirname(__FILE__).'/class.Translation.php');
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
 	        
612 612
 		$q_array = explode(" ", $q);
613 613
 		
614
-		foreach ($q_array as $q_item){
614
+		foreach ($q_array as $q_item) {
615 615
 		    $additional_query .= " AND (";
616 616
 		    $additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR ";
617 617
 		    $additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR ";
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
 	
644 644
 	if ($registration != "")
645 645
 	{
646
-	    $registration = filter_var($registration,FILTER_SANITIZE_STRING);
646
+	    $registration = filter_var($registration, FILTER_SANITIZE_STRING);
647 647
 	    if (!is_string($registration))
648 648
 	    {
649 649
 		return false;
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
 	
655 655
 	if ($aircraft_icao != "")
656 656
 	{
657
-	    $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
657
+	    $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
658 658
 	    if (!is_string($aircraft_icao))
659 659
 	    {
660 660
 		return false;
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
 	
666 666
 	if ($aircraft_manufacturer != "")
667 667
 	{
668
-	    $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
668
+	    $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
669 669
 	    if (!is_string($aircraft_manufacturer))
670 670
 	    {
671 671
 		return false;
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 	
687 687
 	if ($airline_icao != "")
688 688
 	{
689
-	    $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
689
+	    $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
690 690
 	    if (!is_string($airline_icao))
691 691
 	    {
692 692
 		return false;
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
 	
698 698
 	if ($airline_country != "")
699 699
 	{
700
-	    $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
700
+	    $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING);
701 701
 	    if (!is_string($airline_country))
702 702
 	    {
703 703
 		return false;
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
 	
709 709
 	if ($airline_type != "")
710 710
 	{
711
-	    $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
711
+	    $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
712 712
 	    if (!is_string($airline_type))
713 713
 	    {
714 714
 		return false;
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 	
731 731
 	if ($airport != "")
732 732
 	{
733
-	    $airport = filter_var($airport,FILTER_SANITIZE_STRING);
733
+	    $airport = filter_var($airport, FILTER_SANITIZE_STRING);
734 734
 	    if (!is_string($airport))
735 735
 	    {
736 736
 		return false;
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
 	
742 742
 	if ($airport_country != "")
743 743
 	{
744
-	    $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
744
+	    $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING);
745 745
 	    if (!is_string($airport_country))
746 746
 	    {
747 747
 		return false;
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
     
753 753
 	if ($callsign != "")
754 754
 	{
755
-	    $callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
755
+	    $callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
756 756
 	    if (!is_string($callsign))
757 757
 	    {
758 758
 		return false;
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 		$translate = $Translation->ident2icao($callsign);
761 761
 		if ($translate != $callsign) {
762 762
 			$additional_query .= " AND (spotter_archive_output.ident = :callsign OR spotter_archive_output.ident = :translate)";
763
-			$query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate));
763
+			$query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate));
764 764
 		} else {
765 765
 			$additional_query .= " AND (spotter_archive_output.ident = '".$callsign."')";
766 766
 		}
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
 
770 770
 	if ($owner != "")
771 771
 	{
772
-	    $owner = filter_var($owner,FILTER_SANITIZE_STRING);
772
+	    $owner = filter_var($owner, FILTER_SANITIZE_STRING);
773 773
 	    if (!is_string($owner))
774 774
 	    {
775 775
 		return false;
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
 
781 781
 	if ($pilot_name != "")
782 782
 	{
783
-	    $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
783
+	    $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
784 784
 	    if (!is_string($pilot_name))
785 785
 	    {
786 786
 		return false;
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 	
792 792
 	if ($pilot_id != "")
793 793
 	{
794
-	    $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
794
+	    $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT);
795 795
 	    if (!is_string($pilot_id))
796 796
 	    {
797 797
 		return false;
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
 	
803 803
 	if ($departure_airport_route != "")
804 804
 	{
805
-	    $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
805
+	    $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING);
806 806
 	    if (!is_string($departure_airport_route))
807 807
 	    {
808 808
 		return false;
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
 	
814 814
 	if ($arrival_airport_route != "")
815 815
 	{
816
-	    $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
816
+	    $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING);
817 817
 	    if (!is_string($arrival_airport_route))
818 818
 	    {
819 819
 		return false;
@@ -826,8 +826,8 @@  discard block
 block discarded – undo
826 826
 	{
827 827
 	    $altitude_array = explode(",", $altitude);
828 828
 	    
829
-	    $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
830
-	    $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
829
+	    $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
830
+	    $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
831 831
 	    
832 832
 
833 833
 	    if ($altitude_array[1] != "")
@@ -845,8 +845,8 @@  discard block
 block discarded – undo
845 845
 	{
846 846
 	    $date_array = explode(",", $date_posted);
847 847
 	    
848
-	    $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
849
-	    $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
848
+	    $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
849
+	    $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
850 850
 	    
851 851
 	    if ($globalTimezone != '') {
852 852
 		date_default_timezone_set($globalTimezone);
@@ -878,8 +878,8 @@  discard block
 block discarded – undo
878 878
 	{
879 879
 	    $limit_array = explode(",", $limit);
880 880
 	    
881
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
882
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
881
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
882
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
883 883
 	    
884 884
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
885 885
 	    {
@@ -890,8 +890,8 @@  discard block
 block discarded – undo
890 890
 	
891 891
 
892 892
 	if ($origLat != "" && $origLon != "" && $dist != "") {
893
-		$dist = number_format($dist*0.621371,2,'.','');
894
-		$query="SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(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 
893
+		$dist = number_format($dist*0.621371, 2, '.', '');
894
+		$query = "SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(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 
895 895
                           FROM spotter_archive_output, spotter_archive WHERE spotter_output_archive.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/ABS(cos(radians($origLat))*69)) and ($origLon+$dist/ABS(cos(radians($origLat))*69)) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
896 896
                           AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(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." ORDER BY distance";
897 897
 	} else {
@@ -908,12 +908,12 @@  discard block
 block discarded – undo
908 908
 			$additional_query .= " AND (spotter_archive_output.waypoints <> '')";
909 909
 		}
910 910
 
911
-		$query  = "SELECT spotter_archive_output.* FROM spotter_archive_output 
911
+		$query = "SELECT spotter_archive_output.* FROM spotter_archive_output 
912 912
 		    WHERE spotter_archive_output.ident <> '' 
913 913
 		    ".$additional_query."
914 914
 		    ".$filter_query.$orderby_query;
915 915
 	}
916
-	$spotter_array = $Spotter->getDataFromDB($query, $query_values,$limit_query);
916
+	$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
917 917
 
918 918
 	return $spotter_array;
919 919
     }
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
                 try {
931 931
                         $sth = $this->db->prepare($query);
932 932
                         $sth->execute();
933
-                } catch(PDOException $e) {
933
+                } catch (PDOException $e) {
934 934
                         return "error";
935 935
                 }
936 936
 	}
@@ -967,8 +967,8 @@  discard block
 block discarded – undo
967 967
 	{
968 968
 	    $limit_array = explode(",", $limit);
969 969
 	    
970
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
971
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
970
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
971
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
972 972
 	    
973 973
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
974 974
 	    {
@@ -1009,7 +1009,7 @@  discard block
 block discarded – undo
1009 1009
 	$query_values = array();
1010 1010
 	$limit_query = '';
1011 1011
 	$additional_query = '';
1012
-	$filter_query = $this->getFilter($filter,true,true);
1012
+	$filter_query = $this->getFilter($filter, true, true);
1013 1013
 	
1014 1014
 	if ($owner != "")
1015 1015
 	{
@@ -1026,8 +1026,8 @@  discard block
 block discarded – undo
1026 1026
 	{
1027 1027
 	    $limit_array = explode(",", $limit);
1028 1028
 	    
1029
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1030
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1029
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1030
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1031 1031
 	    
1032 1032
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1033 1033
 	    {
@@ -1067,7 +1067,7 @@  discard block
 block discarded – undo
1067 1067
 	$query_values = array();
1068 1068
 	$limit_query = '';
1069 1069
 	$additional_query = '';
1070
-	$filter_query = $this->getFilter($filter,true,true);
1070
+	$filter_query = $this->getFilter($filter, true, true);
1071 1071
 	
1072 1072
 	if ($pilot != "")
1073 1073
 	{
@@ -1079,8 +1079,8 @@  discard block
 block discarded – undo
1079 1079
 	{
1080 1080
 	    $limit_array = explode(",", $limit);
1081 1081
 	    
1082
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1083
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1082
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1083
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1084 1084
 	    
1085 1085
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1086 1086
 	    {
@@ -1110,7 +1110,7 @@  discard block
 block discarded – undo
1110 1110
     * @return Array the airline country list
1111 1111
     *
1112 1112
     */
1113
-    public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1113
+    public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '')
1114 1114
     {
1115 1115
 	global $globalDBdriver;
1116 1116
 	/*
@@ -1139,7 +1139,7 @@  discard block
 block discarded – undo
1139 1139
 	$flight_array = array();
1140 1140
 	$temp_array = array();
1141 1141
         
1142
-	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1142
+	while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1143 1143
 	{
1144 1144
 	    $temp_array['flight_count'] = $row['nb'];
1145 1145
 	    $temp_array['flight_country'] = $row['name'];
@@ -1156,7 +1156,7 @@  discard block
 block discarded – undo
1156 1156
     * @return Array the airline country list
1157 1157
     *
1158 1158
     */
1159
-    public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
1159
+    public function countAllFlightOverCountriesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
1160 1160
     {
1161 1161
 	global $globalDBdriver;
1162 1162
 	/*
@@ -1185,7 +1185,7 @@  discard block
 block discarded – undo
1185 1185
 	$flight_array = array();
1186 1186
 	$temp_array = array();
1187 1187
         
1188
-	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1188
+	while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1189 1189
 	{
1190 1190
 	    $temp_array['airline_icao'] = $row['airline_icao'];
1191 1191
 	    $temp_array['flight_count'] = $row['nb'];
@@ -1203,14 +1203,14 @@  discard block
 block discarded – undo
1203 1203
     * @return Array the spotter information
1204 1204
     *
1205 1205
     */
1206
-    public function getDateArchiveSpotterDataById($id,$date)
1206
+    public function getDateArchiveSpotterDataById($id, $date)
1207 1207
     {
1208 1208
 	$Spotter = new Spotter($this->db);
1209 1209
 	date_default_timezone_set('UTC');
1210 1210
 	$id = filter_var($id, FILTER_SANITIZE_STRING);
1211
-	$query  = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC';
1212
-	$date = date('c',$date);
1213
-	$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date));
1211
+	$query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC';
1212
+	$date = date('c', $date);
1213
+	$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date));
1214 1214
 	return $spotter_array;
1215 1215
     }
1216 1216
 
@@ -1220,14 +1220,14 @@  discard block
 block discarded – undo
1220 1220
     * @return Array the spotter information
1221 1221
     *
1222 1222
     */
1223
-    public function getDateArchiveSpotterDataByIdent($ident,$date)
1223
+    public function getDateArchiveSpotterDataByIdent($ident, $date)
1224 1224
     {
1225 1225
 	$Spotter = new Spotter($this->db);
1226 1226
 	date_default_timezone_set('UTC');
1227 1227
 	$ident = filter_var($ident, FILTER_SANITIZE_STRING);
1228
-	$query  = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC';
1229
-	$date = date('c',$date);
1230
-	$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
1228
+	$query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC';
1229
+	$date = date('c', $date);
1230
+	$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
1231 1231
 	return $spotter_array;
1232 1232
     }
1233 1233
 
@@ -1237,7 +1237,7 @@  discard block
 block discarded – undo
1237 1237
     * @return Array the spotter information
1238 1238
     *
1239 1239
     */
1240
-    public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1240
+    public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array())
1241 1241
     {
1242 1242
 	global $global_query;
1243 1243
 	$Spotter = new Spotter();
@@ -1245,7 +1245,7 @@  discard block
 block discarded – undo
1245 1245
 	$query_values = array();
1246 1246
 	$limit_query = '';
1247 1247
 	$additional_query = '';
1248
-	$filter_query = $this->getFilter($filters,true,true);
1248
+	$filter_query = $this->getFilter($filters, true, true);
1249 1249
 	
1250 1250
 	if ($airport != "")
1251 1251
 	{
@@ -1262,8 +1262,8 @@  discard block
 block discarded – undo
1262 1262
 	{
1263 1263
 	    $limit_array = explode(",", $limit);
1264 1264
 	    
1265
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1266
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1265
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1266
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1267 1267
 	    
1268 1268
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1269 1269
 	    {
Please login to merge, or discard this patch.
pilot-detailed.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -6,14 +6,14 @@  discard block
 block discarded – undo
6 6
 //require_once('require/class.SpotterLive.php');
7 7
 require_once('require/class.SpotterArchive.php');
8 8
 
9
-if (!isset($_GET['pilot'])){
9
+if (!isset($_GET['pilot'])) {
10 10
 	header('Location: '.$globalURL.'/');
11 11
 } else {
12 12
 	$Spotter = new Spotter();
13 13
 	$SpotterArchive = new SpotterArchive();
14 14
 	$Translation = new Translation();
15 15
 	//calculuation for the pagination
16
-	if(!isset($_GET['limit']))
16
+	if (!isset($_GET['limit']))
17 17
 	{
18 18
 		$limit_start = 0;
19 19
 		$limit_end = 25;
@@ -34,29 +34,29 @@  discard block
 block discarded – undo
34 34
 	
35 35
 	$page_url = $globalURL.'/pilot/'.$_GET['pilot'];
36 36
 	
37
-	$pilot = filter_input(INPUT_GET,'pilot',FILTER_SANITIZE_STRING);
38
-	$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
39
-	$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
40
-	$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
37
+	$pilot = filter_input(INPUT_GET, 'pilot', FILTER_SANITIZE_STRING);
38
+	$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
39
+	$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
40
+	$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
41 41
 	$filter = array();
42
-	if ($year != '') $filter = array_merge($filter,array('year' => $year));
43
-	if ($month != '') $filter = array_merge($filter,array('month' => $month));
42
+	if ($year != '') $filter = array_merge($filter, array('year' => $year));
43
+	if ($month != '') $filter = array_merge($filter, array('month' => $month));
44 44
 	if ($sort != '') 
45 45
 	{
46
-		$spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort,$filter);
46
+		$spotter_array = $Spotter->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, $sort, $filter);
47 47
 		if (empty($spotter_array)) {
48
-			$spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort,$filter);
48
+			$spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, $sort, $filter);
49 49
 		}
50 50
 	} else {
51
-		$spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference,'',$filter);
51
+		$spotter_array = $Spotter->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, '', $filter);
52 52
 		if (empty($spotter_array)) {
53
-			$spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference,'',$filter);
53
+			$spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, '', $filter);
54 54
 		}
55 55
 	}
56 56
 
57 57
 	if (!empty($spotter_array))
58 58
 	{
59
-		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['pilot_name']);
59
+		$title = sprintf(_("Detailed View for %s"), $spotter_array[0]['pilot_name']);
60 60
 		$ident = $spotter_array[0]['ident'];
61 61
 		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
62 62
 		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
@@ -117,23 +117,23 @@  discard block
 block discarded – undo
117 117
 			$Stats = new Stats();
118 118
 			$flights = $Stats->getStatsPilot($pilot);
119 119
 		} else $flights = 0;
120
-		if ($flight == 0) $flights = $Spotter->countFlightsByPilot($pilot,$filter);
120
+		if ($flight == 0) $flights = $Spotter->countFlightsByPilot($pilot, $filter);
121 121
 		print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>';
122
-		$aircraft_type = count($Spotter->countAllAircraftTypesByPilot($pilot,$filter));
122
+		$aircraft_type = count($Spotter->countAllAircraftTypesByPilot($pilot, $filter));
123 123
 		print '<div><span class="label">'._("Aircrafts type").'</span>'.$aircraft_type.'</div>';
124
-		$aircraft_registration = count($Spotter->countAllAircraftRegistrationByPilot($pilot,$filter));
124
+		$aircraft_registration = count($Spotter->countAllAircraftRegistrationByPilot($pilot, $filter));
125 125
 		print '<div><span class="label">'._("Aircrafts").'</span>'.$aircraft_registration.'</div>';
126
-		$aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByPilot($pilot,$filter));
126
+		$aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByPilot($pilot, $filter));
127 127
 		print '<div><span class="label">'._("Manufacturers").'</span>'.$aircraft_manufacturer.'</div>';
128
-		$airlines = count($Spotter->countAllAirlinesByPilot($pilot,$filter));
128
+		$airlines = count($Spotter->countAllAirlinesByPilot($pilot, $filter));
129 129
 		print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>';
130
-		$duration = $Spotter->getFlightDurationByPilot($pilot,$filter);
130
+		$duration = $Spotter->getFlightDurationByPilot($pilot, $filter);
131 131
 		if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
132 132
 		print '</div>';
133 133
 	
134 134
 		include('owner-sub-menu.php');
135 135
 		print '<div class="table column">';
136
-		print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the pilot <strong>%s</strong>."),$spotter_array[0]['pilot_name']).'</p>';
136
+		print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the pilot <strong>%s</strong>."), $spotter_array[0]['pilot_name']).'</p>';
137 137
 
138 138
 		include('table-output.php'); 
139 139
 		print '<div class="pagination">';
Please login to merge, or discard this patch.
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -39,8 +39,12 @@  discard block
 block discarded – undo
39 39
 	$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
40 40
 	$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
41 41
 	$filter = array();
42
-	if ($year != '') $filter = array_merge($filter,array('year' => $year));
43
-	if ($month != '') $filter = array_merge($filter,array('month' => $month));
42
+	if ($year != '') {
43
+		$filter = array_merge($filter,array('year' => $year));
44
+	}
45
+	if ($month != '') {
46
+		$filter = array_merge($filter,array('month' => $month));
47
+	}
44 48
 	if ($sort != '') 
45 49
 	{
46 50
 		$spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort,$filter);
@@ -58,8 +62,12 @@  discard block
 block discarded – undo
58 62
 	{
59 63
 		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['pilot_name']);
60 64
 		$ident = $spotter_array[0]['ident'];
61
-		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
62
-		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
65
+		if (isset($spotter_array[0]['latitude'])) {
66
+			$latitude = $spotter_array[0]['latitude'];
67
+		}
68
+		if (isset($spotter_array[0]['longitude'])) {
69
+			$longitude = $spotter_array[0]['longitude'];
70
+		}
63 71
 		require_once('header.php');
64 72
 		/*
65 73
 		if (isset($globalArchive) && $globalArchive) {
@@ -112,12 +120,18 @@  discard block
 block discarded – undo
112 120
 		*/
113 121
 		print '<div class="info column">';
114 122
 		print '<h1>'.$spotter_array[0]['pilot_name'].'</h1>';
115
-		if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>';
123
+		if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') {
124
+			print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>';
125
+		}
116 126
 		if ($year == '' && $month == '') {
117 127
 			$Stats = new Stats();
118 128
 			$flights = $Stats->getStatsPilot($pilot);
119
-		} else $flights = 0;
120
-		if ($flight == 0) $flights = $Spotter->countFlightsByPilot($pilot,$filter);
129
+		} else {
130
+			$flights = 0;
131
+		}
132
+		if ($flight == 0) {
133
+			$flights = $Spotter->countFlightsByPilot($pilot,$filter);
134
+		}
121 135
 		print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>';
122 136
 		$aircraft_type = count($Spotter->countAllAircraftTypesByPilot($pilot,$filter));
123 137
 		print '<div><span class="label">'._("Aircrafts type").'</span>'.$aircraft_type.'</div>';
@@ -128,7 +142,9 @@  discard block
 block discarded – undo
128 142
 		$airlines = count($Spotter->countAllAirlinesByPilot($pilot,$filter));
129 143
 		print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>';
130 144
 		$duration = $Spotter->getFlightDurationByPilot($pilot,$filter);
131
-		if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
145
+		if ($duration != '0') {
146
+			print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
147
+		}
132 148
 		print '</div>';
133 149
 	
134 150
 		include('owner-sub-menu.php');
Please login to merge, or discard this patch.
owner-detailed.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@  discard block
 block discarded – undo
7 7
 //require_once('require/class.SpotterLive.php');
8 8
 require_once('require/class.SpotterArchive.php');
9 9
 
10
-if (!isset($_GET['owner'])){
10
+if (!isset($_GET['owner'])) {
11 11
 	header('Location: '.$globalURL.'');
12 12
 } else {
13 13
 	$Spotter = new Spotter();
14 14
 	$SpotterArchive = new SpotterArchive();
15 15
 	//$Translation = new Translation();
16 16
 	//calculuation for the pagination
17
-	if(!isset($_GET['limit']))
17
+	if (!isset($_GET['limit']))
18 18
 	{
19 19
 		$limit_start = 0;
20 20
 		$limit_end = 25;
@@ -35,29 +35,29 @@  discard block
 block discarded – undo
35 35
 	
36 36
 	$page_url = $globalURL.'/owner/'.$_GET['owner'];
37 37
 	
38
-	$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING);
39
-	$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
40
-	$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
41
-	$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
38
+	$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING);
39
+	$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
40
+	$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
41
+	$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
42 42
 	$filter = array();
43
-	if ($year != '') $filter = array_merge($filter,array('year' => $year));
44
-	if ($month != '') $filter = array_merge($filter,array('month' => $month));
43
+	if ($year != '') $filter = array_merge($filter, array('year' => $year));
44
+	if ($month != '') $filter = array_merge($filter, array('month' => $month));
45 45
 	if ($sort != '') 
46 46
 	{
47
-		$spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter);
47
+		$spotter_array = $Spotter->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, $sort, $filter);
48 48
 		if (empty($spotter_array)) {
49
-			$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter);
49
+			$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, $sort, $filter);
50 50
 		}
51 51
 	} else {
52
-		$spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference,'',$filter);
52
+		$spotter_array = $Spotter->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, '', $filter);
53 53
 		if (empty($spotter_array)) {
54
-			$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference,'',$filter);
54
+			$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, '', $filter);
55 55
 		}
56 56
 	}
57 57
 
58 58
 	if (!empty($spotter_array))
59 59
 	{
60
-		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['aircraft_owner']);
60
+		$title = sprintf(_("Detailed View for %s"), $spotter_array[0]['aircraft_owner']);
61 61
 		//$ident = $spotter_array[0]['ident'];
62 62
 		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
63 63
 		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
@@ -117,23 +117,23 @@  discard block
 block discarded – undo
117 117
 		$Stats = new Stats();
118 118
 		if ($year == '' && $month == '') $flights = $Stats->getStatsOwner($owner);
119 119
 		else $flights = 0;
120
-		if ($flights == 0) $flights = $Spotter->countFlightsByOwner($owner,$filter);
120
+		if ($flights == 0) $flights = $Spotter->countFlightsByOwner($owner, $filter);
121 121
 		print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>';
122
-		$aircraft_type = count($Spotter->countAllAircraftTypesByOwner($owner,$filter));
122
+		$aircraft_type = count($Spotter->countAllAircraftTypesByOwner($owner, $filter));
123 123
 		print '<div><span class="label">'._("Aircrafts type").'</span>'.$aircraft_type.'</div>';
124
-		$aircraft_registration = count($Spotter->countAllAircraftRegistrationByOwner($owner,$filter));
124
+		$aircraft_registration = count($Spotter->countAllAircraftRegistrationByOwner($owner, $filter));
125 125
 		print '<div><span class="label">'._("Aircrafts").'</span>'.$aircraft_registration.'</div>';
126
-		$aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByOwner($owner,$filter));
126
+		$aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByOwner($owner, $filter));
127 127
 		print '<div><span class="label">'._("Manufacturers").'</span>'.$aircraft_manufacturer.'</div>';
128
-		$airlines = count($Spotter->countAllAirlinesByOwner($owner,$filter));
128
+		$airlines = count($Spotter->countAllAirlinesByOwner($owner, $filter));
129 129
 		print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>';
130
-		$duration = $Spotter->getFlightDurationByOwner($owner,$filter);
130
+		$duration = $Spotter->getFlightDurationByOwner($owner, $filter);
131 131
 		if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
132 132
 		print '</div>';
133 133
 	
134 134
 		include('owner-sub-menu.php');
135 135
 		print '<div class="table column">';
136
-		print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the owner <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>';
136
+		print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the owner <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>';
137 137
 
138 138
 		include('table-output.php'); 
139 139
 		print '<div class="pagination">';
Please login to merge, or discard this patch.
Braces   +23 added lines, -8 removed lines patch added patch discarded remove patch
@@ -40,8 +40,12 @@  discard block
 block discarded – undo
40 40
 	$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
41 41
 	$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
42 42
 	$filter = array();
43
-	if ($year != '') $filter = array_merge($filter,array('year' => $year));
44
-	if ($month != '') $filter = array_merge($filter,array('month' => $month));
43
+	if ($year != '') {
44
+		$filter = array_merge($filter,array('year' => $year));
45
+	}
46
+	if ($month != '') {
47
+		$filter = array_merge($filter,array('month' => $month));
48
+	}
45 49
 	if ($sort != '') 
46 50
 	{
47 51
 		$spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter);
@@ -59,8 +63,12 @@  discard block
 block discarded – undo
59 63
 	{
60 64
 		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['aircraft_owner']);
61 65
 		//$ident = $spotter_array[0]['ident'];
62
-		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
63
-		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
66
+		if (isset($spotter_array[0]['latitude'])) {
67
+			$latitude = $spotter_array[0]['latitude'];
68
+		}
69
+		if (isset($spotter_array[0]['longitude'])) {
70
+			$longitude = $spotter_array[0]['longitude'];
71
+		}
64 72
 		require_once('header.php');
65 73
 		/*
66 74
 		if (isset($globalArchive) && $globalArchive) {
@@ -115,9 +123,14 @@  discard block
 block discarded – undo
115 123
 		print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>';
116 124
 		//print '<div><span class="label">'._("Owner").'</span>'.$spotter_array[0]['aircraft_owner'].'</div>';
117 125
 		$Stats = new Stats();
118
-		if ($year == '' && $month == '') $flights = $Stats->getStatsOwner($owner);
119
-		else $flights = 0;
120
-		if ($flights == 0) $flights = $Spotter->countFlightsByOwner($owner,$filter);
126
+		if ($year == '' && $month == '') {
127
+			$flights = $Stats->getStatsOwner($owner);
128
+		} else {
129
+			$flights = 0;
130
+		}
131
+		if ($flights == 0) {
132
+			$flights = $Spotter->countFlightsByOwner($owner,$filter);
133
+		}
121 134
 		print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>';
122 135
 		$aircraft_type = count($Spotter->countAllAircraftTypesByOwner($owner,$filter));
123 136
 		print '<div><span class="label">'._("Aircrafts type").'</span>'.$aircraft_type.'</div>';
@@ -128,7 +141,9 @@  discard block
 block discarded – undo
128 141
 		$airlines = count($Spotter->countAllAirlinesByOwner($owner,$filter));
129 142
 		print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>';
130 143
 		$duration = $Spotter->getFlightDurationByOwner($owner,$filter);
131
-		if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
144
+		if ($duration != '0') {
145
+			print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
146
+		}
132 147
 		print '</div>';
133 148
 	
134 149
 		include('owner-sub-menu.php');
Please login to merge, or discard this patch.
search.php 2 patches
Spacing   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -16,40 +16,40 @@  discard block
 block discarded – undo
16 16
 
17 17
 if (isset($_GET['start_date'])) {
18 18
 	//for the date manipulation into the query
19
-	if($_GET['start_date'] != "" && $_GET['end_date'] != ""){
19
+	if ($_GET['start_date'] != "" && $_GET['end_date'] != "") {
20 20
 		//$start_date = $_GET['start_date']." 00:00:00";
21
-		$start_date = date("Y-m-d",strtotime($_GET['start_date']))." 00:00:00";
21
+		$start_date = date("Y-m-d", strtotime($_GET['start_date']))." 00:00:00";
22 22
 		//$end_date = $_GET['end_date']." 00:00:00";
23
-		$end_date = date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00";
23
+		$end_date = date("Y-m-d", strtotime($_GET['end_date']))." 00:00:00";
24 24
 		$sql_date = $start_date.",".$end_date;
25
-	} else if($_GET['start_date'] != ""){
25
+	} else if ($_GET['start_date'] != "") {
26 26
 		//$start_date = $_GET['start_date']." 00:00:00";
27
-		$start_date = date("Y-m-d",strtotime($_GET['start_date']))." 00:00:00";
27
+		$start_date = date("Y-m-d", strtotime($_GET['start_date']))." 00:00:00";
28 28
 		$sql_date = $start_date;
29
-	} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
29
+	} else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") {
30 30
 		//$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date']." 00:00:00";
31
-		$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00";
31
+		$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d", strtotime($_GET['end_date']))." 00:00:00";
32 32
 		$sql_date = $end_date;
33 33
 	} else $sql_date = '';
34 34
 } else $sql_date = '';
35 35
 
36 36
 if (isset($_GET['highest_altitude'])) {
37 37
 	//for altitude manipulation
38
-	if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){
39
-		$end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT);
40
-		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT);
38
+	if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") {
39
+		$end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT);
40
+		$start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT);
41 41
 		$sql_altitude = $start_altitude.",".$end_altitude;
42
-	} else if($_GET['highest_altitude'] != ""){
43
-		$end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT);
42
+	} else if ($_GET['highest_altitude'] != "") {
43
+		$end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT);
44 44
 		$sql_altitude = $end_altitude;
45
-	} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
46
-		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000";
45
+	} else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") {
46
+		$start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000";
47 47
 		$sql_altitude = $start_altitude;
48 48
 	} else $sql_altitude = '';
49 49
 } else $sql_altitude = '';
50 50
 
51 51
 //calculuation for the pagination
52
-if(!isset($_GET['limit']))
52
+if (!isset($_GET['limit']))
53 53
 {
54 54
 	if (!isset($_GET['number_results']))
55 55
 	{
@@ -57,45 +57,45 @@  discard block
 block discarded – undo
57 57
 		$limit_end = 25;
58 58
 		$absolute_difference = 25;
59 59
 	} else {
60
-		if ($_GET['number_results'] > 1000){
60
+		if ($_GET['number_results'] > 1000) {
61 61
 			$_GET['number_results'] = 1000;
62 62
 		}
63 63
 		$limit_start = 0;
64
-		$limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
65
-		$absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
64
+		$limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT);
65
+		$absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT);
66 66
 	}
67
-}  else {
67
+} else {
68 68
 	$limit_explode = explode(",", $_GET['limit']);
69
-	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
70
-	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
69
+	$limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT);
70
+	$limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT);
71 71
 }
72 72
 $absolute_difference = abs($limit_start - $limit_end);
73 73
 $limit_next = $limit_end + $absolute_difference;
74 74
 $limit_previous_1 = $limit_start - $absolute_difference;
75 75
 $limit_previous_2 = $limit_end - $absolute_difference;
76 76
 
77
-if (!empty($_GET)){  
78
-	$q = filter_input(INPUT_GET, 'q',FILTER_SANITIZE_STRING);
79
-	$registration = filter_input(INPUT_GET, 'registration',FILTER_SANITIZE_STRING);
80
-	$aircraft = filter_input(INPUT_GET, 'aircraft',FILTER_SANITIZE_STRING);
81
-	$manufacturer = filter_input(INPUT_GET, 'manufacturer',FILTER_SANITIZE_STRING);
82
-	$highlights = filter_input(INPUT_GET, 'highlights',FILTER_SANITIZE_STRING);
83
-	$airline = filter_input(INPUT_GET, 'airline',FILTER_SANITIZE_STRING);
84
-	$airline_country = filter_input(INPUT_GET, 'airline_country',FILTER_SANITIZE_STRING);
85
-	$airline_type = filter_input(INPUT_GET, 'airline_type',FILTER_SANITIZE_STRING);
86
-	$airport = filter_input(INPUT_GET, 'airport',FILTER_SANITIZE_STRING);
87
-	$airport_country = filter_input(INPUT_GET, 'airport_country',FILTER_SANITIZE_STRING);
88
-	$callsign = filter_input(INPUT_GET, 'callsign',FILTER_SANITIZE_STRING);
89
-	$owner = filter_input(INPUT_GET, 'owner',FILTER_SANITIZE_STRING);
90
-	$pilot_name = filter_input(INPUT_GET, 'pilot_name',FILTER_SANITIZE_STRING);
91
-	$pilot_id = filter_input(INPUT_GET, 'pilot_id',FILTER_SANITIZE_STRING);
92
-	$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route',FILTER_SANITIZE_STRING);
93
-	$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route',FILTER_SANITIZE_STRING);
94
-	$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
95
-	$archive = filter_input(INPUT_GET,'archive',FILTER_SANITIZE_NUMBER_INT);
96
-	$origlat = filter_input(INPUT_GET,'origlat',FILTER_SANITIZE_STRING);
97
-	$origlon = filter_input(INPUT_GET,'origlon',FILTER_SANITIZE_STRING);
98
-	$dist = filter_input(INPUT_GET,'dist',FILTER_SANITIZE_NUMBER_INT);
77
+if (!empty($_GET)) {  
78
+	$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING);
79
+	$registration = filter_input(INPUT_GET, 'registration', FILTER_SANITIZE_STRING);
80
+	$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING);
81
+	$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING);
82
+	$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING);
83
+	$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
84
+	$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING);
85
+	$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING);
86
+	$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING);
87
+	$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING);
88
+	$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING);
89
+	$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING);
90
+	$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING);
91
+	$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING);
92
+	$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING);
93
+	$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING);
94
+	$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
95
+	$archive = filter_input(INPUT_GET, 'archive', FILTER_SANITIZE_NUMBER_INT);
96
+	$origlat = filter_input(INPUT_GET, 'origlat', FILTER_SANITIZE_STRING);
97
+	$origlon = filter_input(INPUT_GET, 'origlon', FILTER_SANITIZE_STRING);
98
+	$dist = filter_input(INPUT_GET, 'dist', FILTER_SANITIZE_NUMBER_INT);
99 99
 	if ($dist != '') {
100 100
 		if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') $dist = $dist*1.60934;
101 101
 		elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') $dist = $dist*1.852;
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
 	if (!isset($sql_date)) $sql_date = '';
104 104
 	if ($archive == 1) {
105 105
 		$SpotterArchive = new SpotterArchive();
106
-		$spotter_array = $SpotterArchive->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,'',$origlat,$origlon,$dist);
106
+		$spotter_array = $SpotterArchive->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, '', $origlat, $origlon, $dist);
107 107
 	} else {
108
-		$spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,'',$origlat,$origlon,$dist);
108
+		$spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, '', $origlat, $origlon, $dist);
109 109
 	}
110 110
 	 
111 111
 	print '<span class="sub-menu-statistic column mobile">';
@@ -138,12 +138,12 @@  discard block
 block discarded – undo
138 138
 	//remove 3D=true parameter
139 139
 	$no3D = str_replace("&3D=true", "", $_SERVER['QUERY_STRING']);
140 140
 	$kmlURL = str_replace("http://", "kml://", $globalURL);
141
-	if (!isset($_GET['3D'])){
141
+	if (!isset($_GET['3D'])) {
142 142
 		print '<li><a href="'.$globalURL.'/search?'.$no3D.'" class="active"><i class="fa fa-table"></i> '._("Table").'</a></li>';
143 143
 	} else {
144 144
 		print '<li><span class="notablet"><a href="'.$globalURL.'/search?'.$no3D.'"><i class="fa fa-table"></i> '._("Table").'</a></span></li>';
145 145
 	}
146
-	if (isset($_GET['3D'])){
146
+	if (isset($_GET['3D'])) {
147 147
 		print '<li><a href="'.$globalURL.'/search?'.$no3D.'&3D=true" class="active"><i class="fa fa-globe"></i> '._("3D Map").'</a></li>';
148 148
 	} else {
149 149
 		print '<li ><a href="'.$globalURL.'/search?'.$no3D.'&3D=true" class="notablet nomobile"><i class="fa fa-globe"></i> '._("3D Map").'</a><a href="'.$kmlURL.'/search/kml?'.htmlentities($_SERVER['QUERY_STRING']).'" class="tablet mobile"><i class="fa fa-globe"></i> 3D Map</a></li>';
@@ -164,30 +164,30 @@  discard block
 block discarded – undo
164 164
 		print '<div class="column">';
165 165
 		print '<div class="info">';
166 166
 		print '<h1>'._("Search Results for").' ';
167
-		if (isset($_GET['q']) && $_GET['q'] != ""){ print _("Keyword:").' <span>'.$q.'</span> '; }
168
-		if (isset($_GET['aircraft']) && $_GET['aircraft'] != ""){ print _("Aircraft:").' <span>'.$aircraft.'</span> '; }
169
-		if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != ""){ print _("Manufacturer:").' <span>'.$manufacturer.'</span> '; }
170
-		if (isset($_GET['registration']) && $_GET['registration'] != ""){ print _("Registration:").' <span>'.$registration.'</span> '; }
171
-		if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$highlights.'</span> '; }
172
-		if (isset($_GET['airline']) && $_GET['airline'] != ""){ print _("Airline:").' <span>'.$airline.'</span> '; }
173
-		if (isset($_GET['airline_country']) && $_GET['airline_country'] != ""){ print _("Airline country:").' <span>'.$airline_country.'</span> '; }
174
-		if (isset($_GET['airline_type']) && $_GET['airline_type'] != ""){ print _("Airline type:").' <span>'.$airline_type.'</span> '; }
175
-		if (isset($_GET['airport']) && $_GET['airport'] != ""){ print _("Airport:").' <span>'.$airport.'</span> '; }
176
-		if (isset($_GET['airport_country']) && $_GET['airport_country'] != ""){ print _("Airport country:").' <span>'.$airport_country.'</span> '; }
177
-		if (isset($_GET['callsign']) && $_GET['callsign'] != ""){ print _("Callsign:").' <span>'.$callsign.'</span> '; }
178
-		if (isset($_GET['owner']) && $_GET['owner'] != ""){ print _("Owner:").' <span>'.$owner.'</span> '; }
179
-		if (isset($_GET['pilot_id']) && $_GET['pilot_id'] != ""){ print _("Pilot id:").' <span>'.$pilot_id.'</span> '; }
180
-		if (isset($_GET['pilot_name']) && $_GET['pilot_name'] != ""){ print _("Pilot name:").' <span>'.$pilot_name.'</span> '; }
181
-		if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && (!isset($_GET['arrival_airport_route']) || $_GET['arrival_airport_route'] == "")){ print _("Route out of:").' <span>'.$departure_airport_route.'</span> '; }
182
-		if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] == "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != ""){ print _("Route into:").' <span>'.$arrival_airport_route.'</span> '; }
183
-		if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != ""){ print _("Route between:").' <span>'.$departure_airport_route.'</span> and <span>'.$_GET['arrival_airport_route'].'</span> '; }
184
-		if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] == ""){ print _("Date starting at:").' <span>'.$start_date.'</span> '; }
185
-		if (isset($_GET['start_date']) && $_GET['start_date'] == "" && isset($_GET['end_date']) && $_GET['end_date'] != ""){ print _("Date ending at:").' <span>'.$end_date.'</span> '; }
186
-		if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] != ""){ print _("Date between:").' <span>'.$start_date.'</span> and <span>'.$end_date.'</span> '; }
187
-		if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == ""){ print _("Altitude starting at:").' <span>'.number_format($lowest_altitude).' feet</span> '; }
188
-		if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != ""){ print _("Altitude ending at:").' <span>'.number_format($highest_altitude).' feet</span> '; }
189
-		if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != ""){ print _("Altitude between:").' <span>'.number_format($lowest_altitude).' feet</span> '._("and").' <span>'.number_format($highest_altitude).' feet</span> '; }
190
-		if (isset($_GET['number_results']) && $_GET['number_results'] != ""){ print _("limit per page:").' <span>'.$number_results.'</span> '; }
167
+		if (isset($_GET['q']) && $_GET['q'] != "") { print _("Keyword:").' <span>'.$q.'</span> '; }
168
+		if (isset($_GET['aircraft']) && $_GET['aircraft'] != "") { print _("Aircraft:").' <span>'.$aircraft.'</span> '; }
169
+		if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != "") { print _("Manufacturer:").' <span>'.$manufacturer.'</span> '; }
170
+		if (isset($_GET['registration']) && $_GET['registration'] != "") { print _("Registration:").' <span>'.$registration.'</span> '; }
171
+		if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print _("Highlights:").' <span>'.$highlights.'</span> '; }
172
+		if (isset($_GET['airline']) && $_GET['airline'] != "") { print _("Airline:").' <span>'.$airline.'</span> '; }
173
+		if (isset($_GET['airline_country']) && $_GET['airline_country'] != "") { print _("Airline country:").' <span>'.$airline_country.'</span> '; }
174
+		if (isset($_GET['airline_type']) && $_GET['airline_type'] != "") { print _("Airline type:").' <span>'.$airline_type.'</span> '; }
175
+		if (isset($_GET['airport']) && $_GET['airport'] != "") { print _("Airport:").' <span>'.$airport.'</span> '; }
176
+		if (isset($_GET['airport_country']) && $_GET['airport_country'] != "") { print _("Airport country:").' <span>'.$airport_country.'</span> '; }
177
+		if (isset($_GET['callsign']) && $_GET['callsign'] != "") { print _("Callsign:").' <span>'.$callsign.'</span> '; }
178
+		if (isset($_GET['owner']) && $_GET['owner'] != "") { print _("Owner:").' <span>'.$owner.'</span> '; }
179
+		if (isset($_GET['pilot_id']) && $_GET['pilot_id'] != "") { print _("Pilot id:").' <span>'.$pilot_id.'</span> '; }
180
+		if (isset($_GET['pilot_name']) && $_GET['pilot_name'] != "") { print _("Pilot name:").' <span>'.$pilot_name.'</span> '; }
181
+		if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && (!isset($_GET['arrival_airport_route']) || $_GET['arrival_airport_route'] == "")) { print _("Route out of:").' <span>'.$departure_airport_route.'</span> '; }
182
+		if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] == "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != "") { print _("Route into:").' <span>'.$arrival_airport_route.'</span> '; }
183
+		if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != "") { print _("Route between:").' <span>'.$departure_airport_route.'</span> and <span>'.$_GET['arrival_airport_route'].'</span> '; }
184
+		if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] == "") { print _("Date starting at:").' <span>'.$start_date.'</span> '; }
185
+		if (isset($_GET['start_date']) && $_GET['start_date'] == "" && isset($_GET['end_date']) && $_GET['end_date'] != "") { print _("Date ending at:").' <span>'.$end_date.'</span> '; }
186
+		if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] != "") { print _("Date between:").' <span>'.$start_date.'</span> and <span>'.$end_date.'</span> '; }
187
+		if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == "") { print _("Altitude starting at:").' <span>'.number_format($lowest_altitude).' feet</span> '; }
188
+		if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != "") { print _("Altitude ending at:").' <span>'.number_format($highest_altitude).' feet</span> '; }
189
+		if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != "") { print _("Altitude between:").' <span>'.number_format($lowest_altitude).' feet</span> '._("and").' <span>'.number_format($highest_altitude).' feet</span> '; }
190
+		if (isset($_GET['number_results']) && $_GET['number_results'] != "") { print _("limit per page:").' <span>'.$number_results.'</span> '; }
191 191
 		print '</h1>';
192 192
 		print '</div>';
193 193
 
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 					    </select>
295 295
 					</div>
296 296
 				</div>
297
-				<script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) print $manufacturer; ?>')</script>
297
+				<script type="text/javascript">getSelect('manufacturer','<?php if (isset($_GET['manufacturer'])) print $manufacturer; ?>')</script>
298 298
 				<div class="form-group">
299 299
 					<label class="control-label col-sm-2"><?php echo _("Type"); ?></label>
300 300
 						<div class="col-sm-10">
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 							</select>
304 304
 						</div>
305 305
 				</div>
306
-				<script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) print $aircraft_icao; ?>');</script>
306
+				<script type="text/javascript">getSelect('aircrafttypes','<?php if (isset($_GET['aircraft_icao'])) print $aircraft_icao; ?>');</script>
307 307
 				<div class="form-group">
308 308
 					<label class="control-label col-sm-2"><?php echo _("Registration"); ?></label> 
309 309
 					<div class="col-sm-10">
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 					</div>
327 327
 				</div>
328 328
 <?php
329
-}else {
329
+} else {
330 330
 ?>
331 331
 				<div class="form-group">
332 332
 					<label class="control-label col-sm-2"><?php echo _("Owner name"); ?></label> 
@@ -339,8 +339,8 @@  discard block
 block discarded – undo
339 339
 ?>
340 340
 				<div class="form-group">
341 341
 					<div class="col-sm-offset-2 col-sm-10">
342
-					<!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label></div>-->
343
-					<label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label>
342
+					<!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label></div>-->
343
+					<label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print 'checked="checked"'; } ?>> <?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label>
344 344
 					</div>
345 345
 				</div>
346 346
 			</fieldset>
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 						</select>
355 355
 					</div>
356 356
 				</div>
357
-				<script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) print $airline; ?>');</script>
357
+				<script type="text/javascript">getSelect('airlinenames','<?php if (isset($_GET['airline'])) print $airline; ?>');</script>
358 358
 				<div class="form-group">
359 359
 					<label class="control-label col-sm-2"><?php echo _("Country"); ?></label> 
360 360
 					<div class="col-sm-10">
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 						</select>
364 364
 					</div>
365 365
 				</div>
366
-				<script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) print $airline_country; ?>');</script>
366
+				<script type="text/javascript">getSelect('airlinecountries','<?php if (isset($_GET['airline_country'])) print $airline_country; ?>');</script>
367 367
 				<div class="form-group">
368 368
 					<label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> 
369 369
 					<div class="col-sm-10">
@@ -372,10 +372,10 @@  discard block
 block discarded – undo
372 372
 				</div>
373 373
 				<div class="form-group">
374 374
 					<div class="col-sm-offset-2 col-sm-10">
375
-						<label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all"){ print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label>
376
-						<label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label>
377
-						<label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label>
378
-						<label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "military"){ print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label>
375
+						<label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all") { print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label>
376
+						<label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger") { print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label>
377
+						<label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "cargo") { print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label>
378
+						<label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "military") { print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label>
379 379
 					</div>
380 380
 				</div>
381 381
 			</fieldset>
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 						</select>
390 390
 					</div>
391 391
 				</div>
392
-				<script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) print $airport_icao; ?>');</script>
392
+				<script type="text/javascript">getSelect('airportnames','<?php if (isset($_GET['airport_icao'])) print $airport_icao; ?>');</script>
393 393
 				<div class="form-group">
394 394
 					<label class="control-label col-sm-2"><?php echo _("Country"); ?></label> 
395 395
 					<div class="col-sm-10">
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 						</select>
399 399
 					</div>
400 400
 				</div>
401
-				<script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) print $airport_country; ?>');</script>
401
+				<script type="text/javascript">getSelect('airportcountries','<?php if (isset($_GET['airport_country'])) print $airport_country; ?>');</script>
402 402
 			</fieldset>
403 403
 			<fieldset>
404 404
 				<legend><?php echo _("Route"); ?></legend>
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 						</select>
411 411
 					</div>
412 412
 				</div>
413
-				<script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) print $departure_airport_route; ?>');</script>
413
+				<script type="text/javascript">getSelect('departureairportnames','<?php if (isset($_GET['departure_airport_route'])) print $departure_airport_route; ?>');</script>
414 414
 				<div class="form-group">
415 415
 					<label class="control-label col-sm-2"><?php echo _("Arrival Airport"); ?></label> 
416 416
 					<div class="col-sm-10">
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 						</select>
420 420
 					</div>
421 421
 				</div>
422
-				<script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) print $arrival_airport_route; ?>');</script>
422
+				<script type="text/javascript">getSelect('arrivalairportnames','<?php if (isset($_GET['arrival_airport_route'])) print $arrival_airport_route; ?>');</script>
423 423
 			</fieldset>
424 424
 			<fieldset>
425 425
 				<legend><?php echo _("Date"); ?></legend>
@@ -473,9 +473,9 @@  discard block
 block discarded – undo
473 473
 						<option></option>
474 474
 <?php
475 475
 $altitude_array = Array(1000, 5000, 10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000);
476
-foreach($altitude_array as $altitude)
476
+foreach ($altitude_array as $altitude)
477 477
 {
478
-	if(isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == $altitude)
478
+	if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == $altitude)
479 479
 	{
480 480
 		print '<option value="'.$altitude.'" selected="selected">'.number_format($altitude).' feet</option>';
481 481
 	} else {
@@ -493,9 +493,9 @@  discard block
 block discarded – undo
493 493
 					<option></option>
494 494
 <?php
495 495
 $altitude_array = Array(1000, 5000, 10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000);
496
-foreach($altitude_array as $altitude)
496
+foreach ($altitude_array as $altitude)
497 497
 {
498
-	if(isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == $altitude)
498
+	if (isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == $altitude)
499 499
 	{
500 500
 		print '<option value="'.$altitude.'" selected="selected">'.number_format($altitude).' feet</option>';
501 501
 	} else {
@@ -534,10 +534,10 @@  discard block
 block discarded – undo
534 534
 				<div class="col-sm-10">
535 535
 					<select class="form-control" name="number_results">
536 536
 <?php
537
-$number_results_array = Array(25, 50, 100, 150, 200, 250, 300, 400, 500,  600, 700, 800, 900, 1000);
538
-foreach($number_results_array as $number)
537
+$number_results_array = Array(25, 50, 100, 150, 200, 250, 300, 400, 500, 600, 700, 800, 900, 1000);
538
+foreach ($number_results_array as $number)
539 539
 {
540
-	if(isset($_GET['number_results']) && $_GET['number_results'] == $number)
540
+	if (isset($_GET['number_results']) && $_GET['number_results'] == $number)
541 541
 	{
542 542
 		print '<option value="'.$number.'" selected="selected">'.$number.'</option>';
543 543
 	} else {
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 		<fieldset>
556 556
 			<div class="form-group">
557 557
 				<div class="col-sm-offset-2 col-sm-10">
558
-					<label class="checkbox-inline"><input type="checkbox" name="archive" value="1" /><?php echo sprintf(_("Search in archive (older than %s months)"),$globalArchiveKeepMonths); ?></label>
558
+					<label class="checkbox-inline"><input type="checkbox" name="archive" value="1" /><?php echo sprintf(_("Search in archive (older than %s months)"), $globalArchiveKeepMonths); ?></label>
559 559
 				</div>
560 560
 			</div>
561 561
 		</fieldset>
Please login to merge, or discard this patch.
Braces   +128 added lines, -35 removed lines patch added patch discarded remove patch
@@ -30,8 +30,12 @@  discard block
 block discarded – undo
30 30
 		//$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date']." 00:00:00";
31 31
 		$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00";
32 32
 		$sql_date = $end_date;
33
-	} else $sql_date = '';
34
-} else $sql_date = '';
33
+	} else {
34
+		$sql_date = '';
35
+	}
36
+	} else {
37
+	$sql_date = '';
38
+}
35 39
 
36 40
 if (isset($_GET['highest_altitude'])) {
37 41
 	//for altitude manipulation
@@ -45,8 +49,12 @@  discard block
 block discarded – undo
45 49
 	} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
46 50
 		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000";
47 51
 		$sql_altitude = $start_altitude;
48
-	} else $sql_altitude = '';
49
-} else $sql_altitude = '';
52
+	} else {
53
+		$sql_altitude = '';
54
+	}
55
+	} else {
56
+	$sql_altitude = '';
57
+}
50 58
 
51 59
 //calculuation for the pagination
52 60
 if(!isset($_GET['limit']))
@@ -64,7 +72,7 @@  discard block
 block discarded – undo
64 72
 		$limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
65 73
 		$absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
66 74
 	}
67
-}  else {
75
+} else {
68 76
 	$limit_explode = explode(",", $_GET['limit']);
69 77
 	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
70 78
 	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
@@ -97,10 +105,15 @@  discard block
 block discarded – undo
97 105
 	$origlon = filter_input(INPUT_GET,'origlon',FILTER_SANITIZE_STRING);
98 106
 	$dist = filter_input(INPUT_GET,'dist',FILTER_SANITIZE_NUMBER_INT);
99 107
 	if ($dist != '') {
100
-		if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') $dist = $dist*1.60934;
101
-		elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') $dist = $dist*1.852;
108
+		if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') {
109
+			$dist = $dist*1.60934;
110
+		} elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') {
111
+			$dist = $dist*1.852;
112
+		}
113
+	}
114
+	if (!isset($sql_date)) {
115
+		$sql_date = '';
102 116
 	}
103
-	if (!isset($sql_date)) $sql_date = '';
104 117
 	if ($archive == 1) {
105 118
 		$SpotterArchive = new SpotterArchive();
106 119
 		$spotter_array = $SpotterArchive->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,'',$origlat,$origlon,$dist);
@@ -168,7 +181,10 @@  discard block
 block discarded – undo
168 181
 		if (isset($_GET['aircraft']) && $_GET['aircraft'] != ""){ print _("Aircraft:").' <span>'.$aircraft.'</span> '; }
169 182
 		if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != ""){ print _("Manufacturer:").' <span>'.$manufacturer.'</span> '; }
170 183
 		if (isset($_GET['registration']) && $_GET['registration'] != ""){ print _("Registration:").' <span>'.$registration.'</span> '; }
171
-		if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$highlights.'</span> '; }
184
+		if (isset($_GET['highlights'])) {
185
+			if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$highlights.'</span> ';
186
+		}
187
+		}
172 188
 		if (isset($_GET['airline']) && $_GET['airline'] != ""){ print _("Airline:").' <span>'.$airline.'</span> '; }
173 189
 		if (isset($_GET['airline_country']) && $_GET['airline_country'] != ""){ print _("Airline country:").' <span>'.$airline_country.'</span> '; }
174 190
 		if (isset($_GET['airline_type']) && $_GET['airline_type'] != ""){ print _("Airline type:").' <span>'.$airline_type.'</span> '; }
@@ -279,7 +295,10 @@  discard block
 block discarded – undo
279 295
 			<div class="form-group">
280 296
 				<label class="control-label col-sm-2"><?php echo _("Keywords"); ?></label>
281 297
 				<div class="col-sm-10">
282
-					<input type="text" class="form-control" id="q" name="q" value="<?php if (isset($_GET['q'])) print $q; ?>" size="10" placeholder="<?php echo _("Keywords"); ?>" />
298
+					<input type="text" class="form-control" id="q" name="q" value="<?php if (isset($_GET['q'])) {
299
+	print $q;
300
+}
301
+?>" size="10" placeholder="<?php echo _("Keywords"); ?>" />
283 302
 				</div>
284 303
 			</div>
285 304
 		</fieldset>
@@ -294,7 +313,10 @@  discard block
 block discarded – undo
294 313
 					    </select>
295 314
 					</div>
296 315
 				</div>
297
-				<script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) print $manufacturer; ?>')</script>
316
+				<script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) {
317
+	print $manufacturer;
318
+}
319
+?>')</script>
298 320
 				<div class="form-group">
299 321
 					<label class="control-label col-sm-2"><?php echo _("Type"); ?></label>
300 322
 						<div class="col-sm-10">
@@ -303,11 +325,17 @@  discard block
 block discarded – undo
303 325
 							</select>
304 326
 						</div>
305 327
 				</div>
306
-				<script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) print $aircraft_icao; ?>');</script>
328
+				<script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) {
329
+	print $aircraft_icao;
330
+}
331
+?>');</script>
307 332
 				<div class="form-group">
308 333
 					<label class="control-label col-sm-2"><?php echo _("Registration"); ?></label> 
309 334
 					<div class="col-sm-10">
310
-						<input type="text" class="form-control" name="registration" value="<?php if (isset($_GET['registration'])) print $registration; ?>" size="8" placeholder="<?php echo _("Registration"); ?>" />
335
+						<input type="text" class="form-control" name="registration" value="<?php if (isset($_GET['registration'])) {
336
+	print $registration;
337
+}
338
+?>" size="8" placeholder="<?php echo _("Registration"); ?>" />
311 339
 					</div>
312 340
 				</div>
313 341
 <?php
@@ -316,22 +344,31 @@  discard block
 block discarded – undo
316 344
 				<div class="form-group">
317 345
 					<label class="control-label col-sm-2"><?php echo _("Pilot id"); ?></label> 
318 346
 					<div class="col-sm-10">
319
-						<input type="text" class="form-control" name="pilot_id" value="<?php if (isset($_GET['pilot_id'])) print $pilot_id; ?>" size="15" placeholder="<?php echo _("Pilot id"); ?>" />
347
+						<input type="text" class="form-control" name="pilot_id" value="<?php if (isset($_GET['pilot_id'])) {
348
+	print $pilot_id;
349
+}
350
+?>" size="15" placeholder="<?php echo _("Pilot id"); ?>" />
320 351
 					</div>
321 352
 				</div>
322 353
 				<div class="form-group">
323 354
 					<label class="control-label col-sm-2"><?php echo _("Pilot name"); ?></label> 
324 355
 					<div class="col-sm-10">
325
-						<input type="text" class="form-control" name="pilot_name" value="<?php if (isset($_GET['pilot_name'])) print $pilot_name; ?>" size="15" placeholder="<?php echo _("Pilot nmae"); ?>" />
356
+						<input type="text" class="form-control" name="pilot_name" value="<?php if (isset($_GET['pilot_name'])) {
357
+	print $pilot_name;
358
+}
359
+?>" size="15" placeholder="<?php echo _("Pilot nmae"); ?>" />
326 360
 					</div>
327 361
 				</div>
328 362
 <?php
329
-}else {
363
+} else {
330 364
 ?>
331 365
 				<div class="form-group">
332 366
 					<label class="control-label col-sm-2"><?php echo _("Owner name"); ?></label> 
333 367
 					<div class="col-sm-10">
334
-						<input type="text" class="form-control" name="owner" value="<?php if (isset($_GET['owner'])) print $owner; ?>" size="15" placeholder="<?php echo _("Owner name"); ?>" />
368
+						<input type="text" class="form-control" name="owner" value="<?php if (isset($_GET['owner'])) {
369
+	print $owner;
370
+}
371
+?>" size="15" placeholder="<?php echo _("Owner name"); ?>" />
335 372
 					</div>
336 373
 				</div>
337 374
 <?php
@@ -339,8 +376,14 @@  discard block
 block discarded – undo
339 376
 ?>
340 377
 				<div class="form-group">
341 378
 					<div class="col-sm-offset-2 col-sm-10">
342
-					<!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label></div>-->
343
-					<label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label>
379
+					<!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) {
380
+	if ($_GET['highlights'] == "true"){ print 'checked="checked"';
381
+}
382
+} ?>> <label for="highlights"><?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label></div>-->
383
+					<label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) {
384
+	if ($_GET['highlights'] == "true"){ print 'checked="checked"';
385
+}
386
+} ?>> <?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label>
344 387
 					</div>
345 388
 				</div>
346 389
 			</fieldset>
@@ -354,7 +397,10 @@  discard block
 block discarded – undo
354 397
 						</select>
355 398
 					</div>
356 399
 				</div>
357
-				<script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) print $airline; ?>');</script>
400
+				<script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) {
401
+	print $airline;
402
+}
403
+?>');</script>
358 404
 				<div class="form-group">
359 405
 					<label class="control-label col-sm-2"><?php echo _("Country"); ?></label> 
360 406
 					<div class="col-sm-10">
@@ -363,19 +409,34 @@  discard block
 block discarded – undo
363 409
 						</select>
364 410
 					</div>
365 411
 				</div>
366
-				<script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) print $airline_country; ?>');</script>
412
+				<script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) {
413
+	print $airline_country;
414
+}
415
+?>');</script>
367 416
 				<div class="form-group">
368 417
 					<label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> 
369 418
 					<div class="col-sm-10">
370
-						<input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) print $callsign; ?>" size="8" placeholder="<?php echo _("Callsign"); ?>" />
419
+						<input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) {
420
+	print $callsign;
421
+}
422
+?>" size="8" placeholder="<?php echo _("Callsign"); ?>" />
371 423
 					</div>
372 424
 				</div>
373 425
 				<div class="form-group">
374 426
 					<div class="col-sm-offset-2 col-sm-10">
375 427
 						<label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all"){ print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label>
376
-						<label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label>
377
-						<label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label>
378
-						<label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "military"){ print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label>
428
+						<label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) {
429
+	if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"';
430
+}
431
+} ?>> <?php echo _("Only Passenger airlines"); ?></label>
432
+						<label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) {
433
+	if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"';
434
+}
435
+} ?>> <?php echo _("Only Cargo airlines"); ?></label>
436
+						<label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) {
437
+	if ( $_GET['airline_type'] == "military"){ print 'checked="checked"';
438
+}
439
+} ?>> <?php echo _("Only Military airlines"); ?></label>
379 440
 					</div>
380 441
 				</div>
381 442
 			</fieldset>
@@ -389,7 +450,10 @@  discard block
 block discarded – undo
389 450
 						</select>
390 451
 					</div>
391 452
 				</div>
392
-				<script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) print $airport_icao; ?>');</script>
453
+				<script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) {
454
+	print $airport_icao;
455
+}
456
+?>');</script>
393 457
 				<div class="form-group">
394 458
 					<label class="control-label col-sm-2"><?php echo _("Country"); ?></label> 
395 459
 					<div class="col-sm-10">
@@ -398,7 +462,10 @@  discard block
 block discarded – undo
398 462
 						</select>
399 463
 					</div>
400 464
 				</div>
401
-				<script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) print $airport_country; ?>');</script>
465
+				<script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) {
466
+	print $airport_country;
467
+}
468
+?>');</script>
402 469
 			</fieldset>
403 470
 			<fieldset>
404 471
 				<legend><?php echo _("Route"); ?></legend>
@@ -410,7 +477,10 @@  discard block
 block discarded – undo
410 477
 						</select>
411 478
 					</div>
412 479
 				</div>
413
-				<script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) print $departure_airport_route; ?>');</script>
480
+				<script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) {
481
+	print $departure_airport_route;
482
+}
483
+?>');</script>
414 484
 				<div class="form-group">
415 485
 					<label class="control-label col-sm-2"><?php echo _("Arrival Airport"); ?></label> 
416 486
 					<div class="col-sm-10">
@@ -419,7 +489,10 @@  discard block
 block discarded – undo
419 489
 						</select>
420 490
 					</div>
421 491
 				</div>
422
-				<script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) print $arrival_airport_route; ?>');</script>
492
+				<script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) {
493
+	print $arrival_airport_route;
494
+}
495
+?>');</script>
423 496
 			</fieldset>
424 497
 			<fieldset>
425 498
 				<legend><?php echo _("Date"); ?></legend>
@@ -427,7 +500,10 @@  discard block
 block discarded – undo
427 500
 					<label class="control-label col-sm-2"><?php echo _("Start Date"); ?></label>
428 501
 					<div class="col-sm-10">
429 502
 						<div class='input-group date' id='datetimepicker1'>
430
-							<input type='text' name="start_date" class="form-control" value="<?php if (isset($_GET['start_date'])) print $start_date; ?>" placeholder="<?php echo _("Start Date/Time"); ?>" />
503
+							<input type='text' name="start_date" class="form-control" value="<?php if (isset($_GET['start_date'])) {
504
+	print $start_date;
505
+}
506
+?>" placeholder="<?php echo _("Start Date/Time"); ?>" />
431 507
 							<span class="input-group-addon">
432 508
 								<span class="glyphicon glyphicon-calendar"></span>
433 509
 							</span>
@@ -438,7 +514,10 @@  discard block
 block discarded – undo
438 514
 					<label class="control-label col-sm-2"><?php echo _("End Date"); ?></label>
439 515
 					<div class="col-sm-10">
440 516
 						<div class='input-group date' id='datetimepicker2'>
441
-						<input type='text' name="end_date" class="form-control" value="<?php if (isset($_GET['end_date'])) print $end_date; ?>" placeholder="<?php echo _("End Date/Time"); ?>" />
517
+						<input type='text' name="end_date" class="form-control" value="<?php if (isset($_GET['end_date'])) {
518
+	print $end_date;
519
+}
520
+?>" placeholder="<?php echo _("End Date/Time"); ?>" />
442 521
 						<span class="input-group-addon">
443 522
 							<span class="glyphicon glyphicon-calendar"></span>
444 523
 						</span>
@@ -511,19 +590,33 @@  discard block
 block discarded – undo
511 590
 			<div class="form-group">
512 591
 				<label class="control-label col-sm-2"><?php echo _("Latitude"); ?></label>
513 592
 				<div class="col-sm-10">
514
-					<input type="text" name="origlat" class="form-control" placeholder="<?php echo _("Center point latitude"); ?>" value="<?php if (isset($_GET['origlat'])) print $origlat; ?>" />
593
+					<input type="text" name="origlat" class="form-control" placeholder="<?php echo _("Center point latitude"); ?>" value="<?php if (isset($_GET['origlat'])) {
594
+	print $origlat;
595
+}
596
+?>" />
515 597
 				</div>
516 598
 			</div>
517 599
 			<div class="form-group">
518 600
 				<label class="control-label col-sm-2"><?php echo _("Longitude"); ?></label>
519 601
 				<div class="col-sm-10">
520
-					<input type="text" name="origlon" class="form-control" placeholder="<?php echo _("Center point longitude"); ?>" value="<?php if (isset($_GET['origlon'])) print $origlon; ?>" />
602
+					<input type="text" name="origlon" class="form-control" placeholder="<?php echo _("Center point longitude"); ?>" value="<?php if (isset($_GET['origlon'])) {
603
+	print $origlon;
604
+}
605
+?>" />
521 606
 				</div>
522 607
 			</div>
523 608
 			<div class="form-group">
524
-				<label class="control-label col-sm-2"><?php echo _("Distance").' ('; if (isset($globalDistanceUnit)) print $globalDistanceUnit; else print 'km'; print ')'; ?></label>
609
+				<label class="control-label col-sm-2"><?php echo _("Distance").' ('; if (isset($globalDistanceUnit)) {
610
+	print $globalDistanceUnit;
611
+} else {
612
+	print 'km';
613
+}
614
+print ')'; ?></label>
525 615
 				<div class="col-sm-10">
526
-					<input type="text" name="dist" class="form-control" placeholder="<?php echo _("Distance from center point"); ?>" value="<?php if (isset($_GET['distance'])) print $distance; ?>" />
616
+					<input type="text" name="dist" class="form-control" placeholder="<?php echo _("Distance from center point"); ?>" value="<?php if (isset($_GET['distance'])) {
617
+	print $distance;
618
+}
619
+?>" />
527 620
 				</div>
528 621
 			</div>
529 622
 		</fieldset>
Please login to merge, or discard this patch.
flightid-sub-menu.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 </span>
4 4
 <div class="sub-menu sub-menu-container">
5 5
 	<ul class="nav nav-pills">
6
-		<li><a href="<?php print $globalURL; ?>/flightid/<?php print $id; ?>" <?php if (strtolower($current_page) == "flightid-overview"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
6
+		<li><a href="<?php print $globalURL; ?>/flightid/<?php print $id; ?>" <?php if (strtolower($current_page) == "flightid-overview") { print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
7 7
 		<?php if ($globalFlightAware) { ?>
8 8
 		<li><a href="http://flightaware.com/live/flight/id/<?php print $spotter_array[0]['flightaware_id']; ?>" target="_blank"><?php echo _("Flight Status"); ?>&raquo;</a></li>
9 9
 		<li><a href="http://flightaware.com/live/flight/id/<?php print $spotter_array[0]['flightaware_id']; ?>/tracklog" target="_blank"><?php echo _("Flight Log"); ?>&raquo;</a></li>
Please login to merge, or discard this patch.
aircraft-sub-menu.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -3,10 +3,10 @@  discard block
 block discarded – undo
3 3
 </span>
4 4
 <div class="sub-menu sub-menu-container">
5 5
 	<ul class="nav nav-pills">
6
-		<li><a href="<?php print $globalURL; ?>/aircraft/<?php print $aircraft_type; ?>" <?php if (strtolower($current_page) == "aircraft-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
7
-		<li><a href="<?php print $globalURL; ?>/aircraft/statistics/registration/<?php print $aircraft_type; ?>" <?php if (strtolower($current_page) == "aircraft-statistics-registration"){ print 'class="active"'; } ?>><?php echo _("Registration"); ?></a></li>
6
+		<li><a href="<?php print $globalURL; ?>/aircraft/<?php print $aircraft_type; ?>" <?php if (strtolower($current_page) == "aircraft-detailed") { print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
7
+		<li><a href="<?php print $globalURL; ?>/aircraft/statistics/registration/<?php print $aircraft_type; ?>" <?php if (strtolower($current_page) == "aircraft-statistics-registration") { print 'class="active"'; } ?>><?php echo _("Registration"); ?></a></li>
8 8
 		<li class="dropdown">
9
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "aircraft-statistics-airline" || strtolower($current_page) == "aircraft-statistics-airline-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
9
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "aircraft-statistics-airline" || strtolower($current_page) == "aircraft-statistics-airline-country") { print 'active'; } ?>" data-toggle="dropdown" href="#">
10 10
 		      <?php echo _("Airline"); ?> <span class="caret"></span>
11 11
 		    </a>
12 12
 		    <ul class="dropdown-menu" role="menu">
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 		    </ul>
16 16
 		</li>
17 17
 		<li class="dropdown">
18
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "aircraft-statistics-departure-airport" || strtolower($current_page) == "aircraft-statistics-departure-airport-country" || strtolower($current_page) == "aircraft-statistics-arrival-airport" || strtolower($current_page) == "aircraft-statistics-arrival-airport-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
18
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "aircraft-statistics-departure-airport" || strtolower($current_page) == "aircraft-statistics-departure-airport-country" || strtolower($current_page) == "aircraft-statistics-arrival-airport" || strtolower($current_page) == "aircraft-statistics-arrival-airport-country") { print 'active'; } ?>" data-toggle="dropdown" href="#">
19 19
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
20 20
 		    </a>
21 21
 		    <ul class="dropdown-menu" role="menu">
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 			  <li><a href="<?php print $globalURL; ?>/aircraft/statistics/arrival-airport-country/<?php print $aircraft_type; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
26 26
 		    </ul>
27 27
 		</li>
28
-		<li><a href="<?php print $globalURL; ?>/aircraft/statistics/route/<?php print $aircraft_type; ?>" <?php if (strtolower($current_page) == "aircraft-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li>
29
-		<li><a href="<?php print $globalURL; ?>/aircraft/statistics/time/<?php print $aircraft_type; ?>" <?php if (strtolower($current_page) == "aircraft-statistics-time"){ print 'class="active"'; } ?>><?php echo ("Time"); ?></a></li>
28
+		<li><a href="<?php print $globalURL; ?>/aircraft/statistics/route/<?php print $aircraft_type; ?>" <?php if (strtolower($current_page) == "aircraft-statistics-route") { print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li>
29
+		<li><a href="<?php print $globalURL; ?>/aircraft/statistics/time/<?php print $aircraft_type; ?>" <?php if (strtolower($current_page) == "aircraft-statistics-time") { print 'class="active"'; } ?>><?php echo ("Time"); ?></a></li>
30 30
 	</ul>
31 31
 </div>
32 32
\ No newline at end of file
Please login to merge, or discard this patch.