Completed
Push — master ( 665628...cdf767 )
by Yannick
05:38
created
require/class.Stats.php 2 patches
Spacing   +312 added lines, -312 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
17 17
 		$this->db = $Connection->db();
18 18
         }
19 19
               
20
-	public function addLastStatsUpdate($type,$stats_date) {
20
+	public function addLastStatsUpdate($type, $stats_date) {
21 21
                 $query = "DELETE FROM config WHERE name = :type;
22 22
             		INSERT INTO config (name,value) VALUES (:type,:stats_date);";
23
-                $query_values = array('type' => $type,':stats_date' => $stats_date);
23
+                $query_values = array('type' => $type, ':stats_date' => $stats_date);
24 24
                  try {
25 25
                         $sth = $this->db->prepare($query);
26 26
                         $sth->execute($query_values);
27
-                } catch(PDOException $e) {
27
+                } catch (PDOException $e) {
28 28
                         return "error : ".$e->getMessage();
29 29
                 }
30 30
         }
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
                  try {
35 35
                         $sth = $this->db->prepare($query);
36 36
                         $sth->execute(array(':type' => $type));
37
-                } catch(PDOException $e) {
37
+                } catch (PDOException $e) {
38 38
                         echo "error : ".$e->getMessage();
39 39
                 }
40 40
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
                  try {
55 55
                         $sth = $this->db->prepare($query);
56 56
                         $sth->execute(array(':filter_name' => $filter_name));
57
-                } catch(PDOException $e) {
57
+                } catch (PDOException $e) {
58 58
                         return "error : ".$e->getMessage();
59 59
                 }
60 60
         }
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
                  try {
65 65
                         $sth = $this->db->prepare($query);
66 66
                         $sth->execute();
67
-                } catch(PDOException $e) {
67
+                } catch (PDOException $e) {
68 68
                         return "error : ".$e->getMessage();
69 69
                 }
70 70
                 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
                  try {
73 73
                         $sth = $this->db->prepare($query);
74 74
                         $sth->execute(array(':filter_name' => $filter_name));
75
-                } catch(PDOException $e) {
75
+                } catch (PDOException $e) {
76 76
                         return "error : ".$e->getMessage();
77 77
                 }
78 78
         }
@@ -82,43 +82,43 @@  discard block
 block discarded – undo
82 82
                  try {
83 83
                         $sth = $this->db->prepare($query);
84 84
                         $sth->execute(array(':filter_name' => $filter_name));
85
-                } catch(PDOException $e) {
85
+                } catch (PDOException $e) {
86 86
                         echo "error : ".$e->getMessage();
87 87
                 }
88 88
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
89 89
                 return $all;
90 90
         }
91
-	public function getAllAircraftTypes($stats_airline = '',$filter_name = '') {
91
+	public function getAllAircraftTypes($stats_airline = '', $filter_name = '') {
92 92
 		if ($filter_name == '') $filter_name = $this->filter_name;
93 93
                 $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
94 94
                  try {
95 95
                         $sth = $this->db->prepare($query);
96
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
97
-                } catch(PDOException $e) {
96
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
97
+                } catch (PDOException $e) {
98 98
                         echo "error : ".$e->getMessage();
99 99
                 }
100 100
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
101 101
                 return $all;
102 102
         }
103
-	public function getAllManufacturers($stats_airline = '',$filter_name = '') {
103
+	public function getAllManufacturers($stats_airline = '', $filter_name = '') {
104 104
 		if ($filter_name == '') $filter_name = $this->filter_name;
105 105
                 $query = "SELECT DISTINCT(aircraft_manufacturer) FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND aircraft_manufacturer <> '' ORDER BY aircraft_manufacturer ASC";
106 106
                  try {
107 107
                         $sth = $this->db->prepare($query);
108
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
109
-                } catch(PDOException $e) {
108
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
109
+                } catch (PDOException $e) {
110 110
                         echo "error : ".$e->getMessage();
111 111
                 }
112 112
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
113 113
                 return $all;
114 114
         }
115
-	public function getAllAirportNames($stats_airline = '',$filter_name = '') {
115
+	public function getAllAirportNames($stats_airline = '', $filter_name = '') {
116 116
 		if ($filter_name == '') $filter_name = $this->filter_name;
117 117
                 $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC";
118 118
                  try {
119 119
                         $sth = $this->db->prepare($query);
120
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
121
-                } catch(PDOException $e) {
120
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
121
+                } catch (PDOException $e) {
122 122
                         echo "error : ".$e->getMessage();
123 123
                 }
124 124
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -133,22 +133,22 @@  discard block
 block discarded – undo
133 133
 		else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC";
134 134
                  try {
135 135
                         $sth = $this->db->prepare($query);
136
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
137
-                } catch(PDOException $e) {
136
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
137
+                } catch (PDOException $e) {
138 138
                         echo "error : ".$e->getMessage();
139 139
                 }
140 140
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
141 141
                 if (empty($all)) {
142 142
             	    $filters = array('airlines' => array($stats_airline));
143 143
             	    if ($filter_name != '') {
144
-            		    $filters = array_merge($filters,$globalStatsFilters[$filter_name]);
144
+            		    $filters = array_merge($filters, $globalStatsFilters[$filter_name]);
145 145
             	    }
146 146
             	    $Spotter = new Spotter($this->db);
147
-            	    $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters);
147
+            	    $all = $Spotter->countAllAircraftTypes($limit, 0, '', $filters);
148 148
                 }
149 149
                 return $all;
150 150
 	}
151
-	public function countAllAirlineCountries($limit = true,$filter_name = '') {
151
+	public function countAllAirlineCountries($limit = true, $filter_name = '') {
152 152
 		global $globalStatsFilters;
153 153
 		if ($filter_name == '') $filter_name = $this->filter_name;
154 154
 		if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0";
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
                  try {
157 157
                         $sth = $this->db->prepare($query);
158 158
                         $sth->execute(array(':filter_name' => $filter_name));
159
-                } catch(PDOException $e) {
159
+                } catch (PDOException $e) {
160 160
                         echo "error : ".$e->getMessage();
161 161
                 }
162 162
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -164,28 +164,28 @@  discard block
 block discarded – undo
164 164
             		$Spotter = new Spotter($this->db);
165 165
             		$filters = array();
166 166
             		if ($filter_name != '') {
167
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
167
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
168 168
 			}
169
-            		$all = $Spotter->countAllAirlineCountries($limit,$filters);
169
+            		$all = $Spotter->countAllAirlineCountries($limit, $filters);
170 170
                 }
171 171
                 return $all;
172 172
 	}
173
-	public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '') {
173
+	public function countAllAircraftManufacturers($limit = true, $stats_airline = '', $filter_name = '') {
174 174
 		global $globalStatsFilters;
175 175
 		if ($filter_name == '') $filter_name = $this->filter_name;
176 176
 		if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0";
177 177
 		else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC";
178 178
                  try {
179 179
                         $sth = $this->db->prepare($query);
180
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
181
-                } catch(PDOException $e) {
180
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
181
+                } catch (PDOException $e) {
182 182
                         echo "error : ".$e->getMessage();
183 183
                 }
184 184
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
185 185
                 if (empty($all)) {
186 186
             		$filters = array('airlines' => array($stats_airline));
187 187
             		if ($filter_name != '') {
188
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
188
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
189 189
 			}
190 190
             		$Spotter = new Spotter($this->db);
191 191
 			$all = $Spotter->countAllAircraftManufacturers($filters);
@@ -200,18 +200,18 @@  discard block
 block discarded – undo
200 200
 		else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC";
201 201
                  try {
202 202
                         $sth = $this->db->prepare($query);
203
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
204
-                } catch(PDOException $e) {
203
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
204
+                } catch (PDOException $e) {
205 205
                         echo "error : ".$e->getMessage();
206 206
                 }
207 207
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
208 208
                 if (empty($all)) {
209 209
 			$filters = array('airlines' => array($stats_airline));
210 210
 			if ($filter_name != '') {
211
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
211
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
212 212
 			}
213 213
 			$Spotter = new Spotter($this->db);
214
-			$all = $Spotter->countAllArrivalCountries($limit,$filters);
214
+			$all = $Spotter->countAllArrivalCountries($limit, $filters);
215 215
                 }
216 216
                 return $all;
217 217
 	}
@@ -222,15 +222,15 @@  discard block
 block discarded – undo
222 222
 		else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC";
223 223
                  try {
224 224
                         $sth = $this->db->prepare($query);
225
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
226
-                } catch(PDOException $e) {
225
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
226
+                } catch (PDOException $e) {
227 227
                         echo "error : ".$e->getMessage();
228 228
                 }
229 229
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
230 230
                 if (empty($all)) {
231 231
 			$filters = array('airlines' => array($stats_airline));
232 232
 			if ($filter_name != '') {
233
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
233
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
234 234
 			}
235 235
 			$Spotter = new Spotter($this->db);
236 236
 			$all = $Spotter->countAllDepartureCountries($filters);
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
                 return $all;
239 239
 	}
240 240
 
241
-	public function countAllAirlines($limit = true,$filter_name = '') {
241
+	public function countAllAirlines($limit = true, $filter_name = '') {
242 242
 		global $globalStatsFilters;
243 243
 		if ($filter_name == '') $filter_name = $this->filter_name;
244 244
 		if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
                  try {
247 247
                         $sth = $this->db->prepare($query);
248 248
                         $sth->execute(array(':filter_name' => $filter_name));
249
-                } catch(PDOException $e) {
249
+                } catch (PDOException $e) {
250 250
                         echo "error : ".$e->getMessage();
251 251
                 }
252 252
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -254,58 +254,58 @@  discard block
 block discarded – undo
254 254
 	                $Spotter = new Spotter($this->db);
255 255
             		$filters = array();
256 256
             		if ($filter_name != '') {
257
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
257
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
258 258
 			}
259 259
 
260
-    		        $all = $Spotter->countAllAirlines($limit,0,'',$filters);
260
+    		        $all = $Spotter->countAllAirlines($limit, 0, '', $filters);
261 261
                 }
262 262
                 return $all;
263 263
 	}
264
-	public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '') {
264
+	public function countAllAircraftRegistrations($limit = true, $stats_airline = '', $filter_name = '') {
265 265
 		global $globalStatsFilters;
266 266
 		if ($filter_name == '') $filter_name = $this->filter_name;
267 267
 		if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0";
268 268
 		else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC";
269 269
                  try {
270 270
                         $sth = $this->db->prepare($query);
271
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
272
-                } catch(PDOException $e) {
271
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
272
+                } catch (PDOException $e) {
273 273
                         echo "error : ".$e->getMessage();
274 274
                 }
275 275
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
276 276
                 if (empty($all)) {
277 277
 			$filters = array('airlines' => array($stats_airline));
278 278
 			if ($filter_name != '') {
279
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
279
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
280 280
 			}
281 281
 	                $Spotter = new Spotter($this->db);
282
-    		        $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters);
282
+    		        $all = $Spotter->countAllAircraftRegistrations($limit, 0, '', $filters);
283 283
                 }
284 284
                 return $all;
285 285
 	}
286
-	public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '') {
286
+	public function countAllCallsigns($limit = true, $stats_airline = '', $filter_name = '') {
287 287
 		global $globalStatsFilters;
288 288
 		if ($filter_name == '') $filter_name = $this->filter_name;
289 289
 		if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0";
290 290
 		else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC";
291 291
 		 try {
292 292
 			$sth = $this->db->prepare($query);
293
-			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
294
-		} catch(PDOException $e) {
293
+			$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
294
+		} catch (PDOException $e) {
295 295
 			echo "error : ".$e->getMessage();
296 296
 		}
297 297
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
298 298
 		if (empty($all)) {
299 299
 			$filters = array('airlines' => array($stats_airline));
300 300
 			if ($filter_name != '') {
301
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
301
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
302 302
 			}
303 303
 			$Spotter = new Spotter($this->db);
304
-			$all = $Spotter->countAllCallsigns($limit,0,'',$filters);
304
+			$all = $Spotter->countAllCallsigns($limit, 0, '', $filters);
305 305
 		}
306 306
 		return $all;
307 307
 	}
308
-	public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '') {
308
+	public function countAllFlightOverCountries($limit = true, $stats_airline = '', $filter_name = '') {
309 309
 		$Connection = new Connection();
310 310
 		if ($filter_name == '') $filter_name = $this->filter_name;
311 311
 		if ($Connection->tableExists('countries')) {
@@ -313,8 +313,8 @@  discard block
 block discarded – undo
313 313
 			else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC";
314 314
 			 try {
315 315
 				$sth = $this->db->prepare($query);
316
-				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
317
-			} catch(PDOException $e) {
316
+				$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
317
+			} catch (PDOException $e) {
318 318
 				echo "error : ".$e->getMessage();
319 319
 			}
320 320
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -329,70 +329,70 @@  discard block
 block discarded – undo
329 329
 			return array();
330 330
 		}
331 331
 	}
332
-	public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '') {
332
+	public function countAllPilots($limit = true, $stats_airline = '', $filter_name = '') {
333 333
 		global $globalStatsFilters;
334 334
 		if ($filter_name == '') $filter_name = $this->filter_name;
335 335
 		if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0";
336 336
 		else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC";
337 337
                  try {
338 338
                         $sth = $this->db->prepare($query);
339
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
340
-                } catch(PDOException $e) {
339
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
340
+                } catch (PDOException $e) {
341 341
                         echo "error : ".$e->getMessage();
342 342
                 }
343 343
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
344 344
                 if (empty($all)) {
345 345
 			$filters = array('airlines' => array($stats_airline));
346 346
 			if ($filter_name != '') {
347
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
347
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
348 348
 			}
349 349
             		$Spotter = new Spotter($this->db);
350
-            		$all = $Spotter->countAllPilots($limit,0,'',$filters);
350
+            		$all = $Spotter->countAllPilots($limit, 0, '', $filters);
351 351
                 }
352 352
                 return $all;
353 353
 	}
354
-	public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '') {
354
+	public function countAllOwners($limit = true, $stats_airline = '', $filter_name = '') {
355 355
 		global $globalStatsFilters;
356 356
 		if ($filter_name == '') $filter_name = $this->filter_name;
357 357
 		if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0";
358 358
 		else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC";
359 359
                  try {
360 360
                         $sth = $this->db->prepare($query);
361
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
362
-                } catch(PDOException $e) {
361
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
362
+                } catch (PDOException $e) {
363 363
                         echo "error : ".$e->getMessage();
364 364
                 }
365 365
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
366 366
                 if (empty($all)) {
367 367
 			$filters = array('airlines' => array($stats_airline));
368 368
 			if ($filter_name != '') {
369
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
369
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
370 370
 			}
371 371
             		$Spotter = new Spotter($this->db);
372
-            		$all = $Spotter->countAllOwners($limit,0,'',$filters);
372
+            		$all = $Spotter->countAllOwners($limit, 0, '', $filters);
373 373
                 }
374 374
                 return $all;
375 375
 	}
376
-	public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '') {
376
+	public function countAllDepartureAirports($limit = true, $stats_airline = '', $filter_name = '') {
377 377
 		global $globalStatsFilters;
378 378
 		if ($filter_name == '') $filter_name = $this->filter_name;
379 379
 		if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
380 380
 		else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
381 381
                  try {
382 382
                         $sth = $this->db->prepare($query);
383
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
384
-                } catch(PDOException $e) {
383
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
384
+                } catch (PDOException $e) {
385 385
                         echo "error : ".$e->getMessage();
386 386
                 }
387 387
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
388 388
                 if (empty($all)) {
389 389
 			$filters = array('airlines' => array($stats_airline));
390 390
             		if ($filter_name != '') {
391
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
391
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
392 392
 			}
393 393
             		$Spotter = new Spotter($this->db);
394
-            		$pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters);
395
-        		$dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters);
394
+            		$pall = $Spotter->countAllDepartureAirports($limit, 0, '', $filters);
395
+        		$dall = $Spotter->countAllDetectedDepartureAirports($limit, 0, '', $filters);
396 396
         		$all = array();
397 397
         		foreach ($pall as $value) {
398 398
         			$icao = $value['airport_departure_icao'];
@@ -409,30 +409,30 @@  discard block
 block discarded – undo
409 409
         		foreach ($all as $key => $row) {
410 410
         			$count[$key] = $row['airport_departure_icao_count'];
411 411
         		}
412
-        		array_multisort($count,SORT_DESC,$all);
412
+        		array_multisort($count, SORT_DESC, $all);
413 413
                 }
414 414
                 return $all;
415 415
 	}
416
-	public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '') {
416
+	public function countAllArrivalAirports($limit = true, $stats_airline = '', $filter_name = '') {
417 417
 		global $globalStatsFilters;
418 418
 		if ($filter_name == '') $filter_name = $this->filter_name;
419 419
 		if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0";
420 420
 		else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
421 421
 		try {
422 422
 			$sth = $this->db->prepare($query);
423
-			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
424
-		} catch(PDOException $e) {
423
+			$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
424
+		} catch (PDOException $e) {
425 425
 			echo "error : ".$e->getMessage();
426 426
 		}
427 427
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
428 428
 		if (empty($all)) {
429 429
 			$filters = array('airlines' => array($stats_airline));
430 430
 			if ($filter_name != '') {
431
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
431
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
432 432
 			}
433 433
 			$Spotter = new Spotter($this->db);
434
-			$pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters);
435
-			$dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters);
434
+			$pall = $Spotter->countAllArrivalAirports($limit, 0, '', false, $filters);
435
+			$dall = $Spotter->countAllDetectedArrivalAirports($limit, 0, '', false, $filters);
436 436
         		$all = array();
437 437
         		foreach ($pall as $value) {
438 438
         			$icao = $value['airport_arrival_icao'];
@@ -449,12 +449,12 @@  discard block
 block discarded – undo
449 449
         		foreach ($all as $key => $row) {
450 450
         			$count[$key] = $row['airport_arrival_icao_count'];
451 451
         		}
452
-        		array_multisort($count,SORT_DESC,$all);
452
+        		array_multisort($count, SORT_DESC, $all);
453 453
                 }
454 454
  
455 455
                 return $all;
456 456
 	}
457
-	public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') {
457
+	public function countAllMonthsLastYear($limit = true, $stats_airline = '', $filter_name = '') {
458 458
 		global $globalDBdriver, $globalStatsFilters;
459 459
 		if ($filter_name == '') $filter_name = $this->filter_name;
460 460
 		if ($globalDBdriver == 'mysql') {
@@ -464,18 +464,18 @@  discard block
 block discarded – undo
464 464
 			if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
465 465
 			else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
466 466
 		}
467
-		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
467
+		$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
468 468
                  try {
469 469
                         $sth = $this->db->prepare($query);
470 470
                         $sth->execute($query_data);
471
-                } catch(PDOException $e) {
471
+                } catch (PDOException $e) {
472 472
                         echo "error : ".$e->getMessage();
473 473
                 }
474 474
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
475 475
                 if (empty($all)) {
476 476
 			$filters = array('airlines' => array($stats_airline));
477 477
 			if ($filter_name != '') {
478
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
478
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
479 479
 			}
480 480
             		$Spotter = new Spotter($this->db);
481 481
             		$all = $Spotter->countAllMonthsLastYear($filters);
@@ -484,29 +484,29 @@  discard block
 block discarded – undo
484 484
                 return $all;
485 485
 	}
486 486
 	
487
-	public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') {
487
+	public function countAllDatesLastMonth($stats_airline = '', $filter_name = '') {
488 488
 		global $globalStatsFilters;
489 489
 		if ($filter_name == '') $filter_name = $this->filter_name;
490 490
 		$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name";
491
-		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
491
+		$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
492 492
                  try {
493 493
                         $sth = $this->db->prepare($query);
494 494
                         $sth->execute($query_data);
495
-                } catch(PDOException $e) {
495
+                } catch (PDOException $e) {
496 496
                         echo "error : ".$e->getMessage();
497 497
                 }
498 498
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
499 499
                 if (empty($all)) {
500 500
 			$filters = array('airlines' => array($stats_airline));
501 501
 			if ($filter_name != '') {
502
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
502
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
503 503
 			}
504 504
             		$Spotter = new Spotter($this->db);
505 505
             		$all = $Spotter->countAllDatesLastMonth($filters);
506 506
                 }
507 507
                 return $all;
508 508
 	}
509
-	public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') {
509
+	public function countAllDatesLast7Days($stats_airline = '', $filter_name = '') {
510 510
 		global $globalDBdriver, $globalStatsFilters;
511 511
 		if ($filter_name == '') $filter_name = $this->filter_name;
512 512
 		if ($globalDBdriver == 'mysql') {
@@ -514,40 +514,40 @@  discard block
 block discarded – undo
514 514
 		} else {
515 515
 			$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '7 DAYS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
516 516
 		}
517
-		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
517
+		$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
518 518
                  try {
519 519
                         $sth = $this->db->prepare($query);
520 520
                         $sth->execute($query_data);
521
-                } catch(PDOException $e) {
521
+                } catch (PDOException $e) {
522 522
                         echo "error : ".$e->getMessage();
523 523
                 }
524 524
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
525 525
                 if (empty($all)) {
526 526
 			$filters = array('airlines' => array($stats_airline));
527 527
 			if ($filter_name != '') {
528
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
528
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
529 529
 			}
530 530
             		$Spotter = new Spotter($this->db);
531 531
             		$all = $Spotter->countAllDatesLast7Days($filters);
532 532
                 }
533 533
                 return $all;
534 534
 	}
535
-	public function countAllDates($stats_airline = '',$filter_name = '') {
535
+	public function countAllDates($stats_airline = '', $filter_name = '') {
536 536
 		global $globalStatsFilters;
537 537
 		if ($filter_name == '') $filter_name = $this->filter_name;
538 538
 		$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name";
539
-		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
539
+		$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
540 540
                  try {
541 541
                         $sth = $this->db->prepare($query);
542 542
                         $sth->execute($query_data);
543
-                } catch(PDOException $e) {
543
+                } catch (PDOException $e) {
544 544
                         echo "error : ".$e->getMessage();
545 545
                 }
546 546
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
547 547
                 if (empty($all)) {
548 548
 			$filters = array('airlines' => array($stats_airline));
549 549
 			if ($filter_name != '') {
550
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
550
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
551 551
 			}
552 552
             		$Spotter = new Spotter($this->db);
553 553
             		$all = $Spotter->countAllDates($filters);
@@ -562,35 +562,35 @@  discard block
 block discarded – undo
562 562
                  try {
563 563
                         $sth = $this->db->prepare($query);
564 564
                         $sth->execute($query_data);
565
-                } catch(PDOException $e) {
565
+                } catch (PDOException $e) {
566 566
                         echo "error : ".$e->getMessage();
567 567
                 }
568 568
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
569 569
                 if (empty($all)) {
570 570
             		$filters = array();
571 571
             		if ($filter_name != '') {
572
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
572
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
573 573
 			}
574 574
             		$Spotter = new Spotter($this->db);
575 575
             		$all = $Spotter->countAllDatesByAirlines($filters);
576 576
                 }
577 577
                 return $all;
578 578
 	}
579
-	public function countAllMonths($stats_airline = '',$filter_name = '') {
579
+	public function countAllMonths($stats_airline = '', $filter_name = '') {
580 580
 		global $globalStatsFilters;
581 581
 		if ($filter_name == '') $filter_name = $this->filter_name;
582 582
 	    	$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
583 583
                  try {
584 584
                         $sth = $this->db->prepare($query);
585 585
                         $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
586
-                } catch(PDOException $e) {
586
+                } catch (PDOException $e) {
587 587
                         echo "error : ".$e->getMessage();
588 588
                 }
589 589
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
590 590
                 if (empty($all)) {
591 591
 			$filters = array('airlines' => array($stats_airline));
592 592
 			if ($filter_name != '') {
593
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
593
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
594 594
 			}
595 595
             		$Spotter = new Spotter($this->db);
596 596
             		$all = $Spotter->countAllMonths($filters);
@@ -604,21 +604,21 @@  discard block
 block discarded – undo
604 604
                  try {
605 605
                         $sth = $this->db->prepare($query);
606 606
                         $sth->execute(array(':filter_name' => $filter_name));
607
-                } catch(PDOException $e) {
607
+                } catch (PDOException $e) {
608 608
                         echo "error : ".$e->getMessage();
609 609
                 }
610 610
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
611 611
                 if (empty($all)) {
612 612
             		$filters = array();
613 613
             		if ($filter_name != '') {
614
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
614
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
615 615
 			}
616 616
             		$Spotter = new Spotter($this->db);
617 617
             		$all = $Spotter->countAllMilitaryMonths($filters);
618 618
                 }
619 619
                 return $all;
620 620
 	}
621
-	public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') {
621
+	public function countAllHours($orderby = 'hour', $limit = true, $stats_airline = '', $filter_name = '') {
622 622
 		global $globalTimezone, $globalDBdriver, $globalStatsFilters;
623 623
 		if ($filter_name == '') $filter_name = $this->filter_name;
624 624
 		if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
@@ -635,17 +635,17 @@  discard block
 block discarded – undo
635 635
                  try {
636 636
                         $sth = $this->db->prepare($query);
637 637
                         $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
638
-                } catch(PDOException $e) {
638
+                } catch (PDOException $e) {
639 639
                         echo "error : ".$e->getMessage();
640 640
                 }
641 641
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
642 642
                 if (empty($all)) {
643 643
 			$filters = array('airlines' => array($stats_airline));
644 644
 			if ($filter_name != '') {
645
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
645
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
646 646
 			}
647 647
             		$Spotter = new Spotter($this->db);
648
-            		$all = $Spotter->countAllHours($orderby,$filters);
648
+            		$all = $Spotter->countAllHours($orderby, $filters);
649 649
                 }
650 650
                 return $all;
651 651
 	}
@@ -653,11 +653,11 @@  discard block
 block discarded – undo
653 653
 	public function countOverallFlights($stats_airline = '', $filter_name = '') {
654 654
 		global $globalStatsFilters;
655 655
 		if ($filter_name == '') $filter_name = $this->filter_name;
656
-		$all = $this->getSumStats('flights_bymonth',date('Y'),$stats_airline,$filter_name);
656
+		$all = $this->getSumStats('flights_bymonth', date('Y'), $stats_airline, $filter_name);
657 657
 		if (empty($all)) {
658 658
 			$filters = array('airlines' => array($stats_airline));
659 659
 			if ($filter_name != '') {
660
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
660
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
661 661
 			}
662 662
 			$Spotter = new Spotter($this->db);
663 663
 			$all = $Spotter->countOverallFlights($filters);
@@ -667,39 +667,39 @@  discard block
 block discarded – undo
667 667
 	public function countOverallMilitaryFlights($filter_name = '') {
668 668
 		global $globalStatsFilters;
669 669
 		if ($filter_name == '') $filter_name = $this->filter_name;
670
-		$all = $this->getSumStats('military_flights_bymonth',date('Y'),'',$filter_name);
670
+		$all = $this->getSumStats('military_flights_bymonth', date('Y'), '', $filter_name);
671 671
 		if (empty($all)) {
672 672
 		        $filters = array();
673 673
             		if ($filter_name != '') {
674
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
674
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
675 675
 			}
676 676
 			$Spotter = new Spotter($this->db);
677 677
 			$all = $Spotter->countOverallMilitaryFlights($filters);
678 678
 		}
679 679
 		return $all;
680 680
 	}
681
-	public function countOverallArrival($stats_airline = '',$filter_name = '') {
681
+	public function countOverallArrival($stats_airline = '', $filter_name = '') {
682 682
 		global $globalStatsFilters;
683 683
 		if ($filter_name == '') $filter_name = $this->filter_name;
684
-		$all = $this->getSumStats('realarrivals_bymonth',date('Y'),$stats_airline,$filter_name);
684
+		$all = $this->getSumStats('realarrivals_bymonth', date('Y'), $stats_airline, $filter_name);
685 685
 		if (empty($all)) {
686 686
 			$filters = array('airlines' => array($stats_airline));
687 687
 			if ($filter_name != '') {
688
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
688
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
689 689
 			}
690 690
 			$Spotter = new Spotter($this->db);
691 691
 			$all = $Spotter->countOverallArrival($filters);
692 692
 		}
693 693
 		return $all;
694 694
 	}
695
-	public function countOverallAircrafts($stats_airline = '',$filter_name = '') {
695
+	public function countOverallAircrafts($stats_airline = '', $filter_name = '') {
696 696
 		global $globalStatsFilters;
697 697
 		if ($filter_name == '') $filter_name = $this->filter_name;
698
-		$all = $this->getSumStats('aircrafts_bymonth',date('Y'),$stats_airline,$filter_name);
698
+		$all = $this->getSumStats('aircrafts_bymonth', date('Y'), $stats_airline, $filter_name);
699 699
 		if (empty($all)) {
700 700
 			$filters = array('airlines' => array($stats_airline));
701 701
 			if ($filter_name != '') {
702
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
702
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
703 703
 			}
704 704
 			$Spotter = new Spotter($this->db);
705 705
 			$all = $Spotter->countOverallAircrafts($filters);
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
                  try {
714 714
                         $sth = $this->db->prepare($query);
715 715
                         $sth->execute(array(':filter_name' => $filter_name));
716
-                } catch(PDOException $e) {
716
+                } catch (PDOException $e) {
717 717
                         echo "error : ".$e->getMessage();
718 718
                 }
719 719
                 $result = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -722,14 +722,14 @@  discard block
 block discarded – undo
722 722
 		if (empty($all)) {
723 723
             		$filters = array();
724 724
             		if ($filter_name != '') {
725
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
725
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
726 726
 			}
727 727
 			$Spotter = new Spotter($this->db);
728 728
 			$all = $Spotter->countOverallAirlines($filters);
729 729
 		}
730 730
 		return $all;
731 731
 	}
732
-	public function countOverallOwners($stats_airline = '',$filter_name = '') {
732
+	public function countOverallOwners($stats_airline = '', $filter_name = '') {
733 733
 		global $globalStatsFilters;
734 734
 		if ($filter_name == '') $filter_name = $this->filter_name;
735 735
 		/*
@@ -743,25 +743,25 @@  discard block
 block discarded – undo
743 743
                 $result = $sth->fetchAll(PDO::FETCH_ASSOC);
744 744
                 $all = $result[0]['nb_owner'];
745 745
                 */
746
-		$all = $this->getSumStats('owners_bymonth',date('Y'),$stats_airline,$filter_name);
746
+		$all = $this->getSumStats('owners_bymonth', date('Y'), $stats_airline, $filter_name);
747 747
 		if (empty($all)) {
748 748
 			$filters = array('airlines' => array($stats_airline));
749 749
 			if ($filter_name != '') {
750
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
750
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
751 751
 			}
752 752
 			$Spotter = new Spotter($this->db);
753 753
 			$all = $Spotter->countOverallOwners($filters);
754 754
 		}
755 755
 		return $all;
756 756
 	}
757
-	public function countOverallPilots($stats_airline = '',$filter_name = '') {
757
+	public function countOverallPilots($stats_airline = '', $filter_name = '') {
758 758
 		global $globalStatsFilters;
759 759
 		if ($filter_name == '') $filter_name = $this->filter_name;
760
-		$all = $this->getSumStats('pilots_bymonth',date('Y'),$stats_airline,$filter_name);
760
+		$all = $this->getSumStats('pilots_bymonth', date('Y'), $stats_airline, $filter_name);
761 761
 		if (empty($all)) {
762 762
 			$filters = array('airlines' => array($stats_airline));
763 763
 			if ($filter_name != '') {
764
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
764
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
765 765
 			}
766 766
 			$Spotter = new Spotter($this->db);
767 767
 			$all = $Spotter->countOverallPilots($filters);
@@ -769,33 +769,33 @@  discard block
 block discarded – undo
769 769
 		return $all;
770 770
 	}
771 771
 
772
-	public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') {
772
+	public function getLast7DaysAirports($airport_icao = '', $stats_airline = '', $filter_name = '') {
773 773
 		if ($filter_name == '') $filter_name = $this->filter_name;
774 774
 		$query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date";
775
-		$query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
775
+		$query_values = array(':airport_icao' => $airport_icao, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
776 776
                  try {
777 777
                         $sth = $this->db->prepare($query);
778 778
                         $sth->execute($query_values);
779
-                } catch(PDOException $e) {
779
+                } catch (PDOException $e) {
780 780
                         echo "error : ".$e->getMessage();
781 781
                 }
782 782
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
783 783
                 return $all;
784 784
 	}
785
-	public function getStats($type,$stats_airline = '', $filter_name = '') {
785
+	public function getStats($type, $stats_airline = '', $filter_name = '') {
786 786
 		if ($filter_name == '') $filter_name = $this->filter_name;
787 787
                 $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date";
788
-                $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
788
+                $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
789 789
                  try {
790 790
                         $sth = $this->db->prepare($query);
791 791
                         $sth->execute($query_values);
792
-                } catch(PDOException $e) {
792
+                } catch (PDOException $e) {
793 793
                         echo "error : ".$e->getMessage();
794 794
                 }
795 795
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
796 796
                 return $all;
797 797
         }
798
-	public function getSumStats($type,$year,$stats_airline = '',$filter_name = '') {
798
+	public function getSumStats($type, $year, $stats_airline = '', $filter_name = '') {
799 799
 		if ($filter_name == '') $filter_name = $this->filter_name;
800 800
     		global $globalArchiveMonths, $globalDBdriver;
801 801
     		if ($globalDBdriver == 'mysql') {
@@ -803,11 +803,11 @@  discard block
 block discarded – undo
803 803
 	        } else {
804 804
             		$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name";
805 805
                 }
806
-                $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
806
+                $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
807 807
                  try {
808 808
                         $sth = $this->db->prepare($query);
809 809
                         $sth->execute($query_values);
810
-                } catch(PDOException $e) {
810
+                } catch (PDOException $e) {
811 811
                         echo "error : ".$e->getMessage();
812 812
                 }
813 813
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
                  try {
826 826
                         $sth = $this->db->prepare($query);
827 827
                         $sth->execute($query_values);
828
-                } catch(PDOException $e) {
828
+                } catch (PDOException $e) {
829 829
                         echo "error : ".$e->getMessage();
830 830
                 }
831 831
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
                  try {
843 843
                         $sth = $this->db->prepare($query);
844 844
                         $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
845
-                } catch(PDOException $e) {
845
+                } catch (PDOException $e) {
846 846
                         echo "error : ".$e->getMessage();
847 847
                 }
848 848
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
                  try {
860 860
                         $sth = $this->db->prepare($query);
861 861
                         $sth->execute(array(':filter_name' => $filter_name));
862
-                } catch(PDOException $e) {
862
+                } catch (PDOException $e) {
863 863
                         echo "error : ".$e->getMessage();
864 864
                 }
865 865
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
                  try {
877 877
                         $sth = $this->db->prepare($query);
878 878
                         $sth->execute(array(':filter_name' => $filter_name));
879
-                } catch(PDOException $e) {
879
+                } catch (PDOException $e) {
880 880
                         echo "error : ".$e->getMessage();
881 881
                 }
882 882
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -893,14 +893,14 @@  discard block
 block discarded – undo
893 893
                  try {
894 894
                         $sth = $this->db->prepare($query);
895 895
                         $sth->execute(array(':filter_name' => $filter_name));
896
-                } catch(PDOException $e) {
896
+                } catch (PDOException $e) {
897 897
                         echo "error : ".$e->getMessage();
898 898
                 }
899 899
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
900 900
                 return $all[0]['total'];
901 901
         }
902 902
 
903
-	public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
903
+	public function addStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') {
904 904
 		global $globalDBdriver;
905 905
 		if ($filter_name == '') $filter_name = $this->filter_name;
906 906
 		if ($globalDBdriver == 'mysql') {
@@ -908,15 +908,15 @@  discard block
 block discarded – undo
908 908
                 } else {
909 909
 			$query = "UPDATE stats SET cnt = :cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE  stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
910 910
 		}
911
-                $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
911
+                $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
912 912
                  try {
913 913
                         $sth = $this->db->prepare($query);
914 914
                         $sth->execute($query_values);
915
-                } catch(PDOException $e) {
915
+                } catch (PDOException $e) {
916 916
                         return "error : ".$e->getMessage();
917 917
                 }
918 918
         }
919
-	public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
919
+	public function updateStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') {
920 920
 		global $globalDBdriver;
921 921
 		if ($filter_name == '') $filter_name = $this->filter_name;
922 922
 		if ($globalDBdriver == 'mysql') {
@@ -925,219 +925,219 @@  discard block
 block discarded – undo
925 925
             		//$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date";
926 926
 			$query = "UPDATE stats SET cnt = cnt+:cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE  stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
927 927
                 }
928
-                $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
928
+                $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
929 929
                  try {
930 930
                         $sth = $this->db->prepare($query);
931 931
                         $sth->execute($query_values);
932
-                } catch(PDOException $e) {
932
+                } catch (PDOException $e) {
933 933
                         return "error : ".$e->getMessage();
934 934
                 }
935 935
         }
936
-	public function getStatsSource($date,$stats_type = '') {
936
+	public function getStatsSource($date, $stats_type = '') {
937 937
 		if ($stats_type == '') {
938 938
 			$query = "SELECT * FROM stats_source WHERE stats_date = :date ORDER BY source_name";
939 939
 			$query_values = array(':date' => $date);
940 940
 		} else {
941 941
 			$query = "SELECT * FROM stats_source WHERE stats_date = :date AND stats_type = :stats_type ORDER BY source_name";
942
-			$query_values = array(':date' => $date,':stats_type' => $stats_type);
942
+			$query_values = array(':date' => $date, ':stats_type' => $stats_type);
943 943
 		}
944 944
                  try {
945 945
                         $sth = $this->db->prepare($query);
946 946
                         $sth->execute($query_values);
947
-                } catch(PDOException $e) {
947
+                } catch (PDOException $e) {
948 948
                         echo "error : ".$e->getMessage();
949 949
                 }
950 950
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
951 951
                 return $all;
952 952
         }
953 953
 
954
-	public function addStatSource($data,$source_name,$stats_type,$date) {
954
+	public function addStatSource($data, $source_name, $stats_type, $date) {
955 955
 		global $globalDBdriver;
956 956
 		if ($globalDBdriver == 'mysql') {
957 957
 			$query = "INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) VALUES (:data,:source_name,:stats_type,:stats_date) ON DUPLICATE KEY UPDATE source_data = :data";
958 958
 		} else {
959 959
 			$query = "UPDATE stats_source SET source_data = :data WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type; INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) SELECT :data,:source_name,:stats_type,:stats_date WHERE NOT EXISTS (SELECT 1 FROM stats_source WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type);"; 
960 960
                 }
961
-                $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type);
961
+                $query_values = array(':data' => $data, ':stats_date' => $date, ':source_name' => $source_name, ':stats_type' => $stats_type);
962 962
                  try {
963 963
                         $sth = $this->db->prepare($query);
964 964
                         $sth->execute($query_values);
965
-                } catch(PDOException $e) {
965
+                } catch (PDOException $e) {
966 966
                         return "error : ".$e->getMessage();
967 967
                 }
968 968
         }
969
-	public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') {
969
+	public function addStatFlight($type, $date_name, $cnt, $stats_airline = '', $filter_name = '') {
970 970
                 $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)";
971
-                $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
971
+                $query_values = array(':type' => $type, ':flight_date' => $date_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
972 972
                  try {
973 973
                         $sth = $this->db->prepare($query);
974 974
                         $sth->execute($query_values);
975
-                } catch(PDOException $e) {
975
+                } catch (PDOException $e) {
976 976
                         return "error : ".$e->getMessage();
977 977
                 }
978 978
         }
979
-	public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '') {
979
+	public function addStatAircraftRegistration($registration, $cnt, $aircraft_icao = '', $airline_icao = '', $filter_name = '') {
980 980
 		global $globalDBdriver;
981 981
 		if ($globalDBdriver == 'mysql') {
982 982
 			$query = "INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline,filter_name) VALUES (:aircraft_icao,:registration,:cnt,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt";
983 983
 		} else {
984 984
 			$query = "UPDATE stats_registration SET cnt = cnt+:cnt WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:registration,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_registration WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
985 985
 		}
986
-                $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
986
+                $query_values = array(':aircraft_icao' => $aircraft_icao, ':registration' => $registration, ':cnt' => $cnt, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
987 987
                  try {
988 988
                         $sth = $this->db->prepare($query);
989 989
                         $sth->execute($query_values);
990
-                } catch(PDOException $e) {
990
+                } catch (PDOException $e) {
991 991
                         return "error : ".$e->getMessage();
992 992
                 }
993 993
         }
994
-	public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '') {
994
+	public function addStatCallsign($callsign_icao, $cnt, $airline_icao = '', $filter_name = '') {
995 995
 		global $globalDBdriver;
996 996
 		if ($globalDBdriver == 'mysql') {
997 997
 			$query = "INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt,filter_name) VALUES (:callsign_icao,:airline_icao,:cnt,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt";
998 998
 		} else {
999 999
 			$query = "UPDATE stats_callsign SET cnt = cnt+:cnt WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name; INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt,filter_name) SELECT :callsign_icao,:airline_icao,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_callsign WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name);"; 
1000 1000
 		}
1001
-                $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name);
1001
+                $query_values = array(':callsign_icao' => $callsign_icao, ':airline_icao' => $airline_icao, ':cnt' => $cnt, ':filter_name' => $filter_name);
1002 1002
                  try {
1003 1003
                         $sth = $this->db->prepare($query);
1004 1004
                         $sth->execute($query_values);
1005
-                } catch(PDOException $e) {
1005
+                } catch (PDOException $e) {
1006 1006
                         return "error : ".$e->getMessage();
1007 1007
                 }
1008 1008
         }
1009
-	public function addStatCountry($iso2,$iso3,$name,$cnt,$filter_name = '') {
1009
+	public function addStatCountry($iso2, $iso3, $name, $cnt, $filter_name = '') {
1010 1010
 		global $globalDBdriver;
1011 1011
 		if ($globalDBdriver == 'mysql') {
1012 1012
 			$query = "INSERT INTO stats_country (iso2,iso3,name,cnt,filter_name) VALUES (:iso2,:iso3,:name,:cnt,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt";
1013 1013
 		} else {
1014 1014
 			$query = "UPDATE stats_country SET cnt = cnt+:cnt WHERE iso2 = :iso2 AND filter_name = :filter_name; INSERT INTO stats_country (iso2,iso3,name,cnt,filter_name) SELECT :iso2,:iso3,:name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_country WHERE iso2 = :iso2 AND filter_name = :filter_name);"; 
1015 1015
 		}
1016
-                $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name);
1016
+                $query_values = array(':iso2' => $iso2, ':iso3' => $iso3, ':name' => $name, ':cnt' => $cnt, ':filter_name' => $filter_name);
1017 1017
                  try {
1018 1018
                         $sth = $this->db->prepare($query);
1019 1019
                         $sth->execute($query_values);
1020
-                } catch(PDOException $e) {
1020
+                } catch (PDOException $e) {
1021 1021
                         return "error : ".$e->getMessage();
1022 1022
                 }
1023 1023
         }
1024
-	public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '') {
1024
+	public function addStatAircraft($aircraft_icao, $cnt, $aircraft_name = '', $aircraft_manufacturer = '', $airline_icao = '', $filter_name = '') {
1025 1025
 		global $globalDBdriver;
1026 1026
 		if ($globalDBdriver == 'mysql') {
1027 1027
 			$query = "INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline, filter_name) VALUES (:aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer, stats_airline = :stats_airline";
1028 1028
 		} else {
1029 1029
 			$query = "UPDATE stats_aircraft SET cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer, filter_name = :filter_name WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_aircraft WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1030 1030
 		}
1031
-                $query_values = array(':aircraft_icao' => $aircraft_icao,':aircraft_name' => $aircraft_name,':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer,':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1031
+                $query_values = array(':aircraft_icao' => $aircraft_icao, ':aircraft_name' => $aircraft_name, ':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1032 1032
                  try {
1033 1033
                         $sth = $this->db->prepare($query);
1034 1034
                         $sth->execute($query_values);
1035
-                } catch(PDOException $e) {
1035
+                } catch (PDOException $e) {
1036 1036
                         return "error : ".$e->getMessage();
1037 1037
                 }
1038 1038
         }
1039
-	public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '') {
1039
+	public function addStatAirline($airline_icao, $cnt, $airline_name = '', $filter_name = '') {
1040 1040
 		global $globalDBdriver;
1041 1041
 		if ($globalDBdriver == 'mysql') {
1042 1042
 			$query = "INSERT INTO stats_airline (airline_icao,airline_name,cnt,filter_name) VALUES (:airline_icao,:airline_name,:cnt,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt,airline_name = :airline_name";
1043 1043
 		} else {
1044 1044
 			$query = "UPDATE stats_airline SET cnt = cnt+:cnt WHERE airline_icao = :airline_icao AND filter_name = :filter_name; INSERT INTO stats_airline (airline_icao,airline_name,cnt,filter_name) SELECT :airline_icao,:airline_name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airline WHERE airline_icao = :airline_icao AND filter_name = :filter_name);"; 
1045 1045
 		}
1046
-                $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name);
1046
+                $query_values = array(':airline_icao' => $airline_icao, ':airline_name' => $airline_name, ':cnt' => $cnt, ':filter_name' => $filter_name);
1047 1047
                  try {
1048 1048
                         $sth = $this->db->prepare($query);
1049 1049
                         $sth->execute($query_values);
1050
-                } catch(PDOException $e) {
1050
+                } catch (PDOException $e) {
1051 1051
                         return "error : ".$e->getMessage();
1052 1052
                 }
1053 1053
         }
1054
-	public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '') {
1054
+	public function addStatOwner($owner_name, $cnt, $stats_airline = '', $filter_name = '') {
1055 1055
 		global $globalDBdriver;
1056 1056
 		if ($globalDBdriver == 'mysql') {
1057 1057
 			$query = "INSERT INTO stats_owner (owner_name,cnt,stats_airline,filter_name) VALUES (:owner_name,:cnt,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt";
1058 1058
 		} else {
1059 1059
 			$query = "UPDATE stats_owner SET cnt = cnt+:cnt WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_owner (owner_name,cnt,stats_airline,filter_name) SELECT :owner_name,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_owner WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1060 1060
 		}
1061
-                $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1061
+                $query_values = array(':owner_name' => $owner_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
1062 1062
                  try {
1063 1063
                         $sth = $this->db->prepare($query);
1064 1064
                         $sth->execute($query_values);
1065
-                } catch(PDOException $e) {
1065
+                } catch (PDOException $e) {
1066 1066
                         return "error : ".$e->getMessage();
1067 1067
                 }
1068 1068
         }
1069
-	public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '',$format_source = '') {
1069
+	public function addStatPilot($pilot_id, $cnt, $pilot_name, $stats_airline = '', $filter_name = '', $format_source = '') {
1070 1070
 		global $globalDBdriver;
1071 1071
 		if ($globalDBdriver == 'mysql') {
1072 1072
 			$query = "INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name,format_source) VALUES (:pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name,:format_source) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, pilot_name = :pilot_name";
1073 1073
 		} else {
1074 1074
 			$query = "UPDATE stats_pilot SET cnt = cnt+:cnt, pilot_name = :pilot_name WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source; INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name,format_source) SELECT :pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name,:format_source WHERE NOT EXISTS (SELECT 1 FROM stats_pilot WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source);"; 
1075 1075
 		}
1076
-                $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name,':format_source' => $format_source);
1076
+                $query_values = array(':pilot_id' => $pilot_id, ':cnt' => $cnt, ':pilot_name' => $pilot_name, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':format_source' => $format_source);
1077 1077
                  try {
1078 1078
                         $sth = $this->db->prepare($query);
1079 1079
                         $sth->execute($query_values);
1080
-                } catch(PDOException $e) {
1080
+                } catch (PDOException $e) {
1081 1081
                         return "error : ".$e->getMessage();
1082 1082
                 }
1083 1083
         }
1084
-	public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') {
1084
+	public function addStatDepartureAirports($airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') {
1085 1085
 		global $globalDBdriver;
1086 1086
 		if ($globalDBdriver == 'mysql') {
1087 1087
 			$query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:departure,'yearly',:date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE departure = departure+:departure";
1088 1088
 		} else {
1089 1089
 			$query = "UPDATE stats_airport SET departure = departure+:departure WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; 
1090 1090
 		}
1091
-                $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao,':filter_name' => $filter_name);
1091
+                $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':departure' => $departure, ':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1092 1092
                  try {
1093 1093
                         $sth = $this->db->prepare($query);
1094 1094
                         $sth->execute($query_values);
1095
-                } catch(PDOException $e) {
1095
+                } catch (PDOException $e) {
1096 1096
                         return "error : ".$e->getMessage();
1097 1097
                 }
1098 1098
         }
1099
-	public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') {
1099
+	public function addStatDepartureAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') {
1100 1100
 		global $globalDBdriver;
1101 1101
 		if ($globalDBdriver == 'mysql') {
1102 1102
 			$query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE departure = :departure";
1103 1103
 		} else {
1104 1104
 			$query = "UPDATE stats_airport SET departure = :departure WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1105 1105
 		}
1106
-                $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name);
1106
+                $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':departure' => $departure, ':date' => $date, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1107 1107
                  try {
1108 1108
                         $sth = $this->db->prepare($query);
1109 1109
                         $sth->execute($query_values);
1110
-                } catch(PDOException $e) {
1110
+                } catch (PDOException $e) {
1111 1111
                         return "error : ".$e->getMessage();
1112 1112
                 }
1113 1113
         }
1114
-	public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') {
1114
+	public function addStatArrivalAirports($airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') {
1115 1115
 		global $globalDBdriver;
1116 1116
 		if ($globalDBdriver == 'mysql') {
1117 1117
 			$query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE arrival = arrival+:arrival";
1118 1118
 		} else {
1119 1119
 			$query = "UPDATE stats_airport SET arrival = arrival+:arrival WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; 
1120 1120
 		}
1121
-                $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival,':date' => date('Y').'-01-01 00:00:00',':stats_airline' => $airline_icao,':filter_name' => $filter_name);
1121
+                $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':arrival' => $arrival, ':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1122 1122
                  try {
1123 1123
                         $sth = $this->db->prepare($query);
1124 1124
                         $sth->execute($query_values);
1125
-                } catch(PDOException $e) {
1125
+                } catch (PDOException $e) {
1126 1126
                         return "error : ".$e->getMessage();
1127 1127
                 }
1128 1128
         }
1129
-	public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') {
1129
+	public function addStatArrivalAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') {
1130 1130
 		global $globalDBdriver;
1131 1131
 		if ($globalDBdriver == 'mysql') {
1132 1132
 			$query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'daily',:date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE arrival = :arrival";
1133 1133
 		} else {
1134 1134
 			$query = "UPDATE stats_airport SET arrival = :arrival WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1135 1135
 		}
1136
-                $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival, ':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name);
1136
+                $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':arrival' => $arrival, ':date' => $date, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1137 1137
                  try {
1138 1138
                         $sth = $this->db->prepare($query);
1139 1139
                         $sth->execute($query_values);
1140
-                } catch(PDOException $e) {
1140
+                } catch (PDOException $e) {
1141 1141
                         return "error : ".$e->getMessage();
1142 1142
                 }
1143 1143
         }
@@ -1148,7 +1148,7 @@  discard block
 block discarded – undo
1148 1148
                  try {
1149 1149
                         $sth = $this->db->prepare($query);
1150 1150
                         $sth->execute($query_values);
1151
-                } catch(PDOException $e) {
1151
+                } catch (PDOException $e) {
1152 1152
                         return "error : ".$e->getMessage();
1153 1153
                 }
1154 1154
         }
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
                  try {
1159 1159
                         $sth = $this->db->prepare($query);
1160 1160
                         $sth->execute($query_values);
1161
-                } catch(PDOException $e) {
1161
+                } catch (PDOException $e) {
1162 1162
                         return "error : ".$e->getMessage();
1163 1163
                 }
1164 1164
         }
@@ -1168,13 +1168,13 @@  discard block
 block discarded – undo
1168 1168
                  try {
1169 1169
                         $sth = $this->db->prepare($query);
1170 1170
                         $sth->execute($query_values);
1171
-                } catch(PDOException $e) {
1171
+                } catch (PDOException $e) {
1172 1172
                         return "error : ".$e->getMessage();
1173 1173
                 }
1174 1174
         }
1175 1175
         
1176 1176
         public function addOldStats() {
1177
-    		global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats;
1177
+    		global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters, $globalDeleteLastYearStats;
1178 1178
     		$Common = new Common();
1179 1179
     		$Connection = new Connection();
1180 1180
     		date_default_timezone_set('UTC');
@@ -1407,40 +1407,40 @@  discard block
 block discarded – undo
1407 1407
 				$last_update_day = $last_update[0]['value'];
1408 1408
 			} else $last_update_day = '2012-12-12 12:12:12';
1409 1409
 			$Spotter = new Spotter($this->db);
1410
-			$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day);
1410
+			$alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day);
1411 1411
 			foreach ($alldata as $number) {
1412
-				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer']);
1412
+				$this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer']);
1413 1413
 			}
1414 1414
 			if ($globalDebug) echo 'Count all airlines...'."\n";
1415
-			$alldata = $Spotter->countAllAirlines(false,0,$last_update_day);
1415
+			$alldata = $Spotter->countAllAirlines(false, 0, $last_update_day);
1416 1416
 			foreach ($alldata as $number) {
1417
-				$this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name']);
1417
+				$this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name']);
1418 1418
 			}
1419 1419
 			if ($globalDebug) echo 'Count all registrations...'."\n";
1420
-			$alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day);
1420
+			$alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day);
1421 1421
 			foreach ($alldata as $number) {
1422
-				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao']);
1422
+				$this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao']);
1423 1423
 			}
1424 1424
 			if ($globalDebug) echo 'Count all callsigns...'."\n";
1425
-			$alldata = $Spotter->countAllCallsigns(false,0,$last_update_day);
1425
+			$alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day);
1426 1426
 			foreach ($alldata as $number) {
1427
-				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']);
1427
+				$this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao']);
1428 1428
 			}
1429 1429
 			if ($globalDebug) echo 'Count all owners...'."\n";
1430
-			$alldata = $Spotter->countAllOwners(false,0,$last_update_day);
1430
+			$alldata = $Spotter->countAllOwners(false, 0, $last_update_day);
1431 1431
 			foreach ($alldata as $number) {
1432
-				$this->addStatOwner($number['owner_name'],$number['owner_count']);
1432
+				$this->addStatOwner($number['owner_name'], $number['owner_count']);
1433 1433
 			}
1434 1434
 			if ($globalDebug) echo 'Count all pilots...'."\n";
1435
-			$alldata = $Spotter->countAllPilots(false,0,$last_update_day);
1435
+			$alldata = $Spotter->countAllPilots(false, 0, $last_update_day);
1436 1436
 			foreach ($alldata as $number) {
1437
-				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source']);
1437
+				$this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', '', $number['format_source']);
1438 1438
 			}
1439 1439
 			
1440 1440
 			if ($globalDebug) echo 'Count all departure airports...'."\n";
1441
-			$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day);
1441
+			$pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day);
1442 1442
 			if ($globalDebug) echo 'Count all detected departure airports...'."\n";
1443
-        		$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day);
1443
+        		$dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day);
1444 1444
 			if ($globalDebug) echo 'Order departure airports...'."\n";
1445 1445
 	        	$alldata = array();
1446 1446
 	        	
@@ -1458,14 +1458,14 @@  discard block
 block discarded – undo
1458 1458
     			foreach ($alldata as $key => $row) {
1459 1459
     				$count[$key] = $row['airport_departure_icao_count'];
1460 1460
         		}
1461
-			array_multisort($count,SORT_DESC,$alldata);
1461
+			array_multisort($count, SORT_DESC, $alldata);
1462 1462
 			foreach ($alldata as $number) {
1463
-				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count']);
1463
+				echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count']);
1464 1464
 			}
1465 1465
 			if ($globalDebug) echo 'Count all arrival airports...'."\n";
1466
-			$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day);
1466
+			$pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day);
1467 1467
 			if ($globalDebug) echo 'Count all detected arrival airports...'."\n";
1468
-        		$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day);
1468
+        		$dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day);
1469 1469
 			if ($globalDebug) echo 'Order arrival airports...'."\n";
1470 1470
 	        	$alldata = array();
1471 1471
     			foreach ($pall as $value) {
@@ -1482,16 +1482,16 @@  discard block
 block discarded – undo
1482 1482
         		foreach ($alldata as $key => $row) {
1483 1483
         			$count[$key] = $row['airport_arrival_icao_count'];
1484 1484
 	        	}
1485
-    			array_multisort($count,SORT_DESC,$alldata);
1485
+    			array_multisort($count, SORT_DESC, $alldata);
1486 1486
                         foreach ($alldata as $number) {
1487
-				echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count']);
1487
+				echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count']);
1488 1488
 			}
1489 1489
 			if ($Connection->tableExists('countries')) {
1490 1490
 				if ($globalDebug) echo 'Count all flights by countries...'."\n";
1491 1491
 				$SpotterArchive = new SpotterArchive();
1492
-				$alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day);
1492
+				$alldata = $SpotterArchive->countAllFlightOverCountries(false, 0, $last_update_day);
1493 1493
 				foreach ($alldata as $number) {
1494
-					$this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count']);
1494
+					$this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count']);
1495 1495
 				}
1496 1496
 			}
1497 1497
 			
@@ -1505,37 +1505,37 @@  discard block
 block discarded – undo
1505 1505
 			$lastyear = false;
1506 1506
 			foreach ($alldata as $number) {
1507 1507
 				if ($number['year_name'] != date('Y')) $lastyear = true;
1508
-				$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1508
+				$this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1509 1509
 			}
1510 1510
 			if ($globalDebug) echo 'Count all military flights by months...'."\n";
1511 1511
 			$alldata = $Spotter->countAllMilitaryMonths();
1512 1512
 			foreach ($alldata as $number) {
1513
-				$this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1513
+				$this->addStat('military_flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1514 1514
 			}
1515 1515
 			if ($globalDebug) echo 'Count all owners by months...'."\n";
1516 1516
 			$alldata = $Spotter->countAllMonthsOwners();
1517 1517
 			foreach ($alldata as $number) {
1518
-				$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1518
+				$this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1519 1519
 			}
1520 1520
 			if ($globalDebug) echo 'Count all pilots by months...'."\n";
1521 1521
 			$alldata = $Spotter->countAllMonthsPilots();
1522 1522
 			foreach ($alldata as $number) {
1523
-				$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1523
+				$this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1524 1524
 			}
1525 1525
 			if ($globalDebug) echo 'Count all airlines by months...'."\n";
1526 1526
 			$alldata = $Spotter->countAllMonthsAirlines();
1527 1527
 			foreach ($alldata as $number) {
1528
-				$this->addStat('airlines_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1528
+				$this->addStat('airlines_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1529 1529
 			}
1530 1530
 			if ($globalDebug) echo 'Count all aircrafts by months...'."\n";
1531 1531
 			$alldata = $Spotter->countAllMonthsAircrafts();
1532 1532
 			foreach ($alldata as $number) {
1533
-				$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1533
+				$this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1534 1534
 			}
1535 1535
 			if ($globalDebug) echo 'Count all real arrivals by months...'."\n";
1536 1536
 			$alldata = $Spotter->countAllMonthsRealArrivals();
1537 1537
 			foreach ($alldata as $number) {
1538
-				$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1538
+				$this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1539 1539
 			}
1540 1540
 			if ($globalDebug) echo 'Airports data...'."\n";
1541 1541
 			if ($globalDebug) echo '...Departure'."\n";
@@ -1580,7 +1580,7 @@  discard block
 block discarded – undo
1580 1580
     			}
1581 1581
     			$alldata = $pall;
1582 1582
 			foreach ($alldata as $number) {
1583
-				$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']);
1583
+				$this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count']);
1584 1584
 			}
1585 1585
 			echo '...Arrival'."\n";
1586 1586
 			$pall = $Spotter->getLast7DaysAirportsArrival();
@@ -1622,7 +1622,7 @@  discard block
 block discarded – undo
1622 1622
     			}
1623 1623
     			$alldata = $pall;
1624 1624
 			foreach ($alldata as $number) {
1625
-				$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']);
1625
+				$this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count']);
1626 1626
 			}
1627 1627
 
1628 1628
 			echo 'Flights data...'."\n";
@@ -1630,28 +1630,28 @@  discard block
 block discarded – undo
1630 1630
 			echo '-> countAllDatesLastMonth...'."\n";
1631 1631
 			$alldata = $Spotter->countAllDatesLastMonth();
1632 1632
 			foreach ($alldata as $number) {
1633
-				$this->addStatFlight('month',$number['date_name'],$number['date_count']);
1633
+				$this->addStatFlight('month', $number['date_name'], $number['date_count']);
1634 1634
 			}
1635 1635
 			echo '-> countAllDates...'."\n";
1636 1636
 			$previousdata = $this->countAllDates();
1637 1637
 			$previousdatabyairlines = $this->countAllDatesByAirlines();
1638 1638
 			$this->deleteStatFlight('date');
1639
-			$alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates());
1639
+			$alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates());
1640 1640
 			$values = array();
1641 1641
 			foreach ($alldata as $cnt) {
1642 1642
 				$values[] = $cnt['date_count'];
1643 1643
 			}
1644
-			array_multisort($values,SORT_DESC,$alldata);
1645
-			array_splice($alldata,11);
1644
+			array_multisort($values, SORT_DESC, $alldata);
1645
+			array_splice($alldata, 11);
1646 1646
 			foreach ($alldata as $number) {
1647
-				$this->addStatFlight('date',$number['date_name'],$number['date_count']);
1647
+				$this->addStatFlight('date', $number['date_name'], $number['date_count']);
1648 1648
 			}
1649 1649
 			
1650 1650
 			$this->deleteStatFlight('hour');
1651 1651
 			echo '-> countAllHours...'."\n";
1652 1652
 			$alldata = $Spotter->countAllHours('hour');
1653 1653
 			foreach ($alldata as $number) {
1654
-				$this->addStatFlight('hour',$number['hour_name'],$number['hour_count']);
1654
+				$this->addStatFlight('hour', $number['hour_name'], $number['hour_count']);
1655 1655
 			}
1656 1656
 
1657 1657
 
@@ -1660,34 +1660,34 @@  discard block
 block discarded – undo
1660 1660
 			echo '--- Stats by airlines ---'."\n";
1661 1661
 			if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n";
1662 1662
 			$Spotter = new Spotter($this->db);
1663
-			$alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day);
1663
+			$alldata = $Spotter->countAllAircraftTypesByAirlines(false, 0, $last_update_day);
1664 1664
 			foreach ($alldata as $number) {
1665
-				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao']);
1665
+				$this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], $number['airline_icao']);
1666 1666
 			}
1667 1667
 			if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n";
1668
-			$alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day);
1668
+			$alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false, 0, $last_update_day);
1669 1669
 			foreach ($alldata as $number) {
1670
-				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao']);
1670
+				$this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], $number['airline_icao']);
1671 1671
 			}
1672 1672
 			if ($globalDebug) echo 'Count all callsigns by airlines...'."\n";
1673
-			$alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day);
1673
+			$alldata = $Spotter->countAllCallsignsByAirlines(false, 0, $last_update_day);
1674 1674
 			foreach ($alldata as $number) {
1675
-				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']);
1675
+				$this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao']);
1676 1676
 			}
1677 1677
 			if ($globalDebug) echo 'Count all owners by airlines...'."\n";
1678
-			$alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day);
1678
+			$alldata = $Spotter->countAllOwnersByAirlines(false, 0, $last_update_day);
1679 1679
 			foreach ($alldata as $number) {
1680
-				$this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao']);
1680
+				$this->addStatOwner($number['owner_name'], $number['owner_count'], $number['airline_icao']);
1681 1681
 			}
1682 1682
 			if ($globalDebug) echo 'Count all pilots by airlines...'."\n";
1683
-			$alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day);
1683
+			$alldata = $Spotter->countAllPilotsByAirlines(false, 0, $last_update_day);
1684 1684
 			foreach ($alldata as $number) {
1685
-				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source']);
1685
+				$this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], $number['airline_icao'], '', $number['format_source']);
1686 1686
 			}
1687 1687
 			if ($globalDebug) echo 'Count all departure airports by airlines...'."\n";
1688
-			$pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day);
1688
+			$pall = $Spotter->countAllDepartureAirportsByAirlines(false, 0, $last_update_day);
1689 1689
 			if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n";
1690
-       			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day);
1690
+       			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false, 0, $last_update_day);
1691 1691
 			if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n";
1692 1692
 	        	//$alldata = array();
1693 1693
     			foreach ($dall as $value) {
@@ -1707,12 +1707,12 @@  discard block
 block discarded – undo
1707 1707
     			}
1708 1708
     			$alldata = $pall;
1709 1709
 			foreach ($alldata as $number) {
1710
-				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao']);
1710
+				echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], $number['airline_icao']);
1711 1711
 			}
1712 1712
 			if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n";
1713
-			$pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day);
1713
+			$pall = $Spotter->countAllArrivalAirportsByAirlines(false, 0, $last_update_day);
1714 1714
 			if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n";
1715
-        		$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day);
1715
+        		$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false, 0, $last_update_day);
1716 1716
 			if ($globalDebug) echo 'Order arrival airports by airlines...'."\n";
1717 1717
 	        	//$alldata = array();
1718 1718
     			foreach ($dall as $value) {
@@ -1732,7 +1732,7 @@  discard block
 block discarded – undo
1732 1732
     			}
1733 1733
     			$alldata = $pall;
1734 1734
                         foreach ($alldata as $number) {
1735
-				if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao']);
1735
+				if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], $number['airline_icao']);
1736 1736
 			}
1737 1737
 			if ($globalDebug) echo 'Count all flights by months by airlines...'."\n";
1738 1738
 			$Spotter = new Spotter($this->db);
@@ -1740,27 +1740,27 @@  discard block
 block discarded – undo
1740 1740
 			$lastyear = false;
1741 1741
 			foreach ($alldata as $number) {
1742 1742
 				if ($number['year_name'] != date('Y')) $lastyear = true;
1743
-				$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1743
+				$this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
1744 1744
 			}
1745 1745
 			if ($globalDebug) echo 'Count all owners by months by airlines...'."\n";
1746 1746
 			$alldata = $Spotter->countAllMonthsOwnersByAirlines();
1747 1747
 			foreach ($alldata as $number) {
1748
-				$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1748
+				$this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
1749 1749
 			}
1750 1750
 			if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n";
1751 1751
 			$alldata = $Spotter->countAllMonthsPilotsByAirlines();
1752 1752
 			foreach ($alldata as $number) {
1753
-				$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1753
+				$this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
1754 1754
 			}
1755 1755
 			if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n";
1756 1756
 			$alldata = $Spotter->countAllMonthsAircraftsByAirlines();
1757 1757
 			foreach ($alldata as $number) {
1758
-				$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1758
+				$this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
1759 1759
 			}
1760 1760
 			if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n";
1761 1761
 			$alldata = $Spotter->countAllMonthsRealArrivalsByAirlines();
1762 1762
 			foreach ($alldata as $number) {
1763
-				$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1763
+				$this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
1764 1764
 			}
1765 1765
 			if ($globalDebug) echo '...Departure'."\n";
1766 1766
 			$pall = $Spotter->getLast7DaysAirportsDepartureByAirlines();
@@ -1783,7 +1783,7 @@  discard block
 block discarded – undo
1783 1783
     			}
1784 1784
     			$alldata = $pall;
1785 1785
 			foreach ($alldata as $number) {
1786
-				$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']);
1786
+				$this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count'], $number['airline_icao']);
1787 1787
 			}
1788 1788
 			if ($globalDebug) echo '...Arrival'."\n";
1789 1789
 			$pall = $Spotter->getLast7DaysAirportsArrivalByAirlines();
@@ -1806,32 +1806,32 @@  discard block
 block discarded – undo
1806 1806
     			}
1807 1807
     			$alldata = $pall;
1808 1808
 			foreach ($alldata as $number) {
1809
-				$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']);
1809
+				$this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count'], $number['airline_icao']);
1810 1810
 			}
1811 1811
 
1812 1812
 			if ($globalDebug) echo 'Flights data...'."\n";
1813 1813
 			if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n";
1814 1814
 			$alldata = $Spotter->countAllDatesLastMonthByAirlines();
1815 1815
 			foreach ($alldata as $number) {
1816
-				$this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']);
1816
+				$this->addStatFlight('month', $number['date_name'], $number['date_count'], $number['airline_icao']);
1817 1817
 			}
1818 1818
 			if ($globalDebug) echo '-> countAllDates...'."\n";
1819 1819
 			//$previousdata = $this->countAllDatesByAirlines();
1820
-			$alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines());
1820
+			$alldata = $Common->array_merge_noappend($previousdatabyairlines, $Spotter->countAllDatesByAirlines());
1821 1821
 			$values = array();
1822 1822
 			foreach ($alldata as $cnt) {
1823 1823
 				$values[] = $cnt['date_count'];
1824 1824
 			}
1825
-			array_multisort($values,SORT_DESC,$alldata);
1826
-			array_splice($alldata,11);
1825
+			array_multisort($values, SORT_DESC, $alldata);
1826
+			array_splice($alldata, 11);
1827 1827
 			foreach ($alldata as $number) {
1828
-				$this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']);
1828
+				$this->addStatFlight('date', $number['date_name'], $number['date_count'], $number['airline_icao']);
1829 1829
 			}
1830 1830
 			
1831 1831
 			if ($globalDebug) echo '-> countAllHours...'."\n";
1832 1832
 			$alldata = $Spotter->countAllHoursByAirlines('hour');
1833 1833
 			foreach ($alldata as $number) {
1834
-				$this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']);
1834
+				$this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], $number['airline_icao']);
1835 1835
 			}
1836 1836
 			
1837 1837
 
@@ -1848,32 +1848,32 @@  discard block
 block discarded – undo
1848 1848
 				// Count by filter
1849 1849
 				if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n";
1850 1850
 				$Spotter = new Spotter($this->db);
1851
-				$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter);
1851
+				$alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day, $filter);
1852 1852
 				foreach ($alldata as $number) {
1853
-					$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'',$filter_name);
1853
+					$this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', $filter_name);
1854 1854
 				}
1855
-				$alldata = $Spotter->countAllAirlines(false,0,$last_update_day,$filter);
1855
+				$alldata = $Spotter->countAllAirlines(false, 0, $last_update_day, $filter);
1856 1856
 				foreach ($alldata as $number) {
1857
-					$this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],$filter_name);
1857
+					$this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], $filter_name);
1858 1858
 				}
1859
-				$alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day,$filter);
1859
+				$alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day, $filter);
1860 1860
 				foreach ($alldata as $number) {
1861
-					$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'',$filter_name);
1861
+					$this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', $filter_name);
1862 1862
 				}
1863
-				$alldata = $Spotter->countAllCallsigns(false,0,$last_update_day,$filter);
1863
+				$alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day, $filter);
1864 1864
 				foreach ($alldata as $number) {
1865
-					$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],'',$filter_name);
1865
+					$this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], '', $filter_name);
1866 1866
 				}
1867
-				$alldata = $Spotter->countAllOwners(false,0,$last_update_day,$filter);
1867
+				$alldata = $Spotter->countAllOwners(false, 0, $last_update_day, $filter);
1868 1868
 				foreach ($alldata as $number) {
1869
-					$this->addStatOwner($number['owner_name'],$number['owner_count'],'',$filter_name);
1869
+					$this->addStatOwner($number['owner_name'], $number['owner_count'], '', $filter_name);
1870 1870
 				}
1871
-				$alldata = $Spotter->countAllPilots(false,0,$last_update_day,$filter);
1871
+				$alldata = $Spotter->countAllPilots(false, 0, $last_update_day, $filter);
1872 1872
 				foreach ($alldata as $number) {
1873
-					$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name,$number['format_source']);
1873
+					$this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', $filter_name, $number['format_source']);
1874 1874
 				}
1875
-				$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter);
1876
-	       			$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter);
1875
+				$pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day, $filter);
1876
+	       			$dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day, $filter);
1877 1877
 		        	$alldata = array();
1878 1878
 	    			foreach ($pall as $value) {
1879 1879
 		        		$icao = $value['airport_departure_icao'];
@@ -1889,12 +1889,12 @@  discard block
 block discarded – undo
1889 1889
     				foreach ($alldata as $key => $row) {
1890 1890
     					$count[$key] = $row['airport_departure_icao_count'];
1891 1891
     				}
1892
-				array_multisort($count,SORT_DESC,$alldata);
1892
+				array_multisort($count, SORT_DESC, $alldata);
1893 1893
 				foreach ($alldata as $number) {
1894
-    					echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'',$filter_name);
1894
+    					echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], '', $filter_name);
1895 1895
 				}
1896
-				$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,false,$filter);
1897
-    				$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter);
1896
+				$pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day, false, $filter);
1897
+    				$dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day, false, $filter);
1898 1898
 				$alldata = array();
1899 1899
     				foreach ($pall as $value) {
1900 1900
 		        		$icao = $value['airport_arrival_icao'];
@@ -1910,40 +1910,40 @@  discard block
 block discarded – undo
1910 1910
         			foreach ($alldata as $key => $row) {
1911 1911
     					$count[$key] = $row['airport_arrival_icao_count'];
1912 1912
 		        	}
1913
-        			array_multisort($count,SORT_DESC,$alldata);
1913
+        			array_multisort($count, SORT_DESC, $alldata);
1914 1914
 				foreach ($alldata as $number) {
1915
-					echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'',$filter_name);
1915
+					echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], '', $filter_name);
1916 1916
 				}
1917 1917
 				$Spotter = new Spotter($this->db);
1918 1918
 				$alldata = $Spotter->countAllMonths($filter);
1919 1919
 				$lastyear = false;
1920 1920
 				foreach ($alldata as $number) {
1921 1921
 					if ($number['year_name'] != date('Y')) $lastyear = true;
1922
-					$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1922
+					$this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
1923 1923
 				}
1924 1924
 				$alldata = $Spotter->countAllMonthsOwners($filter);
1925 1925
 				foreach ($alldata as $number) {
1926
-					$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1926
+					$this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
1927 1927
 				}
1928 1928
 				$alldata = $Spotter->countAllMonthsPilots($filter);
1929 1929
 				foreach ($alldata as $number) {
1930
-					$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1930
+					$this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
1931 1931
 				}
1932 1932
 				$alldata = $Spotter->countAllMilitaryMonths($filter);
1933 1933
 				foreach ($alldata as $number) {
1934
-					$this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1934
+					$this->addStat('military_flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
1935 1935
 				}
1936 1936
 				$alldata = $Spotter->countAllMonthsAircrafts($filter);
1937 1937
 				foreach ($alldata as $number) {
1938
-					$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1938
+					$this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
1939 1939
 				}
1940 1940
 				$alldata = $Spotter->countAllMonthsRealArrivals($filter);
1941 1941
 				foreach ($alldata as $number) {
1942
-					$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1942
+					$this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
1943 1943
 				}
1944 1944
 				echo '...Departure'."\n";
1945
-				$pall = $Spotter->getLast7DaysAirportsDeparture('',$filter);
1946
-        			$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter);
1945
+				$pall = $Spotter->getLast7DaysAirportsDeparture('', $filter);
1946
+        			$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('', $filter);
1947 1947
 				foreach ($dall as $value) {
1948 1948
     					$icao = $value['departure_airport_icao'];
1949 1949
     					$ddate = $value['date'];
@@ -1961,11 +1961,11 @@  discard block
 block discarded – undo
1961 1961
     				}
1962 1962
 	    			$alldata = $pall;
1963 1963
 				foreach ($alldata as $number) {
1964
-					$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],'',$filter_name);
1964
+					$this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count'], '', $filter_name);
1965 1965
 				}
1966 1966
 				echo '...Arrival'."\n";
1967
-				$pall = $Spotter->getLast7DaysAirportsArrival('',$filter);
1968
-    				$dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter);
1967
+				$pall = $Spotter->getLast7DaysAirportsArrival('', $filter);
1968
+    				$dall = $Spotter->getLast7DaysDetectedAirportsArrival('', $filter);
1969 1969
 				foreach ($dall as $value) {
1970 1970
 					$icao = $value['arrival_airport_icao'];
1971 1971
 					$ddate = $value['date'];
@@ -1983,40 +1983,40 @@  discard block
 block discarded – undo
1983 1983
     				}
1984 1984
     				$alldata = $pall;
1985 1985
 				foreach ($alldata as $number) {
1986
-					$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],'',$filter_name);
1986
+					$this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count'], '', $filter_name);
1987 1987
 				}
1988 1988
     
1989 1989
 				echo 'Flights data...'."\n";
1990 1990
 				echo '-> countAllDatesLastMonth...'."\n";
1991 1991
 				$alldata = $Spotter->countAllDatesLastMonth($filter);
1992 1992
 				foreach ($alldata as $number) {
1993
-					$this->addStatFlight('month',$number['date_name'],$number['date_count'], '',$filter_name);
1993
+					$this->addStatFlight('month', $number['date_name'], $number['date_count'], '', $filter_name);
1994 1994
 				}
1995 1995
 				echo '-> countAllDates...'."\n";
1996
-				$previousdata = $this->countAllDates('',$filter_name);
1997
-				$alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter));
1996
+				$previousdata = $this->countAllDates('', $filter_name);
1997
+				$alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter));
1998 1998
 				$values = array();
1999 1999
 				foreach ($alldata as $cnt) {
2000 2000
 					$values[] = $cnt['date_count'];
2001 2001
 				}
2002
-				array_multisort($values,SORT_DESC,$alldata);
2003
-				array_splice($alldata,11);
2002
+				array_multisort($values, SORT_DESC, $alldata);
2003
+				array_splice($alldata, 11);
2004 2004
 				foreach ($alldata as $number) {
2005
-					$this->addStatFlight('date',$number['date_name'],$number['date_count'],'',$filter_name);
2005
+					$this->addStatFlight('date', $number['date_name'], $number['date_count'], '', $filter_name);
2006 2006
 				}
2007 2007
 				
2008 2008
 				echo '-> countAllHours...'."\n";
2009
-				$alldata = $Spotter->countAllHours('hour',$filter);
2009
+				$alldata = $Spotter->countAllHours('hour', $filter);
2010 2010
 				foreach ($alldata as $number) {
2011
-					$this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],'',$filter_name);
2011
+					$this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], '', $filter_name);
2012 2012
 				}
2013 2013
 				echo 'Insert last stats update date...'."\n";
2014 2014
 				date_default_timezone_set('UTC');
2015
-				$this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y-m-d G:i:s'));
2015
+				$this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y-m-d G:i:s'));
2016 2016
 				if (isset($filter['DeleteLastYearStats']) && $filter['DeleteLastYearStats'] == true) {
2017
-					if (date('Y',strtotime($last_update_day)) != date('Y')) {
2017
+					if (date('Y', strtotime($last_update_day)) != date('Y')) {
2018 2018
 						$this->deleteOldStats($filter_name);
2019
-						$this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y').'-01-01 00:00:00');
2019
+						$this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y').'-01-01 00:00:00');
2020 2020
 					}
2021 2021
 				}
2022 2022
 
@@ -2029,16 +2029,16 @@  discard block
 block discarded – undo
2029 2029
 				// SUM all previous month to put as year
2030 2030
 				$previous_year = date('Y');
2031 2031
 				$previous_year--;
2032
-				$this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
2033
-				$this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
2034
-				$this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
2035
-				$this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
2032
+				$this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
2033
+				$this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
2034
+				$this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
2035
+				$this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
2036 2036
 				$allairlines = $this->getAllAirlineNames();
2037 2037
 				foreach ($allairlines as $data) {
2038
-					$this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
2039
-					$this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
2040
-					$this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
2041
-					$this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
2038
+					$this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
2039
+					$this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
2040
+					$this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
2041
+					$this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
2042 2042
 				}
2043 2043
 				
2044 2044
 				if (isset($globalArchiveYear) && $globalArchiveYear) {
@@ -2047,7 +2047,7 @@  discard block
 block discarded – undo
2047 2047
 						try {
2048 2048
 							$sth = $this->db->prepare($query);
2049 2049
 							$sth->execute();
2050
-						} catch(PDOException $e) {
2050
+						} catch (PDOException $e) {
2051 2051
 							return "error : ".$e->getMessage().' - query : '.$query."\n";
2052 2052
 						}
2053 2053
 					}
@@ -2056,15 +2056,15 @@  discard block
 block discarded – undo
2056 2056
 					try {
2057 2057
 						$sth = $this->db->prepare($query);
2058 2058
 						$sth->execute();
2059
-					} catch(PDOException $e) {
2059
+					} catch (PDOException $e) {
2060 2060
 						return "error : ".$e->getMessage().' - query : '.$query."\n";
2061 2061
 					}
2062 2062
 				}
2063 2063
 				if (isset($globalDeleteLastYearStats) && $globalDeleteLastYearStats) {
2064 2064
 					$last_update = $this->getLastStatsUpdate('last_update_stats');
2065
-					if (date('Y',strtotime($last_update[0]['value'])) != date('Y')) {
2065
+					if (date('Y', strtotime($last_update[0]['value'])) != date('Y')) {
2066 2066
 						$this->deleteOldStats();
2067
-						$this->addLastStatsUpdate('last_update_stats',date('Y').'-01-01 00:00:00');
2067
+						$this->addLastStatsUpdate('last_update_stats', date('Y').'-01-01 00:00:00');
2068 2068
 						$lastyearupdate = true;
2069 2069
 					}
2070 2070
 				}
@@ -2086,7 +2086,7 @@  discard block
 block discarded – undo
2086 2086
 					try {
2087 2087
 						$sth = $this->db->prepare($query);
2088 2088
 						$sth->execute();
2089
-					} catch(PDOException $e) {
2089
+					} catch (PDOException $e) {
2090 2090
 						return "error : ".$e->getMessage();
2091 2091
 					}
2092 2092
 				}
@@ -2100,14 +2100,14 @@  discard block
 block discarded – undo
2100 2100
 				try {
2101 2101
 					$sth = $this->db->prepare($query);
2102 2102
 					$sth->execute();
2103
-				} catch(PDOException $e) {
2103
+				} catch (PDOException $e) {
2104 2104
 					return "error : ".$e->getMessage();
2105 2105
 				}
2106 2106
 			}
2107 2107
 			if (!isset($lastyearupdate)) {
2108 2108
 				echo 'Insert last stats update date...'."\n";
2109 2109
 				date_default_timezone_set('UTC');
2110
-				$this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s'));
2110
+				$this->addLastStatsUpdate('last_update_stats', date('Y-m-d G:i:s'));
2111 2111
 			}
2112 2112
 		//}
2113 2113
 	}
Please login to merge, or discard this patch.
Braces   +389 added lines, -135 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@  discard block
 block discarded – undo
12 12
 	
13 13
 	public function __construct($dbc = null) {
14 14
 		global $globalFilterName;
15
-		if (isset($globalFilterName)) $this->filter_name = $globalFilterName;
15
+		if (isset($globalFilterName)) {
16
+			$this->filter_name = $globalFilterName;
17
+		}
16 18
 		$Connection = new Connection($dbc);
17 19
 		$this->db = $Connection->db();
18 20
         }
@@ -77,7 +79,9 @@  discard block
 block discarded – undo
77 79
                 }
78 80
         }
79 81
 	public function getAllAirlineNames($filter_name = '') {
80
-		if ($filter_name == '') $filter_name = $this->filter_name;
82
+		if ($filter_name == '') {
83
+			$filter_name = $this->filter_name;
84
+		}
81 85
                 $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC";
82 86
                  try {
83 87
                         $sth = $this->db->prepare($query);
@@ -89,7 +93,9 @@  discard block
 block discarded – undo
89 93
                 return $all;
90 94
         }
91 95
 	public function getAllAircraftTypes($stats_airline = '',$filter_name = '') {
92
-		if ($filter_name == '') $filter_name = $this->filter_name;
96
+		if ($filter_name == '') {
97
+			$filter_name = $this->filter_name;
98
+		}
93 99
                 $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
94 100
                  try {
95 101
                         $sth = $this->db->prepare($query);
@@ -101,7 +107,9 @@  discard block
 block discarded – undo
101 107
                 return $all;
102 108
         }
103 109
 	public function getAllManufacturers($stats_airline = '',$filter_name = '') {
104
-		if ($filter_name == '') $filter_name = $this->filter_name;
110
+		if ($filter_name == '') {
111
+			$filter_name = $this->filter_name;
112
+		}
105 113
                 $query = "SELECT DISTINCT(aircraft_manufacturer) FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND aircraft_manufacturer <> '' ORDER BY aircraft_manufacturer ASC";
106 114
                  try {
107 115
                         $sth = $this->db->prepare($query);
@@ -113,7 +121,9 @@  discard block
 block discarded – undo
113 121
                 return $all;
114 122
         }
115 123
 	public function getAllAirportNames($stats_airline = '',$filter_name = '') {
116
-		if ($filter_name == '') $filter_name = $this->filter_name;
124
+		if ($filter_name == '') {
125
+			$filter_name = $this->filter_name;
126
+		}
117 127
                 $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC";
118 128
                  try {
119 129
                         $sth = $this->db->prepare($query);
@@ -128,9 +138,14 @@  discard block
 block discarded – undo
128 138
 
129 139
 	public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '') {
130 140
 		global $globalStatsFilters;
131
-		if ($filter_name == '') $filter_name = $this->filter_name;
132
-		if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0";
133
-		else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC";
141
+		if ($filter_name == '') {
142
+			$filter_name = $this->filter_name;
143
+		}
144
+		if ($limit) {
145
+			$query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0";
146
+		} else {
147
+			$query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC";
148
+		}
134 149
                  try {
135 150
                         $sth = $this->db->prepare($query);
136 151
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -150,9 +165,14 @@  discard block
 block discarded – undo
150 165
 	}
151 166
 	public function countAllAirlineCountries($limit = true,$filter_name = '') {
152 167
 		global $globalStatsFilters;
153
-		if ($filter_name == '') $filter_name = $this->filter_name;
154
-		if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0";
155
-		else $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC";
168
+		if ($filter_name == '') {
169
+			$filter_name = $this->filter_name;
170
+		}
171
+		if ($limit) {
172
+			$query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0";
173
+		} else {
174
+			$query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC";
175
+		}
156 176
                  try {
157 177
                         $sth = $this->db->prepare($query);
158 178
                         $sth->execute(array(':filter_name' => $filter_name));
@@ -172,9 +192,14 @@  discard block
 block discarded – undo
172 192
 	}
173 193
 	public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '') {
174 194
 		global $globalStatsFilters;
175
-		if ($filter_name == '') $filter_name = $this->filter_name;
176
-		if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0";
177
-		else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC";
195
+		if ($filter_name == '') {
196
+			$filter_name = $this->filter_name;
197
+		}
198
+		if ($limit) {
199
+			$query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0";
200
+		} else {
201
+			$query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC";
202
+		}
178 203
                  try {
179 204
                         $sth = $this->db->prepare($query);
180 205
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -195,9 +220,14 @@  discard block
 block discarded – undo
195 220
 
196 221
 	public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '') {
197 222
 		global $globalStatsFilters;
198
-		if ($filter_name == '') $filter_name = $this->filter_name;
199
-		if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0";
200
-		else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC";
223
+		if ($filter_name == '') {
224
+			$filter_name = $this->filter_name;
225
+		}
226
+		if ($limit) {
227
+			$query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0";
228
+		} else {
229
+			$query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC";
230
+		}
201 231
                  try {
202 232
                         $sth = $this->db->prepare($query);
203 233
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -217,9 +247,14 @@  discard block
 block discarded – undo
217 247
 	}
218 248
 	public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '') {
219 249
 		global $globalStatsFilters;
220
-		if ($filter_name == '') $filter_name = $this->filter_name;
221
-		if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
222
-		else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC";
250
+		if ($filter_name == '') {
251
+			$filter_name = $this->filter_name;
252
+		}
253
+		if ($limit) {
254
+			$query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
255
+		} else {
256
+			$query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC";
257
+		}
223 258
                  try {
224 259
                         $sth = $this->db->prepare($query);
225 260
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -240,9 +275,14 @@  discard block
 block discarded – undo
240 275
 
241 276
 	public function countAllAirlines($limit = true,$filter_name = '') {
242 277
 		global $globalStatsFilters;
243
-		if ($filter_name == '') $filter_name = $this->filter_name;
244
-		if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
245
-		else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC";
278
+		if ($filter_name == '') {
279
+			$filter_name = $this->filter_name;
280
+		}
281
+		if ($limit) {
282
+			$query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
283
+		} else {
284
+			$query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC";
285
+		}
246 286
                  try {
247 287
                         $sth = $this->db->prepare($query);
248 288
                         $sth->execute(array(':filter_name' => $filter_name));
@@ -263,9 +303,14 @@  discard block
 block discarded – undo
263 303
 	}
264 304
 	public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '') {
265 305
 		global $globalStatsFilters;
266
-		if ($filter_name == '') $filter_name = $this->filter_name;
267
-		if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0";
268
-		else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC";
306
+		if ($filter_name == '') {
307
+			$filter_name = $this->filter_name;
308
+		}
309
+		if ($limit) {
310
+			$query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0";
311
+		} else {
312
+			$query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC";
313
+		}
269 314
                  try {
270 315
                         $sth = $this->db->prepare($query);
271 316
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -285,9 +330,14 @@  discard block
 block discarded – undo
285 330
 	}
286 331
 	public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '') {
287 332
 		global $globalStatsFilters;
288
-		if ($filter_name == '') $filter_name = $this->filter_name;
289
-		if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0";
290
-		else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC";
333
+		if ($filter_name == '') {
334
+			$filter_name = $this->filter_name;
335
+		}
336
+		if ($limit) {
337
+			$query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0";
338
+		} else {
339
+			$query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC";
340
+		}
291 341
 		 try {
292 342
 			$sth = $this->db->prepare($query);
293 343
 			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -307,10 +357,15 @@  discard block
 block discarded – undo
307 357
 	}
308 358
 	public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '') {
309 359
 		$Connection = new Connection();
310
-		if ($filter_name == '') $filter_name = $this->filter_name;
360
+		if ($filter_name == '') {
361
+			$filter_name = $this->filter_name;
362
+		}
311 363
 		if ($Connection->tableExists('countries')) {
312
-			if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0";
313
-			else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC";
364
+			if ($limit) {
365
+				$query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0";
366
+			} else {
367
+				$query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC";
368
+			}
314 369
 			 try {
315 370
 				$sth = $this->db->prepare($query);
316 371
 				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -331,9 +386,14 @@  discard block
 block discarded – undo
331 386
 	}
332 387
 	public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '') {
333 388
 		global $globalStatsFilters;
334
-		if ($filter_name == '') $filter_name = $this->filter_name;
335
-		if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0";
336
-		else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC";
389
+		if ($filter_name == '') {
390
+			$filter_name = $this->filter_name;
391
+		}
392
+		if ($limit) {
393
+			$query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0";
394
+		} else {
395
+			$query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC";
396
+		}
337 397
                  try {
338 398
                         $sth = $this->db->prepare($query);
339 399
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -353,9 +413,14 @@  discard block
 block discarded – undo
353 413
 	}
354 414
 	public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '') {
355 415
 		global $globalStatsFilters;
356
-		if ($filter_name == '') $filter_name = $this->filter_name;
357
-		if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0";
358
-		else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC";
416
+		if ($filter_name == '') {
417
+			$filter_name = $this->filter_name;
418
+		}
419
+		if ($limit) {
420
+			$query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0";
421
+		} else {
422
+			$query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC";
423
+		}
359 424
                  try {
360 425
                         $sth = $this->db->prepare($query);
361 426
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -375,9 +440,14 @@  discard block
 block discarded – undo
375 440
 	}
376 441
 	public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '') {
377 442
 		global $globalStatsFilters;
378
-		if ($filter_name == '') $filter_name = $this->filter_name;
379
-		if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
380
-		else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
443
+		if ($filter_name == '') {
444
+			$filter_name = $this->filter_name;
445
+		}
446
+		if ($limit) {
447
+			$query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
448
+		} else {
449
+			$query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
450
+		}
381 451
                  try {
382 452
                         $sth = $this->db->prepare($query);
383 453
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -403,7 +473,9 @@  discard block
 block discarded – undo
403 473
         			$icao = $value['airport_departure_icao'];
404 474
         			if (isset($all[$icao])) {
405 475
         				$all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
406
-        			} else $all[$icao] = $value;
476
+        			} else {
477
+        				$all[$icao] = $value;
478
+        			}
407 479
         		}
408 480
         		$count = array();
409 481
         		foreach ($all as $key => $row) {
@@ -415,9 +487,14 @@  discard block
 block discarded – undo
415 487
 	}
416 488
 	public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '') {
417 489
 		global $globalStatsFilters;
418
-		if ($filter_name == '') $filter_name = $this->filter_name;
419
-		if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0";
420
-		else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
490
+		if ($filter_name == '') {
491
+			$filter_name = $this->filter_name;
492
+		}
493
+		if ($limit) {
494
+			$query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0";
495
+		} else {
496
+			$query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
497
+		}
421 498
 		try {
422 499
 			$sth = $this->db->prepare($query);
423 500
 			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -443,7 +520,9 @@  discard block
 block discarded – undo
443 520
         			$icao = $value['airport_arrival_icao'];
444 521
         			if (isset($all[$icao])) {
445 522
         				$all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
446
-        			} else $all[$icao] = $value;
523
+        			} else {
524
+        				$all[$icao] = $value;
525
+        			}
447 526
         		}
448 527
         		$count = array();
449 528
         		foreach ($all as $key => $row) {
@@ -456,13 +535,21 @@  discard block
 block discarded – undo
456 535
 	}
457 536
 	public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') {
458 537
 		global $globalDBdriver, $globalStatsFilters;
459
-		if ($filter_name == '') $filter_name = $this->filter_name;
538
+		if ($filter_name == '') {
539
+			$filter_name = $this->filter_name;
540
+		}
460 541
 		if ($globalDBdriver == 'mysql') {
461
-			if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
462
-			else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
542
+			if ($limit) {
543
+				$query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
544
+			} else {
545
+				$query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
546
+			}
463 547
 		} else {
464
-			if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
465
-			else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
548
+			if ($limit) {
549
+				$query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
550
+			} else {
551
+				$query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
552
+			}
466 553
 		}
467 554
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
468 555
                  try {
@@ -486,7 +573,9 @@  discard block
 block discarded – undo
486 573
 	
487 574
 	public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') {
488 575
 		global $globalStatsFilters;
489
-		if ($filter_name == '') $filter_name = $this->filter_name;
576
+		if ($filter_name == '') {
577
+			$filter_name = $this->filter_name;
578
+		}
490 579
 		$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name";
491 580
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
492 581
                  try {
@@ -508,7 +597,9 @@  discard block
 block discarded – undo
508 597
 	}
509 598
 	public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') {
510 599
 		global $globalDBdriver, $globalStatsFilters;
511
-		if ($filter_name == '') $filter_name = $this->filter_name;
600
+		if ($filter_name == '') {
601
+			$filter_name = $this->filter_name;
602
+		}
512 603
 		if ($globalDBdriver == 'mysql') {
513 604
 			$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND stats_airline = :stats_airline AND filter_name = :filter_name";
514 605
 		} else {
@@ -534,7 +625,9 @@  discard block
 block discarded – undo
534 625
 	}
535 626
 	public function countAllDates($stats_airline = '',$filter_name = '') {
536 627
 		global $globalStatsFilters;
537
-		if ($filter_name == '') $filter_name = $this->filter_name;
628
+		if ($filter_name == '') {
629
+			$filter_name = $this->filter_name;
630
+		}
538 631
 		$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name";
539 632
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
540 633
                  try {
@@ -556,7 +649,9 @@  discard block
 block discarded – undo
556 649
 	}
557 650
 	public function countAllDatesByAirlines($filter_name = '') {
558 651
 		global $globalStatsFilters;
559
-		if ($filter_name == '') $filter_name = $this->filter_name;
652
+		if ($filter_name == '') {
653
+			$filter_name = $this->filter_name;
654
+		}
560 655
 		$query = "SELECT stats_airline as airline_icao, flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND filter_name = :filter_name";
561 656
 		$query_data = array('filter_name' => $filter_name);
562 657
                  try {
@@ -578,7 +673,9 @@  discard block
 block discarded – undo
578 673
 	}
579 674
 	public function countAllMonths($stats_airline = '',$filter_name = '') {
580 675
 		global $globalStatsFilters;
581
-		if ($filter_name == '') $filter_name = $this->filter_name;
676
+		if ($filter_name == '') {
677
+			$filter_name = $this->filter_name;
678
+		}
582 679
 	    	$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
583 680
                  try {
584 681
                         $sth = $this->db->prepare($query);
@@ -599,7 +696,9 @@  discard block
 block discarded – undo
599 696
 	}
600 697
 	public function countAllMilitaryMonths($filter_name = '') {
601 698
 		global $globalStatsFilters;
602
-		if ($filter_name == '') $filter_name = $this->filter_name;
699
+		if ($filter_name == '') {
700
+			$filter_name = $this->filter_name;
701
+		}
603 702
 	    	$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name";
604 703
                  try {
605 704
                         $sth = $this->db->prepare($query);
@@ -620,9 +719,14 @@  discard block
 block discarded – undo
620 719
 	}
621 720
 	public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') {
622 721
 		global $globalTimezone, $globalDBdriver, $globalStatsFilters;
623
-		if ($filter_name == '') $filter_name = $this->filter_name;
624
-		if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
625
-		else $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
722
+		if ($filter_name == '') {
723
+			$filter_name = $this->filter_name;
724
+		}
725
+		if ($limit) {
726
+			$query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
727
+		} else {
728
+			$query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
729
+		}
626 730
 		if ($orderby == 'hour') {
627 731
 			/*
628 732
 			if ($globalDBdriver == 'mysql') {
@@ -631,7 +735,9 @@  discard block
 block discarded – undo
631 735
 			*/
632 736
 			$query .= " ORDER BY CAST(flight_date AS integer) ASC";
633 737
 		}
634
-		if ($orderby == 'count') $query .= " ORDER BY hour_count DESC";
738
+		if ($orderby == 'count') {
739
+			$query .= " ORDER BY hour_count DESC";
740
+		}
635 741
                  try {
636 742
                         $sth = $this->db->prepare($query);
637 743
                         $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
@@ -652,7 +758,9 @@  discard block
 block discarded – undo
652 758
 	
653 759
 	public function countOverallFlights($stats_airline = '', $filter_name = '') {
654 760
 		global $globalStatsFilters;
655
-		if ($filter_name == '') $filter_name = $this->filter_name;
761
+		if ($filter_name == '') {
762
+			$filter_name = $this->filter_name;
763
+		}
656 764
 		$all = $this->getSumStats('flights_bymonth',date('Y'),$stats_airline,$filter_name);
657 765
 		if (empty($all)) {
658 766
 			$filters = array('airlines' => array($stats_airline));
@@ -666,7 +774,9 @@  discard block
 block discarded – undo
666 774
 	}
667 775
 	public function countOverallMilitaryFlights($filter_name = '') {
668 776
 		global $globalStatsFilters;
669
-		if ($filter_name == '') $filter_name = $this->filter_name;
777
+		if ($filter_name == '') {
778
+			$filter_name = $this->filter_name;
779
+		}
670 780
 		$all = $this->getSumStats('military_flights_bymonth',date('Y'),'',$filter_name);
671 781
 		if (empty($all)) {
672 782
 		        $filters = array();
@@ -680,7 +790,9 @@  discard block
 block discarded – undo
680 790
 	}
681 791
 	public function countOverallArrival($stats_airline = '',$filter_name = '') {
682 792
 		global $globalStatsFilters;
683
-		if ($filter_name == '') $filter_name = $this->filter_name;
793
+		if ($filter_name == '') {
794
+			$filter_name = $this->filter_name;
795
+		}
684 796
 		$all = $this->getSumStats('realarrivals_bymonth',date('Y'),$stats_airline,$filter_name);
685 797
 		if (empty($all)) {
686 798
 			$filters = array('airlines' => array($stats_airline));
@@ -694,7 +806,9 @@  discard block
 block discarded – undo
694 806
 	}
695 807
 	public function countOverallAircrafts($stats_airline = '',$filter_name = '') {
696 808
 		global $globalStatsFilters;
697
-		if ($filter_name == '') $filter_name = $this->filter_name;
809
+		if ($filter_name == '') {
810
+			$filter_name = $this->filter_name;
811
+		}
698 812
 		$all = $this->getSumStats('aircrafts_bymonth',date('Y'),$stats_airline,$filter_name);
699 813
 		if (empty($all)) {
700 814
 			$filters = array('airlines' => array($stats_airline));
@@ -708,7 +822,9 @@  discard block
 block discarded – undo
708 822
 	}
709 823
 	public function countOverallAirlines($filter_name = '') {
710 824
 		global $globalStatsFilters;
711
-		if ($filter_name == '') $filter_name = $this->filter_name;
825
+		if ($filter_name == '') {
826
+			$filter_name = $this->filter_name;
827
+		}
712 828
 		$query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name";
713 829
                  try {
714 830
                         $sth = $this->db->prepare($query);
@@ -731,7 +847,9 @@  discard block
 block discarded – undo
731 847
 	}
732 848
 	public function countOverallOwners($stats_airline = '',$filter_name = '') {
733 849
 		global $globalStatsFilters;
734
-		if ($filter_name == '') $filter_name = $this->filter_name;
850
+		if ($filter_name == '') {
851
+			$filter_name = $this->filter_name;
852
+		}
735 853
 		/*
736 854
 		$query = "SELECT COUNT(*) AS nb_owner FROM stats_owner";
737 855
                  try {
@@ -756,7 +874,9 @@  discard block
 block discarded – undo
756 874
 	}
757 875
 	public function countOverallPilots($stats_airline = '',$filter_name = '') {
758 876
 		global $globalStatsFilters;
759
-		if ($filter_name == '') $filter_name = $this->filter_name;
877
+		if ($filter_name == '') {
878
+			$filter_name = $this->filter_name;
879
+		}
760 880
 		$all = $this->getSumStats('pilots_bymonth',date('Y'),$stats_airline,$filter_name);
761 881
 		if (empty($all)) {
762 882
 			$filters = array('airlines' => array($stats_airline));
@@ -770,7 +890,9 @@  discard block
 block discarded – undo
770 890
 	}
771 891
 
772 892
 	public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') {
773
-		if ($filter_name == '') $filter_name = $this->filter_name;
893
+		if ($filter_name == '') {
894
+			$filter_name = $this->filter_name;
895
+		}
774 896
 		$query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date";
775 897
 		$query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
776 898
                  try {
@@ -783,7 +905,9 @@  discard block
 block discarded – undo
783 905
                 return $all;
784 906
 	}
785 907
 	public function getStats($type,$stats_airline = '', $filter_name = '') {
786
-		if ($filter_name == '') $filter_name = $this->filter_name;
908
+		if ($filter_name == '') {
909
+			$filter_name = $this->filter_name;
910
+		}
787 911
                 $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date";
788 912
                 $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
789 913
                  try {
@@ -796,7 +920,9 @@  discard block
 block discarded – undo
796 920
                 return $all;
797 921
         }
798 922
 	public function getSumStats($type,$year,$stats_airline = '',$filter_name = '') {
799
-		if ($filter_name == '') $filter_name = $this->filter_name;
923
+		if ($filter_name == '') {
924
+			$filter_name = $this->filter_name;
925
+		}
800 926
     		global $globalArchiveMonths, $globalDBdriver;
801 927
     		if ($globalDBdriver == 'mysql') {
802 928
 	                $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name";
@@ -815,7 +941,9 @@  discard block
 block discarded – undo
815 941
         }
816 942
 	public function getStatsTotal($type, $stats_airline = '', $filter_name = '') {
817 943
     		global $globalArchiveMonths, $globalDBdriver;
818
-		if ($filter_name == '') $filter_name = $this->filter_name;
944
+		if ($filter_name == '') {
945
+			$filter_name = $this->filter_name;
946
+		}
819 947
     		if ($globalDBdriver == 'mysql') {
820 948
 			$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
821 949
 		} else {
@@ -833,7 +961,9 @@  discard block
 block discarded – undo
833 961
         }
834 962
 	public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') {
835 963
     		global $globalArchiveMonths, $globalDBdriver;
836
-		if ($filter_name == '') $filter_name = $this->filter_name;
964
+		if ($filter_name == '') {
965
+			$filter_name = $this->filter_name;
966
+		}
837 967
     		if ($globalDBdriver == 'mysql') {
838 968
 			$query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name";
839 969
                 } else {
@@ -850,7 +980,9 @@  discard block
 block discarded – undo
850 980
         }
851 981
 	public function getStatsAirlineTotal($filter_name = '') {
852 982
     		global $globalArchiveMonths, $globalDBdriver;
853
-		if ($filter_name == '') $filter_name = $this->filter_name;
983
+		if ($filter_name == '') {
984
+			$filter_name = $this->filter_name;
985
+		}
854 986
     		if ($globalDBdriver == 'mysql') {
855 987
 			$query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name";
856 988
                 } else {
@@ -867,7 +999,9 @@  discard block
 block discarded – undo
867 999
         }
868 1000
 	public function getStatsOwnerTotal($filter_name = '') {
869 1001
     		global $globalArchiveMonths, $globalDBdriver;
870
-		if ($filter_name == '') $filter_name = $this->filter_name;
1002
+		if ($filter_name == '') {
1003
+			$filter_name = $this->filter_name;
1004
+		}
871 1005
     		if ($globalDBdriver == 'mysql') {
872 1006
 			$query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name";
873 1007
 		} else {
@@ -884,7 +1018,9 @@  discard block
 block discarded – undo
884 1018
         }
885 1019
 	public function getStatsPilotTotal($filter_name = '') {
886 1020
     		global $globalArchiveMonths, $globalDBdriver;
887
-		if ($filter_name == '') $filter_name = $this->filter_name;
1021
+		if ($filter_name == '') {
1022
+			$filter_name = $this->filter_name;
1023
+		}
888 1024
     		if ($globalDBdriver == 'mysql') {
889 1025
             		$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
890 1026
             	} else {
@@ -902,7 +1038,9 @@  discard block
 block discarded – undo
902 1038
 
903 1039
 	public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
904 1040
 		global $globalDBdriver;
905
-		if ($filter_name == '') $filter_name = $this->filter_name;
1041
+		if ($filter_name == '') {
1042
+			$filter_name = $this->filter_name;
1043
+		}
906 1044
 		if ($globalDBdriver == 'mysql') {
907 1045
 			$query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = :cnt";
908 1046
                 } else {
@@ -918,7 +1056,9 @@  discard block
 block discarded – undo
918 1056
         }
919 1057
 	public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
920 1058
 		global $globalDBdriver;
921
-		if ($filter_name == '') $filter_name = $this->filter_name;
1059
+		if ($filter_name == '') {
1060
+			$filter_name = $this->filter_name;
1061
+		}
922 1062
 		if ($globalDBdriver == 'mysql') {
923 1063
 			$query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date";
924 1064
 		} else {
@@ -1401,47 +1541,69 @@  discard block
 block discarded – undo
1401 1541
 			$this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s'));
1402 1542
 		} else {
1403 1543
 		*/
1404
-			if ($globalDebug) echo 'Update stats !'."\n";
1405
-			if ($globalDebug) echo 'Count all aircraft types...'."\n";
1544
+			if ($globalDebug) {
1545
+				echo 'Update stats !'."\n";
1546
+			}
1547
+			if ($globalDebug) {
1548
+				echo 'Count all aircraft types...'."\n";
1549
+			}
1406 1550
 			if (isset($last_update[0]['value'])) {
1407 1551
 				$last_update_day = $last_update[0]['value'];
1408
-			} else $last_update_day = '2012-12-12 12:12:12';
1552
+			} else {
1553
+				$last_update_day = '2012-12-12 12:12:12';
1554
+			}
1409 1555
 			$Spotter = new Spotter($this->db);
1410 1556
 			$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day);
1411 1557
 			foreach ($alldata as $number) {
1412 1558
 				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer']);
1413 1559
 			}
1414
-			if ($globalDebug) echo 'Count all airlines...'."\n";
1560
+			if ($globalDebug) {
1561
+				echo 'Count all airlines...'."\n";
1562
+			}
1415 1563
 			$alldata = $Spotter->countAllAirlines(false,0,$last_update_day);
1416 1564
 			foreach ($alldata as $number) {
1417 1565
 				$this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name']);
1418 1566
 			}
1419
-			if ($globalDebug) echo 'Count all registrations...'."\n";
1567
+			if ($globalDebug) {
1568
+				echo 'Count all registrations...'."\n";
1569
+			}
1420 1570
 			$alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day);
1421 1571
 			foreach ($alldata as $number) {
1422 1572
 				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao']);
1423 1573
 			}
1424
-			if ($globalDebug) echo 'Count all callsigns...'."\n";
1574
+			if ($globalDebug) {
1575
+				echo 'Count all callsigns...'."\n";
1576
+			}
1425 1577
 			$alldata = $Spotter->countAllCallsigns(false,0,$last_update_day);
1426 1578
 			foreach ($alldata as $number) {
1427 1579
 				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']);
1428 1580
 			}
1429
-			if ($globalDebug) echo 'Count all owners...'."\n";
1581
+			if ($globalDebug) {
1582
+				echo 'Count all owners...'."\n";
1583
+			}
1430 1584
 			$alldata = $Spotter->countAllOwners(false,0,$last_update_day);
1431 1585
 			foreach ($alldata as $number) {
1432 1586
 				$this->addStatOwner($number['owner_name'],$number['owner_count']);
1433 1587
 			}
1434
-			if ($globalDebug) echo 'Count all pilots...'."\n";
1588
+			if ($globalDebug) {
1589
+				echo 'Count all pilots...'."\n";
1590
+			}
1435 1591
 			$alldata = $Spotter->countAllPilots(false,0,$last_update_day);
1436 1592
 			foreach ($alldata as $number) {
1437 1593
 				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source']);
1438 1594
 			}
1439 1595
 			
1440
-			if ($globalDebug) echo 'Count all departure airports...'."\n";
1596
+			if ($globalDebug) {
1597
+				echo 'Count all departure airports...'."\n";
1598
+			}
1441 1599
 			$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day);
1442
-			if ($globalDebug) echo 'Count all detected departure airports...'."\n";
1600
+			if ($globalDebug) {
1601
+				echo 'Count all detected departure airports...'."\n";
1602
+			}
1443 1603
         		$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day);
1444
-			if ($globalDebug) echo 'Order departure airports...'."\n";
1604
+			if ($globalDebug) {
1605
+				echo 'Order departure airports...'."\n";
1606
+			}
1445 1607
 	        	$alldata = array();
1446 1608
 	        	
1447 1609
     			foreach ($pall as $value) {
@@ -1452,7 +1614,9 @@  discard block
 block discarded – undo
1452 1614
     				$icao = $value['airport_departure_icao'];
1453 1615
         			if (isset($alldata[$icao])) {
1454 1616
     					$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1455
-        			} else $alldata[$icao] = $value;
1617
+        			} else {
1618
+        				$alldata[$icao] = $value;
1619
+        			}
1456 1620
 			}
1457 1621
     			$count = array();
1458 1622
     			foreach ($alldata as $key => $row) {
@@ -1462,11 +1626,17 @@  discard block
 block discarded – undo
1462 1626
 			foreach ($alldata as $number) {
1463 1627
 				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count']);
1464 1628
 			}
1465
-			if ($globalDebug) echo 'Count all arrival airports...'."\n";
1629
+			if ($globalDebug) {
1630
+				echo 'Count all arrival airports...'."\n";
1631
+			}
1466 1632
 			$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day);
1467
-			if ($globalDebug) echo 'Count all detected arrival airports...'."\n";
1633
+			if ($globalDebug) {
1634
+				echo 'Count all detected arrival airports...'."\n";
1635
+			}
1468 1636
         		$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day);
1469
-			if ($globalDebug) echo 'Order arrival airports...'."\n";
1637
+			if ($globalDebug) {
1638
+				echo 'Order arrival airports...'."\n";
1639
+			}
1470 1640
 	        	$alldata = array();
1471 1641
     			foreach ($pall as $value) {
1472 1642
 	        		$icao = $value['airport_arrival_icao'];
@@ -1476,7 +1646,9 @@  discard block
 block discarded – undo
1476 1646
     				$icao = $value['airport_arrival_icao'];
1477 1647
         			if (isset($alldata[$icao])) {
1478 1648
         				$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1479
-	        		} else $alldata[$icao] = $value;
1649
+	        		} else {
1650
+	        			$alldata[$icao] = $value;
1651
+	        		}
1480 1652
     			}
1481 1653
         		$count = array();
1482 1654
         		foreach ($alldata as $key => $row) {
@@ -1487,7 +1659,9 @@  discard block
 block discarded – undo
1487 1659
 				echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count']);
1488 1660
 			}
1489 1661
 			if ($Connection->tableExists('countries')) {
1490
-				if ($globalDebug) echo 'Count all flights by countries...'."\n";
1662
+				if ($globalDebug) {
1663
+					echo 'Count all flights by countries...'."\n";
1664
+				}
1491 1665
 				$SpotterArchive = new SpotterArchive();
1492 1666
 				$alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day);
1493 1667
 				foreach ($alldata as $number) {
@@ -1499,46 +1673,66 @@  discard block
 block discarded – undo
1499 1673
 			// Add by month using getstat if month finish...
1500 1674
 
1501 1675
 			//if (date('m',strtotime($last_update_day)) != date('m')) {
1502
-			if ($globalDebug) echo 'Count all flights by months...'."\n";
1676
+			if ($globalDebug) {
1677
+				echo 'Count all flights by months...'."\n";
1678
+			}
1503 1679
 			$Spotter = new Spotter($this->db);
1504 1680
 			$alldata = $Spotter->countAllMonths();
1505 1681
 			$lastyear = false;
1506 1682
 			foreach ($alldata as $number) {
1507
-				if ($number['year_name'] != date('Y')) $lastyear = true;
1683
+				if ($number['year_name'] != date('Y')) {
1684
+					$lastyear = true;
1685
+				}
1508 1686
 				$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1509 1687
 			}
1510
-			if ($globalDebug) echo 'Count all military flights by months...'."\n";
1688
+			if ($globalDebug) {
1689
+				echo 'Count all military flights by months...'."\n";
1690
+			}
1511 1691
 			$alldata = $Spotter->countAllMilitaryMonths();
1512 1692
 			foreach ($alldata as $number) {
1513 1693
 				$this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1514 1694
 			}
1515
-			if ($globalDebug) echo 'Count all owners by months...'."\n";
1695
+			if ($globalDebug) {
1696
+				echo 'Count all owners by months...'."\n";
1697
+			}
1516 1698
 			$alldata = $Spotter->countAllMonthsOwners();
1517 1699
 			foreach ($alldata as $number) {
1518 1700
 				$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1519 1701
 			}
1520
-			if ($globalDebug) echo 'Count all pilots by months...'."\n";
1702
+			if ($globalDebug) {
1703
+				echo 'Count all pilots by months...'."\n";
1704
+			}
1521 1705
 			$alldata = $Spotter->countAllMonthsPilots();
1522 1706
 			foreach ($alldata as $number) {
1523 1707
 				$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1524 1708
 			}
1525
-			if ($globalDebug) echo 'Count all airlines by months...'."\n";
1709
+			if ($globalDebug) {
1710
+				echo 'Count all airlines by months...'."\n";
1711
+			}
1526 1712
 			$alldata = $Spotter->countAllMonthsAirlines();
1527 1713
 			foreach ($alldata as $number) {
1528 1714
 				$this->addStat('airlines_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1529 1715
 			}
1530
-			if ($globalDebug) echo 'Count all aircrafts by months...'."\n";
1716
+			if ($globalDebug) {
1717
+				echo 'Count all aircrafts by months...'."\n";
1718
+			}
1531 1719
 			$alldata = $Spotter->countAllMonthsAircrafts();
1532 1720
 			foreach ($alldata as $number) {
1533 1721
 				$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1534 1722
 			}
1535
-			if ($globalDebug) echo 'Count all real arrivals by months...'."\n";
1723
+			if ($globalDebug) {
1724
+				echo 'Count all real arrivals by months...'."\n";
1725
+			}
1536 1726
 			$alldata = $Spotter->countAllMonthsRealArrivals();
1537 1727
 			foreach ($alldata as $number) {
1538 1728
 				$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1539 1729
 			}
1540
-			if ($globalDebug) echo 'Airports data...'."\n";
1541
-			if ($globalDebug) echo '...Departure'."\n";
1730
+			if ($globalDebug) {
1731
+				echo 'Airports data...'."\n";
1732
+			}
1733
+			if ($globalDebug) {
1734
+				echo '...Departure'."\n";
1735
+			}
1542 1736
 			$this->deleteStatAirport('daily');
1543 1737
 //			$pall = $Spotter->getLast7DaysAirportsDeparture();
1544 1738
   //      		$dall = $Spotter->getLast7DaysDetectedAirportsDeparture();
@@ -1658,37 +1852,53 @@  discard block
 block discarded – undo
1658 1852
 
1659 1853
 			// Count by airlines
1660 1854
 			echo '--- Stats by airlines ---'."\n";
1661
-			if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n";
1855
+			if ($globalDebug) {
1856
+				echo 'Count all aircraft types by airlines...'."\n";
1857
+			}
1662 1858
 			$Spotter = new Spotter($this->db);
1663 1859
 			$alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day);
1664 1860
 			foreach ($alldata as $number) {
1665 1861
 				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao']);
1666 1862
 			}
1667
-			if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n";
1863
+			if ($globalDebug) {
1864
+				echo 'Count all aircraft registrations by airlines...'."\n";
1865
+			}
1668 1866
 			$alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day);
1669 1867
 			foreach ($alldata as $number) {
1670 1868
 				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao']);
1671 1869
 			}
1672
-			if ($globalDebug) echo 'Count all callsigns by airlines...'."\n";
1870
+			if ($globalDebug) {
1871
+				echo 'Count all callsigns by airlines...'."\n";
1872
+			}
1673 1873
 			$alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day);
1674 1874
 			foreach ($alldata as $number) {
1675 1875
 				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']);
1676 1876
 			}
1677
-			if ($globalDebug) echo 'Count all owners by airlines...'."\n";
1877
+			if ($globalDebug) {
1878
+				echo 'Count all owners by airlines...'."\n";
1879
+			}
1678 1880
 			$alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day);
1679 1881
 			foreach ($alldata as $number) {
1680 1882
 				$this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao']);
1681 1883
 			}
1682
-			if ($globalDebug) echo 'Count all pilots by airlines...'."\n";
1884
+			if ($globalDebug) {
1885
+				echo 'Count all pilots by airlines...'."\n";
1886
+			}
1683 1887
 			$alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day);
1684 1888
 			foreach ($alldata as $number) {
1685 1889
 				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source']);
1686 1890
 			}
1687
-			if ($globalDebug) echo 'Count all departure airports by airlines...'."\n";
1891
+			if ($globalDebug) {
1892
+				echo 'Count all departure airports by airlines...'."\n";
1893
+			}
1688 1894
 			$pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day);
1689
-			if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n";
1895
+			if ($globalDebug) {
1896
+				echo 'Count all detected departure airports by airlines...'."\n";
1897
+			}
1690 1898
        			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day);
1691
-			if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n";
1899
+			if ($globalDebug) {
1900
+				echo 'Order detected departure airports by airlines...'."\n";
1901
+			}
1692 1902
 	        	//$alldata = array();
1693 1903
     			foreach ($dall as $value) {
1694 1904
     				$icao = $value['airport_departure_icao'];
@@ -1709,11 +1919,17 @@  discard block
 block discarded – undo
1709 1919
 			foreach ($alldata as $number) {
1710 1920
 				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao']);
1711 1921
 			}
1712
-			if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n";
1922
+			if ($globalDebug) {
1923
+				echo 'Count all arrival airports by airlines...'."\n";
1924
+			}
1713 1925
 			$pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day);
1714
-			if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n";
1926
+			if ($globalDebug) {
1927
+				echo 'Count all detected arrival airports by airlines...'."\n";
1928
+			}
1715 1929
         		$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day);
1716
-			if ($globalDebug) echo 'Order arrival airports by airlines...'."\n";
1930
+			if ($globalDebug) {
1931
+				echo 'Order arrival airports by airlines...'."\n";
1932
+			}
1717 1933
 	        	//$alldata = array();
1718 1934
     			foreach ($dall as $value) {
1719 1935
     				$icao = $value['airport_arrival_icao'];
@@ -1732,37 +1948,53 @@  discard block
 block discarded – undo
1732 1948
     			}
1733 1949
     			$alldata = $pall;
1734 1950
                         foreach ($alldata as $number) {
1735
-				if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao']);
1951
+				if ($number['airline_icao'] != '') {
1952
+					echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao']);
1953
+				}
1954
+			}
1955
+			if ($globalDebug) {
1956
+				echo 'Count all flights by months by airlines...'."\n";
1736 1957
 			}
1737
-			if ($globalDebug) echo 'Count all flights by months by airlines...'."\n";
1738 1958
 			$Spotter = new Spotter($this->db);
1739 1959
 			$alldata = $Spotter->countAllMonthsByAirlines();
1740 1960
 			$lastyear = false;
1741 1961
 			foreach ($alldata as $number) {
1742
-				if ($number['year_name'] != date('Y')) $lastyear = true;
1962
+				if ($number['year_name'] != date('Y')) {
1963
+					$lastyear = true;
1964
+				}
1743 1965
 				$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1744 1966
 			}
1745
-			if ($globalDebug) echo 'Count all owners by months by airlines...'."\n";
1967
+			if ($globalDebug) {
1968
+				echo 'Count all owners by months by airlines...'."\n";
1969
+			}
1746 1970
 			$alldata = $Spotter->countAllMonthsOwnersByAirlines();
1747 1971
 			foreach ($alldata as $number) {
1748 1972
 				$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1749 1973
 			}
1750
-			if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n";
1974
+			if ($globalDebug) {
1975
+				echo 'Count all pilots by months by airlines...'."\n";
1976
+			}
1751 1977
 			$alldata = $Spotter->countAllMonthsPilotsByAirlines();
1752 1978
 			foreach ($alldata as $number) {
1753 1979
 				$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1754 1980
 			}
1755
-			if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n";
1981
+			if ($globalDebug) {
1982
+				echo 'Count all aircrafts by months by airlines...'."\n";
1983
+			}
1756 1984
 			$alldata = $Spotter->countAllMonthsAircraftsByAirlines();
1757 1985
 			foreach ($alldata as $number) {
1758 1986
 				$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1759 1987
 			}
1760
-			if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n";
1988
+			if ($globalDebug) {
1989
+				echo 'Count all real arrivals by months by airlines...'."\n";
1990
+			}
1761 1991
 			$alldata = $Spotter->countAllMonthsRealArrivalsByAirlines();
1762 1992
 			foreach ($alldata as $number) {
1763 1993
 				$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1764 1994
 			}
1765
-			if ($globalDebug) echo '...Departure'."\n";
1995
+			if ($globalDebug) {
1996
+				echo '...Departure'."\n";
1997
+			}
1766 1998
 			$pall = $Spotter->getLast7DaysAirportsDepartureByAirlines();
1767 1999
         		$dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines();
1768 2000
     			foreach ($dall as $value) {
@@ -1785,7 +2017,9 @@  discard block
 block discarded – undo
1785 2017
 			foreach ($alldata as $number) {
1786 2018
 				$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']);
1787 2019
 			}
1788
-			if ($globalDebug) echo '...Arrival'."\n";
2020
+			if ($globalDebug) {
2021
+				echo '...Arrival'."\n";
2022
+			}
1789 2023
 			$pall = $Spotter->getLast7DaysAirportsArrivalByAirlines();
1790 2024
         		$dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines();
1791 2025
     			foreach ($dall as $value) {
@@ -1809,13 +2043,19 @@  discard block
 block discarded – undo
1809 2043
 				$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']);
1810 2044
 			}
1811 2045
 
1812
-			if ($globalDebug) echo 'Flights data...'."\n";
1813
-			if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n";
2046
+			if ($globalDebug) {
2047
+				echo 'Flights data...'."\n";
2048
+			}
2049
+			if ($globalDebug) {
2050
+				echo '-> countAllDatesLastMonth...'."\n";
2051
+			}
1814 2052
 			$alldata = $Spotter->countAllDatesLastMonthByAirlines();
1815 2053
 			foreach ($alldata as $number) {
1816 2054
 				$this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']);
1817 2055
 			}
1818
-			if ($globalDebug) echo '-> countAllDates...'."\n";
2056
+			if ($globalDebug) {
2057
+				echo '-> countAllDates...'."\n";
2058
+			}
1819 2059
 			//$previousdata = $this->countAllDatesByAirlines();
1820 2060
 			$alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines());
1821 2061
 			$values = array();
@@ -1828,14 +2068,18 @@  discard block
 block discarded – undo
1828 2068
 				$this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']);
1829 2069
 			}
1830 2070
 			
1831
-			if ($globalDebug) echo '-> countAllHours...'."\n";
2071
+			if ($globalDebug) {
2072
+				echo '-> countAllHours...'."\n";
2073
+			}
1832 2074
 			$alldata = $Spotter->countAllHoursByAirlines('hour');
1833 2075
 			foreach ($alldata as $number) {
1834 2076
 				$this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']);
1835 2077
 			}
1836 2078
 			
1837 2079
 
1838
-			if (!isset($globalStatsFilters) || $globalStatsFilters == '') $globalStatsFilters = array();
2080
+			if (!isset($globalStatsFilters) || $globalStatsFilters == '') {
2081
+				$globalStatsFilters = array();
2082
+			}
1839 2083
 			foreach ($globalStatsFilters as $name => $filter) {
1840 2084
 				//$filter_name = $filter['name'];
1841 2085
 				$filter_name = $name;
@@ -1843,10 +2087,14 @@  discard block
 block discarded – undo
1843 2087
 				$last_update = $this->getLastStatsUpdate('last_update_stats_'.$filter_name);
1844 2088
 				if (isset($last_update[0]['value'])) {
1845 2089
 					$last_update_day = $last_update[0]['value'];
1846
-				} else $last_update_day = '2012-12-12 12:12:12';
2090
+				} else {
2091
+					$last_update_day = '2012-12-12 12:12:12';
2092
+				}
1847 2093
 
1848 2094
 				// Count by filter
1849
-				if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n";
2095
+				if ($globalDebug) {
2096
+					echo '--- Stats for filter '.$filter_name.' ---'."\n";
2097
+				}
1850 2098
 				$Spotter = new Spotter($this->db);
1851 2099
 				$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter);
1852 2100
 				foreach ($alldata as $number) {
@@ -1883,7 +2131,9 @@  discard block
 block discarded – undo
1883 2131
 	    				$icao = $value['airport_departure_icao'];
1884 2132
         				if (isset($alldata[$icao])) {
1885 2133
     						$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1886
-        				} else $alldata[$icao] = $value;
2134
+        				} else {
2135
+        					$alldata[$icao] = $value;
2136
+        				}
1887 2137
 				}
1888 2138
 	    			$count = array();
1889 2139
     				foreach ($alldata as $key => $row) {
@@ -1904,7 +2154,9 @@  discard block
 block discarded – undo
1904 2154
 	    				$icao = $value['airport_arrival_icao'];
1905 2155
         				if (isset($alldata[$icao])) {
1906 2156
         					$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1907
-		        		} else $alldata[$icao] = $value;
2157
+		        		} else {
2158
+		        			$alldata[$icao] = $value;
2159
+		        		}
1908 2160
 	    			}
1909 2161
         			$count = array();
1910 2162
         			foreach ($alldata as $key => $row) {
@@ -1918,7 +2170,9 @@  discard block
 block discarded – undo
1918 2170
 				$alldata = $Spotter->countAllMonths($filter);
1919 2171
 				$lastyear = false;
1920 2172
 				foreach ($alldata as $number) {
1921
-					if ($number['year_name'] != date('Y')) $lastyear = true;
2173
+					if ($number['year_name'] != date('Y')) {
2174
+						$lastyear = true;
2175
+					}
1922 2176
 					$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1923 2177
 				}
1924 2178
 				$alldata = $Spotter->countAllMonthsOwners($filter);
Please login to merge, or discard this patch.
require/class.Spotter.php 1 patch
Indentation   +1293 added lines, -1293 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 	}
14 14
 
15 15
 	/**
16
-	* Get SQL query part for filter used
17
-	* @param Array $filter the filter
18
-	* @return Array the SQL part
19
-	*/
16
+	 * Get SQL query part for filter used
17
+	 * @param Array $filter the filter
18
+	 * @return Array the SQL part
19
+	 */
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
22 22
 		$filters = array();
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
 	}
85 85
 
86 86
 	/**
87
-	* Executes the SQL statements to get the spotter information
88
-	*
89
-	* @param String $query the SQL query
90
-	* @param Array $params parameter of the query
91
-	* @param String $limitQuery the limit query
92
-	* @return Array the spotter information
93
-	*
94
-	*/
87
+	 * Executes the SQL statements to get the spotter information
88
+	 *
89
+	 * @param String $query the SQL query
90
+	 * @param Array $params parameter of the query
91
+	 * @param String $limitQuery the limit query
92
+	 * @return Array the spotter information
93
+	 *
94
+	 */
95 95
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
96 96
 	{
97 97
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
@@ -255,11 +255,11 @@  discard block
 block discarded – undo
255 255
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
256 256
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
257 257
 					} else $temp_array['aircraft_shadow'] = 'default.png';
258
-                                } else {
259
-                            		$temp_array['aircraft_shadow'] = 'default.png';
258
+								} else {
259
+									$temp_array['aircraft_shadow'] = 'default.png';
260 260
 					$temp_array['aircraft_name'] = 'N/A';
261 261
 					$temp_array['aircraft_manufacturer'] = 'N/A';
262
-                            	}
262
+								}
263 263
 			}
264 264
 			$fromsource = NULL;
265 265
 			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
@@ -455,11 +455,11 @@  discard block
 block discarded – undo
455 455
 	
456 456
 	
457 457
 	/**
458
-	* Gets all the spotter information
459
-	*
460
-	* @return Array the spotter information
461
-	*
462
-	*/
458
+	 * Gets all the spotter information
459
+	 *
460
+	 * @return Array the spotter information
461
+	 *
462
+	 */
463 463
 	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
464 464
 	{
465 465
 		global $globalTimezone, $globalDBdriver;
@@ -806,11 +806,11 @@  discard block
 block discarded – undo
806 806
 	
807 807
 	
808 808
 	/**
809
-	* Gets all the spotter information based on the latest data entry
810
-	*
811
-	* @return Array the spotter information
812
-	*
813
-	*/
809
+	 * Gets all the spotter information based on the latest data entry
810
+	 *
811
+	 * @return Array the spotter information
812
+	 *
813
+	 */
814 814
 	public function getLatestSpotterData($limit = '', $sort = '', $filter = array())
815 815
 	{
816 816
 		global $global_query;
@@ -849,12 +849,12 @@  discard block
 block discarded – undo
849 849
 	}
850 850
     
851 851
     
852
-    /**
853
-	* Gets all the spotter information based on a user's latitude and longitude
854
-	*
855
-	* @return Array the spotter information
856
-	*
857
-	*/
852
+	/**
853
+	 * Gets all the spotter information based on a user's latitude and longitude
854
+	 *
855
+	 * @return Array the spotter information
856
+	 *
857
+	 */
858 858
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
859 859
 	{
860 860
 		date_default_timezone_set('UTC');
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
 				return false;
883 883
 			}
884 884
 		}
885
-    		$additional_query = '';
885
+			$additional_query = '';
886 886
 		if ($interval != "")
887 887
 		{
888 888
 			if (!is_string($interval))
@@ -922,12 +922,12 @@  discard block
 block discarded – undo
922 922
 	}
923 923
     
924 924
     
925
-    /**
926
-	* Gets all the spotter information sorted by the newest aircraft type
927
-	*
928
-	* @return Array the spotter information
929
-	*
930
-	*/
925
+	/**
926
+	 * Gets all the spotter information sorted by the newest aircraft type
927
+	 *
928
+	 * @return Array the spotter information
929
+	 *
930
+	 */
931 931
 	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
932 932
 	{
933 933
 		global $global_query;
@@ -968,11 +968,11 @@  discard block
 block discarded – undo
968 968
     
969 969
     
970 970
 	/**
971
-	* Gets all the spotter information sorted by the newest aircraft registration
972
-	*
973
-	* @return Array the spotter information
974
-	*
975
-	*/
971
+	 * Gets all the spotter information sorted by the newest aircraft registration
972
+	 *
973
+	 * @return Array the spotter information
974
+	 *
975
+	 */
976 976
 	public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array())
977 977
 	{
978 978
 		global $global_query;
@@ -1012,11 +1012,11 @@  discard block
 block discarded – undo
1012 1012
 
1013 1013
 
1014 1014
 	/**
1015
-	* Gets all the spotter information sorted by the newest airline
1016
-	*
1017
-	* @return Array the spotter information
1018
-	*
1019
-	*/
1015
+	 * Gets all the spotter information sorted by the newest airline
1016
+	 *
1017
+	 * @return Array the spotter information
1018
+	 *
1019
+	 */
1020 1020
 	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1021 1021
 	{
1022 1022
 		global $global_query;
@@ -1055,12 +1055,12 @@  discard block
 block discarded – undo
1055 1055
 	}
1056 1056
     
1057 1057
     
1058
-    /**
1059
-	* Gets all the spotter information sorted by the newest departure airport
1060
-	*
1061
-	* @return Array the spotter information
1062
-	*
1063
-	*/
1058
+	/**
1059
+	 * Gets all the spotter information sorted by the newest departure airport
1060
+	 *
1061
+	 * @return Array the spotter information
1062
+	 *
1063
+	 */
1064 1064
 	public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array())
1065 1065
 	{
1066 1066
 		global $global_query;
@@ -1102,11 +1102,11 @@  discard block
 block discarded – undo
1102 1102
 
1103 1103
 
1104 1104
 	/**
1105
-	* Gets all the spotter information sorted by the newest arrival airport
1106
-	*
1107
-	* @return Array the spotter information
1108
-	*
1109
-	*/
1105
+	 * Gets all the spotter information sorted by the newest arrival airport
1106
+	 *
1107
+	 * @return Array the spotter information
1108
+	 *
1109
+	 */
1110 1110
 	public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array())
1111 1111
 	{
1112 1112
 		global $global_query;
@@ -1145,11 +1145,11 @@  discard block
 block discarded – undo
1145 1145
 	
1146 1146
 
1147 1147
 	/**
1148
-	* Gets all the spotter information based on the spotter id
1149
-	*
1150
-	* @return Array the spotter information
1151
-	*
1152
-	*/
1148
+	 * Gets all the spotter information based on the spotter id
1149
+	 *
1150
+	 * @return Array the spotter information
1151
+	 *
1152
+	 */
1153 1153
 	public function getSpotterDataByID($id = '')
1154 1154
 	{
1155 1155
 		global $global_query;
@@ -1171,11 +1171,11 @@  discard block
 block discarded – undo
1171 1171
 	
1172 1172
 	
1173 1173
 	/**
1174
-	* Gets all the spotter information based on the callsign
1175
-	*
1176
-	* @return Array the spotter information
1177
-	*
1178
-	*/
1174
+	 * Gets all the spotter information based on the callsign
1175
+	 *
1176
+	 * @return Array the spotter information
1177
+	 *
1178
+	 */
1179 1179
 	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
1180 1180
 	{
1181 1181
 		global $global_query;
@@ -1228,11 +1228,11 @@  discard block
 block discarded – undo
1228 1228
 	
1229 1229
 	
1230 1230
 	/**
1231
-	* Gets all the spotter information based on the aircraft type
1232
-	*
1233
-	* @return Array the spotter information
1234
-	*
1235
-	*/
1231
+	 * Gets all the spotter information based on the aircraft type
1232
+	 *
1233
+	 * @return Array the spotter information
1234
+	 *
1235
+	 */
1236 1236
 	public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array())
1237 1237
 	{
1238 1238
 		global $global_query;
@@ -1286,11 +1286,11 @@  discard block
 block discarded – undo
1286 1286
 	
1287 1287
 	
1288 1288
 	/**
1289
-	* Gets all the spotter information based on the aircraft registration
1290
-	*
1291
-	* @return Array the spotter information
1292
-	*
1293
-	*/
1289
+	 * Gets all the spotter information based on the aircraft registration
1290
+	 *
1291
+	 * @return Array the spotter information
1292
+	 *
1293
+	 */
1294 1294
 	public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array())
1295 1295
 	{
1296 1296
 		global $global_query;
@@ -1347,11 +1347,11 @@  discard block
 block discarded – undo
1347 1347
 	
1348 1348
 	
1349 1349
 	/**
1350
-	* Gets all the spotter information based on the airline
1351
-	*
1352
-	* @return Array the spotter information
1353
-	*
1354
-	*/
1350
+	 * Gets all the spotter information based on the airline
1351
+	 *
1352
+	 * @return Array the spotter information
1353
+	 *
1354
+	 */
1355 1355
 	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1356 1356
 	{
1357 1357
 		global $global_query;
@@ -1404,11 +1404,11 @@  discard block
 block discarded – undo
1404 1404
 	
1405 1405
 	
1406 1406
 	/**
1407
-	* Gets all the spotter information based on the airport
1408
-	*
1409
-	* @return Array the spotter information
1410
-	*
1411
-	*/
1407
+	 * Gets all the spotter information based on the airport
1408
+	 *
1409
+	 * @return Array the spotter information
1410
+	 *
1411
+	 */
1412 1412
 	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1413 1413
 	{
1414 1414
 		global $global_query;
@@ -1462,11 +1462,11 @@  discard block
 block discarded – undo
1462 1462
 
1463 1463
 
1464 1464
 	/**
1465
-	* Gets all the spotter information based on the date
1466
-	*
1467
-	* @return Array the spotter information
1468
-	*
1469
-	*/
1465
+	 * Gets all the spotter information based on the date
1466
+	 *
1467
+	 * @return Array the spotter information
1468
+	 *
1469
+	 */
1470 1470
 	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1471 1471
 	{
1472 1472
 		global $global_query, $globalTimezone, $globalDBdriver;
@@ -1527,11 +1527,11 @@  discard block
 block discarded – undo
1527 1527
 
1528 1528
 
1529 1529
 	/**
1530
-	* Gets all the spotter information based on the country name
1531
-	*
1532
-	* @return Array the spotter information
1533
-	*
1534
-	*/
1530
+	 * Gets all the spotter information based on the country name
1531
+	 *
1532
+	 * @return Array the spotter information
1533
+	 *
1534
+	 */
1535 1535
 	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1536 1536
 	{
1537 1537
 		global $global_query;
@@ -1585,11 +1585,11 @@  discard block
 block discarded – undo
1585 1585
 	
1586 1586
 	
1587 1587
 	/**
1588
-	* Gets all the spotter information based on the manufacturer name
1589
-	*
1590
-	* @return Array the spotter information
1591
-	*
1592
-	*/
1588
+	 * Gets all the spotter information based on the manufacturer name
1589
+	 *
1590
+	 * @return Array the spotter information
1591
+	 *
1592
+	 */
1593 1593
 	public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array())
1594 1594
 	{
1595 1595
 		global $global_query;
@@ -1645,13 +1645,13 @@  discard block
 block discarded – undo
1645 1645
   
1646 1646
   
1647 1647
 	/**
1648
-	* Gets a list of all aircraft that take a route
1649
-	*
1650
-	* @param String $departure_airport_icao ICAO code of departure airport
1651
-	* @param String $arrival_airport_icao ICAO code of arrival airport
1652
-	* @return Array the spotter information
1653
-	*
1654
-	*/
1648
+	 * Gets a list of all aircraft that take a route
1649
+	 *
1650
+	 * @param String $departure_airport_icao ICAO code of departure airport
1651
+	 * @param String $arrival_airport_icao ICAO code of arrival airport
1652
+	 * @return Array the spotter information
1653
+	 *
1654
+	 */
1655 1655
 	public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array())
1656 1656
 	{
1657 1657
 		global $global_query;
@@ -1720,11 +1720,11 @@  discard block
 block discarded – undo
1720 1720
 	
1721 1721
 	
1722 1722
 	/**
1723
-	* Gets all the spotter information based on the special column in the table
1724
-	*
1725
-	* @return Array the spotter information
1726
-	*
1727
-	*/
1723
+	 * Gets all the spotter information based on the special column in the table
1724
+	 *
1725
+	 * @return Array the spotter information
1726
+	 *
1727
+	 */
1728 1728
 	public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array())
1729 1729
 	{
1730 1730
 		global $global_query;
@@ -1763,11 +1763,11 @@  discard block
 block discarded – undo
1763 1763
 	}
1764 1764
 
1765 1765
 	/**
1766
-	* Gets all the highlight based on a aircraft registration
1767
-	*
1768
-	* @return String the highlight text
1769
-	*
1770
-	*/
1766
+	 * Gets all the highlight based on a aircraft registration
1767
+	 *
1768
+	 * @return String the highlight text
1769
+	 *
1770
+	 */
1771 1771
 	public function getHighlightByRegistration($registration,$filter = array())
1772 1772
 	{
1773 1773
 		global $global_query;
@@ -1789,13 +1789,13 @@  discard block
 block discarded – undo
1789 1789
 
1790 1790
 	
1791 1791
 	/**
1792
-	* Gets the squawk usage from squawk code
1793
-	*
1794
-	* @param String $squawk squawk code
1795
-	* @param String $country country
1796
-	* @return String usage
1797
-	*
1798
-	*/
1792
+	 * Gets the squawk usage from squawk code
1793
+	 *
1794
+	 * @param String $squawk squawk code
1795
+	 * @param String $country country
1796
+	 * @return String usage
1797
+	 *
1798
+	 */
1799 1799
 	public function getSquawkUsage($squawk = '',$country = 'FR')
1800 1800
 	{
1801 1801
 		
@@ -1816,12 +1816,12 @@  discard block
 block discarded – undo
1816 1816
 	}
1817 1817
 
1818 1818
 	/**
1819
-	* Gets the airport icao from the iata
1820
-	*
1821
-	* @param String $airport_iata the iata code of the airport
1822
-	* @return String airport iata
1823
-	*
1824
-	*/
1819
+	 * Gets the airport icao from the iata
1820
+	 *
1821
+	 * @param String $airport_iata the iata code of the airport
1822
+	 * @return String airport iata
1823
+	 *
1824
+	 */
1825 1825
 	public function getAirportIcao($airport_iata = '')
1826 1826
 	{
1827 1827
 		
@@ -1841,14 +1841,14 @@  discard block
 block discarded – undo
1841 1841
 	}
1842 1842
 
1843 1843
 	/**
1844
-	* Gets the airport distance
1845
-	*
1846
-	* @param String $airport_icao the icao code of the airport
1847
-	* @param Float $latitude the latitude
1848
-	* @param Float $longitude the longitude
1849
-	* @return Float distance to the airport
1850
-	*
1851
-	*/
1844
+	 * Gets the airport distance
1845
+	 *
1846
+	 * @param String $airport_icao the icao code of the airport
1847
+	 * @param Float $latitude the latitude
1848
+	 * @param Float $longitude the longitude
1849
+	 * @return Float distance to the airport
1850
+	 *
1851
+	 */
1852 1852
 	public function getAirportDistance($airport_icao,$latitude,$longitude)
1853 1853
 	{
1854 1854
 		
@@ -1869,12 +1869,12 @@  discard block
 block discarded – undo
1869 1869
 	}
1870 1870
 	
1871 1871
 	/**
1872
-	* Gets the airport info based on the icao
1873
-	*
1874
-	* @param String $airport the icao code of the airport
1875
-	* @return Array airport information
1876
-	*
1877
-	*/
1872
+	 * Gets the airport info based on the icao
1873
+	 *
1874
+	 * @param String $airport the icao code of the airport
1875
+	 * @return Array airport information
1876
+	 *
1877
+	 */
1878 1878
 	public function getAllAirportInfo($airport = '')
1879 1879
 	{
1880 1880
 		
@@ -1920,12 +1920,12 @@  discard block
 block discarded – undo
1920 1920
 	}
1921 1921
 	
1922 1922
 	/**
1923
-	* Gets the airport info based on the country
1924
-	*
1925
-	* @param Array $countries Airports countries
1926
-	* @return Array airport information
1927
-	*
1928
-	*/
1923
+	 * Gets the airport info based on the country
1924
+	 *
1925
+	 * @param Array $countries Airports countries
1926
+	 * @return Array airport information
1927
+	 *
1928
+	 */
1929 1929
 	public function getAllAirportInfobyCountry($countries)
1930 1930
 	{
1931 1931
 		$lst_countries = '';
@@ -1963,12 +1963,12 @@  discard block
 block discarded – undo
1963 1963
 	}
1964 1964
 	
1965 1965
 	/**
1966
-	* Gets airports info based on the coord
1967
-	*
1968
-	* @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1969
-	* @return Array airport information
1970
-	*
1971
-	*/
1966
+	 * Gets airports info based on the coord
1967
+	 *
1968
+	 * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1969
+	 * @return Array airport information
1970
+	 *
1971
+	 */
1972 1972
 	public function getAllAirportInfobyCoord($coord)
1973 1973
 	{
1974 1974
 		global $globalDBdriver;
@@ -1999,12 +1999,12 @@  discard block
 block discarded – undo
1999 1999
 	}
2000 2000
 
2001 2001
 	/**
2002
-	* Gets waypoints info based on the coord
2003
-	*
2004
-	* @param Array $coord waypoints coord
2005
-	* @return Array airport information
2006
-	*
2007
-	*/
2002
+	 * Gets waypoints info based on the coord
2003
+	 *
2004
+	 * @param Array $coord waypoints coord
2005
+	 * @return Array airport information
2006
+	 *
2007
+	 */
2008 2008
 	public function getAllWaypointsInfobyCoord($coord)
2009 2009
 	{
2010 2010
 		if (is_array($coord)) {
@@ -2038,12 +2038,12 @@  discard block
 block discarded – undo
2038 2038
 	
2039 2039
 	
2040 2040
 	/**
2041
-	* Gets the airline info based on the icao code or iata code
2042
-	*
2043
-	* @param String $airline_icao the iata code of the airport
2044
-	* @return Array airport information
2045
-	*
2046
-	*/
2041
+	 * Gets the airline info based on the icao code or iata code
2042
+	 *
2043
+	 * @param String $airline_icao the iata code of the airport
2044
+	 * @return Array airport information
2045
+	 *
2046
+	 */
2047 2047
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2048 2048
 	{
2049 2049
 		global $globalUseRealAirlines;
@@ -2074,7 +2074,7 @@  discard block
 block discarded – undo
2074 2074
 			} else {
2075 2075
 				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2076 2076
 			}
2077
-                        /*
2077
+						/*
2078 2078
 			$airline_array = array();
2079 2079
 			$temp_array = array();
2080 2080
 		
@@ -2106,12 +2106,12 @@  discard block
 block discarded – undo
2106 2106
 	
2107 2107
 	
2108 2108
 	/**
2109
-	* Gets the aircraft info based on the aircraft type
2110
-	*
2111
-	* @param String $aircraft_type the aircraft type
2112
-	* @return Array aircraft information
2113
-	*
2114
-	*/
2109
+	 * Gets the aircraft info based on the aircraft type
2110
+	 *
2111
+	 * @param String $aircraft_type the aircraft type
2112
+	 * @return Array aircraft information
2113
+	 *
2114
+	 */
2115 2115
 	public function getAllAircraftInfo($aircraft_type)
2116 2116
 	{
2117 2117
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2143,12 +2143,12 @@  discard block
 block discarded – undo
2143 2143
 	}
2144 2144
 
2145 2145
 	/**
2146
-	* Gets the aircraft icao based on the aircraft name/type
2147
-	*
2148
-	* @param String $aircraft_type the aircraft type
2149
-	* @return String aircraft information
2150
-	*
2151
-	*/
2146
+	 * Gets the aircraft icao based on the aircraft name/type
2147
+	 *
2148
+	 * @param String $aircraft_type the aircraft type
2149
+	 * @return String aircraft information
2150
+	 *
2151
+	 */
2152 2152
 	public function getAircraftIcao($aircraft_type)
2153 2153
 	{
2154 2154
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2173,12 +2173,12 @@  discard block
 block discarded – undo
2173 2173
 	}
2174 2174
 	
2175 2175
 	/**
2176
-	* Gets the aircraft info based on the aircraft modes
2177
-	*
2178
-	* @param String $aircraft_modes the aircraft ident (hex)
2179
-	* @return String aircraft type
2180
-	*
2181
-	*/
2176
+	 * Gets the aircraft info based on the aircraft modes
2177
+	 *
2178
+	 * @param String $aircraft_modes the aircraft ident (hex)
2179
+	 * @return String aircraft type
2180
+	 *
2181
+	 */
2182 2182
 	public function getAllAircraftType($aircraft_modes)
2183 2183
 	{
2184 2184
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -2196,12 +2196,12 @@  discard block
 block discarded – undo
2196 2196
 	}
2197 2197
 
2198 2198
 	/**
2199
-	* Gets the aircraft info based on the aircraft registration
2200
-	*
2201
-	* @param String $registration the aircraft registration
2202
-	* @return String aircraft type
2203
-	*
2204
-	*/
2199
+	 * Gets the aircraft info based on the aircraft registration
2200
+	 *
2201
+	 * @param String $registration the aircraft registration
2202
+	 * @return String aircraft type
2203
+	 *
2204
+	 */
2205 2205
 	public function getAllAircraftTypeByRegistration($registration)
2206 2206
 	{
2207 2207
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2219,12 +2219,12 @@  discard block
 block discarded – undo
2219 2219
 	}
2220 2220
 
2221 2221
 	/**
2222
-	* Gets correct aircraft operator corde
2223
-	*
2224
-	* @param String $operator the aircraft operator code (callsign)
2225
-	* @return String aircraft operator code
2226
-	*
2227
-	*/
2222
+	 * Gets correct aircraft operator corde
2223
+	 *
2224
+	 * @param String $operator the aircraft operator code (callsign)
2225
+	 * @return String aircraft operator code
2226
+	 *
2227
+	 */
2228 2228
 	public function getOperator($operator)
2229 2229
 	{
2230 2230
 		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
@@ -2241,16 +2241,16 @@  discard block
 block discarded – undo
2241 2241
 	}
2242 2242
 
2243 2243
 	/**
2244
-	* Gets the aircraft route based on the aircraft callsign
2245
-	*
2246
-	* @param String $callsign the aircraft callsign
2247
-	* @return Array aircraft type
2248
-	*
2249
-	*/
2244
+	 * Gets the aircraft route based on the aircraft callsign
2245
+	 *
2246
+	 * @param String $callsign the aircraft callsign
2247
+	 * @return Array aircraft type
2248
+	 *
2249
+	 */
2250 2250
 	public function getRouteInfo($callsign)
2251 2251
 	{
2252 2252
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2253
-                if ($callsign == '') return array();
2253
+				if ($callsign == '') return array();
2254 2254
 		$query  = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2255 2255
 		
2256 2256
 		$sth = $this->db->prepare($query);
@@ -2264,12 +2264,12 @@  discard block
 block discarded – undo
2264 2264
 	}
2265 2265
 	
2266 2266
 	/**
2267
-	* Gets the aircraft info based on the aircraft registration
2268
-	*
2269
-	* @param String $registration the aircraft registration
2270
-	* @return Array aircraft information
2271
-	*
2272
-	*/
2267
+	 * Gets the aircraft info based on the aircraft registration
2268
+	 *
2269
+	 * @param String $registration the aircraft registration
2270
+	 * @return Array aircraft information
2271
+	 *
2272
+	 */
2273 2273
 	public function getAircraftInfoByRegistration($registration)
2274 2274
 	{
2275 2275
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2296,12 +2296,12 @@  discard block
 block discarded – undo
2296 2296
 	}
2297 2297
 	
2298 2298
 	/**
2299
-	* Gets the aircraft owner & base based on the aircraft registration
2300
-	*
2301
-	* @param String $registration the aircraft registration
2302
-	* @return Array aircraft information
2303
-	*
2304
-	*/
2299
+	 * Gets the aircraft owner & base based on the aircraft registration
2300
+	 *
2301
+	 * @param String $registration the aircraft registration
2302
+	 * @return Array aircraft information
2303
+	 *
2304
+	 */
2305 2305
 	public function getAircraftOwnerByRegistration($registration)
2306 2306
 	{
2307 2307
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2318,11 +2318,11 @@  discard block
 block discarded – undo
2318 2318
 	
2319 2319
   
2320 2320
   /**
2321
-	* Gets all flights (but with only little info)
2322
-	*
2323
-	* @return Array basic flight information
2324
-	*
2325
-	*/
2321
+   * Gets all flights (but with only little info)
2322
+   *
2323
+   * @return Array basic flight information
2324
+   *
2325
+   */
2326 2326
 	public function getAllFlightsforSitemap()
2327 2327
 	{
2328 2328
 		//$query  = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT ";
@@ -2330,7 +2330,7 @@  discard block
 block discarded – undo
2330 2330
 		
2331 2331
 		$sth = $this->db->prepare($query);
2332 2332
 		$sth->execute();
2333
-                  /*
2333
+				  /*
2334 2334
 		$flight_array = array();
2335 2335
 		$temp_array = array();
2336 2336
 		
@@ -2352,11 +2352,11 @@  discard block
 block discarded – undo
2352 2352
 	}
2353 2353
   
2354 2354
 	/**
2355
-	* Gets a list of all aircraft manufacturers
2356
-	*
2357
-	* @return Array list of aircraft types
2358
-	*
2359
-	*/
2355
+	 * Gets a list of all aircraft manufacturers
2356
+	 *
2357
+	 * @return Array list of aircraft types
2358
+	 *
2359
+	 */
2360 2360
 	public function getAllManufacturers()
2361 2361
 	{
2362 2362
 		/*
@@ -2385,11 +2385,11 @@  discard block
 block discarded – undo
2385 2385
   
2386 2386
   
2387 2387
   /**
2388
-	* Gets a list of all aircraft types
2389
-	*
2390
-	* @return Array list of aircraft types
2391
-	*
2392
-	*/
2388
+   * Gets a list of all aircraft types
2389
+   *
2390
+   * @return Array list of aircraft types
2391
+   *
2392
+   */
2393 2393
 	public function getAllAircraftTypes($filters = array())
2394 2394
 	{
2395 2395
 		/*
@@ -2424,11 +2424,11 @@  discard block
 block discarded – undo
2424 2424
 	
2425 2425
 	
2426 2426
 	/**
2427
-	* Gets a list of all aircraft registrations
2428
-	*
2429
-	* @return Array list of aircraft registrations
2430
-	*
2431
-	*/
2427
+	 * Gets a list of all aircraft registrations
2428
+	 *
2429
+	 * @return Array list of aircraft registrations
2430
+	 *
2431
+	 */
2432 2432
 	public function getAllAircraftRegistrations($filters = array())
2433 2433
 	{
2434 2434
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2453,12 +2453,12 @@  discard block
 block discarded – undo
2453 2453
 	}
2454 2454
 
2455 2455
 	/**
2456
-	* Gets all source name
2457
-	*
2458
-	* @param String type format of source
2459
-	* @return Array list of source name
2460
-	*
2461
-	*/
2456
+	 * Gets all source name
2457
+	 *
2458
+	 * @param String type format of source
2459
+	 * @return Array list of source name
2460
+	 *
2461
+	 */
2462 2462
 	public function getAllSourceName($type = '',$filters = array())
2463 2463
 	{
2464 2464
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2489,11 +2489,11 @@  discard block
 block discarded – undo
2489 2489
 
2490 2490
 
2491 2491
 	/**
2492
-	* Gets a list of all airline names
2493
-	*
2494
-	* @return Array list of airline names
2495
-	*
2496
-	*/
2492
+	 * Gets a list of all airline names
2493
+	 *
2494
+	 * @return Array list of airline names
2495
+	 *
2496
+	 */
2497 2497
 	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2498 2498
 	{
2499 2499
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2543,11 +2543,11 @@  discard block
 block discarded – undo
2543 2543
 	
2544 2544
 	
2545 2545
 	/**
2546
-	* Gets a list of all airline countries
2547
-	*
2548
-	* @return Array list of airline countries
2549
-	*
2550
-	*/
2546
+	 * Gets a list of all airline countries
2547
+	 *
2548
+	 * @return Array list of airline countries
2549
+	 *
2550
+	 */
2551 2551
 	public function getAllAirlineCountries($filters = array())
2552 2552
 	{
2553 2553
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2575,11 +2575,11 @@  discard block
 block discarded – undo
2575 2575
 	
2576 2576
 	
2577 2577
 	/**
2578
-	* Gets a list of all departure & arrival names
2579
-	*
2580
-	* @return Array list of airport names
2581
-	*
2582
-	*/
2578
+	 * Gets a list of all departure & arrival names
2579
+	 *
2580
+	 * @return Array list of airport names
2581
+	 *
2582
+	 */
2583 2583
 	public function getAllAirportNames($filters = array())
2584 2584
 	{
2585 2585
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2628,11 +2628,11 @@  discard block
 block discarded – undo
2628 2628
 	
2629 2629
 	
2630 2630
 	/**
2631
-	* Gets a list of all departure & arrival airport countries
2632
-	*
2633
-	* @return Array list of airport countries
2634
-	*
2635
-	*/
2631
+	 * Gets a list of all departure & arrival airport countries
2632
+	 *
2633
+	 * @return Array list of airport countries
2634
+	 *
2635
+	 */
2636 2636
 	public function getAllAirportCountries($filters = array())
2637 2637
 	{
2638 2638
 		$airport_array = array();
@@ -2680,11 +2680,11 @@  discard block
 block discarded – undo
2680 2680
 	
2681 2681
 	
2682 2682
 	/**
2683
-	* Gets a list of all countries (airline, departure airport & arrival airport)
2684
-	*
2685
-	* @return Array list of countries
2686
-	*
2687
-	*/
2683
+	 * Gets a list of all countries (airline, departure airport & arrival airport)
2684
+	 *
2685
+	 * @return Array list of countries
2686
+	 *
2687
+	 */
2688 2688
 	public function getAllCountries($filters = array())
2689 2689
 	{
2690 2690
 		$Connection= new Connection($this->db);
@@ -2761,11 +2761,11 @@  discard block
 block discarded – undo
2761 2761
 	
2762 2762
 	
2763 2763
 	/**
2764
-	* Gets a list of all idents/callsigns
2765
-	*
2766
-	* @return Array list of ident/callsign names
2767
-	*
2768
-	*/
2764
+	 * Gets a list of all idents/callsigns
2765
+	 *
2766
+	 * @return Array list of ident/callsign names
2767
+	 *
2768
+	 */
2769 2769
 	public function getAllIdents($filters = array())
2770 2770
 	{
2771 2771
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2789,9 +2789,9 @@  discard block
 block discarded – undo
2789 2789
 	}
2790 2790
 
2791 2791
 	/**
2792
-	* Get a list of flights from airport since 7 days
2793
-	* @return Array number, icao, name and city of airports
2794
-	*/
2792
+	 * Get a list of flights from airport since 7 days
2793
+	 * @return Array number, icao, name and city of airports
2794
+	 */
2795 2795
 
2796 2796
 	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
2797 2797
 		global $globalTimezone, $globalDBdriver;
@@ -2822,9 +2822,9 @@  discard block
 block discarded – undo
2822 2822
 	}
2823 2823
 
2824 2824
 	/**
2825
-	* Get a list of flights from airport since 7 days
2826
-	* @return Array number, icao, name and city of airports
2827
-	*/
2825
+	 * Get a list of flights from airport since 7 days
2826
+	 * @return Array number, icao, name and city of airports
2827
+	 */
2828 2828
 
2829 2829
 	public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') {
2830 2830
 		global $globalTimezone, $globalDBdriver;
@@ -2854,9 +2854,9 @@  discard block
 block discarded – undo
2854 2854
 	}
2855 2855
 
2856 2856
 	/**
2857
-	* Get a list of flights from detected airport since 7 days
2858
-	* @return Array number, icao, name and city of airports
2859
-	*/
2857
+	 * Get a list of flights from detected airport since 7 days
2858
+	 * @return Array number, icao, name and city of airports
2859
+	 */
2860 2860
 
2861 2861
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
2862 2862
 		global $globalTimezone, $globalDBdriver;
@@ -2894,9 +2894,9 @@  discard block
 block discarded – undo
2894 2894
 	}
2895 2895
 
2896 2896
 	/**
2897
-	* Get a list of flights from detected airport since 7 days
2898
-	* @return Array number, icao, name and city of airports
2899
-	*/
2897
+	 * Get a list of flights from detected airport since 7 days
2898
+	 * @return Array number, icao, name and city of airports
2899
+	 */
2900 2900
 
2901 2901
 	public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') {
2902 2902
 		global $globalTimezone, $globalDBdriver;
@@ -2938,9 +2938,9 @@  discard block
 block discarded – undo
2938 2938
 
2939 2939
 
2940 2940
 	/**
2941
-	* Get a list of flights to airport since 7 days
2942
-	* @return Array number, icao, name and city of airports
2943
-	*/
2941
+	 * Get a list of flights to airport since 7 days
2942
+	 * @return Array number, icao, name and city of airports
2943
+	 */
2944 2944
 
2945 2945
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
2946 2946
 		global $globalTimezone, $globalDBdriver;
@@ -2973,9 +2973,9 @@  discard block
 block discarded – undo
2973 2973
 
2974 2974
 
2975 2975
 	/**
2976
-	* Get a list of flights detected to airport since 7 days
2977
-	* @return Array number, icao, name and city of airports
2978
-	*/
2976
+	 * Get a list of flights detected to airport since 7 days
2977
+	 * @return Array number, icao, name and city of airports
2978
+	 */
2979 2979
 
2980 2980
 	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
2981 2981
 		global $globalTimezone, $globalDBdriver;
@@ -3016,9 +3016,9 @@  discard block
 block discarded – undo
3016 3016
 
3017 3017
 
3018 3018
 	/**
3019
-	* Get a list of flights to airport since 7 days
3020
-	* @return Array number, icao, name and city of airports
3021
-	*/
3019
+	 * Get a list of flights to airport since 7 days
3020
+	 * @return Array number, icao, name and city of airports
3021
+	 */
3022 3022
 
3023 3023
 	public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') {
3024 3024
 		global $globalTimezone, $globalDBdriver;
@@ -3050,9 +3050,9 @@  discard block
 block discarded – undo
3050 3050
 
3051 3051
 
3052 3052
 	/**
3053
-	* Get a list of flights detected to airport since 7 days
3054
-	* @return Array number, icao, name and city of airports
3055
-	*/
3053
+	 * Get a list of flights detected to airport since 7 days
3054
+	 * @return Array number, icao, name and city of airports
3055
+	 */
3056 3056
 
3057 3057
 	public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') {
3058 3058
 		global $globalTimezone, $globalDBdriver;
@@ -3096,11 +3096,11 @@  discard block
 block discarded – undo
3096 3096
 
3097 3097
 
3098 3098
 	/**
3099
-	* Gets a list of all dates
3100
-	*
3101
-	* @return Array list of date names
3102
-	*
3103
-	*/
3099
+	 * Gets a list of all dates
3100
+	 *
3101
+	 * @return Array list of date names
3102
+	 *
3103
+	 */
3104 3104
 	public function getAllDates()
3105 3105
 	{
3106 3106
 		global $globalTimezone, $globalDBdriver;
@@ -3141,11 +3141,11 @@  discard block
 block discarded – undo
3141 3141
 	
3142 3142
 	
3143 3143
 	/**
3144
-	* Gets all route combinations
3145
-	*
3146
-	* @return Array the route list
3147
-	*
3148
-	*/
3144
+	 * Gets all route combinations
3145
+	 *
3146
+	 * @return Array the route list
3147
+	 *
3148
+	 */
3149 3149
 	public function getAllRoutes()
3150 3150
 	{
3151 3151
 		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route,  spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao 
@@ -3171,13 +3171,13 @@  discard block
 block discarded – undo
3171 3171
 	}
3172 3172
 
3173 3173
 	/**
3174
-	* Update ident spotter data
3175
-	*
3176
-	* @param String $flightaware_id the ID from flightaware
3177
-	* @param String $ident the flight ident
3178
-	* @return String success or false
3179
-	*
3180
-	*/	
3174
+	 * Update ident spotter data
3175
+	 *
3176
+	 * @param String $flightaware_id the ID from flightaware
3177
+	 * @param String $ident the flight ident
3178
+	 * @return String success or false
3179
+	 *
3180
+	 */	
3181 3181
 	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3182 3182
 	{
3183 3183
 		if (!is_numeric(substr($ident, 0, 3)))
@@ -3198,14 +3198,14 @@  discard block
 block discarded – undo
3198 3198
 		} else {
3199 3199
 			$airline_array = $this->getAllAirlineInfo("NA");
3200 3200
 		}
3201
-                $airline_name = $airline_array[0]['name'];
3202
-                $airline_icao = $airline_array[0]['icao'];
3203
-                $airline_country = $airline_array[0]['country'];
3204
-                $airline_type = $airline_array[0]['type'];
3201
+				$airline_name = $airline_array[0]['name'];
3202
+				$airline_icao = $airline_array[0]['icao'];
3203
+				$airline_country = $airline_array[0]['country'];
3204
+				$airline_type = $airline_array[0]['type'];
3205 3205
 
3206 3206
 
3207 3207
 		$query = 'UPDATE spotter_output SET ident = :ident, airline_name = :airline_name, airline_icao = :airline_icao, airline_country = :airline_country, airline_type = :airline_type WHERE flightaware_id = :flightaware_id';
3208
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type);
3208
+				$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type);
3209 3209
 
3210 3210
 		try {
3211 3211
 			$sth = $this->db->prepare($query);
@@ -3218,19 +3218,19 @@  discard block
 block discarded – undo
3218 3218
 
3219 3219
 	}
3220 3220
 	/**
3221
-	* Update latest spotter data
3222
-	*
3223
-	* @param String $flightaware_id the ID from flightaware
3224
-	* @param String $ident the flight ident
3225
-	* @param String $arrival_airport_icao the arrival airport
3226
-	* @return String success or false
3227
-	*
3228
-	*/	
3221
+	 * Update latest spotter data
3222
+	 *
3223
+	 * @param String $flightaware_id the ID from flightaware
3224
+	 * @param String $ident the flight ident
3225
+	 * @param String $arrival_airport_icao the arrival airport
3226
+	 * @return String success or false
3227
+	 *
3228
+	 */	
3229 3229
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3230 3230
 	{
3231 3231
 		if ($groundspeed == '') $groundspeed = NULL;
3232 3232
 		$query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id';
3233
-                $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3233
+				$query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3234 3234
 
3235 3235
 		try {
3236 3236
 			$sth = $this->db->prepare($query);
@@ -3244,32 +3244,32 @@  discard block
 block discarded – undo
3244 3244
 	}
3245 3245
 
3246 3246
 	/**
3247
-	* Adds a new spotter data
3248
-	*
3249
-	* @param String $flightaware_id the ID from flightaware
3250
-	* @param String $ident the flight ident
3251
-	* @param String $aircraft_icao the aircraft type
3252
-	* @param String $departure_airport_icao the departure airport
3253
-	* @param String $arrival_airport_icao the arrival airport
3254
-	* @param String $latitude latitude of flight
3255
-	* @param String $longitude latitude of flight
3256
-	* @param String $waypoints waypoints of flight
3257
-	* @param String $altitude altitude of flight
3258
-	* @param String $heading heading of flight
3259
-	* @param String $groundspeed speed of flight
3260
-	* @param String $date date of flight
3261
-	* @param String $departure_airport_time departure time of flight
3262
-	* @param String $arrival_airport_time arrival time of flight
3263
-	* @param String $squawk squawk code of flight
3264
-	* @param String $route_stop route stop of flight
3265
-	* @param String $highlight highlight or not
3266
-	* @param String $ModeS ModesS code of flight
3267
-	* @param String $registration registration code of flight
3268
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
3269
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
3270
-	* @param String $verticalrate vertival rate of flight
3271
-	* @return String success or false
3272
-	*/
3247
+	 * Adds a new spotter data
3248
+	 *
3249
+	 * @param String $flightaware_id the ID from flightaware
3250
+	 * @param String $ident the flight ident
3251
+	 * @param String $aircraft_icao the aircraft type
3252
+	 * @param String $departure_airport_icao the departure airport
3253
+	 * @param String $arrival_airport_icao the arrival airport
3254
+	 * @param String $latitude latitude of flight
3255
+	 * @param String $longitude latitude of flight
3256
+	 * @param String $waypoints waypoints of flight
3257
+	 * @param String $altitude altitude of flight
3258
+	 * @param String $heading heading of flight
3259
+	 * @param String $groundspeed speed of flight
3260
+	 * @param String $date date of flight
3261
+	 * @param String $departure_airport_time departure time of flight
3262
+	 * @param String $arrival_airport_time arrival time of flight
3263
+	 * @param String $squawk squawk code of flight
3264
+	 * @param String $route_stop route stop of flight
3265
+	 * @param String $highlight highlight or not
3266
+	 * @param String $ModeS ModesS code of flight
3267
+	 * @param String $registration registration code of flight
3268
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
3269
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
3270
+	 * @param String $verticalrate vertival rate of flight
3271
+	 * @return String success or false
3272
+	 */
3273 3273
 	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '',$squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '')
3274 3274
 	{
3275 3275
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
@@ -3483,8 +3483,8 @@  discard block
 block discarded – undo
3483 3483
     
3484 3484
 		if ($globalIVAO && $aircraft_icao != '')
3485 3485
 		{
3486
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3487
-            		else $airline_icao = '';
3486
+					if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3487
+					else $airline_icao = '';
3488 3488
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3489 3489
 			if (!isset($image_array[0]['registration']))
3490 3490
 			{
@@ -3515,52 +3515,52 @@  discard block
 block discarded – undo
3515 3515
 	
3516 3516
 		if (count($airline_array) == 0) 
3517 3517
 		{
3518
-                        $airline_array = $this->getAllAirlineInfo('NA');
3519
-                }
3520
-                if (count($aircraft_array) == 0) 
3521
-                {
3522
-                        $aircraft_array = $this->getAllAircraftInfo('NA');
3523
-                }
3524
-                if (count($departure_airport_array) == 0) 
3525
-                {
3526
-                        $departure_airport_array = $this->getAllAirportInfo('NA');
3527
-                }
3528
-                if (count($arrival_airport_array) == 0) 
3529
-                {
3530
-                        $arrival_airport_array = $this->getAllAirportInfo('NA');
3531
-                }
3532
-                if ($registration == '') $registration = 'NA';
3533
-                if ($latitude == '' && $longitude == '') {
3534
-            		$latitude = 0;
3535
-            		$longitude = 0;
3536
-            	}
3537
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3538
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3539
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3540
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3541
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3542
-                $query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3518
+						$airline_array = $this->getAllAirlineInfo('NA');
3519
+				}
3520
+				if (count($aircraft_array) == 0) 
3521
+				{
3522
+						$aircraft_array = $this->getAllAircraftInfo('NA');
3523
+				}
3524
+				if (count($departure_airport_array) == 0) 
3525
+				{
3526
+						$departure_airport_array = $this->getAllAirportInfo('NA');
3527
+				}
3528
+				if (count($arrival_airport_array) == 0) 
3529
+				{
3530
+						$arrival_airport_array = $this->getAllAirportInfo('NA');
3531
+				}
3532
+				if ($registration == '') $registration = 'NA';
3533
+				if ($latitude == '' && $longitude == '') {
3534
+					$latitude = 0;
3535
+					$longitude = 0;
3536
+				}
3537
+				if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3538
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3539
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3540
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3541
+				if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3542
+				$query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3543 3543
                 VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)";
3544 3544
 
3545
-                $airline_name = $airline_array[0]['name'];
3546
-                $airline_icao = $airline_array[0]['icao'];
3547
-                $airline_country = $airline_array[0]['country'];
3548
-                $airline_type = $airline_array[0]['type'];
3545
+				$airline_name = $airline_array[0]['name'];
3546
+				$airline_icao = $airline_array[0]['icao'];
3547
+				$airline_country = $airline_array[0]['country'];
3548
+				$airline_type = $airline_array[0]['type'];
3549 3549
 		if ($airline_type == '') {
3550 3550
 			$timeelapsed = microtime(true);
3551 3551
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3552 3552
 			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3553 3553
 		}
3554 3554
 		if ($airline_type == null) $airline_type = '';
3555
-                $aircraft_type = $aircraft_array[0]['type'];
3556
-                $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3557
-                $departure_airport_name = $departure_airport_array[0]['name'];
3558
-                $departure_airport_city = $departure_airport_array[0]['city'];
3559
-                $departure_airport_country = $departure_airport_array[0]['country'];
3560
-                $arrival_airport_name = $arrival_airport_array[0]['name'];
3561
-                $arrival_airport_city = $arrival_airport_array[0]['city'];
3562
-                $arrival_airport_country = $arrival_airport_array[0]['country'];
3563
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3555
+				$aircraft_type = $aircraft_array[0]['type'];
3556
+				$aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3557
+				$departure_airport_name = $departure_airport_array[0]['name'];
3558
+				$departure_airport_city = $departure_airport_array[0]['city'];
3559
+				$departure_airport_country = $departure_airport_array[0]['country'];
3560
+				$arrival_airport_name = $arrival_airport_array[0]['name'];
3561
+				$arrival_airport_city = $arrival_airport_array[0]['city'];
3562
+				$arrival_airport_country = $arrival_airport_array[0]['country'];
3563
+				$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3564 3564
 
3565 3565
 		try {
3566 3566
 		        
@@ -3568,7 +3568,7 @@  discard block
 block discarded – undo
3568 3568
 			$sth->execute($query_values);
3569 3569
 			$this->db = null;
3570 3570
 		} catch (PDOException $e) {
3571
-		    return "error : ".$e->getMessage();
3571
+			return "error : ".$e->getMessage();
3572 3572
 		}
3573 3573
 		
3574 3574
 		return "success";
@@ -3577,11 +3577,11 @@  discard block
 block discarded – undo
3577 3577
 	
3578 3578
   
3579 3579
 	/**
3580
-	* Gets the aircraft ident within the last hour
3581
-	*
3582
-	* @return String the ident
3583
-	*
3584
-	*/
3580
+	 * Gets the aircraft ident within the last hour
3581
+	 *
3582
+	 * @return String the ident
3583
+	 *
3584
+	 */
3585 3585
 	public function getIdentFromLastHour($ident)
3586 3586
 	{
3587 3587
 		global $globalDBdriver, $globalTimezone;
@@ -3597,11 +3597,11 @@  discard block
 block discarded – undo
3597 3597
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3598 3598
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
3599 3599
 			$query_data = array(':ident' => $ident);
3600
-    		}
3600
+			}
3601 3601
 		
3602 3602
 		$sth = $this->db->prepare($query);
3603 3603
 		$sth->execute($query_data);
3604
-    		$ident_result='';
3604
+			$ident_result='';
3605 3605
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3606 3606
 		{
3607 3607
 			$ident_result = $row['ident'];
@@ -3612,11 +3612,11 @@  discard block
 block discarded – undo
3612 3612
 	
3613 3613
 	
3614 3614
 	/**
3615
-	* Gets the aircraft data from the last 20 seconds
3616
-	*
3617
-	* @return Array the spotter data
3618
-	*
3619
-	*/
3615
+	 * Gets the aircraft data from the last 20 seconds
3616
+	 *
3617
+	 * @return Array the spotter data
3618
+	 *
3619
+	 */
3620 3620
 	public function getRealTimeData($q = '')
3621 3621
 	{
3622 3622
 		global $globalDBdriver;
@@ -3660,11 +3660,11 @@  discard block
 block discarded – undo
3660 3660
 	
3661 3661
 	
3662 3662
 	 /**
3663
-	* Gets all airlines that have flown over
3664
-	*
3665
-	* @return Array the airline list
3666
-	*
3667
-	*/
3663
+	  * Gets all airlines that have flown over
3664
+	  *
3665
+	  * @return Array the airline list
3666
+	  *
3667
+	  */
3668 3668
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3669 3669
 	{
3670 3670
 		global $globalDBdriver;
@@ -3678,7 +3678,7 @@  discard block
 block discarded – undo
3678 3678
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3679 3679
 			}
3680 3680
 		}
3681
-                if ($sincedate != '') {
3681
+				if ($sincedate != '') {
3682 3682
 			if ($globalDBdriver == 'mysql') {
3683 3683
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3684 3684
 			} else {
@@ -3705,26 +3705,26 @@  discard block
 block discarded – undo
3705 3705
 	}
3706 3706
 
3707 3707
 	 /**
3708
-	* Gets all pilots that have flown over
3709
-	*
3710
-	* @return Array the pilots list
3711
-	*
3712
-	*/
3708
+	  * Gets all pilots that have flown over
3709
+	  *
3710
+	  * @return Array the pilots list
3711
+	  *
3712
+	  */
3713 3713
 	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3714 3714
 	{
3715 3715
 		global $globalDBdriver;
3716 3716
 		$filter_query = $this->getFilter($filters,true,true);
3717 3717
 		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3718 3718
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3719
-                if ($olderthanmonths > 0) {
3720
-            		if ($globalDBdriver == 'mysql') {
3719
+				if ($olderthanmonths > 0) {
3720
+					if ($globalDBdriver == 'mysql') {
3721 3721
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3722 3722
 			} else {
3723 3723
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3724 3724
 			}
3725 3725
 		}
3726
-                if ($sincedate != '') {
3727
-            		if ($globalDBdriver == 'mysql') {
3726
+				if ($sincedate != '') {
3727
+					if ($globalDBdriver == 'mysql') {
3728 3728
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3729 3729
 			} else {
3730 3730
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3752,25 +3752,25 @@  discard block
 block discarded – undo
3752 3752
 	}
3753 3753
 	
3754 3754
 		 /**
3755
-	* Gets all pilots that have flown over
3756
-	*
3757
-	* @return Array the pilots list
3758
-	*
3759
-	*/
3755
+		  * Gets all pilots that have flown over
3756
+		  *
3757
+		  * @return Array the pilots list
3758
+		  *
3759
+		  */
3760 3760
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3761 3761
 	{
3762 3762
 		global $globalDBdriver;
3763 3763
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3764 3764
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
3765
-                if ($olderthanmonths > 0) {
3766
-            		if ($globalDBdriver == 'mysql') {
3765
+				if ($olderthanmonths > 0) {
3766
+					if ($globalDBdriver == 'mysql') {
3767 3767
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3768 3768
 			} else {
3769 3769
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3770 3770
 			}
3771 3771
 		}
3772
-                if ($sincedate != '') {
3773
-            		if ($globalDBdriver == 'mysql') {
3772
+				if ($sincedate != '') {
3773
+					if ($globalDBdriver == 'mysql') {
3774 3774
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3775 3775
 			} else {
3776 3776
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3799,26 +3799,26 @@  discard block
 block discarded – undo
3799 3799
 	}
3800 3800
 	
3801 3801
 	 /**
3802
-	* Gets all owner that have flown over
3803
-	*
3804
-	* @return Array the pilots list
3805
-	*
3806
-	*/
3802
+	  * Gets all owner that have flown over
3803
+	  *
3804
+	  * @return Array the pilots list
3805
+	  *
3806
+	  */
3807 3807
 	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3808 3808
 	{
3809 3809
 		global $globalDBdriver;
3810 3810
 		$filter_query = $this->getFilter($filters,true,true);
3811 3811
 		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3812 3812
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3813
-                if ($olderthanmonths > 0) {
3814
-            		if ($globalDBdriver == 'mysql') {
3813
+				if ($olderthanmonths > 0) {
3814
+					if ($globalDBdriver == 'mysql') {
3815 3815
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3816 3816
 			} else {
3817 3817
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3818 3818
 			}
3819 3819
 		}
3820
-                if ($sincedate != '') {
3821
-            		if ($globalDBdriver == 'mysql') {
3820
+				if ($sincedate != '') {
3821
+					if ($globalDBdriver == 'mysql') {
3822 3822
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3823 3823
 			} else {
3824 3824
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3844,26 +3844,26 @@  discard block
 block discarded – undo
3844 3844
 	}
3845 3845
 	
3846 3846
 	 /**
3847
-	* Gets all owner that have flown over
3848
-	*
3849
-	* @return Array the pilots list
3850
-	*
3851
-	*/
3847
+	  * Gets all owner that have flown over
3848
+	  *
3849
+	  * @return Array the pilots list
3850
+	  *
3851
+	  */
3852 3852
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3853 3853
 	{
3854 3854
 		global $globalDBdriver;
3855 3855
 		$filter_query = $this->getFilter($filters,true,true);
3856 3856
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3857 3857
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3858
-                if ($olderthanmonths > 0) {
3859
-            		if ($globalDBdriver == 'mysql') {
3858
+				if ($olderthanmonths > 0) {
3859
+					if ($globalDBdriver == 'mysql') {
3860 3860
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3861 3861
 			} else {
3862 3862
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3863 3863
 			}
3864 3864
 		}
3865
-                if ($sincedate != '') {
3866
-            		if ($globalDBdriver == 'mysql') {
3865
+				if ($sincedate != '') {
3866
+					if ($globalDBdriver == 'mysql') {
3867 3867
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3868 3868
 			} else {
3869 3869
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3890,11 +3890,11 @@  discard block
 block discarded – undo
3890 3890
 	}
3891 3891
 
3892 3892
 	/**
3893
-	* Gets all airlines that have flown over by aircraft
3894
-	*
3895
-	* @return Array the airline list
3896
-	*
3897
-	*/
3893
+	 * Gets all airlines that have flown over by aircraft
3894
+	 *
3895
+	 * @return Array the airline list
3896
+	 *
3897
+	 */
3898 3898
 	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
3899 3899
 	{
3900 3900
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3926,11 +3926,11 @@  discard block
 block discarded – undo
3926 3926
 
3927 3927
 
3928 3928
 	/**
3929
-	* Gets all airline countries that have flown over by aircraft
3930
-	*
3931
-	* @return Array the airline country list
3932
-	*
3933
-	*/
3929
+	 * Gets all airline countries that have flown over by aircraft
3930
+	 *
3931
+	 * @return Array the airline country list
3932
+	 *
3933
+	 */
3934 3934
 	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
3935 3935
 	{
3936 3936
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3962,11 +3962,11 @@  discard block
 block discarded – undo
3962 3962
 	
3963 3963
 	
3964 3964
 	/**
3965
-	* Gets all airlines that have flown over by airport
3966
-	*
3967
-	* @return Array the airline list
3968
-	*
3969
-	*/
3965
+	 * Gets all airlines that have flown over by airport
3966
+	 *
3967
+	 * @return Array the airline list
3968
+	 *
3969
+	 */
3970 3970
 	public function countAllAirlinesByAirport($airport_icao,$filters = array())
3971 3971
 	{
3972 3972
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -3997,11 +3997,11 @@  discard block
 block discarded – undo
3997 3997
 
3998 3998
 
3999 3999
 	/**
4000
-	* Gets all airline countries that have flown over by airport icao
4001
-	*
4002
-	* @return Array the airline country list
4003
-	*
4004
-	*/
4000
+	 * Gets all airline countries that have flown over by airport icao
4001
+	 *
4002
+	 * @return Array the airline country list
4003
+	 *
4004
+	 */
4005 4005
 	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4006 4006
 	{
4007 4007
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4031,11 +4031,11 @@  discard block
 block discarded – undo
4031 4031
 
4032 4032
 
4033 4033
 	/**
4034
-	* Gets all airlines that have flown over by aircraft manufacturer
4035
-	*
4036
-	* @return Array the airline list
4037
-	*
4038
-	*/
4034
+	 * Gets all airlines that have flown over by aircraft manufacturer
4035
+	 *
4036
+	 * @return Array the airline list
4037
+	 *
4038
+	 */
4039 4039
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4040 4040
 	{
4041 4041
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4066,11 +4066,11 @@  discard block
 block discarded – undo
4066 4066
 
4067 4067
 
4068 4068
 	/**
4069
-	* Gets all airline countries that have flown over by aircraft manufacturer
4070
-	*
4071
-	* @return Array the airline country list
4072
-	*
4073
-	*/
4069
+	 * Gets all airline countries that have flown over by aircraft manufacturer
4070
+	 *
4071
+	 * @return Array the airline country list
4072
+	 *
4073
+	 */
4074 4074
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4075 4075
 	{
4076 4076
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4099,11 +4099,11 @@  discard block
 block discarded – undo
4099 4099
 
4100 4100
 
4101 4101
 	/**
4102
-	* Gets all airlines that have flown over by date
4103
-	*
4104
-	* @return Array the airline list
4105
-	*
4106
-	*/
4102
+	 * Gets all airlines that have flown over by date
4103
+	 *
4104
+	 * @return Array the airline list
4105
+	 *
4106
+	 */
4107 4107
 	public function countAllAirlinesByDate($date,$filters = array())
4108 4108
 	{
4109 4109
 		global $globalTimezone, $globalDBdriver;
@@ -4147,11 +4147,11 @@  discard block
 block discarded – undo
4147 4147
 	
4148 4148
 	
4149 4149
 	/**
4150
-	* Gets all airline countries that have flown over by date
4151
-	*
4152
-	* @return Array the airline country list
4153
-	*
4154
-	*/
4150
+	 * Gets all airline countries that have flown over by date
4151
+	 *
4152
+	 * @return Array the airline country list
4153
+	 *
4154
+	 */
4155 4155
 	public function countAllAirlineCountriesByDate($date,$filters = array())
4156 4156
 	{
4157 4157
 		global $globalTimezone, $globalDBdriver;
@@ -4194,11 +4194,11 @@  discard block
 block discarded – undo
4194 4194
 
4195 4195
 
4196 4196
 	/**
4197
-	* Gets all airlines that have flown over by ident/callsign
4198
-	*
4199
-	* @return Array the airline list
4200
-	*
4201
-	*/
4197
+	 * Gets all airlines that have flown over by ident/callsign
4198
+	 *
4199
+	 * @return Array the airline list
4200
+	 *
4201
+	 */
4202 4202
 	public function countAllAirlinesByIdent($ident,$filters = array())
4203 4203
 	{
4204 4204
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4228,11 +4228,11 @@  discard block
 block discarded – undo
4228 4228
 	}
4229 4229
 
4230 4230
 	/**
4231
-	* Gets all airlines that have flown over by route
4232
-	*
4233
-	* @return Array the airline list
4234
-	*
4235
-	*/
4231
+	 * Gets all airlines that have flown over by route
4232
+	 *
4233
+	 * @return Array the airline list
4234
+	 *
4235
+	 */
4236 4236
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4237 4237
 	{
4238 4238
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4264,11 +4264,11 @@  discard block
 block discarded – undo
4264 4264
 	}
4265 4265
 
4266 4266
 	/**
4267
-	* Gets all airline countries that have flown over by route
4268
-	*
4269
-	* @return Array the airline country list
4270
-	*
4271
-	*/
4267
+	 * Gets all airline countries that have flown over by route
4268
+	 *
4269
+	 * @return Array the airline country list
4270
+	 *
4271
+	 */
4272 4272
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4273 4273
 	{
4274 4274
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4300,11 +4300,11 @@  discard block
 block discarded – undo
4300 4300
 
4301 4301
 
4302 4302
 	/**
4303
-	* Gets all airlines that have flown over by country
4304
-	*
4305
-	* @return Array the airline list
4306
-	*
4307
-	*/
4303
+	 * Gets all airlines that have flown over by country
4304
+	 *
4305
+	 * @return Array the airline list
4306
+	 *
4307
+	 */
4308 4308
 	public function countAllAirlinesByCountry($country,$filters = array())
4309 4309
 	{
4310 4310
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4334,11 +4334,11 @@  discard block
 block discarded – undo
4334 4334
 
4335 4335
 
4336 4336
 	/**
4337
-	* Gets all airline countries that have flown over by country
4338
-	*
4339
-	* @return Array the airline country list
4340
-	*
4341
-	*/
4337
+	 * Gets all airline countries that have flown over by country
4338
+	 *
4339
+	 * @return Array the airline country list
4340
+	 *
4341
+	 */
4342 4342
 	public function countAllAirlineCountriesByCountry($country,$filters = array())
4343 4343
 	{
4344 4344
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4367,11 +4367,11 @@  discard block
 block discarded – undo
4367 4367
 
4368 4368
 
4369 4369
 	/**
4370
-	* Gets all airlines countries
4371
-	*
4372
-	* @return Array the airline country list
4373
-	*
4374
-	*/
4370
+	 * Gets all airlines countries
4371
+	 *
4372
+	 * @return Array the airline country list
4373
+	 *
4374
+	 */
4375 4375
 	public function countAllAirlineCountries($limit = true, $filters = array())
4376 4376
 	{
4377 4377
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4397,11 +4397,11 @@  discard block
 block discarded – undo
4397 4397
 	}
4398 4398
 
4399 4399
 	/**
4400
-	* Gets all number of flight over countries
4401
-	*
4402
-	* @return Array the airline country list
4403
-	*
4404
-	*/
4400
+	 * Gets all number of flight over countries
4401
+	 *
4402
+	 * @return Array the airline country list
4403
+	 *
4404
+	 */
4405 4405
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4406 4406
 	{
4407 4407
 		global $globalDBdriver;
@@ -4423,15 +4423,15 @@  discard block
 block discarded – undo
4423 4423
 		$SpotterLive = new SpotterLive();
4424 4424
 		$filter_query = $SpotterLive->getFilter($filters,true,true);
4425 4425
 		$filter_query .= ' over_country IS NOT NULL';
4426
-                if ($olderthanmonths > 0) {
4426
+				if ($olderthanmonths > 0) {
4427 4427
 			if ($globalDBdriver == 'mysql') {
4428 4428
 				$filter_query .= ' AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
4429 4429
 			} else {
4430 4430
 				$filter_query .= " AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4431 4431
 			}
4432 4432
 		}
4433
-                if ($sincedate != '') {
4434
-            		if ($globalDBdriver == 'mysql') {
4433
+				if ($sincedate != '') {
4434
+					if ($globalDBdriver == 'mysql') {
4435 4435
 				$filter_query .= " AND spotter_live.date > '".$sincedate."' ";
4436 4436
 			} else {
4437 4437
 				$filter_query .= " AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4461,11 +4461,11 @@  discard block
 block discarded – undo
4461 4461
 	
4462 4462
 	
4463 4463
 	/**
4464
-	* Gets all aircraft types that have flown over
4465
-	*
4466
-	* @return Array the aircraft list
4467
-	*
4468
-	*/
4464
+	 * Gets all aircraft types that have flown over
4465
+	 *
4466
+	 * @return Array the aircraft list
4467
+	 *
4468
+	 */
4469 4469
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4470 4470
 	{
4471 4471
 		global $globalDBdriver;
@@ -4508,11 +4508,11 @@  discard block
 block discarded – undo
4508 4508
 	}
4509 4509
 
4510 4510
 	/**
4511
-	* Gets all aircraft types that have flown over by airline
4512
-	*
4513
-	* @return Array the aircraft list
4514
-	*
4515
-	*/
4511
+	 * Gets all aircraft types that have flown over by airline
4512
+	 *
4513
+	 * @return Array the aircraft list
4514
+	 *
4515
+	 */
4516 4516
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4517 4517
 	{
4518 4518
 		global $globalDBdriver;
@@ -4555,11 +4555,11 @@  discard block
 block discarded – undo
4555 4555
 	}
4556 4556
 
4557 4557
 	/**
4558
-	* Gets all aircraft types that have flown over by months
4559
-	*
4560
-	* @return Array the aircraft list
4561
-	*
4562
-	*/
4558
+	 * Gets all aircraft types that have flown over by months
4559
+	 *
4560
+	 * @return Array the aircraft list
4561
+	 *
4562
+	 */
4563 4563
 	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4564 4564
 	{
4565 4565
 		global $globalDBdriver;
@@ -4603,11 +4603,11 @@  discard block
 block discarded – undo
4603 4603
 
4604 4604
 
4605 4605
 	/**
4606
-	* Gets all aircraft registration that have flown over by aircaft icao
4607
-	*
4608
-	* @return Array the aircraft list
4609
-	*
4610
-	*/
4606
+	 * Gets all aircraft registration that have flown over by aircaft icao
4607
+	 *
4608
+	 * @return Array the aircraft list
4609
+	 *
4610
+	 */
4611 4611
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
4612 4612
 	{
4613 4613
 		$Image = new Image($this->db);
@@ -4646,11 +4646,11 @@  discard block
 block discarded – undo
4646 4646
 
4647 4647
 
4648 4648
 	/**
4649
-	* Gets all aircraft types that have flown over by airline icao
4650
-	*
4651
-	* @return Array the aircraft list
4652
-	*
4653
-	*/
4649
+	 * Gets all aircraft types that have flown over by airline icao
4650
+	 *
4651
+	 * @return Array the aircraft list
4652
+	 *
4653
+	 */
4654 4654
 	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
4655 4655
 	{
4656 4656
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4679,11 +4679,11 @@  discard block
 block discarded – undo
4679 4679
 
4680 4680
 
4681 4681
 	/**
4682
-	* Gets all aircraft registration that have flown over by airline icao
4683
-	*
4684
-	* @return Array the aircraft list
4685
-	*
4686
-	*/
4682
+	 * Gets all aircraft registration that have flown over by airline icao
4683
+	 *
4684
+	 * @return Array the aircraft list
4685
+	 *
4686
+	 */
4687 4687
 	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
4688 4688
 	{
4689 4689
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4721,11 +4721,11 @@  discard block
 block discarded – undo
4721 4721
 
4722 4722
 
4723 4723
 	/**
4724
-	* Gets all aircraft manufacturer that have flown over by airline icao
4725
-	*
4726
-	* @return Array the aircraft list
4727
-	*
4728
-	*/
4724
+	 * Gets all aircraft manufacturer that have flown over by airline icao
4725
+	 *
4726
+	 * @return Array the aircraft list
4727
+	 *
4728
+	 */
4729 4729
 	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
4730 4730
 	{
4731 4731
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4753,11 +4753,11 @@  discard block
 block discarded – undo
4753 4753
 
4754 4754
 
4755 4755
 	/**
4756
-	* Gets all aircraft types that have flown over by airline icao
4757
-	*
4758
-	* @return Array the aircraft list
4759
-	*
4760
-	*/
4756
+	 * Gets all aircraft types that have flown over by airline icao
4757
+	 *
4758
+	 * @return Array the aircraft list
4759
+	 *
4760
+	 */
4761 4761
 	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
4762 4762
 	{
4763 4763
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4786,11 +4786,11 @@  discard block
 block discarded – undo
4786 4786
 
4787 4787
 
4788 4788
 	/**
4789
-	* Gets all aircraft registration that have flown over by airport icao
4790
-	*
4791
-	* @return Array the aircraft list
4792
-	*
4793
-	*/
4789
+	 * Gets all aircraft registration that have flown over by airport icao
4790
+	 *
4791
+	 * @return Array the aircraft list
4792
+	 *
4793
+	 */
4794 4794
 	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
4795 4795
 	{
4796 4796
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4827,11 +4827,11 @@  discard block
 block discarded – undo
4827 4827
 	
4828 4828
 	
4829 4829
 	/**
4830
-	* Gets all aircraft manufacturer that have flown over by airport icao
4831
-	*
4832
-	* @return Array the aircraft list
4833
-	*
4834
-	*/
4830
+	 * Gets all aircraft manufacturer that have flown over by airport icao
4831
+	 *
4832
+	 * @return Array the aircraft list
4833
+	 *
4834
+	 */
4835 4835
 	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
4836 4836
 	{
4837 4837
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4857,11 +4857,11 @@  discard block
 block discarded – undo
4857 4857
 	}
4858 4858
 
4859 4859
 	/**
4860
-	* Gets all aircraft types that have flown over by aircraft manufacturer
4861
-	*
4862
-	* @return Array the aircraft list
4863
-	*
4864
-	*/
4860
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
4861
+	 *
4862
+	 * @return Array the aircraft list
4863
+	 *
4864
+	 */
4865 4865
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
4866 4866
 	{
4867 4867
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4888,11 +4888,11 @@  discard block
 block discarded – undo
4888 4888
 
4889 4889
 
4890 4890
 	/**
4891
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
4892
-	*
4893
-	* @return Array the aircraft list
4894
-	*
4895
-	*/
4891
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
4892
+	 *
4893
+	 * @return Array the aircraft list
4894
+	 *
4895
+	 */
4896 4896
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
4897 4897
 	{
4898 4898
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4928,11 +4928,11 @@  discard block
 block discarded – undo
4928 4928
 	}
4929 4929
 
4930 4930
 	/**
4931
-	* Gets all aircraft types that have flown over by date
4932
-	*
4933
-	* @return Array the aircraft list
4934
-	*
4935
-	*/
4931
+	 * Gets all aircraft types that have flown over by date
4932
+	 *
4933
+	 * @return Array the aircraft list
4934
+	 *
4935
+	 */
4936 4936
 	public function countAllAircraftTypesByDate($date,$filters = array())
4937 4937
 	{
4938 4938
 		global $globalTimezone, $globalDBdriver;
@@ -4974,11 +4974,11 @@  discard block
 block discarded – undo
4974 4974
 
4975 4975
 
4976 4976
 	/**
4977
-	* Gets all aircraft registration that have flown over by date
4978
-	*
4979
-	* @return Array the aircraft list
4980
-	*
4981
-	*/
4977
+	 * Gets all aircraft registration that have flown over by date
4978
+	 *
4979
+	 * @return Array the aircraft list
4980
+	 *
4981
+	 */
4982 4982
 	public function countAllAircraftRegistrationByDate($date,$filters = array())
4983 4983
 	{
4984 4984
 		global $globalTimezone, $globalDBdriver;
@@ -5029,11 +5029,11 @@  discard block
 block discarded – undo
5029 5029
 
5030 5030
 
5031 5031
 	/**
5032
-	* Gets all aircraft manufacturer that have flown over by date
5033
-	*
5034
-	* @return Array the aircraft manufacturer list
5035
-	*
5036
-	*/
5032
+	 * Gets all aircraft manufacturer that have flown over by date
5033
+	 *
5034
+	 * @return Array the aircraft manufacturer list
5035
+	 *
5036
+	 */
5037 5037
 	public function countAllAircraftManufacturerByDate($date,$filters = array())
5038 5038
 	{
5039 5039
 		global $globalTimezone, $globalDBdriver;
@@ -5075,11 +5075,11 @@  discard block
 block discarded – undo
5075 5075
 
5076 5076
 
5077 5077
 	/**
5078
-	* Gets all aircraft types that have flown over by ident/callsign
5079
-	*
5080
-	* @return Array the aircraft list
5081
-	*
5082
-	*/
5078
+	 * Gets all aircraft types that have flown over by ident/callsign
5079
+	 *
5080
+	 * @return Array the aircraft list
5081
+	 *
5082
+	 */
5083 5083
 	public function countAllAircraftTypesByIdent($ident,$filters = array())
5084 5084
 	{
5085 5085
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5108,11 +5108,11 @@  discard block
 block discarded – undo
5108 5108
 
5109 5109
 
5110 5110
 	/**
5111
-	* Gets all aircraft registration that have flown over by ident/callsign
5112
-	*
5113
-	* @return Array the aircraft list
5114
-	*
5115
-	*/
5111
+	 * Gets all aircraft registration that have flown over by ident/callsign
5112
+	 *
5113
+	 * @return Array the aircraft list
5114
+	 *
5115
+	 */
5116 5116
 	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5117 5117
 	{
5118 5118
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5152,11 +5152,11 @@  discard block
 block discarded – undo
5152 5152
 
5153 5153
 
5154 5154
 	/**
5155
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
5156
-	*
5157
-	* @return Array the aircraft manufacturer list
5158
-	*
5159
-	*/
5155
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
5156
+	 *
5157
+	 * @return Array the aircraft manufacturer list
5158
+	 *
5159
+	 */
5160 5160
 	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5161 5161
 	{
5162 5162
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5182,11 +5182,11 @@  discard block
 block discarded – undo
5182 5182
 
5183 5183
 
5184 5184
 	/**
5185
-	* Gets all aircraft types that have flown over by route
5186
-	*
5187
-	* @return Array the aircraft list
5188
-	*
5189
-	*/
5185
+	 * Gets all aircraft types that have flown over by route
5186
+	 *
5187
+	 * @return Array the aircraft list
5188
+	 *
5189
+	 */
5190 5190
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5191 5191
 	{
5192 5192
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5215,11 +5215,11 @@  discard block
 block discarded – undo
5215 5215
 	}
5216 5216
 
5217 5217
 	/**
5218
-	* Gets all aircraft registration that have flown over by route
5219
-	*
5220
-	* @return Array the aircraft list
5221
-	*
5222
-	*/
5218
+	 * Gets all aircraft registration that have flown over by route
5219
+	 *
5220
+	 * @return Array the aircraft list
5221
+	 *
5222
+	 */
5223 5223
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5224 5224
 	{
5225 5225
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5261,11 +5261,11 @@  discard block
 block discarded – undo
5261 5261
 	
5262 5262
 	
5263 5263
 	/**
5264
-	* Gets all aircraft manufacturer that have flown over by route
5265
-	*
5266
-	* @return Array the aircraft manufacturer list
5267
-	*
5268
-	*/
5264
+	 * Gets all aircraft manufacturer that have flown over by route
5265
+	 *
5266
+	 * @return Array the aircraft manufacturer list
5267
+	 *
5268
+	 */
5269 5269
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5270 5270
 	{
5271 5271
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5299,11 +5299,11 @@  discard block
 block discarded – undo
5299 5299
 	
5300 5300
 	
5301 5301
 	/**
5302
-	* Gets all aircraft types that have flown over by country
5303
-	*
5304
-	* @return Array the aircraft list
5305
-	*
5306
-	*/
5302
+	 * Gets all aircraft types that have flown over by country
5303
+	 *
5304
+	 * @return Array the aircraft list
5305
+	 *
5306
+	 */
5307 5307
 	public function countAllAircraftTypesByCountry($country,$filters = array())
5308 5308
 	{
5309 5309
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5334,11 +5334,11 @@  discard block
 block discarded – undo
5334 5334
 
5335 5335
 
5336 5336
 	/**
5337
-	* Gets all aircraft registration that have flown over by country
5338
-	*
5339
-	* @return Array the aircraft list
5340
-	*
5341
-	*/
5337
+	 * Gets all aircraft registration that have flown over by country
5338
+	 *
5339
+	 * @return Array the aircraft list
5340
+	 *
5341
+	 */
5342 5342
 	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5343 5343
 	{
5344 5344
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5378,11 +5378,11 @@  discard block
 block discarded – undo
5378 5378
 	
5379 5379
 	
5380 5380
 	/**
5381
-	* Gets all aircraft manufacturer that have flown over by country
5382
-	*
5383
-	* @return Array the aircraft manufacturer list
5384
-	*
5385
-	*/
5381
+	 * Gets all aircraft manufacturer that have flown over by country
5382
+	 *
5383
+	 * @return Array the aircraft manufacturer list
5384
+	 *
5385
+	 */
5386 5386
 	public function countAllAircraftManufacturerByCountry($country,$filters = array())
5387 5387
 	{
5388 5388
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5413,17 +5413,17 @@  discard block
 block discarded – undo
5413 5413
 	
5414 5414
 	
5415 5415
 	/**
5416
-	* Gets all aircraft manufacturers that have flown over
5417
-	*
5418
-	* @return Array the aircraft list
5419
-	*
5420
-	*/
5416
+	 * Gets all aircraft manufacturers that have flown over
5417
+	 *
5418
+	 * @return Array the aircraft list
5419
+	 *
5420
+	 */
5421 5421
 	public function countAllAircraftManufacturers($filters = array())
5422 5422
 	{
5423 5423
 		$filter_query = $this->getFilter($filters,true,true);
5424 5424
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5425 5425
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5426
-                $query .= " GROUP BY spotter_output.aircraft_manufacturer
5426
+				$query .= " GROUP BY spotter_output.aircraft_manufacturer
5427 5427
 					ORDER BY aircraft_manufacturer_count DESC
5428 5428
 					LIMIT 10";
5429 5429
       
@@ -5448,11 +5448,11 @@  discard block
 block discarded – undo
5448 5448
 	
5449 5449
 	
5450 5450
 	/**
5451
-	* Gets all aircraft registrations that have flown over
5452
-	*
5453
-	* @return Array the aircraft list
5454
-	*
5455
-	*/
5451
+	 * Gets all aircraft registrations that have flown over
5452
+	 *
5453
+	 * @return Array the aircraft list
5454
+	 *
5455
+	 */
5456 5456
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5457 5457
 	{
5458 5458
 		global $globalDBdriver;
@@ -5460,15 +5460,15 @@  discard block
 block discarded – undo
5460 5460
 		$filter_query = $this->getFilter($filters,true,true);
5461 5461
 		$query  = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
5462 5462
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5463
-                if ($olderthanmonths > 0) {
5464
-            		if ($globalDBdriver == 'mysql') {
5463
+				if ($olderthanmonths > 0) {
5464
+					if ($globalDBdriver == 'mysql') {
5465 5465
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5466 5466
 			} else {
5467 5467
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5468 5468
 			}
5469 5469
 		}
5470
-                if ($sincedate != '') {
5471
-            		if ($globalDBdriver == 'mysql') {
5470
+				if ($sincedate != '') {
5471
+					if ($globalDBdriver == 'mysql') {
5472 5472
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5473 5473
 			} else {
5474 5474
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5477,7 +5477,7 @@  discard block
 block discarded – undo
5477 5477
 
5478 5478
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5479 5479
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5480
-                $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5480
+				$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5481 5481
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5482 5482
 		
5483 5483
 		$sth = $this->db->prepare($query);
@@ -5508,11 +5508,11 @@  discard block
 block discarded – undo
5508 5508
 
5509 5509
 
5510 5510
 	/**
5511
-	* Gets all aircraft registrations that have flown over
5512
-	*
5513
-	* @return Array the aircraft list
5514
-	*
5515
-	*/
5511
+	 * Gets all aircraft registrations that have flown over
5512
+	 *
5513
+	 * @return Array the aircraft list
5514
+	 *
5515
+	 */
5516 5516
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5517 5517
 	{
5518 5518
 		global $globalDBdriver;
@@ -5520,15 +5520,15 @@  discard block
 block discarded – undo
5520 5520
 		$Image = new Image($this->db);
5521 5521
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
5522 5522
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5523
-                if ($olderthanmonths > 0) {
5524
-            		if ($globalDBdriver == 'mysql') {
5523
+				if ($olderthanmonths > 0) {
5524
+					if ($globalDBdriver == 'mysql') {
5525 5525
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5526 5526
 			} else {
5527 5527
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5528 5528
 			}
5529 5529
 		}
5530
-                if ($sincedate != '') {
5531
-            		if ($globalDBdriver == 'mysql') {
5530
+				if ($sincedate != '') {
5531
+					if ($globalDBdriver == 'mysql') {
5532 5532
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5533 5533
 			} else {
5534 5534
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5537,7 +5537,7 @@  discard block
 block discarded – undo
5537 5537
 
5538 5538
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5539 5539
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5540
-                $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";
5540
+				$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";
5541 5541
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5542 5542
 		
5543 5543
 		$sth = $this->db->prepare($query);
@@ -5569,35 +5569,35 @@  discard block
 block discarded – undo
5569 5569
 	
5570 5570
 	
5571 5571
 	/**
5572
-	* Gets all departure airports of the airplanes that have flown over
5573
-	*
5574
-	* @return Array the airport list
5575
-	*
5576
-	*/
5572
+	 * Gets all departure airports of the airplanes that have flown over
5573
+	 *
5574
+	 * @return Array the airport list
5575
+	 *
5576
+	 */
5577 5577
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5578 5578
 	{
5579 5579
 		global $globalDBdriver;
5580 5580
 		$filter_query = $this->getFilter($filters,true,true);
5581 5581
 		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5582 5582
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA'";
5583
-                if ($olderthanmonths > 0) {
5584
-            		if ($globalDBdriver == 'mysql') {
5583
+				if ($olderthanmonths > 0) {
5584
+					if ($globalDBdriver == 'mysql') {
5585 5585
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5586 5586
 			} else {
5587 5587
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5588 5588
 			}
5589
-                }
5590
-                if ($sincedate != '') {
5591
-            		if ($globalDBdriver == 'mysql') {
5589
+				}
5590
+				if ($sincedate != '') {
5591
+					if ($globalDBdriver == 'mysql') {
5592 5592
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5593 5593
 			} else {
5594 5594
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5595 5595
 			}
5596 5596
 		}
5597 5597
 
5598
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5599
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5600
-                $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5598
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5599
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5600
+				$query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5601 5601
 				ORDER BY airport_departure_icao_count DESC";
5602 5602
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5603 5603
       
@@ -5621,35 +5621,35 @@  discard block
 block discarded – undo
5621 5621
 	}
5622 5622
 
5623 5623
 	/**
5624
-	* Gets all departure airports of the airplanes that have flown over
5625
-	*
5626
-	* @return Array the airport list
5627
-	*
5628
-	*/
5624
+	 * Gets all departure airports of the airplanes that have flown over
5625
+	 *
5626
+	 * @return Array the airport list
5627
+	 *
5628
+	 */
5629 5629
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5630 5630
 	{
5631 5631
 		global $globalDBdriver;
5632 5632
 		$filter_query = $this->getFilter($filters,true,true);
5633 5633
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5634 5634
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' ";
5635
-                if ($olderthanmonths > 0) {
5636
-            		if ($globalDBdriver == 'mysql') {
5635
+				if ($olderthanmonths > 0) {
5636
+					if ($globalDBdriver == 'mysql') {
5637 5637
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5638 5638
 			} else {
5639 5639
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5640 5640
 			}
5641
-                }
5642
-                if ($sincedate != '') {
5643
-            		if ($globalDBdriver == 'mysql') {
5641
+				}
5642
+				if ($sincedate != '') {
5643
+					if ($globalDBdriver == 'mysql') {
5644 5644
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5645 5645
 			} else {
5646 5646
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5647 5647
 			}
5648 5648
 		}
5649 5649
 
5650
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5651
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5652
-                $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
5650
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5651
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5652
+				$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
5653 5653
 				ORDER BY airport_departure_icao_count DESC";
5654 5654
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5655 5655
       
@@ -5674,37 +5674,37 @@  discard block
 block discarded – undo
5674 5674
 	}
5675 5675
 
5676 5676
 	/**
5677
-	* Gets all detected departure airports of the airplanes that have flown over
5678
-	*
5679
-	* @return Array the airport list
5680
-	*
5681
-	*/
5677
+	 * Gets all detected departure airports of the airplanes that have flown over
5678
+	 *
5679
+	 * @return Array the airport list
5680
+	 *
5681
+	 */
5682 5682
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5683 5683
 	{
5684 5684
 		global $globalDBdriver;
5685 5685
 		$filter_query = $this->getFilter($filters,true,true);
5686 5686
 		$query  = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
5687 5687
 				FROM airport, spotter_output".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao";
5688
-                if ($olderthanmonths > 0) {
5689
-            		if ($globalDBdriver == 'mysql') {
5688
+				if ($olderthanmonths > 0) {
5689
+					if ($globalDBdriver == 'mysql') {
5690 5690
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5691 5691
 			} else {
5692 5692
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5693 5693
 			}
5694
-                }
5695
-                if ($sincedate != '') {
5696
-            		if ($globalDBdriver == 'mysql') {
5694
+				}
5695
+				if ($sincedate != '') {
5696
+					if ($globalDBdriver == 'mysql') {
5697 5697
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5698 5698
 			} else {
5699 5699
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5700 5700
 			}
5701 5701
 		}
5702
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5703
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5704
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5702
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5703
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5704
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5705 5705
 				ORDER BY airport_departure_icao_count DESC";
5706 5706
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5707
-    		//echo $query;
5707
+			//echo $query;
5708 5708
 		$sth = $this->db->prepare($query);
5709 5709
 		$sth->execute();
5710 5710
       
@@ -5725,35 +5725,35 @@  discard block
 block discarded – undo
5725 5725
 	}
5726 5726
 	
5727 5727
 	/**
5728
-	* Gets all detected departure airports of the airplanes that have flown over
5729
-	*
5730
-	* @return Array the airport list
5731
-	*
5732
-	*/
5728
+	 * Gets all detected departure airports of the airplanes that have flown over
5729
+	 *
5730
+	 * @return Array the airport list
5731
+	 *
5732
+	 */
5733 5733
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5734 5734
 	{
5735 5735
 		global $globalDBdriver;
5736 5736
 		$filter_query = $this->getFilter($filters,true,true);
5737 5737
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
5738 5738
 				FROM airport, spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao ";
5739
-                if ($olderthanmonths > 0) {
5740
-            		if ($globalDBdriver == 'mysql') {
5739
+				if ($olderthanmonths > 0) {
5740
+					if ($globalDBdriver == 'mysql') {
5741 5741
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5742 5742
 			} else {
5743 5743
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5744 5744
 			}
5745
-                }
5746
-                if ($sincedate != '') {
5747
-            		if ($globalDBdriver == 'mysql') {
5745
+				}
5746
+				if ($sincedate != '') {
5747
+					if ($globalDBdriver == 'mysql') {
5748 5748
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5749 5749
 			} else {
5750 5750
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
5751 5751
 			}
5752 5752
 		}
5753 5753
 
5754
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5755
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5756
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5754
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5755
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5756
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5757 5757
 				ORDER BY airport_departure_icao_count DESC";
5758 5758
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5759 5759
       
@@ -5778,11 +5778,11 @@  discard block
 block discarded – undo
5778 5778
 	}	
5779 5779
 	
5780 5780
 	/**
5781
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
5782
-	*
5783
-	* @return Array the airport list
5784
-	*
5785
-	*/
5781
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
5782
+	 *
5783
+	 * @return Array the airport list
5784
+	 *
5785
+	 */
5786 5786
 	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
5787 5787
 	{
5788 5788
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5816,11 +5816,11 @@  discard block
 block discarded – undo
5816 5816
 	
5817 5817
 	
5818 5818
 	/**
5819
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5820
-	*
5821
-	* @return Array the airport list
5822
-	*
5823
-	*/
5819
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5820
+	 *
5821
+	 * @return Array the airport list
5822
+	 *
5823
+	 */
5824 5824
 	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
5825 5825
 	{
5826 5826
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5851,11 +5851,11 @@  discard block
 block discarded – undo
5851 5851
 	
5852 5852
 	
5853 5853
 	/**
5854
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5855
-	*
5856
-	* @return Array the airport list
5857
-	*
5858
-	*/
5854
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5855
+	 *
5856
+	 * @return Array the airport list
5857
+	 *
5858
+	 */
5859 5859
 	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
5860 5860
 	{
5861 5861
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5888,11 +5888,11 @@  discard block
 block discarded – undo
5888 5888
 	
5889 5889
 	
5890 5890
 	/**
5891
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5892
-	*
5893
-	* @return Array the airport list
5894
-	*
5895
-	*/
5891
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5892
+	 *
5893
+	 * @return Array the airport list
5894
+	 *
5895
+	 */
5896 5896
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
5897 5897
 	{
5898 5898
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5922,11 +5922,11 @@  discard block
 block discarded – undo
5922 5922
 	
5923 5923
 	
5924 5924
 	/**
5925
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5926
-	*
5927
-	* @return Array the airport list
5928
-	*
5929
-	*/
5925
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5926
+	 *
5927
+	 * @return Array the airport list
5928
+	 *
5929
+	 */
5930 5930
 	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
5931 5931
 	{
5932 5932
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5959,11 +5959,11 @@  discard block
 block discarded – undo
5959 5959
 	
5960 5960
 	
5961 5961
 	/**
5962
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
5963
-	*
5964
-	* @return Array the airport list
5965
-	*
5966
-	*/
5962
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
5963
+	 *
5964
+	 * @return Array the airport list
5965
+	 *
5966
+	 */
5967 5967
 	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
5968 5968
 	{
5969 5969
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5993,11 +5993,11 @@  discard block
 block discarded – undo
5993 5993
 	
5994 5994
 	
5995 5995
 	/**
5996
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
5997
-	*
5998
-	* @return Array the airport list
5999
-	*
6000
-	*/
5996
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
5997
+	 *
5998
+	 * @return Array the airport list
5999
+	 *
6000
+	 */
6001 6001
 	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
6002 6002
 	{
6003 6003
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6030,11 +6030,11 @@  discard block
 block discarded – undo
6030 6030
 	
6031 6031
 	
6032 6032
 	/**
6033
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
6034
-	*
6035
-	* @return Array the airport list
6036
-	*
6037
-	*/
6033
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
6034
+	 *
6035
+	 * @return Array the airport list
6036
+	 *
6037
+	 */
6038 6038
 	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
6039 6039
 	{
6040 6040
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6065,11 +6065,11 @@  discard block
 block discarded – undo
6065 6065
 	
6066 6066
 	
6067 6067
 	/**
6068
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
6069
-	*
6070
-	* @return Array the airport list
6071
-	*
6072
-	*/
6068
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
6069
+	 *
6070
+	 * @return Array the airport list
6071
+	 *
6072
+	 */
6073 6073
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6074 6074
 	{
6075 6075
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6102,11 +6102,11 @@  discard block
 block discarded – undo
6102 6102
 	
6103 6103
 	
6104 6104
 	/**
6105
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
6106
-	*
6107
-	* @return Array the airport list
6108
-	*
6109
-	*/
6105
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
6106
+	 *
6107
+	 * @return Array the airport list
6108
+	 *
6109
+	 */
6110 6110
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6111 6111
 	{
6112 6112
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6136,11 +6136,11 @@  discard block
 block discarded – undo
6136 6136
 	
6137 6137
 	
6138 6138
 	/**
6139
-	* Gets all departure airports of the airplanes that have flown over based on a date
6140
-	*
6141
-	* @return Array the airport list
6142
-	*
6143
-	*/
6139
+	 * Gets all departure airports of the airplanes that have flown over based on a date
6140
+	 *
6141
+	 * @return Array the airport list
6142
+	 *
6143
+	 */
6144 6144
 	public function countAllDepartureAirportsByDate($date,$filters = array())
6145 6145
 	{
6146 6146
 		global $globalTimezone, $globalDBdriver;
@@ -6186,11 +6186,11 @@  discard block
 block discarded – undo
6186 6186
 	
6187 6187
 	
6188 6188
 	/**
6189
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
6190
-	*
6191
-	* @return Array the airport list
6192
-	*
6193
-	*/
6189
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
6190
+	 *
6191
+	 * @return Array the airport list
6192
+	 *
6193
+	 */
6194 6194
 	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6195 6195
 	{
6196 6196
 		global $globalTimezone, $globalDBdriver;
@@ -6233,11 +6233,11 @@  discard block
 block discarded – undo
6233 6233
 	
6234 6234
 	
6235 6235
 	/**
6236
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6237
-	*
6238
-	* @return Array the airport list
6239
-	*
6240
-	*/
6236
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6237
+	 *
6238
+	 * @return Array the airport list
6239
+	 *
6240
+	 */
6241 6241
 	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6242 6242
 	{
6243 6243
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6271,11 +6271,11 @@  discard block
 block discarded – undo
6271 6271
 	
6272 6272
 	
6273 6273
 	/**
6274
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6275
-	*
6276
-	* @return Array the airport list
6277
-	*
6278
-	*/
6274
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6275
+	 *
6276
+	 * @return Array the airport list
6277
+	 *
6278
+	 */
6279 6279
 	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
6280 6280
 	{
6281 6281
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6306,11 +6306,11 @@  discard block
 block discarded – undo
6306 6306
 	
6307 6307
 	
6308 6308
 	/**
6309
-	* Gets all departure airports of the airplanes that have flown over based on a country
6310
-	*
6311
-	* @return Array the airport list
6312
-	*
6313
-	*/
6309
+	 * Gets all departure airports of the airplanes that have flown over based on a country
6310
+	 *
6311
+	 * @return Array the airport list
6312
+	 *
6313
+	 */
6314 6314
 	public function countAllDepartureAirportsByCountry($country,$filters = array())
6315 6315
 	{
6316 6316
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6344,11 +6344,11 @@  discard block
 block discarded – undo
6344 6344
 
6345 6345
 
6346 6346
 	/**
6347
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6348
-	*
6349
-	* @return Array the airport list
6350
-	*
6351
-	*/
6347
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6348
+	 *
6349
+	 * @return Array the airport list
6350
+	 *
6351
+	 */
6352 6352
 	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
6353 6353
 	{
6354 6354
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6378,40 +6378,40 @@  discard block
 block discarded – undo
6378 6378
 	
6379 6379
 
6380 6380
 	/**
6381
-	* Gets all arrival airports of the airplanes that have flown over
6382
-	*
6383
-	* @param Boolean $limit Limit result to 10 or not
6384
-	* @param Integer $olderthanmonths Only show result older than x months
6385
-	* @param String $sincedate Only show result since x date
6386
-	* @param Boolean $icaoaskey Show result by ICAO
6387
-	* @param Array $filters Filter used here
6388
-	* @return Array the airport list
6389
-	*
6390
-	*/
6381
+	 * Gets all arrival airports of the airplanes that have flown over
6382
+	 *
6383
+	 * @param Boolean $limit Limit result to 10 or not
6384
+	 * @param Integer $olderthanmonths Only show result older than x months
6385
+	 * @param String $sincedate Only show result since x date
6386
+	 * @param Boolean $icaoaskey Show result by ICAO
6387
+	 * @param Array $filters Filter used here
6388
+	 * @return Array the airport list
6389
+	 *
6390
+	 */
6391 6391
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6392 6392
 	{
6393 6393
 		global $globalDBdriver;
6394 6394
 		$filter_query = $this->getFilter($filters,true,true);
6395 6395
 		$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 
6396 6396
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
6397
-                if ($olderthanmonths > 0) {
6398
-            		if ($globalDBdriver == 'mysql') {
6397
+				if ($olderthanmonths > 0) {
6398
+					if ($globalDBdriver == 'mysql') {
6399 6399
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6400 6400
 			} else {
6401 6401
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6402 6402
 			}
6403 6403
 		}
6404
-                if ($sincedate != '') {
6405
-            		if ($globalDBdriver == 'mysql') {
6404
+				if ($sincedate != '') {
6405
+					if ($globalDBdriver == 'mysql') {
6406 6406
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6407 6407
 			} else {
6408 6408
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6409 6409
 			}
6410 6410
 		}
6411 6411
 
6412
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6413
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6414
-                $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6412
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6413
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6414
+				$query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6415 6415
 					ORDER BY airport_arrival_icao_count DESC";
6416 6416
 		if ($limit) $query .= " LIMIT 10";
6417 6417
       
@@ -6440,35 +6440,35 @@  discard block
 block discarded – undo
6440 6440
 	}
6441 6441
 
6442 6442
 	/**
6443
-	* Gets all arrival airports of the airplanes that have flown over
6444
-	*
6445
-	* @return Array the airport list
6446
-	*
6447
-	*/
6443
+	 * Gets all arrival airports of the airplanes that have flown over
6444
+	 *
6445
+	 * @return Array the airport list
6446
+	 *
6447
+	 */
6448 6448
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6449 6449
 	{
6450 6450
 		global $globalDBdriver;
6451 6451
 		$filter_query = $this->getFilter($filters,true,true);
6452 6452
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6453 6453
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' ";
6454
-                if ($olderthanmonths > 0) {
6455
-            		if ($globalDBdriver == 'mysql') {
6454
+				if ($olderthanmonths > 0) {
6455
+					if ($globalDBdriver == 'mysql') {
6456 6456
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6457 6457
 			} else {
6458 6458
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6459 6459
 			}
6460 6460
 		}
6461
-                if ($sincedate != '') {
6462
-            		if ($globalDBdriver == 'mysql') {
6461
+				if ($sincedate != '') {
6462
+					if ($globalDBdriver == 'mysql') {
6463 6463
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6464 6464
 			} else {
6465 6465
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6466 6466
 			}
6467 6467
 		}
6468 6468
 
6469
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6470
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6471
-                $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
6469
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6470
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6471
+				$query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6472 6472
 					ORDER BY airport_arrival_icao_count DESC";
6473 6473
 		if ($limit) $query .= " LIMIT 10";
6474 6474
       
@@ -6499,34 +6499,34 @@  discard block
 block discarded – undo
6499 6499
 
6500 6500
 
6501 6501
 	/**
6502
-	* Gets all detected arrival airports of the airplanes that have flown over
6503
-	*
6504
-	* @return Array the airport list
6505
-	*
6506
-	*/
6502
+	 * Gets all detected arrival airports of the airplanes that have flown over
6503
+	 *
6504
+	 * @return Array the airport list
6505
+	 *
6506
+	 */
6507 6507
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6508 6508
 	{
6509 6509
 		global $globalDBdriver;
6510 6510
 		$filter_query = $this->getFilter($filters,true,true);
6511 6511
 		$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 
6512 6512
 			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";
6513
-                if ($olderthanmonths > 0) {
6514
-            		if ($globalDBdriver == 'mysql') {
6513
+				if ($olderthanmonths > 0) {
6514
+					if ($globalDBdriver == 'mysql') {
6515 6515
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6516 6516
 			} else {
6517 6517
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6518 6518
 			}
6519 6519
 		}
6520
-                if ($sincedate != '') {
6521
-            		if ($globalDBdriver == 'mysql') {
6520
+				if ($sincedate != '') {
6521
+					if ($globalDBdriver == 'mysql') {
6522 6522
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6523 6523
 			} else {
6524 6524
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6525 6525
 			}
6526 6526
 		}
6527
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6528
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6529
-                $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6527
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6528
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6529
+				$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6530 6530
 					ORDER BY airport_arrival_icao_count DESC";
6531 6531
 		if ($limit) $query .= " LIMIT 10";
6532 6532
       
@@ -6555,35 +6555,35 @@  discard block
 block discarded – undo
6555 6555
 	}
6556 6556
 	
6557 6557
 	/**
6558
-	* Gets all detected arrival airports of the airplanes that have flown over
6559
-	*
6560
-	* @return Array the airport list
6561
-	*
6562
-	*/
6558
+	 * Gets all detected arrival airports of the airplanes that have flown over
6559
+	 *
6560
+	 * @return Array the airport list
6561
+	 *
6562
+	 */
6563 6563
 	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6564 6564
 	{
6565 6565
 		global $globalDBdriver;
6566 6566
 		$filter_query = $this->getFilter($filters,true,true);
6567 6567
 		$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 
6568 6568
 			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 ";
6569
-                if ($olderthanmonths > 0) {
6570
-            		if ($globalDBdriver == 'mysql') {
6569
+				if ($olderthanmonths > 0) {
6570
+					if ($globalDBdriver == 'mysql') {
6571 6571
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6572 6572
 			} else {
6573 6573
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6574 6574
 			}
6575 6575
 		}
6576
-                if ($sincedate != '') {
6577
-            		if ($globalDBdriver == 'mysql') {
6576
+				if ($sincedate != '') {
6577
+					if ($globalDBdriver == 'mysql') {
6578 6578
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6579 6579
 			} else {
6580 6580
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6581 6581
 			}
6582 6582
 		}
6583 6583
 
6584
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6585
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6586
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6584
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6585
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6586
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6587 6587
 					ORDER BY airport_arrival_icao_count DESC";
6588 6588
 		if ($limit) $query .= " LIMIT 10";
6589 6589
       
@@ -6613,11 +6613,11 @@  discard block
 block discarded – undo
6613 6613
 	}	
6614 6614
 	
6615 6615
 	/**
6616
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
6617
-	*
6618
-	* @return Array the airport list
6619
-	*
6620
-	*/
6616
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
6617
+	 *
6618
+	 * @return Array the airport list
6619
+	 *
6620
+	 */
6621 6621
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
6622 6622
 	{
6623 6623
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6649,11 +6649,11 @@  discard block
 block discarded – undo
6649 6649
 	
6650 6650
 	
6651 6651
 	/**
6652
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6653
-	*
6654
-	* @return Array the airport list
6655
-	*
6656
-	*/
6652
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6653
+	 *
6654
+	 * @return Array the airport list
6655
+	 *
6656
+	 */
6657 6657
 	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
6658 6658
 	{
6659 6659
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6684,11 +6684,11 @@  discard block
 block discarded – undo
6684 6684
 	
6685 6685
 	
6686 6686
 	/**
6687
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6688
-	*
6689
-	* @return Array the airport list
6690
-	*
6691
-	*/
6687
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6688
+	 *
6689
+	 * @return Array the airport list
6690
+	 *
6691
+	 */
6692 6692
 	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
6693 6693
 	{
6694 6694
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6722,11 +6722,11 @@  discard block
 block discarded – undo
6722 6722
 	
6723 6723
 	
6724 6724
 	/**
6725
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6726
-	*
6727
-	* @return Array the airport list
6728
-	*
6729
-	*/
6725
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6726
+	 *
6727
+	 * @return Array the airport list
6728
+	 *
6729
+	 */
6730 6730
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
6731 6731
 	{
6732 6732
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6756,11 +6756,11 @@  discard block
 block discarded – undo
6756 6756
 	
6757 6757
 	
6758 6758
 	/**
6759
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6760
-	*
6761
-	* @return Array the airport list
6762
-	*
6763
-	*/
6759
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6760
+	 *
6761
+	 * @return Array the airport list
6762
+	 *
6763
+	 */
6764 6764
 	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
6765 6765
 	{
6766 6766
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6794,11 +6794,11 @@  discard block
 block discarded – undo
6794 6794
 	
6795 6795
 	
6796 6796
 	/**
6797
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6798
-	*
6799
-	* @return Array the airport list
6800
-	*
6801
-	*/
6797
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6798
+	 *
6799
+	 * @return Array the airport list
6800
+	 *
6801
+	 */
6802 6802
 	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
6803 6803
 	{
6804 6804
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6829,11 +6829,11 @@  discard block
 block discarded – undo
6829 6829
 	
6830 6830
 	
6831 6831
 	/**
6832
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
6833
-	*
6834
-	* @return Array the airport list
6835
-	*
6836
-	*/
6832
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
6833
+	 *
6834
+	 * @return Array the airport list
6835
+	 *
6836
+	 */
6837 6837
 	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
6838 6838
 	{
6839 6839
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6866,11 +6866,11 @@  discard block
 block discarded – undo
6866 6866
 	
6867 6867
 	
6868 6868
 	/**
6869
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6870
-	*
6871
-	* @return Array the airport list
6872
-	*
6873
-	*/
6869
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6870
+	 *
6871
+	 * @return Array the airport list
6872
+	 *
6873
+	 */
6874 6874
 	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
6875 6875
 	{
6876 6876
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6900,11 +6900,11 @@  discard block
 block discarded – undo
6900 6900
 	
6901 6901
 	
6902 6902
 	/**
6903
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6904
-	*
6905
-	* @return Array the airport list
6906
-	*
6907
-	*/
6903
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6904
+	 *
6905
+	 * @return Array the airport list
6906
+	 *
6907
+	 */
6908 6908
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6909 6909
 	{
6910 6910
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6938,11 +6938,11 @@  discard block
 block discarded – undo
6938 6938
 	
6939 6939
 	
6940 6940
 	/**
6941
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
6942
-	*
6943
-	* @return Array the airport list
6944
-	*
6945
-	*/
6941
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
6942
+	 *
6943
+	 * @return Array the airport list
6944
+	 *
6945
+	 */
6946 6946
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6947 6947
 	{
6948 6948
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6973,11 +6973,11 @@  discard block
 block discarded – undo
6973 6973
 	
6974 6974
 	
6975 6975
 	/**
6976
-	* Gets all arrival airports of the airplanes that have flown over based on a date
6977
-	*
6978
-	* @return Array the airport list
6979
-	*
6980
-	*/
6976
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
6977
+	 *
6978
+	 * @return Array the airport list
6979
+	 *
6980
+	 */
6981 6981
 	public function countAllArrivalAirportsByDate($date,$filters = array())
6982 6982
 	{
6983 6983
 		global $globalTimezone, $globalDBdriver;
@@ -7023,11 +7023,11 @@  discard block
 block discarded – undo
7023 7023
 	
7024 7024
 	
7025 7025
 	/**
7026
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
7027
-	*
7028
-	* @return Array the airport list
7029
-	*
7030
-	*/
7026
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
7027
+	 *
7028
+	 * @return Array the airport list
7029
+	 *
7030
+	 */
7031 7031
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
7032 7032
 	{
7033 7033
 		global $globalTimezone, $globalDBdriver;
@@ -7070,11 +7070,11 @@  discard block
 block discarded – undo
7070 7070
 	
7071 7071
 	
7072 7072
 	/**
7073
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
7074
-	*
7075
-	* @return Array the airport list
7076
-	*
7077
-	*/
7073
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
7074
+	 *
7075
+	 * @return Array the airport list
7076
+	 *
7077
+	 */
7078 7078
 	public function countAllArrivalAirportsByIdent($ident,$filters = array())
7079 7079
 	{
7080 7080
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7107,11 +7107,11 @@  discard block
 block discarded – undo
7107 7107
 	
7108 7108
 	
7109 7109
 	/**
7110
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7111
-	*
7112
-	* @return Array the airport list
7113
-	*
7114
-	*/
7110
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7111
+	 *
7112
+	 * @return Array the airport list
7113
+	 *
7114
+	 */
7115 7115
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
7116 7116
 	{
7117 7117
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7142,11 +7142,11 @@  discard block
 block discarded – undo
7142 7142
 	
7143 7143
 	
7144 7144
 	/**
7145
-	* Gets all arrival airports of the airplanes that have flown over based on a country
7146
-	*
7147
-	* @return Array the airport list
7148
-	*
7149
-	*/
7145
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
7146
+	 *
7147
+	 * @return Array the airport list
7148
+	 *
7149
+	 */
7150 7150
 	public function countAllArrivalAirportsByCountry($country,$filters = array())
7151 7151
 	{
7152 7152
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7179,11 +7179,11 @@  discard block
 block discarded – undo
7179 7179
 	
7180 7180
 	
7181 7181
 	/**
7182
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
7183
-	*
7184
-	* @return Array the airport list
7185
-	*
7186
-	*/
7182
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
7183
+	 *
7184
+	 * @return Array the airport list
7185
+	 *
7186
+	 */
7187 7187
 	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
7188 7188
 	{
7189 7189
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7214,11 +7214,11 @@  discard block
 block discarded – undo
7214 7214
 
7215 7215
 
7216 7216
 	/**
7217
-	* Counts all airport departure countries
7218
-	*
7219
-	* @return Array the airport departure list
7220
-	*
7221
-	*/
7217
+	 * Counts all airport departure countries
7218
+	 *
7219
+	 * @return Array the airport departure list
7220
+	 *
7221
+	 */
7222 7222
 	public function countAllDepartureCountries($filters = array())
7223 7223
 	{
7224 7224
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7248,11 +7248,11 @@  discard block
 block discarded – undo
7248 7248
 	
7249 7249
 	
7250 7250
 	/**
7251
-	* Counts all airport arrival countries
7252
-	*
7253
-	* @return Array the airport arrival list
7254
-	*
7255
-	*/
7251
+	 * Counts all airport arrival countries
7252
+	 *
7253
+	 * @return Array the airport arrival list
7254
+	 *
7255
+	 */
7256 7256
 	public function countAllArrivalCountries($limit = true,$filters = array())
7257 7257
 	{
7258 7258
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7285,11 +7285,11 @@  discard block
 block discarded – undo
7285 7285
 
7286 7286
 
7287 7287
 	/**
7288
-	* Gets all route combinations
7289
-	*
7290
-	* @return Array the route list
7291
-	*
7292
-	*/
7288
+	 * Gets all route combinations
7289
+	 *
7290
+	 * @return Array the route list
7291
+	 *
7292
+	 */
7293 7293
 	public function countAllRoutes($filters = array())
7294 7294
 	{
7295 7295
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7328,11 +7328,11 @@  discard block
 block discarded – undo
7328 7328
 	
7329 7329
 	
7330 7330
 	/**
7331
-	* Gets all route combinations based on an aircraft
7332
-	*
7333
-	* @return Array the route list
7334
-	*
7335
-	*/
7331
+	 * Gets all route combinations based on an aircraft
7332
+	 *
7333
+	 * @return Array the route list
7334
+	 *
7335
+	 */
7336 7336
 	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
7337 7337
 	{
7338 7338
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7368,11 +7368,11 @@  discard block
 block discarded – undo
7368 7368
 	
7369 7369
 	
7370 7370
 	/**
7371
-	* Gets all route combinations based on an aircraft registration
7372
-	*
7373
-	* @return Array the route list
7374
-	*
7375
-	*/
7371
+	 * Gets all route combinations based on an aircraft registration
7372
+	 *
7373
+	 * @return Array the route list
7374
+	 *
7375
+	 */
7376 7376
 	public function countAllRoutesByRegistration($registration, $filters = array())
7377 7377
 	{
7378 7378
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7410,11 +7410,11 @@  discard block
 block discarded – undo
7410 7410
 	
7411 7411
 	
7412 7412
 	/**
7413
-	* Gets all route combinations based on an airline
7414
-	*
7415
-	* @return Array the route list
7416
-	*
7417
-	*/
7413
+	 * Gets all route combinations based on an airline
7414
+	 *
7415
+	 * @return Array the route list
7416
+	 *
7417
+	 */
7418 7418
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
7419 7419
 	{
7420 7420
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7452,11 +7452,11 @@  discard block
 block discarded – undo
7452 7452
 	
7453 7453
 	
7454 7454
 	/**
7455
-	* Gets all route combinations based on an airport
7456
-	*
7457
-	* @return Array the route list
7458
-	*
7459
-	*/
7455
+	 * Gets all route combinations based on an airport
7456
+	 *
7457
+	 * @return Array the route list
7458
+	 *
7459
+	 */
7460 7460
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
7461 7461
 	{
7462 7462
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7493,11 +7493,11 @@  discard block
 block discarded – undo
7493 7493
 	
7494 7494
 	
7495 7495
 	/**
7496
-	* Gets all route combinations based on an country
7497
-	*
7498
-	* @return Array the route list
7499
-	*
7500
-	*/
7496
+	 * Gets all route combinations based on an country
7497
+	 *
7498
+	 * @return Array the route list
7499
+	 *
7500
+	 */
7501 7501
 	public function countAllRoutesByCountry($country, $filters = array())
7502 7502
 	{
7503 7503
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7533,11 +7533,11 @@  discard block
 block discarded – undo
7533 7533
 
7534 7534
 
7535 7535
 	/**
7536
-	* Gets all route combinations based on an date
7537
-	*
7538
-	* @return Array the route list
7539
-	*
7540
-	*/
7536
+	 * Gets all route combinations based on an date
7537
+	 *
7538
+	 * @return Array the route list
7539
+	 *
7540
+	 */
7541 7541
 	public function countAllRoutesByDate($date, $filters = array())
7542 7542
 	{
7543 7543
 		global $globalTimezone, $globalDBdriver;
@@ -7587,11 +7587,11 @@  discard block
 block discarded – undo
7587 7587
 	
7588 7588
 	
7589 7589
 	/**
7590
-	* Gets all route combinations based on an ident/callsign
7591
-	*
7592
-	* @return Array the route list
7593
-	*
7594
-	*/
7590
+	 * Gets all route combinations based on an ident/callsign
7591
+	 *
7592
+	 * @return Array the route list
7593
+	 *
7594
+	 */
7595 7595
 	public function countAllRoutesByIdent($ident, $filters = array())
7596 7596
 	{
7597 7597
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7628,11 +7628,11 @@  discard block
 block discarded – undo
7628 7628
 	
7629 7629
 	
7630 7630
 	/**
7631
-	* Gets all route combinations based on an manufacturer
7632
-	*
7633
-	* @return Array the route list
7634
-	*
7635
-	*/
7631
+	 * Gets all route combinations based on an manufacturer
7632
+	 *
7633
+	 * @return Array the route list
7634
+	 *
7635
+	 */
7636 7636
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
7637 7637
 	{
7638 7638
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7670,11 +7670,11 @@  discard block
 block discarded – undo
7670 7670
 	
7671 7671
 	
7672 7672
 	/**
7673
-	* Gets all route combinations with waypoints
7674
-	*
7675
-	* @return Array the route list
7676
-	*
7677
-	*/
7673
+	 * Gets all route combinations with waypoints
7674
+	 *
7675
+	 * @return Array the route list
7676
+	 *
7677
+	 */
7678 7678
 	public function countAllRoutesWithWaypoints($filters = array())
7679 7679
 	{
7680 7680
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7711,11 +7711,11 @@  discard block
 block discarded – undo
7711 7711
 	}
7712 7712
 	
7713 7713
 	/**
7714
-	* Gets all callsigns that have flown over
7715
-	*
7716
-	* @return Array the callsign list
7717
-	*
7718
-	*/
7714
+	 * Gets all callsigns that have flown over
7715
+	 *
7716
+	 * @return Array the callsign list
7717
+	 *
7718
+	 */
7719 7719
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
7720 7720
 	{
7721 7721
 		global $globalDBdriver;
@@ -7753,11 +7753,11 @@  discard block
 block discarded – undo
7753 7753
 	}
7754 7754
 
7755 7755
 	/**
7756
-	* Gets all callsigns that have flown over
7757
-	*
7758
-	* @return Array the callsign list
7759
-	*
7760
-	*/
7756
+	 * Gets all callsigns that have flown over
7757
+	 *
7758
+	 * @return Array the callsign list
7759
+	 *
7760
+	 */
7761 7761
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7762 7762
 	{
7763 7763
 		global $globalDBdriver;
@@ -7798,11 +7798,11 @@  discard block
 block discarded – undo
7798 7798
 
7799 7799
 
7800 7800
 	/**
7801
-	* Counts all dates
7802
-	*
7803
-	* @return Array the date list
7804
-	*
7805
-	*/
7801
+	 * Counts all dates
7802
+	 *
7803
+	 * @return Array the date list
7804
+	 *
7805
+	 */
7806 7806
 	public function countAllDates($filters = array())
7807 7807
 	{
7808 7808
 		global $globalTimezone, $globalDBdriver;
@@ -7847,11 +7847,11 @@  discard block
 block discarded – undo
7847 7847
 	}
7848 7848
 	
7849 7849
 	/**
7850
-	* Counts all dates
7851
-	*
7852
-	* @return Array the date list
7853
-	*
7854
-	*/
7850
+	 * Counts all dates
7851
+	 *
7852
+	 * @return Array the date list
7853
+	 *
7854
+	 */
7855 7855
 	public function countAllDatesByAirlines($filters = array())
7856 7856
 	{
7857 7857
 		global $globalTimezone, $globalDBdriver;
@@ -7896,11 +7896,11 @@  discard block
 block discarded – undo
7896 7896
 	}	
7897 7897
 	
7898 7898
 	/**
7899
-	* Counts all dates during the last 7 days
7900
-	*
7901
-	* @return Array the date list
7902
-	*
7903
-	*/
7899
+	 * Counts all dates during the last 7 days
7900
+	 *
7901
+	 * @return Array the date list
7902
+	 *
7903
+	 */
7904 7904
 	public function countAllDatesLast7Days($filters = array())
7905 7905
 	{
7906 7906
 		global $globalTimezone, $globalDBdriver;
@@ -7922,7 +7922,7 @@  discard block
 block discarded – undo
7922 7922
 			$query .= " GROUP BY date_name 
7923 7923
 								ORDER BY date_name ASC";
7924 7924
 			$query_data = array(':offset' => $offset);
7925
-    		}
7925
+			}
7926 7926
 		
7927 7927
 		$sth = $this->db->prepare($query);
7928 7928
 		$sth->execute($query_data);
@@ -7942,11 +7942,11 @@  discard block
 block discarded – undo
7942 7942
 	}
7943 7943
 
7944 7944
 	/**
7945
-	* Counts all dates during the last month
7946
-	*
7947
-	* @return Array the date list
7948
-	*
7949
-	*/
7945
+	 * Counts all dates during the last month
7946
+	 *
7947
+	 * @return Array the date list
7948
+	 *
7949
+	 */
7950 7950
 	public function countAllDatesLastMonth($filters = array())
7951 7951
 	{
7952 7952
 		global $globalTimezone, $globalDBdriver;
@@ -7968,7 +7968,7 @@  discard block
 block discarded – undo
7968 7968
 			$query .= " GROUP BY date_name 
7969 7969
 								ORDER BY date_name ASC";
7970 7970
 			$query_data = array(':offset' => $offset);
7971
-    		}
7971
+			}
7972 7972
 		
7973 7973
 		$sth = $this->db->prepare($query);
7974 7974
 		$sth->execute($query_data);
@@ -7989,11 +7989,11 @@  discard block
 block discarded – undo
7989 7989
 
7990 7990
 
7991 7991
 	/**
7992
-	* Counts all dates during the last month
7993
-	*
7994
-	* @return Array the date list
7995
-	*
7996
-	*/
7992
+	 * Counts all dates during the last month
7993
+	 *
7994
+	 * @return Array the date list
7995
+	 *
7996
+	 */
7997 7997
 	public function countAllDatesLastMonthByAirlines($filters = array())
7998 7998
 	{
7999 7999
 		global $globalTimezone, $globalDBdriver;
@@ -8016,7 +8016,7 @@  discard block
 block discarded – undo
8016 8016
 								GROUP BY spotter_output.airline_icao, date_name 
8017 8017
 								ORDER BY date_name ASC";
8018 8018
 			$query_data = array(':offset' => $offset);
8019
-    		}
8019
+			}
8020 8020
 		
8021 8021
 		$sth = $this->db->prepare($query);
8022 8022
 		$sth->execute($query_data);
@@ -8038,11 +8038,11 @@  discard block
 block discarded – undo
8038 8038
 	
8039 8039
 
8040 8040
 	/**
8041
-	* Counts all month
8042
-	*
8043
-	* @return Array the month list
8044
-	*
8045
-	*/
8041
+	 * Counts all month
8042
+	 *
8043
+	 * @return Array the month list
8044
+	 *
8045
+	 */
8046 8046
 	public function countAllMonths($filters = array())
8047 8047
 	{
8048 8048
 		global $globalTimezone, $globalDBdriver;
@@ -8084,11 +8084,11 @@  discard block
 block discarded – undo
8084 8084
 	}
8085 8085
 
8086 8086
 	/**
8087
-	* Counts all month
8088
-	*
8089
-	* @return Array the month list
8090
-	*
8091
-	*/
8087
+	 * Counts all month
8088
+	 *
8089
+	 * @return Array the month list
8090
+	 *
8091
+	 */
8092 8092
 	public function countAllMonthsByAirlines($filters = array())
8093 8093
 	{
8094 8094
 		global $globalTimezone, $globalDBdriver;
@@ -8133,11 +8133,11 @@  discard block
 block discarded – undo
8133 8133
 	}
8134 8134
 
8135 8135
 	/**
8136
-	* Counts all military month
8137
-	*
8138
-	* @return Array the month list
8139
-	*
8140
-	*/
8136
+	 * Counts all military month
8137
+	 *
8138
+	 * @return Array the month list
8139
+	 *
8140
+	 */
8141 8141
 	public function countAllMilitaryMonths($filters = array())
8142 8142
 	{
8143 8143
 		global $globalTimezone, $globalDBdriver;
@@ -8178,11 +8178,11 @@  discard block
 block discarded – undo
8178 8178
 	}
8179 8179
 	
8180 8180
 	/**
8181
-	* Counts all month owners
8182
-	*
8183
-	* @return Array the month list
8184
-	*
8185
-	*/
8181
+	 * Counts all month owners
8182
+	 *
8183
+	 * @return Array the month list
8184
+	 *
8185
+	 */
8186 8186
 	public function countAllMonthsOwners($filters = array())
8187 8187
 	{
8188 8188
 		global $globalTimezone, $globalDBdriver;
@@ -8224,11 +8224,11 @@  discard block
 block discarded – undo
8224 8224
 	}
8225 8225
 	
8226 8226
 	/**
8227
-	* Counts all month owners
8228
-	*
8229
-	* @return Array the month list
8230
-	*
8231
-	*/
8227
+	 * Counts all month owners
8228
+	 *
8229
+	 * @return Array the month list
8230
+	 *
8231
+	 */
8232 8232
 	public function countAllMonthsOwnersByAirlines($filters = array())
8233 8233
 	{
8234 8234
 		global $globalTimezone, $globalDBdriver;
@@ -8271,11 +8271,11 @@  discard block
 block discarded – undo
8271 8271
 	}
8272 8272
 
8273 8273
 	/**
8274
-	* Counts all month pilot
8275
-	*
8276
-	* @return Array the month list
8277
-	*
8278
-	*/
8274
+	 * Counts all month pilot
8275
+	 *
8276
+	 * @return Array the month list
8277
+	 *
8278
+	 */
8279 8279
 	public function countAllMonthsPilots($filters = array())
8280 8280
 	{
8281 8281
 		global $globalTimezone, $globalDBdriver;
@@ -8317,11 +8317,11 @@  discard block
 block discarded – undo
8317 8317
 	}
8318 8318
 	
8319 8319
 	/**
8320
-	* Counts all month pilot
8321
-	*
8322
-	* @return Array the month list
8323
-	*
8324
-	*/
8320
+	 * Counts all month pilot
8321
+	 *
8322
+	 * @return Array the month list
8323
+	 *
8324
+	 */
8325 8325
 	public function countAllMonthsPilotsByAirlines($filters = array())
8326 8326
 	{
8327 8327
 		global $globalTimezone, $globalDBdriver;
@@ -8364,11 +8364,11 @@  discard block
 block discarded – undo
8364 8364
 	}
8365 8365
 
8366 8366
 	/**
8367
-	* Counts all month airline
8368
-	*
8369
-	* @return Array the month list
8370
-	*
8371
-	*/
8367
+	 * Counts all month airline
8368
+	 *
8369
+	 * @return Array the month list
8370
+	 *
8371
+	 */
8372 8372
 	public function countAllMonthsAirlines($filters = array())
8373 8373
 	{
8374 8374
 		global $globalTimezone, $globalDBdriver;
@@ -8410,11 +8410,11 @@  discard block
 block discarded – undo
8410 8410
 	}
8411 8411
 	
8412 8412
 	/**
8413
-	* Counts all month aircraft
8414
-	*
8415
-	* @return Array the month list
8416
-	*
8417
-	*/
8413
+	 * Counts all month aircraft
8414
+	 *
8415
+	 * @return Array the month list
8416
+	 *
8417
+	 */
8418 8418
 	public function countAllMonthsAircrafts($filters = array())
8419 8419
 	{
8420 8420
 		global $globalTimezone, $globalDBdriver;
@@ -8457,11 +8457,11 @@  discard block
 block discarded – undo
8457 8457
 	
8458 8458
 
8459 8459
 	/**
8460
-	* Counts all month aircraft
8461
-	*
8462
-	* @return Array the month list
8463
-	*
8464
-	*/
8460
+	 * Counts all month aircraft
8461
+	 *
8462
+	 * @return Array the month list
8463
+	 *
8464
+	 */
8465 8465
 	public function countAllMonthsAircraftsByAirlines($filters = array())
8466 8466
 	{
8467 8467
 		global $globalTimezone, $globalDBdriver;
@@ -8504,11 +8504,11 @@  discard block
 block discarded – undo
8504 8504
 	}
8505 8505
 
8506 8506
 	/**
8507
-	* Counts all month real arrival
8508
-	*
8509
-	* @return Array the month list
8510
-	*
8511
-	*/
8507
+	 * Counts all month real arrival
8508
+	 *
8509
+	 * @return Array the month list
8510
+	 *
8511
+	 */
8512 8512
 	public function countAllMonthsRealArrivals($filters = array())
8513 8513
 	{
8514 8514
 		global $globalTimezone, $globalDBdriver;
@@ -8551,11 +8551,11 @@  discard block
 block discarded – undo
8551 8551
 	
8552 8552
 
8553 8553
 	/**
8554
-	* Counts all month real arrival
8555
-	*
8556
-	* @return Array the month list
8557
-	*
8558
-	*/
8554
+	 * Counts all month real arrival
8555
+	 *
8556
+	 * @return Array the month list
8557
+	 *
8558
+	 */
8559 8559
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
8560 8560
 	{
8561 8561
 		global $globalTimezone, $globalDBdriver;
@@ -8599,11 +8599,11 @@  discard block
 block discarded – undo
8599 8599
 	
8600 8600
 
8601 8601
 	/**
8602
-	* Counts all dates during the last year
8603
-	*
8604
-	* @return Array the date list
8605
-	*
8606
-	*/
8602
+	 * Counts all dates during the last year
8603
+	 *
8604
+	 * @return Array the date list
8605
+	 *
8606
+	 */
8607 8607
 	public function countAllMonthsLastYear($filters)
8608 8608
 	{
8609 8609
 		global $globalTimezone, $globalDBdriver;
@@ -8625,7 +8625,7 @@  discard block
 block discarded – undo
8625 8625
 			$query .= " GROUP BY year_name, month_name
8626 8626
 								ORDER BY year_name, month_name ASC";
8627 8627
 			$query_data = array(':offset' => $offset);
8628
-    		}
8628
+			}
8629 8629
 		
8630 8630
 		$sth = $this->db->prepare($query);
8631 8631
 		$sth->execute($query_data);
@@ -8648,11 +8648,11 @@  discard block
 block discarded – undo
8648 8648
 	
8649 8649
 	
8650 8650
 	/**
8651
-	* Counts all hours
8652
-	*
8653
-	* @return Array the hour list
8654
-	*
8655
-	*/
8651
+	 * Counts all hours
8652
+	 *
8653
+	 * @return Array the hour list
8654
+	 *
8655
+	 */
8656 8656
 	public function countAllHours($orderby,$filters = array())
8657 8657
 	{
8658 8658
 		global $globalTimezone, $globalDBdriver;
@@ -8713,11 +8713,11 @@  discard block
 block discarded – undo
8713 8713
 	}
8714 8714
 	
8715 8715
 	/**
8716
-	* Counts all hours
8717
-	*
8718
-	* @return Array the hour list
8719
-	*
8720
-	*/
8716
+	 * Counts all hours
8717
+	 *
8718
+	 * @return Array the hour list
8719
+	 *
8720
+	 */
8721 8721
 	public function countAllHoursByAirlines($orderby, $filters = array())
8722 8722
 	{
8723 8723
 		global $globalTimezone, $globalDBdriver;
@@ -8780,11 +8780,11 @@  discard block
 block discarded – undo
8780 8780
 
8781 8781
 
8782 8782
 	/**
8783
-	* Counts all hours by airline
8784
-	*
8785
-	* @return Array the hour list
8786
-	*
8787
-	*/
8783
+	 * Counts all hours by airline
8784
+	 *
8785
+	 * @return Array the hour list
8786
+	 *
8787
+	 */
8788 8788
 	public function countAllHoursByAirline($airline_icao, $filters = array())
8789 8789
 	{
8790 8790
 		global $globalTimezone, $globalDBdriver;
@@ -8830,11 +8830,11 @@  discard block
 block discarded – undo
8830 8830
 	
8831 8831
 	
8832 8832
 	/**
8833
-	* Counts all hours by aircraft
8834
-	*
8835
-	* @return Array the hour list
8836
-	*
8837
-	*/
8833
+	 * Counts all hours by aircraft
8834
+	 *
8835
+	 * @return Array the hour list
8836
+	 *
8837
+	 */
8838 8838
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
8839 8839
 	{
8840 8840
 		global $globalTimezone, $globalDBdriver;
@@ -8877,11 +8877,11 @@  discard block
 block discarded – undo
8877 8877
 	
8878 8878
 	
8879 8879
 	/**
8880
-	* Counts all hours by aircraft registration
8881
-	*
8882
-	* @return Array the hour list
8883
-	*
8884
-	*/
8880
+	 * Counts all hours by aircraft registration
8881
+	 *
8882
+	 * @return Array the hour list
8883
+	 *
8884
+	 */
8885 8885
 	public function countAllHoursByRegistration($registration, $filters = array())
8886 8886
 	{
8887 8887
 		global $globalTimezone, $globalDBdriver;
@@ -8924,11 +8924,11 @@  discard block
 block discarded – undo
8924 8924
 	
8925 8925
 	
8926 8926
 	/**
8927
-	* Counts all hours by airport
8928
-	*
8929
-	* @return Array the hour list
8930
-	*
8931
-	*/
8927
+	 * Counts all hours by airport
8928
+	 *
8929
+	 * @return Array the hour list
8930
+	 *
8931
+	 */
8932 8932
 	public function countAllHoursByAirport($airport_icao, $filters = array())
8933 8933
 	{
8934 8934
 		global $globalTimezone, $globalDBdriver;
@@ -8972,11 +8972,11 @@  discard block
 block discarded – undo
8972 8972
 	
8973 8973
 	
8974 8974
 	/**
8975
-	* Counts all hours by manufacturer
8976
-	*
8977
-	* @return Array the hour list
8978
-	*
8979
-	*/
8975
+	 * Counts all hours by manufacturer
8976
+	 *
8977
+	 * @return Array the hour list
8978
+	 *
8979
+	 */
8980 8980
 	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
8981 8981
 	{
8982 8982
 		global $globalTimezone, $globalDBdriver;
@@ -9020,11 +9020,11 @@  discard block
 block discarded – undo
9020 9020
 	
9021 9021
 	
9022 9022
 	/**
9023
-	* Counts all hours by date
9024
-	*
9025
-	* @return Array the hour list
9026
-	*
9027
-	*/
9023
+	 * Counts all hours by date
9024
+	 *
9025
+	 * @return Array the hour list
9026
+	 *
9027
+	 */
9028 9028
 	public function countAllHoursByDate($date, $filters = array())
9029 9029
 	{
9030 9030
 		global $globalTimezone, $globalDBdriver;
@@ -9068,11 +9068,11 @@  discard block
 block discarded – undo
9068 9068
 	
9069 9069
 	
9070 9070
 	/**
9071
-	* Counts all hours by a ident/callsign
9072
-	*
9073
-	* @return Array the hour list
9074
-	*
9075
-	*/
9071
+	 * Counts all hours by a ident/callsign
9072
+	 *
9073
+	 * @return Array the hour list
9074
+	 *
9075
+	 */
9076 9076
 	public function countAllHoursByIdent($ident, $filters = array())
9077 9077
 	{
9078 9078
 		global $globalTimezone, $globalDBdriver;
@@ -9117,11 +9117,11 @@  discard block
 block discarded – undo
9117 9117
 	
9118 9118
 	
9119 9119
 	/**
9120
-	* Counts all hours by route
9121
-	*
9122
-	* @return Array the hour list
9123
-	*
9124
-	*/
9120
+	 * Counts all hours by route
9121
+	 *
9122
+	 * @return Array the hour list
9123
+	 *
9124
+	 */
9125 9125
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
9126 9126
 	{
9127 9127
 		global $globalTimezone, $globalDBdriver;
@@ -9165,11 +9165,11 @@  discard block
 block discarded – undo
9165 9165
 	
9166 9166
 	
9167 9167
 	/**
9168
-	* Counts all hours by country
9169
-	*
9170
-	* @return Array the hour list
9171
-	*
9172
-	*/
9168
+	 * Counts all hours by country
9169
+	 *
9170
+	 * @return Array the hour list
9171
+	 *
9172
+	 */
9173 9173
 	public function countAllHoursByCountry($country, $filters = array())
9174 9174
 	{
9175 9175
 		global $globalTimezone, $globalDBdriver;
@@ -9214,11 +9214,11 @@  discard block
 block discarded – undo
9214 9214
 
9215 9215
 
9216 9216
 	/**
9217
-	* Counts all aircraft that have flown over
9218
-	*
9219
-	* @return Integer the number of aircrafts
9220
-	*
9221
-	*/
9217
+	 * Counts all aircraft that have flown over
9218
+	 *
9219
+	 * @return Integer the number of aircrafts
9220
+	 *
9221
+	 */
9222 9222
 	public function countOverallAircrafts($filters = array())
9223 9223
 	{
9224 9224
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9230,11 +9230,11 @@  discard block
 block discarded – undo
9230 9230
 	}
9231 9231
 
9232 9232
 	/**
9233
-	* Counts all flight that really arrival
9234
-	*
9235
-	* @return Integer the number of aircrafts
9236
-	*
9237
-	*/
9233
+	 * Counts all flight that really arrival
9234
+	 *
9235
+	 * @return Integer the number of aircrafts
9236
+	 *
9237
+	 */
9238 9238
 	public function countOverallArrival($filters = array())
9239 9239
 	{
9240 9240
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9247,11 +9247,11 @@  discard block
 block discarded – undo
9247 9247
 	}
9248 9248
 
9249 9249
 	/**
9250
-	* Counts all pilots that have flown over
9251
-	*
9252
-	* @return Integer the number of pilots
9253
-	*
9254
-	*/
9250
+	 * Counts all pilots that have flown over
9251
+	 *
9252
+	 * @return Integer the number of pilots
9253
+	 *
9254
+	 */
9255 9255
 	public function countOverallPilots($filters = array())
9256 9256
 	{
9257 9257
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9263,11 +9263,11 @@  discard block
 block discarded – undo
9263 9263
 	}
9264 9264
 
9265 9265
 	/**
9266
-	* Counts all owners that have flown over
9267
-	*
9268
-	* @return Integer the number of owners
9269
-	*
9270
-	*/
9266
+	 * Counts all owners that have flown over
9267
+	 *
9268
+	 * @return Integer the number of owners
9269
+	 *
9270
+	 */
9271 9271
 	public function countOverallOwners($filters = array())
9272 9272
 	{
9273 9273
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9280,11 +9280,11 @@  discard block
 block discarded – undo
9280 9280
 	
9281 9281
 	
9282 9282
 	/**
9283
-	* Counts all flights that have flown over
9284
-	*
9285
-	* @return Integer the number of flights
9286
-	*
9287
-	*/
9283
+	 * Counts all flights that have flown over
9284
+	 *
9285
+	 * @return Integer the number of flights
9286
+	 *
9287
+	 */
9288 9288
 	public function countOverallFlights($filters = array())
9289 9289
 	{
9290 9290
 		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
@@ -9297,11 +9297,11 @@  discard block
 block discarded – undo
9297 9297
 	}
9298 9298
 	
9299 9299
 	/**
9300
-	* Counts all military flights that have flown over
9301
-	*
9302
-	* @return Integer the number of flights
9303
-	*
9304
-	*/
9300
+	 * Counts all military flights that have flown over
9301
+	 *
9302
+	 * @return Integer the number of flights
9303
+	 *
9304
+	 */
9305 9305
 	public function countOverallMilitaryFlights($filters = array())
9306 9306
 	{
9307 9307
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9316,11 +9316,11 @@  discard block
 block discarded – undo
9316 9316
 	
9317 9317
 	
9318 9318
 	/**
9319
-	* Counts all airlines that have flown over
9320
-	*
9321
-	* @return Integer the number of airlines
9322
-	*
9323
-	*/
9319
+	 * Counts all airlines that have flown over
9320
+	 *
9321
+	 * @return Integer the number of airlines
9322
+	 *
9323
+	 */
9324 9324
 	public function countOverallAirlines($filters = array())
9325 9325
 	{
9326 9326
 		$query  = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
@@ -9334,11 +9334,11 @@  discard block
 block discarded – undo
9334 9334
 
9335 9335
   
9336 9336
 	/**
9337
-	* Counts all hours of today
9338
-	*
9339
-	* @return Array the hour list
9340
-	*
9341
-	*/
9337
+	 * Counts all hours of today
9338
+	 *
9339
+	 * @return Array the hour list
9340
+	 *
9341
+	 */
9342 9342
 	public function countAllHoursFromToday($filters = array())
9343 9343
 	{
9344 9344
 		global $globalTimezone, $globalDBdriver;
@@ -9378,11 +9378,11 @@  discard block
 block discarded – undo
9378 9378
 	}
9379 9379
     
9380 9380
 	/**
9381
-	* Gets all the spotter information based on calculated upcoming flights
9382
-	*
9383
-	* @return Array the spotter information
9384
-	*
9385
-	*/
9381
+	 * Gets all the spotter information based on calculated upcoming flights
9382
+	 *
9383
+	 * @return Array the spotter information
9384
+	 *
9385
+	 */
9386 9386
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
9387 9387
 	{
9388 9388
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -9457,12 +9457,12 @@  discard block
 block discarded – undo
9457 9457
 	}
9458 9458
     
9459 9459
     
9460
-     /**
9461
-	* Gets the Barrie Spotter ID based on the FlightAware ID
9462
-	*
9463
-	* @return Integer the Barrie Spotter ID
9460
+	 /**
9461
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
9462
+	  *
9463
+	  * @return Integer the Barrie Spotter ID
9464 9464
 q	*
9465
-	*/
9465
+	  */
9466 9466
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
9467 9467
 	{
9468 9468
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -9483,13 +9483,13 @@  discard block
 block discarded – undo
9483 9483
   
9484 9484
  
9485 9485
 	/**
9486
-	* Parses a date string
9487
-	*
9488
-	* @param String $dateString the date string
9489
-	* @param String $timezone the timezone of a user
9490
-	* @return Array the time information
9491
-	*
9492
-	*/
9486
+	 * Parses a date string
9487
+	 *
9488
+	 * @param String $dateString the date string
9489
+	 * @param String $timezone the timezone of a user
9490
+	 * @return Array the time information
9491
+	 *
9492
+	 */
9493 9493
 	public function parseDateString($dateString, $timezone = '')
9494 9494
 	{
9495 9495
 		$time_array = array();
@@ -9525,12 +9525,12 @@  discard block
 block discarded – undo
9525 9525
 	
9526 9526
 	
9527 9527
 	/**
9528
-	* Parses the direction degrees to working
9529
-	*
9530
-	* @param Float $direction the direction in degrees
9531
-	* @return Array the direction information
9532
-	*
9533
-	*/
9528
+	 * Parses the direction degrees to working
9529
+	 *
9530
+	 * @param Float $direction the direction in degrees
9531
+	 * @return Array the direction information
9532
+	 *
9533
+	 */
9534 9534
 	public function parseDirection($direction = 0)
9535 9535
 	{
9536 9536
 		if ($direction == '') $direction = 0;
@@ -9609,12 +9609,12 @@  discard block
 block discarded – undo
9609 9609
 	
9610 9610
 	
9611 9611
 	/**
9612
-	* Gets the aircraft registration
9613
-	*
9614
-	* @param String $flightaware_id the flight aware id
9615
-	* @return String the aircraft registration
9616
-	*
9617
-	*/
9612
+	 * Gets the aircraft registration
9613
+	 *
9614
+	 * @param String $flightaware_id the flight aware id
9615
+	 * @return String the aircraft registration
9616
+	 *
9617
+	 */
9618 9618
 	
9619 9619
 	public function getAircraftRegistration($flightaware_id)
9620 9620
 	{
@@ -9643,12 +9643,12 @@  discard block
 block discarded – undo
9643 9643
 
9644 9644
 
9645 9645
 	/**
9646
-	* Gets the aircraft registration from ModeS
9647
-	*
9648
-	* @param String $aircraft_modes the flight ModeS in hex
9649
-	* @return String the aircraft registration
9650
-	*
9651
-	*/
9646
+	 * Gets the aircraft registration from ModeS
9647
+	 *
9648
+	 * @param String $aircraft_modes the flight ModeS in hex
9649
+	 * @return String the aircraft registration
9650
+	 *
9651
+	 */
9652 9652
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
9653 9653
 	{
9654 9654
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9661,19 +9661,19 @@  discard block
 block discarded – undo
9661 9661
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9662 9662
 		$sth->closeCursor();
9663 9663
 		if (count($row) > 0) {
9664
-		    //return $row['Registration'];
9665
-		    return $row['registration'];
9664
+			//return $row['Registration'];
9665
+			return $row['registration'];
9666 9666
 		} else return '';
9667 9667
 	
9668 9668
 	}
9669 9669
 
9670 9670
 	/**
9671
-	* Gets the aircraft type from ModeS
9672
-	*
9673
-	* @param String $aircraft_modes the flight ModeS in hex
9674
-	* @return String the aircraft type
9675
-	*
9676
-	*/
9671
+	 * Gets the aircraft type from ModeS
9672
+	 *
9673
+	 * @param String $aircraft_modes the flight ModeS in hex
9674
+	 * @return String the aircraft type
9675
+	 *
9676
+	 */
9677 9677
 	public function getAircraftTypeBymodeS($aircraft_modes)
9678 9678
 	{
9679 9679
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9686,19 +9686,19 @@  discard block
 block discarded – undo
9686 9686
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9687 9687
 		$sth->closeCursor();
9688 9688
 		if (count($row) > 0) {
9689
-		    if ($row['type_flight'] == null) return '';
9690
-		    else return $row['type_flight'];
9689
+			if ($row['type_flight'] == null) return '';
9690
+			else return $row['type_flight'];
9691 9691
 		} else return '';
9692 9692
 	
9693 9693
 	}
9694 9694
 
9695 9695
 	/**
9696
-	* Gets Country from latitude/longitude
9697
-	*
9698
-	* @param Float $latitude latitute of the flight
9699
-	* @param Float $longitude longitute of the flight
9700
-	* @return String the countrie
9701
-	*/
9696
+	 * Gets Country from latitude/longitude
9697
+	 *
9698
+	 * @param Float $latitude latitute of the flight
9699
+	 * @param Float $longitude longitute of the flight
9700
+	 * @return String the countrie
9701
+	 */
9702 9702
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
9703 9703
 	{
9704 9704
 		global $globalDBdriver, $globalDebug;
@@ -9735,11 +9735,11 @@  discard block
 block discarded – undo
9735 9735
 	}
9736 9736
 
9737 9737
 	/**
9738
-	* Gets Country from iso2
9739
-	*
9740
-	* @param String $iso2 ISO2 country code
9741
-	* @return String the countrie
9742
-	*/
9738
+	 * Gets Country from iso2
9739
+	 *
9740
+	 * @param String $iso2 ISO2 country code
9741
+	 * @return String the countrie
9742
+	 */
9743 9743
 	public function getCountryFromISO2($iso2)
9744 9744
 	{
9745 9745
 		global $globalDBdriver, $globalDebug;
@@ -9767,12 +9767,12 @@  discard block
 block discarded – undo
9767 9767
 	}
9768 9768
 
9769 9769
 	/**
9770
-	* converts the registration code using the country prefix
9771
-	*
9772
-	* @param String $registration the aircraft registration
9773
-	* @return String the aircraft registration
9774
-	*
9775
-	*/
9770
+	 * converts the registration code using the country prefix
9771
+	 *
9772
+	 * @param String $registration the aircraft registration
9773
+	 * @return String the aircraft registration
9774
+	 *
9775
+	 */
9776 9776
 	public function convertAircraftRegistration($registration)
9777 9777
 	{
9778 9778
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9824,12 +9824,12 @@  discard block
 block discarded – undo
9824 9824
 	}
9825 9825
 
9826 9826
 	/**
9827
-	* Country from the registration code
9828
-	*
9829
-	* @param String $registration the aircraft registration
9830
-	* @return String the country
9831
-	*
9832
-	*/
9827
+	 * Country from the registration code
9828
+	 *
9829
+	 * @param String $registration the aircraft registration
9830
+	 * @return String the country
9831
+	 *
9832
+	 */
9833 9833
 	public function countryFromAircraftRegistration($registration)
9834 9834
 	{
9835 9835
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9848,8 +9848,8 @@  discard block
 block discarded – undo
9848 9848
 				$country = $row['country'];
9849 9849
 			}
9850 9850
 		} else {
9851
-    			$registration_1 = substr($registration, 0, 1);
9852
-		        $registration_2 = substr($registration, 0, 2);
9851
+				$registration_1 = substr($registration, 0, 1);
9852
+				$registration_2 = substr($registration, 0, 2);
9853 9853
 
9854 9854
 			$country = '';
9855 9855
 			//first get the prefix based on two characters
@@ -9885,12 +9885,12 @@  discard block
 block discarded – undo
9885 9885
 	}
9886 9886
 
9887 9887
 	/**
9888
-	* Country from the registration code
9889
-	*
9890
-	* @param String $registration the aircraft registration
9891
-	* @return String the country
9892
-	*
9893
-	*/
9888
+	 * Country from the registration code
9889
+	 *
9890
+	 * @param String $registration the aircraft registration
9891
+	 * @return String the country
9892
+	 *
9893
+	 */
9894 9894
 	public function countryFromAircraftRegistrationCode($registration)
9895 9895
 	{
9896 9896
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9907,11 +9907,11 @@  discard block
 block discarded – undo
9907 9907
 	}
9908 9908
 	
9909 9909
 	/**
9910
-	* Set a new highlight value for a flight
9911
-	*
9912
-	* @param String $flightaware_id flightaware_id from spotter_output table
9913
-	* @param String $highlight New highlight value
9914
-	*/
9910
+	 * Set a new highlight value for a flight
9911
+	 *
9912
+	 * @param String $flightaware_id flightaware_id from spotter_output table
9913
+	 * @param String $highlight New highlight value
9914
+	 */
9915 9915
 	public function setHighlightFlight($flightaware_id,$highlight) {
9916 9916
 		
9917 9917
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -9920,12 +9920,12 @@  discard block
 block discarded – undo
9920 9920
 	}
9921 9921
 	
9922 9922
 	/**
9923
-	* Gets the short url from bit.ly
9924
-	*
9925
-	* @param String $url the full url
9926
-	* @return String the bit.ly url
9927
-	*
9928
-	*/
9923
+	 * Gets the short url from bit.ly
9924
+	 *
9925
+	 * @param String $url the full url
9926
+	 * @return String the bit.ly url
9927
+	 *
9928
+	 */
9929 9929
 	public function getBitlyURL($url)
9930 9930
 	{
9931 9931
 		global $globalBitlyAccessToken;
@@ -10214,11 +10214,11 @@  discard block
 block discarded – undo
10214 10214
 			$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 
10215 10215
 	                      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)) 
10216 10216
 	                      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;";
10217
-                } else {
10217
+				} else {
10218 10218
 			$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 
10219 10219
 	                      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)) 
10220 10220
 	                      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;";
10221
-    		}
10221
+			}
10222 10222
 		$sth = $this->db->prepare($query);
10223 10223
 		$sth->execute();
10224 10224
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.