Completed
Push — master ( ed4a23...e0ac49 )
by Yannick
06:21
created
require/class.Stats.php 3 patches
Indentation   +815 added lines, -815 removed lines patch added patch discarded remove patch
@@ -15,67 +15,67 @@  discard block
 block discarded – undo
15 15
 		if (isset($globalFilterName)) $this->filter_name = $globalFilterName;
16 16
 		$Connection = new Connection($dbc);
17 17
 		$this->db = $Connection->db();
18
-        }
18
+		}
19 19
               
20 20
 	public function addLastStatsUpdate($type,$stats_date) {
21
-                $query = "DELETE FROM config WHERE name = :type;
21
+				$query = "DELETE FROM config WHERE name = :type;
22 22
             		INSERT INTO config (name,value) VALUES (:type,:stats_date);";
23
-                $query_values = array('type' => $type,':stats_date' => $stats_date);
24
-                 try {
25
-                        $sth = $this->db->prepare($query);
26
-                        $sth->execute($query_values);
27
-                } catch(PDOException $e) {
28
-                        return "error : ".$e->getMessage();
29
-                }
30
-        }
23
+				$query_values = array('type' => $type,':stats_date' => $stats_date);
24
+				 try {
25
+						$sth = $this->db->prepare($query);
26
+						$sth->execute($query_values);
27
+				} catch(PDOException $e) {
28
+						return "error : ".$e->getMessage();
29
+				}
30
+		}
31 31
 
32 32
 	public function getLastStatsUpdate($type = 'last_update_stats') {
33
-                $query = "SELECT value FROM config WHERE name = :type";
34
-                 try {
35
-                        $sth = $this->db->prepare($query);
36
-                        $sth->execute(array(':type' => $type));
37
-                } catch(PDOException $e) {
38
-                        echo "error : ".$e->getMessage();
39
-                }
40
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
41
-                return $all;
42
-        }
33
+				$query = "SELECT value FROM config WHERE name = :type";
34
+				 try {
35
+						$sth = $this->db->prepare($query);
36
+						$sth->execute(array(':type' => $type));
37
+				} catch(PDOException $e) {
38
+						echo "error : ".$e->getMessage();
39
+				}
40
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
41
+				return $all;
42
+		}
43 43
 	public function getAllAirlineNames($filter_name = '') {
44 44
 		if ($filter_name == '') $filter_name = $this->filter_name;
45
-                $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC";
46
-                 try {
47
-                        $sth = $this->db->prepare($query);
48
-                        $sth->execute(array(':filter_name' => $filter_name));
49
-                } catch(PDOException $e) {
50
-                        echo "error : ".$e->getMessage();
51
-                }
52
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
53
-                return $all;
54
-        }
45
+				$query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC";
46
+				 try {
47
+						$sth = $this->db->prepare($query);
48
+						$sth->execute(array(':filter_name' => $filter_name));
49
+				} catch(PDOException $e) {
50
+						echo "error : ".$e->getMessage();
51
+				}
52
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
53
+				return $all;
54
+		}
55 55
 	public function getAllAircraftTypes($stats_airline = '',$filter_name = '') {
56 56
 		if ($filter_name == '') $filter_name = $this->filter_name;
57
-                $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
58
-                 try {
59
-                        $sth = $this->db->prepare($query);
60
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
61
-                } catch(PDOException $e) {
62
-                        echo "error : ".$e->getMessage();
63
-                }
64
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
65
-                return $all;
66
-        }
57
+				$query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
58
+				 try {
59
+						$sth = $this->db->prepare($query);
60
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
61
+				} catch(PDOException $e) {
62
+						echo "error : ".$e->getMessage();
63
+				}
64
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
65
+				return $all;
66
+		}
67 67
 	public function getAllAirportNames($stats_airline = '',$filter_name = '') {
68 68
 		if ($filter_name == '') $filter_name = $this->filter_name;
69
-                $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC";
70
-                 try {
71
-                        $sth = $this->db->prepare($query);
72
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
73
-                } catch(PDOException $e) {
74
-                        echo "error : ".$e->getMessage();
75
-                }
76
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
77
-                return $all;
78
-        }
69
+				$query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC";
70
+				 try {
71
+						$sth = $this->db->prepare($query);
72
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
73
+				} catch(PDOException $e) {
74
+						echo "error : ".$e->getMessage();
75
+				}
76
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
77
+				return $all;
78
+		}
79 79
 
80 80
 
81 81
 	public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '') {
@@ -83,66 +83,66 @@  discard block
 block discarded – undo
83 83
 		if ($filter_name == '') $filter_name = $this->filter_name;
84 84
 		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";
85 85
 		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";
86
-                 try {
87
-                        $sth = $this->db->prepare($query);
88
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
89
-                } catch(PDOException $e) {
90
-                        echo "error : ".$e->getMessage();
91
-                }
92
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
93
-                if (empty($all)) {
94
-            	    $filters = array('airlines' => array($stats_airline));
95
-            	    if ($filter_name != '') {
96
-            		    $filters = array_merge($filters,$globalStatsFilters[$filter_name]);
97
-            	    }
98
-            	    $Spotter = new Spotter($this->db);
99
-            	    $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters);
100
-                }
101
-                return $all;
86
+				 try {
87
+						$sth = $this->db->prepare($query);
88
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
89
+				} catch(PDOException $e) {
90
+						echo "error : ".$e->getMessage();
91
+				}
92
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
93
+				if (empty($all)) {
94
+					$filters = array('airlines' => array($stats_airline));
95
+					if ($filter_name != '') {
96
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
97
+					}
98
+					$Spotter = new Spotter($this->db);
99
+					$all = $Spotter->countAllAircraftTypes($limit,0,'',$filters);
100
+				}
101
+				return $all;
102 102
 	}
103 103
 	public function countAllAirlineCountries($limit = true,$filter_name = '') {
104 104
 		global $globalStatsFilters;
105 105
 		if ($filter_name == '') $filter_name = $this->filter_name;
106 106
 		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";
107 107
 		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";
108
-                 try {
109
-                        $sth = $this->db->prepare($query);
110
-                        $sth->execute(array(':filter_name' => $filter_name));
111
-                } catch(PDOException $e) {
112
-                        echo "error : ".$e->getMessage();
113
-                }
114
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
115
-                if (empty($all)) {
116
-            		$Spotter = new Spotter($this->db);
117
-            		$filters = array();
118
-            		if ($filter_name != '') {
119
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
120
-			}
121
-            		$all = $Spotter->countAllAirlineCountries($limit,$filters);
122
-                }
123
-                return $all;
108
+				 try {
109
+						$sth = $this->db->prepare($query);
110
+						$sth->execute(array(':filter_name' => $filter_name));
111
+				} catch(PDOException $e) {
112
+						echo "error : ".$e->getMessage();
113
+				}
114
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
115
+				if (empty($all)) {
116
+					$Spotter = new Spotter($this->db);
117
+					$filters = array();
118
+					if ($filter_name != '') {
119
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
120
+			}
121
+					$all = $Spotter->countAllAirlineCountries($limit,$filters);
122
+				}
123
+				return $all;
124 124
 	}
125 125
 	public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '') {
126 126
 		global $globalStatsFilters;
127 127
 		if ($filter_name == '') $filter_name = $this->filter_name;
128 128
 		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";
129 129
 		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";
130
-                 try {
131
-                        $sth = $this->db->prepare($query);
132
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
133
-                } catch(PDOException $e) {
134
-                        echo "error : ".$e->getMessage();
135
-                }
136
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
137
-                if (empty($all)) {
138
-            		$filters = array('airlines' => array($stats_airline));
139
-            		if ($filter_name != '') {
140
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
130
+				 try {
131
+						$sth = $this->db->prepare($query);
132
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
133
+				} catch(PDOException $e) {
134
+						echo "error : ".$e->getMessage();
135
+				}
136
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
137
+				if (empty($all)) {
138
+					$filters = array('airlines' => array($stats_airline));
139
+					if ($filter_name != '') {
140
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
141 141
 			}
142
-            		$Spotter = new Spotter($this->db);
142
+					$Spotter = new Spotter($this->db);
143 143
 			$all = $Spotter->countAllAircraftManufacturers($filters);
144
-                }
145
-                return $all;
144
+				}
145
+				return $all;
146 146
 	}
147 147
 
148 148
 	public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '') {
@@ -150,44 +150,44 @@  discard block
 block discarded – undo
150 150
 		if ($filter_name == '') $filter_name = $this->filter_name;
151 151
 		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";
152 152
 		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";
153
-                 try {
154
-                        $sth = $this->db->prepare($query);
155
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
156
-                } catch(PDOException $e) {
157
-                        echo "error : ".$e->getMessage();
158
-                }
159
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
160
-                if (empty($all)) {
153
+				 try {
154
+						$sth = $this->db->prepare($query);
155
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
156
+				} catch(PDOException $e) {
157
+						echo "error : ".$e->getMessage();
158
+				}
159
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
160
+				if (empty($all)) {
161 161
 			$filters = array('airlines' => array($stats_airline));
162 162
 			if ($filter_name != '') {
163
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
163
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
164 164
 			}
165 165
 			$Spotter = new Spotter($this->db);
166 166
 			$all = $Spotter->countAllArrivalCountries($limit,$filters);
167
-                }
168
-                return $all;
167
+				}
168
+				return $all;
169 169
 	}
170 170
 	public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '') {
171 171
 		global $globalStatsFilters;
172 172
 		if ($filter_name == '') $filter_name = $this->filter_name;
173 173
 		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";
174 174
 		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";
175
-                 try {
176
-                        $sth = $this->db->prepare($query);
177
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
178
-                } catch(PDOException $e) {
179
-                        echo "error : ".$e->getMessage();
180
-                }
181
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
182
-                if (empty($all)) {
175
+				 try {
176
+						$sth = $this->db->prepare($query);
177
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
178
+				} catch(PDOException $e) {
179
+						echo "error : ".$e->getMessage();
180
+				}
181
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
182
+				if (empty($all)) {
183 183
 			$filters = array('airlines' => array($stats_airline));
184 184
 			if ($filter_name != '') {
185
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
185
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
186 186
 			}
187 187
 			$Spotter = new Spotter($this->db);
188 188
 			$all = $Spotter->countAllDepartureCountries($filters);
189
-                }
190
-                return $all;
189
+				}
190
+				return $all;
191 191
 	}
192 192
 
193 193
 	public function countAllAirlines($limit = true,$filter_name = '') {
@@ -195,45 +195,45 @@  discard block
 block discarded – undo
195 195
 		if ($filter_name == '') $filter_name = $this->filter_name;
196 196
 		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";
197 197
 		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";
198
-                 try {
199
-                        $sth = $this->db->prepare($query);
200
-                        $sth->execute(array(':filter_name' => $filter_name));
201
-                } catch(PDOException $e) {
202
-                        echo "error : ".$e->getMessage();
203
-                }
204
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
205
-                if (empty($all)) {
206
-	                $Spotter = new Spotter($this->db);
207
-            		$filters = array();
208
-            		if ($filter_name != '') {
209
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
198
+				 try {
199
+						$sth = $this->db->prepare($query);
200
+						$sth->execute(array(':filter_name' => $filter_name));
201
+				} catch(PDOException $e) {
202
+						echo "error : ".$e->getMessage();
203
+				}
204
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
205
+				if (empty($all)) {
206
+					$Spotter = new Spotter($this->db);
207
+					$filters = array();
208
+					if ($filter_name != '') {
209
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
210 210
 			}
211 211
 
212
-    		        $all = $Spotter->countAllAirlines($limit,0,'',$filters);
213
-                }
214
-                return $all;
212
+					$all = $Spotter->countAllAirlines($limit,0,'',$filters);
213
+				}
214
+				return $all;
215 215
 	}
216 216
 	public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '') {
217 217
 		global $globalStatsFilters;
218 218
 		if ($filter_name == '') $filter_name = $this->filter_name;
219 219
 		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";
220 220
 		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";
221
-                 try {
222
-                        $sth = $this->db->prepare($query);
223
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
224
-                } catch(PDOException $e) {
225
-                        echo "error : ".$e->getMessage();
226
-                }
227
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
228
-                if (empty($all)) {
221
+				 try {
222
+						$sth = $this->db->prepare($query);
223
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
224
+				} catch(PDOException $e) {
225
+						echo "error : ".$e->getMessage();
226
+				}
227
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
228
+				if (empty($all)) {
229 229
 			$filters = array('airlines' => array($stats_airline));
230 230
 			if ($filter_name != '') {
231 231
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
232 232
 			}
233
-	                $Spotter = new Spotter($this->db);
234
-    		        $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters);
235
-                }
236
-                return $all;
233
+					$Spotter = new Spotter($this->db);
234
+					$all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters);
235
+				}
236
+				return $all;
237 237
 	}
238 238
 	public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '') {
239 239
 		global $globalStatsFilters;
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 				echo "error : ".$e->getMessage();
271 271
 			}
272 272
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
273
-                /*
273
+				/*
274 274
                 if (empty($all)) {
275 275
 	                $Spotter = new Spotter($this->db);
276 276
     		        $all = $Spotter->countAllFlightOverCountries($limit);
@@ -286,84 +286,84 @@  discard block
 block discarded – undo
286 286
 		if ($filter_name == '') $filter_name = $this->filter_name;
287 287
 		if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0";
288 288
 		else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC";
289
-                 try {
290
-                        $sth = $this->db->prepare($query);
291
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
292
-                } catch(PDOException $e) {
293
-                        echo "error : ".$e->getMessage();
294
-                }
295
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
296
-                if (empty($all)) {
289
+				 try {
290
+						$sth = $this->db->prepare($query);
291
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
292
+				} catch(PDOException $e) {
293
+						echo "error : ".$e->getMessage();
294
+				}
295
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
296
+				if (empty($all)) {
297 297
 			$filters = array('airlines' => array($stats_airline));
298 298
 			if ($filter_name != '') {
299 299
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
300 300
 			}
301
-            		$Spotter = new Spotter($this->db);
302
-            		$all = $Spotter->countAllPilots($limit,0,'',$filters);
303
-                }
304
-                return $all;
301
+					$Spotter = new Spotter($this->db);
302
+					$all = $Spotter->countAllPilots($limit,0,'',$filters);
303
+				}
304
+				return $all;
305 305
 	}
306 306
 	public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '') {
307 307
 		global $globalStatsFilters;
308 308
 		if ($filter_name == '') $filter_name = $this->filter_name;
309 309
 		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";
310 310
 		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";
311
-                 try {
312
-                        $sth = $this->db->prepare($query);
313
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
314
-                } catch(PDOException $e) {
315
-                        echo "error : ".$e->getMessage();
316
-                }
317
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
318
-                if (empty($all)) {
311
+				 try {
312
+						$sth = $this->db->prepare($query);
313
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
314
+				} catch(PDOException $e) {
315
+						echo "error : ".$e->getMessage();
316
+				}
317
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
318
+				if (empty($all)) {
319 319
 			$filters = array('airlines' => array($stats_airline));
320 320
 			if ($filter_name != '') {
321 321
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
322 322
 			}
323
-            		$Spotter = new Spotter($this->db);
324
-            		$all = $Spotter->countAllOwners($limit,0,'',$filters);
325
-                }
326
-                return $all;
323
+					$Spotter = new Spotter($this->db);
324
+					$all = $Spotter->countAllOwners($limit,0,'',$filters);
325
+				}
326
+				return $all;
327 327
 	}
328 328
 	public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '') {
329 329
 		global $globalStatsFilters;
330 330
 		if ($filter_name == '') $filter_name = $this->filter_name;
331 331
 		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 stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
332 332
 		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 stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
333
-                 try {
334
-                        $sth = $this->db->prepare($query);
335
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
336
-                } catch(PDOException $e) {
337
-                        echo "error : ".$e->getMessage();
338
-                }
339
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
340
-                if (empty($all)) {
333
+				 try {
334
+						$sth = $this->db->prepare($query);
335
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
336
+				} catch(PDOException $e) {
337
+						echo "error : ".$e->getMessage();
338
+				}
339
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
340
+				if (empty($all)) {
341 341
 			$filters = array('airlines' => array($stats_airline));
342
-            		if ($filter_name != '') {
343
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
344
-			}
345
-            		$Spotter = new Spotter($this->db);
346
-            		$pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters);
347
-        		$dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters);
348
-        		$all = array();
349
-        		foreach ($pall as $value) {
350
-        			$icao = $value['airport_departure_icao'];
351
-        			$all[$icao] = $value;
352
-        		}
342
+					if ($filter_name != '') {
343
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
344
+			}
345
+					$Spotter = new Spotter($this->db);
346
+					$pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters);
347
+				$dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters);
348
+				$all = array();
349
+				foreach ($pall as $value) {
350
+					$icao = $value['airport_departure_icao'];
351
+					$all[$icao] = $value;
352
+				}
353 353
         		
354
-        		foreach ($dall as $value) {
355
-        			$icao = $value['airport_departure_icao'];
356
-        			if (isset($all[$icao])) {
357
-        				$all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
358
-        			} else $all[$icao] = $value;
359
-        		}
360
-        		$count = array();
361
-        		foreach ($all as $key => $row) {
362
-        			$count[$key] = $row['airport_departure_icao_count'];
363
-        		}
364
-        		array_multisort($count,SORT_DESC,$all);
365
-                }
366
-                return $all;
354
+				foreach ($dall as $value) {
355
+					$icao = $value['airport_departure_icao'];
356
+					if (isset($all[$icao])) {
357
+						$all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
358
+					} else $all[$icao] = $value;
359
+				}
360
+				$count = array();
361
+				foreach ($all as $key => $row) {
362
+					$count[$key] = $row['airport_departure_icao_count'];
363
+				}
364
+				array_multisort($count,SORT_DESC,$all);
365
+				}
366
+				return $all;
367 367
 	}
368 368
 	public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '') {
369 369
 		global $globalStatsFilters;
@@ -385,26 +385,26 @@  discard block
 block discarded – undo
385 385
 			$Spotter = new Spotter($this->db);
386 386
 			$pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters);
387 387
 			$dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters);
388
-        		$all = array();
389
-        		foreach ($pall as $value) {
390
-        			$icao = $value['airport_arrival_icao'];
391
-        			$all[$icao] = $value;
392
-        		}
388
+				$all = array();
389
+				foreach ($pall as $value) {
390
+					$icao = $value['airport_arrival_icao'];
391
+					$all[$icao] = $value;
392
+				}
393 393
         		
394
-        		foreach ($dall as $value) {
395
-        			$icao = $value['airport_arrival_icao'];
396
-        			if (isset($all[$icao])) {
397
-        				$all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
398
-        			} else $all[$icao] = $value;
399
-        		}
400
-        		$count = array();
401
-        		foreach ($all as $key => $row) {
402
-        			$count[$key] = $row['airport_arrival_icao_count'];
403
-        		}
404
-        		array_multisort($count,SORT_DESC,$all);
405
-                }
394
+				foreach ($dall as $value) {
395
+					$icao = $value['airport_arrival_icao'];
396
+					if (isset($all[$icao])) {
397
+						$all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
398
+					} else $all[$icao] = $value;
399
+				}
400
+				$count = array();
401
+				foreach ($all as $key => $row) {
402
+					$count[$key] = $row['airport_arrival_icao_count'];
403
+				}
404
+				array_multisort($count,SORT_DESC,$all);
405
+				}
406 406
  
407
-                return $all;
407
+				return $all;
408 408
 	}
409 409
 	public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') {
410 410
 		global $globalDBdriver, $globalStatsFilters;
@@ -417,23 +417,23 @@  discard block
 block discarded – undo
417 417
 			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";
418 418
 		}
419 419
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
420
-                 try {
421
-                        $sth = $this->db->prepare($query);
422
-                        $sth->execute($query_data);
423
-                } catch(PDOException $e) {
424
-                        echo "error : ".$e->getMessage();
425
-                }
426
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
427
-                if (empty($all)) {
420
+				 try {
421
+						$sth = $this->db->prepare($query);
422
+						$sth->execute($query_data);
423
+				} catch(PDOException $e) {
424
+						echo "error : ".$e->getMessage();
425
+				}
426
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
427
+				if (empty($all)) {
428 428
 			$filters = array('airlines' => array($stats_airline));
429 429
 			if ($filter_name != '') {
430 430
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
431 431
 			}
432
-            		$Spotter = new Spotter($this->db);
433
-            		$all = $Spotter->countAllMonthsLastYear($filters);
434
-                }
432
+					$Spotter = new Spotter($this->db);
433
+					$all = $Spotter->countAllMonthsLastYear($filters);
434
+				}
435 435
                 
436
-                return $all;
436
+				return $all;
437 437
 	}
438 438
 	
439 439
 	public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') {
@@ -441,22 +441,22 @@  discard block
 block discarded – undo
441 441
 		if ($filter_name == '') $filter_name = $this->filter_name;
442 442
 		$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";
443 443
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
444
-                 try {
445
-                        $sth = $this->db->prepare($query);
446
-                        $sth->execute($query_data);
447
-                } catch(PDOException $e) {
448
-                        echo "error : ".$e->getMessage();
449
-                }
450
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
451
-                if (empty($all)) {
444
+				 try {
445
+						$sth = $this->db->prepare($query);
446
+						$sth->execute($query_data);
447
+				} catch(PDOException $e) {
448
+						echo "error : ".$e->getMessage();
449
+				}
450
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
451
+				if (empty($all)) {
452 452
 			$filters = array('airlines' => array($stats_airline));
453 453
 			if ($filter_name != '') {
454 454
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
455 455
 			}
456
-            		$Spotter = new Spotter($this->db);
457
-            		$all = $Spotter->countAllDatesLastMonth($filters);
458
-                }
459
-                return $all;
456
+					$Spotter = new Spotter($this->db);
457
+					$all = $Spotter->countAllDatesLastMonth($filters);
458
+				}
459
+				return $all;
460 460
 	}
461 461
 	public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') {
462 462
 		global $globalDBdriver, $globalStatsFilters;
@@ -467,108 +467,108 @@  discard block
 block discarded – undo
467 467
 			$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";
468 468
 		}
469 469
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
470
-                 try {
471
-                        $sth = $this->db->prepare($query);
472
-                        $sth->execute($query_data);
473
-                } catch(PDOException $e) {
474
-                        echo "error : ".$e->getMessage();
475
-                }
476
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
477
-                if (empty($all)) {
470
+				 try {
471
+						$sth = $this->db->prepare($query);
472
+						$sth->execute($query_data);
473
+				} catch(PDOException $e) {
474
+						echo "error : ".$e->getMessage();
475
+				}
476
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
477
+				if (empty($all)) {
478 478
 			$filters = array('airlines' => array($stats_airline));
479 479
 			if ($filter_name != '') {
480 480
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
481 481
 			}
482
-            		$Spotter = new Spotter($this->db);
483
-            		$all = $Spotter->countAllDatesLast7Days($filters);
484
-                }
485
-                return $all;
482
+					$Spotter = new Spotter($this->db);
483
+					$all = $Spotter->countAllDatesLast7Days($filters);
484
+				}
485
+				return $all;
486 486
 	}
487 487
 	public function countAllDates($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 = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name";
491 491
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
492
-                 try {
493
-                        $sth = $this->db->prepare($query);
494
-                        $sth->execute($query_data);
495
-                } catch(PDOException $e) {
496
-                        echo "error : ".$e->getMessage();
497
-                }
498
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
499
-                if (empty($all)) {
492
+				 try {
493
+						$sth = $this->db->prepare($query);
494
+						$sth->execute($query_data);
495
+				} catch(PDOException $e) {
496
+						echo "error : ".$e->getMessage();
497
+				}
498
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
499
+				if (empty($all)) {
500 500
 			$filters = array('airlines' => array($stats_airline));
501 501
 			if ($filter_name != '') {
502
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
502
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
503 503
 			}
504
-            		$Spotter = new Spotter($this->db);
505
-            		$all = $Spotter->countAllDates($filters);
506
-                }
507
-                return $all;
504
+					$Spotter = new Spotter($this->db);
505
+					$all = $Spotter->countAllDates($filters);
506
+				}
507
+				return $all;
508 508
 	}
509 509
 	public function countAllDatesByAirlines($filter_name = '') {
510 510
 		global $globalStatsFilters;
511 511
 		if ($filter_name == '') $filter_name = $this->filter_name;
512 512
 		$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";
513 513
 		$query_data = array('filter_name' => $filter_name);
514
-                 try {
515
-                        $sth = $this->db->prepare($query);
516
-                        $sth->execute($query_data);
517
-                } catch(PDOException $e) {
518
-                        echo "error : ".$e->getMessage();
519
-                }
520
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
521
-                if (empty($all)) {
522
-            		$filters = array();
523
-            		if ($filter_name != '') {
524
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
525
-			}
526
-            		$Spotter = new Spotter($this->db);
527
-            		$all = $Spotter->countAllDatesByAirlines($filters);
528
-                }
529
-                return $all;
514
+				 try {
515
+						$sth = $this->db->prepare($query);
516
+						$sth->execute($query_data);
517
+				} catch(PDOException $e) {
518
+						echo "error : ".$e->getMessage();
519
+				}
520
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
521
+				if (empty($all)) {
522
+					$filters = array();
523
+					if ($filter_name != '') {
524
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
525
+			}
526
+					$Spotter = new Spotter($this->db);
527
+					$all = $Spotter->countAllDatesByAirlines($filters);
528
+				}
529
+				return $all;
530 530
 	}
531 531
 	public function countAllMonths($stats_airline = '',$filter_name = '') {
532 532
 		global $globalStatsFilters;
533 533
 		if ($filter_name == '') $filter_name = $this->filter_name;
534
-	    	$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";
535
-                 try {
536
-                        $sth = $this->db->prepare($query);
537
-                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
538
-                } catch(PDOException $e) {
539
-                        echo "error : ".$e->getMessage();
540
-                }
541
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
542
-                if (empty($all)) {
534
+			$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";
535
+				 try {
536
+						$sth = $this->db->prepare($query);
537
+						$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
538
+				} catch(PDOException $e) {
539
+						echo "error : ".$e->getMessage();
540
+				}
541
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
542
+				if (empty($all)) {
543 543
 			$filters = array('airlines' => array($stats_airline));
544 544
 			if ($filter_name != '') {
545 545
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
546 546
 			}
547
-            		$Spotter = new Spotter($this->db);
548
-            		$all = $Spotter->countAllMonths($filters);
549
-                }
550
-                return $all;
547
+					$Spotter = new Spotter($this->db);
548
+					$all = $Spotter->countAllMonths($filters);
549
+				}
550
+				return $all;
551 551
 	}
552 552
 	public function countAllMilitaryMonths($filter_name = '') {
553 553
 		global $globalStatsFilters;
554 554
 		if ($filter_name == '') $filter_name = $this->filter_name;
555
-	    	$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";
556
-                 try {
557
-                        $sth = $this->db->prepare($query);
558
-                        $sth->execute(array(':filter_name' => $filter_name));
559
-                } catch(PDOException $e) {
560
-                        echo "error : ".$e->getMessage();
561
-                }
562
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
563
-                if (empty($all)) {
564
-            		$filters = array();
565
-            		if ($filter_name != '') {
566
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
567
-			}
568
-            		$Spotter = new Spotter($this->db);
569
-            		$all = $Spotter->countAllMilitaryMonths($filters);
570
-                }
571
-                return $all;
555
+			$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";
556
+				 try {
557
+						$sth = $this->db->prepare($query);
558
+						$sth->execute(array(':filter_name' => $filter_name));
559
+				} catch(PDOException $e) {
560
+						echo "error : ".$e->getMessage();
561
+				}
562
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
563
+				if (empty($all)) {
564
+					$filters = array();
565
+					if ($filter_name != '') {
566
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
567
+			}
568
+					$Spotter = new Spotter($this->db);
569
+					$all = $Spotter->countAllMilitaryMonths($filters);
570
+				}
571
+				return $all;
572 572
 	}
573 573
 	public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') {
574 574
 		global $globalTimezone, $globalDBdriver, $globalStatsFilters;
@@ -584,22 +584,22 @@  discard block
 block discarded – undo
584 584
 			$query .= " ORDER BY CAST(flight_date AS integer) ASC";
585 585
 		}
586 586
 		if ($orderby == 'count') $query .= " ORDER BY hour_count DESC";
587
-                 try {
588
-                        $sth = $this->db->prepare($query);
589
-                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
590
-                } catch(PDOException $e) {
591
-                        echo "error : ".$e->getMessage();
592
-                }
593
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
594
-                if (empty($all)) {
587
+				 try {
588
+						$sth = $this->db->prepare($query);
589
+						$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
590
+				} catch(PDOException $e) {
591
+						echo "error : ".$e->getMessage();
592
+				}
593
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
594
+				if (empty($all)) {
595 595
 			$filters = array('airlines' => array($stats_airline));
596 596
 			if ($filter_name != '') {
597
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
597
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
598 598
 			}
599
-            		$Spotter = new Spotter($this->db);
600
-            		$all = $Spotter->countAllHours($orderby,$filters);
601
-                }
602
-                return $all;
599
+					$Spotter = new Spotter($this->db);
600
+					$all = $Spotter->countAllHours($orderby,$filters);
601
+				}
602
+				return $all;
603 603
 	}
604 604
 	
605 605
 	public function countOverallFlights($stats_airline = '', $filter_name = '') {
@@ -621,9 +621,9 @@  discard block
 block discarded – undo
621 621
 		if ($filter_name == '') $filter_name = $this->filter_name;
622 622
 		$all = $this->getSumStats('military_flights_bymonth',date('Y'),'',$filter_name);
623 623
 		if (empty($all)) {
624
-		        $filters = array();
625
-            		if ($filter_name != '') {
626
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
624
+				$filters = array();
625
+					if ($filter_name != '') {
626
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
627 627
 			}
628 628
 			$Spotter = new Spotter($this->db);
629 629
 			$all = $Spotter->countOverallMilitaryFlights($filters);
@@ -662,19 +662,19 @@  discard block
 block discarded – undo
662 662
 		global $globalStatsFilters;
663 663
 		if ($filter_name == '') $filter_name = $this->filter_name;
664 664
 		$query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name";
665
-                 try {
666
-                        $sth = $this->db->prepare($query);
667
-                        $sth->execute(array(':filter_name' => $filter_name));
668
-                } catch(PDOException $e) {
669
-                        echo "error : ".$e->getMessage();
670
-                }
671
-                $result = $sth->fetchAll(PDO::FETCH_ASSOC);
672
-                $all = $result[0]['nb_airline'];
665
+				 try {
666
+						$sth = $this->db->prepare($query);
667
+						$sth->execute(array(':filter_name' => $filter_name));
668
+				} catch(PDOException $e) {
669
+						echo "error : ".$e->getMessage();
670
+				}
671
+				$result = $sth->fetchAll(PDO::FETCH_ASSOC);
672
+				$all = $result[0]['nb_airline'];
673 673
 		//$all = $this->getSumStats('airlines_bymonth',date('Y'));
674 674
 		if (empty($all)) {
675
-            		$filters = array();
676
-            		if ($filter_name != '') {
677
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
675
+					$filters = array();
676
+					if ($filter_name != '') {
677
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
678 678
 			}
679 679
 			$Spotter = new Spotter($this->db);
680 680
 			$all = $Spotter->countOverallAirlines($filters);
@@ -725,166 +725,166 @@  discard block
 block discarded – undo
725 725
 		if ($filter_name == '') $filter_name = $this->filter_name;
726 726
 		$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";
727 727
 		$query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
728
-                 try {
729
-                        $sth = $this->db->prepare($query);
730
-                        $sth->execute($query_values);
731
-                } catch(PDOException $e) {
732
-                        echo "error : ".$e->getMessage();
733
-                }
734
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
735
-                return $all;
728
+				 try {
729
+						$sth = $this->db->prepare($query);
730
+						$sth->execute($query_values);
731
+				} catch(PDOException $e) {
732
+						echo "error : ".$e->getMessage();
733
+				}
734
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
735
+				return $all;
736 736
 	}
737 737
 	public function getStats($type,$stats_airline = '', $filter_name = '') {
738 738
 		if ($filter_name == '') $filter_name = $this->filter_name;
739
-                $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date";
740
-                $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
741
-                 try {
742
-                        $sth = $this->db->prepare($query);
743
-                        $sth->execute($query_values);
744
-                } catch(PDOException $e) {
745
-                        echo "error : ".$e->getMessage();
746
-                }
747
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
748
-                return $all;
749
-        }
739
+				$query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date";
740
+				$query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
741
+				 try {
742
+						$sth = $this->db->prepare($query);
743
+						$sth->execute($query_values);
744
+				} catch(PDOException $e) {
745
+						echo "error : ".$e->getMessage();
746
+				}
747
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
748
+				return $all;
749
+		}
750 750
 	public function getSumStats($type,$year,$stats_airline = '',$filter_name = '') {
751 751
 		if ($filter_name == '') $filter_name = $this->filter_name;
752
-    		global $globalArchiveMonths, $globalDBdriver;
753
-    		if ($globalDBdriver == 'mysql') {
754
-	                $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";
755
-	        } else {
756
-            		$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";
757
-                }
758
-                $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
759
-                 try {
760
-                        $sth = $this->db->prepare($query);
761
-                        $sth->execute($query_values);
762
-                } catch(PDOException $e) {
763
-                        echo "error : ".$e->getMessage();
764
-                }
765
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
766
-                return $all[0]['total'];
767
-        }
752
+			global $globalArchiveMonths, $globalDBdriver;
753
+			if ($globalDBdriver == 'mysql') {
754
+					$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";
755
+			} else {
756
+					$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";
757
+				}
758
+				$query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
759
+				 try {
760
+						$sth = $this->db->prepare($query);
761
+						$sth->execute($query_values);
762
+				} catch(PDOException $e) {
763
+						echo "error : ".$e->getMessage();
764
+				}
765
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
766
+				return $all[0]['total'];
767
+		}
768 768
 	public function getStatsTotal($type, $stats_airline = '', $filter_name = '') {
769
-    		global $globalArchiveMonths, $globalDBdriver;
769
+			global $globalArchiveMonths, $globalDBdriver;
770 770
 		if ($filter_name == '') $filter_name = $this->filter_name;
771
-    		if ($globalDBdriver == 'mysql') {
771
+			if ($globalDBdriver == 'mysql') {
772 772
 			$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";
773 773
 		} else {
774 774
 			$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveMonths." MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
775
-                }
776
-                $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
777
-                 try {
778
-                        $sth = $this->db->prepare($query);
779
-                        $sth->execute($query_values);
780
-                } catch(PDOException $e) {
781
-                        echo "error : ".$e->getMessage();
782
-                }
783
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
784
-                return $all[0]['total'];
785
-        }
775
+				}
776
+				$query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
777
+				 try {
778
+						$sth = $this->db->prepare($query);
779
+						$sth->execute($query_values);
780
+				} catch(PDOException $e) {
781
+						echo "error : ".$e->getMessage();
782
+				}
783
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
784
+				return $all[0]['total'];
785
+		}
786 786
 	public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') {
787
-    		global $globalArchiveMonths, $globalDBdriver;
787
+			global $globalArchiveMonths, $globalDBdriver;
788 788
 		if ($filter_name == '') $filter_name = $this->filter_name;
789
-    		if ($globalDBdriver == 'mysql') {
789
+			if ($globalDBdriver == 'mysql') {
790 790
 			$query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name";
791
-                } else {
791
+				} else {
792 792
 			$query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name";
793
-                }
794
-                 try {
795
-                        $sth = $this->db->prepare($query);
796
-                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
797
-                } catch(PDOException $e) {
798
-                        echo "error : ".$e->getMessage();
799
-                }
800
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
801
-                return $all[0]['total'];
802
-        }
793
+				}
794
+				 try {
795
+						$sth = $this->db->prepare($query);
796
+						$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
797
+				} catch(PDOException $e) {
798
+						echo "error : ".$e->getMessage();
799
+				}
800
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
801
+				return $all[0]['total'];
802
+		}
803 803
 	public function getStatsAirlineTotal($filter_name = '') {
804
-    		global $globalArchiveMonths, $globalDBdriver;
804
+			global $globalArchiveMonths, $globalDBdriver;
805 805
 		if ($filter_name == '') $filter_name = $this->filter_name;
806
-    		if ($globalDBdriver == 'mysql') {
806
+			if ($globalDBdriver == 'mysql') {
807 807
 			$query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name";
808
-                } else {
808
+				} else {
809 809
 			$query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name";
810
-                }
811
-                 try {
812
-                        $sth = $this->db->prepare($query);
813
-                        $sth->execute(array(':filter_name' => $filter_name));
814
-                } catch(PDOException $e) {
815
-                        echo "error : ".$e->getMessage();
816
-                }
817
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
818
-                return $all[0]['total'];
819
-        }
810
+				}
811
+				 try {
812
+						$sth = $this->db->prepare($query);
813
+						$sth->execute(array(':filter_name' => $filter_name));
814
+				} catch(PDOException $e) {
815
+						echo "error : ".$e->getMessage();
816
+				}
817
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
818
+				return $all[0]['total'];
819
+		}
820 820
 	public function getStatsOwnerTotal($filter_name = '') {
821
-    		global $globalArchiveMonths, $globalDBdriver;
821
+			global $globalArchiveMonths, $globalDBdriver;
822 822
 		if ($filter_name == '') $filter_name = $this->filter_name;
823
-    		if ($globalDBdriver == 'mysql') {
823
+			if ($globalDBdriver == 'mysql') {
824 824
 			$query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name";
825 825
 		} else {
826 826
 			$query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name";
827
-                }
828
-                 try {
829
-                        $sth = $this->db->prepare($query);
830
-                        $sth->execute(array(':filter_name' => $filter_name));
831
-                } catch(PDOException $e) {
832
-                        echo "error : ".$e->getMessage();
833
-                }
834
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
835
-                return $all[0]['total'];
836
-        }
827
+				}
828
+				 try {
829
+						$sth = $this->db->prepare($query);
830
+						$sth->execute(array(':filter_name' => $filter_name));
831
+				} catch(PDOException $e) {
832
+						echo "error : ".$e->getMessage();
833
+				}
834
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
835
+				return $all[0]['total'];
836
+		}
837 837
 	public function getStatsPilotTotal($filter_name = '') {
838
-    		global $globalArchiveMonths, $globalDBdriver;
838
+			global $globalArchiveMonths, $globalDBdriver;
839 839
 		if ($filter_name == '') $filter_name = $this->filter_name;
840
-    		if ($globalDBdriver == 'mysql') {
841
-            		$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
842
-            	} else {
843
-            		$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
844
-            	}
845
-                 try {
846
-                        $sth = $this->db->prepare($query);
847
-                        $sth->execute(array(':filter_name' => $filter_name));
848
-                } catch(PDOException $e) {
849
-                        echo "error : ".$e->getMessage();
850
-                }
851
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
852
-                return $all[0]['total'];
853
-        }
840
+			if ($globalDBdriver == 'mysql') {
841
+					$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
842
+				} else {
843
+					$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
844
+				}
845
+				 try {
846
+						$sth = $this->db->prepare($query);
847
+						$sth->execute(array(':filter_name' => $filter_name));
848
+				} catch(PDOException $e) {
849
+						echo "error : ".$e->getMessage();
850
+				}
851
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
852
+				return $all[0]['total'];
853
+		}
854 854
 
855 855
 	public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
856 856
 		global $globalDBdriver;
857 857
 		if ($filter_name == '') $filter_name = $this->filter_name;
858 858
 		if ($globalDBdriver == 'mysql') {
859 859
 			$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";
860
-                } else {
860
+				} else {
861 861
 			$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);"; 
862 862
 		}
863
-                $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
864
-                 try {
865
-                        $sth = $this->db->prepare($query);
866
-                        $sth->execute($query_values);
867
-                } catch(PDOException $e) {
868
-                        return "error : ".$e->getMessage();
869
-                }
870
-        }
863
+				$query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
864
+				 try {
865
+						$sth = $this->db->prepare($query);
866
+						$sth->execute($query_values);
867
+				} catch(PDOException $e) {
868
+						return "error : ".$e->getMessage();
869
+				}
870
+		}
871 871
 	public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
872 872
 		global $globalDBdriver;
873 873
 		if ($filter_name == '') $filter_name = $this->filter_name;
874 874
 		if ($globalDBdriver == 'mysql') {
875 875
 			$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";
876 876
 		} else {
877
-            		//$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date";
877
+					//$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date";
878 878
 			$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);"; 
879
-                }
880
-                $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
881
-                 try {
882
-                        $sth = $this->db->prepare($query);
883
-                        $sth->execute($query_values);
884
-                } catch(PDOException $e) {
885
-                        return "error : ".$e->getMessage();
886
-                }
887
-        }
879
+				}
880
+				$query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
881
+				 try {
882
+						$sth = $this->db->prepare($query);
883
+						$sth->execute($query_values);
884
+				} catch(PDOException $e) {
885
+						return "error : ".$e->getMessage();
886
+				}
887
+		}
888 888
 	public function getStatsSource($date,$stats_type = '') {
889 889
 		if ($stats_type == '') {
890 890
 			$query = "SELECT * FROM stats_source WHERE stats_date = :date ORDER BY source_name";
@@ -893,15 +893,15 @@  discard block
 block discarded – undo
893 893
 			$query = "SELECT * FROM stats_source WHERE stats_date = :date AND stats_type = :stats_type ORDER BY source_name";
894 894
 			$query_values = array(':date' => $date,':stats_type' => $stats_type);
895 895
 		}
896
-                 try {
897
-                        $sth = $this->db->prepare($query);
898
-                        $sth->execute($query_values);
899
-                } catch(PDOException $e) {
900
-                        echo "error : ".$e->getMessage();
901
-                }
902
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
903
-                return $all;
904
-        }
896
+				 try {
897
+						$sth = $this->db->prepare($query);
898
+						$sth->execute($query_values);
899
+				} catch(PDOException $e) {
900
+						echo "error : ".$e->getMessage();
901
+				}
902
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
903
+				return $all;
904
+		}
905 905
 
906 906
 	public function addStatSource($data,$source_name,$stats_type,$date) {
907 907
 		global $globalDBdriver;
@@ -909,25 +909,25 @@  discard block
 block discarded – undo
909 909
 			$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";
910 910
 		} else {
911 911
 			$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);"; 
912
-                }
913
-                $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type);
914
-                 try {
915
-                        $sth = $this->db->prepare($query);
916
-                        $sth->execute($query_values);
917
-                } catch(PDOException $e) {
918
-                        return "error : ".$e->getMessage();
919
-                }
920
-        }
912
+				}
913
+				$query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type);
914
+				 try {
915
+						$sth = $this->db->prepare($query);
916
+						$sth->execute($query_values);
917
+				} catch(PDOException $e) {
918
+						return "error : ".$e->getMessage();
919
+				}
920
+		}
921 921
 	public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') {
922
-                $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)";
923
-                $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
924
-                 try {
925
-                        $sth = $this->db->prepare($query);
926
-                        $sth->execute($query_values);
927
-                } catch(PDOException $e) {
928
-                        return "error : ".$e->getMessage();
929
-                }
930
-        }
922
+				$query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)";
923
+				$query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
924
+				 try {
925
+						$sth = $this->db->prepare($query);
926
+						$sth->execute($query_values);
927
+				} catch(PDOException $e) {
928
+						return "error : ".$e->getMessage();
929
+				}
930
+		}
931 931
 	public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '') {
932 932
 		global $globalDBdriver;
933 933
 		if ($globalDBdriver == 'mysql') {
@@ -935,14 +935,14 @@  discard block
 block discarded – undo
935 935
 		} else {
936 936
 			$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);"; 
937 937
 		}
938
-                $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
939
-                 try {
940
-                        $sth = $this->db->prepare($query);
941
-                        $sth->execute($query_values);
942
-                } catch(PDOException $e) {
943
-                        return "error : ".$e->getMessage();
944
-                }
945
-        }
938
+				$query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
939
+				 try {
940
+						$sth = $this->db->prepare($query);
941
+						$sth->execute($query_values);
942
+				} catch(PDOException $e) {
943
+						return "error : ".$e->getMessage();
944
+				}
945
+		}
946 946
 	public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '') {
947 947
 		global $globalDBdriver;
948 948
 		if ($globalDBdriver == 'mysql') {
@@ -950,14 +950,14 @@  discard block
 block discarded – undo
950 950
 		} else {
951 951
 			$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);"; 
952 952
 		}
953
-                $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name);
954
-                 try {
955
-                        $sth = $this->db->prepare($query);
956
-                        $sth->execute($query_values);
957
-                } catch(PDOException $e) {
958
-                        return "error : ".$e->getMessage();
959
-                }
960
-        }
953
+				$query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name);
954
+				 try {
955
+						$sth = $this->db->prepare($query);
956
+						$sth->execute($query_values);
957
+				} catch(PDOException $e) {
958
+						return "error : ".$e->getMessage();
959
+				}
960
+		}
961 961
 	public function addStatCountry($iso2,$iso3,$name,$cnt,$filter_name = '') {
962 962
 		global $globalDBdriver;
963 963
 		if ($globalDBdriver == 'mysql') {
@@ -965,14 +965,14 @@  discard block
 block discarded – undo
965 965
 		} else {
966 966
 			$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);"; 
967 967
 		}
968
-                $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name);
969
-                 try {
970
-                        $sth = $this->db->prepare($query);
971
-                        $sth->execute($query_values);
972
-                } catch(PDOException $e) {
973
-                        return "error : ".$e->getMessage();
974
-                }
975
-        }
968
+				$query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name);
969
+				 try {
970
+						$sth = $this->db->prepare($query);
971
+						$sth->execute($query_values);
972
+				} catch(PDOException $e) {
973
+						return "error : ".$e->getMessage();
974
+				}
975
+		}
976 976
 	public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '') {
977 977
 		global $globalDBdriver;
978 978
 		if ($globalDBdriver == 'mysql') {
@@ -980,14 +980,14 @@  discard block
 block discarded – undo
980 980
 		} else {
981 981
 			$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);"; 
982 982
 		}
983
-                $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);
984
-                 try {
985
-                        $sth = $this->db->prepare($query);
986
-                        $sth->execute($query_values);
987
-                } catch(PDOException $e) {
988
-                        return "error : ".$e->getMessage();
989
-                }
990
-        }
983
+				$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);
984
+				 try {
985
+						$sth = $this->db->prepare($query);
986
+						$sth->execute($query_values);
987
+				} catch(PDOException $e) {
988
+						return "error : ".$e->getMessage();
989
+				}
990
+		}
991 991
 	public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '') {
992 992
 		global $globalDBdriver;
993 993
 		if ($globalDBdriver == 'mysql') {
@@ -995,14 +995,14 @@  discard block
 block discarded – undo
995 995
 		} else {
996 996
 			$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);"; 
997 997
 		}
998
-                $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name);
999
-                 try {
1000
-                        $sth = $this->db->prepare($query);
1001
-                        $sth->execute($query_values);
1002
-                } catch(PDOException $e) {
1003
-                        return "error : ".$e->getMessage();
1004
-                }
1005
-        }
998
+				$query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name);
999
+				 try {
1000
+						$sth = $this->db->prepare($query);
1001
+						$sth->execute($query_values);
1002
+				} catch(PDOException $e) {
1003
+						return "error : ".$e->getMessage();
1004
+				}
1005
+		}
1006 1006
 	public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '') {
1007 1007
 		global $globalDBdriver;
1008 1008
 		if ($globalDBdriver == 'mysql') {
@@ -1010,14 +1010,14 @@  discard block
 block discarded – undo
1010 1010
 		} else {
1011 1011
 			$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);"; 
1012 1012
 		}
1013
-                $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1014
-                 try {
1015
-                        $sth = $this->db->prepare($query);
1016
-                        $sth->execute($query_values);
1017
-                } catch(PDOException $e) {
1018
-                        return "error : ".$e->getMessage();
1019
-                }
1020
-        }
1013
+				$query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1014
+				 try {
1015
+						$sth = $this->db->prepare($query);
1016
+						$sth->execute($query_values);
1017
+				} catch(PDOException $e) {
1018
+						return "error : ".$e->getMessage();
1019
+				}
1020
+		}
1021 1021
 	public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '') {
1022 1022
 		global $globalDBdriver;
1023 1023
 		if ($globalDBdriver == 'mysql') {
@@ -1025,14 +1025,14 @@  discard block
 block discarded – undo
1025 1025
 		} else {
1026 1026
 			$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; INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name) SELECT :pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_pilot WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1027 1027
 		}
1028
-                $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1029
-                 try {
1030
-                        $sth = $this->db->prepare($query);
1031
-                        $sth->execute($query_values);
1032
-                } catch(PDOException $e) {
1033
-                        return "error : ".$e->getMessage();
1034
-                }
1035
-        }
1028
+				$query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1029
+				 try {
1030
+						$sth = $this->db->prepare($query);
1031
+						$sth->execute($query_values);
1032
+				} catch(PDOException $e) {
1033
+						return "error : ".$e->getMessage();
1034
+				}
1035
+		}
1036 1036
 	public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') {
1037 1037
 		global $globalDBdriver;
1038 1038
 		if ($globalDBdriver == 'mysql') {
@@ -1040,14 +1040,14 @@  discard block
 block discarded – undo
1040 1040
 		} else {
1041 1041
 			$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);"; 
1042 1042
 		}
1043
-                $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);
1044
-                 try {
1045
-                        $sth = $this->db->prepare($query);
1046
-                        $sth->execute($query_values);
1047
-                } catch(PDOException $e) {
1048
-                        return "error : ".$e->getMessage();
1049
-                }
1050
-        }
1043
+				$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);
1044
+				 try {
1045
+						$sth = $this->db->prepare($query);
1046
+						$sth->execute($query_values);
1047
+				} catch(PDOException $e) {
1048
+						return "error : ".$e->getMessage();
1049
+				}
1050
+		}
1051 1051
 	public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') {
1052 1052
 		global $globalDBdriver;
1053 1053
 		if ($globalDBdriver == 'mysql') {
@@ -1055,14 +1055,14 @@  discard block
 block discarded – undo
1055 1055
 		} else {
1056 1056
 			$query = "UPDATE stats_airport SET departure = departure+:departure WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1057 1057
 		}
1058
-                $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);
1059
-                 try {
1060
-                        $sth = $this->db->prepare($query);
1061
-                        $sth->execute($query_values);
1062
-                } catch(PDOException $e) {
1063
-                        return "error : ".$e->getMessage();
1064
-                }
1065
-        }
1058
+				$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);
1059
+				 try {
1060
+						$sth = $this->db->prepare($query);
1061
+						$sth->execute($query_values);
1062
+				} catch(PDOException $e) {
1063
+						return "error : ".$e->getMessage();
1064
+				}
1065
+		}
1066 1066
 	public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') {
1067 1067
 		global $globalDBdriver;
1068 1068
 		if ($globalDBdriver == 'mysql') {
@@ -1070,14 +1070,14 @@  discard block
 block discarded – undo
1070 1070
 		} else {
1071 1071
 			$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);"; 
1072 1072
 		}
1073
-                $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);
1074
-                 try {
1075
-                        $sth = $this->db->prepare($query);
1076
-                        $sth->execute($query_values);
1077
-                } catch(PDOException $e) {
1078
-                        return "error : ".$e->getMessage();
1079
-                }
1080
-        }
1073
+				$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);
1074
+				 try {
1075
+						$sth = $this->db->prepare($query);
1076
+						$sth->execute($query_values);
1077
+				} catch(PDOException $e) {
1078
+						return "error : ".$e->getMessage();
1079
+				}
1080
+		}
1081 1081
 	public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') {
1082 1082
 		global $globalDBdriver;
1083 1083
 		if ($globalDBdriver == 'mysql') {
@@ -1085,52 +1085,52 @@  discard block
 block discarded – undo
1085 1085
 		} else {
1086 1086
 			$query = "UPDATE stats_airport SET arrival = arrival+:arrival WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1087 1087
 		}
1088
-                $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);
1089
-                 try {
1090
-                        $sth = $this->db->prepare($query);
1091
-                        $sth->execute($query_values);
1092
-                } catch(PDOException $e) {
1093
-                        return "error : ".$e->getMessage();
1094
-                }
1095
-        }
1088
+				$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);
1089
+				 try {
1090
+						$sth = $this->db->prepare($query);
1091
+						$sth->execute($query_values);
1092
+				} catch(PDOException $e) {
1093
+						return "error : ".$e->getMessage();
1094
+				}
1095
+		}
1096 1096
 
1097 1097
 	public function deleteStat($id) {
1098
-                $query = "DELETE FROM stats WHERE stats_id = :id";
1099
-                $query_values = array(':id' => $id);
1100
-                 try {
1101
-                        $sth = $this->db->prepare($query);
1102
-                        $sth->execute($query_values);
1103
-                } catch(PDOException $e) {
1104
-                        return "error : ".$e->getMessage();
1105
-                }
1106
-        }
1098
+				$query = "DELETE FROM stats WHERE stats_id = :id";
1099
+				$query_values = array(':id' => $id);
1100
+				 try {
1101
+						$sth = $this->db->prepare($query);
1102
+						$sth->execute($query_values);
1103
+				} catch(PDOException $e) {
1104
+						return "error : ".$e->getMessage();
1105
+				}
1106
+		}
1107 1107
 	public function deleteStatFlight($type) {
1108
-                $query = "DELETE FROM stats_flight WHERE stats_type = :type";
1109
-                $query_values = array(':type' => $type);
1110
-                 try {
1111
-                        $sth = $this->db->prepare($query);
1112
-                        $sth->execute($query_values);
1113
-                } catch(PDOException $e) {
1114
-                        return "error : ".$e->getMessage();
1115
-                }
1116
-        }
1108
+				$query = "DELETE FROM stats_flight WHERE stats_type = :type";
1109
+				$query_values = array(':type' => $type);
1110
+				 try {
1111
+						$sth = $this->db->prepare($query);
1112
+						$sth->execute($query_values);
1113
+				} catch(PDOException $e) {
1114
+						return "error : ".$e->getMessage();
1115
+				}
1116
+		}
1117 1117
 	public function deleteStatAirport($type) {
1118
-                $query = "DELETE FROM stats_airport WHERE stats_type = :type";
1119
-                $query_values = array(':type' => $type);
1120
-                 try {
1121
-                        $sth = $this->db->prepare($query);
1122
-                        $sth->execute($query_values);
1123
-                } catch(PDOException $e) {
1124
-                        return "error : ".$e->getMessage();
1125
-                }
1126
-        }
1118
+				$query = "DELETE FROM stats_airport WHERE stats_type = :type";
1119
+				$query_values = array(':type' => $type);
1120
+				 try {
1121
+						$sth = $this->db->prepare($query);
1122
+						$sth->execute($query_values);
1123
+				} catch(PDOException $e) {
1124
+						return "error : ".$e->getMessage();
1125
+				}
1126
+		}
1127 1127
         
1128
-        public function addOldStats() {
1129
-    		global $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters;
1130
-    		$Common = new Common();
1131
-    		$Connection = new Connection();
1132
-    		date_default_timezone_set('UTC');
1133
-    		$last_update = $this->getLastStatsUpdate('last_update_stats');
1128
+		public function addOldStats() {
1129
+			global $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters;
1130
+			$Common = new Common();
1131
+			$Connection = new Connection();
1132
+			date_default_timezone_set('UTC');
1133
+			$last_update = $this->getLastStatsUpdate('last_update_stats');
1134 1134
 		//print_r($last_update);
1135 1135
 		/*
1136 1136
 		$flightsbymonth = $this->getStats('flights_by_month');
@@ -1384,46 +1384,46 @@  discard block
 block discarded – undo
1384 1384
 			}
1385 1385
 			
1386 1386
 			$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day);
1387
-        		$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day);
1388
-	        	$alldata = array();
1387
+				$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day);
1388
+				$alldata = array();
1389 1389
 	        	
1390
-    			foreach ($pall as $value) {
1391
-	        		$icao = $value['airport_departure_icao'];
1392
-    				$alldata[$icao] = $value;
1393
-	        	}
1394
-	        	foreach ($dall as $value) {
1395
-    				$icao = $value['airport_departure_icao'];
1396
-        			if (isset($alldata[$icao])) {
1397
-    					$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1398
-        			} else $alldata[$icao] = $value;
1399
-			}
1400
-    			$count = array();
1401
-    			foreach ($alldata as $key => $row) {
1402
-    				$count[$key] = $row['airport_departure_icao_count'];
1403
-        		}
1390
+				foreach ($pall as $value) {
1391
+					$icao = $value['airport_departure_icao'];
1392
+					$alldata[$icao] = $value;
1393
+				}
1394
+				foreach ($dall as $value) {
1395
+					$icao = $value['airport_departure_icao'];
1396
+					if (isset($alldata[$icao])) {
1397
+						$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1398
+					} else $alldata[$icao] = $value;
1399
+			}
1400
+				$count = array();
1401
+				foreach ($alldata as $key => $row) {
1402
+					$count[$key] = $row['airport_departure_icao_count'];
1403
+				}
1404 1404
 			array_multisort($count,SORT_DESC,$alldata);
1405 1405
 			foreach ($alldata as $number) {
1406 1406
 				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count']);
1407 1407
 			}
1408 1408
 			$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day);
1409
-        		$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day);
1410
-	        	$alldata = array();
1411
-    			foreach ($pall as $value) {
1412
-	        		$icao = $value['airport_arrival_icao'];
1413
-    				$alldata[$icao] = $value;
1414
-	        	}
1415
-	        	foreach ($dall as $value) {
1416
-    				$icao = $value['airport_arrival_icao'];
1417
-        			if (isset($alldata[$icao])) {
1418
-        				$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1419
-	        		} else $alldata[$icao] = $value;
1420
-    			}
1421
-        		$count = array();
1422
-        		foreach ($alldata as $key => $row) {
1423
-        			$count[$key] = $row['airport_arrival_icao_count'];
1424
-	        	}
1425
-    			array_multisort($count,SORT_DESC,$alldata);
1426
-                        foreach ($alldata as $number) {
1409
+				$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day);
1410
+				$alldata = array();
1411
+				foreach ($pall as $value) {
1412
+					$icao = $value['airport_arrival_icao'];
1413
+					$alldata[$icao] = $value;
1414
+				}
1415
+				foreach ($dall as $value) {
1416
+					$icao = $value['airport_arrival_icao'];
1417
+					if (isset($alldata[$icao])) {
1418
+						$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1419
+					} else $alldata[$icao] = $value;
1420
+				}
1421
+				$count = array();
1422
+				foreach ($alldata as $key => $row) {
1423
+					$count[$key] = $row['airport_arrival_icao_count'];
1424
+				}
1425
+				array_multisort($count,SORT_DESC,$alldata);
1426
+						foreach ($alldata as $number) {
1427 1427
 				echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count']);
1428 1428
 			}
1429 1429
 			if ($Connection->tableExists('countries')) {
@@ -1475,8 +1475,8 @@  discard block
 block discarded – undo
1475 1475
 //			$pall = $Spotter->getLast7DaysAirportsDeparture();
1476 1476
   //      		$dall = $Spotter->getLast7DaysDetectedAirportsDeparture();
1477 1477
 			$pall = $Spotter->getLast7DaysAirportsDeparture();
1478
-        		$dall = $Spotter->getLast7DaysDetectedAirportsDeparture();
1479
-        		/*
1478
+				$dall = $Spotter->getLast7DaysDetectedAirportsDeparture();
1479
+				/*
1480 1480
 	        	$alldata = array();
1481 1481
     			foreach ($pall as $value) {
1482 1482
 	        		$icao = $value['departure_airport_icao'];
@@ -1495,29 +1495,29 @@  discard block
 block discarded – undo
1495 1495
 	        	}
1496 1496
     			array_multisort($count,SORT_DESC,$alldata);
1497 1497
     			*/
1498
-    			foreach ($dall as $value) {
1499
-    				$icao = $value['departure_airport_icao'];
1500
-    				$ddate = $value['date'];
1501
-    				$find = false;
1502
-    				foreach ($pall as $pvalue) {
1503
-    					if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1504
-    						$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1505
-    						$find = true;
1506
-    						break;
1507
-    					}
1508
-    				}
1509
-    				if ($find === false) {
1510
-    					$pall[] = $value;
1511
-    				}
1512
-    			}
1513
-    			$alldata = $pall;
1498
+				foreach ($dall as $value) {
1499
+					$icao = $value['departure_airport_icao'];
1500
+					$ddate = $value['date'];
1501
+					$find = false;
1502
+					foreach ($pall as $pvalue) {
1503
+						if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1504
+							$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1505
+							$find = true;
1506
+							break;
1507
+						}
1508
+					}
1509
+					if ($find === false) {
1510
+						$pall[] = $value;
1511
+					}
1512
+				}
1513
+				$alldata = $pall;
1514 1514
 			foreach ($alldata as $number) {
1515 1515
 				$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']);
1516 1516
 			}
1517 1517
 			echo '...Arrival'."\n";
1518 1518
 			$pall = $Spotter->getLast7DaysAirportsArrival();
1519
-        		$dall = $Spotter->getLast7DaysDetectedAirportsArrival();
1520
-        		/*
1519
+				$dall = $Spotter->getLast7DaysDetectedAirportsArrival();
1520
+				/*
1521 1521
 	        	$alldata = array();
1522 1522
     			foreach ($pall as $value) {
1523 1523
 	        		$icao = $value['arrival_airport_icao'];
@@ -1537,22 +1537,22 @@  discard block
 block discarded – undo
1537 1537
     			*/
1538 1538
 
1539 1539
 
1540
-    			foreach ($dall as $value) {
1541
-    				$icao = $value['arrival_airport_icao'];
1542
-    				$ddate = $value['date'];
1543
-    				$find = false;
1544
-    				foreach ($pall as $pvalue) {
1545
-    					if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1546
-    						$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1547
-    						$find = true;
1548
-    						break;
1549
-    					}
1550
-    				}
1551
-    				if ($find === false) {
1552
-    					$pall[] = $value;
1553
-    				}
1554
-    			}
1555
-    			$alldata = $pall;
1540
+				foreach ($dall as $value) {
1541
+					$icao = $value['arrival_airport_icao'];
1542
+					$ddate = $value['date'];
1543
+					$find = false;
1544
+					foreach ($pall as $pvalue) {
1545
+						if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1546
+							$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1547
+							$find = true;
1548
+							break;
1549
+						}
1550
+					}
1551
+					if ($find === false) {
1552
+						$pall[] = $value;
1553
+					}
1554
+				}
1555
+				$alldata = $pall;
1556 1556
 			foreach ($alldata as $number) {
1557 1557
 				$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']);
1558 1558
 			}
@@ -1613,47 +1613,47 @@  discard block
 block discarded – undo
1613 1613
 			}
1614 1614
 			
1615 1615
 			$pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day);
1616
-       			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day);
1617
-	        	//$alldata = array();
1618
-    			foreach ($dall as $value) {
1619
-    				$icao = $value['airport_departure_icao'];
1620
-    				$dicao = $value['airline_icao'];
1621
-    				$find = false;
1622
-    				foreach ($pall as $pvalue) {
1623
-    					if ($pvalue['airport_departure_icao'] == $icao && $pvalue['airline_icao'] = $dicao) {
1624
-    						$pvalue['airport_departure_icao_count'] = $pvalue['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1625
-    						$find = true;
1626
-    						break;
1627
-    					}
1628
-    				}
1629
-    				if ($find === false) {
1630
-    					$pall[] = $value;
1631
-    				}
1632
-    			}
1633
-    			$alldata = $pall;
1616
+	   			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day);
1617
+				//$alldata = array();
1618
+				foreach ($dall as $value) {
1619
+					$icao = $value['airport_departure_icao'];
1620
+					$dicao = $value['airline_icao'];
1621
+					$find = false;
1622
+					foreach ($pall as $pvalue) {
1623
+						if ($pvalue['airport_departure_icao'] == $icao && $pvalue['airline_icao'] = $dicao) {
1624
+							$pvalue['airport_departure_icao_count'] = $pvalue['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1625
+							$find = true;
1626
+							break;
1627
+						}
1628
+					}
1629
+					if ($find === false) {
1630
+						$pall[] = $value;
1631
+					}
1632
+				}
1633
+				$alldata = $pall;
1634 1634
 			foreach ($alldata as $number) {
1635 1635
 				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']);
1636 1636
 			}
1637 1637
 			$pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day);
1638
-        		$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day);
1639
-	        	//$alldata = array();
1640
-    			foreach ($dall as $value) {
1641
-    				$icao = $value['airport_arrival_icao'];
1642
-    				$dicao = $value['airline_icao'];
1643
-    				$find = false;
1644
-    				foreach ($pall as $pvalue) {
1645
-    					if ($pvalue['airport_arrival_icao'] == $icao && $pvalue['airline_icao'] = $dicao) {
1646
-    						$pvalue['airport_arrival_icao_count'] = $pvalue['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1647
-    						$find = true;
1648
-    						break;
1649
-    					}
1650
-    				}
1651
-    				if ($find === false) {
1652
-    					$pall[] = $value;
1653
-    				}
1654
-    			}
1655
-    			$alldata = $pall;
1656
-                        foreach ($alldata as $number) {
1638
+				$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day);
1639
+				//$alldata = array();
1640
+				foreach ($dall as $value) {
1641
+					$icao = $value['airport_arrival_icao'];
1642
+					$dicao = $value['airline_icao'];
1643
+					$find = false;
1644
+					foreach ($pall as $pvalue) {
1645
+						if ($pvalue['airport_arrival_icao'] == $icao && $pvalue['airline_icao'] = $dicao) {
1646
+							$pvalue['airport_arrival_icao_count'] = $pvalue['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1647
+							$find = true;
1648
+							break;
1649
+						}
1650
+					}
1651
+					if ($find === false) {
1652
+						$pall[] = $value;
1653
+					}
1654
+				}
1655
+				$alldata = $pall;
1656
+						foreach ($alldata as $number) {
1657 1657
 				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']);
1658 1658
 			}
1659 1659
 			$Spotter = new Spotter($this->db);
@@ -1681,47 +1681,47 @@  discard block
 block discarded – undo
1681 1681
 			}
1682 1682
 			echo '...Departure'."\n";
1683 1683
 			$pall = $Spotter->getLast7DaysAirportsDepartureByAirlines();
1684
-        		$dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines();
1685
-    			foreach ($dall as $value) {
1686
-    				$icao = $value['departure_airport_icao'];
1687
-    				$airline = $value['airline_icao'];
1688
-    				$ddate = $value['date'];
1689
-    				$find = false;
1690
-    				foreach ($pall as $pvalue) {
1691
-    					if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] = $airline) {
1692
-    						$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1693
-    						$find = true;
1694
-    						break;
1695
-    					}
1696
-    				}
1697
-    				if ($find === false) {
1698
-    					$pall[] = $value;
1699
-    				}
1700
-    			}
1701
-    			$alldata = $pall;
1684
+				$dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines();
1685
+				foreach ($dall as $value) {
1686
+					$icao = $value['departure_airport_icao'];
1687
+					$airline = $value['airline_icao'];
1688
+					$ddate = $value['date'];
1689
+					$find = false;
1690
+					foreach ($pall as $pvalue) {
1691
+						if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] = $airline) {
1692
+							$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1693
+							$find = true;
1694
+							break;
1695
+						}
1696
+					}
1697
+					if ($find === false) {
1698
+						$pall[] = $value;
1699
+					}
1700
+				}
1701
+				$alldata = $pall;
1702 1702
 			foreach ($alldata as $number) {
1703 1703
 				$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']);
1704 1704
 			}
1705 1705
 			echo '...Arrival'."\n";
1706 1706
 			$pall = $Spotter->getLast7DaysAirportsArrivalByAirlines();
1707
-        		$dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines();
1708
-    			foreach ($dall as $value) {
1709
-    				$icao = $value['arrival_airport_icao'];
1710
-    				$airline = $value['airline_icao'];
1711
-    				$ddate = $value['date'];
1712
-    				$find = false;
1713
-    				foreach ($pall as $pvalue) {
1714
-    					if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] == $airline) {
1715
-    						$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1716
-    						$find = true;
1717
-    						break;
1718
-    					}
1719
-    				}
1720
-    				if ($find === false) {
1721
-    					$pall[] = $value;
1722
-    				}
1723
-    			}
1724
-    			$alldata = $pall;
1707
+				$dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines();
1708
+				foreach ($dall as $value) {
1709
+					$icao = $value['arrival_airport_icao'];
1710
+					$airline = $value['airline_icao'];
1711
+					$ddate = $value['date'];
1712
+					$find = false;
1713
+					foreach ($pall as $pvalue) {
1714
+						if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] == $airline) {
1715
+							$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1716
+							$find = true;
1717
+							break;
1718
+						}
1719
+					}
1720
+					if ($find === false) {
1721
+						$pall[] = $value;
1722
+					}
1723
+				}
1724
+				$alldata = $pall;
1725 1725
 			foreach ($alldata as $number) {
1726 1726
 				$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']);
1727 1727
 			}
@@ -1781,44 +1781,44 @@  discard block
 block discarded – undo
1781 1781
 				}
1782 1782
     			
1783 1783
 				$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter);
1784
-	       			$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter);
1785
-		        	$alldata = array();
1786
-	    			foreach ($pall as $value) {
1787
-		        		$icao = $value['airport_departure_icao'];
1788
-    					$alldata[$icao] = $value;
1789
-	    			}
1790
-		        	foreach ($dall as $value) {
1791
-	    				$icao = $value['airport_departure_icao'];
1792
-        				if (isset($alldata[$icao])) {
1793
-    						$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1794
-        				} else $alldata[$icao] = $value;
1795
-				}
1796
-	    			$count = array();
1797
-    				foreach ($alldata as $key => $row) {
1798
-    					$count[$key] = $row['airport_departure_icao_count'];
1799
-    				}
1784
+		   			$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter);
1785
+					$alldata = array();
1786
+					foreach ($pall as $value) {
1787
+						$icao = $value['airport_departure_icao'];
1788
+						$alldata[$icao] = $value;
1789
+					}
1790
+					foreach ($dall as $value) {
1791
+						$icao = $value['airport_departure_icao'];
1792
+						if (isset($alldata[$icao])) {
1793
+							$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1794
+						} else $alldata[$icao] = $value;
1795
+				}
1796
+					$count = array();
1797
+					foreach ($alldata as $key => $row) {
1798
+						$count[$key] = $row['airport_departure_icao_count'];
1799
+					}
1800 1800
 				array_multisort($count,SORT_DESC,$alldata);
1801 1801
 				foreach ($alldata as $number) {
1802
-    					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);
1802
+						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);
1803 1803
 				}
1804 1804
 				$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,$filter);
1805
-    				$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,$filter);
1805
+					$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,$filter);
1806 1806
 				$alldata = array();
1807
-    				foreach ($pall as $value) {
1808
-		        		$icao = $value['airport_arrival_icao'];
1809
-    					$alldata[$icao] = $value;
1810
-	    			}
1811
-		        	foreach ($dall as $value) {
1812
-	    				$icao = $value['airport_arrival_icao'];
1813
-        				if (isset($alldata[$icao])) {
1814
-        					$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1815
-		        		} else $alldata[$icao] = $value;
1816
-	    			}
1817
-        			$count = array();
1818
-        			foreach ($alldata as $key => $row) {
1819
-    					$count[$key] = $row['airport_arrival_icao_count'];
1820
-		        	}
1821
-        			array_multisort($count,SORT_DESC,$alldata);
1807
+					foreach ($pall as $value) {
1808
+						$icao = $value['airport_arrival_icao'];
1809
+						$alldata[$icao] = $value;
1810
+					}
1811
+					foreach ($dall as $value) {
1812
+						$icao = $value['airport_arrival_icao'];
1813
+						if (isset($alldata[$icao])) {
1814
+							$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1815
+						} else $alldata[$icao] = $value;
1816
+					}
1817
+					$count = array();
1818
+					foreach ($alldata as $key => $row) {
1819
+						$count[$key] = $row['airport_arrival_icao_count'];
1820
+					}
1821
+					array_multisort($count,SORT_DESC,$alldata);
1822 1822
 				foreach ($alldata as $number) {
1823 1823
 					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);
1824 1824
 				}
@@ -1847,45 +1847,45 @@  discard block
 block discarded – undo
1847 1847
 				}
1848 1848
 				echo '...Departure'."\n";
1849 1849
 				$pall = $Spotter->getLast7DaysAirportsDeparture('',$filter);
1850
-        			$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter);
1850
+					$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter);
1851 1851
 				foreach ($dall as $value) {
1852
-    					$icao = $value['departure_airport_icao'];
1853
-    					$ddate = $value['date'];
1854
-    					$find = false;
1855
-    					foreach ($pall as $pvalue) {
1856
-    						if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1857
-    							$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1858
-	    						$find = true;
1859
-    							break;
1860
-    						}
1861
-    					}
1862
-    					if ($find === false) {
1863
-    						$pall[] = $value;
1864
-	    				}
1865
-    				}
1866
-	    			$alldata = $pall;
1852
+						$icao = $value['departure_airport_icao'];
1853
+						$ddate = $value['date'];
1854
+						$find = false;
1855
+						foreach ($pall as $pvalue) {
1856
+							if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1857
+								$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1858
+								$find = true;
1859
+								break;
1860
+							}
1861
+						}
1862
+						if ($find === false) {
1863
+							$pall[] = $value;
1864
+						}
1865
+					}
1866
+					$alldata = $pall;
1867 1867
 				foreach ($alldata as $number) {
1868 1868
 					$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);
1869 1869
 				}
1870 1870
 				echo '...Arrival'."\n";
1871 1871
 				$pall = $Spotter->getLast7DaysAirportsArrival('',$filter);
1872
-    				$dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter);
1872
+					$dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter);
1873 1873
 				foreach ($dall as $value) {
1874 1874
 					$icao = $value['arrival_airport_icao'];
1875 1875
 					$ddate = $value['date'];
1876
-    					$find = false;
1876
+						$find = false;
1877 1877
 					foreach ($pall as $pvalue) {
1878
-    						if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1879
-    							$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1880
-    							$find = true;
1881
-    							break;
1882
-	    					}
1883
-    					}
1884
-    					if ($find === false) {
1885
-    						$pall[] = $value;
1886
-	    				}
1887
-    				}
1888
-    				$alldata = $pall;
1878
+							if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1879
+								$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1880
+								$find = true;
1881
+								break;
1882
+							}
1883
+						}
1884
+						if ($find === false) {
1885
+							$pall[] = $value;
1886
+						}
1887
+					}
1888
+					$alldata = $pall;
1889 1889
 				foreach ($alldata as $number) {
1890 1890
 					$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);
1891 1891
 				}
Please login to merge, or discard this patch.
Spacing   +297 added lines, -297 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);
@@ -46,31 +46,31 @@  discard block
 block discarded – undo
46 46
                  try {
47 47
                         $sth = $this->db->prepare($query);
48 48
                         $sth->execute(array(':filter_name' => $filter_name));
49
-                } catch(PDOException $e) {
49
+                } catch (PDOException $e) {
50 50
                         echo "error : ".$e->getMessage();
51 51
                 }
52 52
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
53 53
                 return $all;
54 54
         }
55
-	public function getAllAircraftTypes($stats_airline = '',$filter_name = '') {
55
+	public function getAllAircraftTypes($stats_airline = '', $filter_name = '') {
56 56
 		if ($filter_name == '') $filter_name = $this->filter_name;
57 57
                 $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
58 58
                  try {
59 59
                         $sth = $this->db->prepare($query);
60
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
61
-                } catch(PDOException $e) {
60
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
61
+                } catch (PDOException $e) {
62 62
                         echo "error : ".$e->getMessage();
63 63
                 }
64 64
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
65 65
                 return $all;
66 66
         }
67
-	public function getAllAirportNames($stats_airline = '',$filter_name = '') {
67
+	public function getAllAirportNames($stats_airline = '', $filter_name = '') {
68 68
 		if ($filter_name == '') $filter_name = $this->filter_name;
69 69
                 $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC";
70 70
                  try {
71 71
                         $sth = $this->db->prepare($query);
72
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
73
-                } catch(PDOException $e) {
72
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
73
+                } catch (PDOException $e) {
74 74
                         echo "error : ".$e->getMessage();
75 75
                 }
76 76
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -85,22 +85,22 @@  discard block
 block discarded – undo
85 85
 		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";
86 86
                  try {
87 87
                         $sth = $this->db->prepare($query);
88
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
89
-                } catch(PDOException $e) {
88
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
89
+                } catch (PDOException $e) {
90 90
                         echo "error : ".$e->getMessage();
91 91
                 }
92 92
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
93 93
                 if (empty($all)) {
94 94
             	    $filters = array('airlines' => array($stats_airline));
95 95
             	    if ($filter_name != '') {
96
-            		    $filters = array_merge($filters,$globalStatsFilters[$filter_name]);
96
+            		    $filters = array_merge($filters, $globalStatsFilters[$filter_name]);
97 97
             	    }
98 98
             	    $Spotter = new Spotter($this->db);
99
-            	    $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters);
99
+            	    $all = $Spotter->countAllAircraftTypes($limit, 0, '', $filters);
100 100
                 }
101 101
                 return $all;
102 102
 	}
103
-	public function countAllAirlineCountries($limit = true,$filter_name = '') {
103
+	public function countAllAirlineCountries($limit = true, $filter_name = '') {
104 104
 		global $globalStatsFilters;
105 105
 		if ($filter_name == '') $filter_name = $this->filter_name;
106 106
 		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";
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
                  try {
109 109
                         $sth = $this->db->prepare($query);
110 110
                         $sth->execute(array(':filter_name' => $filter_name));
111
-                } catch(PDOException $e) {
111
+                } catch (PDOException $e) {
112 112
                         echo "error : ".$e->getMessage();
113 113
                 }
114 114
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -116,28 +116,28 @@  discard block
 block discarded – undo
116 116
             		$Spotter = new Spotter($this->db);
117 117
             		$filters = array();
118 118
             		if ($filter_name != '') {
119
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
119
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
120 120
 			}
121
-            		$all = $Spotter->countAllAirlineCountries($limit,$filters);
121
+            		$all = $Spotter->countAllAirlineCountries($limit, $filters);
122 122
                 }
123 123
                 return $all;
124 124
 	}
125
-	public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '') {
125
+	public function countAllAircraftManufacturers($limit = true, $stats_airline = '', $filter_name = '') {
126 126
 		global $globalStatsFilters;
127 127
 		if ($filter_name == '') $filter_name = $this->filter_name;
128 128
 		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";
129 129
 		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";
130 130
                  try {
131 131
                         $sth = $this->db->prepare($query);
132
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
133
-                } catch(PDOException $e) {
132
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
133
+                } catch (PDOException $e) {
134 134
                         echo "error : ".$e->getMessage();
135 135
                 }
136 136
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
137 137
                 if (empty($all)) {
138 138
             		$filters = array('airlines' => array($stats_airline));
139 139
             		if ($filter_name != '') {
140
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
140
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
141 141
 			}
142 142
             		$Spotter = new Spotter($this->db);
143 143
 			$all = $Spotter->countAllAircraftManufacturers($filters);
@@ -152,18 +152,18 @@  discard block
 block discarded – undo
152 152
 		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";
153 153
                  try {
154 154
                         $sth = $this->db->prepare($query);
155
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
156
-                } catch(PDOException $e) {
155
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
156
+                } catch (PDOException $e) {
157 157
                         echo "error : ".$e->getMessage();
158 158
                 }
159 159
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
160 160
                 if (empty($all)) {
161 161
 			$filters = array('airlines' => array($stats_airline));
162 162
 			if ($filter_name != '') {
163
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
163
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
164 164
 			}
165 165
 			$Spotter = new Spotter($this->db);
166
-			$all = $Spotter->countAllArrivalCountries($limit,$filters);
166
+			$all = $Spotter->countAllArrivalCountries($limit, $filters);
167 167
                 }
168 168
                 return $all;
169 169
 	}
@@ -174,15 +174,15 @@  discard block
 block discarded – undo
174 174
 		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";
175 175
                  try {
176 176
                         $sth = $this->db->prepare($query);
177
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
178
-                } catch(PDOException $e) {
177
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
178
+                } catch (PDOException $e) {
179 179
                         echo "error : ".$e->getMessage();
180 180
                 }
181 181
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
182 182
                 if (empty($all)) {
183 183
 			$filters = array('airlines' => array($stats_airline));
184 184
 			if ($filter_name != '') {
185
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
185
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
186 186
 			}
187 187
 			$Spotter = new Spotter($this->db);
188 188
 			$all = $Spotter->countAllDepartureCountries($filters);
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
                 return $all;
191 191
 	}
192 192
 
193
-	public function countAllAirlines($limit = true,$filter_name = '') {
193
+	public function countAllAirlines($limit = true, $filter_name = '') {
194 194
 		global $globalStatsFilters;
195 195
 		if ($filter_name == '') $filter_name = $this->filter_name;
196 196
 		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";
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
                  try {
199 199
                         $sth = $this->db->prepare($query);
200 200
                         $sth->execute(array(':filter_name' => $filter_name));
201
-                } catch(PDOException $e) {
201
+                } catch (PDOException $e) {
202 202
                         echo "error : ".$e->getMessage();
203 203
                 }
204 204
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -206,58 +206,58 @@  discard block
 block discarded – undo
206 206
 	                $Spotter = new Spotter($this->db);
207 207
             		$filters = array();
208 208
             		if ($filter_name != '') {
209
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
209
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
210 210
 			}
211 211
 
212
-    		        $all = $Spotter->countAllAirlines($limit,0,'',$filters);
212
+    		        $all = $Spotter->countAllAirlines($limit, 0, '', $filters);
213 213
                 }
214 214
                 return $all;
215 215
 	}
216
-	public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '') {
216
+	public function countAllAircraftRegistrations($limit = true, $stats_airline = '', $filter_name = '') {
217 217
 		global $globalStatsFilters;
218 218
 		if ($filter_name == '') $filter_name = $this->filter_name;
219 219
 		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";
220 220
 		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";
221 221
                  try {
222 222
                         $sth = $this->db->prepare($query);
223
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
224
-                } catch(PDOException $e) {
223
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
224
+                } catch (PDOException $e) {
225 225
                         echo "error : ".$e->getMessage();
226 226
                 }
227 227
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
228 228
                 if (empty($all)) {
229 229
 			$filters = array('airlines' => array($stats_airline));
230 230
 			if ($filter_name != '') {
231
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
231
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
232 232
 			}
233 233
 	                $Spotter = new Spotter($this->db);
234
-    		        $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters);
234
+    		        $all = $Spotter->countAllAircraftRegistrations($limit, 0, '', $filters);
235 235
                 }
236 236
                 return $all;
237 237
 	}
238
-	public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '') {
238
+	public function countAllCallsigns($limit = true, $stats_airline = '', $filter_name = '') {
239 239
 		global $globalStatsFilters;
240 240
 		if ($filter_name == '') $filter_name = $this->filter_name;
241 241
 		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";
242 242
 		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";
243 243
 		 try {
244 244
 			$sth = $this->db->prepare($query);
245
-			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
246
-		} catch(PDOException $e) {
245
+			$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
246
+		} catch (PDOException $e) {
247 247
 			echo "error : ".$e->getMessage();
248 248
 		}
249 249
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
250 250
 		if (empty($all)) {
251 251
 			$filters = array('airlines' => array($stats_airline));
252 252
 			if ($filter_name != '') {
253
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
253
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
254 254
 			}
255 255
 			$Spotter = new Spotter($this->db);
256
-			$all = $Spotter->countAllCallsigns($limit,0,'',$filters);
256
+			$all = $Spotter->countAllCallsigns($limit, 0, '', $filters);
257 257
 		}
258 258
 		return $all;
259 259
 	}
260
-	public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '') {
260
+	public function countAllFlightOverCountries($limit = true, $stats_airline = '', $filter_name = '') {
261 261
 		$Connection = new Connection();
262 262
 		if ($filter_name == '') $filter_name = $this->filter_name;
263 263
 		if ($Connection->tableExists('countries')) {
@@ -265,8 +265,8 @@  discard block
 block discarded – undo
265 265
 			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";
266 266
 			 try {
267 267
 				$sth = $this->db->prepare($query);
268
-				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
269
-			} catch(PDOException $e) {
268
+				$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
269
+			} catch (PDOException $e) {
270 270
 				echo "error : ".$e->getMessage();
271 271
 			}
272 272
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -281,70 +281,70 @@  discard block
 block discarded – undo
281 281
 			return array();
282 282
 		}
283 283
 	}
284
-	public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '') {
284
+	public function countAllPilots($limit = true, $stats_airline = '', $filter_name = '') {
285 285
 		global $globalStatsFilters;
286 286
 		if ($filter_name == '') $filter_name = $this->filter_name;
287 287
 		if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0";
288 288
 		else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC";
289 289
                  try {
290 290
                         $sth = $this->db->prepare($query);
291
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
292
-                } catch(PDOException $e) {
291
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
292
+                } catch (PDOException $e) {
293 293
                         echo "error : ".$e->getMessage();
294 294
                 }
295 295
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
296 296
                 if (empty($all)) {
297 297
 			$filters = array('airlines' => array($stats_airline));
298 298
 			if ($filter_name != '') {
299
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
299
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
300 300
 			}
301 301
             		$Spotter = new Spotter($this->db);
302
-            		$all = $Spotter->countAllPilots($limit,0,'',$filters);
302
+            		$all = $Spotter->countAllPilots($limit, 0, '', $filters);
303 303
                 }
304 304
                 return $all;
305 305
 	}
306
-	public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '') {
306
+	public function countAllOwners($limit = true, $stats_airline = '', $filter_name = '') {
307 307
 		global $globalStatsFilters;
308 308
 		if ($filter_name == '') $filter_name = $this->filter_name;
309 309
 		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";
310 310
 		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";
311 311
                  try {
312 312
                         $sth = $this->db->prepare($query);
313
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
314
-                } catch(PDOException $e) {
313
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
314
+                } catch (PDOException $e) {
315 315
                         echo "error : ".$e->getMessage();
316 316
                 }
317 317
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
318 318
                 if (empty($all)) {
319 319
 			$filters = array('airlines' => array($stats_airline));
320 320
 			if ($filter_name != '') {
321
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
321
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
322 322
 			}
323 323
             		$Spotter = new Spotter($this->db);
324
-            		$all = $Spotter->countAllOwners($limit,0,'',$filters);
324
+            		$all = $Spotter->countAllOwners($limit, 0, '', $filters);
325 325
                 }
326 326
                 return $all;
327 327
 	}
328
-	public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '') {
328
+	public function countAllDepartureAirports($limit = true, $stats_airline = '', $filter_name = '') {
329 329
 		global $globalStatsFilters;
330 330
 		if ($filter_name == '') $filter_name = $this->filter_name;
331 331
 		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 stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
332 332
 		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 stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
333 333
                  try {
334 334
                         $sth = $this->db->prepare($query);
335
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
336
-                } catch(PDOException $e) {
335
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
336
+                } catch (PDOException $e) {
337 337
                         echo "error : ".$e->getMessage();
338 338
                 }
339 339
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
340 340
                 if (empty($all)) {
341 341
 			$filters = array('airlines' => array($stats_airline));
342 342
             		if ($filter_name != '') {
343
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
343
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
344 344
 			}
345 345
             		$Spotter = new Spotter($this->db);
346
-            		$pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters);
347
-        		$dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters);
346
+            		$pall = $Spotter->countAllDepartureAirports($limit, 0, '', $filters);
347
+        		$dall = $Spotter->countAllDetectedDepartureAirports($limit, 0, '', $filters);
348 348
         		$all = array();
349 349
         		foreach ($pall as $value) {
350 350
         			$icao = $value['airport_departure_icao'];
@@ -361,30 +361,30 @@  discard block
 block discarded – undo
361 361
         		foreach ($all as $key => $row) {
362 362
         			$count[$key] = $row['airport_departure_icao_count'];
363 363
         		}
364
-        		array_multisort($count,SORT_DESC,$all);
364
+        		array_multisort($count, SORT_DESC, $all);
365 365
                 }
366 366
                 return $all;
367 367
 	}
368
-	public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '') {
368
+	public function countAllArrivalAirports($limit = true, $stats_airline = '', $filter_name = '') {
369 369
 		global $globalStatsFilters;
370 370
 		if ($filter_name == '') $filter_name = $this->filter_name;
371 371
 		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 stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0";
372 372
 		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 stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
373 373
 		try {
374 374
 			$sth = $this->db->prepare($query);
375
-			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
376
-		} catch(PDOException $e) {
375
+			$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
376
+		} catch (PDOException $e) {
377 377
 			echo "error : ".$e->getMessage();
378 378
 		}
379 379
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
380 380
 		if (empty($all)) {
381 381
 			$filters = array('airlines' => array($stats_airline));
382 382
 			if ($filter_name != '') {
383
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
383
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
384 384
 			}
385 385
 			$Spotter = new Spotter($this->db);
386
-			$pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters);
387
-			$dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters);
386
+			$pall = $Spotter->countAllArrivalAirports($limit, 0, '', false, $filters);
387
+			$dall = $Spotter->countAllDetectedArrivalAirports($limit, 0, '', false, $filters);
388 388
         		$all = array();
389 389
         		foreach ($pall as $value) {
390 390
         			$icao = $value['airport_arrival_icao'];
@@ -401,12 +401,12 @@  discard block
 block discarded – undo
401 401
         		foreach ($all as $key => $row) {
402 402
         			$count[$key] = $row['airport_arrival_icao_count'];
403 403
         		}
404
-        		array_multisort($count,SORT_DESC,$all);
404
+        		array_multisort($count, SORT_DESC, $all);
405 405
                 }
406 406
  
407 407
                 return $all;
408 408
 	}
409
-	public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') {
409
+	public function countAllMonthsLastYear($limit = true, $stats_airline = '', $filter_name = '') {
410 410
 		global $globalDBdriver, $globalStatsFilters;
411 411
 		if ($filter_name == '') $filter_name = $this->filter_name;
412 412
 		if ($globalDBdriver == 'mysql') {
@@ -416,18 +416,18 @@  discard block
 block discarded – undo
416 416
 			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";
417 417
 			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";
418 418
 		}
419
-		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
419
+		$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
420 420
                  try {
421 421
                         $sth = $this->db->prepare($query);
422 422
                         $sth->execute($query_data);
423
-                } catch(PDOException $e) {
423
+                } catch (PDOException $e) {
424 424
                         echo "error : ".$e->getMessage();
425 425
                 }
426 426
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
427 427
                 if (empty($all)) {
428 428
 			$filters = array('airlines' => array($stats_airline));
429 429
 			if ($filter_name != '') {
430
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
430
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
431 431
 			}
432 432
             		$Spotter = new Spotter($this->db);
433 433
             		$all = $Spotter->countAllMonthsLastYear($filters);
@@ -436,29 +436,29 @@  discard block
 block discarded – undo
436 436
                 return $all;
437 437
 	}
438 438
 	
439
-	public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') {
439
+	public function countAllDatesLastMonth($stats_airline = '', $filter_name = '') {
440 440
 		global $globalStatsFilters;
441 441
 		if ($filter_name == '') $filter_name = $this->filter_name;
442 442
 		$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";
443
-		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
443
+		$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
444 444
                  try {
445 445
                         $sth = $this->db->prepare($query);
446 446
                         $sth->execute($query_data);
447
-                } catch(PDOException $e) {
447
+                } catch (PDOException $e) {
448 448
                         echo "error : ".$e->getMessage();
449 449
                 }
450 450
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
451 451
                 if (empty($all)) {
452 452
 			$filters = array('airlines' => array($stats_airline));
453 453
 			if ($filter_name != '') {
454
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
454
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
455 455
 			}
456 456
             		$Spotter = new Spotter($this->db);
457 457
             		$all = $Spotter->countAllDatesLastMonth($filters);
458 458
                 }
459 459
                 return $all;
460 460
 	}
461
-	public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') {
461
+	public function countAllDatesLast7Days($stats_airline = '', $filter_name = '') {
462 462
 		global $globalDBdriver, $globalStatsFilters;
463 463
 		if ($filter_name == '') $filter_name = $this->filter_name;
464 464
 		if ($globalDBdriver == 'mysql') {
@@ -466,40 +466,40 @@  discard block
 block discarded – undo
466 466
 		} else {
467 467
 			$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";
468 468
 		}
469
-		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
469
+		$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
470 470
                  try {
471 471
                         $sth = $this->db->prepare($query);
472 472
                         $sth->execute($query_data);
473
-                } catch(PDOException $e) {
473
+                } catch (PDOException $e) {
474 474
                         echo "error : ".$e->getMessage();
475 475
                 }
476 476
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
477 477
                 if (empty($all)) {
478 478
 			$filters = array('airlines' => array($stats_airline));
479 479
 			if ($filter_name != '') {
480
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
480
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
481 481
 			}
482 482
             		$Spotter = new Spotter($this->db);
483 483
             		$all = $Spotter->countAllDatesLast7Days($filters);
484 484
                 }
485 485
                 return $all;
486 486
 	}
487
-	public function countAllDates($stats_airline = '',$filter_name = '') {
487
+	public function countAllDates($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 = 'date' 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->countAllDates($filters);
@@ -514,35 +514,35 @@  discard block
 block discarded – undo
514 514
                  try {
515 515
                         $sth = $this->db->prepare($query);
516 516
                         $sth->execute($query_data);
517
-                } catch(PDOException $e) {
517
+                } catch (PDOException $e) {
518 518
                         echo "error : ".$e->getMessage();
519 519
                 }
520 520
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
521 521
                 if (empty($all)) {
522 522
             		$filters = array();
523 523
             		if ($filter_name != '') {
524
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
524
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
525 525
 			}
526 526
             		$Spotter = new Spotter($this->db);
527 527
             		$all = $Spotter->countAllDatesByAirlines($filters);
528 528
                 }
529 529
                 return $all;
530 530
 	}
531
-	public function countAllMonths($stats_airline = '',$filter_name = '') {
531
+	public function countAllMonths($stats_airline = '', $filter_name = '') {
532 532
 		global $globalStatsFilters;
533 533
 		if ($filter_name == '') $filter_name = $this->filter_name;
534 534
 	    	$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";
535 535
                  try {
536 536
                         $sth = $this->db->prepare($query);
537 537
                         $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
538
-                } catch(PDOException $e) {
538
+                } catch (PDOException $e) {
539 539
                         echo "error : ".$e->getMessage();
540 540
                 }
541 541
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
542 542
                 if (empty($all)) {
543 543
 			$filters = array('airlines' => array($stats_airline));
544 544
 			if ($filter_name != '') {
545
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
545
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
546 546
 			}
547 547
             		$Spotter = new Spotter($this->db);
548 548
             		$all = $Spotter->countAllMonths($filters);
@@ -556,21 +556,21 @@  discard block
 block discarded – undo
556 556
                  try {
557 557
                         $sth = $this->db->prepare($query);
558 558
                         $sth->execute(array(':filter_name' => $filter_name));
559
-                } catch(PDOException $e) {
559
+                } catch (PDOException $e) {
560 560
                         echo "error : ".$e->getMessage();
561 561
                 }
562 562
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
563 563
                 if (empty($all)) {
564 564
             		$filters = array();
565 565
             		if ($filter_name != '') {
566
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
566
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
567 567
 			}
568 568
             		$Spotter = new Spotter($this->db);
569 569
             		$all = $Spotter->countAllMilitaryMonths($filters);
570 570
                 }
571 571
                 return $all;
572 572
 	}
573
-	public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') {
573
+	public function countAllHours($orderby = 'hour', $limit = true, $stats_airline = '', $filter_name = '') {
574 574
 		global $globalTimezone, $globalDBdriver, $globalStatsFilters;
575 575
 		if ($filter_name == '') $filter_name = $this->filter_name;
576 576
 		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";
@@ -587,17 +587,17 @@  discard block
 block discarded – undo
587 587
                  try {
588 588
                         $sth = $this->db->prepare($query);
589 589
                         $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
590
-                } catch(PDOException $e) {
590
+                } catch (PDOException $e) {
591 591
                         echo "error : ".$e->getMessage();
592 592
                 }
593 593
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
594 594
                 if (empty($all)) {
595 595
 			$filters = array('airlines' => array($stats_airline));
596 596
 			if ($filter_name != '') {
597
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
597
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
598 598
 			}
599 599
             		$Spotter = new Spotter($this->db);
600
-            		$all = $Spotter->countAllHours($orderby,$filters);
600
+            		$all = $Spotter->countAllHours($orderby, $filters);
601 601
                 }
602 602
                 return $all;
603 603
 	}
@@ -605,11 +605,11 @@  discard block
 block discarded – undo
605 605
 	public function countOverallFlights($stats_airline = '', $filter_name = '') {
606 606
 		global $globalStatsFilters;
607 607
 		if ($filter_name == '') $filter_name = $this->filter_name;
608
-		$all = $this->getSumStats('flights_bymonth',date('Y'),$stats_airline,$filter_name);
608
+		$all = $this->getSumStats('flights_bymonth', date('Y'), $stats_airline, $filter_name);
609 609
 		if (empty($all)) {
610 610
 			$filters = array('airlines' => array($stats_airline));
611 611
 			if ($filter_name != '') {
612
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
612
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
613 613
 			}
614 614
 			$Spotter = new Spotter($this->db);
615 615
 			$all = $Spotter->countOverallFlights($filters);
@@ -619,39 +619,39 @@  discard block
 block discarded – undo
619 619
 	public function countOverallMilitaryFlights($filter_name = '') {
620 620
 		global $globalStatsFilters;
621 621
 		if ($filter_name == '') $filter_name = $this->filter_name;
622
-		$all = $this->getSumStats('military_flights_bymonth',date('Y'),'',$filter_name);
622
+		$all = $this->getSumStats('military_flights_bymonth', date('Y'), '', $filter_name);
623 623
 		if (empty($all)) {
624 624
 		        $filters = array();
625 625
             		if ($filter_name != '') {
626
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
626
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
627 627
 			}
628 628
 			$Spotter = new Spotter($this->db);
629 629
 			$all = $Spotter->countOverallMilitaryFlights($filters);
630 630
 		}
631 631
 		return $all;
632 632
 	}
633
-	public function countOverallArrival($stats_airline = '',$filter_name = '') {
633
+	public function countOverallArrival($stats_airline = '', $filter_name = '') {
634 634
 		global $globalStatsFilters;
635 635
 		if ($filter_name == '') $filter_name = $this->filter_name;
636
-		$all = $this->getSumStats('realarrivals_bymonth',date('Y'),$stats_airline,$filter_name);
636
+		$all = $this->getSumStats('realarrivals_bymonth', date('Y'), $stats_airline, $filter_name);
637 637
 		if (empty($all)) {
638 638
 			$filters = array('airlines' => array($stats_airline));
639 639
 			if ($filter_name != '') {
640
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
640
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
641 641
 			}
642 642
 			$Spotter = new Spotter($this->db);
643 643
 			$all = $Spotter->countOverallArrival($filters);
644 644
 		}
645 645
 		return $all;
646 646
 	}
647
-	public function countOverallAircrafts($stats_airline = '',$filter_name = '') {
647
+	public function countOverallAircrafts($stats_airline = '', $filter_name = '') {
648 648
 		global $globalStatsFilters;
649 649
 		if ($filter_name == '') $filter_name = $this->filter_name;
650
-		$all = $this->getSumStats('aircrafts_bymonth',date('Y'),$stats_airline,$filter_name);
650
+		$all = $this->getSumStats('aircrafts_bymonth', date('Y'), $stats_airline, $filter_name);
651 651
 		if (empty($all)) {
652 652
 			$filters = array('airlines' => array($stats_airline));
653 653
 			if ($filter_name != '') {
654
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
654
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
655 655
 			}
656 656
 			$Spotter = new Spotter($this->db);
657 657
 			$all = $Spotter->countOverallAircrafts($filters);
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
                  try {
666 666
                         $sth = $this->db->prepare($query);
667 667
                         $sth->execute(array(':filter_name' => $filter_name));
668
-                } catch(PDOException $e) {
668
+                } catch (PDOException $e) {
669 669
                         echo "error : ".$e->getMessage();
670 670
                 }
671 671
                 $result = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -674,14 +674,14 @@  discard block
 block discarded – undo
674 674
 		if (empty($all)) {
675 675
             		$filters = array();
676 676
             		if ($filter_name != '') {
677
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
677
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
678 678
 			}
679 679
 			$Spotter = new Spotter($this->db);
680 680
 			$all = $Spotter->countOverallAirlines($filters);
681 681
 		}
682 682
 		return $all;
683 683
 	}
684
-	public function countOverallOwners($stats_airline = '',$filter_name = '') {
684
+	public function countOverallOwners($stats_airline = '', $filter_name = '') {
685 685
 		global $globalStatsFilters;
686 686
 		if ($filter_name == '') $filter_name = $this->filter_name;
687 687
 		/*
@@ -695,25 +695,25 @@  discard block
 block discarded – undo
695 695
                 $result = $sth->fetchAll(PDO::FETCH_ASSOC);
696 696
                 $all = $result[0]['nb_owner'];
697 697
                 */
698
-		$all = $this->getSumStats('owners_bymonth',date('Y'),$stats_airline,$filter_name);
698
+		$all = $this->getSumStats('owners_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->countOverallOwners($filters);
706 706
 		}
707 707
 		return $all;
708 708
 	}
709
-	public function countOverallPilots($stats_airline = '',$filter_name = '') {
709
+	public function countOverallPilots($stats_airline = '', $filter_name = '') {
710 710
 		global $globalStatsFilters;
711 711
 		if ($filter_name == '') $filter_name = $this->filter_name;
712
-		$all = $this->getSumStats('pilots_bymonth',date('Y'),$stats_airline,$filter_name);
712
+		$all = $this->getSumStats('pilots_bymonth', date('Y'), $stats_airline, $filter_name);
713 713
 		if (empty($all)) {
714 714
 			$filters = array('airlines' => array($stats_airline));
715 715
 			if ($filter_name != '') {
716
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
716
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
717 717
 			}
718 718
 			$Spotter = new Spotter($this->db);
719 719
 			$all = $Spotter->countOverallPilots($filters);
@@ -721,33 +721,33 @@  discard block
 block discarded – undo
721 721
 		return $all;
722 722
 	}
723 723
 
724
-	public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') {
724
+	public function getLast7DaysAirports($airport_icao = '', $stats_airline = '', $filter_name = '') {
725 725
 		if ($filter_name == '') $filter_name = $this->filter_name;
726 726
 		$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";
727
-		$query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
727
+		$query_values = array(':airport_icao' => $airport_icao, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
728 728
                  try {
729 729
                         $sth = $this->db->prepare($query);
730 730
                         $sth->execute($query_values);
731
-                } catch(PDOException $e) {
731
+                } catch (PDOException $e) {
732 732
                         echo "error : ".$e->getMessage();
733 733
                 }
734 734
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
735 735
                 return $all;
736 736
 	}
737
-	public function getStats($type,$stats_airline = '', $filter_name = '') {
737
+	public function getStats($type, $stats_airline = '', $filter_name = '') {
738 738
 		if ($filter_name == '') $filter_name = $this->filter_name;
739 739
                 $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date";
740
-                $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
740
+                $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
741 741
                  try {
742 742
                         $sth = $this->db->prepare($query);
743 743
                         $sth->execute($query_values);
744
-                } catch(PDOException $e) {
744
+                } catch (PDOException $e) {
745 745
                         echo "error : ".$e->getMessage();
746 746
                 }
747 747
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
748 748
                 return $all;
749 749
         }
750
-	public function getSumStats($type,$year,$stats_airline = '',$filter_name = '') {
750
+	public function getSumStats($type, $year, $stats_airline = '', $filter_name = '') {
751 751
 		if ($filter_name == '') $filter_name = $this->filter_name;
752 752
     		global $globalArchiveMonths, $globalDBdriver;
753 753
     		if ($globalDBdriver == 'mysql') {
@@ -755,11 +755,11 @@  discard block
 block discarded – undo
755 755
 	        } else {
756 756
             		$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";
757 757
                 }
758
-                $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
758
+                $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
759 759
                  try {
760 760
                         $sth = $this->db->prepare($query);
761 761
                         $sth->execute($query_values);
762
-                } catch(PDOException $e) {
762
+                } catch (PDOException $e) {
763 763
                         echo "error : ".$e->getMessage();
764 764
                 }
765 765
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
                  try {
778 778
                         $sth = $this->db->prepare($query);
779 779
                         $sth->execute($query_values);
780
-                } catch(PDOException $e) {
780
+                } catch (PDOException $e) {
781 781
                         echo "error : ".$e->getMessage();
782 782
                 }
783 783
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
                  try {
795 795
                         $sth = $this->db->prepare($query);
796 796
                         $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
797
-                } catch(PDOException $e) {
797
+                } catch (PDOException $e) {
798 798
                         echo "error : ".$e->getMessage();
799 799
                 }
800 800
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
                  try {
812 812
                         $sth = $this->db->prepare($query);
813 813
                         $sth->execute(array(':filter_name' => $filter_name));
814
-                } catch(PDOException $e) {
814
+                } catch (PDOException $e) {
815 815
                         echo "error : ".$e->getMessage();
816 816
                 }
817 817
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
                  try {
829 829
                         $sth = $this->db->prepare($query);
830 830
                         $sth->execute(array(':filter_name' => $filter_name));
831
-                } catch(PDOException $e) {
831
+                } catch (PDOException $e) {
832 832
                         echo "error : ".$e->getMessage();
833 833
                 }
834 834
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -845,14 +845,14 @@  discard block
 block discarded – undo
845 845
                  try {
846 846
                         $sth = $this->db->prepare($query);
847 847
                         $sth->execute(array(':filter_name' => $filter_name));
848
-                } catch(PDOException $e) {
848
+                } catch (PDOException $e) {
849 849
                         echo "error : ".$e->getMessage();
850 850
                 }
851 851
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
852 852
                 return $all[0]['total'];
853 853
         }
854 854
 
855
-	public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
855
+	public function addStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') {
856 856
 		global $globalDBdriver;
857 857
 		if ($filter_name == '') $filter_name = $this->filter_name;
858 858
 		if ($globalDBdriver == 'mysql') {
@@ -860,15 +860,15 @@  discard block
 block discarded – undo
860 860
                 } else {
861 861
 			$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);"; 
862 862
 		}
863
-                $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
863
+                $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
864 864
                  try {
865 865
                         $sth = $this->db->prepare($query);
866 866
                         $sth->execute($query_values);
867
-                } catch(PDOException $e) {
867
+                } catch (PDOException $e) {
868 868
                         return "error : ".$e->getMessage();
869 869
                 }
870 870
         }
871
-	public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
871
+	public function updateStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') {
872 872
 		global $globalDBdriver;
873 873
 		if ($filter_name == '') $filter_name = $this->filter_name;
874 874
 		if ($globalDBdriver == 'mysql') {
@@ -877,219 +877,219 @@  discard block
 block discarded – undo
877 877
             		//$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date";
878 878
 			$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);"; 
879 879
                 }
880
-                $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
880
+                $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
881 881
                  try {
882 882
                         $sth = $this->db->prepare($query);
883 883
                         $sth->execute($query_values);
884
-                } catch(PDOException $e) {
884
+                } catch (PDOException $e) {
885 885
                         return "error : ".$e->getMessage();
886 886
                 }
887 887
         }
888
-	public function getStatsSource($date,$stats_type = '') {
888
+	public function getStatsSource($date, $stats_type = '') {
889 889
 		if ($stats_type == '') {
890 890
 			$query = "SELECT * FROM stats_source WHERE stats_date = :date ORDER BY source_name";
891 891
 			$query_values = array(':date' => $date);
892 892
 		} else {
893 893
 			$query = "SELECT * FROM stats_source WHERE stats_date = :date AND stats_type = :stats_type ORDER BY source_name";
894
-			$query_values = array(':date' => $date,':stats_type' => $stats_type);
894
+			$query_values = array(':date' => $date, ':stats_type' => $stats_type);
895 895
 		}
896 896
                  try {
897 897
                         $sth = $this->db->prepare($query);
898 898
                         $sth->execute($query_values);
899
-                } catch(PDOException $e) {
899
+                } catch (PDOException $e) {
900 900
                         echo "error : ".$e->getMessage();
901 901
                 }
902 902
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
903 903
                 return $all;
904 904
         }
905 905
 
906
-	public function addStatSource($data,$source_name,$stats_type,$date) {
906
+	public function addStatSource($data, $source_name, $stats_type, $date) {
907 907
 		global $globalDBdriver;
908 908
 		if ($globalDBdriver == 'mysql') {
909 909
 			$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";
910 910
 		} else {
911 911
 			$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);"; 
912 912
                 }
913
-                $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type);
913
+                $query_values = array(':data' => $data, ':stats_date' => $date, ':source_name' => $source_name, ':stats_type' => $stats_type);
914 914
                  try {
915 915
                         $sth = $this->db->prepare($query);
916 916
                         $sth->execute($query_values);
917
-                } catch(PDOException $e) {
917
+                } catch (PDOException $e) {
918 918
                         return "error : ".$e->getMessage();
919 919
                 }
920 920
         }
921
-	public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') {
921
+	public function addStatFlight($type, $date_name, $cnt, $stats_airline = '', $filter_name = '') {
922 922
                 $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)";
923
-                $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
923
+                $query_values = array(':type' => $type, ':flight_date' => $date_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
924 924
                  try {
925 925
                         $sth = $this->db->prepare($query);
926 926
                         $sth->execute($query_values);
927
-                } catch(PDOException $e) {
927
+                } catch (PDOException $e) {
928 928
                         return "error : ".$e->getMessage();
929 929
                 }
930 930
         }
931
-	public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '') {
931
+	public function addStatAircraftRegistration($registration, $cnt, $aircraft_icao = '', $airline_icao = '', $filter_name = '') {
932 932
 		global $globalDBdriver;
933 933
 		if ($globalDBdriver == 'mysql') {
934 934
 			$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";
935 935
 		} else {
936 936
 			$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);"; 
937 937
 		}
938
-                $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
938
+                $query_values = array(':aircraft_icao' => $aircraft_icao, ':registration' => $registration, ':cnt' => $cnt, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
939 939
                  try {
940 940
                         $sth = $this->db->prepare($query);
941 941
                         $sth->execute($query_values);
942
-                } catch(PDOException $e) {
942
+                } catch (PDOException $e) {
943 943
                         return "error : ".$e->getMessage();
944 944
                 }
945 945
         }
946
-	public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '') {
946
+	public function addStatCallsign($callsign_icao, $cnt, $airline_icao = '', $filter_name = '') {
947 947
 		global $globalDBdriver;
948 948
 		if ($globalDBdriver == 'mysql') {
949 949
 			$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";
950 950
 		} else {
951 951
 			$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);"; 
952 952
 		}
953
-                $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name);
953
+                $query_values = array(':callsign_icao' => $callsign_icao, ':airline_icao' => $airline_icao, ':cnt' => $cnt, ':filter_name' => $filter_name);
954 954
                  try {
955 955
                         $sth = $this->db->prepare($query);
956 956
                         $sth->execute($query_values);
957
-                } catch(PDOException $e) {
957
+                } catch (PDOException $e) {
958 958
                         return "error : ".$e->getMessage();
959 959
                 }
960 960
         }
961
-	public function addStatCountry($iso2,$iso3,$name,$cnt,$filter_name = '') {
961
+	public function addStatCountry($iso2, $iso3, $name, $cnt, $filter_name = '') {
962 962
 		global $globalDBdriver;
963 963
 		if ($globalDBdriver == 'mysql') {
964 964
 			$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";
965 965
 		} else {
966 966
 			$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);"; 
967 967
 		}
968
-                $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name);
968
+                $query_values = array(':iso2' => $iso2, ':iso3' => $iso3, ':name' => $name, ':cnt' => $cnt, ':filter_name' => $filter_name);
969 969
                  try {
970 970
                         $sth = $this->db->prepare($query);
971 971
                         $sth->execute($query_values);
972
-                } catch(PDOException $e) {
972
+                } catch (PDOException $e) {
973 973
                         return "error : ".$e->getMessage();
974 974
                 }
975 975
         }
976
-	public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '') {
976
+	public function addStatAircraft($aircraft_icao, $cnt, $aircraft_name = '', $aircraft_manufacturer = '', $airline_icao = '', $filter_name = '') {
977 977
 		global $globalDBdriver;
978 978
 		if ($globalDBdriver == 'mysql') {
979 979
 			$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";
980 980
 		} else {
981 981
 			$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);"; 
982 982
 		}
983
-                $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);
983
+                $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);
984 984
                  try {
985 985
                         $sth = $this->db->prepare($query);
986 986
                         $sth->execute($query_values);
987
-                } catch(PDOException $e) {
987
+                } catch (PDOException $e) {
988 988
                         return "error : ".$e->getMessage();
989 989
                 }
990 990
         }
991
-	public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '') {
991
+	public function addStatAirline($airline_icao, $cnt, $airline_name = '', $filter_name = '') {
992 992
 		global $globalDBdriver;
993 993
 		if ($globalDBdriver == 'mysql') {
994 994
 			$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";
995 995
 		} else {
996 996
 			$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);"; 
997 997
 		}
998
-                $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name);
998
+                $query_values = array(':airline_icao' => $airline_icao, ':airline_name' => $airline_name, ':cnt' => $cnt, ':filter_name' => $filter_name);
999 999
                  try {
1000 1000
                         $sth = $this->db->prepare($query);
1001 1001
                         $sth->execute($query_values);
1002
-                } catch(PDOException $e) {
1002
+                } catch (PDOException $e) {
1003 1003
                         return "error : ".$e->getMessage();
1004 1004
                 }
1005 1005
         }
1006
-	public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '') {
1006
+	public function addStatOwner($owner_name, $cnt, $stats_airline = '', $filter_name = '') {
1007 1007
 		global $globalDBdriver;
1008 1008
 		if ($globalDBdriver == 'mysql') {
1009 1009
 			$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";
1010 1010
 		} else {
1011 1011
 			$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);"; 
1012 1012
 		}
1013
-                $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1013
+                $query_values = array(':owner_name' => $owner_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
1014 1014
                  try {
1015 1015
                         $sth = $this->db->prepare($query);
1016 1016
                         $sth->execute($query_values);
1017
-                } catch(PDOException $e) {
1017
+                } catch (PDOException $e) {
1018 1018
                         return "error : ".$e->getMessage();
1019 1019
                 }
1020 1020
         }
1021
-	public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '') {
1021
+	public function addStatPilot($pilot_id, $cnt, $pilot_name, $stats_airline = '', $filter_name = '') {
1022 1022
 		global $globalDBdriver;
1023 1023
 		if ($globalDBdriver == 'mysql') {
1024 1024
 			$query = "INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name) VALUES (:pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, pilot_name = :pilot_name";
1025 1025
 		} else {
1026 1026
 			$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; INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name) SELECT :pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_pilot WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1027 1027
 		}
1028
-                $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1028
+                $query_values = array(':pilot_id' => $pilot_id, ':cnt' => $cnt, ':pilot_name' => $pilot_name, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
1029 1029
                  try {
1030 1030
                         $sth = $this->db->prepare($query);
1031 1031
                         $sth->execute($query_values);
1032
-                } catch(PDOException $e) {
1032
+                } catch (PDOException $e) {
1033 1033
                         return "error : ".$e->getMessage();
1034 1034
                 }
1035 1035
         }
1036
-	public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') {
1036
+	public function addStatDepartureAirports($airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') {
1037 1037
 		global $globalDBdriver;
1038 1038
 		if ($globalDBdriver == 'mysql') {
1039 1039
 			$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";
1040 1040
 		} else {
1041 1041
 			$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);"; 
1042 1042
 		}
1043
-                $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);
1043
+                $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);
1044 1044
                  try {
1045 1045
                         $sth = $this->db->prepare($query);
1046 1046
                         $sth->execute($query_values);
1047
-                } catch(PDOException $e) {
1047
+                } catch (PDOException $e) {
1048 1048
                         return "error : ".$e->getMessage();
1049 1049
                 }
1050 1050
         }
1051
-	public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') {
1051
+	public function addStatDepartureAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') {
1052 1052
 		global $globalDBdriver;
1053 1053
 		if ($globalDBdriver == 'mysql') {
1054 1054
 			$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";
1055 1055
 		} else {
1056 1056
 			$query = "UPDATE stats_airport SET departure = departure+:departure WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1057 1057
 		}
1058
-                $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);
1058
+                $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);
1059 1059
                  try {
1060 1060
                         $sth = $this->db->prepare($query);
1061 1061
                         $sth->execute($query_values);
1062
-                } catch(PDOException $e) {
1062
+                } catch (PDOException $e) {
1063 1063
                         return "error : ".$e->getMessage();
1064 1064
                 }
1065 1065
         }
1066
-	public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') {
1066
+	public function addStatArrivalAirports($airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') {
1067 1067
 		global $globalDBdriver;
1068 1068
 		if ($globalDBdriver == 'mysql') {
1069 1069
 			$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";
1070 1070
 		} else {
1071 1071
 			$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);"; 
1072 1072
 		}
1073
-                $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);
1073
+                $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);
1074 1074
                  try {
1075 1075
                         $sth = $this->db->prepare($query);
1076 1076
                         $sth->execute($query_values);
1077
-                } catch(PDOException $e) {
1077
+                } catch (PDOException $e) {
1078 1078
                         return "error : ".$e->getMessage();
1079 1079
                 }
1080 1080
         }
1081
-	public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') {
1081
+	public function addStatArrivalAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') {
1082 1082
 		global $globalDBdriver;
1083 1083
 		if ($globalDBdriver == 'mysql') {
1084 1084
 			$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";
1085 1085
 		} else {
1086 1086
 			$query = "UPDATE stats_airport SET arrival = arrival+:arrival WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1087 1087
 		}
1088
-                $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);
1088
+                $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);
1089 1089
                  try {
1090 1090
                         $sth = $this->db->prepare($query);
1091 1091
                         $sth->execute($query_values);
1092
-                } catch(PDOException $e) {
1092
+                } catch (PDOException $e) {
1093 1093
                         return "error : ".$e->getMessage();
1094 1094
                 }
1095 1095
         }
@@ -1100,7 +1100,7 @@  discard block
 block discarded – undo
1100 1100
                  try {
1101 1101
                         $sth = $this->db->prepare($query);
1102 1102
                         $sth->execute($query_values);
1103
-                } catch(PDOException $e) {
1103
+                } catch (PDOException $e) {
1104 1104
                         return "error : ".$e->getMessage();
1105 1105
                 }
1106 1106
         }
@@ -1110,7 +1110,7 @@  discard block
 block discarded – undo
1110 1110
                  try {
1111 1111
                         $sth = $this->db->prepare($query);
1112 1112
                         $sth->execute($query_values);
1113
-                } catch(PDOException $e) {
1113
+                } catch (PDOException $e) {
1114 1114
                         return "error : ".$e->getMessage();
1115 1115
                 }
1116 1116
         }
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
                  try {
1121 1121
                         $sth = $this->db->prepare($query);
1122 1122
                         $sth->execute($query_values);
1123
-                } catch(PDOException $e) {
1123
+                } catch (PDOException $e) {
1124 1124
                         return "error : ".$e->getMessage();
1125 1125
                 }
1126 1126
         }
@@ -1358,33 +1358,33 @@  discard block
 block discarded – undo
1358 1358
 				$last_update_day = $last_update[0]['value'];
1359 1359
 			} else $last_update_day = '2012-12-12 12:12:12';
1360 1360
 			$Spotter = new Spotter($this->db);
1361
-			$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day);
1361
+			$alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day);
1362 1362
 			foreach ($alldata as $number) {
1363
-				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer']);
1363
+				$this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer']);
1364 1364
 			}
1365
-			$alldata = $Spotter->countAllAirlines(false,0,$last_update_day);
1365
+			$alldata = $Spotter->countAllAirlines(false, 0, $last_update_day);
1366 1366
 			foreach ($alldata as $number) {
1367
-				$this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name']);
1367
+				$this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name']);
1368 1368
 			}
1369
-			$alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day);
1369
+			$alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day);
1370 1370
 			foreach ($alldata as $number) {
1371
-				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao']);
1371
+				$this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao']);
1372 1372
 			}
1373
-			$alldata = $Spotter->countAllCallsigns(false,0,$last_update_day);
1373
+			$alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day);
1374 1374
 			foreach ($alldata as $number) {
1375
-				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']);
1375
+				$this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao']);
1376 1376
 			}
1377
-			$alldata = $Spotter->countAllOwners(false,0,$last_update_day);
1377
+			$alldata = $Spotter->countAllOwners(false, 0, $last_update_day);
1378 1378
 			foreach ($alldata as $number) {
1379
-				$this->addStatOwner($number['owner_name'],$number['owner_count']);
1379
+				$this->addStatOwner($number['owner_name'], $number['owner_count']);
1380 1380
 			}
1381
-			$alldata = $Spotter->countAllPilots(false,0,$last_update_day);
1381
+			$alldata = $Spotter->countAllPilots(false, 0, $last_update_day);
1382 1382
 			foreach ($alldata as $number) {
1383
-				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name']);
1383
+				$this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name']);
1384 1384
 			}
1385 1385
 			
1386
-			$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day);
1387
-        		$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day);
1386
+			$pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day);
1387
+        		$dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day);
1388 1388
 	        	$alldata = array();
1389 1389
 	        	
1390 1390
     			foreach ($pall as $value) {
@@ -1401,12 +1401,12 @@  discard block
 block discarded – undo
1401 1401
     			foreach ($alldata as $key => $row) {
1402 1402
     				$count[$key] = $row['airport_departure_icao_count'];
1403 1403
         		}
1404
-			array_multisort($count,SORT_DESC,$alldata);
1404
+			array_multisort($count, SORT_DESC, $alldata);
1405 1405
 			foreach ($alldata as $number) {
1406
-				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count']);
1406
+				echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count']);
1407 1407
 			}
1408
-			$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day);
1409
-        		$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day);
1408
+			$pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day);
1409
+        		$dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day);
1410 1410
 	        	$alldata = array();
1411 1411
     			foreach ($pall as $value) {
1412 1412
 	        		$icao = $value['airport_arrival_icao'];
@@ -1422,15 +1422,15 @@  discard block
 block discarded – undo
1422 1422
         		foreach ($alldata as $key => $row) {
1423 1423
         			$count[$key] = $row['airport_arrival_icao_count'];
1424 1424
 	        	}
1425
-    			array_multisort($count,SORT_DESC,$alldata);
1425
+    			array_multisort($count, SORT_DESC, $alldata);
1426 1426
                         foreach ($alldata as $number) {
1427
-				echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count']);
1427
+				echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count']);
1428 1428
 			}
1429 1429
 			if ($Connection->tableExists('countries')) {
1430 1430
 				$SpotterArchive = new SpotterArchive();
1431
-				$alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day);
1431
+				$alldata = $SpotterArchive->countAllFlightOverCountries(false, 0, $last_update_day);
1432 1432
 				foreach ($alldata as $number) {
1433
-					$this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count']);
1433
+					$this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count']);
1434 1434
 				}
1435 1435
 			}
1436 1436
 			
@@ -1443,31 +1443,31 @@  discard block
 block discarded – undo
1443 1443
 			$lastyear = false;
1444 1444
 			foreach ($alldata as $number) {
1445 1445
 				if ($number['year_name'] != date('Y')) $lastyear = true;
1446
-				$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'])));
1446
+				$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'])));
1447 1447
 			}
1448 1448
 			$alldata = $Spotter->countAllMilitaryMonths();
1449 1449
 			foreach ($alldata as $number) {
1450
-				$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'])));
1450
+				$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'])));
1451 1451
 			}
1452 1452
 			$alldata = $Spotter->countAllMonthsOwners();
1453 1453
 			foreach ($alldata as $number) {
1454
-				$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'])));
1454
+				$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'])));
1455 1455
 			}
1456 1456
 			$alldata = $Spotter->countAllMonthsPilots();
1457 1457
 			foreach ($alldata as $number) {
1458
-				$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'])));
1458
+				$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'])));
1459 1459
 			}
1460 1460
 			$alldata = $Spotter->countAllMonthsAirlines();
1461 1461
 			foreach ($alldata as $number) {
1462
-				$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'])));
1462
+				$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'])));
1463 1463
 			}
1464 1464
 			$alldata = $Spotter->countAllMonthsAircrafts();
1465 1465
 			foreach ($alldata as $number) {
1466
-				$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'])));
1466
+				$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'])));
1467 1467
 			}
1468 1468
 			$alldata = $Spotter->countAllMonthsRealArrivals();
1469 1469
 			foreach ($alldata as $number) {
1470
-				$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'])));
1470
+				$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'])));
1471 1471
 			}
1472 1472
 			echo 'Airports data...'."\n";
1473 1473
 			echo '...Departure'."\n";
@@ -1512,7 +1512,7 @@  discard block
 block discarded – undo
1512 1512
     			}
1513 1513
     			$alldata = $pall;
1514 1514
 			foreach ($alldata as $number) {
1515
-				$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']);
1515
+				$this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count']);
1516 1516
 			}
1517 1517
 			echo '...Arrival'."\n";
1518 1518
 			$pall = $Spotter->getLast7DaysAirportsArrival();
@@ -1554,7 +1554,7 @@  discard block
 block discarded – undo
1554 1554
     			}
1555 1555
     			$alldata = $pall;
1556 1556
 			foreach ($alldata as $number) {
1557
-				$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']);
1557
+				$this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count']);
1558 1558
 			}
1559 1559
 
1560 1560
 			echo 'Flights data...'."\n";
@@ -1562,28 +1562,28 @@  discard block
 block discarded – undo
1562 1562
 			echo '-> countAllDatesLastMonth...'."\n";
1563 1563
 			$alldata = $Spotter->countAllDatesLastMonth();
1564 1564
 			foreach ($alldata as $number) {
1565
-				$this->addStatFlight('month',$number['date_name'],$number['date_count']);
1565
+				$this->addStatFlight('month', $number['date_name'], $number['date_count']);
1566 1566
 			}
1567 1567
 			echo '-> countAllDates...'."\n";
1568 1568
 			$previousdata = $this->countAllDates();
1569 1569
 			$previousdatabyairlines = $this->countAllDatesByAirlines();
1570 1570
 			$this->deleteStatFlight('date');
1571
-			$alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates());
1571
+			$alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates());
1572 1572
 			$values = array();
1573 1573
 			foreach ($alldata as $cnt) {
1574 1574
 				$values[] = $cnt['date_count'];
1575 1575
 			}
1576
-			array_multisort($values,SORT_DESC,$alldata);
1577
-			array_splice($alldata,11);
1576
+			array_multisort($values, SORT_DESC, $alldata);
1577
+			array_splice($alldata, 11);
1578 1578
 			foreach ($alldata as $number) {
1579
-				$this->addStatFlight('date',$number['date_name'],$number['date_count']);
1579
+				$this->addStatFlight('date', $number['date_name'], $number['date_count']);
1580 1580
 			}
1581 1581
 			
1582 1582
 			$this->deleteStatFlight('hour');
1583 1583
 			echo '-> countAllHours...'."\n";
1584 1584
 			$alldata = $Spotter->countAllHours('hour');
1585 1585
 			foreach ($alldata as $number) {
1586
-				$this->addStatFlight('hour',$number['hour_name'],$number['hour_count']);
1586
+				$this->addStatFlight('hour', $number['hour_name'], $number['hour_count']);
1587 1587
 			}
1588 1588
 
1589 1589
 
@@ -1591,29 +1591,29 @@  discard block
 block discarded – undo
1591 1591
 			// Count by airlines
1592 1592
 			echo '--- Stats by airlines ---'."\n";
1593 1593
 			$Spotter = new Spotter($this->db);
1594
-			$alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day);
1594
+			$alldata = $Spotter->countAllAircraftTypesByAirlines(false, 0, $last_update_day);
1595 1595
 			foreach ($alldata as $number) {
1596
-				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao']);
1596
+				$this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], $number['airline_icao']);
1597 1597
 			}
1598
-			$alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day);
1598
+			$alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false, 0, $last_update_day);
1599 1599
 			foreach ($alldata as $number) {
1600
-				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao']);
1600
+				$this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], $number['airline_icao']);
1601 1601
 			}
1602
-			$alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day);
1602
+			$alldata = $Spotter->countAllCallsignsByAirlines(false, 0, $last_update_day);
1603 1603
 			foreach ($alldata as $number) {
1604
-				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']);
1604
+				$this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao']);
1605 1605
 			}
1606
-			$alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day);
1606
+			$alldata = $Spotter->countAllOwnersByAirlines(false, 0, $last_update_day);
1607 1607
 			foreach ($alldata as $number) {
1608
-				$this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao']);
1608
+				$this->addStatOwner($number['owner_name'], $number['owner_count'], $number['airline_icao']);
1609 1609
 			}
1610
-			$alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day);
1610
+			$alldata = $Spotter->countAllPilotsByAirlines(false, 0, $last_update_day);
1611 1611
 			foreach ($alldata as $number) {
1612
-				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao']);
1612
+				$this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], $number['airline_icao']);
1613 1613
 			}
1614 1614
 			
1615
-			$pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day);
1616
-       			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day);
1615
+			$pall = $Spotter->countAllDepartureAirportsByAirlines(false, 0, $last_update_day);
1616
+       			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false, 0, $last_update_day);
1617 1617
 	        	//$alldata = array();
1618 1618
     			foreach ($dall as $value) {
1619 1619
     				$icao = $value['airport_departure_icao'];
@@ -1632,10 +1632,10 @@  discard block
 block discarded – undo
1632 1632
     			}
1633 1633
     			$alldata = $pall;
1634 1634
 			foreach ($alldata as $number) {
1635
-				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']);
1635
+				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']);
1636 1636
 			}
1637
-			$pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day);
1638
-        		$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day);
1637
+			$pall = $Spotter->countAllArrivalAirportsByAirlines(false, 0, $last_update_day);
1638
+        		$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false, 0, $last_update_day);
1639 1639
 	        	//$alldata = array();
1640 1640
     			foreach ($dall as $value) {
1641 1641
     				$icao = $value['airport_arrival_icao'];
@@ -1654,30 +1654,30 @@  discard block
 block discarded – undo
1654 1654
     			}
1655 1655
     			$alldata = $pall;
1656 1656
                         foreach ($alldata as $number) {
1657
-				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']);
1657
+				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']);
1658 1658
 			}
1659 1659
 			$Spotter = new Spotter($this->db);
1660 1660
 			$alldata = $Spotter->countAllMonthsByAirlines();
1661 1661
 			$lastyear = false;
1662 1662
 			foreach ($alldata as $number) {
1663 1663
 				if ($number['year_name'] != date('Y')) $lastyear = true;
1664
-				$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']);
1664
+				$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']);
1665 1665
 			}
1666 1666
 			$alldata = $Spotter->countAllMonthsOwnersByAirlines();
1667 1667
 			foreach ($alldata as $number) {
1668
-				$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']);
1668
+				$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']);
1669 1669
 			}
1670 1670
 			$alldata = $Spotter->countAllMonthsPilotsByAirlines();
1671 1671
 			foreach ($alldata as $number) {
1672
-				$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']);
1672
+				$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']);
1673 1673
 			}
1674 1674
 			$alldata = $Spotter->countAllMonthsAircraftsByAirlines();
1675 1675
 			foreach ($alldata as $number) {
1676
-				$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']);
1676
+				$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']);
1677 1677
 			}
1678 1678
 			$alldata = $Spotter->countAllMonthsRealArrivalsByAirlines();
1679 1679
 			foreach ($alldata as $number) {
1680
-				$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']);
1680
+				$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']);
1681 1681
 			}
1682 1682
 			echo '...Departure'."\n";
1683 1683
 			$pall = $Spotter->getLast7DaysAirportsDepartureByAirlines();
@@ -1700,7 +1700,7 @@  discard block
 block discarded – undo
1700 1700
     			}
1701 1701
     			$alldata = $pall;
1702 1702
 			foreach ($alldata as $number) {
1703
-				$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']);
1703
+				$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']);
1704 1704
 			}
1705 1705
 			echo '...Arrival'."\n";
1706 1706
 			$pall = $Spotter->getLast7DaysAirportsArrivalByAirlines();
@@ -1723,32 +1723,32 @@  discard block
 block discarded – undo
1723 1723
     			}
1724 1724
     			$alldata = $pall;
1725 1725
 			foreach ($alldata as $number) {
1726
-				$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']);
1726
+				$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']);
1727 1727
 			}
1728 1728
 
1729 1729
 			echo 'Flights data...'."\n";
1730 1730
 			echo '-> countAllDatesLastMonth...'."\n";
1731 1731
 			$alldata = $Spotter->countAllDatesLastMonthByAirlines();
1732 1732
 			foreach ($alldata as $number) {
1733
-				$this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']);
1733
+				$this->addStatFlight('month', $number['date_name'], $number['date_count'], $number['airline_icao']);
1734 1734
 			}
1735 1735
 			echo '-> countAllDates...'."\n";
1736 1736
 			//$previousdata = $this->countAllDatesByAirlines();
1737
-			$alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines());
1737
+			$alldata = $Common->array_merge_noappend($previousdatabyairlines, $Spotter->countAllDatesByAirlines());
1738 1738
 			$values = array();
1739 1739
 			foreach ($alldata as $cnt) {
1740 1740
 				$values[] = $cnt['date_count'];
1741 1741
 			}
1742
-			array_multisort($values,SORT_DESC,$alldata);
1743
-			array_splice($alldata,11);
1742
+			array_multisort($values, SORT_DESC, $alldata);
1743
+			array_splice($alldata, 11);
1744 1744
 			foreach ($alldata as $number) {
1745
-				$this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']);
1745
+				$this->addStatFlight('date', $number['date_name'], $number['date_count'], $number['airline_icao']);
1746 1746
 			}
1747 1747
 			
1748 1748
 			echo '-> countAllHours...'."\n";
1749 1749
 			$alldata = $Spotter->countAllHoursByAirlines('hour');
1750 1750
 			foreach ($alldata as $number) {
1751
-				$this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']);
1751
+				$this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], $number['airline_icao']);
1752 1752
 			}
1753 1753
 			
1754 1754
 
@@ -1759,29 +1759,29 @@  discard block
 block discarded – undo
1759 1759
 				// Count by filter
1760 1760
 				echo '--- Stats for filter '.$filter_name.' ---'."\n";
1761 1761
 				$Spotter = new Spotter($this->db);
1762
-				$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter);
1762
+				$alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day, $filter);
1763 1763
 				foreach ($alldata as $number) {
1764
-					$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'',$filter_name);
1764
+					$this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', $filter_name);
1765 1765
 				}
1766
-				$alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day,$filter);
1766
+				$alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day, $filter);
1767 1767
 				foreach ($alldata as $number) {
1768
-					$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'',$filter_name);
1768
+					$this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', $filter_name);
1769 1769
 				}
1770
-				$alldata = $Spotter->countAllCallsigns(false,0,$last_update_day,$filter);
1770
+				$alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day, $filter);
1771 1771
 				foreach ($alldata as $number) {
1772
-					$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],'',$filter_name);
1772
+					$this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], '', $filter_name);
1773 1773
 				}
1774
-				$alldata = $Spotter->countAllOwners(false,0,$last_update_day,$filter);
1774
+				$alldata = $Spotter->countAllOwners(false, 0, $last_update_day, $filter);
1775 1775
 				foreach ($alldata as $number) {
1776
-					$this->addStatOwner($number['owner_name'],$number['owner_count'],'',$filter_name);
1776
+					$this->addStatOwner($number['owner_name'], $number['owner_count'], '', $filter_name);
1777 1777
 				}
1778
-				$alldata = $Spotter->countAllPilots(false,0,$last_update_day,$filter);
1778
+				$alldata = $Spotter->countAllPilots(false, 0, $last_update_day, $filter);
1779 1779
 				foreach ($alldata as $number) {
1780
-					$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name);
1780
+					$this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', $filter_name);
1781 1781
 				}
1782 1782
     			
1783
-				$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter);
1784
-	       			$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter);
1783
+				$pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day, $filter);
1784
+	       			$dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day, $filter);
1785 1785
 		        	$alldata = array();
1786 1786
 	    			foreach ($pall as $value) {
1787 1787
 		        		$icao = $value['airport_departure_icao'];
@@ -1797,12 +1797,12 @@  discard block
 block discarded – undo
1797 1797
     				foreach ($alldata as $key => $row) {
1798 1798
     					$count[$key] = $row['airport_departure_icao_count'];
1799 1799
     				}
1800
-				array_multisort($count,SORT_DESC,$alldata);
1800
+				array_multisort($count, SORT_DESC, $alldata);
1801 1801
 				foreach ($alldata as $number) {
1802
-    					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);
1802
+    					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);
1803 1803
 				}
1804
-				$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,$filter);
1805
-    				$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,$filter);
1804
+				$pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day, $filter);
1805
+    				$dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day, $filter);
1806 1806
 				$alldata = array();
1807 1807
     				foreach ($pall as $value) {
1808 1808
 		        		$icao = $value['airport_arrival_icao'];
@@ -1818,36 +1818,36 @@  discard block
 block discarded – undo
1818 1818
         			foreach ($alldata as $key => $row) {
1819 1819
     					$count[$key] = $row['airport_arrival_icao_count'];
1820 1820
 		        	}
1821
-        			array_multisort($count,SORT_DESC,$alldata);
1821
+        			array_multisort($count, SORT_DESC, $alldata);
1822 1822
 				foreach ($alldata as $number) {
1823
-					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);
1823
+					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);
1824 1824
 				}
1825 1825
 				$Spotter = new Spotter($this->db);
1826 1826
 				$alldata = $Spotter->countAllMonths($filter);
1827 1827
 				$lastyear = false;
1828 1828
 				foreach ($alldata as $number) {
1829 1829
 					if ($number['year_name'] != date('Y')) $lastyear = true;
1830
-					$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);
1830
+					$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);
1831 1831
 				}
1832 1832
 				$alldata = $Spotter->countAllMonthsOwners($filter);
1833 1833
 				foreach ($alldata as $number) {
1834
-					$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);
1834
+					$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);
1835 1835
 				}
1836 1836
 				$alldata = $Spotter->countAllMonthsPilots($filter);
1837 1837
 				foreach ($alldata as $number) {
1838
-					$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);
1838
+					$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);
1839 1839
 				}
1840 1840
 				$alldata = $Spotter->countAllMonthsAircrafts($filter);
1841 1841
 				foreach ($alldata as $number) {
1842
-					$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);
1842
+					$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);
1843 1843
 				}
1844 1844
 				$alldata = $Spotter->countAllMonthsRealArrivals($filter);
1845 1845
 				foreach ($alldata as $number) {
1846
-					$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);
1846
+					$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);
1847 1847
 				}
1848 1848
 				echo '...Departure'."\n";
1849
-				$pall = $Spotter->getLast7DaysAirportsDeparture('',$filter);
1850
-        			$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter);
1849
+				$pall = $Spotter->getLast7DaysAirportsDeparture('', $filter);
1850
+        			$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('', $filter);
1851 1851
 				foreach ($dall as $value) {
1852 1852
     					$icao = $value['departure_airport_icao'];
1853 1853
     					$ddate = $value['date'];
@@ -1865,11 +1865,11 @@  discard block
 block discarded – undo
1865 1865
     				}
1866 1866
 	    			$alldata = $pall;
1867 1867
 				foreach ($alldata as $number) {
1868
-					$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);
1868
+					$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);
1869 1869
 				}
1870 1870
 				echo '...Arrival'."\n";
1871
-				$pall = $Spotter->getLast7DaysAirportsArrival('',$filter);
1872
-    				$dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter);
1871
+				$pall = $Spotter->getLast7DaysAirportsArrival('', $filter);
1872
+    				$dall = $Spotter->getLast7DaysDetectedAirportsArrival('', $filter);
1873 1873
 				foreach ($dall as $value) {
1874 1874
 					$icao = $value['arrival_airport_icao'];
1875 1875
 					$ddate = $value['date'];
@@ -1887,32 +1887,32 @@  discard block
 block discarded – undo
1887 1887
     				}
1888 1888
     				$alldata = $pall;
1889 1889
 				foreach ($alldata as $number) {
1890
-					$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);
1890
+					$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);
1891 1891
 				}
1892 1892
     
1893 1893
 				echo 'Flights data...'."\n";
1894 1894
 				echo '-> countAllDatesLastMonth...'."\n";
1895 1895
 				$alldata = $Spotter->countAllDatesLastMonth($filter);
1896 1896
 				foreach ($alldata as $number) {
1897
-					$this->addStatFlight('month',$number['date_name'],$number['date_count'], '',$filter_name);
1897
+					$this->addStatFlight('month', $number['date_name'], $number['date_count'], '', $filter_name);
1898 1898
 				}
1899 1899
 				echo '-> countAllDates...'."\n";
1900
-				$previousdata = $this->countAllDates('',$filter_name);
1901
-				$alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter));
1900
+				$previousdata = $this->countAllDates('', $filter_name);
1901
+				$alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter));
1902 1902
 				$values = array();
1903 1903
 				foreach ($alldata as $cnt) {
1904 1904
 					$values[] = $cnt['date_count'];
1905 1905
 				}
1906
-				array_multisort($values,SORT_DESC,$alldata);
1907
-				array_splice($alldata,11);
1906
+				array_multisort($values, SORT_DESC, $alldata);
1907
+				array_splice($alldata, 11);
1908 1908
 				foreach ($alldata as $number) {
1909
-					$this->addStatFlight('date',$number['date_name'],$number['date_count'],'',$filter_name);
1909
+					$this->addStatFlight('date', $number['date_name'], $number['date_count'], '', $filter_name);
1910 1910
 				}
1911 1911
 				
1912 1912
 				echo '-> countAllHours...'."\n";
1913
-				$alldata = $Spotter->countAllHours('hour',$filter);
1913
+				$alldata = $Spotter->countAllHours('hour', $filter);
1914 1914
 				foreach ($alldata as $number) {
1915
-					$this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],'',$filter_name);
1915
+					$this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], '', $filter_name);
1916 1916
 				}
1917 1917
 			}
1918 1918
 	
@@ -1923,16 +1923,16 @@  discard block
 block discarded – undo
1923 1923
 				// SUM all previous month to put as year
1924 1924
 				$previous_year = date('Y');
1925 1925
 				$previous_year--;
1926
-				$this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
1927
-				$this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
1928
-				$this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
1929
-				$this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
1926
+				$this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
1927
+				$this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
1928
+				$this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
1929
+				$this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
1930 1930
 				$allairlines = $this->getAllAirlineNames();
1931 1931
 				foreach ($allairlines as $data) {
1932
-					$this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
1933
-					$this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
1934
-					$this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
1935
-					$this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
1932
+					$this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
1933
+					$this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
1934
+					$this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
1935
+					$this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
1936 1936
 				}
1937 1937
 				
1938 1938
 				if (isset($globalArchiveYear) && $globalArchiveYear) {
@@ -1941,7 +1941,7 @@  discard block
 block discarded – undo
1941 1941
 						try {
1942 1942
 							$sth = $this->db->prepare($query);
1943 1943
 							$sth->execute();
1944
-						} catch(PDOException $e) {
1944
+						} catch (PDOException $e) {
1945 1945
 							return "error : ".$e->getMessage().' - query : '.$query."\n";
1946 1946
 						}
1947 1947
 					}
@@ -1950,7 +1950,7 @@  discard block
 block discarded – undo
1950 1950
 					try {
1951 1951
 						$sth = $this->db->prepare($query);
1952 1952
 						$sth->execute();
1953
-					} catch(PDOException $e) {
1953
+					} catch (PDOException $e) {
1954 1954
 						return "error : ".$e->getMessage().' - query : '.$query."\n";
1955 1955
 					}
1956 1956
 				}
@@ -1972,7 +1972,7 @@  discard block
 block discarded – undo
1972 1972
 					try {
1973 1973
 						$sth = $this->db->prepare($query);
1974 1974
 						$sth->execute();
1975
-					} catch(PDOException $e) {
1975
+					} catch (PDOException $e) {
1976 1976
 						return "error : ".$e->getMessage();
1977 1977
 					}
1978 1978
 				}
@@ -1986,13 +1986,13 @@  discard block
 block discarded – undo
1986 1986
 				try {
1987 1987
 					$sth = $this->db->prepare($query);
1988 1988
 					$sth->execute();
1989
-				} catch(PDOException $e) {
1989
+				} catch (PDOException $e) {
1990 1990
 					return "error : ".$e->getMessage();
1991 1991
 				}
1992 1992
 			}
1993 1993
 			echo 'Insert last stats update date...'."\n";
1994 1994
 			date_default_timezone_set('UTC');
1995
-			$this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s'));
1995
+			$this->addLastStatsUpdate('last_update_stats', date('Y-m-d G:i:s'));
1996 1996
 		//}
1997 1997
 	}
1998 1998
 }
Please login to merge, or discard this patch.
Braces   +242 added lines, -86 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
         }
@@ -41,7 +43,9 @@  discard block
 block discarded – undo
41 43
                 return $all;
42 44
         }
43 45
 	public function getAllAirlineNames($filter_name = '') {
44
-		if ($filter_name == '') $filter_name = $this->filter_name;
46
+		if ($filter_name == '') {
47
+			$filter_name = $this->filter_name;
48
+		}
45 49
                 $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC";
46 50
                  try {
47 51
                         $sth = $this->db->prepare($query);
@@ -53,7 +57,9 @@  discard block
 block discarded – undo
53 57
                 return $all;
54 58
         }
55 59
 	public function getAllAircraftTypes($stats_airline = '',$filter_name = '') {
56
-		if ($filter_name == '') $filter_name = $this->filter_name;
60
+		if ($filter_name == '') {
61
+			$filter_name = $this->filter_name;
62
+		}
57 63
                 $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
58 64
                  try {
59 65
                         $sth = $this->db->prepare($query);
@@ -65,7 +71,9 @@  discard block
 block discarded – undo
65 71
                 return $all;
66 72
         }
67 73
 	public function getAllAirportNames($stats_airline = '',$filter_name = '') {
68
-		if ($filter_name == '') $filter_name = $this->filter_name;
74
+		if ($filter_name == '') {
75
+			$filter_name = $this->filter_name;
76
+		}
69 77
                 $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC";
70 78
                  try {
71 79
                         $sth = $this->db->prepare($query);
@@ -80,9 +88,14 @@  discard block
 block discarded – undo
80 88
 
81 89
 	public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '') {
82 90
 		global $globalStatsFilters;
83
-		if ($filter_name == '') $filter_name = $this->filter_name;
84
-		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";
85
-		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";
91
+		if ($filter_name == '') {
92
+			$filter_name = $this->filter_name;
93
+		}
94
+		if ($limit) {
95
+			$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";
96
+		} else {
97
+			$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";
98
+		}
86 99
                  try {
87 100
                         $sth = $this->db->prepare($query);
88 101
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -102,9 +115,14 @@  discard block
 block discarded – undo
102 115
 	}
103 116
 	public function countAllAirlineCountries($limit = true,$filter_name = '') {
104 117
 		global $globalStatsFilters;
105
-		if ($filter_name == '') $filter_name = $this->filter_name;
106
-		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";
107
-		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";
118
+		if ($filter_name == '') {
119
+			$filter_name = $this->filter_name;
120
+		}
121
+		if ($limit) {
122
+			$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";
123
+		} else {
124
+			$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";
125
+		}
108 126
                  try {
109 127
                         $sth = $this->db->prepare($query);
110 128
                         $sth->execute(array(':filter_name' => $filter_name));
@@ -124,9 +142,14 @@  discard block
 block discarded – undo
124 142
 	}
125 143
 	public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '') {
126 144
 		global $globalStatsFilters;
127
-		if ($filter_name == '') $filter_name = $this->filter_name;
128
-		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";
129
-		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";
145
+		if ($filter_name == '') {
146
+			$filter_name = $this->filter_name;
147
+		}
148
+		if ($limit) {
149
+			$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";
150
+		} else {
151
+			$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";
152
+		}
130 153
                  try {
131 154
                         $sth = $this->db->prepare($query);
132 155
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -147,9 +170,14 @@  discard block
 block discarded – undo
147 170
 
148 171
 	public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '') {
149 172
 		global $globalStatsFilters;
150
-		if ($filter_name == '') $filter_name = $this->filter_name;
151
-		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";
152
-		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";
173
+		if ($filter_name == '') {
174
+			$filter_name = $this->filter_name;
175
+		}
176
+		if ($limit) {
177
+			$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";
178
+		} else {
179
+			$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";
180
+		}
153 181
                  try {
154 182
                         $sth = $this->db->prepare($query);
155 183
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -169,9 +197,14 @@  discard block
 block discarded – undo
169 197
 	}
170 198
 	public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '') {
171 199
 		global $globalStatsFilters;
172
-		if ($filter_name == '') $filter_name = $this->filter_name;
173
-		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";
174
-		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";
200
+		if ($filter_name == '') {
201
+			$filter_name = $this->filter_name;
202
+		}
203
+		if ($limit) {
204
+			$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";
205
+		} else {
206
+			$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";
207
+		}
175 208
                  try {
176 209
                         $sth = $this->db->prepare($query);
177 210
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -192,9 +225,14 @@  discard block
 block discarded – undo
192 225
 
193 226
 	public function countAllAirlines($limit = true,$filter_name = '') {
194 227
 		global $globalStatsFilters;
195
-		if ($filter_name == '') $filter_name = $this->filter_name;
196
-		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";
197
-		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";
228
+		if ($filter_name == '') {
229
+			$filter_name = $this->filter_name;
230
+		}
231
+		if ($limit) {
232
+			$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";
233
+		} else {
234
+			$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";
235
+		}
198 236
                  try {
199 237
                         $sth = $this->db->prepare($query);
200 238
                         $sth->execute(array(':filter_name' => $filter_name));
@@ -215,9 +253,14 @@  discard block
 block discarded – undo
215 253
 	}
216 254
 	public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '') {
217 255
 		global $globalStatsFilters;
218
-		if ($filter_name == '') $filter_name = $this->filter_name;
219
-		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";
220
-		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";
256
+		if ($filter_name == '') {
257
+			$filter_name = $this->filter_name;
258
+		}
259
+		if ($limit) {
260
+			$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";
261
+		} else {
262
+			$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";
263
+		}
221 264
                  try {
222 265
                         $sth = $this->db->prepare($query);
223 266
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -237,9 +280,14 @@  discard block
 block discarded – undo
237 280
 	}
238 281
 	public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '') {
239 282
 		global $globalStatsFilters;
240
-		if ($filter_name == '') $filter_name = $this->filter_name;
241
-		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";
242
-		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";
283
+		if ($filter_name == '') {
284
+			$filter_name = $this->filter_name;
285
+		}
286
+		if ($limit) {
287
+			$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";
288
+		} else {
289
+			$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";
290
+		}
243 291
 		 try {
244 292
 			$sth = $this->db->prepare($query);
245 293
 			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -259,10 +307,15 @@  discard block
 block discarded – undo
259 307
 	}
260 308
 	public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '') {
261 309
 		$Connection = new Connection();
262
-		if ($filter_name == '') $filter_name = $this->filter_name;
310
+		if ($filter_name == '') {
311
+			$filter_name = $this->filter_name;
312
+		}
263 313
 		if ($Connection->tableExists('countries')) {
264
-			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";
265
-			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
+			if ($limit) {
315
+				$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";
316
+			} else {
317
+				$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";
318
+			}
266 319
 			 try {
267 320
 				$sth = $this->db->prepare($query);
268 321
 				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -283,9 +336,14 @@  discard block
 block discarded – undo
283 336
 	}
284 337
 	public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '') {
285 338
 		global $globalStatsFilters;
286
-		if ($filter_name == '') $filter_name = $this->filter_name;
287
-		if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0";
288
-		else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC";
339
+		if ($filter_name == '') {
340
+			$filter_name = $this->filter_name;
341
+		}
342
+		if ($limit) {
343
+			$query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0";
344
+		} else {
345
+			$query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC";
346
+		}
289 347
                  try {
290 348
                         $sth = $this->db->prepare($query);
291 349
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -305,9 +363,14 @@  discard block
 block discarded – undo
305 363
 	}
306 364
 	public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '') {
307 365
 		global $globalStatsFilters;
308
-		if ($filter_name == '') $filter_name = $this->filter_name;
309
-		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";
310
-		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";
366
+		if ($filter_name == '') {
367
+			$filter_name = $this->filter_name;
368
+		}
369
+		if ($limit) {
370
+			$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";
371
+		} else {
372
+			$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";
373
+		}
311 374
                  try {
312 375
                         $sth = $this->db->prepare($query);
313 376
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -327,9 +390,14 @@  discard block
 block discarded – undo
327 390
 	}
328 391
 	public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '') {
329 392
 		global $globalStatsFilters;
330
-		if ($filter_name == '') $filter_name = $this->filter_name;
331
-		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 stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
332
-		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 stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
393
+		if ($filter_name == '') {
394
+			$filter_name = $this->filter_name;
395
+		}
396
+		if ($limit) {
397
+			$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 stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
398
+		} else {
399
+			$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 stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
400
+		}
333 401
                  try {
334 402
                         $sth = $this->db->prepare($query);
335 403
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -355,7 +423,9 @@  discard block
 block discarded – undo
355 423
         			$icao = $value['airport_departure_icao'];
356 424
         			if (isset($all[$icao])) {
357 425
         				$all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
358
-        			} else $all[$icao] = $value;
426
+        			} else {
427
+        				$all[$icao] = $value;
428
+        			}
359 429
         		}
360 430
         		$count = array();
361 431
         		foreach ($all as $key => $row) {
@@ -367,9 +437,14 @@  discard block
 block discarded – undo
367 437
 	}
368 438
 	public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '') {
369 439
 		global $globalStatsFilters;
370
-		if ($filter_name == '') $filter_name = $this->filter_name;
371
-		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 stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0";
372
-		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 stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
440
+		if ($filter_name == '') {
441
+			$filter_name = $this->filter_name;
442
+		}
443
+		if ($limit) {
444
+			$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 stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0";
445
+		} else {
446
+			$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 stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
447
+		}
373 448
 		try {
374 449
 			$sth = $this->db->prepare($query);
375 450
 			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -395,7 +470,9 @@  discard block
 block discarded – undo
395 470
         			$icao = $value['airport_arrival_icao'];
396 471
         			if (isset($all[$icao])) {
397 472
         				$all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
398
-        			} else $all[$icao] = $value;
473
+        			} else {
474
+        				$all[$icao] = $value;
475
+        			}
399 476
         		}
400 477
         		$count = array();
401 478
         		foreach ($all as $key => $row) {
@@ -408,13 +485,21 @@  discard block
 block discarded – undo
408 485
 	}
409 486
 	public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') {
410 487
 		global $globalDBdriver, $globalStatsFilters;
411
-		if ($filter_name == '') $filter_name = $this->filter_name;
488
+		if ($filter_name == '') {
489
+			$filter_name = $this->filter_name;
490
+		}
412 491
 		if ($globalDBdriver == 'mysql') {
413
-			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";
414
-			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";
492
+			if ($limit) {
493
+				$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";
494
+			} else {
495
+				$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";
496
+			}
415 497
 		} else {
416
-			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";
417
-			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";
498
+			if ($limit) {
499
+				$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";
500
+			} else {
501
+				$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";
502
+			}
418 503
 		}
419 504
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
420 505
                  try {
@@ -438,7 +523,9 @@  discard block
 block discarded – undo
438 523
 	
439 524
 	public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') {
440 525
 		global $globalStatsFilters;
441
-		if ($filter_name == '') $filter_name = $this->filter_name;
526
+		if ($filter_name == '') {
527
+			$filter_name = $this->filter_name;
528
+		}
442 529
 		$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";
443 530
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
444 531
                  try {
@@ -460,7 +547,9 @@  discard block
 block discarded – undo
460 547
 	}
461 548
 	public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') {
462 549
 		global $globalDBdriver, $globalStatsFilters;
463
-		if ($filter_name == '') $filter_name = $this->filter_name;
550
+		if ($filter_name == '') {
551
+			$filter_name = $this->filter_name;
552
+		}
464 553
 		if ($globalDBdriver == 'mysql') {
465 554
 			$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";
466 555
 		} else {
@@ -486,7 +575,9 @@  discard block
 block discarded – undo
486 575
 	}
487 576
 	public function countAllDates($stats_airline = '',$filter_name = '') {
488 577
 		global $globalStatsFilters;
489
-		if ($filter_name == '') $filter_name = $this->filter_name;
578
+		if ($filter_name == '') {
579
+			$filter_name = $this->filter_name;
580
+		}
490 581
 		$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";
491 582
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
492 583
                  try {
@@ -508,7 +599,9 @@  discard block
 block discarded – undo
508 599
 	}
509 600
 	public function countAllDatesByAirlines($filter_name = '') {
510 601
 		global $globalStatsFilters;
511
-		if ($filter_name == '') $filter_name = $this->filter_name;
602
+		if ($filter_name == '') {
603
+			$filter_name = $this->filter_name;
604
+		}
512 605
 		$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";
513 606
 		$query_data = array('filter_name' => $filter_name);
514 607
                  try {
@@ -530,7 +623,9 @@  discard block
 block discarded – undo
530 623
 	}
531 624
 	public function countAllMonths($stats_airline = '',$filter_name = '') {
532 625
 		global $globalStatsFilters;
533
-		if ($filter_name == '') $filter_name = $this->filter_name;
626
+		if ($filter_name == '') {
627
+			$filter_name = $this->filter_name;
628
+		}
534 629
 	    	$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";
535 630
                  try {
536 631
                         $sth = $this->db->prepare($query);
@@ -551,7 +646,9 @@  discard block
 block discarded – undo
551 646
 	}
552 647
 	public function countAllMilitaryMonths($filter_name = '') {
553 648
 		global $globalStatsFilters;
554
-		if ($filter_name == '') $filter_name = $this->filter_name;
649
+		if ($filter_name == '') {
650
+			$filter_name = $this->filter_name;
651
+		}
555 652
 	    	$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";
556 653
                  try {
557 654
                         $sth = $this->db->prepare($query);
@@ -572,9 +669,14 @@  discard block
 block discarded – undo
572 669
 	}
573 670
 	public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') {
574 671
 		global $globalTimezone, $globalDBdriver, $globalStatsFilters;
575
-		if ($filter_name == '') $filter_name = $this->filter_name;
576
-		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";
577
-		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";
672
+		if ($filter_name == '') {
673
+			$filter_name = $this->filter_name;
674
+		}
675
+		if ($limit) {
676
+			$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";
677
+		} else {
678
+			$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";
679
+		}
578 680
 		if ($orderby == 'hour') {
579 681
 			/*
580 682
 			if ($globalDBdriver == 'mysql') {
@@ -583,7 +685,9 @@  discard block
 block discarded – undo
583 685
 			*/
584 686
 			$query .= " ORDER BY CAST(flight_date AS integer) ASC";
585 687
 		}
586
-		if ($orderby == 'count') $query .= " ORDER BY hour_count DESC";
688
+		if ($orderby == 'count') {
689
+			$query .= " ORDER BY hour_count DESC";
690
+		}
587 691
                  try {
588 692
                         $sth = $this->db->prepare($query);
589 693
                         $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
@@ -604,7 +708,9 @@  discard block
 block discarded – undo
604 708
 	
605 709
 	public function countOverallFlights($stats_airline = '', $filter_name = '') {
606 710
 		global $globalStatsFilters;
607
-		if ($filter_name == '') $filter_name = $this->filter_name;
711
+		if ($filter_name == '') {
712
+			$filter_name = $this->filter_name;
713
+		}
608 714
 		$all = $this->getSumStats('flights_bymonth',date('Y'),$stats_airline,$filter_name);
609 715
 		if (empty($all)) {
610 716
 			$filters = array('airlines' => array($stats_airline));
@@ -618,7 +724,9 @@  discard block
 block discarded – undo
618 724
 	}
619 725
 	public function countOverallMilitaryFlights($filter_name = '') {
620 726
 		global $globalStatsFilters;
621
-		if ($filter_name == '') $filter_name = $this->filter_name;
727
+		if ($filter_name == '') {
728
+			$filter_name = $this->filter_name;
729
+		}
622 730
 		$all = $this->getSumStats('military_flights_bymonth',date('Y'),'',$filter_name);
623 731
 		if (empty($all)) {
624 732
 		        $filters = array();
@@ -632,7 +740,9 @@  discard block
 block discarded – undo
632 740
 	}
633 741
 	public function countOverallArrival($stats_airline = '',$filter_name = '') {
634 742
 		global $globalStatsFilters;
635
-		if ($filter_name == '') $filter_name = $this->filter_name;
743
+		if ($filter_name == '') {
744
+			$filter_name = $this->filter_name;
745
+		}
636 746
 		$all = $this->getSumStats('realarrivals_bymonth',date('Y'),$stats_airline,$filter_name);
637 747
 		if (empty($all)) {
638 748
 			$filters = array('airlines' => array($stats_airline));
@@ -646,7 +756,9 @@  discard block
 block discarded – undo
646 756
 	}
647 757
 	public function countOverallAircrafts($stats_airline = '',$filter_name = '') {
648 758
 		global $globalStatsFilters;
649
-		if ($filter_name == '') $filter_name = $this->filter_name;
759
+		if ($filter_name == '') {
760
+			$filter_name = $this->filter_name;
761
+		}
650 762
 		$all = $this->getSumStats('aircrafts_bymonth',date('Y'),$stats_airline,$filter_name);
651 763
 		if (empty($all)) {
652 764
 			$filters = array('airlines' => array($stats_airline));
@@ -660,7 +772,9 @@  discard block
 block discarded – undo
660 772
 	}
661 773
 	public function countOverallAirlines($filter_name = '') {
662 774
 		global $globalStatsFilters;
663
-		if ($filter_name == '') $filter_name = $this->filter_name;
775
+		if ($filter_name == '') {
776
+			$filter_name = $this->filter_name;
777
+		}
664 778
 		$query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name";
665 779
                  try {
666 780
                         $sth = $this->db->prepare($query);
@@ -683,7 +797,9 @@  discard block
 block discarded – undo
683 797
 	}
684 798
 	public function countOverallOwners($stats_airline = '',$filter_name = '') {
685 799
 		global $globalStatsFilters;
686
-		if ($filter_name == '') $filter_name = $this->filter_name;
800
+		if ($filter_name == '') {
801
+			$filter_name = $this->filter_name;
802
+		}
687 803
 		/*
688 804
 		$query = "SELECT COUNT(*) AS nb_owner FROM stats_owner";
689 805
                  try {
@@ -708,7 +824,9 @@  discard block
 block discarded – undo
708 824
 	}
709 825
 	public function countOverallPilots($stats_airline = '',$filter_name = '') {
710 826
 		global $globalStatsFilters;
711
-		if ($filter_name == '') $filter_name = $this->filter_name;
827
+		if ($filter_name == '') {
828
+			$filter_name = $this->filter_name;
829
+		}
712 830
 		$all = $this->getSumStats('pilots_bymonth',date('Y'),$stats_airline,$filter_name);
713 831
 		if (empty($all)) {
714 832
 			$filters = array('airlines' => array($stats_airline));
@@ -722,7 +840,9 @@  discard block
 block discarded – undo
722 840
 	}
723 841
 
724 842
 	public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') {
725
-		if ($filter_name == '') $filter_name = $this->filter_name;
843
+		if ($filter_name == '') {
844
+			$filter_name = $this->filter_name;
845
+		}
726 846
 		$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";
727 847
 		$query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
728 848
                  try {
@@ -735,7 +855,9 @@  discard block
 block discarded – undo
735 855
                 return $all;
736 856
 	}
737 857
 	public function getStats($type,$stats_airline = '', $filter_name = '') {
738
-		if ($filter_name == '') $filter_name = $this->filter_name;
858
+		if ($filter_name == '') {
859
+			$filter_name = $this->filter_name;
860
+		}
739 861
                 $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date";
740 862
                 $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
741 863
                  try {
@@ -748,7 +870,9 @@  discard block
 block discarded – undo
748 870
                 return $all;
749 871
         }
750 872
 	public function getSumStats($type,$year,$stats_airline = '',$filter_name = '') {
751
-		if ($filter_name == '') $filter_name = $this->filter_name;
873
+		if ($filter_name == '') {
874
+			$filter_name = $this->filter_name;
875
+		}
752 876
     		global $globalArchiveMonths, $globalDBdriver;
753 877
     		if ($globalDBdriver == 'mysql') {
754 878
 	                $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";
@@ -767,7 +891,9 @@  discard block
 block discarded – undo
767 891
         }
768 892
 	public function getStatsTotal($type, $stats_airline = '', $filter_name = '') {
769 893
     		global $globalArchiveMonths, $globalDBdriver;
770
-		if ($filter_name == '') $filter_name = $this->filter_name;
894
+		if ($filter_name == '') {
895
+			$filter_name = $this->filter_name;
896
+		}
771 897
     		if ($globalDBdriver == 'mysql') {
772 898
 			$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";
773 899
 		} else {
@@ -785,7 +911,9 @@  discard block
 block discarded – undo
785 911
         }
786 912
 	public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') {
787 913
     		global $globalArchiveMonths, $globalDBdriver;
788
-		if ($filter_name == '') $filter_name = $this->filter_name;
914
+		if ($filter_name == '') {
915
+			$filter_name = $this->filter_name;
916
+		}
789 917
     		if ($globalDBdriver == 'mysql') {
790 918
 			$query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name";
791 919
                 } else {
@@ -802,7 +930,9 @@  discard block
 block discarded – undo
802 930
         }
803 931
 	public function getStatsAirlineTotal($filter_name = '') {
804 932
     		global $globalArchiveMonths, $globalDBdriver;
805
-		if ($filter_name == '') $filter_name = $this->filter_name;
933
+		if ($filter_name == '') {
934
+			$filter_name = $this->filter_name;
935
+		}
806 936
     		if ($globalDBdriver == 'mysql') {
807 937
 			$query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name";
808 938
                 } else {
@@ -819,7 +949,9 @@  discard block
 block discarded – undo
819 949
         }
820 950
 	public function getStatsOwnerTotal($filter_name = '') {
821 951
     		global $globalArchiveMonths, $globalDBdriver;
822
-		if ($filter_name == '') $filter_name = $this->filter_name;
952
+		if ($filter_name == '') {
953
+			$filter_name = $this->filter_name;
954
+		}
823 955
     		if ($globalDBdriver == 'mysql') {
824 956
 			$query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name";
825 957
 		} else {
@@ -836,7 +968,9 @@  discard block
 block discarded – undo
836 968
         }
837 969
 	public function getStatsPilotTotal($filter_name = '') {
838 970
     		global $globalArchiveMonths, $globalDBdriver;
839
-		if ($filter_name == '') $filter_name = $this->filter_name;
971
+		if ($filter_name == '') {
972
+			$filter_name = $this->filter_name;
973
+		}
840 974
     		if ($globalDBdriver == 'mysql') {
841 975
             		$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
842 976
             	} else {
@@ -854,7 +988,9 @@  discard block
 block discarded – undo
854 988
 
855 989
 	public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
856 990
 		global $globalDBdriver;
857
-		if ($filter_name == '') $filter_name = $this->filter_name;
991
+		if ($filter_name == '') {
992
+			$filter_name = $this->filter_name;
993
+		}
858 994
 		if ($globalDBdriver == 'mysql') {
859 995
 			$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";
860 996
                 } else {
@@ -870,7 +1006,9 @@  discard block
 block discarded – undo
870 1006
         }
871 1007
 	public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
872 1008
 		global $globalDBdriver;
873
-		if ($filter_name == '') $filter_name = $this->filter_name;
1009
+		if ($filter_name == '') {
1010
+			$filter_name = $this->filter_name;
1011
+		}
874 1012
 		if ($globalDBdriver == 'mysql') {
875 1013
 			$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";
876 1014
 		} else {
@@ -1356,7 +1494,9 @@  discard block
 block discarded – undo
1356 1494
 			echo 'Update stats !'."\n";
1357 1495
 			if (isset($last_update[0]['value'])) {
1358 1496
 				$last_update_day = $last_update[0]['value'];
1359
-			} else $last_update_day = '2012-12-12 12:12:12';
1497
+			} else {
1498
+				$last_update_day = '2012-12-12 12:12:12';
1499
+			}
1360 1500
 			$Spotter = new Spotter($this->db);
1361 1501
 			$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day);
1362 1502
 			foreach ($alldata as $number) {
@@ -1395,7 +1535,9 @@  discard block
 block discarded – undo
1395 1535
     				$icao = $value['airport_departure_icao'];
1396 1536
         			if (isset($alldata[$icao])) {
1397 1537
     					$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1398
-        			} else $alldata[$icao] = $value;
1538
+        			} else {
1539
+        				$alldata[$icao] = $value;
1540
+        			}
1399 1541
 			}
1400 1542
     			$count = array();
1401 1543
     			foreach ($alldata as $key => $row) {
@@ -1416,7 +1558,9 @@  discard block
 block discarded – undo
1416 1558
     				$icao = $value['airport_arrival_icao'];
1417 1559
         			if (isset($alldata[$icao])) {
1418 1560
         				$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1419
-	        		} else $alldata[$icao] = $value;
1561
+	        		} else {
1562
+	        			$alldata[$icao] = $value;
1563
+	        		}
1420 1564
     			}
1421 1565
         		$count = array();
1422 1566
         		foreach ($alldata as $key => $row) {
@@ -1442,7 +1586,9 @@  discard block
 block discarded – undo
1442 1586
 			$alldata = $Spotter->countAllMonths();
1443 1587
 			$lastyear = false;
1444 1588
 			foreach ($alldata as $number) {
1445
-				if ($number['year_name'] != date('Y')) $lastyear = true;
1589
+				if ($number['year_name'] != date('Y')) {
1590
+					$lastyear = true;
1591
+				}
1446 1592
 				$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'])));
1447 1593
 			}
1448 1594
 			$alldata = $Spotter->countAllMilitaryMonths();
@@ -1660,7 +1806,9 @@  discard block
 block discarded – undo
1660 1806
 			$alldata = $Spotter->countAllMonthsByAirlines();
1661 1807
 			$lastyear = false;
1662 1808
 			foreach ($alldata as $number) {
1663
-				if ($number['year_name'] != date('Y')) $lastyear = true;
1809
+				if ($number['year_name'] != date('Y')) {
1810
+					$lastyear = true;
1811
+				}
1664 1812
 				$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']);
1665 1813
 			}
1666 1814
 			$alldata = $Spotter->countAllMonthsOwnersByAirlines();
@@ -1752,7 +1900,9 @@  discard block
 block discarded – undo
1752 1900
 			}
1753 1901
 			
1754 1902
 
1755
-			if (!isset($globalStatsFilters) || $globalStatsFilters == '') $globalStatsFilters = array();
1903
+			if (!isset($globalStatsFilters) || $globalStatsFilters == '') {
1904
+				$globalStatsFilters = array();
1905
+			}
1756 1906
 			foreach ($globalStatsFilters as $name => $filter) {
1757 1907
 				//$filter_name = $filter['name'];
1758 1908
 				$filter_name = $name;
@@ -1791,7 +1941,9 @@  discard block
 block discarded – undo
1791 1941
 	    				$icao = $value['airport_departure_icao'];
1792 1942
         				if (isset($alldata[$icao])) {
1793 1943
     						$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1794
-        				} else $alldata[$icao] = $value;
1944
+        				} else {
1945
+        					$alldata[$icao] = $value;
1946
+        				}
1795 1947
 				}
1796 1948
 	    			$count = array();
1797 1949
     				foreach ($alldata as $key => $row) {
@@ -1812,7 +1964,9 @@  discard block
 block discarded – undo
1812 1964
 	    				$icao = $value['airport_arrival_icao'];
1813 1965
         				if (isset($alldata[$icao])) {
1814 1966
         					$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1815
-		        		} else $alldata[$icao] = $value;
1967
+		        		} else {
1968
+		        			$alldata[$icao] = $value;
1969
+		        		}
1816 1970
 	    			}
1817 1971
         			$count = array();
1818 1972
         			foreach ($alldata as $key => $row) {
@@ -1826,7 +1980,9 @@  discard block
 block discarded – undo
1826 1980
 				$alldata = $Spotter->countAllMonths($filter);
1827 1981
 				$lastyear = false;
1828 1982
 				foreach ($alldata as $number) {
1829
-					if ($number['year_name'] != date('Y')) $lastyear = true;
1983
+					if ($number['year_name'] != date('Y')) {
1984
+						$lastyear = true;
1985
+					}
1830 1986
 					$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);
1831 1987
 				}
1832 1988
 				$alldata = $Spotter->countAllMonthsOwners($filter);
Please login to merge, or discard this patch.
require/class.Spotter.php 2 patches
Indentation   +1266 added lines, -1266 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
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName],$filter);
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
 	}
56 56
 
57 57
 	/**
58
-	* Executes the SQL statements to get the spotter information
59
-	*
60
-	* @param String $query the SQL query
61
-	* @param Array $params parameter of the query
62
-	* @param String $limitQuery the limit query
63
-	* @return Array the spotter information
64
-	*
65
-	*/
58
+	 * Executes the SQL statements to get the spotter information
59
+	 *
60
+	 * @param String $query the SQL query
61
+	 * @param Array $params parameter of the query
62
+	 * @param String $limitQuery the limit query
63
+	 * @return Array the spotter information
64
+	 *
65
+	 */
66 66
 	public function getDataFromDB($query, $params = array(), $limitQuery = '')
67 67
 	{
68 68
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
@@ -226,11 +226,11 @@  discard block
 block discarded – undo
226 226
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
227 227
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
228 228
 					} else $temp_array['aircraft_shadow'] = 'default.png';
229
-                                } else {
230
-                            		$temp_array['aircraft_shadow'] = 'default.png';
229
+								} else {
230
+									$temp_array['aircraft_shadow'] = 'default.png';
231 231
 					$temp_array['aircraft_name'] = 'N/A';
232 232
 					$temp_array['aircraft_manufacturer'] = 'N/A';
233
-                            	}
233
+								}
234 234
 			}
235 235
 			$fromsource = NULL;
236 236
 			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
@@ -413,11 +413,11 @@  discard block
 block discarded – undo
413 413
 	
414 414
 	
415 415
 	/**
416
-	* Gets all the spotter information
417
-	*
418
-	* @return Array the spotter information
419
-	*
420
-	*/
416
+	 * Gets all the spotter information
417
+	 *
418
+	 * @return Array the spotter information
419
+	 *
420
+	 */
421 421
 	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 = '',$filter = array())
422 422
 	{
423 423
 		global $globalTimezone, $globalDBdriver;
@@ -764,11 +764,11 @@  discard block
 block discarded – undo
764 764
 	
765 765
 	
766 766
 	/**
767
-	* Gets all the spotter information based on the latest data entry
768
-	*
769
-	* @return Array the spotter information
770
-	*
771
-	*/
767
+	 * Gets all the spotter information based on the latest data entry
768
+	 *
769
+	 * @return Array the spotter information
770
+	 *
771
+	 */
772 772
 	public function getLatestSpotterData($limit = '', $sort = '', $filter = array())
773 773
 	{
774 774
 		global $global_query;
@@ -807,12 +807,12 @@  discard block
 block discarded – undo
807 807
 	}
808 808
     
809 809
     
810
-    /**
811
-	* Gets all the spotter information based on a user's latitude and longitude
812
-	*
813
-	* @return Array the spotter information
814
-	*
815
-	*/
810
+	/**
811
+	 * Gets all the spotter information based on a user's latitude and longitude
812
+	 *
813
+	 * @return Array the spotter information
814
+	 *
815
+	 */
816 816
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
817 817
 	{
818 818
 		date_default_timezone_set('UTC');
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
 				return false;
841 841
 			}
842 842
 		}
843
-    		$additional_query = '';
843
+			$additional_query = '';
844 844
 		if ($interval != "")
845 845
 		{
846 846
 			if (!is_string($interval))
@@ -880,12 +880,12 @@  discard block
 block discarded – undo
880 880
 	}
881 881
     
882 882
     
883
-    /**
884
-	* Gets all the spotter information sorted by the newest aircraft type
885
-	*
886
-	* @return Array the spotter information
887
-	*
888
-	*/
883
+	/**
884
+	 * Gets all the spotter information sorted by the newest aircraft type
885
+	 *
886
+	 * @return Array the spotter information
887
+	 *
888
+	 */
889 889
 	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
890 890
 	{
891 891
 		global $global_query;
@@ -926,11 +926,11 @@  discard block
 block discarded – undo
926 926
     
927 927
     
928 928
 	/**
929
-	* Gets all the spotter information sorted by the newest aircraft registration
930
-	*
931
-	* @return Array the spotter information
932
-	*
933
-	*/
929
+	 * Gets all the spotter information sorted by the newest aircraft registration
930
+	 *
931
+	 * @return Array the spotter information
932
+	 *
933
+	 */
934 934
 	public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array())
935 935
 	{
936 936
 		global $global_query;
@@ -970,11 +970,11 @@  discard block
 block discarded – undo
970 970
 
971 971
 
972 972
 	/**
973
-	* Gets all the spotter information sorted by the newest airline
974
-	*
975
-	* @return Array the spotter information
976
-	*
977
-	*/
973
+	 * Gets all the spotter information sorted by the newest airline
974
+	 *
975
+	 * @return Array the spotter information
976
+	 *
977
+	 */
978 978
 	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
979 979
 	{
980 980
 		global $global_query;
@@ -1013,12 +1013,12 @@  discard block
 block discarded – undo
1013 1013
 	}
1014 1014
     
1015 1015
     
1016
-    /**
1017
-	* Gets all the spotter information sorted by the newest departure airport
1018
-	*
1019
-	* @return Array the spotter information
1020
-	*
1021
-	*/
1016
+	/**
1017
+	 * Gets all the spotter information sorted by the newest departure airport
1018
+	 *
1019
+	 * @return Array the spotter information
1020
+	 *
1021
+	 */
1022 1022
 	public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array())
1023 1023
 	{
1024 1024
 		global $global_query;
@@ -1060,11 +1060,11 @@  discard block
 block discarded – undo
1060 1060
 
1061 1061
 
1062 1062
 	/**
1063
-	* Gets all the spotter information sorted by the newest arrival airport
1064
-	*
1065
-	* @return Array the spotter information
1066
-	*
1067
-	*/
1063
+	 * Gets all the spotter information sorted by the newest arrival airport
1064
+	 *
1065
+	 * @return Array the spotter information
1066
+	 *
1067
+	 */
1068 1068
 	public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array())
1069 1069
 	{
1070 1070
 		global $global_query;
@@ -1103,11 +1103,11 @@  discard block
 block discarded – undo
1103 1103
 	
1104 1104
 
1105 1105
 	/**
1106
-	* Gets all the spotter information based on the spotter id
1107
-	*
1108
-	* @return Array the spotter information
1109
-	*
1110
-	*/
1106
+	 * Gets all the spotter information based on the spotter id
1107
+	 *
1108
+	 * @return Array the spotter information
1109
+	 *
1110
+	 */
1111 1111
 	public function getSpotterDataByID($id = '')
1112 1112
 	{
1113 1113
 		global $global_query;
@@ -1129,11 +1129,11 @@  discard block
 block discarded – undo
1129 1129
 	
1130 1130
 	
1131 1131
 	/**
1132
-	* Gets all the spotter information based on the callsign
1133
-	*
1134
-	* @return Array the spotter information
1135
-	*
1136
-	*/
1132
+	 * Gets all the spotter information based on the callsign
1133
+	 *
1134
+	 * @return Array the spotter information
1135
+	 *
1136
+	 */
1137 1137
 	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
1138 1138
 	{
1139 1139
 		global $global_query;
@@ -1186,11 +1186,11 @@  discard block
 block discarded – undo
1186 1186
 	
1187 1187
 	
1188 1188
 	/**
1189
-	* Gets all the spotter information based on the aircraft type
1190
-	*
1191
-	* @return Array the spotter information
1192
-	*
1193
-	*/
1189
+	 * Gets all the spotter information based on the aircraft type
1190
+	 *
1191
+	 * @return Array the spotter information
1192
+	 *
1193
+	 */
1194 1194
 	public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array())
1195 1195
 	{
1196 1196
 		global $global_query;
@@ -1244,11 +1244,11 @@  discard block
 block discarded – undo
1244 1244
 	
1245 1245
 	
1246 1246
 	/**
1247
-	* Gets all the spotter information based on the aircraft registration
1248
-	*
1249
-	* @return Array the spotter information
1250
-	*
1251
-	*/
1247
+	 * Gets all the spotter information based on the aircraft registration
1248
+	 *
1249
+	 * @return Array the spotter information
1250
+	 *
1251
+	 */
1252 1252
 	public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array())
1253 1253
 	{
1254 1254
 		global $global_query;
@@ -1304,11 +1304,11 @@  discard block
 block discarded – undo
1304 1304
 	
1305 1305
 	
1306 1306
 	/**
1307
-	* Gets all the spotter information based on the airline
1308
-	*
1309
-	* @return Array the spotter information
1310
-	*
1311
-	*/
1307
+	 * Gets all the spotter information based on the airline
1308
+	 *
1309
+	 * @return Array the spotter information
1310
+	 *
1311
+	 */
1312 1312
 	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '')
1313 1313
 	{
1314 1314
 		global $global_query;
@@ -1360,11 +1360,11 @@  discard block
 block discarded – undo
1360 1360
 	
1361 1361
 	
1362 1362
 	/**
1363
-	* Gets all the spotter information based on the airport
1364
-	*
1365
-	* @return Array the spotter information
1366
-	*
1367
-	*/
1363
+	 * Gets all the spotter information based on the airport
1364
+	 *
1365
+	 * @return Array the spotter information
1366
+	 *
1367
+	 */
1368 1368
 	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '')
1369 1369
 	{
1370 1370
 		global $global_query;
@@ -1417,11 +1417,11 @@  discard block
 block discarded – undo
1417 1417
 
1418 1418
 
1419 1419
 	/**
1420
-	* Gets all the spotter information based on the date
1421
-	*
1422
-	* @return Array the spotter information
1423
-	*
1424
-	*/
1420
+	 * Gets all the spotter information based on the date
1421
+	 *
1422
+	 * @return Array the spotter information
1423
+	 *
1424
+	 */
1425 1425
 	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1426 1426
 	{
1427 1427
 		global $global_query, $globalTimezone, $globalDBdriver;
@@ -1498,11 +1498,11 @@  discard block
 block discarded – undo
1498 1498
 
1499 1499
 
1500 1500
 	/**
1501
-	* Gets all the spotter information based on the country name
1502
-	*
1503
-	* @return Array the spotter information
1504
-	*
1505
-	*/
1501
+	 * Gets all the spotter information based on the country name
1502
+	 *
1503
+	 * @return Array the spotter information
1504
+	 *
1505
+	 */
1506 1506
 	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '')
1507 1507
 	{
1508 1508
 		global $global_query;
@@ -1555,11 +1555,11 @@  discard block
 block discarded – undo
1555 1555
 	
1556 1556
 	
1557 1557
 	/**
1558
-	* Gets all the spotter information based on the manufacturer name
1559
-	*
1560
-	* @return Array the spotter information
1561
-	*
1562
-	*/
1558
+	 * Gets all the spotter information based on the manufacturer name
1559
+	 *
1560
+	 * @return Array the spotter information
1561
+	 *
1562
+	 */
1563 1563
 	public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '')
1564 1564
 	{
1565 1565
 		global $global_query;
@@ -1614,13 +1614,13 @@  discard block
 block discarded – undo
1614 1614
   
1615 1615
   
1616 1616
 	/**
1617
-	* Gets a list of all aircraft that take a route
1618
-	*
1619
-	* @param String $departure_airport_icao ICAO code of departure airport
1620
-	* @param String $arrival_airport_icao ICAO code of arrival airport
1621
-	* @return Array the spotter information
1622
-	*
1623
-	*/
1617
+	 * Gets a list of all aircraft that take a route
1618
+	 *
1619
+	 * @param String $departure_airport_icao ICAO code of departure airport
1620
+	 * @param String $arrival_airport_icao ICAO code of arrival airport
1621
+	 * @return Array the spotter information
1622
+	 *
1623
+	 */
1624 1624
 	public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '')
1625 1625
 	{
1626 1626
 		global $global_query;
@@ -1686,11 +1686,11 @@  discard block
 block discarded – undo
1686 1686
 	
1687 1687
 	
1688 1688
 	/**
1689
-	* Gets all the spotter information based on the special column in the table
1690
-	*
1691
-	* @return Array the spotter information
1692
-	*
1693
-	*/
1689
+	 * Gets all the spotter information based on the special column in the table
1690
+	 *
1691
+	 * @return Array the spotter information
1692
+	 *
1693
+	 */
1694 1694
 	public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array())
1695 1695
 	{
1696 1696
 		global $global_query;
@@ -1729,11 +1729,11 @@  discard block
 block discarded – undo
1729 1729
 	}
1730 1730
 
1731 1731
 	/**
1732
-	* Gets all the highlight based on a aircraft registration
1733
-	*
1734
-	* @return String the highlight text
1735
-	*
1736
-	*/
1732
+	 * Gets all the highlight based on a aircraft registration
1733
+	 *
1734
+	 * @return String the highlight text
1735
+	 *
1736
+	 */
1737 1737
 	public function getHighlightByRegistration($registration,$filter = array())
1738 1738
 	{
1739 1739
 		global $global_query;
@@ -1755,13 +1755,13 @@  discard block
 block discarded – undo
1755 1755
 
1756 1756
 	
1757 1757
 	/**
1758
-	* Gets the squawk usage from squawk code
1759
-	*
1760
-	* @param String $squawk squawk code
1761
-	* @param String $country country
1762
-	* @return String usage
1763
-	*
1764
-	*/
1758
+	 * Gets the squawk usage from squawk code
1759
+	 *
1760
+	 * @param String $squawk squawk code
1761
+	 * @param String $country country
1762
+	 * @return String usage
1763
+	 *
1764
+	 */
1765 1765
 	public function getSquawkUsage($squawk = '',$country = 'FR')
1766 1766
 	{
1767 1767
 		
@@ -1782,12 +1782,12 @@  discard block
 block discarded – undo
1782 1782
 	}
1783 1783
 
1784 1784
 	/**
1785
-	* Gets the airport icao from the iata
1786
-	*
1787
-	* @param String $airport_iata the iata code of the airport
1788
-	* @return String airport iata
1789
-	*
1790
-	*/
1785
+	 * Gets the airport icao from the iata
1786
+	 *
1787
+	 * @param String $airport_iata the iata code of the airport
1788
+	 * @return String airport iata
1789
+	 *
1790
+	 */
1791 1791
 	public function getAirportIcao($airport_iata = '')
1792 1792
 	{
1793 1793
 		
@@ -1807,14 +1807,14 @@  discard block
 block discarded – undo
1807 1807
 	}
1808 1808
 
1809 1809
 	/**
1810
-	* Gets the airport distance
1811
-	*
1812
-	* @param String $airport_icao the icao code of the airport
1813
-	* @param Float $latitude the latitude
1814
-	* @param Float $longitude the longitude
1815
-	* @return Float distance to the airport
1816
-	*
1817
-	*/
1810
+	 * Gets the airport distance
1811
+	 *
1812
+	 * @param String $airport_icao the icao code of the airport
1813
+	 * @param Float $latitude the latitude
1814
+	 * @param Float $longitude the longitude
1815
+	 * @return Float distance to the airport
1816
+	 *
1817
+	 */
1818 1818
 	public function getAirportDistance($airport_icao,$latitude,$longitude)
1819 1819
 	{
1820 1820
 		
@@ -1835,12 +1835,12 @@  discard block
 block discarded – undo
1835 1835
 	}
1836 1836
 	
1837 1837
 	/**
1838
-	* Gets the airport info based on the icao
1839
-	*
1840
-	* @param String $airport the icao code of the airport
1841
-	* @return Array airport information
1842
-	*
1843
-	*/
1838
+	 * Gets the airport info based on the icao
1839
+	 *
1840
+	 * @param String $airport the icao code of the airport
1841
+	 * @return Array airport information
1842
+	 *
1843
+	 */
1844 1844
 	public function getAllAirportInfo($airport = '')
1845 1845
 	{
1846 1846
 		
@@ -1886,12 +1886,12 @@  discard block
 block discarded – undo
1886 1886
 	}
1887 1887
 	
1888 1888
 	/**
1889
-	* Gets the airport info based on the country
1890
-	*
1891
-	* @param Array $countries Airports countries
1892
-	* @return Array airport information
1893
-	*
1894
-	*/
1889
+	 * Gets the airport info based on the country
1890
+	 *
1891
+	 * @param Array $countries Airports countries
1892
+	 * @return Array airport information
1893
+	 *
1894
+	 */
1895 1895
 	public function getAllAirportInfobyCountry($countries)
1896 1896
 	{
1897 1897
 		$lst_countries = '';
@@ -1929,12 +1929,12 @@  discard block
 block discarded – undo
1929 1929
 	}
1930 1930
 	
1931 1931
 	/**
1932
-	* Gets airports info based on the coord
1933
-	*
1934
-	* @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1935
-	* @return Array airport information
1936
-	*
1937
-	*/
1932
+	 * Gets airports info based on the coord
1933
+	 *
1934
+	 * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1935
+	 * @return Array airport information
1936
+	 *
1937
+	 */
1938 1938
 	public function getAllAirportInfobyCoord($coord)
1939 1939
 	{
1940 1940
 		global $globalDBdriver;
@@ -1965,12 +1965,12 @@  discard block
 block discarded – undo
1965 1965
 	}
1966 1966
 
1967 1967
 	/**
1968
-	* Gets waypoints info based on the coord
1969
-	*
1970
-	* @param Array $coord waypoints coord
1971
-	* @return Array airport information
1972
-	*
1973
-	*/
1968
+	 * Gets waypoints info based on the coord
1969
+	 *
1970
+	 * @param Array $coord waypoints coord
1971
+	 * @return Array airport information
1972
+	 *
1973
+	 */
1974 1974
 	public function getAllWaypointsInfobyCoord($coord)
1975 1975
 	{
1976 1976
 		if (is_array($coord)) {
@@ -2004,12 +2004,12 @@  discard block
 block discarded – undo
2004 2004
 	
2005 2005
 	
2006 2006
 	/**
2007
-	* Gets the airline info based on the icao code or iata code
2008
-	*
2009
-	* @param String $airline_icao the iata code of the airport
2010
-	* @return Array airport information
2011
-	*
2012
-	*/
2007
+	 * Gets the airline info based on the icao code or iata code
2008
+	 *
2009
+	 * @param String $airline_icao the iata code of the airport
2010
+	 * @return Array airport information
2011
+	 *
2012
+	 */
2013 2013
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2014 2014
 	{
2015 2015
 		global $globalUseRealAirlines;
@@ -2040,7 +2040,7 @@  discard block
 block discarded – undo
2040 2040
 			} else {
2041 2041
 				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2042 2042
 			}
2043
-                        /*
2043
+						/*
2044 2044
 			$airline_array = array();
2045 2045
 			$temp_array = array();
2046 2046
 		
@@ -2072,12 +2072,12 @@  discard block
 block discarded – undo
2072 2072
 	
2073 2073
 	
2074 2074
 	/**
2075
-	* Gets the aircraft info based on the aircraft type
2076
-	*
2077
-	* @param String $aircraft_type the aircraft type
2078
-	* @return Array aircraft information
2079
-	*
2080
-	*/
2075
+	 * Gets the aircraft info based on the aircraft type
2076
+	 *
2077
+	 * @param String $aircraft_type the aircraft type
2078
+	 * @return Array aircraft information
2079
+	 *
2080
+	 */
2081 2081
 	public function getAllAircraftInfo($aircraft_type)
2082 2082
 	{
2083 2083
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2109,12 +2109,12 @@  discard block
 block discarded – undo
2109 2109
 	}
2110 2110
 
2111 2111
 	/**
2112
-	* Gets the aircraft icao based on the aircraft name/type
2113
-	*
2114
-	* @param String $aircraft_type the aircraft type
2115
-	* @return String aircraft information
2116
-	*
2117
-	*/
2112
+	 * Gets the aircraft icao based on the aircraft name/type
2113
+	 *
2114
+	 * @param String $aircraft_type the aircraft type
2115
+	 * @return String aircraft information
2116
+	 *
2117
+	 */
2118 2118
 	public function getAircraftIcao($aircraft_type)
2119 2119
 	{
2120 2120
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2139,12 +2139,12 @@  discard block
 block discarded – undo
2139 2139
 	}
2140 2140
 	
2141 2141
 	/**
2142
-	* Gets the aircraft info based on the aircraft ident
2143
-	*
2144
-	* @param String $aircraft_modes the aircraft ident (hex)
2145
-	* @return String aircraft type
2146
-	*
2147
-	*/
2142
+	 * Gets the aircraft info based on the aircraft ident
2143
+	 *
2144
+	 * @param String $aircraft_modes the aircraft ident (hex)
2145
+	 * @return String aircraft type
2146
+	 *
2147
+	 */
2148 2148
 	public function getAllAircraftType($aircraft_modes)
2149 2149
 	{
2150 2150
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -2162,12 +2162,12 @@  discard block
 block discarded – undo
2162 2162
 	}
2163 2163
 
2164 2164
 	/**
2165
-	* Gets correct aircraft operator corde
2166
-	*
2167
-	* @param String $operator the aircraft operator code (callsign)
2168
-	* @return String aircraft operator code
2169
-	*
2170
-	*/
2165
+	 * Gets correct aircraft operator corde
2166
+	 *
2167
+	 * @param String $operator the aircraft operator code (callsign)
2168
+	 * @return String aircraft operator code
2169
+	 *
2170
+	 */
2171 2171
 	public function getOperator($operator)
2172 2172
 	{
2173 2173
 		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
@@ -2184,16 +2184,16 @@  discard block
 block discarded – undo
2184 2184
 	}
2185 2185
 
2186 2186
 	/**
2187
-	* Gets the aircraft route based on the aircraft callsign
2188
-	*
2189
-	* @param String $callsign the aircraft callsign
2190
-	* @return Array aircraft type
2191
-	*
2192
-	*/
2187
+	 * Gets the aircraft route based on the aircraft callsign
2188
+	 *
2189
+	 * @param String $callsign the aircraft callsign
2190
+	 * @return Array aircraft type
2191
+	 *
2192
+	 */
2193 2193
 	public function getRouteInfo($callsign)
2194 2194
 	{
2195 2195
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2196
-                if ($callsign == '') return array();
2196
+				if ($callsign == '') return array();
2197 2197
 		$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";
2198 2198
 		
2199 2199
 		$sth = $this->db->prepare($query);
@@ -2207,12 +2207,12 @@  discard block
 block discarded – undo
2207 2207
 	}
2208 2208
 	
2209 2209
 	/**
2210
-	* Gets the aircraft info based on the aircraft registration
2211
-	*
2212
-	* @param String $registration the aircraft registration
2213
-	* @return Array aircraft information
2214
-	*
2215
-	*/
2210
+	 * Gets the aircraft info based on the aircraft registration
2211
+	 *
2212
+	 * @param String $registration the aircraft registration
2213
+	 * @return Array aircraft information
2214
+	 *
2215
+	 */
2216 2216
 	public function getAircraftInfoByRegistration($registration)
2217 2217
 	{
2218 2218
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2239,12 +2239,12 @@  discard block
 block discarded – undo
2239 2239
 	}
2240 2240
 	
2241 2241
 	/**
2242
-	* Gets the aircraft owner & base based on the aircraft registration
2243
-	*
2244
-	* @param String $registration the aircraft registration
2245
-	* @return Array aircraft information
2246
-	*
2247
-	*/
2242
+	 * Gets the aircraft owner & base based on the aircraft registration
2243
+	 *
2244
+	 * @param String $registration the aircraft registration
2245
+	 * @return Array aircraft information
2246
+	 *
2247
+	 */
2248 2248
 	public function getAircraftOwnerByRegistration($registration)
2249 2249
 	{
2250 2250
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2261,11 +2261,11 @@  discard block
 block discarded – undo
2261 2261
 	
2262 2262
   
2263 2263
   /**
2264
-	* Gets all flights (but with only little info)
2265
-	*
2266
-	* @return Array basic flight information
2267
-	*
2268
-	*/
2264
+   * Gets all flights (but with only little info)
2265
+   *
2266
+   * @return Array basic flight information
2267
+   *
2268
+   */
2269 2269
 	public function getAllFlightsforSitemap()
2270 2270
 	{
2271 2271
 		//$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 ";
@@ -2273,7 +2273,7 @@  discard block
 block discarded – undo
2273 2273
 		
2274 2274
 		$sth = $this->db->prepare($query);
2275 2275
 		$sth->execute();
2276
-                  /*
2276
+				  /*
2277 2277
 		$flight_array = array();
2278 2278
 		$temp_array = array();
2279 2279
 		
@@ -2295,11 +2295,11 @@  discard block
 block discarded – undo
2295 2295
 	}
2296 2296
   
2297 2297
 	/**
2298
-	* Gets a list of all aircraft manufacturers
2299
-	*
2300
-	* @return Array list of aircraft types
2301
-	*
2302
-	*/
2298
+	 * Gets a list of all aircraft manufacturers
2299
+	 *
2300
+	 * @return Array list of aircraft types
2301
+	 *
2302
+	 */
2303 2303
 	public function getAllManufacturers()
2304 2304
 	{
2305 2305
 		/*
@@ -2328,11 +2328,11 @@  discard block
 block discarded – undo
2328 2328
   
2329 2329
   
2330 2330
   /**
2331
-	* Gets a list of all aircraft types
2332
-	*
2333
-	* @return Array list of aircraft types
2334
-	*
2335
-	*/
2331
+   * Gets a list of all aircraft types
2332
+   *
2333
+   * @return Array list of aircraft types
2334
+   *
2335
+   */
2336 2336
 	public function getAllAircraftTypes($filters = array())
2337 2337
 	{
2338 2338
 		/*
@@ -2365,11 +2365,11 @@  discard block
 block discarded – undo
2365 2365
 	
2366 2366
 	
2367 2367
 	/**
2368
-	* Gets a list of all aircraft registrations
2369
-	*
2370
-	* @return Array list of aircraft registrations
2371
-	*
2372
-	*/
2368
+	 * Gets a list of all aircraft registrations
2369
+	 *
2370
+	 * @return Array list of aircraft registrations
2371
+	 *
2372
+	 */
2373 2373
 	public function getAllAircraftRegistrations($filters = array())
2374 2374
 	{
2375 2375
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2394,12 +2394,12 @@  discard block
 block discarded – undo
2394 2394
 	}
2395 2395
 
2396 2396
 	/**
2397
-	* Gets all source name
2398
-	*
2399
-	* @param String type format of source
2400
-	* @return Array list of source name
2401
-	*
2402
-	*/
2397
+	 * Gets all source name
2398
+	 *
2399
+	 * @param String type format of source
2400
+	 * @return Array list of source name
2401
+	 *
2402
+	 */
2403 2403
 	public function getAllSourceName($type = '',$filters = array())
2404 2404
 	{
2405 2405
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2430,11 +2430,11 @@  discard block
 block discarded – undo
2430 2430
 
2431 2431
 
2432 2432
 	/**
2433
-	* Gets a list of all airline names
2434
-	*
2435
-	* @return Array list of airline names
2436
-	*
2437
-	*/
2433
+	 * Gets a list of all airline names
2434
+	 *
2435
+	 * @return Array list of airline names
2436
+	 *
2437
+	 */
2438 2438
 	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2439 2439
 	{
2440 2440
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2484,11 +2484,11 @@  discard block
 block discarded – undo
2484 2484
 	
2485 2485
 	
2486 2486
 	/**
2487
-	* Gets a list of all airline countries
2488
-	*
2489
-	* @return Array list of airline countries
2490
-	*
2491
-	*/
2487
+	 * Gets a list of all airline countries
2488
+	 *
2489
+	 * @return Array list of airline countries
2490
+	 *
2491
+	 */
2492 2492
 	public function getAllAirlineCountries($filters = array())
2493 2493
 	{
2494 2494
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2516,11 +2516,11 @@  discard block
 block discarded – undo
2516 2516
 	
2517 2517
 	
2518 2518
 	/**
2519
-	* Gets a list of all departure & arrival names
2520
-	*
2521
-	* @return Array list of airport names
2522
-	*
2523
-	*/
2519
+	 * Gets a list of all departure & arrival names
2520
+	 *
2521
+	 * @return Array list of airport names
2522
+	 *
2523
+	 */
2524 2524
 	public function getAllAirportNames($filters = array())
2525 2525
 	{
2526 2526
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2569,11 +2569,11 @@  discard block
 block discarded – undo
2569 2569
 	
2570 2570
 	
2571 2571
 	/**
2572
-	* Gets a list of all departure & arrival airport countries
2573
-	*
2574
-	* @return Array list of airport countries
2575
-	*
2576
-	*/
2572
+	 * Gets a list of all departure & arrival airport countries
2573
+	 *
2574
+	 * @return Array list of airport countries
2575
+	 *
2576
+	 */
2577 2577
 	public function getAllAirportCountries($filters = array())
2578 2578
 	{
2579 2579
 		$airport_array = array();
@@ -2621,11 +2621,11 @@  discard block
 block discarded – undo
2621 2621
 	
2622 2622
 	
2623 2623
 	/**
2624
-	* Gets a list of all countries (airline, departure airport & arrival airport)
2625
-	*
2626
-	* @return Array list of countries
2627
-	*
2628
-	*/
2624
+	 * Gets a list of all countries (airline, departure airport & arrival airport)
2625
+	 *
2626
+	 * @return Array list of countries
2627
+	 *
2628
+	 */
2629 2629
 	public function getAllCountries($filters = array())
2630 2630
 	{
2631 2631
 		$Connection= new Connection($this->db);
@@ -2702,11 +2702,11 @@  discard block
 block discarded – undo
2702 2702
 	
2703 2703
 	
2704 2704
 	/**
2705
-	* Gets a list of all idents/callsigns
2706
-	*
2707
-	* @return Array list of ident/callsign names
2708
-	*
2709
-	*/
2705
+	 * Gets a list of all idents/callsigns
2706
+	 *
2707
+	 * @return Array list of ident/callsign names
2708
+	 *
2709
+	 */
2710 2710
 	public function getAllIdents($filters = array())
2711 2711
 	{
2712 2712
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2730,9 +2730,9 @@  discard block
 block discarded – undo
2730 2730
 	}
2731 2731
 
2732 2732
 	/**
2733
-	* Get a list of flights from airport since 7 days
2734
-	* @return Array number, icao, name and city of airports
2735
-	*/
2733
+	 * Get a list of flights from airport since 7 days
2734
+	 * @return Array number, icao, name and city of airports
2735
+	 */
2736 2736
 
2737 2737
 	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
2738 2738
 		global $globalTimezone, $globalDBdriver;
@@ -2763,9 +2763,9 @@  discard block
 block discarded – undo
2763 2763
 	}
2764 2764
 
2765 2765
 	/**
2766
-	* Get a list of flights from airport since 7 days
2767
-	* @return Array number, icao, name and city of airports
2768
-	*/
2766
+	 * Get a list of flights from airport since 7 days
2767
+	 * @return Array number, icao, name and city of airports
2768
+	 */
2769 2769
 
2770 2770
 	public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') {
2771 2771
 		global $globalTimezone, $globalDBdriver;
@@ -2795,9 +2795,9 @@  discard block
 block discarded – undo
2795 2795
 	}
2796 2796
 
2797 2797
 	/**
2798
-	* Get a list of flights from detected airport since 7 days
2799
-	* @return Array number, icao, name and city of airports
2800
-	*/
2798
+	 * Get a list of flights from detected airport since 7 days
2799
+	 * @return Array number, icao, name and city of airports
2800
+	 */
2801 2801
 
2802 2802
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
2803 2803
 		global $globalTimezone, $globalDBdriver;
@@ -2835,9 +2835,9 @@  discard block
 block discarded – undo
2835 2835
 	}
2836 2836
 
2837 2837
 	/**
2838
-	* Get a list of flights from detected airport since 7 days
2839
-	* @return Array number, icao, name and city of airports
2840
-	*/
2838
+	 * Get a list of flights from detected airport since 7 days
2839
+	 * @return Array number, icao, name and city of airports
2840
+	 */
2841 2841
 
2842 2842
 	public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') {
2843 2843
 		global $globalTimezone, $globalDBdriver;
@@ -2879,9 +2879,9 @@  discard block
 block discarded – undo
2879 2879
 
2880 2880
 
2881 2881
 	/**
2882
-	* Get a list of flights to airport since 7 days
2883
-	* @return Array number, icao, name and city of airports
2884
-	*/
2882
+	 * Get a list of flights to airport since 7 days
2883
+	 * @return Array number, icao, name and city of airports
2884
+	 */
2885 2885
 
2886 2886
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
2887 2887
 		global $globalTimezone, $globalDBdriver;
@@ -2914,9 +2914,9 @@  discard block
 block discarded – undo
2914 2914
 
2915 2915
 
2916 2916
 	/**
2917
-	* Get a list of flights detected to airport since 7 days
2918
-	* @return Array number, icao, name and city of airports
2919
-	*/
2917
+	 * Get a list of flights detected to airport since 7 days
2918
+	 * @return Array number, icao, name and city of airports
2919
+	 */
2920 2920
 
2921 2921
 	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
2922 2922
 		global $globalTimezone, $globalDBdriver;
@@ -2957,9 +2957,9 @@  discard block
 block discarded – undo
2957 2957
 
2958 2958
 
2959 2959
 	/**
2960
-	* Get a list of flights to airport since 7 days
2961
-	* @return Array number, icao, name and city of airports
2962
-	*/
2960
+	 * Get a list of flights to airport since 7 days
2961
+	 * @return Array number, icao, name and city of airports
2962
+	 */
2963 2963
 
2964 2964
 	public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') {
2965 2965
 		global $globalTimezone, $globalDBdriver;
@@ -2991,9 +2991,9 @@  discard block
 block discarded – undo
2991 2991
 
2992 2992
 
2993 2993
 	/**
2994
-	* Get a list of flights detected to airport since 7 days
2995
-	* @return Array number, icao, name and city of airports
2996
-	*/
2994
+	 * Get a list of flights detected to airport since 7 days
2995
+	 * @return Array number, icao, name and city of airports
2996
+	 */
2997 2997
 
2998 2998
 	public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') {
2999 2999
 		global $globalTimezone, $globalDBdriver;
@@ -3037,11 +3037,11 @@  discard block
 block discarded – undo
3037 3037
 
3038 3038
 
3039 3039
 	/**
3040
-	* Gets a list of all dates
3041
-	*
3042
-	* @return Array list of date names
3043
-	*
3044
-	*/
3040
+	 * Gets a list of all dates
3041
+	 *
3042
+	 * @return Array list of date names
3043
+	 *
3044
+	 */
3045 3045
 	public function getAllDates()
3046 3046
 	{
3047 3047
 		global $globalTimezone, $globalDBdriver;
@@ -3082,11 +3082,11 @@  discard block
 block discarded – undo
3082 3082
 	
3083 3083
 	
3084 3084
 	/**
3085
-	* Gets all route combinations
3086
-	*
3087
-	* @return Array the route list
3088
-	*
3089
-	*/
3085
+	 * Gets all route combinations
3086
+	 *
3087
+	 * @return Array the route list
3088
+	 *
3089
+	 */
3090 3090
 	public function getAllRoutes()
3091 3091
 	{
3092 3092
 		$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 
@@ -3112,13 +3112,13 @@  discard block
 block discarded – undo
3112 3112
 	}
3113 3113
 
3114 3114
 	/**
3115
-	* Update ident spotter data
3116
-	*
3117
-	* @param String $flightaware_id the ID from flightaware
3118
-	* @param String $ident the flight ident
3119
-	* @return String success or false
3120
-	*
3121
-	*/	
3115
+	 * Update ident spotter data
3116
+	 *
3117
+	 * @param String $flightaware_id the ID from flightaware
3118
+	 * @param String $ident the flight ident
3119
+	 * @return String success or false
3120
+	 *
3121
+	 */	
3122 3122
 	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3123 3123
 	{
3124 3124
 		if (!is_numeric(substr($ident, 0, 3)))
@@ -3139,14 +3139,14 @@  discard block
 block discarded – undo
3139 3139
 		} else {
3140 3140
 			$airline_array = $this->getAllAirlineInfo("NA");
3141 3141
 		}
3142
-                $airline_name = $airline_array[0]['name'];
3143
-                $airline_icao = $airline_array[0]['icao'];
3144
-                $airline_country = $airline_array[0]['country'];
3145
-                $airline_type = $airline_array[0]['type'];
3142
+				$airline_name = $airline_array[0]['name'];
3143
+				$airline_icao = $airline_array[0]['icao'];
3144
+				$airline_country = $airline_array[0]['country'];
3145
+				$airline_type = $airline_array[0]['type'];
3146 3146
 
3147 3147
 
3148 3148
 		$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';
3149
-                $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);
3149
+				$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);
3150 3150
 
3151 3151
 		try {
3152 3152
 			$sth = $this->db->prepare($query);
@@ -3159,19 +3159,19 @@  discard block
 block discarded – undo
3159 3159
 
3160 3160
 	}
3161 3161
 	/**
3162
-	* Update latest spotter data
3163
-	*
3164
-	* @param String $flightaware_id the ID from flightaware
3165
-	* @param String $ident the flight ident
3166
-	* @param String $arrival_airport_icao the arrival airport
3167
-	* @return String success or false
3168
-	*
3169
-	*/	
3162
+	 * Update latest spotter data
3163
+	 *
3164
+	 * @param String $flightaware_id the ID from flightaware
3165
+	 * @param String $ident the flight ident
3166
+	 * @param String $arrival_airport_icao the arrival airport
3167
+	 * @return String success or false
3168
+	 *
3169
+	 */	
3170 3170
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3171 3171
 	{
3172 3172
 		if ($groundspeed == '') $groundspeed = NULL;
3173 3173
 		$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';
3174
-                $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);
3174
+				$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);
3175 3175
 
3176 3176
 		try {
3177 3177
 			$sth = $this->db->prepare($query);
@@ -3185,32 +3185,32 @@  discard block
 block discarded – undo
3185 3185
 	}
3186 3186
 
3187 3187
 	/**
3188
-	* Adds a new spotter data
3189
-	*
3190
-	* @param String $flightaware_id the ID from flightaware
3191
-	* @param String $ident the flight ident
3192
-	* @param String $aircraft_icao the aircraft type
3193
-	* @param String $departure_airport_icao the departure airport
3194
-	* @param String $arrival_airport_icao the arrival airport
3195
-	* @param String $latitude latitude of flight
3196
-	* @param String $longitude latitude of flight
3197
-	* @param String $waypoints waypoints of flight
3198
-	* @param String $altitude altitude of flight
3199
-	* @param String $heading heading of flight
3200
-	* @param String $groundspeed speed of flight
3201
-	* @param String $date date of flight
3202
-	* @param String $departure_airport_time departure time of flight
3203
-	* @param String $arrival_airport_time arrival time of flight
3204
-	* @param String $squawk squawk code of flight
3205
-	* @param String $route_stop route stop of flight
3206
-	* @param String $highlight highlight or not
3207
-	* @param String $ModeS ModesS code of flight
3208
-	* @param String $registration registration code of flight
3209
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
3210
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
3211
-	* @param String $verticalrate vertival rate of flight
3212
-	* @return String success or false
3213
-	*/
3188
+	 * Adds a new spotter data
3189
+	 *
3190
+	 * @param String $flightaware_id the ID from flightaware
3191
+	 * @param String $ident the flight ident
3192
+	 * @param String $aircraft_icao the aircraft type
3193
+	 * @param String $departure_airport_icao the departure airport
3194
+	 * @param String $arrival_airport_icao the arrival airport
3195
+	 * @param String $latitude latitude of flight
3196
+	 * @param String $longitude latitude of flight
3197
+	 * @param String $waypoints waypoints of flight
3198
+	 * @param String $altitude altitude of flight
3199
+	 * @param String $heading heading of flight
3200
+	 * @param String $groundspeed speed of flight
3201
+	 * @param String $date date of flight
3202
+	 * @param String $departure_airport_time departure time of flight
3203
+	 * @param String $arrival_airport_time arrival time of flight
3204
+	 * @param String $squawk squawk code of flight
3205
+	 * @param String $route_stop route stop of flight
3206
+	 * @param String $highlight highlight or not
3207
+	 * @param String $ModeS ModesS code of flight
3208
+	 * @param String $registration registration code of flight
3209
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
3210
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
3211
+	 * @param String $verticalrate vertival rate of flight
3212
+	 * @return String success or false
3213
+	 */
3214 3214
 	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 = '')
3215 3215
 	{
3216 3216
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
@@ -3424,8 +3424,8 @@  discard block
 block discarded – undo
3424 3424
     
3425 3425
 		if ($globalIVAO && $aircraft_icao != '')
3426 3426
 		{
3427
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3428
-            		else $airline_icao = '';
3427
+					if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3428
+					else $airline_icao = '';
3429 3429
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3430 3430
 			if (!isset($image_array[0]['registration']))
3431 3431
 			{
@@ -3456,48 +3456,48 @@  discard block
 block discarded – undo
3456 3456
 	
3457 3457
 		if (count($airline_array) == 0) 
3458 3458
 		{
3459
-                        $airline_array = $this->getAllAirlineInfo('NA');
3460
-                }
3461
-                if (count($aircraft_array) == 0) 
3462
-                {
3463
-                        $aircraft_array = $this->getAllAircraftInfo('NA');
3464
-                }
3465
-                if (count($departure_airport_array) == 0) 
3466
-                {
3467
-                        $departure_airport_array = $this->getAllAirportInfo('NA');
3468
-                }
3469
-                if (count($arrival_airport_array) == 0) 
3470
-                {
3471
-                        $arrival_airport_array = $this->getAllAirportInfo('NA');
3472
-                }
3473
-                if ($registration == '') $registration = 'NA';
3474
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3475
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3476
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3477
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3478
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3479
-                $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) 
3459
+						$airline_array = $this->getAllAirlineInfo('NA');
3460
+				}
3461
+				if (count($aircraft_array) == 0) 
3462
+				{
3463
+						$aircraft_array = $this->getAllAircraftInfo('NA');
3464
+				}
3465
+				if (count($departure_airport_array) == 0) 
3466
+				{
3467
+						$departure_airport_array = $this->getAllAirportInfo('NA');
3468
+				}
3469
+				if (count($arrival_airport_array) == 0) 
3470
+				{
3471
+						$arrival_airport_array = $this->getAllAirportInfo('NA');
3472
+				}
3473
+				if ($registration == '') $registration = 'NA';
3474
+				if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3475
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3476
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3477
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3478
+				if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3479
+				$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) 
3480 3480
                 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)";
3481 3481
 
3482
-                $airline_name = $airline_array[0]['name'];
3483
-                $airline_icao = $airline_array[0]['icao'];
3484
-                $airline_country = $airline_array[0]['country'];
3485
-                $airline_type = $airline_array[0]['type'];
3482
+				$airline_name = $airline_array[0]['name'];
3483
+				$airline_icao = $airline_array[0]['icao'];
3484
+				$airline_country = $airline_array[0]['country'];
3485
+				$airline_type = $airline_array[0]['type'];
3486 3486
 		if ($airline_type == '') {
3487 3487
 			$timeelapsed = microtime(true);
3488 3488
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3489 3489
 			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3490 3490
 		}
3491 3491
 		if ($airline_type == null) $airline_type = '';
3492
-                $aircraft_type = $aircraft_array[0]['type'];
3493
-                $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3494
-                $departure_airport_name = $departure_airport_array[0]['name'];
3495
-                $departure_airport_city = $departure_airport_array[0]['city'];
3496
-                $departure_airport_country = $departure_airport_array[0]['country'];
3497
-                $arrival_airport_name = $arrival_airport_array[0]['name'];
3498
-                $arrival_airport_city = $arrival_airport_array[0]['city'];
3499
-                $arrival_airport_country = $arrival_airport_array[0]['country'];
3500
-                $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);
3492
+				$aircraft_type = $aircraft_array[0]['type'];
3493
+				$aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3494
+				$departure_airport_name = $departure_airport_array[0]['name'];
3495
+				$departure_airport_city = $departure_airport_array[0]['city'];
3496
+				$departure_airport_country = $departure_airport_array[0]['country'];
3497
+				$arrival_airport_name = $arrival_airport_array[0]['name'];
3498
+				$arrival_airport_city = $arrival_airport_array[0]['city'];
3499
+				$arrival_airport_country = $arrival_airport_array[0]['country'];
3500
+				$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);
3501 3501
 
3502 3502
 		try {
3503 3503
 		        
@@ -3505,7 +3505,7 @@  discard block
 block discarded – undo
3505 3505
 			$sth->execute($query_values);
3506 3506
 			$this->db = null;
3507 3507
 		} catch (PDOException $e) {
3508
-		    return "error : ".$e->getMessage();
3508
+			return "error : ".$e->getMessage();
3509 3509
 		}
3510 3510
 		
3511 3511
 		return "success";
@@ -3514,11 +3514,11 @@  discard block
 block discarded – undo
3514 3514
 	
3515 3515
   
3516 3516
 	/**
3517
-	* Gets the aircraft ident within the last hour
3518
-	*
3519
-	* @return String the ident
3520
-	*
3521
-	*/
3517
+	 * Gets the aircraft ident within the last hour
3518
+	 *
3519
+	 * @return String the ident
3520
+	 *
3521
+	 */
3522 3522
 	public function getIdentFromLastHour($ident)
3523 3523
 	{
3524 3524
 		global $globalDBdriver, $globalTimezone;
@@ -3534,11 +3534,11 @@  discard block
 block discarded – undo
3534 3534
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3535 3535
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
3536 3536
 			$query_data = array(':ident' => $ident);
3537
-    		}
3537
+			}
3538 3538
 		
3539 3539
 		$sth = $this->db->prepare($query);
3540 3540
 		$sth->execute($query_data);
3541
-    		$ident_result='';
3541
+			$ident_result='';
3542 3542
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3543 3543
 		{
3544 3544
 			$ident_result = $row['ident'];
@@ -3549,11 +3549,11 @@  discard block
 block discarded – undo
3549 3549
 	
3550 3550
 	
3551 3551
 	/**
3552
-	* Gets the aircraft data from the last 20 seconds
3553
-	*
3554
-	* @return Array the spotter data
3555
-	*
3556
-	*/
3552
+	 * Gets the aircraft data from the last 20 seconds
3553
+	 *
3554
+	 * @return Array the spotter data
3555
+	 *
3556
+	 */
3557 3557
 	public function getRealTimeData($q = '')
3558 3558
 	{
3559 3559
 		global $globalDBdriver;
@@ -3597,11 +3597,11 @@  discard block
 block discarded – undo
3597 3597
 	
3598 3598
 	
3599 3599
 	 /**
3600
-	* Gets all airlines that have flown over
3601
-	*
3602
-	* @return Array the airline list
3603
-	*
3604
-	*/
3600
+	  * Gets all airlines that have flown over
3601
+	  *
3602
+	  * @return Array the airline list
3603
+	  *
3604
+	  */
3605 3605
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3606 3606
 	{
3607 3607
 		global $globalDBdriver;
@@ -3615,7 +3615,7 @@  discard block
 block discarded – undo
3615 3615
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3616 3616
 			}
3617 3617
 		}
3618
-                if ($sincedate != '') {
3618
+				if ($sincedate != '') {
3619 3619
 			if ($globalDBdriver == 'mysql') {
3620 3620
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3621 3621
 			} else {
@@ -3642,26 +3642,26 @@  discard block
 block discarded – undo
3642 3642
 	}
3643 3643
 
3644 3644
 	 /**
3645
-	* Gets all pilots that have flown over
3646
-	*
3647
-	* @return Array the pilots list
3648
-	*
3649
-	*/
3645
+	  * Gets all pilots that have flown over
3646
+	  *
3647
+	  * @return Array the pilots list
3648
+	  *
3649
+	  */
3650 3650
 	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3651 3651
 	{
3652 3652
 		global $globalDBdriver;
3653 3653
 		$filter_query = $this->getFilter($filters,true,true);
3654 3654
 		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3655 3655
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3656
-                if ($olderthanmonths > 0) {
3657
-            		if ($globalDBdriver == 'mysql') {
3656
+				if ($olderthanmonths > 0) {
3657
+					if ($globalDBdriver == 'mysql') {
3658 3658
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3659 3659
 			} else {
3660 3660
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3661 3661
 			}
3662 3662
 		}
3663
-                if ($sincedate != '') {
3664
-            		if ($globalDBdriver == 'mysql') {
3663
+				if ($sincedate != '') {
3664
+					if ($globalDBdriver == 'mysql') {
3665 3665
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3666 3666
 			} else {
3667 3667
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3688,25 +3688,25 @@  discard block
 block discarded – undo
3688 3688
 	}
3689 3689
 	
3690 3690
 		 /**
3691
-	* Gets all pilots that have flown over
3692
-	*
3693
-	* @return Array the pilots list
3694
-	*
3695
-	*/
3691
+		  * Gets all pilots that have flown over
3692
+		  *
3693
+		  * @return Array the pilots list
3694
+		  *
3695
+		  */
3696 3696
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3697 3697
 	{
3698 3698
 		global $globalDBdriver;
3699 3699
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3700 3700
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
3701
-                if ($olderthanmonths > 0) {
3702
-            		if ($globalDBdriver == 'mysql') {
3701
+				if ($olderthanmonths > 0) {
3702
+					if ($globalDBdriver == 'mysql') {
3703 3703
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3704 3704
 			} else {
3705 3705
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3706 3706
 			}
3707 3707
 		}
3708
-                if ($sincedate != '') {
3709
-            		if ($globalDBdriver == 'mysql') {
3708
+				if ($sincedate != '') {
3709
+					if ($globalDBdriver == 'mysql') {
3710 3710
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3711 3711
 			} else {
3712 3712
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3734,26 +3734,26 @@  discard block
 block discarded – undo
3734 3734
 	}
3735 3735
 	
3736 3736
 	 /**
3737
-	* Gets all owner that have flown over
3738
-	*
3739
-	* @return Array the pilots list
3740
-	*
3741
-	*/
3737
+	  * Gets all owner that have flown over
3738
+	  *
3739
+	  * @return Array the pilots list
3740
+	  *
3741
+	  */
3742 3742
 	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3743 3743
 	{
3744 3744
 		global $globalDBdriver;
3745 3745
 		$filter_query = $this->getFilter($filters,true,true);
3746 3746
 		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3747 3747
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3748
-                if ($olderthanmonths > 0) {
3749
-            		if ($globalDBdriver == 'mysql') {
3748
+				if ($olderthanmonths > 0) {
3749
+					if ($globalDBdriver == 'mysql') {
3750 3750
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3751 3751
 			} else {
3752 3752
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3753 3753
 			}
3754 3754
 		}
3755
-                if ($sincedate != '') {
3756
-            		if ($globalDBdriver == 'mysql') {
3755
+				if ($sincedate != '') {
3756
+					if ($globalDBdriver == 'mysql') {
3757 3757
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3758 3758
 			} else {
3759 3759
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3779,26 +3779,26 @@  discard block
 block discarded – undo
3779 3779
 	}
3780 3780
 	
3781 3781
 	 /**
3782
-	* Gets all owner that have flown over
3783
-	*
3784
-	* @return Array the pilots list
3785
-	*
3786
-	*/
3782
+	  * Gets all owner that have flown over
3783
+	  *
3784
+	  * @return Array the pilots list
3785
+	  *
3786
+	  */
3787 3787
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3788 3788
 	{
3789 3789
 		global $globalDBdriver;
3790 3790
 		$filter_query = $this->getFilter($filters,true,true);
3791 3791
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3792 3792
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3793
-                if ($olderthanmonths > 0) {
3794
-            		if ($globalDBdriver == 'mysql') {
3793
+				if ($olderthanmonths > 0) {
3794
+					if ($globalDBdriver == 'mysql') {
3795 3795
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3796 3796
 			} else {
3797 3797
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3798 3798
 			}
3799 3799
 		}
3800
-                if ($sincedate != '') {
3801
-            		if ($globalDBdriver == 'mysql') {
3800
+				if ($sincedate != '') {
3801
+					if ($globalDBdriver == 'mysql') {
3802 3802
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3803 3803
 			} else {
3804 3804
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3825,11 +3825,11 @@  discard block
 block discarded – undo
3825 3825
 	}
3826 3826
 
3827 3827
 	/**
3828
-	* Gets all airlines that have flown over by aircraft
3829
-	*
3830
-	* @return Array the airline list
3831
-	*
3832
-	*/
3828
+	 * Gets all airlines that have flown over by aircraft
3829
+	 *
3830
+	 * @return Array the airline list
3831
+	 *
3832
+	 */
3833 3833
 	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
3834 3834
 	{
3835 3835
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3861,11 +3861,11 @@  discard block
 block discarded – undo
3861 3861
 
3862 3862
 
3863 3863
 	/**
3864
-	* Gets all airline countries that have flown over by aircraft
3865
-	*
3866
-	* @return Array the airline country list
3867
-	*
3868
-	*/
3864
+	 * Gets all airline countries that have flown over by aircraft
3865
+	 *
3866
+	 * @return Array the airline country list
3867
+	 *
3868
+	 */
3869 3869
 	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
3870 3870
 	{
3871 3871
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3897,11 +3897,11 @@  discard block
 block discarded – undo
3897 3897
 	
3898 3898
 	
3899 3899
 	/**
3900
-	* Gets all airlines that have flown over by airport
3901
-	*
3902
-	* @return Array the airline list
3903
-	*
3904
-	*/
3900
+	 * Gets all airlines that have flown over by airport
3901
+	 *
3902
+	 * @return Array the airline list
3903
+	 *
3904
+	 */
3905 3905
 	public function countAllAirlinesByAirport($airport_icao,$filters = array())
3906 3906
 	{
3907 3907
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -3932,11 +3932,11 @@  discard block
 block discarded – undo
3932 3932
 
3933 3933
 
3934 3934
 	/**
3935
-	* Gets all airline countries that have flown over by airport icao
3936
-	*
3937
-	* @return Array the airline country list
3938
-	*
3939
-	*/
3935
+	 * Gets all airline countries that have flown over by airport icao
3936
+	 *
3937
+	 * @return Array the airline country list
3938
+	 *
3939
+	 */
3940 3940
 	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
3941 3941
 	{
3942 3942
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -3966,11 +3966,11 @@  discard block
 block discarded – undo
3966 3966
 
3967 3967
 
3968 3968
 	/**
3969
-	* Gets all airlines that have flown over by aircraft manufacturer
3970
-	*
3971
-	* @return Array the airline list
3972
-	*
3973
-	*/
3969
+	 * Gets all airlines that have flown over by aircraft manufacturer
3970
+	 *
3971
+	 * @return Array the airline list
3972
+	 *
3973
+	 */
3974 3974
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
3975 3975
 	{
3976 3976
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4001,11 +4001,11 @@  discard block
 block discarded – undo
4001 4001
 
4002 4002
 
4003 4003
 	/**
4004
-	* Gets all airline countries that have flown over by aircraft manufacturer
4005
-	*
4006
-	* @return Array the airline country list
4007
-	*
4008
-	*/
4004
+	 * Gets all airline countries that have flown over by aircraft manufacturer
4005
+	 *
4006
+	 * @return Array the airline country list
4007
+	 *
4008
+	 */
4009 4009
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4010 4010
 	{
4011 4011
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4034,11 +4034,11 @@  discard block
 block discarded – undo
4034 4034
 
4035 4035
 
4036 4036
 	/**
4037
-	* Gets all airlines that have flown over by date
4038
-	*
4039
-	* @return Array the airline list
4040
-	*
4041
-	*/
4037
+	 * Gets all airlines that have flown over by date
4038
+	 *
4039
+	 * @return Array the airline list
4040
+	 *
4041
+	 */
4042 4042
 	public function countAllAirlinesByDate($date,$filters = array())
4043 4043
 	{
4044 4044
 		global $globalTimezone, $globalDBdriver;
@@ -4082,11 +4082,11 @@  discard block
 block discarded – undo
4082 4082
 	
4083 4083
 	
4084 4084
 	/**
4085
-	* Gets all airline countries that have flown over by date
4086
-	*
4087
-	* @return Array the airline country list
4088
-	*
4089
-	*/
4085
+	 * Gets all airline countries that have flown over by date
4086
+	 *
4087
+	 * @return Array the airline country list
4088
+	 *
4089
+	 */
4090 4090
 	public function countAllAirlineCountriesByDate($date,$filters = array())
4091 4091
 	{
4092 4092
 		global $globalTimezone, $globalDBdriver;
@@ -4129,11 +4129,11 @@  discard block
 block discarded – undo
4129 4129
 
4130 4130
 
4131 4131
 	/**
4132
-	* Gets all airlines that have flown over by ident/callsign
4133
-	*
4134
-	* @return Array the airline list
4135
-	*
4136
-	*/
4132
+	 * Gets all airlines that have flown over by ident/callsign
4133
+	 *
4134
+	 * @return Array the airline list
4135
+	 *
4136
+	 */
4137 4137
 	public function countAllAirlinesByIdent($ident,$filters = array())
4138 4138
 	{
4139 4139
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4163,11 +4163,11 @@  discard block
 block discarded – undo
4163 4163
 	}
4164 4164
 
4165 4165
 	/**
4166
-	* Gets all airlines that have flown over by route
4167
-	*
4168
-	* @return Array the airline list
4169
-	*
4170
-	*/
4166
+	 * Gets all airlines that have flown over by route
4167
+	 *
4168
+	 * @return Array the airline list
4169
+	 *
4170
+	 */
4171 4171
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4172 4172
 	{
4173 4173
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4199,11 +4199,11 @@  discard block
 block discarded – undo
4199 4199
 	}
4200 4200
 
4201 4201
 	/**
4202
-	* Gets all airline countries that have flown over by route
4203
-	*
4204
-	* @return Array the airline country list
4205
-	*
4206
-	*/
4202
+	 * Gets all airline countries that have flown over by route
4203
+	 *
4204
+	 * @return Array the airline country list
4205
+	 *
4206
+	 */
4207 4207
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4208 4208
 	{
4209 4209
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4235,11 +4235,11 @@  discard block
 block discarded – undo
4235 4235
 
4236 4236
 
4237 4237
 	/**
4238
-	* Gets all airlines that have flown over by country
4239
-	*
4240
-	* @return Array the airline list
4241
-	*
4242
-	*/
4238
+	 * Gets all airlines that have flown over by country
4239
+	 *
4240
+	 * @return Array the airline list
4241
+	 *
4242
+	 */
4243 4243
 	public function countAllAirlinesByCountry($country,$filters = array())
4244 4244
 	{
4245 4245
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4269,11 +4269,11 @@  discard block
 block discarded – undo
4269 4269
 
4270 4270
 
4271 4271
 	/**
4272
-	* Gets all airline countries that have flown over by country
4273
-	*
4274
-	* @return Array the airline country list
4275
-	*
4276
-	*/
4272
+	 * Gets all airline countries that have flown over by country
4273
+	 *
4274
+	 * @return Array the airline country list
4275
+	 *
4276
+	 */
4277 4277
 	public function countAllAirlineCountriesByCountry($country,$filters = array())
4278 4278
 	{
4279 4279
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4302,11 +4302,11 @@  discard block
 block discarded – undo
4302 4302
 
4303 4303
 
4304 4304
 	/**
4305
-	* Gets all airlines countries
4306
-	*
4307
-	* @return Array the airline country list
4308
-	*
4309
-	*/
4305
+	 * Gets all airlines countries
4306
+	 *
4307
+	 * @return Array the airline country list
4308
+	 *
4309
+	 */
4310 4310
 	public function countAllAirlineCountries($limit = true, $filters = array())
4311 4311
 	{
4312 4312
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4332,11 +4332,11 @@  discard block
 block discarded – undo
4332 4332
 	}
4333 4333
 
4334 4334
 	/**
4335
-	* Gets all number of flight over countries
4336
-	*
4337
-	* @return Array the airline country list
4338
-	*
4339
-	*/
4335
+	 * Gets all number of flight over countries
4336
+	 *
4337
+	 * @return Array the airline country list
4338
+	 *
4339
+	 */
4340 4340
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
4341 4341
 	{
4342 4342
 		global $globalDBdriver;
@@ -4351,15 +4351,15 @@  discard block
 block discarded – undo
4351 4351
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
4352 4352
 					FROM countries c, spotter_live s
4353 4353
 					WHERE c.iso2 = s.over_country ";
4354
-                if ($olderthanmonths > 0) {
4354
+				if ($olderthanmonths > 0) {
4355 4355
 			if ($globalDBdriver == 'mysql') {
4356 4356
 				$query .= 'AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
4357 4357
 			} else {
4358 4358
 				$query .= "AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4359 4359
 			}
4360 4360
 		}
4361
-                if ($sincedate != '') {
4362
-            		if ($globalDBdriver == 'mysql') {
4361
+				if ($sincedate != '') {
4362
+					if ($globalDBdriver == 'mysql') {
4363 4363
 				$query .= "AND spotter_live.date > '".$sincedate."' ";
4364 4364
 			} else {
4365 4365
 				$query .= "AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4389,11 +4389,11 @@  discard block
 block discarded – undo
4389 4389
 	
4390 4390
 	
4391 4391
 	/**
4392
-	* Gets all aircraft types that have flown over
4393
-	*
4394
-	* @return Array the aircraft list
4395
-	*
4396
-	*/
4392
+	 * Gets all aircraft types that have flown over
4393
+	 *
4394
+	 * @return Array the aircraft list
4395
+	 *
4396
+	 */
4397 4397
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4398 4398
 	{
4399 4399
 		global $globalDBdriver;
@@ -4436,11 +4436,11 @@  discard block
 block discarded – undo
4436 4436
 	}
4437 4437
 
4438 4438
 	/**
4439
-	* Gets all aircraft types that have flown over by airline
4440
-	*
4441
-	* @return Array the aircraft list
4442
-	*
4443
-	*/
4439
+	 * Gets all aircraft types that have flown over by airline
4440
+	 *
4441
+	 * @return Array the aircraft list
4442
+	 *
4443
+	 */
4444 4444
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4445 4445
 	{
4446 4446
 		global $globalDBdriver;
@@ -4484,11 +4484,11 @@  discard block
 block discarded – undo
4484 4484
 
4485 4485
 
4486 4486
 	/**
4487
-	* Gets all aircraft registration that have flown over by aircaft icao
4488
-	*
4489
-	* @return Array the aircraft list
4490
-	*
4491
-	*/
4487
+	 * Gets all aircraft registration that have flown over by aircaft icao
4488
+	 *
4489
+	 * @return Array the aircraft list
4490
+	 *
4491
+	 */
4492 4492
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
4493 4493
 	{
4494 4494
 		$Image = new Image($this->db);
@@ -4527,11 +4527,11 @@  discard block
 block discarded – undo
4527 4527
 
4528 4528
 
4529 4529
 	/**
4530
-	* Gets all aircraft types that have flown over by airline icao
4531
-	*
4532
-	* @return Array the aircraft list
4533
-	*
4534
-	*/
4530
+	 * Gets all aircraft types that have flown over by airline icao
4531
+	 *
4532
+	 * @return Array the aircraft list
4533
+	 *
4534
+	 */
4535 4535
 	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
4536 4536
 	{
4537 4537
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4560,11 +4560,11 @@  discard block
 block discarded – undo
4560 4560
 
4561 4561
 
4562 4562
 	/**
4563
-	* Gets all aircraft registration that have flown over by airline icao
4564
-	*
4565
-	* @return Array the aircraft list
4566
-	*
4567
-	*/
4563
+	 * Gets all aircraft registration that have flown over by airline icao
4564
+	 *
4565
+	 * @return Array the aircraft list
4566
+	 *
4567
+	 */
4568 4568
 	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
4569 4569
 	{
4570 4570
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4602,11 +4602,11 @@  discard block
 block discarded – undo
4602 4602
 
4603 4603
 
4604 4604
 	/**
4605
-	* Gets all aircraft manufacturer that have flown over by airline icao
4606
-	*
4607
-	* @return Array the aircraft list
4608
-	*
4609
-	*/
4605
+	 * Gets all aircraft manufacturer that have flown over by airline icao
4606
+	 *
4607
+	 * @return Array the aircraft list
4608
+	 *
4609
+	 */
4610 4610
 	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
4611 4611
 	{
4612 4612
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4634,11 +4634,11 @@  discard block
 block discarded – undo
4634 4634
 
4635 4635
 
4636 4636
 	/**
4637
-	* Gets all aircraft types that have flown over by airline icao
4638
-	*
4639
-	* @return Array the aircraft list
4640
-	*
4641
-	*/
4637
+	 * Gets all aircraft types that have flown over by airline icao
4638
+	 *
4639
+	 * @return Array the aircraft list
4640
+	 *
4641
+	 */
4642 4642
 	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
4643 4643
 	{
4644 4644
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4667,11 +4667,11 @@  discard block
 block discarded – undo
4667 4667
 
4668 4668
 
4669 4669
 	/**
4670
-	* Gets all aircraft registration that have flown over by airport icao
4671
-	*
4672
-	* @return Array the aircraft list
4673
-	*
4674
-	*/
4670
+	 * Gets all aircraft registration that have flown over by airport icao
4671
+	 *
4672
+	 * @return Array the aircraft list
4673
+	 *
4674
+	 */
4675 4675
 	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
4676 4676
 	{
4677 4677
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4709,11 +4709,11 @@  discard block
 block discarded – undo
4709 4709
 	
4710 4710
 	
4711 4711
 	/**
4712
-	* Gets all aircraft manufacturer that have flown over by airport icao
4713
-	*
4714
-	* @return Array the aircraft list
4715
-	*
4716
-	*/
4712
+	 * Gets all aircraft manufacturer that have flown over by airport icao
4713
+	 *
4714
+	 * @return Array the aircraft list
4715
+	 *
4716
+	 */
4717 4717
 	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
4718 4718
 	{
4719 4719
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4739,11 +4739,11 @@  discard block
 block discarded – undo
4739 4739
 	}
4740 4740
 
4741 4741
 	/**
4742
-	* Gets all aircraft types that have flown over by aircraft manufacturer
4743
-	*
4744
-	* @return Array the aircraft list
4745
-	*
4746
-	*/
4742
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
4743
+	 *
4744
+	 * @return Array the aircraft list
4745
+	 *
4746
+	 */
4747 4747
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
4748 4748
 	{
4749 4749
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4770,11 +4770,11 @@  discard block
 block discarded – undo
4770 4770
 
4771 4771
 
4772 4772
 	/**
4773
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
4774
-	*
4775
-	* @return Array the aircraft list
4776
-	*
4777
-	*/
4773
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
4774
+	 *
4775
+	 * @return Array the aircraft list
4776
+	 *
4777
+	 */
4778 4778
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
4779 4779
 	{
4780 4780
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4810,11 +4810,11 @@  discard block
 block discarded – undo
4810 4810
 	}
4811 4811
 
4812 4812
 	/**
4813
-	* Gets all aircraft types that have flown over by date
4814
-	*
4815
-	* @return Array the aircraft list
4816
-	*
4817
-	*/
4813
+	 * Gets all aircraft types that have flown over by date
4814
+	 *
4815
+	 * @return Array the aircraft list
4816
+	 *
4817
+	 */
4818 4818
 	public function countAllAircraftTypesByDate($date,$filters = array())
4819 4819
 	{
4820 4820
 		global $globalTimezone, $globalDBdriver;
@@ -4856,11 +4856,11 @@  discard block
 block discarded – undo
4856 4856
 
4857 4857
 
4858 4858
 	/**
4859
-	* Gets all aircraft registration that have flown over by date
4860
-	*
4861
-	* @return Array the aircraft list
4862
-	*
4863
-	*/
4859
+	 * Gets all aircraft registration that have flown over by date
4860
+	 *
4861
+	 * @return Array the aircraft list
4862
+	 *
4863
+	 */
4864 4864
 	public function countAllAircraftRegistrationByDate($date,$filters = array())
4865 4865
 	{
4866 4866
 		global $globalTimezone, $globalDBdriver;
@@ -4911,11 +4911,11 @@  discard block
 block discarded – undo
4911 4911
 
4912 4912
 
4913 4913
 	/**
4914
-	* Gets all aircraft manufacturer that have flown over by date
4915
-	*
4916
-	* @return Array the aircraft manufacturer list
4917
-	*
4918
-	*/
4914
+	 * Gets all aircraft manufacturer that have flown over by date
4915
+	 *
4916
+	 * @return Array the aircraft manufacturer list
4917
+	 *
4918
+	 */
4919 4919
 	public function countAllAircraftManufacturerByDate($date,$filters = array())
4920 4920
 	{
4921 4921
 		global $globalTimezone, $globalDBdriver;
@@ -4957,11 +4957,11 @@  discard block
 block discarded – undo
4957 4957
 
4958 4958
 
4959 4959
 	/**
4960
-	* Gets all aircraft types that have flown over by ident/callsign
4961
-	*
4962
-	* @return Array the aircraft list
4963
-	*
4964
-	*/
4960
+	 * Gets all aircraft types that have flown over by ident/callsign
4961
+	 *
4962
+	 * @return Array the aircraft list
4963
+	 *
4964
+	 */
4965 4965
 	public function countAllAircraftTypesByIdent($ident,$filters = array())
4966 4966
 	{
4967 4967
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4990,11 +4990,11 @@  discard block
 block discarded – undo
4990 4990
 
4991 4991
 
4992 4992
 	/**
4993
-	* Gets all aircraft registration that have flown over by ident/callsign
4994
-	*
4995
-	* @return Array the aircraft list
4996
-	*
4997
-	*/
4993
+	 * Gets all aircraft registration that have flown over by ident/callsign
4994
+	 *
4995
+	 * @return Array the aircraft list
4996
+	 *
4997
+	 */
4998 4998
 	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
4999 4999
 	{
5000 5000
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5034,11 +5034,11 @@  discard block
 block discarded – undo
5034 5034
 
5035 5035
 
5036 5036
 	/**
5037
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
5038
-	*
5039
-	* @return Array the aircraft manufacturer list
5040
-	*
5041
-	*/
5037
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
5038
+	 *
5039
+	 * @return Array the aircraft manufacturer list
5040
+	 *
5041
+	 */
5042 5042
 	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5043 5043
 	{
5044 5044
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5064,11 +5064,11 @@  discard block
 block discarded – undo
5064 5064
 
5065 5065
 
5066 5066
 	/**
5067
-	* Gets all aircraft types that have flown over by route
5068
-	*
5069
-	* @return Array the aircraft list
5070
-	*
5071
-	*/
5067
+	 * Gets all aircraft types that have flown over by route
5068
+	 *
5069
+	 * @return Array the aircraft list
5070
+	 *
5071
+	 */
5072 5072
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5073 5073
 	{
5074 5074
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5097,11 +5097,11 @@  discard block
 block discarded – undo
5097 5097
 	}
5098 5098
 
5099 5099
 	/**
5100
-	* Gets all aircraft registration that have flown over by route
5101
-	*
5102
-	* @return Array the aircraft list
5103
-	*
5104
-	*/
5100
+	 * Gets all aircraft registration that have flown over by route
5101
+	 *
5102
+	 * @return Array the aircraft list
5103
+	 *
5104
+	 */
5105 5105
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5106 5106
 	{
5107 5107
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5143,11 +5143,11 @@  discard block
 block discarded – undo
5143 5143
 	
5144 5144
 	
5145 5145
 	/**
5146
-	* Gets all aircraft manufacturer that have flown over by route
5147
-	*
5148
-	* @return Array the aircraft manufacturer list
5149
-	*
5150
-	*/
5146
+	 * Gets all aircraft manufacturer that have flown over by route
5147
+	 *
5148
+	 * @return Array the aircraft manufacturer list
5149
+	 *
5150
+	 */
5151 5151
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5152 5152
 	{
5153 5153
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5181,11 +5181,11 @@  discard block
 block discarded – undo
5181 5181
 	
5182 5182
 	
5183 5183
 	/**
5184
-	* Gets all aircraft types that have flown over by country
5185
-	*
5186
-	* @return Array the aircraft list
5187
-	*
5188
-	*/
5184
+	 * Gets all aircraft types that have flown over by country
5185
+	 *
5186
+	 * @return Array the aircraft list
5187
+	 *
5188
+	 */
5189 5189
 	public function countAllAircraftTypesByCountry($country,$filters = array())
5190 5190
 	{
5191 5191
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5216,11 +5216,11 @@  discard block
 block discarded – undo
5216 5216
 
5217 5217
 
5218 5218
 	/**
5219
-	* Gets all aircraft registration that have flown over by country
5220
-	*
5221
-	* @return Array the aircraft list
5222
-	*
5223
-	*/
5219
+	 * Gets all aircraft registration that have flown over by country
5220
+	 *
5221
+	 * @return Array the aircraft list
5222
+	 *
5223
+	 */
5224 5224
 	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5225 5225
 	{
5226 5226
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5260,11 +5260,11 @@  discard block
 block discarded – undo
5260 5260
 	
5261 5261
 	
5262 5262
 	/**
5263
-	* Gets all aircraft manufacturer that have flown over by country
5264
-	*
5265
-	* @return Array the aircraft manufacturer list
5266
-	*
5267
-	*/
5263
+	 * Gets all aircraft manufacturer that have flown over by country
5264
+	 *
5265
+	 * @return Array the aircraft manufacturer list
5266
+	 *
5267
+	 */
5268 5268
 	public function countAllAircraftManufacturerByCountry($country,$filters = array())
5269 5269
 	{
5270 5270
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5295,17 +5295,17 @@  discard block
 block discarded – undo
5295 5295
 	
5296 5296
 	
5297 5297
 	/**
5298
-	* Gets all aircraft manufacturers that have flown over
5299
-	*
5300
-	* @return Array the aircraft list
5301
-	*
5302
-	*/
5298
+	 * Gets all aircraft manufacturers that have flown over
5299
+	 *
5300
+	 * @return Array the aircraft list
5301
+	 *
5302
+	 */
5303 5303
 	public function countAllAircraftManufacturers($filters = array())
5304 5304
 	{
5305 5305
 		$filter_query = $this->getFilter($filters,true,true);
5306 5306
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5307 5307
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5308
-                $query .= " GROUP BY spotter_output.aircraft_manufacturer
5308
+				$query .= " GROUP BY spotter_output.aircraft_manufacturer
5309 5309
 					ORDER BY aircraft_manufacturer_count DESC
5310 5310
 					LIMIT 10";
5311 5311
       
@@ -5330,11 +5330,11 @@  discard block
 block discarded – undo
5330 5330
 	
5331 5331
 	
5332 5332
 	/**
5333
-	* Gets all aircraft registrations that have flown over
5334
-	*
5335
-	* @return Array the aircraft list
5336
-	*
5337
-	*/
5333
+	 * Gets all aircraft registrations that have flown over
5334
+	 *
5335
+	 * @return Array the aircraft list
5336
+	 *
5337
+	 */
5338 5338
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5339 5339
 	{
5340 5340
 		global $globalDBdriver;
@@ -5342,15 +5342,15 @@  discard block
 block discarded – undo
5342 5342
 		$filter_query = $this->getFilter($filters,true,true);
5343 5343
 		$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    
5344 5344
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5345
-                if ($olderthanmonths > 0) {
5346
-            		if ($globalDBdriver == 'mysql') {
5345
+				if ($olderthanmonths > 0) {
5346
+					if ($globalDBdriver == 'mysql') {
5347 5347
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5348 5348
 			} else {
5349 5349
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5350 5350
 			}
5351 5351
 		}
5352
-                if ($sincedate != '') {
5353
-            		if ($globalDBdriver == 'mysql') {
5352
+				if ($sincedate != '') {
5353
+					if ($globalDBdriver == 'mysql') {
5354 5354
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5355 5355
 			} else {
5356 5356
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5359,7 +5359,7 @@  discard block
 block discarded – undo
5359 5359
 
5360 5360
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5361 5361
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5362
-                $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5362
+				$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5363 5363
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5364 5364
 		
5365 5365
 		$sth = $this->db->prepare($query);
@@ -5390,11 +5390,11 @@  discard block
 block discarded – undo
5390 5390
 
5391 5391
 
5392 5392
 	/**
5393
-	* Gets all aircraft registrations that have flown over
5394
-	*
5395
-	* @return Array the aircraft list
5396
-	*
5397
-	*/
5393
+	 * Gets all aircraft registrations that have flown over
5394
+	 *
5395
+	 * @return Array the aircraft list
5396
+	 *
5397
+	 */
5398 5398
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5399 5399
 	{
5400 5400
 		global $globalDBdriver;
@@ -5402,15 +5402,15 @@  discard block
 block discarded – undo
5402 5402
 		$Image = new Image($this->db);
5403 5403
 		$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    
5404 5404
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5405
-                if ($olderthanmonths > 0) {
5406
-            		if ($globalDBdriver == 'mysql') {
5405
+				if ($olderthanmonths > 0) {
5406
+					if ($globalDBdriver == 'mysql') {
5407 5407
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5408 5408
 			} else {
5409 5409
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5410 5410
 			}
5411 5411
 		}
5412
-                if ($sincedate != '') {
5413
-            		if ($globalDBdriver == 'mysql') {
5412
+				if ($sincedate != '') {
5413
+					if ($globalDBdriver == 'mysql') {
5414 5414
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5415 5415
 			} else {
5416 5416
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5419,7 +5419,7 @@  discard block
 block discarded – undo
5419 5419
 
5420 5420
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5421 5421
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5422
-                $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";
5422
+				$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";
5423 5423
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5424 5424
 		
5425 5425
 		$sth = $this->db->prepare($query);
@@ -5451,35 +5451,35 @@  discard block
 block discarded – undo
5451 5451
 	
5452 5452
 	
5453 5453
 	/**
5454
-	* Gets all departure airports of the airplanes that have flown over
5455
-	*
5456
-	* @return Array the airport list
5457
-	*
5458
-	*/
5454
+	 * Gets all departure airports of the airplanes that have flown over
5455
+	 *
5456
+	 * @return Array the airport list
5457
+	 *
5458
+	 */
5459 5459
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5460 5460
 	{
5461 5461
 		global $globalDBdriver;
5462 5462
 		$filter_query = $this->getFilter($filters,true,true);
5463 5463
 		$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 
5464 5464
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA'";
5465
-                if ($olderthanmonths > 0) {
5466
-            		if ($globalDBdriver == 'mysql') {
5465
+				if ($olderthanmonths > 0) {
5466
+					if ($globalDBdriver == 'mysql') {
5467 5467
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5468 5468
 			} else {
5469 5469
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5470 5470
 			}
5471
-                }
5472
-                if ($sincedate != '') {
5473
-            		if ($globalDBdriver == 'mysql') {
5471
+				}
5472
+				if ($sincedate != '') {
5473
+					if ($globalDBdriver == 'mysql') {
5474 5474
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5475 5475
 			} else {
5476 5476
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5477 5477
 			}
5478 5478
 		}
5479 5479
 
5480
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5481
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5482
-                $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5480
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5481
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5482
+				$query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5483 5483
 				ORDER BY airport_departure_icao_count DESC";
5484 5484
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5485 5485
       
@@ -5503,35 +5503,35 @@  discard block
 block discarded – undo
5503 5503
 	}
5504 5504
 
5505 5505
 	/**
5506
-	* Gets all departure airports of the airplanes that have flown over
5507
-	*
5508
-	* @return Array the airport list
5509
-	*
5510
-	*/
5506
+	 * Gets all departure airports of the airplanes that have flown over
5507
+	 *
5508
+	 * @return Array the airport list
5509
+	 *
5510
+	 */
5511 5511
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5512 5512
 	{
5513 5513
 		global $globalDBdriver;
5514 5514
 		$filter_query = $this->getFilter($filters,true,true);
5515 5515
 		$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 
5516 5516
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' ";
5517
-                if ($olderthanmonths > 0) {
5518
-            		if ($globalDBdriver == 'mysql') {
5517
+				if ($olderthanmonths > 0) {
5518
+					if ($globalDBdriver == 'mysql') {
5519 5519
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5520 5520
 			} else {
5521 5521
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5522 5522
 			}
5523
-                }
5524
-                if ($sincedate != '') {
5525
-            		if ($globalDBdriver == 'mysql') {
5523
+				}
5524
+				if ($sincedate != '') {
5525
+					if ($globalDBdriver == 'mysql') {
5526 5526
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5527 5527
 			} else {
5528 5528
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5529 5529
 			}
5530 5530
 		}
5531 5531
 
5532
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5533
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5534
-                $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
5532
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5533
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5534
+				$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
5535 5535
 				ORDER BY airport_departure_icao_count DESC";
5536 5536
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5537 5537
       
@@ -5556,37 +5556,37 @@  discard block
 block discarded – undo
5556 5556
 	}
5557 5557
 
5558 5558
 	/**
5559
-	* Gets all detected departure airports of the airplanes that have flown over
5560
-	*
5561
-	* @return Array the airport list
5562
-	*
5563
-	*/
5559
+	 * Gets all detected departure airports of the airplanes that have flown over
5560
+	 *
5561
+	 * @return Array the airport list
5562
+	 *
5563
+	 */
5564 5564
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5565 5565
 	{
5566 5566
 		global $globalDBdriver;
5567 5567
 		$filter_query = $this->getFilter($filters,true,true);
5568 5568
 		$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
5569 5569
 				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";
5570
-                if ($olderthanmonths > 0) {
5571
-            		if ($globalDBdriver == 'mysql') {
5570
+				if ($olderthanmonths > 0) {
5571
+					if ($globalDBdriver == 'mysql') {
5572 5572
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5573 5573
 			} else {
5574 5574
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5575 5575
 			}
5576
-                }
5577
-                if ($sincedate != '') {
5578
-            		if ($globalDBdriver == 'mysql') {
5576
+				}
5577
+				if ($sincedate != '') {
5578
+					if ($globalDBdriver == 'mysql') {
5579 5579
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5580 5580
 			} else {
5581 5581
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5582 5582
 			}
5583 5583
 		}
5584
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5585
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5586
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5584
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5585
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5586
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5587 5587
 				ORDER BY airport_departure_icao_count DESC";
5588 5588
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5589
-    		//echo $query;
5589
+			//echo $query;
5590 5590
 		$sth = $this->db->prepare($query);
5591 5591
 		$sth->execute();
5592 5592
       
@@ -5607,35 +5607,35 @@  discard block
 block discarded – undo
5607 5607
 	}
5608 5608
 	
5609 5609
 	/**
5610
-	* Gets all detected departure airports of the airplanes that have flown over
5611
-	*
5612
-	* @return Array the airport list
5613
-	*
5614
-	*/
5610
+	 * Gets all detected departure airports of the airplanes that have flown over
5611
+	 *
5612
+	 * @return Array the airport list
5613
+	 *
5614
+	 */
5615 5615
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5616 5616
 	{
5617 5617
 		global $globalDBdriver;
5618 5618
 		$filter_query = $this->getFilter($filters,true,true);
5619 5619
 		$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
5620 5620
 				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 ";
5621
-                if ($olderthanmonths > 0) {
5622
-            		if ($globalDBdriver == 'mysql') {
5621
+				if ($olderthanmonths > 0) {
5622
+					if ($globalDBdriver == 'mysql') {
5623 5623
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5624 5624
 			} else {
5625 5625
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5626 5626
 			}
5627
-                }
5628
-                if ($sincedate != '') {
5629
-            		if ($globalDBdriver == 'mysql') {
5627
+				}
5628
+				if ($sincedate != '') {
5629
+					if ($globalDBdriver == 'mysql') {
5630 5630
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5631 5631
 			} else {
5632 5632
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
5633 5633
 			}
5634 5634
 		}
5635 5635
 
5636
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5637
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5638
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5636
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5637
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5638
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5639 5639
 				ORDER BY airport_departure_icao_count DESC";
5640 5640
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5641 5641
       
@@ -5660,11 +5660,11 @@  discard block
 block discarded – undo
5660 5660
 	}	
5661 5661
 	
5662 5662
 	/**
5663
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
5664
-	*
5665
-	* @return Array the airport list
5666
-	*
5667
-	*/
5663
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
5664
+	 *
5665
+	 * @return Array the airport list
5666
+	 *
5667
+	 */
5668 5668
 	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
5669 5669
 	{
5670 5670
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5698,11 +5698,11 @@  discard block
 block discarded – undo
5698 5698
 	
5699 5699
 	
5700 5700
 	/**
5701
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5702
-	*
5703
-	* @return Array the airport list
5704
-	*
5705
-	*/
5701
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5702
+	 *
5703
+	 * @return Array the airport list
5704
+	 *
5705
+	 */
5706 5706
 	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
5707 5707
 	{
5708 5708
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5733,11 +5733,11 @@  discard block
 block discarded – undo
5733 5733
 	
5734 5734
 	
5735 5735
 	/**
5736
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5737
-	*
5738
-	* @return Array the airport list
5739
-	*
5740
-	*/
5736
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5737
+	 *
5738
+	 * @return Array the airport list
5739
+	 *
5740
+	 */
5741 5741
 	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
5742 5742
 	{
5743 5743
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5770,11 +5770,11 @@  discard block
 block discarded – undo
5770 5770
 	
5771 5771
 	
5772 5772
 	/**
5773
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5774
-	*
5775
-	* @return Array the airport list
5776
-	*
5777
-	*/
5773
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5774
+	 *
5775
+	 * @return Array the airport list
5776
+	 *
5777
+	 */
5778 5778
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
5779 5779
 	{
5780 5780
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5804,11 +5804,11 @@  discard block
 block discarded – undo
5804 5804
 	
5805 5805
 	
5806 5806
 	/**
5807
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5808
-	*
5809
-	* @return Array the airport list
5810
-	*
5811
-	*/
5807
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5808
+	 *
5809
+	 * @return Array the airport list
5810
+	 *
5811
+	 */
5812 5812
 	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
5813 5813
 	{
5814 5814
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5841,11 +5841,11 @@  discard block
 block discarded – undo
5841 5841
 	
5842 5842
 	
5843 5843
 	/**
5844
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
5845
-	*
5846
-	* @return Array the airport list
5847
-	*
5848
-	*/
5844
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
5845
+	 *
5846
+	 * @return Array the airport list
5847
+	 *
5848
+	 */
5849 5849
 	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
5850 5850
 	{
5851 5851
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5875,11 +5875,11 @@  discard block
 block discarded – undo
5875 5875
 	
5876 5876
 	
5877 5877
 	/**
5878
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
5879
-	*
5880
-	* @return Array the airport list
5881
-	*
5882
-	*/
5878
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
5879
+	 *
5880
+	 * @return Array the airport list
5881
+	 *
5882
+	 */
5883 5883
 	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
5884 5884
 	{
5885 5885
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5912,11 +5912,11 @@  discard block
 block discarded – undo
5912 5912
 	
5913 5913
 	
5914 5914
 	/**
5915
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
5916
-	*
5917
-	* @return Array the airport list
5918
-	*
5919
-	*/
5915
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
5916
+	 *
5917
+	 * @return Array the airport list
5918
+	 *
5919
+	 */
5920 5920
 	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
5921 5921
 	{
5922 5922
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5947,11 +5947,11 @@  discard block
 block discarded – undo
5947 5947
 	
5948 5948
 	
5949 5949
 	/**
5950
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
5951
-	*
5952
-	* @return Array the airport list
5953
-	*
5954
-	*/
5950
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
5951
+	 *
5952
+	 * @return Array the airport list
5953
+	 *
5954
+	 */
5955 5955
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
5956 5956
 	{
5957 5957
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5984,11 +5984,11 @@  discard block
 block discarded – undo
5984 5984
 	
5985 5985
 	
5986 5986
 	/**
5987
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
5988
-	*
5989
-	* @return Array the airport list
5990
-	*
5991
-	*/
5987
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
5988
+	 *
5989
+	 * @return Array the airport list
5990
+	 *
5991
+	 */
5992 5992
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
5993 5993
 	{
5994 5994
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6018,11 +6018,11 @@  discard block
 block discarded – undo
6018 6018
 	
6019 6019
 	
6020 6020
 	/**
6021
-	* Gets all departure airports of the airplanes that have flown over based on a date
6022
-	*
6023
-	* @return Array the airport list
6024
-	*
6025
-	*/
6021
+	 * Gets all departure airports of the airplanes that have flown over based on a date
6022
+	 *
6023
+	 * @return Array the airport list
6024
+	 *
6025
+	 */
6026 6026
 	public function countAllDepartureAirportsByDate($date,$filters = array())
6027 6027
 	{
6028 6028
 		global $globalTimezone, $globalDBdriver;
@@ -6068,11 +6068,11 @@  discard block
 block discarded – undo
6068 6068
 	
6069 6069
 	
6070 6070
 	/**
6071
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
6072
-	*
6073
-	* @return Array the airport list
6074
-	*
6075
-	*/
6071
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
6072
+	 *
6073
+	 * @return Array the airport list
6074
+	 *
6075
+	 */
6076 6076
 	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6077 6077
 	{
6078 6078
 		global $globalTimezone, $globalDBdriver;
@@ -6115,11 +6115,11 @@  discard block
 block discarded – undo
6115 6115
 	
6116 6116
 	
6117 6117
 	/**
6118
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6119
-	*
6120
-	* @return Array the airport list
6121
-	*
6122
-	*/
6118
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6119
+	 *
6120
+	 * @return Array the airport list
6121
+	 *
6122
+	 */
6123 6123
 	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6124 6124
 	{
6125 6125
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6153,11 +6153,11 @@  discard block
 block discarded – undo
6153 6153
 	
6154 6154
 	
6155 6155
 	/**
6156
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6157
-	*
6158
-	* @return Array the airport list
6159
-	*
6160
-	*/
6156
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6157
+	 *
6158
+	 * @return Array the airport list
6159
+	 *
6160
+	 */
6161 6161
 	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
6162 6162
 	{
6163 6163
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6188,11 +6188,11 @@  discard block
 block discarded – undo
6188 6188
 	
6189 6189
 	
6190 6190
 	/**
6191
-	* Gets all departure airports of the airplanes that have flown over based on a country
6192
-	*
6193
-	* @return Array the airport list
6194
-	*
6195
-	*/
6191
+	 * Gets all departure airports of the airplanes that have flown over based on a country
6192
+	 *
6193
+	 * @return Array the airport list
6194
+	 *
6195
+	 */
6196 6196
 	public function countAllDepartureAirportsByCountry($country,$filters = array())
6197 6197
 	{
6198 6198
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6226,11 +6226,11 @@  discard block
 block discarded – undo
6226 6226
 
6227 6227
 
6228 6228
 	/**
6229
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6230
-	*
6231
-	* @return Array the airport list
6232
-	*
6233
-	*/
6229
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6230
+	 *
6231
+	 * @return Array the airport list
6232
+	 *
6233
+	 */
6234 6234
 	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
6235 6235
 	{
6236 6236
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6260,40 +6260,40 @@  discard block
 block discarded – undo
6260 6260
 	
6261 6261
 
6262 6262
 	/**
6263
-	* Gets all arrival airports of the airplanes that have flown over
6264
-	*
6265
-	* @return Array the airport list
6266
-	*
6267
-	*/
6263
+	 * Gets all arrival airports of the airplanes that have flown over
6264
+	 *
6265
+	 * @return Array the airport list
6266
+	 *
6267
+	 */
6268 6268
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6269 6269
 	{
6270 6270
 		global $globalDBdriver;
6271 6271
 		$filter_query = $this->getFilter($filters,true,true);
6272 6272
 		$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 
6273 6273
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
6274
-                if ($olderthanmonths > 0) {
6275
-            		if ($globalDBdriver == 'mysql') {
6274
+				if ($olderthanmonths > 0) {
6275
+					if ($globalDBdriver == 'mysql') {
6276 6276
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6277 6277
 			} else {
6278 6278
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6279 6279
 			}
6280
-                if ($sincedate != '') {
6281
-            		if ($globalDBdriver == 'mysql') {
6280
+				if ($sincedate != '') {
6281
+					if ($globalDBdriver == 'mysql') {
6282 6282
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6283 6283
 			} else {
6284 6284
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6285 6285
 			}
6286 6286
 		}
6287
-            		if ($globalDBdriver == 'mysql') {
6287
+					if ($globalDBdriver == 'mysql') {
6288 6288
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6289 6289
 			} else {
6290 6290
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6291 6291
 			}
6292 6292
 		}
6293 6293
 
6294
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6295
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6296
-                $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6294
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6295
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6296
+				$query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6297 6297
 					ORDER BY airport_arrival_icao_count DESC";
6298 6298
 		if ($limit) $query .= " LIMIT 10";
6299 6299
       
@@ -6322,40 +6322,40 @@  discard block
 block discarded – undo
6322 6322
 	}
6323 6323
 
6324 6324
 	/**
6325
-	* Gets all arrival airports of the airplanes that have flown over
6326
-	*
6327
-	* @return Array the airport list
6328
-	*
6329
-	*/
6325
+	 * Gets all arrival airports of the airplanes that have flown over
6326
+	 *
6327
+	 * @return Array the airport list
6328
+	 *
6329
+	 */
6330 6330
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6331 6331
 	{
6332 6332
 		global $globalDBdriver;
6333 6333
 		$filter_query = $this->getFilter($filters,true,true);
6334 6334
 		$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 
6335 6335
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' ";
6336
-                if ($olderthanmonths > 0) {
6337
-            		if ($globalDBdriver == 'mysql') {
6336
+				if ($olderthanmonths > 0) {
6337
+					if ($globalDBdriver == 'mysql') {
6338 6338
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6339 6339
 			} else {
6340 6340
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6341 6341
 			}
6342
-                if ($sincedate != '') {
6343
-            		if ($globalDBdriver == 'mysql') {
6342
+				if ($sincedate != '') {
6343
+					if ($globalDBdriver == 'mysql') {
6344 6344
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6345 6345
 			} else {
6346 6346
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6347 6347
 			}
6348 6348
 		}
6349
-            		if ($globalDBdriver == 'mysql') {
6349
+					if ($globalDBdriver == 'mysql') {
6350 6350
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6351 6351
 			} else {
6352 6352
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6353 6353
 			}
6354 6354
 		}
6355 6355
 
6356
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6357
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6358
-                $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
6356
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6357
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6358
+				$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
6359 6359
 					ORDER BY airport_arrival_icao_count DESC";
6360 6360
 		if ($limit) $query .= " LIMIT 10";
6361 6361
       
@@ -6386,39 +6386,39 @@  discard block
 block discarded – undo
6386 6386
 
6387 6387
 
6388 6388
 	/**
6389
-	* Gets all detected arrival airports of the airplanes that have flown over
6390
-	*
6391
-	* @return Array the airport list
6392
-	*
6393
-	*/
6389
+	 * Gets all detected arrival airports of the airplanes that have flown over
6390
+	 *
6391
+	 * @return Array the airport list
6392
+	 *
6393
+	 */
6394 6394
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6395 6395
 	{
6396 6396
 		global $globalDBdriver;
6397 6397
 		$filter_query = $this->getFilter($filters,true,true);
6398 6398
 		$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 
6399 6399
 			FROM spotter_output, airport".$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";
6400
-                if ($olderthanmonths > 0) {
6401
-            		if ($globalDBdriver == 'mysql') {
6400
+				if ($olderthanmonths > 0) {
6401
+					if ($globalDBdriver == 'mysql') {
6402 6402
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6403 6403
 			} else {
6404 6404
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6405 6405
 			}
6406
-                if ($sincedate != '') {
6407
-            		if ($globalDBdriver == 'mysql') {
6406
+				if ($sincedate != '') {
6407
+					if ($globalDBdriver == 'mysql') {
6408 6408
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6409 6409
 			} else {
6410 6410
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6411 6411
 			}
6412 6412
 		}
6413
-            		if ($globalDBdriver == 'mysql') {
6413
+					if ($globalDBdriver == 'mysql') {
6414 6414
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6415 6415
 			} else {
6416 6416
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6417 6417
 			}
6418 6418
 		}
6419
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6420
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6421
-                $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6419
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6420
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6421
+				$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6422 6422
 					ORDER BY airport_arrival_icao_count DESC";
6423 6423
 		if ($limit) $query .= " LIMIT 10";
6424 6424
       
@@ -6447,40 +6447,40 @@  discard block
 block discarded – undo
6447 6447
 	}
6448 6448
 	
6449 6449
 	/**
6450
-	* Gets all detected arrival airports of the airplanes that have flown over
6451
-	*
6452
-	* @return Array the airport list
6453
-	*
6454
-	*/
6450
+	 * Gets all detected arrival airports of the airplanes that have flown over
6451
+	 *
6452
+	 * @return Array the airport list
6453
+	 *
6454
+	 */
6455 6455
 	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6456 6456
 	{
6457 6457
 		global $globalDBdriver;
6458 6458
 		$filter_query = $this->getFilter($filters,true,true);
6459 6459
 		$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 
6460 6460
 			FROM spotter_output, airport".$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 ";
6461
-                if ($olderthanmonths > 0) {
6462
-            		if ($globalDBdriver == 'mysql') {
6461
+				if ($olderthanmonths > 0) {
6462
+					if ($globalDBdriver == 'mysql') {
6463 6463
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6464 6464
 			} else {
6465 6465
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6466 6466
 			}
6467
-                if ($sincedate != '') {
6468
-            		if ($globalDBdriver == 'mysql') {
6467
+				if ($sincedate != '') {
6468
+					if ($globalDBdriver == 'mysql') {
6469 6469
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6470 6470
 			} else {
6471 6471
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6472 6472
 			}
6473 6473
 		}
6474
-            		if ($globalDBdriver == 'mysql') {
6474
+					if ($globalDBdriver == 'mysql') {
6475 6475
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6476 6476
 			} else {
6477 6477
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6478 6478
 			}
6479 6479
 		}
6480 6480
 
6481
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6482
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6483
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6481
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6482
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6483
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6484 6484
 					ORDER BY airport_arrival_icao_count DESC";
6485 6485
 		if ($limit) $query .= " LIMIT 10";
6486 6486
       
@@ -6510,11 +6510,11 @@  discard block
 block discarded – undo
6510 6510
 	}	
6511 6511
 	
6512 6512
 	/**
6513
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
6514
-	*
6515
-	* @return Array the airport list
6516
-	*
6517
-	*/
6513
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
6514
+	 *
6515
+	 * @return Array the airport list
6516
+	 *
6517
+	 */
6518 6518
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
6519 6519
 	{
6520 6520
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6546,11 +6546,11 @@  discard block
 block discarded – undo
6546 6546
 	
6547 6547
 	
6548 6548
 	/**
6549
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6550
-	*
6551
-	* @return Array the airport list
6552
-	*
6553
-	*/
6549
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6550
+	 *
6551
+	 * @return Array the airport list
6552
+	 *
6553
+	 */
6554 6554
 	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
6555 6555
 	{
6556 6556
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6581,11 +6581,11 @@  discard block
 block discarded – undo
6581 6581
 	
6582 6582
 	
6583 6583
 	/**
6584
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6585
-	*
6586
-	* @return Array the airport list
6587
-	*
6588
-	*/
6584
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6585
+	 *
6586
+	 * @return Array the airport list
6587
+	 *
6588
+	 */
6589 6589
 	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
6590 6590
 	{
6591 6591
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6619,11 +6619,11 @@  discard block
 block discarded – undo
6619 6619
 	
6620 6620
 	
6621 6621
 	/**
6622
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6623
-	*
6624
-	* @return Array the airport list
6625
-	*
6626
-	*/
6622
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6623
+	 *
6624
+	 * @return Array the airport list
6625
+	 *
6626
+	 */
6627 6627
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
6628 6628
 	{
6629 6629
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6653,11 +6653,11 @@  discard block
 block discarded – undo
6653 6653
 	
6654 6654
 	
6655 6655
 	/**
6656
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6657
-	*
6658
-	* @return Array the airport list
6659
-	*
6660
-	*/
6656
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6657
+	 *
6658
+	 * @return Array the airport list
6659
+	 *
6660
+	 */
6661 6661
 	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
6662 6662
 	{
6663 6663
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6691,11 +6691,11 @@  discard block
 block discarded – undo
6691 6691
 	
6692 6692
 	
6693 6693
 	/**
6694
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6695
-	*
6696
-	* @return Array the airport list
6697
-	*
6698
-	*/
6694
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6695
+	 *
6696
+	 * @return Array the airport list
6697
+	 *
6698
+	 */
6699 6699
 	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
6700 6700
 	{
6701 6701
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6726,11 +6726,11 @@  discard block
 block discarded – undo
6726 6726
 	
6727 6727
 	
6728 6728
 	/**
6729
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
6730
-	*
6731
-	* @return Array the airport list
6732
-	*
6733
-	*/
6729
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
6730
+	 *
6731
+	 * @return Array the airport list
6732
+	 *
6733
+	 */
6734 6734
 	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
6735 6735
 	{
6736 6736
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6763,11 +6763,11 @@  discard block
 block discarded – undo
6763 6763
 	
6764 6764
 	
6765 6765
 	/**
6766
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6767
-	*
6768
-	* @return Array the airport list
6769
-	*
6770
-	*/
6766
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6767
+	 *
6768
+	 * @return Array the airport list
6769
+	 *
6770
+	 */
6771 6771
 	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
6772 6772
 	{
6773 6773
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6797,11 +6797,11 @@  discard block
 block discarded – undo
6797 6797
 	
6798 6798
 	
6799 6799
 	/**
6800
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6801
-	*
6802
-	* @return Array the airport list
6803
-	*
6804
-	*/
6800
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6801
+	 *
6802
+	 * @return Array the airport list
6803
+	 *
6804
+	 */
6805 6805
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6806 6806
 	{
6807 6807
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6835,11 +6835,11 @@  discard block
 block discarded – undo
6835 6835
 	
6836 6836
 	
6837 6837
 	/**
6838
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
6839
-	*
6840
-	* @return Array the airport list
6841
-	*
6842
-	*/
6838
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
6839
+	 *
6840
+	 * @return Array the airport list
6841
+	 *
6842
+	 */
6843 6843
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6844 6844
 	{
6845 6845
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6870,11 +6870,11 @@  discard block
 block discarded – undo
6870 6870
 	
6871 6871
 	
6872 6872
 	/**
6873
-	* Gets all arrival airports of the airplanes that have flown over based on a date
6874
-	*
6875
-	* @return Array the airport list
6876
-	*
6877
-	*/
6873
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
6874
+	 *
6875
+	 * @return Array the airport list
6876
+	 *
6877
+	 */
6878 6878
 	public function countAllArrivalAirportsByDate($date,$filters = array())
6879 6879
 	{
6880 6880
 		global $globalTimezone, $globalDBdriver;
@@ -6920,11 +6920,11 @@  discard block
 block discarded – undo
6920 6920
 	
6921 6921
 	
6922 6922
 	/**
6923
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
6924
-	*
6925
-	* @return Array the airport list
6926
-	*
6927
-	*/
6923
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
6924
+	 *
6925
+	 * @return Array the airport list
6926
+	 *
6927
+	 */
6928 6928
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
6929 6929
 	{
6930 6930
 		global $globalTimezone, $globalDBdriver;
@@ -6967,11 +6967,11 @@  discard block
 block discarded – undo
6967 6967
 	
6968 6968
 	
6969 6969
 	/**
6970
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
6971
-	*
6972
-	* @return Array the airport list
6973
-	*
6974
-	*/
6970
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
6971
+	 *
6972
+	 * @return Array the airport list
6973
+	 *
6974
+	 */
6975 6975
 	public function countAllArrivalAirportsByIdent($ident,$filters = array())
6976 6976
 	{
6977 6977
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7004,11 +7004,11 @@  discard block
 block discarded – undo
7004 7004
 	
7005 7005
 	
7006 7006
 	/**
7007
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7008
-	*
7009
-	* @return Array the airport list
7010
-	*
7011
-	*/
7007
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7008
+	 *
7009
+	 * @return Array the airport list
7010
+	 *
7011
+	 */
7012 7012
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
7013 7013
 	{
7014 7014
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7039,11 +7039,11 @@  discard block
 block discarded – undo
7039 7039
 	
7040 7040
 	
7041 7041
 	/**
7042
-	* Gets all arrival airports of the airplanes that have flown over based on a country
7043
-	*
7044
-	* @return Array the airport list
7045
-	*
7046
-	*/
7042
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
7043
+	 *
7044
+	 * @return Array the airport list
7045
+	 *
7046
+	 */
7047 7047
 	public function countAllArrivalAirportsByCountry($country,$filters = array())
7048 7048
 	{
7049 7049
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7076,11 +7076,11 @@  discard block
 block discarded – undo
7076 7076
 	
7077 7077
 	
7078 7078
 	/**
7079
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
7080
-	*
7081
-	* @return Array the airport list
7082
-	*
7083
-	*/
7079
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
7080
+	 *
7081
+	 * @return Array the airport list
7082
+	 *
7083
+	 */
7084 7084
 	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
7085 7085
 	{
7086 7086
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7111,11 +7111,11 @@  discard block
 block discarded – undo
7111 7111
 
7112 7112
 
7113 7113
 	/**
7114
-	* Counts all airport departure countries
7115
-	*
7116
-	* @return Array the airport departure list
7117
-	*
7118
-	*/
7114
+	 * Counts all airport departure countries
7115
+	 *
7116
+	 * @return Array the airport departure list
7117
+	 *
7118
+	 */
7119 7119
 	public function countAllDepartureCountries($filters = array())
7120 7120
 	{
7121 7121
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7145,11 +7145,11 @@  discard block
 block discarded – undo
7145 7145
 	
7146 7146
 	
7147 7147
 	/**
7148
-	* Counts all airport arrival countries
7149
-	*
7150
-	* @return Array the airport arrival list
7151
-	*
7152
-	*/
7148
+	 * Counts all airport arrival countries
7149
+	 *
7150
+	 * @return Array the airport arrival list
7151
+	 *
7152
+	 */
7153 7153
 	public function countAllArrivalCountries($limit = true,$filters = array())
7154 7154
 	{
7155 7155
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7182,11 +7182,11 @@  discard block
 block discarded – undo
7182 7182
 
7183 7183
 
7184 7184
 	/**
7185
-	* Gets all route combinations
7186
-	*
7187
-	* @return Array the route list
7188
-	*
7189
-	*/
7185
+	 * Gets all route combinations
7186
+	 *
7187
+	 * @return Array the route list
7188
+	 *
7189
+	 */
7190 7190
 	public function countAllRoutes($filters = array())
7191 7191
 	{
7192 7192
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7225,11 +7225,11 @@  discard block
 block discarded – undo
7225 7225
 	
7226 7226
 	
7227 7227
 	/**
7228
-	* Gets all route combinations based on an aircraft
7229
-	*
7230
-	* @return Array the route list
7231
-	*
7232
-	*/
7228
+	 * Gets all route combinations based on an aircraft
7229
+	 *
7230
+	 * @return Array the route list
7231
+	 *
7232
+	 */
7233 7233
 	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
7234 7234
 	{
7235 7235
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7265,11 +7265,11 @@  discard block
 block discarded – undo
7265 7265
 	
7266 7266
 	
7267 7267
 	/**
7268
-	* Gets all route combinations based on an aircraft registration
7269
-	*
7270
-	* @return Array the route list
7271
-	*
7272
-	*/
7268
+	 * Gets all route combinations based on an aircraft registration
7269
+	 *
7270
+	 * @return Array the route list
7271
+	 *
7272
+	 */
7273 7273
 	public function countAllRoutesByRegistration($registration, $filters = array())
7274 7274
 	{
7275 7275
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7307,11 +7307,11 @@  discard block
 block discarded – undo
7307 7307
 	
7308 7308
 	
7309 7309
 	/**
7310
-	* Gets all route combinations based on an airline
7311
-	*
7312
-	* @return Array the route list
7313
-	*
7314
-	*/
7310
+	 * Gets all route combinations based on an airline
7311
+	 *
7312
+	 * @return Array the route list
7313
+	 *
7314
+	 */
7315 7315
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
7316 7316
 	{
7317 7317
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7349,11 +7349,11 @@  discard block
 block discarded – undo
7349 7349
 	
7350 7350
 	
7351 7351
 	/**
7352
-	* Gets all route combinations based on an airport
7353
-	*
7354
-	* @return Array the route list
7355
-	*
7356
-	*/
7352
+	 * Gets all route combinations based on an airport
7353
+	 *
7354
+	 * @return Array the route list
7355
+	 *
7356
+	 */
7357 7357
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
7358 7358
 	{
7359 7359
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7390,11 +7390,11 @@  discard block
 block discarded – undo
7390 7390
 	
7391 7391
 	
7392 7392
 	/**
7393
-	* Gets all route combinations based on an country
7394
-	*
7395
-	* @return Array the route list
7396
-	*
7397
-	*/
7393
+	 * Gets all route combinations based on an country
7394
+	 *
7395
+	 * @return Array the route list
7396
+	 *
7397
+	 */
7398 7398
 	public function countAllRoutesByCountry($country, $filters = array())
7399 7399
 	{
7400 7400
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7430,11 +7430,11 @@  discard block
 block discarded – undo
7430 7430
 
7431 7431
 
7432 7432
 	/**
7433
-	* Gets all route combinations based on an date
7434
-	*
7435
-	* @return Array the route list
7436
-	*
7437
-	*/
7433
+	 * Gets all route combinations based on an date
7434
+	 *
7435
+	 * @return Array the route list
7436
+	 *
7437
+	 */
7438 7438
 	public function countAllRoutesByDate($date, $filters = array())
7439 7439
 	{
7440 7440
 		global $globalTimezone, $globalDBdriver;
@@ -7484,11 +7484,11 @@  discard block
 block discarded – undo
7484 7484
 	
7485 7485
 	
7486 7486
 	/**
7487
-	* Gets all route combinations based on an ident/callsign
7488
-	*
7489
-	* @return Array the route list
7490
-	*
7491
-	*/
7487
+	 * Gets all route combinations based on an ident/callsign
7488
+	 *
7489
+	 * @return Array the route list
7490
+	 *
7491
+	 */
7492 7492
 	public function countAllRoutesByIdent($ident, $filters = array())
7493 7493
 	{
7494 7494
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7525,11 +7525,11 @@  discard block
 block discarded – undo
7525 7525
 	
7526 7526
 	
7527 7527
 	/**
7528
-	* Gets all route combinations based on an manufacturer
7529
-	*
7530
-	* @return Array the route list
7531
-	*
7532
-	*/
7528
+	 * Gets all route combinations based on an manufacturer
7529
+	 *
7530
+	 * @return Array the route list
7531
+	 *
7532
+	 */
7533 7533
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
7534 7534
 	{
7535 7535
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7567,11 +7567,11 @@  discard block
 block discarded – undo
7567 7567
 	
7568 7568
 	
7569 7569
 	/**
7570
-	* Gets all route combinations with waypoints
7571
-	*
7572
-	* @return Array the route list
7573
-	*
7574
-	*/
7570
+	 * Gets all route combinations with waypoints
7571
+	 *
7572
+	 * @return Array the route list
7573
+	 *
7574
+	 */
7575 7575
 	public function countAllRoutesWithWaypoints($filters = array())
7576 7576
 	{
7577 7577
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7608,11 +7608,11 @@  discard block
 block discarded – undo
7608 7608
 	}
7609 7609
 	
7610 7610
 	/**
7611
-	* Gets all callsigns that have flown over
7612
-	*
7613
-	* @return Array the callsign list
7614
-	*
7615
-	*/
7611
+	 * Gets all callsigns that have flown over
7612
+	 *
7613
+	 * @return Array the callsign list
7614
+	 *
7615
+	 */
7616 7616
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
7617 7617
 	{
7618 7618
 		global $globalDBdriver;
@@ -7650,11 +7650,11 @@  discard block
 block discarded – undo
7650 7650
 	}
7651 7651
 
7652 7652
 	/**
7653
-	* Gets all callsigns that have flown over
7654
-	*
7655
-	* @return Array the callsign list
7656
-	*
7657
-	*/
7653
+	 * Gets all callsigns that have flown over
7654
+	 *
7655
+	 * @return Array the callsign list
7656
+	 *
7657
+	 */
7658 7658
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7659 7659
 	{
7660 7660
 		global $globalDBdriver;
@@ -7695,11 +7695,11 @@  discard block
 block discarded – undo
7695 7695
 
7696 7696
 
7697 7697
 	/**
7698
-	* Counts all dates
7699
-	*
7700
-	* @return Array the date list
7701
-	*
7702
-	*/
7698
+	 * Counts all dates
7699
+	 *
7700
+	 * @return Array the date list
7701
+	 *
7702
+	 */
7703 7703
 	public function countAllDates($filters = array())
7704 7704
 	{
7705 7705
 		global $globalTimezone, $globalDBdriver;
@@ -7744,11 +7744,11 @@  discard block
 block discarded – undo
7744 7744
 	}
7745 7745
 	
7746 7746
 	/**
7747
-	* Counts all dates
7748
-	*
7749
-	* @return Array the date list
7750
-	*
7751
-	*/
7747
+	 * Counts all dates
7748
+	 *
7749
+	 * @return Array the date list
7750
+	 *
7751
+	 */
7752 7752
 	public function countAllDatesByAirlines($filters = array())
7753 7753
 	{
7754 7754
 		global $globalTimezone, $globalDBdriver;
@@ -7793,11 +7793,11 @@  discard block
 block discarded – undo
7793 7793
 	}	
7794 7794
 	
7795 7795
 	/**
7796
-	* Counts all dates during the last 7 days
7797
-	*
7798
-	* @return Array the date list
7799
-	*
7800
-	*/
7796
+	 * Counts all dates during the last 7 days
7797
+	 *
7798
+	 * @return Array the date list
7799
+	 *
7800
+	 */
7801 7801
 	public function countAllDatesLast7Days($filters = array())
7802 7802
 	{
7803 7803
 		global $globalTimezone, $globalDBdriver;
@@ -7819,7 +7819,7 @@  discard block
 block discarded – undo
7819 7819
 			$query .= " GROUP BY date_name 
7820 7820
 								ORDER BY date_name ASC";
7821 7821
 			$query_data = array(':offset' => $offset);
7822
-    		}
7822
+			}
7823 7823
 		
7824 7824
 		$sth = $this->db->prepare($query);
7825 7825
 		$sth->execute($query_data);
@@ -7839,11 +7839,11 @@  discard block
 block discarded – undo
7839 7839
 	}
7840 7840
 
7841 7841
 	/**
7842
-	* Counts all dates during the last month
7843
-	*
7844
-	* @return Array the date list
7845
-	*
7846
-	*/
7842
+	 * Counts all dates during the last month
7843
+	 *
7844
+	 * @return Array the date list
7845
+	 *
7846
+	 */
7847 7847
 	public function countAllDatesLastMonth($filters = array())
7848 7848
 	{
7849 7849
 		global $globalTimezone, $globalDBdriver;
@@ -7865,7 +7865,7 @@  discard block
 block discarded – undo
7865 7865
 			$query .= " GROUP BY date_name 
7866 7866
 								ORDER BY date_name ASC";
7867 7867
 			$query_data = array(':offset' => $offset);
7868
-    		}
7868
+			}
7869 7869
 		
7870 7870
 		$sth = $this->db->prepare($query);
7871 7871
 		$sth->execute($query_data);
@@ -7886,11 +7886,11 @@  discard block
 block discarded – undo
7886 7886
 
7887 7887
 
7888 7888
 	/**
7889
-	* Counts all dates during the last month
7890
-	*
7891
-	* @return Array the date list
7892
-	*
7893
-	*/
7889
+	 * Counts all dates during the last month
7890
+	 *
7891
+	 * @return Array the date list
7892
+	 *
7893
+	 */
7894 7894
 	public function countAllDatesLastMonthByAirlines($filters = array())
7895 7895
 	{
7896 7896
 		global $globalTimezone, $globalDBdriver;
@@ -7913,7 +7913,7 @@  discard block
 block discarded – undo
7913 7913
 								GROUP BY spotter_output.airline_icao, date_name 
7914 7914
 								ORDER BY date_name ASC";
7915 7915
 			$query_data = array(':offset' => $offset);
7916
-    		}
7916
+			}
7917 7917
 		
7918 7918
 		$sth = $this->db->prepare($query);
7919 7919
 		$sth->execute($query_data);
@@ -7935,11 +7935,11 @@  discard block
 block discarded – undo
7935 7935
 	
7936 7936
 
7937 7937
 	/**
7938
-	* Counts all month
7939
-	*
7940
-	* @return Array the month list
7941
-	*
7942
-	*/
7938
+	 * Counts all month
7939
+	 *
7940
+	 * @return Array the month list
7941
+	 *
7942
+	 */
7943 7943
 	public function countAllMonths($filters = array())
7944 7944
 	{
7945 7945
 		global $globalTimezone, $globalDBdriver;
@@ -7981,11 +7981,11 @@  discard block
 block discarded – undo
7981 7981
 	}
7982 7982
 
7983 7983
 	/**
7984
-	* Counts all month
7985
-	*
7986
-	* @return Array the month list
7987
-	*
7988
-	*/
7984
+	 * Counts all month
7985
+	 *
7986
+	 * @return Array the month list
7987
+	 *
7988
+	 */
7989 7989
 	public function countAllMonthsByAirlines($filters = array())
7990 7990
 	{
7991 7991
 		global $globalTimezone, $globalDBdriver;
@@ -8030,11 +8030,11 @@  discard block
 block discarded – undo
8030 8030
 	}
8031 8031
 
8032 8032
 	/**
8033
-	* Counts all military month
8034
-	*
8035
-	* @return Array the month list
8036
-	*
8037
-	*/
8033
+	 * Counts all military month
8034
+	 *
8035
+	 * @return Array the month list
8036
+	 *
8037
+	 */
8038 8038
 	public function countAllMilitaryMonths($filters = array())
8039 8039
 	{
8040 8040
 		global $globalTimezone, $globalDBdriver;
@@ -8075,11 +8075,11 @@  discard block
 block discarded – undo
8075 8075
 	}
8076 8076
 	
8077 8077
 	/**
8078
-	* Counts all month owners
8079
-	*
8080
-	* @return Array the month list
8081
-	*
8082
-	*/
8078
+	 * Counts all month owners
8079
+	 *
8080
+	 * @return Array the month list
8081
+	 *
8082
+	 */
8083 8083
 	public function countAllMonthsOwners($filters = array())
8084 8084
 	{
8085 8085
 		global $globalTimezone, $globalDBdriver;
@@ -8121,11 +8121,11 @@  discard block
 block discarded – undo
8121 8121
 	}
8122 8122
 	
8123 8123
 	/**
8124
-	* Counts all month owners
8125
-	*
8126
-	* @return Array the month list
8127
-	*
8128
-	*/
8124
+	 * Counts all month owners
8125
+	 *
8126
+	 * @return Array the month list
8127
+	 *
8128
+	 */
8129 8129
 	public function countAllMonthsOwnersByAirlines($filters = array())
8130 8130
 	{
8131 8131
 		global $globalTimezone, $globalDBdriver;
@@ -8168,11 +8168,11 @@  discard block
 block discarded – undo
8168 8168
 	}
8169 8169
 
8170 8170
 	/**
8171
-	* Counts all month pilot
8172
-	*
8173
-	* @return Array the month list
8174
-	*
8175
-	*/
8171
+	 * Counts all month pilot
8172
+	 *
8173
+	 * @return Array the month list
8174
+	 *
8175
+	 */
8176 8176
 	public function countAllMonthsPilots($filters = array())
8177 8177
 	{
8178 8178
 		global $globalTimezone, $globalDBdriver;
@@ -8214,11 +8214,11 @@  discard block
 block discarded – undo
8214 8214
 	}
8215 8215
 	
8216 8216
 	/**
8217
-	* Counts all month pilot
8218
-	*
8219
-	* @return Array the month list
8220
-	*
8221
-	*/
8217
+	 * Counts all month pilot
8218
+	 *
8219
+	 * @return Array the month list
8220
+	 *
8221
+	 */
8222 8222
 	public function countAllMonthsPilotsByAirlines($filters = array())
8223 8223
 	{
8224 8224
 		global $globalTimezone, $globalDBdriver;
@@ -8261,11 +8261,11 @@  discard block
 block discarded – undo
8261 8261
 	}
8262 8262
 
8263 8263
 	/**
8264
-	* Counts all month airline
8265
-	*
8266
-	* @return Array the month list
8267
-	*
8268
-	*/
8264
+	 * Counts all month airline
8265
+	 *
8266
+	 * @return Array the month list
8267
+	 *
8268
+	 */
8269 8269
 	public function countAllMonthsAirlines($filters = array())
8270 8270
 	{
8271 8271
 		global $globalTimezone, $globalDBdriver;
@@ -8307,11 +8307,11 @@  discard block
 block discarded – undo
8307 8307
 	}
8308 8308
 	
8309 8309
 	/**
8310
-	* Counts all month aircraft
8311
-	*
8312
-	* @return Array the month list
8313
-	*
8314
-	*/
8310
+	 * Counts all month aircraft
8311
+	 *
8312
+	 * @return Array the month list
8313
+	 *
8314
+	 */
8315 8315
 	public function countAllMonthsAircrafts($filters = array())
8316 8316
 	{
8317 8317
 		global $globalTimezone, $globalDBdriver;
@@ -8354,11 +8354,11 @@  discard block
 block discarded – undo
8354 8354
 	
8355 8355
 
8356 8356
 	/**
8357
-	* Counts all month aircraft
8358
-	*
8359
-	* @return Array the month list
8360
-	*
8361
-	*/
8357
+	 * Counts all month aircraft
8358
+	 *
8359
+	 * @return Array the month list
8360
+	 *
8361
+	 */
8362 8362
 	public function countAllMonthsAircraftsByAirlines($filters = array())
8363 8363
 	{
8364 8364
 		global $globalTimezone, $globalDBdriver;
@@ -8401,11 +8401,11 @@  discard block
 block discarded – undo
8401 8401
 	}
8402 8402
 
8403 8403
 	/**
8404
-	* Counts all month real arrival
8405
-	*
8406
-	* @return Array the month list
8407
-	*
8408
-	*/
8404
+	 * Counts all month real arrival
8405
+	 *
8406
+	 * @return Array the month list
8407
+	 *
8408
+	 */
8409 8409
 	public function countAllMonthsRealArrivals($filters = array())
8410 8410
 	{
8411 8411
 		global $globalTimezone, $globalDBdriver;
@@ -8448,11 +8448,11 @@  discard block
 block discarded – undo
8448 8448
 	
8449 8449
 
8450 8450
 	/**
8451
-	* Counts all month real arrival
8452
-	*
8453
-	* @return Array the month list
8454
-	*
8455
-	*/
8451
+	 * Counts all month real arrival
8452
+	 *
8453
+	 * @return Array the month list
8454
+	 *
8455
+	 */
8456 8456
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
8457 8457
 	{
8458 8458
 		global $globalTimezone, $globalDBdriver;
@@ -8496,11 +8496,11 @@  discard block
 block discarded – undo
8496 8496
 	
8497 8497
 
8498 8498
 	/**
8499
-	* Counts all dates during the last year
8500
-	*
8501
-	* @return Array the date list
8502
-	*
8503
-	*/
8499
+	 * Counts all dates during the last year
8500
+	 *
8501
+	 * @return Array the date list
8502
+	 *
8503
+	 */
8504 8504
 	public function countAllMonthsLastYear($filters)
8505 8505
 	{
8506 8506
 		global $globalTimezone, $globalDBdriver;
@@ -8522,7 +8522,7 @@  discard block
 block discarded – undo
8522 8522
 			$query .= " GROUP BY year_name, month_name
8523 8523
 								ORDER BY year_name, month_name ASC";
8524 8524
 			$query_data = array(':offset' => $offset);
8525
-    		}
8525
+			}
8526 8526
 		
8527 8527
 		$sth = $this->db->prepare($query);
8528 8528
 		$sth->execute($query_data);
@@ -8545,11 +8545,11 @@  discard block
 block discarded – undo
8545 8545
 	
8546 8546
 	
8547 8547
 	/**
8548
-	* Counts all hours
8549
-	*
8550
-	* @return Array the hour list
8551
-	*
8552
-	*/
8548
+	 * Counts all hours
8549
+	 *
8550
+	 * @return Array the hour list
8551
+	 *
8552
+	 */
8553 8553
 	public function countAllHours($orderby,$filters = array())
8554 8554
 	{
8555 8555
 		global $globalTimezone, $globalDBdriver;
@@ -8610,11 +8610,11 @@  discard block
 block discarded – undo
8610 8610
 	}
8611 8611
 	
8612 8612
 	/**
8613
-	* Counts all hours
8614
-	*
8615
-	* @return Array the hour list
8616
-	*
8617
-	*/
8613
+	 * Counts all hours
8614
+	 *
8615
+	 * @return Array the hour list
8616
+	 *
8617
+	 */
8618 8618
 	public function countAllHoursByAirlines($orderby, $filters = array())
8619 8619
 	{
8620 8620
 		global $globalTimezone, $globalDBdriver;
@@ -8677,11 +8677,11 @@  discard block
 block discarded – undo
8677 8677
 
8678 8678
 
8679 8679
 	/**
8680
-	* Counts all hours by airline
8681
-	*
8682
-	* @return Array the hour list
8683
-	*
8684
-	*/
8680
+	 * Counts all hours by airline
8681
+	 *
8682
+	 * @return Array the hour list
8683
+	 *
8684
+	 */
8685 8685
 	public function countAllHoursByAirline($airline_icao, $filters = array())
8686 8686
 	{
8687 8687
 		global $globalTimezone, $globalDBdriver;
@@ -8727,11 +8727,11 @@  discard block
 block discarded – undo
8727 8727
 	
8728 8728
 	
8729 8729
 	/**
8730
-	* Counts all hours by aircraft
8731
-	*
8732
-	* @return Array the hour list
8733
-	*
8734
-	*/
8730
+	 * Counts all hours by aircraft
8731
+	 *
8732
+	 * @return Array the hour list
8733
+	 *
8734
+	 */
8735 8735
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
8736 8736
 	{
8737 8737
 		global $globalTimezone, $globalDBdriver;
@@ -8774,11 +8774,11 @@  discard block
 block discarded – undo
8774 8774
 	
8775 8775
 	
8776 8776
 	/**
8777
-	* Counts all hours by aircraft registration
8778
-	*
8779
-	* @return Array the hour list
8780
-	*
8781
-	*/
8777
+	 * Counts all hours by aircraft registration
8778
+	 *
8779
+	 * @return Array the hour list
8780
+	 *
8781
+	 */
8782 8782
 	public function countAllHoursByRegistration($registration, $filters = array())
8783 8783
 	{
8784 8784
 		global $globalTimezone, $globalDBdriver;
@@ -8821,11 +8821,11 @@  discard block
 block discarded – undo
8821 8821
 	
8822 8822
 	
8823 8823
 	/**
8824
-	* Counts all hours by airport
8825
-	*
8826
-	* @return Array the hour list
8827
-	*
8828
-	*/
8824
+	 * Counts all hours by airport
8825
+	 *
8826
+	 * @return Array the hour list
8827
+	 *
8828
+	 */
8829 8829
 	public function countAllHoursByAirport($airport_icao, $filters = array())
8830 8830
 	{
8831 8831
 		global $globalTimezone, $globalDBdriver;
@@ -8869,11 +8869,11 @@  discard block
 block discarded – undo
8869 8869
 	
8870 8870
 	
8871 8871
 	/**
8872
-	* Counts all hours by manufacturer
8873
-	*
8874
-	* @return Array the hour list
8875
-	*
8876
-	*/
8872
+	 * Counts all hours by manufacturer
8873
+	 *
8874
+	 * @return Array the hour list
8875
+	 *
8876
+	 */
8877 8877
 	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
8878 8878
 	{
8879 8879
 		global $globalTimezone, $globalDBdriver;
@@ -8917,11 +8917,11 @@  discard block
 block discarded – undo
8917 8917
 	
8918 8918
 	
8919 8919
 	/**
8920
-	* Counts all hours by date
8921
-	*
8922
-	* @return Array the hour list
8923
-	*
8924
-	*/
8920
+	 * Counts all hours by date
8921
+	 *
8922
+	 * @return Array the hour list
8923
+	 *
8924
+	 */
8925 8925
 	public function countAllHoursByDate($date, $filters = array())
8926 8926
 	{
8927 8927
 		global $globalTimezone, $globalDBdriver;
@@ -8965,11 +8965,11 @@  discard block
 block discarded – undo
8965 8965
 	
8966 8966
 	
8967 8967
 	/**
8968
-	* Counts all hours by a ident/callsign
8969
-	*
8970
-	* @return Array the hour list
8971
-	*
8972
-	*/
8968
+	 * Counts all hours by a ident/callsign
8969
+	 *
8970
+	 * @return Array the hour list
8971
+	 *
8972
+	 */
8973 8973
 	public function countAllHoursByIdent($ident, $filters = array())
8974 8974
 	{
8975 8975
 		global $globalTimezone, $globalDBdriver;
@@ -9014,11 +9014,11 @@  discard block
 block discarded – undo
9014 9014
 	
9015 9015
 	
9016 9016
 	/**
9017
-	* Counts all hours by route
9018
-	*
9019
-	* @return Array the hour list
9020
-	*
9021
-	*/
9017
+	 * Counts all hours by route
9018
+	 *
9019
+	 * @return Array the hour list
9020
+	 *
9021
+	 */
9022 9022
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
9023 9023
 	{
9024 9024
 		global $globalTimezone, $globalDBdriver;
@@ -9062,11 +9062,11 @@  discard block
 block discarded – undo
9062 9062
 	
9063 9063
 	
9064 9064
 	/**
9065
-	* Counts all hours by country
9066
-	*
9067
-	* @return Array the hour list
9068
-	*
9069
-	*/
9065
+	 * Counts all hours by country
9066
+	 *
9067
+	 * @return Array the hour list
9068
+	 *
9069
+	 */
9070 9070
 	public function countAllHoursByCountry($country, $filters = array())
9071 9071
 	{
9072 9072
 		global $globalTimezone, $globalDBdriver;
@@ -9111,11 +9111,11 @@  discard block
 block discarded – undo
9111 9111
 
9112 9112
 
9113 9113
 	/**
9114
-	* Counts all aircraft that have flown over
9115
-	*
9116
-	* @return Integer the number of aircrafts
9117
-	*
9118
-	*/
9114
+	 * Counts all aircraft that have flown over
9115
+	 *
9116
+	 * @return Integer the number of aircrafts
9117
+	 *
9118
+	 */
9119 9119
 	public function countOverallAircrafts($filters = array())
9120 9120
 	{
9121 9121
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9127,11 +9127,11 @@  discard block
 block discarded – undo
9127 9127
 	}
9128 9128
 
9129 9129
 	/**
9130
-	* Counts all flight that really arrival
9131
-	*
9132
-	* @return Integer the number of aircrafts
9133
-	*
9134
-	*/
9130
+	 * Counts all flight that really arrival
9131
+	 *
9132
+	 * @return Integer the number of aircrafts
9133
+	 *
9134
+	 */
9135 9135
 	public function countOverallArrival($filters = array())
9136 9136
 	{
9137 9137
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9144,11 +9144,11 @@  discard block
 block discarded – undo
9144 9144
 	}
9145 9145
 
9146 9146
 	/**
9147
-	* Counts all pilots that have flown over
9148
-	*
9149
-	* @return Integer the number of pilots
9150
-	*
9151
-	*/
9147
+	 * Counts all pilots that have flown over
9148
+	 *
9149
+	 * @return Integer the number of pilots
9150
+	 *
9151
+	 */
9152 9152
 	public function countOverallPilots($filters = array())
9153 9153
 	{
9154 9154
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9160,11 +9160,11 @@  discard block
 block discarded – undo
9160 9160
 	}
9161 9161
 
9162 9162
 	/**
9163
-	* Counts all owners that have flown over
9164
-	*
9165
-	* @return Integer the number of owners
9166
-	*
9167
-	*/
9163
+	 * Counts all owners that have flown over
9164
+	 *
9165
+	 * @return Integer the number of owners
9166
+	 *
9167
+	 */
9168 9168
 	public function countOverallOwners($filters = array())
9169 9169
 	{
9170 9170
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9177,11 +9177,11 @@  discard block
 block discarded – undo
9177 9177
 	
9178 9178
 	
9179 9179
 	/**
9180
-	* Counts all flights that have flown over
9181
-	*
9182
-	* @return Integer the number of flights
9183
-	*
9184
-	*/
9180
+	 * Counts all flights that have flown over
9181
+	 *
9182
+	 * @return Integer the number of flights
9183
+	 *
9184
+	 */
9185 9185
 	public function countOverallFlights($filters = array())
9186 9186
 	{
9187 9187
 		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
@@ -9194,11 +9194,11 @@  discard block
 block discarded – undo
9194 9194
 	}
9195 9195
 	
9196 9196
 	/**
9197
-	* Counts all military flights that have flown over
9198
-	*
9199
-	* @return Integer the number of flights
9200
-	*
9201
-	*/
9197
+	 * Counts all military flights that have flown over
9198
+	 *
9199
+	 * @return Integer the number of flights
9200
+	 *
9201
+	 */
9202 9202
 	public function countOverallMilitaryFlights($filters = array())
9203 9203
 	{
9204 9204
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9213,11 +9213,11 @@  discard block
 block discarded – undo
9213 9213
 	
9214 9214
 	
9215 9215
 	/**
9216
-	* Counts all airlines that have flown over
9217
-	*
9218
-	* @return Integer the number of airlines
9219
-	*
9220
-	*/
9216
+	 * Counts all airlines that have flown over
9217
+	 *
9218
+	 * @return Integer the number of airlines
9219
+	 *
9220
+	 */
9221 9221
 	public function countOverallAirlines($filters = array())
9222 9222
 	{
9223 9223
 		$query  = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
@@ -9231,11 +9231,11 @@  discard block
 block discarded – undo
9231 9231
 
9232 9232
   
9233 9233
 	/**
9234
-	* Counts all hours of today
9235
-	*
9236
-	* @return Array the hour list
9237
-	*
9238
-	*/
9234
+	 * Counts all hours of today
9235
+	 *
9236
+	 * @return Array the hour list
9237
+	 *
9238
+	 */
9239 9239
 	public function countAllHoursFromToday($filters = array())
9240 9240
 	{
9241 9241
 		global $globalTimezone, $globalDBdriver;
@@ -9275,11 +9275,11 @@  discard block
 block discarded – undo
9275 9275
 	}
9276 9276
     
9277 9277
 	/**
9278
-	* Gets all the spotter information based on calculated upcoming flights
9279
-	*
9280
-	* @return Array the spotter information
9281
-	*
9282
-	*/
9278
+	 * Gets all the spotter information based on calculated upcoming flights
9279
+	 *
9280
+	 * @return Array the spotter information
9281
+	 *
9282
+	 */
9283 9283
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
9284 9284
 	{
9285 9285
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -9354,12 +9354,12 @@  discard block
 block discarded – undo
9354 9354
 	}
9355 9355
     
9356 9356
     
9357
-     /**
9358
-	* Gets the Barrie Spotter ID based on the FlightAware ID
9359
-	*
9360
-	* @return Integer the Barrie Spotter ID
9357
+	 /**
9358
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
9359
+	  *
9360
+	  * @return Integer the Barrie Spotter ID
9361 9361
 q	*
9362
-	*/
9362
+	  */
9363 9363
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
9364 9364
 	{
9365 9365
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -9380,13 +9380,13 @@  discard block
 block discarded – undo
9380 9380
   
9381 9381
  
9382 9382
 	/**
9383
-	* Parses a date string
9384
-	*
9385
-	* @param String $dateString the date string
9386
-	* @param String $timezone the timezone of a user
9387
-	* @return Array the time information
9388
-	*
9389
-	*/
9383
+	 * Parses a date string
9384
+	 *
9385
+	 * @param String $dateString the date string
9386
+	 * @param String $timezone the timezone of a user
9387
+	 * @return Array the time information
9388
+	 *
9389
+	 */
9390 9390
 	public function parseDateString($dateString, $timezone = '')
9391 9391
 	{
9392 9392
 		$time_array = array();
@@ -9422,12 +9422,12 @@  discard block
 block discarded – undo
9422 9422
 	
9423 9423
 	
9424 9424
 	/**
9425
-	* Parses the direction degrees to working
9426
-	*
9427
-	* @param Float $direction the direction in degrees
9428
-	* @return Array the direction information
9429
-	*
9430
-	*/
9425
+	 * Parses the direction degrees to working
9426
+	 *
9427
+	 * @param Float $direction the direction in degrees
9428
+	 * @return Array the direction information
9429
+	 *
9430
+	 */
9431 9431
 	public function parseDirection($direction = 0)
9432 9432
 	{
9433 9433
 		if ($direction == '') $direction = 0;
@@ -9506,12 +9506,12 @@  discard block
 block discarded – undo
9506 9506
 	
9507 9507
 	
9508 9508
 	/**
9509
-	* Gets the aircraft registration
9510
-	*
9511
-	* @param String $flightaware_id the flight aware id
9512
-	* @return String the aircraft registration
9513
-	*
9514
-	*/
9509
+	 * Gets the aircraft registration
9510
+	 *
9511
+	 * @param String $flightaware_id the flight aware id
9512
+	 * @return String the aircraft registration
9513
+	 *
9514
+	 */
9515 9515
 	
9516 9516
 	public function getAircraftRegistration($flightaware_id)
9517 9517
 	{
@@ -9540,12 +9540,12 @@  discard block
 block discarded – undo
9540 9540
 
9541 9541
 
9542 9542
 	/**
9543
-	* Gets the aircraft registration from ModeS
9544
-	*
9545
-	* @param String $aircraft_modes the flight ModeS in hex
9546
-	* @return String the aircraft registration
9547
-	*
9548
-	*/
9543
+	 * Gets the aircraft registration from ModeS
9544
+	 *
9545
+	 * @param String $aircraft_modes the flight ModeS in hex
9546
+	 * @return String the aircraft registration
9547
+	 *
9548
+	 */
9549 9549
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
9550 9550
 	{
9551 9551
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9558,19 +9558,19 @@  discard block
 block discarded – undo
9558 9558
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9559 9559
 		$sth->closeCursor();
9560 9560
 		if (count($row) > 0) {
9561
-		    //return $row['Registration'];
9562
-		    return $row['registration'];
9561
+			//return $row['Registration'];
9562
+			return $row['registration'];
9563 9563
 		} else return '';
9564 9564
 	
9565 9565
 	}
9566 9566
 
9567 9567
 	/**
9568
-	* Gets the aircraft type from ModeS
9569
-	*
9570
-	* @param String $aircraft_modes the flight ModeS in hex
9571
-	* @return String the aircraft type
9572
-	*
9573
-	*/
9568
+	 * Gets the aircraft type from ModeS
9569
+	 *
9570
+	 * @param String $aircraft_modes the flight ModeS in hex
9571
+	 * @return String the aircraft type
9572
+	 *
9573
+	 */
9574 9574
 	public function getAircraftTypeBymodeS($aircraft_modes)
9575 9575
 	{
9576 9576
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9583,19 +9583,19 @@  discard block
 block discarded – undo
9583 9583
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9584 9584
 		$sth->closeCursor();
9585 9585
 		if (count($row) > 0) {
9586
-		    if ($row['type_flight'] == null) return '';
9587
-		    else return $row['type_flight'];
9586
+			if ($row['type_flight'] == null) return '';
9587
+			else return $row['type_flight'];
9588 9588
 		} else return '';
9589 9589
 	
9590 9590
 	}
9591 9591
 
9592 9592
 	/**
9593
-	* Gets Countrie from latitude/longitude
9594
-	*
9595
-	* @param Float $latitude latitute of the flight
9596
-	* @param Float $longitude longitute of the flight
9597
-	* @return String the countrie
9598
-	*/
9593
+	 * Gets Countrie from latitude/longitude
9594
+	 *
9595
+	 * @param Float $latitude latitute of the flight
9596
+	 * @param Float $longitude longitute of the flight
9597
+	 * @return String the countrie
9598
+	 */
9599 9599
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
9600 9600
 	{
9601 9601
 		global $globalDBdriver, $globalDebug;
@@ -9632,12 +9632,12 @@  discard block
 block discarded – undo
9632 9632
 	}
9633 9633
 
9634 9634
 	/**
9635
-	* converts the registration code using the country prefix
9636
-	*
9637
-	* @param String $registration the aircraft registration
9638
-	* @return String the aircraft registration
9639
-	*
9640
-	*/
9635
+	 * converts the registration code using the country prefix
9636
+	 *
9637
+	 * @param String $registration the aircraft registration
9638
+	 * @return String the aircraft registration
9639
+	 *
9640
+	 */
9641 9641
 	public function convertAircraftRegistration($registration)
9642 9642
 	{
9643 9643
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9689,12 +9689,12 @@  discard block
 block discarded – undo
9689 9689
 	}
9690 9690
 
9691 9691
 	/**
9692
-	* Country from the registration code
9693
-	*
9694
-	* @param String $registration the aircraft registration
9695
-	* @return String the country
9696
-	*
9697
-	*/
9692
+	 * Country from the registration code
9693
+	 *
9694
+	 * @param String $registration the aircraft registration
9695
+	 * @return String the country
9696
+	 *
9697
+	 */
9698 9698
 	public function countryFromAircraftRegistration($registration)
9699 9699
 	{
9700 9700
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9713,8 +9713,8 @@  discard block
 block discarded – undo
9713 9713
 				$country = $row['country'];
9714 9714
 			}
9715 9715
 		} else {
9716
-    			$registration_1 = substr($registration, 0, 1);
9717
-		        $registration_2 = substr($registration, 0, 2);
9716
+				$registration_1 = substr($registration, 0, 1);
9717
+				$registration_2 = substr($registration, 0, 2);
9718 9718
 
9719 9719
 			$country = '';
9720 9720
 			//first get the prefix based on two characters
@@ -9750,11 +9750,11 @@  discard block
 block discarded – undo
9750 9750
 	}
9751 9751
 	
9752 9752
 	/**
9753
-	* Set a new highlight value for a flight
9754
-	*
9755
-	* @param String $flightaware_id flightaware_id from spotter_output table
9756
-	* @param String $highlight New highlight value
9757
-	*/
9753
+	 * Set a new highlight value for a flight
9754
+	 *
9755
+	 * @param String $flightaware_id flightaware_id from spotter_output table
9756
+	 * @param String $highlight New highlight value
9757
+	 */
9758 9758
 	public function setHighlightFlight($flightaware_id,$highlight) {
9759 9759
 		
9760 9760
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -9763,12 +9763,12 @@  discard block
 block discarded – undo
9763 9763
 	}
9764 9764
 	
9765 9765
 	/**
9766
-	* Gets the short url from bit.ly
9767
-	*
9768
-	* @param String $url the full url
9769
-	* @return String the bit.ly url
9770
-	*
9771
-	*/
9766
+	 * Gets the short url from bit.ly
9767
+	 *
9768
+	 * @param String $url the full url
9769
+	 * @return String the bit.ly url
9770
+	 *
9771
+	 */
9772 9772
 	public function getBitlyURL($url)
9773 9773
 	{
9774 9774
 		global $globalBitlyAccessToken;
@@ -10057,11 +10057,11 @@  discard block
 block discarded – undo
10057 10057
 			$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 
10058 10058
 	                      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)) 
10059 10059
 	                      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;";
10060
-                } else {
10060
+				} else {
10061 10061
 			$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 
10062 10062
 	                      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)) 
10063 10063
 	                      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;";
10064
-    		}
10064
+			}
10065 10065
 		$sth = $this->db->prepare($query);
10066 10066
 		$sth->execute();
10067 10067
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
Spacing   +988 added lines, -988 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 require_once(dirname(__FILE__).'/class.Image.php');
5 5
 $global_query = "SELECT spotter_output.* FROM spotter_output";
6 6
 
7
-class Spotter{
7
+class Spotter {
8 8
 	public $db;
9 9
 	
10 10
 	public function __construct($dbc = null) {
@@ -17,15 +17,15 @@  discard block
 block discarded – undo
17 17
 	* @param Array $filter the filter
18 18
 	* @return Array the SQL part
19 19
 	*/
20
-	public function getFilter($filter = array(),$where = false,$and = false) {
20
+	public function getFilter($filter = array(), $where = false, $and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
22
-		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName],$filter);
23
-		if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter);
22
+		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName], $filter);
23
+		if (is_array($globalFilter)) $filter = array_merge($globalFilter, $filter);
24 24
 		$filter_query_join = '';
25 25
 		$filter_query_where = '';
26 26
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
27 27
 			if ($filter['airlines'][0] != '') {
28
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
28
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
29 29
 			}
30 30
 		}
31 31
 		
@@ -33,19 +33,19 @@  discard block
 block discarded – undo
33 33
 			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_output.flightaware_id ";
34 34
 		}
35 35
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
36
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
36
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
37 37
 		}
38 38
 		if (isset($filter['source']) && !empty($filter['source'])) {
39
-			$filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
39
+			$filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')";
40 40
 		}
41 41
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
42 42
 			$filter_query_where = " WHERE ident = '".$filter['ident']."'";
43 43
 		}
44 44
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
45 45
 			if ($filter_query_where == '') {
46
-				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
46
+				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
47 47
 			} else {
48
-				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
48
+				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
49 49
 			}
50 50
 		}
51 51
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 			$sth = $this->db->prepare($query.$limitQuery);
94 94
 			$sth->execute($params);
95 95
 		} catch (PDOException $e) {
96
-			printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery);
96
+			printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery);
97 97
 			exit();
98 98
 		}
99 99
 		
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		$spotter_array = array();
104 104
 		
105 105
 
106
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
106
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
107 107
 		{
108 108
 			$num_rows++;
109 109
 			$temp_array = array();
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 			if (isset($row['route_stop'])) {
149 149
 				$temp_array['route_stop'] = $row['route_stop'];
150 150
 				if ($row['route_stop'] != '') {
151
-					$allroute = explode(' ',$row['route_stop']);
151
+					$allroute = explode(' ', $row['route_stop']);
152 152
 			
153 153
 					foreach ($allroute as $route) {
154 154
 						$route_airport_array = $this->getAllAirportInfo($route);
@@ -203,11 +203,11 @@  discard block
 block discarded – undo
203 203
 				{
204 204
 					$temp_array['date'] = "about ".$dateArray['hours']." hours ago";
205 205
 				} else {
206
-					$temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC"));
206
+					$temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC"));
207 207
 				}
208 208
 				$temp_array['date_minutes_past'] = $dateArray['minutes'];
209
-				$temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC"));
210
-				$temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC"));
209
+				$temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC"));
210
+				$temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC"));
211 211
 				$temp_array['date_unix'] = strtotime($row['date']." UTC");
212 212
 			}
213 213
 			
@@ -241,9 +241,9 @@  discard block
 block discarded – undo
241 241
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
242 242
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
243 243
 					if (is_numeric(substr($row['ident'], 2, 1))) {
244
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2),$fromsource);
244
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2), $fromsource);
245 245
 					} elseif (is_numeric(substr($row['ident'], 3, 1))) {
246
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
246
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
247 247
 					} else {
248 248
 						$airline_array = $this->getAllAirlineInfo('NA');
249 249
 					}
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 				$temp_array['airline_type'] = $row['airline_type'];
270 270
 			}
271 271
 			if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') {
272
-				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'],3));
272
+				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'], 3));
273 273
 				//$acars_array = ACARS->getLiveAcarsData('BA40YL');
274 274
 				if (count($acars_array) > 0) {
275 275
 					$temp_array['acars'] = $acars_array;
@@ -286,11 +286,11 @@  discard block
 block discarded – undo
286 286
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
287 287
 			}
288 288
 
289
-			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
289
+			if ($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
290 290
 			{
291 291
 				if ($globalIVAO) {
292
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
293
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
292
+					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('', $temp_array['aircraft_type'], $temp_array['airline_icao']);
293
+					else $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type']);
294 294
 				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
295 295
 				if (count($image_array) > 0) {
296 296
 					$temp_array['image'] = $image_array[0]['image'];
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 			if (isset($row['arrival_airport_time']) && $row['arrival_airport_time'] != '') {
314 314
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
315 315
 			}
316
-			if ((!isset($globalIVAO) || ! $globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
316
+			if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
317 317
 				$schedule_array = $Schedule->getSchedule($temp_array['ident']);
318 318
 				//print_r($schedule_array);
319 319
 				if (count($schedule_array) > 0) {
@@ -394,12 +394,12 @@  discard block
 block discarded – undo
394 394
 			if (isset($row['squawk'])) {
395 395
 				$temp_array['squawk'] = $row['squawk'];
396 396
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
397
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
398
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
397
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['country_iso2']);
398
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
399 399
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
400
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
401
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
402
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
400
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['over_country']);
401
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
402
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
403 403
 			}
404 404
     			
405 405
 			$temp_array['query_number_rows'] = $num_rows;
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 	* @return Array the spotter information
419 419
 	*
420 420
 	*/
421
-	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 = '',$filter = array())
421
+	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 = '', $filter = array())
422 422
 	{
423 423
 		global $globalTimezone, $globalDBdriver;
424 424
 		require_once(dirname(__FILE__).'/class.Translation.php');
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 
429 429
 		$query_values = array();
430 430
 		$additional_query = '';
431
-		$filter_query = $this->getFilter($filter,true,true);
431
+		$filter_query = $this->getFilter($filter, true, true);
432 432
 		if ($q != "")
433 433
 		{
434 434
 			if (!is_string($q))
@@ -436,8 +436,8 @@  discard block
 block discarded – undo
436 436
 				return false;
437 437
 			} else {
438 438
 				$q_array = explode(" ", $q);
439
-				foreach ($q_array as $q_item){
440
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
439
+				foreach ($q_array as $q_item) {
440
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
441 441
 					$additional_query .= " AND (";
442 442
 					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
443 443
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
@@ -469,37 +469,37 @@  discard block
 block discarded – undo
469 469
 
470 470
 		if ($registration != "")
471 471
 		{
472
-			$registration = filter_var($registration,FILTER_SANITIZE_STRING);
472
+			$registration = filter_var($registration, FILTER_SANITIZE_STRING);
473 473
 			if (!is_string($registration))
474 474
 			{
475 475
 				return false;
476 476
 			} else {
477 477
 				$additional_query .= " AND spotter_output.registration = :registration";
478
-				$query_values = array_merge($query_values,array(':registration' => $registration));
478
+				$query_values = array_merge($query_values, array(':registration' => $registration));
479 479
 			}
480 480
 		}
481 481
 
482 482
 		if ($aircraft_icao != "")
483 483
 		{
484
-			$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
484
+			$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
485 485
 			if (!is_string($aircraft_icao))
486 486
 			{
487 487
 				return false;
488 488
 			} else {
489 489
 				$additional_query .= " AND spotter_output.aircraft_icao = :aircraft_icao";
490
-				$query_values = array_merge($query_values,array(':aircraft_icao' => $aircraft_icao));
490
+				$query_values = array_merge($query_values, array(':aircraft_icao' => $aircraft_icao));
491 491
 			}
492 492
 		}
493 493
 
494 494
 		if ($aircraft_manufacturer != "")
495 495
 		{
496
-			$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
496
+			$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
497 497
 			if (!is_string($aircraft_manufacturer))
498 498
 			{
499 499
 				return false;
500 500
 			} else {
501 501
 				$additional_query .= " AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer";
502
-				$query_values = array_merge($query_values,array(':aircraft_manufacturer' => $aircraft_manufacturer));
502
+				$query_values = array_merge($query_values, array(':aircraft_manufacturer' => $aircraft_manufacturer));
503 503
 			}
504 504
 		}
505 505
 
@@ -515,25 +515,25 @@  discard block
 block discarded – undo
515 515
 
516 516
 		if ($airline_icao != "")
517 517
 		{
518
-			$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
518
+			$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
519 519
 			if (!is_string($airline_icao))
520 520
 			{
521 521
 				return false;
522 522
 			} else {
523 523
 				$additional_query .= " AND spotter_output.airline_icao = :airline_icao";
524
-				$query_values = array_merge($query_values,array(':airline_icao' => $airline_icao));
524
+				$query_values = array_merge($query_values, array(':airline_icao' => $airline_icao));
525 525
 			}
526 526
 		}
527 527
 
528 528
 		if ($airline_country != "")
529 529
 		{
530
-			$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
530
+			$airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING);
531 531
 			if (!is_string($airline_country))
532 532
 			{
533 533
 				return false;
534 534
 			} else {
535 535
 				$additional_query .= " AND spotter_output.airline_country = :airline_country";
536
-				$query_values = array_merge($query_values,array(':airline_country' => $airline_country));
536
+				$query_values = array_merge($query_values, array(':airline_country' => $airline_country));
537 537
 			}
538 538
 		}
539 539
 
@@ -560,31 +560,31 @@  discard block
 block discarded – undo
560 560
 
561 561
 		if ($airport != "")
562 562
 		{
563
-			$airport = filter_var($airport,FILTER_SANITIZE_STRING);
563
+			$airport = filter_var($airport, FILTER_SANITIZE_STRING);
564 564
 			if (!is_string($airport))
565 565
 			{
566 566
 				return false;
567 567
 			} else {
568 568
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :airport OR spotter_output.arrival_airport_icao = :airport)";
569
-				$query_values = array_merge($query_values,array(':airport' => $airport));
569
+				$query_values = array_merge($query_values, array(':airport' => $airport));
570 570
 			}
571 571
 		}
572 572
 
573 573
 		if ($airport_country != "")
574 574
 		{
575
-			$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
575
+			$airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING);
576 576
 			if (!is_string($airport_country))
577 577
 			{
578 578
 				return false;
579 579
 			} else {
580 580
 				$additional_query .= " AND (spotter_output.departure_airport_country = :airport_country OR spotter_output.arrival_airport_country = :airport_country)";
581
-				$query_values = array_merge($query_values,array(':airport_country' => $airport_country));
581
+				$query_values = array_merge($query_values, array(':airport_country' => $airport_country));
582 582
 			}
583 583
 		}
584 584
     
585 585
 		if ($callsign != "")
586 586
 		{
587
-			$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
587
+			$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
588 588
 			if (!is_string($callsign))
589 589
 			{
590 590
 				return false;
@@ -592,79 +592,79 @@  discard block
 block discarded – undo
592 592
 				$translate = $Translation->ident2icao($callsign);
593 593
 				if ($translate != $callsign) {
594 594
 					$additional_query .= " AND (spotter_output.ident = :callsign OR spotter_output.ident = :translate)";
595
-					$query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate));
595
+					$query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate));
596 596
 				} else {
597 597
 					$additional_query .= " AND spotter_output.ident = :callsign";
598
-					$query_values = array_merge($query_values,array(':callsign' => $callsign));
598
+					$query_values = array_merge($query_values, array(':callsign' => $callsign));
599 599
 				}
600 600
 			}
601 601
 		}
602 602
 
603 603
 		if ($owner != "")
604 604
 		{
605
-			$owner = filter_var($owner,FILTER_SANITIZE_STRING);
605
+			$owner = filter_var($owner, FILTER_SANITIZE_STRING);
606 606
 			if (!is_string($owner))
607 607
 			{
608 608
 				return false;
609 609
 			} else {
610 610
 				$additional_query .= " AND spotter_output.owner_name = :owner";
611
-				$query_values = array_merge($query_values,array(':owner' => $owner));
611
+				$query_values = array_merge($query_values, array(':owner' => $owner));
612 612
 			}
613 613
 		}
614 614
 
615 615
 		if ($pilot_name != "")
616 616
 		{
617
-			$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
617
+			$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
618 618
 			if (!is_string($pilot_name))
619 619
 			{
620 620
 				return false;
621 621
 			} else {
622 622
 				$additional_query .= " AND spotter_output.pilot_name = :pilot_name";
623
-				$query_values = array_merge($query_values,array(':pilot_name' => $pilot_name));
623
+				$query_values = array_merge($query_values, array(':pilot_name' => $pilot_name));
624 624
 			}
625 625
 		}
626 626
 
627 627
 		if ($pilot_id != "")
628 628
 		{
629
-			$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
629
+			$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT);
630 630
 			if (!is_string($pilot_id))
631 631
 			{
632 632
 				return false;
633 633
 			} else {
634 634
 				$additional_query .= " AND spotter_output.pilot_id = :pilot_id";
635
-				$query_values = array_merge($query_values,array(':pilot_id' => $pilot_id));
635
+				$query_values = array_merge($query_values, array(':pilot_id' => $pilot_id));
636 636
 			}
637 637
 		}
638 638
 
639 639
 		if ($departure_airport_route != "")
640 640
 		{
641
-			$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
641
+			$departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING);
642 642
 			if (!is_string($departure_airport_route))
643 643
 			{
644 644
 				return false;
645 645
 			} else {
646 646
 				$additional_query .= " AND spotter_output.departure_airport_icao = :departure_airport_route";
647
-				$query_values = array_merge($query_values,array(':departure_airport_route' => $departure_airport_route));
647
+				$query_values = array_merge($query_values, array(':departure_airport_route' => $departure_airport_route));
648 648
 			}
649 649
 		}
650 650
 
651 651
 		if ($arrival_airport_route != "")
652 652
 		{
653
-			$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
653
+			$arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING);
654 654
 			if (!is_string($arrival_airport_route))
655 655
 			{
656 656
 				return false;
657 657
 			} else {
658 658
 				$additional_query .= " AND spotter_output.arrival_airport_icao = :arrival_airport_route";
659
-				$query_values = array_merge($query_values,array(':arrival_airport_route' => $arrival_airport_route));
659
+				$query_values = array_merge($query_values, array(':arrival_airport_route' => $arrival_airport_route));
660 660
 			}
661 661
 		}
662 662
 
663 663
 		if ($altitude != "")
664 664
 		{
665 665
 			$altitude_array = explode(",", $altitude);
666
-			$altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
667
-			$altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
666
+			$altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
667
+			$altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
668 668
 
669 669
 			if ($altitude_array[1] != "")
670 670
 			{                
@@ -680,8 +680,8 @@  discard block
 block discarded – undo
680 680
 		if ($date_posted != "")
681 681
 		{
682 682
 			$date_array = explode(",", $date_posted);
683
-			$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
684
-			$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
683
+			$date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
684
+			$date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
685 685
 
686 686
 			if ($globalTimezone != '') {
687 687
 				date_default_timezone_set($globalTimezone);
@@ -712,8 +712,8 @@  discard block
 block discarded – undo
712 712
 		{
713 713
 			$limit_array = explode(",", $limit);
714 714
 			
715
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
716
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
715
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
716
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
717 717
 			
718 718
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
719 719
 			{
@@ -742,23 +742,23 @@  discard block
 block discarded – undo
742 742
 
743 743
 
744 744
 		if ($origLat != "" && $origLon != "" && $dist != "") {
745
-			$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
745
+			$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
746 746
 
747 747
 			if ($globalDBdriver == 'mysql') {
748
-				$query="SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance 
748
+				$query = "SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance 
749 749
 						FROM spotter_output, spotter_archive".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND spotter_archive.longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and spotter_archive.latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
750 750
 						AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2)))) < $dist".$orderby_query;
751 751
 			} else {
752
-				$query="SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
752
+				$query = "SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
753 753
 						FROM spotter_output, spotter_archive".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
754 754
 						AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query.$orderby_query;
755 755
 			}
756 756
 		} else {		
757
-			$query  = "SELECT spotter_output.* FROM spotter_output ".$filter_query." spotter_output.ident <> '' 
757
+			$query = "SELECT spotter_output.* FROM spotter_output ".$filter_query." spotter_output.ident <> '' 
758 758
 					".$additional_query."
759 759
 					".$orderby_query;
760 760
 		}
761
-		$spotter_array = $this->getDataFromDB($query, $query_values,$limit_query);
761
+		$spotter_array = $this->getDataFromDB($query, $query_values, $limit_query);
762 762
 		return $spotter_array;
763 763
 	}
764 764
 	
@@ -781,8 +781,8 @@  discard block
 block discarded – undo
781 781
 		{
782 782
 			$limit_array = explode(",", $limit);
783 783
 			
784
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
785
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
784
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
785
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
786 786
 			
787 787
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
788 788
 			{
@@ -799,9 +799,9 @@  discard block
 block discarded – undo
799 799
 			$orderby_query = " ORDER BY spotter_output.date DESC";
800 800
 		}
801 801
 
802
-		$query  = $global_query.$filter_query." ".$orderby_query;
802
+		$query = $global_query.$filter_query." ".$orderby_query;
803 803
 
804
-		$spotter_array = $this->getDataFromDB($query, array(),$limit_query);
804
+		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
805 805
 
806 806
 		return $spotter_array;
807 807
 	}
@@ -847,34 +847,34 @@  discard block
 block discarded – undo
847 847
 			{
848 848
 				return false;
849 849
 			} else {
850
-				if ($interval == "30m"){
850
+				if ($interval == "30m") {
851 851
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) <= $this_output.date ';
852
-				} else if ($interval == "1h"){
852
+				} else if ($interval == "1h") {
853 853
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) <= $this_output.date ';
854
-				} else if ($interval == "3h"){
854
+				} else if ($interval == "3h") {
855 855
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 3 HOUR) <= $this_output.date ';
856
-				} else if ($interval == "6h"){
856
+				} else if ($interval == "6h") {
857 857
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 6 HOUR) <= $this_output.date ';
858
-				} else if ($interval == "12h"){
858
+				} else if ($interval == "12h") {
859 859
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 HOUR) <= $this_output.date ';
860
-				} else if ($interval == "24h"){
860
+				} else if ($interval == "24h") {
861 861
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 24 HOUR) <= $this_output.date ';
862
-				} else if ($interval == "7d"){
862
+				} else if ($interval == "7d") {
863 863
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) <= $this_output.date ';
864
-				} else if ($interval == "30d"){
864
+				} else if ($interval == "30d") {
865 865
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 DAY) <= $this_output.date ';
866 866
 				} 
867 867
 			}
868 868
 		}
869 869
 
870
-		$query  = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output 
870
+		$query = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output 
871 871
                    WHERE spotter_output.latitude <> '' 
872 872
 				   AND spotter_output.longitude <> '' 
873 873
                    ".$additional_query."
874 874
                    HAVING distance < :radius  
875 875
 				   ORDER BY distance";
876 876
 
877
-		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius),$limit_query);
877
+		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius), $limit_query);
878 878
 
879 879
 		return $spotter_array;
880 880
 	}
@@ -886,21 +886,21 @@  discard block
 block discarded – undo
886 886
 	* @return Array the spotter information
887 887
 	*
888 888
 	*/
889
-	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
889
+	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '', $filter = array())
890 890
 	{
891 891
 		global $global_query;
892 892
 		
893 893
 		date_default_timezone_set('UTC');
894 894
 
895
-		$filter_query = $this->getFilter($filter,true,true);
895
+		$filter_query = $this->getFilter($filter, true, true);
896 896
 
897 897
 		$limit_query = '';
898 898
 		if ($limit != "")
899 899
 		{
900 900
 			$limit_array = explode(",", $limit);
901 901
 			
902
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
903
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
902
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
903
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
904 904
 			
905 905
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
906 906
 			{
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
918 918
 		}
919 919
 
920
-		$query  = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
920
+		$query = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
921 921
 
922 922
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
923 923
 
@@ -936,15 +936,15 @@  discard block
 block discarded – undo
936 936
 		global $global_query;
937 937
 		
938 938
 		date_default_timezone_set('UTC');
939
-		$filter_query = $this->getFilter($filter,true,true);
939
+		$filter_query = $this->getFilter($filter, true, true);
940 940
 
941 941
 		$limit_query = '';
942 942
 		if ($limit != "")
943 943
 		{
944 944
 			$limit_array = explode(",", $limit);
945 945
 			
946
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
947
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
946
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
947
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
948 948
 			
949 949
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
950 950
 			{
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
962 962
 		}
963 963
 
964
-		$query  = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
964
+		$query = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
965 965
 
966 966
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
967 967
 
@@ -975,20 +975,20 @@  discard block
 block discarded – undo
975 975
 	* @return Array the spotter information
976 976
 	*
977 977
 	*/
978
-	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
978
+	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '', $filter = array())
979 979
 	{
980 980
 		global $global_query;
981 981
 		
982 982
 		date_default_timezone_set('UTC');
983
-		$filter_query = $this->getFilter($filter,true,true);
983
+		$filter_query = $this->getFilter($filter, true, true);
984 984
 		
985 985
 		$limit_query = '';
986 986
 		if ($limit != "")
987 987
 		{
988 988
 			$limit_array = explode(",", $limit);
989 989
 			
990
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
991
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
990
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
991
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
992 992
 			
993 993
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
994 994
 			{
@@ -1005,7 +1005,7 @@  discard block
 block discarded – undo
1005 1005
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1006 1006
 		}
1007 1007
 
1008
-		$query  = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1008
+		$query = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1009 1009
 
1010 1010
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1011 1011
 
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
 		
1026 1026
 		date_default_timezone_set('UTC');
1027 1027
 		
1028
-		$filter_query = $this->getFilter($filter,true,true);
1028
+		$filter_query = $this->getFilter($filter, true, true);
1029 1029
 		
1030 1030
 		$limit_query = '';
1031 1031
 		
@@ -1033,8 +1033,8 @@  discard block
 block discarded – undo
1033 1033
 		{
1034 1034
 			$limit_array = explode(",", $limit);
1035 1035
 			
1036
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1037
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1036
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1037
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1038 1038
 			
1039 1039
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1040 1040
 			{
@@ -1051,7 +1051,7 @@  discard block
 block discarded – undo
1051 1051
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1052 1052
 		}
1053 1053
 
1054
-		$query  = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1054
+		$query = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1055 1055
 
1056 1056
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1057 1057
 
@@ -1070,14 +1070,14 @@  discard block
 block discarded – undo
1070 1070
 		global $global_query;
1071 1071
 		
1072 1072
 		date_default_timezone_set('UTC');
1073
-		$filter_query = $this->getFilter($filter,true,true);
1073
+		$filter_query = $this->getFilter($filter, true, true);
1074 1074
 		$limit_query = '';
1075 1075
 		if ($limit != "")
1076 1076
 		{
1077 1077
 			$limit_array = explode(",", $limit);
1078 1078
 			
1079
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1080
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1079
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1080
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1081 1081
 			
1082 1082
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1083 1083
 			{
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1095 1095
 		}
1096 1096
 
1097
-		$query  = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1097
+		$query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1098 1098
 
1099 1099
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1100 1100
 
@@ -1118,9 +1118,9 @@  discard block
 block discarded – undo
1118 1118
 		$query_values = array(':id' => $id);
1119 1119
 
1120 1120
 		//$query  = $global_query." WHERE spotter_output.ident <> '' ".$additional_query." ";
1121
-		$query  = $global_query." WHERE ".$additional_query." ";
1121
+		$query = $global_query." WHERE ".$additional_query." ";
1122 1122
 
1123
-		$spotter_array = $this->getDataFromDB($query,$query_values);
1123
+		$spotter_array = $this->getDataFromDB($query, $query_values);
1124 1124
 
1125 1125
 		return $spotter_array;
1126 1126
 	}
@@ -1158,8 +1158,8 @@  discard block
 block discarded – undo
1158 1158
 		{
1159 1159
 			$limit_array = explode(",", $limit);
1160 1160
 			
1161
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1162
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1161
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1162
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1163 1163
 			
1164 1164
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1165 1165
 			{
@@ -1200,7 +1200,7 @@  discard block
 block discarded – undo
1200 1200
 		$query_values = array();
1201 1201
 		$limit_query = '';
1202 1202
 		$additional_query = '';
1203
-		$filter_query = $this->getFilter($filter,true,true);
1203
+		$filter_query = $this->getFilter($filter, true, true);
1204 1204
 		
1205 1205
 		if ($aircraft_type != "")
1206 1206
 		{
@@ -1217,8 +1217,8 @@  discard block
 block discarded – undo
1217 1217
 		{
1218 1218
 			$limit_array = explode(",", $limit);
1219 1219
 			
1220
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1221
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1220
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1221
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1222 1222
 			
1223 1223
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1224 1224
 			{
@@ -1258,7 +1258,7 @@  discard block
 block discarded – undo
1258 1258
 		$query_values = array();
1259 1259
 		$limit_query = '';
1260 1260
 		$additional_query = '';
1261
-		$filter_query = $this->getFilter($filter,true,true);
1261
+		$filter_query = $this->getFilter($filter, true, true);
1262 1262
 		
1263 1263
 		if ($registration != "")
1264 1264
 		{
@@ -1275,8 +1275,8 @@  discard block
 block discarded – undo
1275 1275
 		{
1276 1276
 			$limit_array = explode(",", $limit);
1277 1277
 			
1278
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1279
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1278
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1279
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1280 1280
 			
1281 1281
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1282 1282
 			{
@@ -1334,8 +1334,8 @@  discard block
 block discarded – undo
1334 1334
 		{
1335 1335
 			$limit_array = explode(",", $limit);
1336 1336
 			
1337
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1338
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1337
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1338
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1339 1339
 			
1340 1340
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1341 1341
 			{
@@ -1389,8 +1389,8 @@  discard block
 block discarded – undo
1389 1389
 		{
1390 1390
 			$limit_array = explode(",", $limit);
1391 1391
 			
1392
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1393
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1392
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1393
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1394 1394
 			
1395 1395
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1396 1396
 			{
@@ -1422,7 +1422,7 @@  discard block
 block discarded – undo
1422 1422
 	* @return Array the spotter information
1423 1423
 	*
1424 1424
 	*/
1425
-	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1425
+	public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array())
1426 1426
 	{
1427 1427
 		global $global_query, $globalTimezone, $globalDBdriver;
1428 1428
 		
@@ -1432,19 +1432,19 @@  discard block
 block discarded – undo
1432 1432
 
1433 1433
 		$filter_query = '';
1434 1434
 		if (isset($filter['source']) && !empty($filter['source'])) {
1435
-			$filter_query = " AND format_source IN ('".implode("','",$filter['source'])."')";
1435
+			$filter_query = " AND format_source IN ('".implode("','", $filter['source'])."')";
1436 1436
 		}
1437 1437
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
1438
-			$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
1438
+			$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
1439 1439
 		}
1440 1440
 		if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
1441 1441
 			$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id ";
1442 1442
 		}
1443 1443
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
1444
-			$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
1444
+			$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
1445 1445
 		}
1446 1446
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
1447
-			$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
1447
+			$filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
1448 1448
 		}
1449 1449
 	
1450 1450
 		
@@ -1472,8 +1472,8 @@  discard block
 block discarded – undo
1472 1472
 		{
1473 1473
 			$limit_array = explode(",", $limit);
1474 1474
 			
1475
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1476
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1475
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1476
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1477 1477
 			
1478 1478
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1479 1479
 			{
@@ -1528,8 +1528,8 @@  discard block
 block discarded – undo
1528 1528
 		{
1529 1529
 			$limit_array = explode(",", $limit);
1530 1530
 			
1531
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1532
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1531
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1532
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1533 1533
 			
1534 1534
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1535 1535
 			{
@@ -1585,8 +1585,8 @@  discard block
 block discarded – undo
1585 1585
 		{
1586 1586
 			$limit_array = explode(",", $limit);
1587 1587
 			
1588
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1589
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1588
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1589
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1590 1590
 			
1591 1591
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1592 1592
 			{
@@ -1634,7 +1634,7 @@  discard block
 block discarded – undo
1634 1634
 			{
1635 1635
 				return false;
1636 1636
 			} else {
1637
-				$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1637
+				$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1638 1638
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)";
1639 1639
 				$query_values = array(':departure_airport_icao' => $departure_airport_icao);
1640 1640
 			}
@@ -1646,9 +1646,9 @@  discard block
 block discarded – undo
1646 1646
 			{
1647 1647
 				return false;
1648 1648
 			} else {
1649
-				$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1649
+				$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1650 1650
 				$additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)";
1651
-				$query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao));
1651
+				$query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao));
1652 1652
 			}
1653 1653
 		}
1654 1654
 		
@@ -1656,8 +1656,8 @@  discard block
 block discarded – undo
1656 1656
 		{
1657 1657
 			$limit_array = explode(",", $limit);
1658 1658
 			
1659
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1660
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1659
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1660
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1661 1661
 			
1662 1662
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1663 1663
 			{
@@ -1696,15 +1696,15 @@  discard block
 block discarded – undo
1696 1696
 		global $global_query;
1697 1697
 		
1698 1698
 		date_default_timezone_set('UTC');
1699
-		$filter_query = $this->getFilter($filter,true,true);
1699
+		$filter_query = $this->getFilter($filter, true, true);
1700 1700
 		$limit_query = '';
1701 1701
 		
1702 1702
 		if ($limit != "")
1703 1703
 		{
1704 1704
 			$limit_array = explode(",", $limit);
1705 1705
 			
1706
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1707
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1706
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1707
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1708 1708
 			
1709 1709
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1710 1710
 			{
@@ -1721,7 +1721,7 @@  discard block
 block discarded – undo
1721 1721
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1722 1722
 		}
1723 1723
 
1724
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1724
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1725 1725
 
1726 1726
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1727 1727
 
@@ -1734,19 +1734,19 @@  discard block
 block discarded – undo
1734 1734
 	* @return String the highlight text
1735 1735
 	*
1736 1736
 	*/
1737
-	public function getHighlightByRegistration($registration,$filter = array())
1737
+	public function getHighlightByRegistration($registration, $filter = array())
1738 1738
 	{
1739 1739
 		global $global_query;
1740 1740
 		
1741 1741
 		date_default_timezone_set('UTC');
1742
-		$filter_query = $this->getFilter($filter,true,true);
1743
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
1742
+		$filter_query = $this->getFilter($filter, true, true);
1743
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
1744 1744
 		
1745
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1745
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1746 1746
 		$sth = $this->db->prepare($query);
1747 1747
 		$sth->execute(array(':registration' => $registration));
1748 1748
 
1749
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1749
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1750 1750
 		{
1751 1751
 			$highlight = $row['highlight'];
1752 1752
 		}
@@ -1762,14 +1762,14 @@  discard block
 block discarded – undo
1762 1762
 	* @return String usage
1763 1763
 	*
1764 1764
 	*/
1765
-	public function getSquawkUsage($squawk = '',$country = 'FR')
1765
+	public function getSquawkUsage($squawk = '', $country = 'FR')
1766 1766
 	{
1767 1767
 		
1768
-		$squawk = filter_var($squawk,FILTER_SANITIZE_STRING);
1769
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
1768
+		$squawk = filter_var($squawk, FILTER_SANITIZE_STRING);
1769
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
1770 1770
 
1771 1771
 		$query  = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1";
1772
-		$query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country);
1772
+		$query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country);
1773 1773
 		
1774 1774
 		$sth = $this->db->prepare($query);
1775 1775
 		$sth->execute($query_values);
@@ -1791,9 +1791,9 @@  discard block
 block discarded – undo
1791 1791
 	public function getAirportIcao($airport_iata = '')
1792 1792
 	{
1793 1793
 		
1794
-		$airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING);
1794
+		$airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING);
1795 1795
 
1796
-		$query  = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1796
+		$query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1797 1797
 		$query_values = array(':airport' => $airport_iata);
1798 1798
 		
1799 1799
 		$sth = $this->db->prepare($query);
@@ -1815,12 +1815,12 @@  discard block
 block discarded – undo
1815 1815
 	* @return Float distance to the airport
1816 1816
 	*
1817 1817
 	*/
1818
-	public function getAirportDistance($airport_icao,$latitude,$longitude)
1818
+	public function getAirportDistance($airport_icao, $latitude, $longitude)
1819 1819
 	{
1820 1820
 		
1821
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
1821
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
1822 1822
 
1823
-		$query  = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
1823
+		$query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
1824 1824
 		$query_values = array(':airport' => $airport_icao);
1825 1825
 		$sth = $this->db->prepare($query);
1826 1826
 		$sth->execute($query_values);
@@ -1830,7 +1830,7 @@  discard block
 block discarded – undo
1830 1830
 			$airport_latitude = $row['latitude'];
1831 1831
 			$airport_longitude = $row['longitude'];
1832 1832
 			$Common = new Common();
1833
-			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
1833
+			return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude);
1834 1834
 		} else return '';
1835 1835
 	}
1836 1836
 	
@@ -1844,11 +1844,11 @@  discard block
 block discarded – undo
1844 1844
 	public function getAllAirportInfo($airport = '')
1845 1845
 	{
1846 1846
 		
1847
-		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
1847
+		$airport = filter_var($airport, FILTER_SANITIZE_STRING);
1848 1848
 
1849 1849
 		$query_values = array();
1850 1850
 		if ($airport == 'NA') {
1851
-			return array(array('name' => 'Not available','city' => 'N/A', 'country' => 'N/A','iata' => 'NA','icao' => 'NA','altitude' => NULL,'latitude' => 0,'longitude' => 0,'type' => 'NA','home_link' => '','wikipedia_link' => '','image_thumb' => '', 'image' => ''));
1851
+			return array(array('name' => 'Not available', 'city' => 'N/A', 'country' => 'N/A', 'iata' => 'NA', 'icao' => 'NA', 'altitude' => NULL, 'latitude' => 0, 'longitude' => 0, 'type' => 'NA', 'home_link' => '', 'wikipedia_link' => '', 'image_thumb' => '', 'image' => ''));
1852 1852
 		} elseif ($airport == '') {
1853 1853
 			$query  = "SELECT airport.name, airport.city, airport.country, airport.iata, airport.icao, airport.latitude, airport.longitude, airport.altitude, airport.type, airport.home_link, airport.wikipedia_link, airport.image_thumb, airport.image FROM airport";
1854 1854
 		} else {
@@ -1896,14 +1896,14 @@  discard block
 block discarded – undo
1896 1896
 	{
1897 1897
 		$lst_countries = '';
1898 1898
 		foreach ($countries as $country) {
1899
-			$country = filter_var($country,FILTER_SANITIZE_STRING);
1899
+			$country = filter_var($country, FILTER_SANITIZE_STRING);
1900 1900
 			if ($lst_countries == '') {
1901 1901
 				$lst_countries = "'".$country."'";
1902 1902
 			} else {
1903 1903
 				$lst_countries .= ",'".$country."'";
1904 1904
 			}
1905 1905
 		}
1906
-		$query  = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
1906
+		$query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
1907 1907
 		
1908 1908
 		$sth = $this->db->prepare($query);
1909 1909
 		$sth->execute();
@@ -1911,7 +1911,7 @@  discard block
 block discarded – undo
1911 1911
 		$airport_array = array();
1912 1912
 		$temp_array = array();
1913 1913
 		
1914
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1914
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1915 1915
 		{
1916 1916
 			$temp_array['name'] = $row['name'];
1917 1917
 			$temp_array['city'] = $row['city'];
@@ -1939,10 +1939,10 @@  discard block
 block discarded – undo
1939 1939
 	{
1940 1940
 		global $globalDBdriver;
1941 1941
 		if (is_array($coord)) {
1942
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1943
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1944
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1945
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1942
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1943
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1944
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1945
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1946 1946
 		} else return array();
1947 1947
 		if ($globalDBdriver == 'mysql') {
1948 1948
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
@@ -1954,7 +1954,7 @@  discard block
 block discarded – undo
1954 1954
     
1955 1955
 		$airport_array = array();
1956 1956
 		
1957
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1957
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1958 1958
 		{
1959 1959
 			$temp_array = $row;
1960 1960
 
@@ -1974,13 +1974,13 @@  discard block
 block discarded – undo
1974 1974
 	public function getAllWaypointsInfobyCoord($coord)
1975 1975
 	{
1976 1976
 		if (is_array($coord)) {
1977
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1978
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1979
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1980
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1977
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1978
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1979
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1980
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1981 1981
 		} else return array();
1982 1982
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
1983
-		$query  = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")";
1983
+		$query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")";
1984 1984
 		//$query  = "SELECT waypoints.* FROM waypoints";
1985 1985
 		//$query  = "SELECT waypoints.* FROM waypoints INNER JOIN (SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") w ON w.name_end = waypoints.name_begin OR w.name_begin = waypoints.name_begin OR w.name_begin = waypoints.name_end OR w.name_end = waypoints.name_end";
1986 1986
 		//$query = "SELECT * FROM waypoints LEFT JOIN waypoints w ON waypoints.name_end = w.name_begin WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
@@ -1992,7 +1992,7 @@  discard block
 block discarded – undo
1992 1992
     
1993 1993
 		$waypoints_array = array();
1994 1994
 		
1995
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1995
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1996 1996
 		{
1997 1997
 			$temp_array = $row;
1998 1998
 
@@ -2014,10 +2014,10 @@  discard block
 block discarded – undo
2014 2014
 	{
2015 2015
 		global $globalUseRealAirlines;
2016 2016
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2017
-		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2017
+		$airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING));
2018 2018
 		if ($airline_icao == 'NA') {
2019 2019
 			$airline_array = array();
2020
-			$airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2020
+			$airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2021 2021
 			return $airline_array;
2022 2022
 		} else {
2023 2023
 			if (strlen($airline_icao) == 2) {
@@ -2038,7 +2038,7 @@  discard block
 block discarded – undo
2038 2038
 			if ($fromsource === NULL) {
2039 2039
 				$sth->execute(array(':airline_icao' => $airline_icao));
2040 2040
 			} else {
2041
-				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2041
+				$sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource));
2042 2042
 			}
2043 2043
                         /*
2044 2044
 			$airline_array = array();
@@ -2080,12 +2080,12 @@  discard block
 block discarded – undo
2080 2080
 	*/
2081 2081
 	public function getAllAircraftInfo($aircraft_type)
2082 2082
 	{
2083
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2083
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2084 2084
 
2085 2085
 		if ($aircraft_type == 'NA') {
2086
-			return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2086
+			return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2087 2087
 		}
2088
-		$query  = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow FROM aircraft WHERE aircraft.icao = :aircraft_type";
2088
+		$query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow FROM aircraft WHERE aircraft.icao = :aircraft_type";
2089 2089
 		
2090 2090
 		$sth = $this->db->prepare($query);
2091 2091
 		$sth->execute(array(':aircraft_type' => $aircraft_type));
@@ -2117,7 +2117,7 @@  discard block
 block discarded – undo
2117 2117
 	*/
2118 2118
 	public function getAircraftIcao($aircraft_type)
2119 2119
 	{
2120
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2120
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2121 2121
 		$all_aircraft = array('737-300' => 'B733',
2122 2122
 				'777-200' => 'B772',
2123 2123
 				'777-200ER' => 'B772',
@@ -2129,10 +2129,10 @@  discard block
 block discarded – undo
2129 2129
 				'A380' => 'A388');
2130 2130
 		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2131 2131
 
2132
-		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2132
+		$query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2133 2133
 		$aircraft_type = strtoupper($aircraft_type);
2134 2134
 		$sth = $this->db->prepare($query);
2135
-		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2135
+		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,));
2136 2136
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2137 2137
 		if (isset($result[0]['icao'])) return $result[0]['icao'];
2138 2138
 		else return '';
@@ -2147,9 +2147,9 @@  discard block
 block discarded – undo
2147 2147
 	*/
2148 2148
 	public function getAllAircraftType($aircraft_modes)
2149 2149
 	{
2150
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
2150
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
2151 2151
 
2152
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
2152
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
2153 2153
 		
2154 2154
 		$sth = $this->db->prepare($query);
2155 2155
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -2170,8 +2170,8 @@  discard block
 block discarded – undo
2170 2170
 	*/
2171 2171
 	public function getOperator($operator)
2172 2172
 	{
2173
-		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
2174
-		$query  = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2173
+		$operator = filter_var($operator, FILTER_SANITIZE_STRING);
2174
+		$query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2175 2175
 		
2176 2176
 		$sth = $this->db->prepare($query);
2177 2177
 		$sth->execute(array(':operator' => $operator));
@@ -2192,9 +2192,9 @@  discard block
 block discarded – undo
2192 2192
 	*/
2193 2193
 	public function getRouteInfo($callsign)
2194 2194
 	{
2195
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2195
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
2196 2196
                 if ($callsign == '') return array();
2197
-		$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";
2197
+		$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";
2198 2198
 		
2199 2199
 		$sth = $this->db->prepare($query);
2200 2200
 		$sth->execute(array(':callsign' => $callsign));
@@ -2215,9 +2215,9 @@  discard block
 block discarded – undo
2215 2215
 	*/
2216 2216
 	public function getAircraftInfoByRegistration($registration)
2217 2217
 	{
2218
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2218
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2219 2219
 
2220
-		$query  = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration";
2220
+		$query = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration";
2221 2221
 		
2222 2222
 		$sth = $this->db->prepare($query);
2223 2223
 		$sth->execute(array(':registration' => $registration));
@@ -2225,7 +2225,7 @@  discard block
 block discarded – undo
2225 2225
 		$aircraft_array = array();
2226 2226
 		$temp_array = array();
2227 2227
 		
2228
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2228
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2229 2229
 		{
2230 2230
 			$temp_array['airline_icao'] = $row['airline_icao'];
2231 2231
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -2247,7 +2247,7 @@  discard block
 block discarded – undo
2247 2247
 	*/
2248 2248
 	public function getAircraftOwnerByRegistration($registration)
2249 2249
 	{
2250
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2250
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2251 2251
 		$Connection = new Connection($this->db);
2252 2252
 		if ($Connection->tableExists('aircraft_owner')) {
2253 2253
 			$query  = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1";
@@ -2269,7 +2269,7 @@  discard block
 block discarded – undo
2269 2269
 	public function getAllFlightsforSitemap()
2270 2270
 	{
2271 2271
 		//$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 ";
2272
-		$query  = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2272
+		$query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2273 2273
 		
2274 2274
 		$sth = $this->db->prepare($query);
2275 2275
 		$sth->execute();
@@ -2316,7 +2316,7 @@  discard block
 block discarded – undo
2316 2316
 		$manufacturer_array = array();
2317 2317
 		$temp_array = array();
2318 2318
 		
2319
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2319
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2320 2320
 		{
2321 2321
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
2322 2322
 
@@ -2342,7 +2342,7 @@  discard block
 block discarded – undo
2342 2342
 								ORDER BY spotter_output.aircraft_name ASC";
2343 2343
 								
2344 2344
 		*/
2345
-		$filter_query = $this->getFilter($filters,true,true);
2345
+		$filter_query = $this->getFilter($filters, true, true);
2346 2346
 		$query = "SELECT DISTINCT icao AS aircraft_icao, type AS aircraft_name, manufacturer AS aircraft_manufacturer FROM aircraft".$filter_query." icao <> '' ORDER BY aircraft_manufacturer ASC";
2347 2347
 		
2348 2348
 		$sth = $this->db->prepare($query);
@@ -2351,7 +2351,7 @@  discard block
 block discarded – undo
2351 2351
 		$aircraft_array = array();
2352 2352
 		$temp_array = array();
2353 2353
 		
2354
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2354
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2355 2355
 		{
2356 2356
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
2357 2357
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
@@ -2372,8 +2372,8 @@  discard block
 block discarded – undo
2372 2372
 	*/
2373 2373
 	public function getAllAircraftRegistrations($filters = array())
2374 2374
 	{
2375
-		$filter_query = $this->getFilter($filters,true,true);
2376
-		$query  = "SELECT DISTINCT spotter_output.registration 
2375
+		$filter_query = $this->getFilter($filters, true, true);
2376
+		$query = "SELECT DISTINCT spotter_output.registration 
2377 2377
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' 
2378 2378
 				ORDER BY spotter_output.registration ASC";
2379 2379
 
@@ -2383,7 +2383,7 @@  discard block
 block discarded – undo
2383 2383
 		$aircraft_array = array();
2384 2384
 		$temp_array = array();
2385 2385
 		
2386
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2386
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2387 2387
 		{
2388 2388
 			$temp_array['registration'] = $row['registration'];
2389 2389
 
@@ -2400,11 +2400,11 @@  discard block
 block discarded – undo
2400 2400
 	* @return Array list of source name
2401 2401
 	*
2402 2402
 	*/
2403
-	public function getAllSourceName($type = '',$filters = array())
2403
+	public function getAllSourceName($type = '', $filters = array())
2404 2404
 	{
2405
-		$filter_query = $this->getFilter($filters,true,true);
2405
+		$filter_query = $this->getFilter($filters, true, true);
2406 2406
 		$query_values = array();
2407
-		$query  = "SELECT DISTINCT spotter_output.source_name 
2407
+		$query = "SELECT DISTINCT spotter_output.source_name 
2408 2408
 				FROM spotter_output".$filter_query." spotter_output.source_name <> ''";
2409 2409
 		if ($type != '') {
2410 2410
 			$query_values = array(':type' => $type);
@@ -2419,7 +2419,7 @@  discard block
 block discarded – undo
2419 2419
 		$source_array = array();
2420 2420
 		$temp_array = array();
2421 2421
 		
2422
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2422
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2423 2423
 		{
2424 2424
 			$temp_array['source_name'] = $row['source_name'];
2425 2425
 			$source_array[] = $temp_array;
@@ -2435,11 +2435,11 @@  discard block
 block discarded – undo
2435 2435
 	* @return Array list of airline names
2436 2436
 	*
2437 2437
 	*/
2438
-	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2438
+	public function getAllAirlineNames($airline_type = '', $forsource = NULL, $filters = array())
2439 2439
 	{
2440
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2441
-		$filter_query = $this->getFilter($filters,true,true);
2442
-		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
2440
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2441
+		$filter_query = $this->getFilter($filters, true, true);
2442
+		$airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
2443 2443
 		if ($airline_type == '' || $airline_type == 'all') {
2444 2444
 			/*
2445 2445
 			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
@@ -2458,7 +2458,7 @@  discard block
 block discarded – undo
2458 2458
 				$query_data = array(':forsource' => $forsource);
2459 2459
 			}
2460 2460
 		} else {
2461
-			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2461
+			$query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2462 2462
 					FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
2463 2463
 					AND spotter_output.airline_type = :airline_type 
2464 2464
 					ORDER BY spotter_output.airline_icao ASC";
@@ -2471,7 +2471,7 @@  discard block
 block discarded – undo
2471 2471
 		$airline_array = array();
2472 2472
 		$temp_array = array();
2473 2473
 		
2474
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2474
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2475 2475
 		{
2476 2476
 			$temp_array['airline_icao'] = $row['airline_icao'];
2477 2477
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -2491,8 +2491,8 @@  discard block
 block discarded – undo
2491 2491
 	*/
2492 2492
 	public function getAllAirlineCountries($filters = array())
2493 2493
 	{
2494
-		$filter_query = $this->getFilter($filters,true,true);
2495
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2494
+		$filter_query = $this->getFilter($filters, true, true);
2495
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2496 2496
 				FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2497 2497
 				ORDER BY spotter_output.airline_country ASC";
2498 2498
 		
@@ -2503,7 +2503,7 @@  discard block
 block discarded – undo
2503 2503
 		$airline_array = array();
2504 2504
 		$temp_array = array();
2505 2505
 		
2506
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2506
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2507 2507
 		{
2508 2508
 			$temp_array['airline_country'] = $row['airline_country'];
2509 2509
 
@@ -2523,9 +2523,9 @@  discard block
 block discarded – undo
2523 2523
 	*/
2524 2524
 	public function getAllAirportNames($filters = array())
2525 2525
 	{
2526
-		$filter_query = $this->getFilter($filters,true,true);
2526
+		$filter_query = $this->getFilter($filters, true, true);
2527 2527
 		$airport_array = array();
2528
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country
2528
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country
2529 2529
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' 
2530 2530
 				ORDER BY spotter_output.departure_airport_city ASC";
2531 2531
 		
@@ -2534,7 +2534,7 @@  discard block
 block discarded – undo
2534 2534
 		$sth->execute();
2535 2535
 
2536 2536
 		$temp_array = array();
2537
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2537
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2538 2538
 		{
2539 2539
 			$temp_array['airport_icao'] = $row['airport_icao'];
2540 2540
 			$temp_array['airport_name'] = $row['airport_name'];
@@ -2544,14 +2544,14 @@  discard block
 block discarded – undo
2544 2544
 			$airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array;
2545 2545
 		}
2546 2546
 
2547
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country
2547
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country
2548 2548
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' 
2549 2549
 								ORDER BY spotter_output.arrival_airport_city ASC";
2550 2550
 					
2551 2551
 		$sth = $this->db->prepare($query);
2552 2552
 		$sth->execute();
2553 2553
 
2554
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2554
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2555 2555
 			{
2556 2556
 		//	if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao'])
2557 2557
 		//	{
@@ -2591,21 +2591,21 @@  discard block
 block discarded – undo
2591 2591
    
2592 2592
 		$temp_array = array();
2593 2593
 		
2594
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2594
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2595 2595
 		{
2596 2596
 			$temp_array['airport_country'] = $row['airport_country'];
2597 2597
 
2598 2598
 			$airport_array[$row['airport_country']] = $temp_array;
2599 2599
 		}
2600
-		$filter_query = $this->getFilter($filters,true,true);
2601
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2600
+		$filter_query = $this->getFilter($filters, true, true);
2601
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2602 2602
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2603 2603
 								ORDER BY spotter_output.arrival_airport_country ASC";
2604 2604
 					
2605 2605
 		$sth = $this->db->prepare($query);
2606 2606
 		$sth->execute();
2607 2607
 		
2608
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2608
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2609 2609
 		{
2610 2610
 			if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country'])
2611 2611
 			{
@@ -2628,9 +2628,9 @@  discard block
 block discarded – undo
2628 2628
 	*/
2629 2629
 	public function getAllCountries($filters = array())
2630 2630
 	{
2631
-		$Connection= new Connection($this->db);
2631
+		$Connection = new Connection($this->db);
2632 2632
 		if ($Connection->tableExists('countries')) {
2633
-			$query  = "SELECT countries.name AS airport_country
2633
+			$query = "SELECT countries.name AS airport_country
2634 2634
 				FROM countries
2635 2635
 				ORDER BY countries.name ASC";
2636 2636
 			$sth = $this->db->prepare($query);
@@ -2639,14 +2639,14 @@  discard block
 block discarded – undo
2639 2639
 			$temp_array = array();
2640 2640
 			$country_array = array();
2641 2641
 		
2642
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2642
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2643 2643
 			{
2644 2644
 				$temp_array['country'] = $row['airport_country'];
2645 2645
 				$country_array[$row['airport_country']] = $temp_array;
2646 2646
 			}
2647 2647
 		} else {
2648
-			$filter_query = $this->getFilter($filters,true,true);
2649
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2648
+			$filter_query = $this->getFilter($filters, true, true);
2649
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2650 2650
 								FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' 
2651 2651
 								ORDER BY spotter_output.departure_airport_country ASC";
2652 2652
 
@@ -2655,20 +2655,20 @@  discard block
 block discarded – undo
2655 2655
    
2656 2656
 			$temp_array = array();
2657 2657
 			$country_array = array();
2658
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2658
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2659 2659
 			{
2660 2660
 				$temp_array['country'] = $row['airport_country'];
2661 2661
 				$country_array[$row['airport_country']] = $temp_array;
2662 2662
 			}
2663 2663
 
2664
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2664
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2665 2665
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2666 2666
 								ORDER BY spotter_output.arrival_airport_country ASC";
2667 2667
 					
2668 2668
 		$sth = $this->db->prepare($query);
2669 2669
 		$sth->execute();
2670 2670
 		
2671
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2671
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2672 2672
 		{
2673 2673
 			if ($country_array[$row['airport_country']]['country'] != $row['airport_country'])
2674 2674
 			{
@@ -2678,14 +2678,14 @@  discard block
 block discarded – undo
2678 2678
 			}
2679 2679
 		}
2680 2680
 		
2681
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2681
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2682 2682
 								FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2683 2683
 								ORDER BY spotter_output.airline_country ASC";
2684 2684
 					
2685 2685
 		$sth = $this->db->prepare($query);
2686 2686
 		$sth->execute();
2687 2687
 		
2688
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2688
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2689 2689
 		{
2690 2690
 			if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country'])
2691 2691
 			{
@@ -2709,8 +2709,8 @@  discard block
 block discarded – undo
2709 2709
 	*/
2710 2710
 	public function getAllIdents($filters = array())
2711 2711
 	{
2712
-		$filter_query = $this->getFilter($filters,true,true);
2713
-		$query  = "SELECT DISTINCT spotter_output.ident
2712
+		$filter_query = $this->getFilter($filters, true, true);
2713
+		$query = "SELECT DISTINCT spotter_output.ident
2714 2714
 								FROM spotter_output".$filter_query." spotter_output.ident <> '' 
2715 2715
 								ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0";
2716 2716
 
@@ -2720,7 +2720,7 @@  discard block
 block discarded – undo
2720 2720
 		$ident_array = array();
2721 2721
 		$temp_array = array();
2722 2722
 		
2723
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2723
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2724 2724
 		{
2725 2725
 			$temp_array['ident'] = $row['ident'];
2726 2726
 			$ident_array[] = $temp_array;
@@ -2734,9 +2734,9 @@  discard block
 block discarded – undo
2734 2734
 	* @return Array number, icao, name and city of airports
2735 2735
 	*/
2736 2736
 
2737
-	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
2737
+	public function getLast7DaysAirportsDeparture($airport_icao = '', $filters = array()) {
2738 2738
 		global $globalTimezone, $globalDBdriver;
2739
-		$filter_query = $this->getFilter($filters,true,true);
2739
+		$filter_query = $this->getFilter($filters, true, true);
2740 2740
 		if ($globalTimezone != '') {
2741 2741
 			date_default_timezone_set($globalTimezone);
2742 2742
 			$datetime = new DateTime();
@@ -2801,7 +2801,7 @@  discard block
 block discarded – undo
2801 2801
 
2802 2802
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
2803 2803
 		global $globalTimezone, $globalDBdriver;
2804
-		$filter_query = $this->getFilter($filters,true,true);
2804
+		$filter_query = $this->getFilter($filters, true, true);
2805 2805
 		if ($globalTimezone != '') {
2806 2806
 			date_default_timezone_set($globalTimezone);
2807 2807
 			$datetime = new DateTime();
@@ -2885,7 +2885,7 @@  discard block
 block discarded – undo
2885 2885
 
2886 2886
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
2887 2887
 		global $globalTimezone, $globalDBdriver;
2888
-		$filter_query = $this->getFilter($filters,true,true);
2888
+		$filter_query = $this->getFilter($filters, true, true);
2889 2889
 		if ($globalTimezone != '') {
2890 2890
 			date_default_timezone_set($globalTimezone);
2891 2891
 			$datetime = new DateTime();
@@ -2918,9 +2918,9 @@  discard block
 block discarded – undo
2918 2918
 	* @return Array number, icao, name and city of airports
2919 2919
 	*/
2920 2920
 
2921
-	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
2921
+	public function getLast7DaysDetectedAirportsArrival($airport_icao = '', $filters = array()) {
2922 2922
 		global $globalTimezone, $globalDBdriver;
2923
-		$filter_query = $this->getFilter($filters,true,true);
2923
+		$filter_query = $this->getFilter($filters, true, true);
2924 2924
 		if ($globalTimezone != '') {
2925 2925
 			date_default_timezone_set($globalTimezone);
2926 2926
 			$datetime = new DateTime();
@@ -3052,12 +3052,12 @@  discard block
 block discarded – undo
3052 3052
 		} else $offset = '+00:00';
3053 3053
 
3054 3054
 		if ($globalDBdriver == 'mysql') {
3055
-			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3055
+			$query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3056 3056
 								FROM spotter_output
3057 3057
 								WHERE spotter_output.date <> '' 
3058 3058
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
3059 3059
 		} else {
3060
-			$query  = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3060
+			$query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3061 3061
 								FROM spotter_output
3062 3062
 								WHERE spotter_output.date <> '' 
3063 3063
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
@@ -3069,7 +3069,7 @@  discard block
 block discarded – undo
3069 3069
 		$date_array = array();
3070 3070
 		$temp_array = array();
3071 3071
 		
3072
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3072
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3073 3073
 		{
3074 3074
 			$temp_array['date'] = $row['date'];
3075 3075
 
@@ -3089,7 +3089,7 @@  discard block
 block discarded – undo
3089 3089
 	*/
3090 3090
 	public function getAllRoutes()
3091 3091
 	{
3092
-		$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 
3092
+		$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 
3093 3093
 				FROM spotter_output
3094 3094
 				WHERE spotter_output.ident <> '' 
3095 3095
 				GROUP BY route
@@ -3100,7 +3100,7 @@  discard block
 block discarded – undo
3100 3100
 
3101 3101
 		$routes_array = array();
3102 3102
 		$temp_array = array();
3103
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3103
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3104 3104
 		{
3105 3105
 			$temp_array['route'] = $row['route'];
3106 3106
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -3119,21 +3119,21 @@  discard block
 block discarded – undo
3119 3119
 	* @return String success or false
3120 3120
 	*
3121 3121
 	*/	
3122
-	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3122
+	public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL)
3123 3123
 	{
3124 3124
 		if (!is_numeric(substr($ident, 0, 3)))
3125 3125
 		{
3126 3126
 			if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3127
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3127
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3128 3128
 			} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3129
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3129
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3130 3130
 			} else {
3131 3131
 				$airline_array = $this->getAllAirlineInfo("NA");
3132 3132
 			}
3133 3133
 			if (count($airline_array) == 0) {
3134 3134
 				$airline_array = $this->getAllAirlineInfo("NA");
3135 3135
 			}
3136
-			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3136
+			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3137 3137
 				$airline_array = $this->getAllAirlineInfo("NA");
3138 3138
 			}
3139 3139
 		} else {
@@ -3146,7 +3146,7 @@  discard block
 block discarded – undo
3146 3146
 
3147 3147
 
3148 3148
 		$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';
3149
-                $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);
3149
+                $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);
3150 3150
 
3151 3151
 		try {
3152 3152
 			$sth = $this->db->prepare($query);
@@ -3167,11 +3167,11 @@  discard block
 block discarded – undo
3167 3167
 	* @return String success or false
3168 3168
 	*
3169 3169
 	*/	
3170
-	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3170
+	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '')
3171 3171
 	{
3172 3172
 		if ($groundspeed == '') $groundspeed = NULL;
3173 3173
 		$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';
3174
-                $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);
3174
+                $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);
3175 3175
 
3176 3176
 		try {
3177 3177
 			$sth = $this->db->prepare($query);
@@ -3211,7 +3211,7 @@  discard block
 block discarded – undo
3211 3211
 	* @param String $verticalrate vertival rate of flight
3212 3212
 	* @return String success or false
3213 3213
 	*/
3214
-	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 = '')
3214
+	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 = '')
3215 3215
 	{
3216 3216
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
3217 3217
 		
@@ -3235,13 +3235,13 @@  discard block
 block discarded – undo
3235 3235
 				if ($ModeS != '') {
3236 3236
 					$timeelapsed = microtime(true);
3237 3237
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3238
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3238
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3239 3239
 				} else {
3240
-					$myhex = explode('-',$flightaware_id);
3240
+					$myhex = explode('-', $flightaware_id);
3241 3241
 					if (count($myhex) > 0) {
3242 3242
 						$timeelapsed = microtime(true);
3243 3243
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3244
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3244
+						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3245 3245
 					}
3246 3246
 				}
3247 3247
 			}
@@ -3263,24 +3263,24 @@  discard block
 block discarded – undo
3263 3263
 				{
3264 3264
 					$timeelapsed = microtime(true);
3265 3265
 					if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3266
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3266
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3267 3267
 					} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3268
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3268
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3269 3269
 					} else {
3270 3270
 						$airline_array = $this->getAllAirlineInfo("NA");
3271 3271
 					}
3272 3272
 					if (count($airline_array) == 0) {
3273 3273
 						$airline_array = $this->getAllAirlineInfo("NA");
3274 3274
 					}
3275
-					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3275
+					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3276 3276
 						$airline_array = $this->getAllAirlineInfo("NA");
3277 3277
 					}
3278
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3278
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3279 3279
 
3280 3280
 				} else {
3281 3281
 					$timeelapsed = microtime(true);
3282 3282
 					$airline_array = $this->getAllAirlineInfo("NA");
3283
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3283
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3284 3284
 				}
3285 3285
 			}
3286 3286
 		} else $airline_array = array();
@@ -3297,27 +3297,27 @@  discard block
 block discarded – undo
3297 3297
 				{
3298 3298
 					$timeelapsed = microtime(true);
3299 3299
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3300
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3300
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3301 3301
 				} else {
3302 3302
 					$timeelapsed = microtime(true);
3303 3303
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3304
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3304
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3305 3305
 				}
3306 3306
 			}
3307 3307
 		} else {
3308 3308
 			if ($ModeS != '') {
3309 3309
 				$timeelapsed = microtime(true);
3310 3310
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3311
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3311
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3312 3312
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3313 3313
 				{
3314 3314
 					$timeelapsed = microtime(true);
3315 3315
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3316
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3316
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3317 3317
 				} else {
3318 3318
 					$timeelapsed = microtime(true);
3319 3319
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3320
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3320
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3321 3321
 				}
3322 3322
 			}
3323 3323
 		}
@@ -3332,7 +3332,7 @@  discard block
 block discarded – undo
3332 3332
 			} else {
3333 3333
 				$timeelapsed = microtime(true);
3334 3334
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3335
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3335
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3336 3336
 			}
3337 3337
 		}
3338 3338
 		
@@ -3346,7 +3346,7 @@  discard block
 block discarded – undo
3346 3346
 			} else {
3347 3347
 				$timeelapsed = microtime(true);
3348 3348
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3349
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3349
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3350 3350
 			}
3351 3351
 		}
3352 3352
 
@@ -3410,7 +3410,7 @@  discard block
 block discarded – undo
3410 3410
 		{
3411 3411
 			$timeelapsed = microtime(true);
3412 3412
 			$image_array = $Image->getSpotterImage($registration);
3413
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3413
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3414 3414
 			if (!isset($image_array[0]['registration']))
3415 3415
 			{
3416 3416
 				//echo "Add image !!!! \n";
@@ -3418,7 +3418,7 @@  discard block
 block discarded – undo
3418 3418
 			}
3419 3419
 			$timeelapsed = microtime(true);
3420 3420
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3421
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3421
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3422 3422
 			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3423 3423
 		}
3424 3424
     
@@ -3426,33 +3426,33 @@  discard block
 block discarded – undo
3426 3426
 		{
3427 3427
             		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3428 3428
             		else $airline_icao = '';
3429
-			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3429
+			$image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao);
3430 3430
 			if (!isset($image_array[0]['registration']))
3431 3431
 			{
3432 3432
 				//echo "Add image !!!! \n";
3433
-				$Image->addSpotterImage('',$aircraft_icao,$airline_icao);
3433
+				$Image->addSpotterImage('', $aircraft_icao, $airline_icao);
3434 3434
 			}
3435 3435
 		}
3436 3436
     
3437
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
3438
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
3439
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
3440
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3441
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
3442
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
3443
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3444
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3445
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
3446
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3447
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
3448
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3449
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
3450
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
3451
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
3452
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
3453
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
3454
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
3455
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
3437
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
3438
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
3439
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
3440
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3441
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
3442
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
3443
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3444
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3445
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
3446
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3447
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
3448
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3449
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
3450
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
3451
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
3452
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
3453
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
3454
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
3455
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
3456 3456
 	
3457 3457
 		if (count($airline_array) == 0) 
3458 3458
 		{
@@ -3476,7 +3476,7 @@  discard block
 block discarded – undo
3476 3476
                 if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3477 3477
                 if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3478 3478
                 if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3479
-                $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) 
3479
+                $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) 
3480 3480
                 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)";
3481 3481
 
3482 3482
                 $airline_name = $airline_array[0]['name'];
@@ -3486,7 +3486,7 @@  discard block
 block discarded – undo
3486 3486
 		if ($airline_type == '') {
3487 3487
 			$timeelapsed = microtime(true);
3488 3488
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3489
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3489
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3490 3490
 		}
3491 3491
 		if ($airline_type == null) $airline_type = '';
3492 3492
                 $aircraft_type = $aircraft_array[0]['type'];
@@ -3497,7 +3497,7 @@  discard block
 block discarded – undo
3497 3497
                 $arrival_airport_name = $arrival_airport_array[0]['name'];
3498 3498
                 $arrival_airport_city = $arrival_airport_array[0]['city'];
3499 3499
                 $arrival_airport_country = $arrival_airport_array[0]['country'];
3500
-                $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);
3500
+                $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);
3501 3501
 
3502 3502
 		try {
3503 3503
 		        
@@ -3523,13 +3523,13 @@  discard block
 block discarded – undo
3523 3523
 	{
3524 3524
 		global $globalDBdriver, $globalTimezone;
3525 3525
 		if ($globalDBdriver == 'mysql') {
3526
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3526
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3527 3527
 								WHERE spotter_output.ident = :ident 
3528 3528
 								AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
3529 3529
 								AND spotter_output.date < UTC_TIMESTAMP()";
3530 3530
 			$query_data = array(':ident' => $ident);
3531 3531
 		} else {
3532
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3532
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3533 3533
 								WHERE spotter_output.ident = :ident 
3534 3534
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3535 3535
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
@@ -3538,8 +3538,8 @@  discard block
 block discarded – undo
3538 3538
 		
3539 3539
 		$sth = $this->db->prepare($query);
3540 3540
 		$sth->execute($query_data);
3541
-    		$ident_result='';
3542
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3541
+    		$ident_result = '';
3542
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3543 3543
 		{
3544 3544
 			$ident_result = $row['ident'];
3545 3545
 		}
@@ -3565,8 +3565,8 @@  discard block
 block discarded – undo
3565 3565
 				return false;
3566 3566
 			} else {
3567 3567
 				$q_array = explode(" ", $q);
3568
-				foreach ($q_array as $q_item){
3569
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
3568
+				foreach ($q_array as $q_item) {
3569
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
3570 3570
 					$additional_query .= " AND (";
3571 3571
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
3572 3572
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
@@ -3581,11 +3581,11 @@  discard block
 block discarded – undo
3581 3581
 			}
3582 3582
 		}
3583 3583
 		if ($globalDBdriver == 'mysql') {
3584
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3584
+			$query = "SELECT spotter_output.* FROM spotter_output 
3585 3585
 				WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
3586 3586
 				AND spotter_output.date < UTC_TIMESTAMP()";
3587 3587
 		} else {
3588
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3588
+			$query = "SELECT spotter_output.* FROM spotter_output 
3589 3589
 				WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
3590 3590
 				AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
3591 3591
 		}
@@ -3602,11 +3602,11 @@  discard block
 block discarded – undo
3602 3602
 	* @return Array the airline list
3603 3603
 	*
3604 3604
 	*/
3605
-	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3605
+	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3606 3606
 	{
3607 3607
 		global $globalDBdriver;
3608
-		$filter_query = $this->getFilter($filters,true,true);
3609
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3608
+		$filter_query = $this->getFilter($filters, true, true);
3609
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3610 3610
 		 			FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA' ";
3611 3611
 		if ($olderthanmonths > 0) {
3612 3612
 			if ($globalDBdriver == 'mysql') {
@@ -3630,7 +3630,7 @@  discard block
 block discarded – undo
3630 3630
  
3631 3631
 		$airline_array = array();
3632 3632
 		$temp_array = array();
3633
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3633
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3634 3634
 		{
3635 3635
 			$temp_array['airline_name'] = $row['airline_name'];
3636 3636
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3647,11 +3647,11 @@  discard block
 block discarded – undo
3647 3647
 	* @return Array the pilots list
3648 3648
 	*
3649 3649
 	*/
3650
-	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3650
+	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3651 3651
 	{
3652 3652
 		global $globalDBdriver;
3653
-		$filter_query = $this->getFilter($filters,true,true);
3654
-		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3653
+		$filter_query = $this->getFilter($filters, true, true);
3654
+		$query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3655 3655
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3656 3656
                 if ($olderthanmonths > 0) {
3657 3657
             		if ($globalDBdriver == 'mysql') {
@@ -3677,7 +3677,7 @@  discard block
 block discarded – undo
3677 3677
 		$airline_array = array();
3678 3678
 		$temp_array = array();
3679 3679
         
3680
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3680
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3681 3681
 		{
3682 3682
 			$temp_array['pilot_name'] = $row['pilot_name'];
3683 3683
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -3696,7 +3696,7 @@  discard block
 block discarded – undo
3696 3696
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3697 3697
 	{
3698 3698
 		global $globalDBdriver;
3699
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3699
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3700 3700
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
3701 3701
                 if ($olderthanmonths > 0) {
3702 3702
             		if ($globalDBdriver == 'mysql') {
@@ -3722,7 +3722,7 @@  discard block
 block discarded – undo
3722 3722
 		$airline_array = array();
3723 3723
 		$temp_array = array();
3724 3724
         
3725
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3725
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3726 3726
 		{
3727 3727
 			$temp_array['pilot_name'] = $row['pilot_name'];
3728 3728
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -3739,11 +3739,11 @@  discard block
 block discarded – undo
3739 3739
 	* @return Array the pilots list
3740 3740
 	*
3741 3741
 	*/
3742
-	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3742
+	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3743 3743
 	{
3744 3744
 		global $globalDBdriver;
3745
-		$filter_query = $this->getFilter($filters,true,true);
3746
-		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3745
+		$filter_query = $this->getFilter($filters, true, true);
3746
+		$query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3747 3747
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3748 3748
                 if ($olderthanmonths > 0) {
3749 3749
             		if ($globalDBdriver == 'mysql') {
@@ -3769,7 +3769,7 @@  discard block
 block discarded – undo
3769 3769
 		$airline_array = array();
3770 3770
 		$temp_array = array();
3771 3771
         
3772
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3772
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3773 3773
 		{
3774 3774
 			$temp_array['owner_name'] = $row['owner_name'];
3775 3775
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -3784,11 +3784,11 @@  discard block
 block discarded – undo
3784 3784
 	* @return Array the pilots list
3785 3785
 	*
3786 3786
 	*/
3787
-	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3787
+	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3788 3788
 	{
3789 3789
 		global $globalDBdriver;
3790
-		$filter_query = $this->getFilter($filters,true,true);
3791
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3790
+		$filter_query = $this->getFilter($filters, true, true);
3791
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3792 3792
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3793 3793
                 if ($olderthanmonths > 0) {
3794 3794
             		if ($globalDBdriver == 'mysql') {
@@ -3814,7 +3814,7 @@  discard block
 block discarded – undo
3814 3814
 		$airline_array = array();
3815 3815
 		$temp_array = array();
3816 3816
         
3817
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3817
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3818 3818
 		{
3819 3819
 			$temp_array['owner_name'] = $row['owner_name'];
3820 3820
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -3830,11 +3830,11 @@  discard block
 block discarded – undo
3830 3830
 	* @return Array the airline list
3831 3831
 	*
3832 3832
 	*/
3833
-	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
3833
+	public function countAllAirlinesByAircraft($aircraft_icao, $filters = array())
3834 3834
 	{
3835
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3836
-		$filter_query = $this->getFilter($filters,true,true);
3837
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3835
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3836
+		$filter_query = $this->getFilter($filters, true, true);
3837
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3838 3838
 		 			FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
3839 3839
                     GROUP BY spotter_output.airline_name
3840 3840
 					ORDER BY airline_count DESC";
@@ -3846,7 +3846,7 @@  discard block
 block discarded – undo
3846 3846
 		$airline_array = array();
3847 3847
 		$temp_array = array();
3848 3848
         
3849
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3849
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3850 3850
 		{
3851 3851
 			$temp_array['airline_name'] = $row['airline_name'];
3852 3852
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3866,11 +3866,11 @@  discard block
 block discarded – undo
3866 3866
 	* @return Array the airline country list
3867 3867
 	*
3868 3868
 	*/
3869
-	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
3869
+	public function countAllAirlineCountriesByAircraft($aircraft_icao, $filters = array())
3870 3870
 	{
3871
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3872
-		$filter_query = $this->getFilter($filters,true,true);
3873
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3871
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3872
+		$filter_query = $this->getFilter($filters, true, true);
3873
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3874 3874
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
3875 3875
                     GROUP BY spotter_output.airline_country
3876 3876
 					ORDER BY airline_country_count DESC
@@ -3883,7 +3883,7 @@  discard block
 block discarded – undo
3883 3883
 		$airline_country_array = array();
3884 3884
 		$temp_array = array();
3885 3885
         
3886
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3886
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3887 3887
 		{
3888 3888
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
3889 3889
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -3902,11 +3902,11 @@  discard block
 block discarded – undo
3902 3902
 	* @return Array the airline list
3903 3903
 	*
3904 3904
 	*/
3905
-	public function countAllAirlinesByAirport($airport_icao,$filters = array())
3905
+	public function countAllAirlinesByAirport($airport_icao, $filters = array())
3906 3906
 	{
3907
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
3908
-		$filter_query = $this->getFilter($filters,true,true);
3909
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3907
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
3908
+		$filter_query = $this->getFilter($filters, true, true);
3909
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3910 3910
 		 			FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao ) 
3911 3911
                     GROUP BY spotter_output.airline_name
3912 3912
 					ORDER BY airline_count DESC";
@@ -3918,7 +3918,7 @@  discard block
 block discarded – undo
3918 3918
 		$airline_array = array();
3919 3919
 		$temp_array = array();
3920 3920
         
3921
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3921
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3922 3922
 		{
3923 3923
 			$temp_array['airline_name'] = $row['airline_name'];
3924 3924
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3937,11 +3937,11 @@  discard block
 block discarded – undo
3937 3937
 	* @return Array the airline country list
3938 3938
 	*
3939 3939
 	*/
3940
-	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
3940
+	public function countAllAirlineCountriesByAirport($airport_icao, $filters = array())
3941 3941
 	{
3942
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
3943
-		$filter_query = $this->getFilter($filters,true,true);
3944
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3942
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
3943
+		$filter_query = $this->getFilter($filters, true, true);
3944
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3945 3945
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao )
3946 3946
 					GROUP BY spotter_output.airline_country
3947 3947
 					ORDER BY airline_country_count DESC
@@ -3954,7 +3954,7 @@  discard block
 block discarded – undo
3954 3954
 		$airline_country_array = array();
3955 3955
 		$temp_array = array();
3956 3956
         
3957
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3957
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3958 3958
 		{
3959 3959
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
3960 3960
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -3971,11 +3971,11 @@  discard block
 block discarded – undo
3971 3971
 	* @return Array the airline list
3972 3972
 	*
3973 3973
 	*/
3974
-	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
3974
+	public function countAllAirlinesByManufacturer($aircraft_manufacturer, $filters = array())
3975 3975
 	{
3976
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
3977
-		$filter_query = $this->getFilter($filters,true,true);
3978
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3976
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
3977
+		$filter_query = $this->getFilter($filters, true, true);
3978
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3979 3979
 		 			FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
3980 3980
 					GROUP BY spotter_output.airline_name
3981 3981
 					ORDER BY airline_count DESC";
@@ -3986,7 +3986,7 @@  discard block
 block discarded – undo
3986 3986
 		$airline_array = array();
3987 3987
 		$temp_array = array();
3988 3988
         
3989
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3989
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3990 3990
 		{
3991 3991
 			$temp_array['airline_name'] = $row['airline_name'];
3992 3992
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4006,11 +4006,11 @@  discard block
 block discarded – undo
4006 4006
 	* @return Array the airline country list
4007 4007
 	*
4008 4008
 	*/
4009
-	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4009
+	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer, $filters = array())
4010 4010
 	{
4011
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4012
-		$filter_query = $this->getFilter($filters,true,true);
4013
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4011
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4012
+		$filter_query = $this->getFilter($filters, true, true);
4013
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4014 4014
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4015 4015
 					GROUP BY spotter_output.airline_country
4016 4016
 					ORDER BY airline_country_count DESC
@@ -4023,7 +4023,7 @@  discard block
 block discarded – undo
4023 4023
 		$airline_country_array = array();
4024 4024
 		$temp_array = array();
4025 4025
         
4026
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4026
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4027 4027
 		{
4028 4028
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4029 4029
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4039,11 +4039,11 @@  discard block
 block discarded – undo
4039 4039
 	* @return Array the airline list
4040 4040
 	*
4041 4041
 	*/
4042
-	public function countAllAirlinesByDate($date,$filters = array())
4042
+	public function countAllAirlinesByDate($date, $filters = array())
4043 4043
 	{
4044 4044
 		global $globalTimezone, $globalDBdriver;
4045
-		$filter_query = $this->getFilter($filters,true,true);
4046
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4045
+		$filter_query = $this->getFilter($filters, true, true);
4046
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4047 4047
 		if ($globalTimezone != '') {
4048 4048
 			date_default_timezone_set($globalTimezone);
4049 4049
 			$datetime = new DateTime($date);
@@ -4051,12 +4051,12 @@  discard block
 block discarded – undo
4051 4051
 		} else $offset = '+00:00';
4052 4052
 
4053 4053
 		if ($globalDBdriver == 'mysql') {
4054
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4054
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4055 4055
 		 			FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4056 4056
 					GROUP BY spotter_output.airline_name
4057 4057
 					ORDER BY airline_count DESC";
4058 4058
 		} else {
4059
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4059
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4060 4060
 		 			FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4061 4061
 					GROUP BY spotter_output.airline_name
4062 4062
 					ORDER BY airline_count DESC";
@@ -4067,7 +4067,7 @@  discard block
 block discarded – undo
4067 4067
 
4068 4068
 		$airline_array = array();
4069 4069
 		$temp_array = array();
4070
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4070
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4071 4071
 		{
4072 4072
 			$temp_array['airline_name'] = $row['airline_name'];
4073 4073
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4087,11 +4087,11 @@  discard block
 block discarded – undo
4087 4087
 	* @return Array the airline country list
4088 4088
 	*
4089 4089
 	*/
4090
-	public function countAllAirlineCountriesByDate($date,$filters = array())
4090
+	public function countAllAirlineCountriesByDate($date, $filters = array())
4091 4091
 	{
4092 4092
 		global $globalTimezone, $globalDBdriver;
4093
-		$filter_query = $this->getFilter($filters,true,true);
4094
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4093
+		$filter_query = $this->getFilter($filters, true, true);
4094
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4095 4095
 		if ($globalTimezone != '') {
4096 4096
 			date_default_timezone_set($globalTimezone);
4097 4097
 			$datetime = new DateTime($date);
@@ -4099,13 +4099,13 @@  discard block
 block discarded – undo
4099 4099
 		} else $offset = '+00:00';
4100 4100
 		
4101 4101
 		if ($globalDBdriver == 'mysql') {
4102
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4102
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4103 4103
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4104 4104
 					GROUP BY spotter_output.airline_country
4105 4105
 					ORDER BY airline_country_count DESC
4106 4106
 					LIMIT 10 OFFSET 0";
4107 4107
 		} else {
4108
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4108
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4109 4109
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4110 4110
 					GROUP BY spotter_output.airline_country
4111 4111
 					ORDER BY airline_country_count DESC
@@ -4117,7 +4117,7 @@  discard block
 block discarded – undo
4117 4117
  
4118 4118
 		$airline_country_array = array();
4119 4119
 		$temp_array = array();
4120
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4120
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4121 4121
 		{
4122 4122
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4123 4123
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4134,11 +4134,11 @@  discard block
 block discarded – undo
4134 4134
 	* @return Array the airline list
4135 4135
 	*
4136 4136
 	*/
4137
-	public function countAllAirlinesByIdent($ident,$filters = array())
4137
+	public function countAllAirlinesByIdent($ident, $filters = array())
4138 4138
 	{
4139
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4140
-		$filter_query = $this->getFilter($filters,true,true);
4141
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4139
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4140
+		$filter_query = $this->getFilter($filters, true, true);
4141
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4142 4142
 		 		FROM spotter_output".$filter_query." spotter_output.ident = :ident  
4143 4143
 				GROUP BY spotter_output.airline_name
4144 4144
 				ORDER BY airline_count DESC";
@@ -4150,7 +4150,7 @@  discard block
 block discarded – undo
4150 4150
 		$airline_array = array();
4151 4151
 		$temp_array = array();
4152 4152
         
4153
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4153
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4154 4154
 		{
4155 4155
 			$temp_array['airline_name'] = $row['airline_name'];
4156 4156
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4168,25 +4168,25 @@  discard block
 block discarded – undo
4168 4168
 	* @return Array the airline list
4169 4169
 	*
4170 4170
 	*/
4171
-	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4171
+	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4172 4172
 	{
4173
-		$filter_query = $this->getFilter($filters,true,true);
4174
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4175
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4173
+		$filter_query = $this->getFilter($filters, true, true);
4174
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4175
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4176 4176
 
4177
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4177
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4178 4178
 		 			FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4179 4179
 					GROUP BY spotter_output.airline_name
4180 4180
 					ORDER BY airline_count DESC";
4181 4181
       
4182 4182
 		
4183 4183
 		$sth = $this->db->prepare($query);
4184
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4184
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4185 4185
       
4186 4186
 		$airline_array = array();
4187 4187
 		$temp_array = array();
4188 4188
         
4189
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4189
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4190 4190
 		{
4191 4191
 			$temp_array['airline_name'] = $row['airline_name'];
4192 4192
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4204,13 +4204,13 @@  discard block
 block discarded – undo
4204 4204
 	* @return Array the airline country list
4205 4205
 	*
4206 4206
 	*/
4207
-	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4207
+	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4208 4208
 	{
4209
-		$filter_query = $this->getFilter($filters,true,true);
4210
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4211
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4209
+		$filter_query = $this->getFilter($filters, true, true);
4210
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4211
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4212 4212
       
4213
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4213
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4214 4214
 		 		FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4215 4215
 				GROUP BY spotter_output.airline_country
4216 4216
 				ORDER BY airline_country_count DESC
@@ -4218,11 +4218,11 @@  discard block
 block discarded – undo
4218 4218
       
4219 4219
 		
4220 4220
 		$sth = $this->db->prepare($query);
4221
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4221
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4222 4222
       
4223 4223
 		$airline_country_array = array();
4224 4224
 		$temp_array = array();
4225
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4225
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4226 4226
 		{
4227 4227
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4228 4228
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4240,11 +4240,11 @@  discard block
 block discarded – undo
4240 4240
 	* @return Array the airline list
4241 4241
 	*
4242 4242
 	*/
4243
-	public function countAllAirlinesByCountry($country,$filters = array())
4243
+	public function countAllAirlinesByCountry($country, $filters = array())
4244 4244
 	{
4245
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4246
-		$filter_query = $this->getFilter($filters,true,true);
4247
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4245
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4246
+		$filter_query = $this->getFilter($filters, true, true);
4247
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4248 4248
 		 		FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
4249 4249
 				GROUP BY spotter_output.airline_name
4250 4250
 				ORDER BY airline_count DESC";
@@ -4255,7 +4255,7 @@  discard block
 block discarded – undo
4255 4255
 
4256 4256
 		$airline_array = array();
4257 4257
 		$temp_array = array();
4258
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4258
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4259 4259
 		{
4260 4260
 			$temp_array['airline_name'] = $row['airline_name'];
4261 4261
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4274,11 +4274,11 @@  discard block
 block discarded – undo
4274 4274
 	* @return Array the airline country list
4275 4275
 	*
4276 4276
 	*/
4277
-	public function countAllAirlineCountriesByCountry($country,$filters = array())
4277
+	public function countAllAirlineCountriesByCountry($country, $filters = array())
4278 4278
 	{
4279
-		$filter_query = $this->getFilter($filters,true,true);
4280
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4281
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4279
+		$filter_query = $this->getFilter($filters, true, true);
4280
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4281
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4282 4282
 		 		FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
4283 4283
 				GROUP BY spotter_output.airline_country
4284 4284
 				ORDER BY airline_country_count DESC
@@ -4290,7 +4290,7 @@  discard block
 block discarded – undo
4290 4290
 
4291 4291
 		$airline_country_array = array();
4292 4292
 		$temp_array = array();
4293
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4293
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4294 4294
 		{
4295 4295
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4296 4296
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4309,8 +4309,8 @@  discard block
 block discarded – undo
4309 4309
 	*/
4310 4310
 	public function countAllAirlineCountries($limit = true, $filters = array())
4311 4311
 	{
4312
-		$filter_query = $this->getFilter($filters,true,true);
4313
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4312
+		$filter_query = $this->getFilter($filters, true, true);
4313
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4314 4314
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' 
4315 4315
 					GROUP BY spotter_output.airline_country
4316 4316
 					ORDER BY airline_country_count DESC";
@@ -4321,7 +4321,7 @@  discard block
 block discarded – undo
4321 4321
 
4322 4322
 		$airline_array = array();
4323 4323
 		$temp_array = array();
4324
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4324
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4325 4325
 		{
4326 4326
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4327 4327
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4337,11 +4337,11 @@  discard block
 block discarded – undo
4337 4337
 	* @return Array the airline country list
4338 4338
 	*
4339 4339
 	*/
4340
-	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
4340
+	public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '')
4341 4341
 	{
4342 4342
 		global $globalDBdriver;
4343 4343
 		//$filter_query = $this->getFilter($filters,true,true);
4344
-		$Connection= new Connection($this->db);
4344
+		$Connection = new Connection($this->db);
4345 4345
 		if (!$Connection->tableExists('countries')) return array();
4346 4346
 		/*
4347 4347
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -4376,7 +4376,7 @@  discard block
 block discarded – undo
4376 4376
 		$flight_array = array();
4377 4377
 		$temp_array = array();
4378 4378
         
4379
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4379
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4380 4380
 		{
4381 4381
 			$temp_array['flight_count'] = $row['nb'];
4382 4382
 			$temp_array['flight_country'] = $row['name'];
@@ -4394,12 +4394,12 @@  discard block
 block discarded – undo
4394 4394
 	* @return Array the aircraft list
4395 4395
 	*
4396 4396
 	*/
4397
-	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4397
+	public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4398 4398
 	{
4399 4399
 		global $globalDBdriver;
4400
-		$filter_query = $this->getFilter($filters,true,true);
4400
+		$filter_query = $this->getFilter($filters, true, true);
4401 4401
 
4402
-		$query  = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4402
+		$query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4403 4403
 		    FROM spotter_output ".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> ''";
4404 4404
 		if ($olderthanmonths > 0) {
4405 4405
 			if ($globalDBdriver == 'mysql') {
@@ -4424,7 +4424,7 @@  discard block
 block discarded – undo
4424 4424
 
4425 4425
 		$aircraft_array = array();
4426 4426
 		$temp_array = array();
4427
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4427
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4428 4428
 		{
4429 4429
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4430 4430
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4441,11 +4441,11 @@  discard block
 block discarded – undo
4441 4441
 	* @return Array the aircraft list
4442 4442
 	*
4443 4443
 	*/
4444
-	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4444
+	public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4445 4445
 	{
4446 4446
 		global $globalDBdriver;
4447
-		$filter_query = $this->getFilter($filters,true,true);
4448
-		$query  = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4447
+		$filter_query = $this->getFilter($filters, true, true);
4448
+		$query = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4449 4449
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA' ";
4450 4450
 		if ($olderthanmonths > 0) {
4451 4451
 			if ($globalDBdriver == 'mysql') {
@@ -4470,7 +4470,7 @@  discard block
 block discarded – undo
4470 4470
 
4471 4471
 		$aircraft_array = array();
4472 4472
 		$temp_array = array();
4473
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4473
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4474 4474
 		{
4475 4475
 			$temp_array['airline_icao'] = $row['airline_icao'];
4476 4476
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -4489,13 +4489,13 @@  discard block
 block discarded – undo
4489 4489
 	* @return Array the aircraft list
4490 4490
 	*
4491 4491
 	*/
4492
-	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
4492
+	public function countAllAircraftRegistrationByAircraft($aircraft_icao, $filters = array())
4493 4493
 	{
4494 4494
 		$Image = new Image($this->db);
4495
-		$filter_query = $this->getFilter($filters,true,true);
4496
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4495
+		$filter_query = $this->getFilter($filters, true, true);
4496
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4497 4497
 
4498
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4498
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4499 4499
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao  
4500 4500
 				GROUP BY spotter_output.registration 
4501 4501
 				ORDER BY registration_count DESC";
@@ -4506,14 +4506,14 @@  discard block
 block discarded – undo
4506 4506
 		$aircraft_array = array();
4507 4507
 		$temp_array = array();
4508 4508
         
4509
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4509
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4510 4510
 		{
4511 4511
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4512 4512
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4513 4513
 			$temp_array['registration'] = $row['registration'];
4514 4514
 			$temp_array['airline_name'] = $row['airline_name'];
4515 4515
 			$temp_array['image_thumbnail'] = "";
4516
-			if($row['registration'] != "")
4516
+			if ($row['registration'] != "")
4517 4517
 			{
4518 4518
 				$image_array = $Image->getSpotterImage($row['registration']);
4519 4519
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4532,11 +4532,11 @@  discard block
 block discarded – undo
4532 4532
 	* @return Array the aircraft list
4533 4533
 	*
4534 4534
 	*/
4535
-	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
4535
+	public function countAllAircraftTypesByAirline($airline_icao, $filters = array())
4536 4536
 	{
4537
-		$filter_query = $this->getFilter($filters,true,true);
4538
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4539
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4537
+		$filter_query = $this->getFilter($filters, true, true);
4538
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4539
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4540 4540
 				FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao 
4541 4541
 				GROUP BY spotter_output.aircraft_name 
4542 4542
 				ORDER BY aircraft_icao_count DESC";
@@ -4547,7 +4547,7 @@  discard block
 block discarded – undo
4547 4547
 		$aircraft_array = array();
4548 4548
 		$temp_array = array();
4549 4549
 
4550
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4550
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4551 4551
 		{
4552 4552
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4553 4553
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4565,13 +4565,13 @@  discard block
 block discarded – undo
4565 4565
 	* @return Array the aircraft list
4566 4566
 	*
4567 4567
 	*/
4568
-	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
4568
+	public function countAllAircraftRegistrationByAirline($airline_icao, $filters = array())
4569 4569
 	{
4570
-		$filter_query = $this->getFilter($filters,true,true);
4570
+		$filter_query = $this->getFilter($filters, true, true);
4571 4571
 		$Image = new Image($this->db);
4572
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4572
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4573 4573
 
4574
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
4574
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
4575 4575
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao 
4576 4576
 				GROUP BY spotter_output.registration 
4577 4577
 				ORDER BY registration_count DESC";
@@ -4581,14 +4581,14 @@  discard block
 block discarded – undo
4581 4581
 
4582 4582
 		$aircraft_array = array();
4583 4583
 		$temp_array = array();
4584
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4584
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4585 4585
 		{
4586 4586
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4587 4587
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4588 4588
 			$temp_array['registration'] = $row['registration'];
4589 4589
 			$temp_array['airline_name'] = $row['airline_name'];
4590 4590
 			$temp_array['image_thumbnail'] = "";
4591
-			if($row['registration'] != "")
4591
+			if ($row['registration'] != "")
4592 4592
 			{
4593 4593
 				$image_array = $Image->getSpotterImage($row['registration']);
4594 4594
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4607,11 +4607,11 @@  discard block
 block discarded – undo
4607 4607
 	* @return Array the aircraft list
4608 4608
 	*
4609 4609
 	*/
4610
-	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
4610
+	public function countAllAircraftManufacturerByAirline($airline_icao, $filters = array())
4611 4611
 	{
4612
-		$filter_query = $this->getFilter($filters,true,true);
4613
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4614
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4612
+		$filter_query = $this->getFilter($filters, true, true);
4613
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4614
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4615 4615
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao 
4616 4616
 				GROUP BY spotter_output.aircraft_manufacturer 
4617 4617
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -4622,7 +4622,7 @@  discard block
 block discarded – undo
4622 4622
 		$aircraft_array = array();
4623 4623
 		$temp_array = array();
4624 4624
 
4625
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4625
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4626 4626
 		{
4627 4627
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4628 4628
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4639,12 +4639,12 @@  discard block
 block discarded – undo
4639 4639
 	* @return Array the aircraft list
4640 4640
 	*
4641 4641
 	*/
4642
-	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
4642
+	public function countAllAircraftTypesByAirport($airport_icao, $filters = array())
4643 4643
 	{
4644
-		$filter_query = $this->getFilter($filters,true,true);
4645
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4644
+		$filter_query = $this->getFilter($filters, true, true);
4645
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4646 4646
 
4647
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4647
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4648 4648
 				FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) 
4649 4649
 				GROUP BY spotter_output.aircraft_name 
4650 4650
 				ORDER BY aircraft_icao_count DESC";
@@ -4654,7 +4654,7 @@  discard block
 block discarded – undo
4654 4654
 
4655 4655
 		$aircraft_array = array();
4656 4656
 		$temp_array = array();
4657
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4657
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4658 4658
 		{
4659 4659
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4660 4660
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4672,13 +4672,13 @@  discard block
 block discarded – undo
4672 4672
 	* @return Array the aircraft list
4673 4673
 	*
4674 4674
 	*/
4675
-	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
4675
+	public function countAllAircraftRegistrationByAirport($airport_icao, $filters = array())
4676 4676
 	{
4677
-		$filter_query = $this->getFilter($filters,true,true);
4677
+		$filter_query = $this->getFilter($filters, true, true);
4678 4678
 		$Image = new Image($this->db);
4679
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4679
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4680 4680
 
4681
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4681
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4682 4682
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)   
4683 4683
                     GROUP BY spotter_output.registration 
4684 4684
 					ORDER BY registration_count DESC";
@@ -4689,14 +4689,14 @@  discard block
 block discarded – undo
4689 4689
 
4690 4690
 		$aircraft_array = array();
4691 4691
 		$temp_array = array();
4692
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4692
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4693 4693
 		{
4694 4694
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4695 4695
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4696 4696
 			$temp_array['registration'] = $row['registration'];
4697 4697
 			$temp_array['airline_name'] = $row['airline_name'];
4698 4698
 			$temp_array['image_thumbnail'] = "";
4699
-			if($row['registration'] != "")
4699
+			if ($row['registration'] != "")
4700 4700
 			{
4701 4701
 				$image_array = $Image->getSpotterImage($row['registration']);
4702 4702
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4714,11 +4714,11 @@  discard block
 block discarded – undo
4714 4714
 	* @return Array the aircraft list
4715 4715
 	*
4716 4716
 	*/
4717
-	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
4717
+	public function countAllAircraftManufacturerByAirport($airport_icao, $filters = array())
4718 4718
 	{
4719
-		$filter_query = $this->getFilter($filters,true,true);
4720
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4721
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4719
+		$filter_query = $this->getFilter($filters, true, true);
4720
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4721
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4722 4722
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)  
4723 4723
                     GROUP BY spotter_output.aircraft_manufacturer 
4724 4724
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -4729,7 +4729,7 @@  discard block
 block discarded – undo
4729 4729
 
4730 4730
 		$aircraft_array = array();
4731 4731
 		$temp_array = array();
4732
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4732
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4733 4733
 		{
4734 4734
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4735 4735
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4744,12 +4744,12 @@  discard block
 block discarded – undo
4744 4744
 	* @return Array the aircraft list
4745 4745
 	*
4746 4746
 	*/
4747
-	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
4747
+	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer, $filters = array())
4748 4748
 	{
4749
-		$filter_query = $this->getFilter($filters,true,true);
4750
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4749
+		$filter_query = $this->getFilter($filters, true, true);
4750
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4751 4751
 
4752
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4752
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4753 4753
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
4754 4754
                     GROUP BY spotter_output.aircraft_name 
4755 4755
 					ORDER BY aircraft_icao_count DESC";
@@ -4758,7 +4758,7 @@  discard block
 block discarded – undo
4758 4758
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
4759 4759
 		$aircraft_array = array();
4760 4760
 		$temp_array = array();
4761
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4761
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4762 4762
 		{
4763 4763
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4764 4764
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4777,11 +4777,11 @@  discard block
 block discarded – undo
4777 4777
 	*/
4778 4778
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
4779 4779
 	{
4780
-		$filter_query = $this->getFilter($filters,true,true);
4780
+		$filter_query = $this->getFilter($filters, true, true);
4781 4781
 		$Image = new Image($this->db);
4782
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4782
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4783 4783
 
4784
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
4784
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
4785 4785
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
4786 4786
                     GROUP BY spotter_output.registration 
4787 4787
 					ORDER BY registration_count DESC";
@@ -4791,14 +4791,14 @@  discard block
 block discarded – undo
4791 4791
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
4792 4792
 		$aircraft_array = array();
4793 4793
 		$temp_array = array();
4794
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4794
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4795 4795
 		{
4796 4796
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4797 4797
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4798 4798
 			$temp_array['registration'] = $row['registration'];
4799 4799
 			$temp_array['airline_name'] = $row['airline_name'];
4800 4800
 			$temp_array['image_thumbnail'] = "";
4801
-			if($row['registration'] != "")
4801
+			if ($row['registration'] != "")
4802 4802
 			{
4803 4803
 				$image_array = $Image->getSpotterImage($row['registration']);
4804 4804
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4815,11 +4815,11 @@  discard block
 block discarded – undo
4815 4815
 	* @return Array the aircraft list
4816 4816
 	*
4817 4817
 	*/
4818
-	public function countAllAircraftTypesByDate($date,$filters = array())
4818
+	public function countAllAircraftTypesByDate($date, $filters = array())
4819 4819
 	{
4820 4820
 		global $globalTimezone, $globalDBdriver;
4821
-		$filter_query = $this->getFilter($filters,true,true);
4822
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4821
+		$filter_query = $this->getFilter($filters, true, true);
4822
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4823 4823
 		if ($globalTimezone != '') {
4824 4824
 			date_default_timezone_set($globalTimezone);
4825 4825
 			$datetime = new DateTime($date);
@@ -4827,12 +4827,12 @@  discard block
 block discarded – undo
4827 4827
 		} else $offset = '+00:00';
4828 4828
 
4829 4829
 		if ($globalDBdriver == 'mysql') {
4830
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4830
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4831 4831
 					FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
4832 4832
 					GROUP BY spotter_output.aircraft_name 
4833 4833
 					ORDER BY aircraft_icao_count DESC";
4834 4834
 		} else {
4835
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4835
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4836 4836
 					FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
4837 4837
 					GROUP BY spotter_output.aircraft_name 
4838 4838
 					ORDER BY aircraft_icao_count DESC";
@@ -4843,7 +4843,7 @@  discard block
 block discarded – undo
4843 4843
 
4844 4844
 		$aircraft_array = array();
4845 4845
 		$temp_array = array();
4846
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4846
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4847 4847
 		{
4848 4848
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4849 4849
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4861,12 +4861,12 @@  discard block
 block discarded – undo
4861 4861
 	* @return Array the aircraft list
4862 4862
 	*
4863 4863
 	*/
4864
-	public function countAllAircraftRegistrationByDate($date,$filters = array())
4864
+	public function countAllAircraftRegistrationByDate($date, $filters = array())
4865 4865
 	{
4866 4866
 		global $globalTimezone, $globalDBdriver;
4867
-		$filter_query = $this->getFilter($filters,true,true);
4867
+		$filter_query = $this->getFilter($filters, true, true);
4868 4868
 		$Image = new Image($this->db);
4869
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4869
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4870 4870
 		if ($globalTimezone != '') {
4871 4871
 			date_default_timezone_set($globalTimezone);
4872 4872
 			$datetime = new DateTime($date);
@@ -4874,12 +4874,12 @@  discard block
 block discarded – undo
4874 4874
 		} else $offset = '+00:00';
4875 4875
 
4876 4876
 		if ($globalDBdriver == 'mysql') {
4877
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name    
4877
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name    
4878 4878
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4879 4879
 					GROUP BY spotter_output.registration 
4880 4880
 					ORDER BY registration_count DESC";
4881 4881
 		} else {
4882
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name    
4882
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name    
4883 4883
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4884 4884
 					GROUP BY spotter_output.registration 
4885 4885
 					ORDER BY registration_count DESC";
@@ -4890,14 +4890,14 @@  discard block
 block discarded – undo
4890 4890
 
4891 4891
 		$aircraft_array = array();
4892 4892
 		$temp_array = array();
4893
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4893
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4894 4894
 		{
4895 4895
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4896 4896
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4897 4897
 			$temp_array['registration'] = $row['registration'];
4898 4898
 			$temp_array['airline_name'] = $row['airline_name'];
4899 4899
 			$temp_array['image_thumbnail'] = "";
4900
-			if($row['registration'] != "")
4900
+			if ($row['registration'] != "")
4901 4901
 			{
4902 4902
 				$image_array = $Image->getSpotterImage($row['registration']);
4903 4903
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4916,11 +4916,11 @@  discard block
 block discarded – undo
4916 4916
 	* @return Array the aircraft manufacturer list
4917 4917
 	*
4918 4918
 	*/
4919
-	public function countAllAircraftManufacturerByDate($date,$filters = array())
4919
+	public function countAllAircraftManufacturerByDate($date, $filters = array())
4920 4920
 	{
4921 4921
 		global $globalTimezone, $globalDBdriver;
4922
-		$filter_query = $this->getFilter($filters,true,true);
4923
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4922
+		$filter_query = $this->getFilter($filters, true, true);
4923
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4924 4924
 		if ($globalTimezone != '') {
4925 4925
 			date_default_timezone_set($globalTimezone);
4926 4926
 			$datetime = new DateTime($date);
@@ -4928,12 +4928,12 @@  discard block
 block discarded – undo
4928 4928
 		} else $offset = '+00:00';
4929 4929
 
4930 4930
 		if ($globalDBdriver == 'mysql') {
4931
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4931
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4932 4932
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4933 4933
 				GROUP BY spotter_output.aircraft_manufacturer 
4934 4934
 				ORDER BY aircraft_manufacturer_count DESC";
4935 4935
 		} else {
4936
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4936
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4937 4937
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4938 4938
 				GROUP BY spotter_output.aircraft_manufacturer 
4939 4939
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -4945,7 +4945,7 @@  discard block
 block discarded – undo
4945 4945
 		$aircraft_array = array();
4946 4946
 		$temp_array = array();
4947 4947
 
4948
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4948
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4949 4949
 		{
4950 4950
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4951 4951
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4962,11 +4962,11 @@  discard block
 block discarded – undo
4962 4962
 	* @return Array the aircraft list
4963 4963
 	*
4964 4964
 	*/
4965
-	public function countAllAircraftTypesByIdent($ident,$filters = array())
4965
+	public function countAllAircraftTypesByIdent($ident, $filters = array())
4966 4966
 	{
4967
-		$filter_query = $this->getFilter($filters,true,true);
4968
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4969
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4967
+		$filter_query = $this->getFilter($filters, true, true);
4968
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4969
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4970 4970
 				FROM spotter_output".$filter_query." spotter_output.ident = :ident 
4971 4971
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
4972 4972
 				ORDER BY aircraft_icao_count DESC";
@@ -4977,7 +4977,7 @@  discard block
 block discarded – undo
4977 4977
 		$aircraft_array = array();
4978 4978
 		$temp_array = array();
4979 4979
 
4980
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4980
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4981 4981
 		{
4982 4982
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4983 4983
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4995,13 +4995,13 @@  discard block
 block discarded – undo
4995 4995
 	* @return Array the aircraft list
4996 4996
 	*
4997 4997
 	*/
4998
-	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
4998
+	public function countAllAircraftRegistrationByIdent($ident, $filters = array())
4999 4999
 	{
5000
-		$filter_query = $this->getFilter($filters,true,true);
5000
+		$filter_query = $this->getFilter($filters, true, true);
5001 5001
 		$Image = new Image($this->db);
5002
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5002
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5003 5003
 
5004
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5004
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5005 5005
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.ident = :ident   
5006 5006
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
5007 5007
 		    ORDER BY registration_count DESC";
@@ -5013,14 +5013,14 @@  discard block
 block discarded – undo
5013 5013
 		$aircraft_array = array();
5014 5014
 		$temp_array = array();
5015 5015
         
5016
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5016
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5017 5017
 		{
5018 5018
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5019 5019
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5020 5020
 			$temp_array['registration'] = $row['registration'];
5021 5021
 			$temp_array['airline_name'] = $row['airline_name'];
5022 5022
 			$temp_array['image_thumbnail'] = "";
5023
-			if($row['registration'] != "")
5023
+			if ($row['registration'] != "")
5024 5024
 			{
5025 5025
 				$image_array = $Image->getSpotterImage($row['registration']);
5026 5026
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5039,11 +5039,11 @@  discard block
 block discarded – undo
5039 5039
 	* @return Array the aircraft manufacturer list
5040 5040
 	*
5041 5041
 	*/
5042
-	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5042
+	public function countAllAircraftManufacturerByIdent($ident, $filters = array())
5043 5043
 	{
5044
-		$filter_query = $this->getFilter($filters,true,true);
5045
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5046
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5044
+		$filter_query = $this->getFilter($filters, true, true);
5045
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5046
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5047 5047
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident  
5048 5048
                     GROUP BY spotter_output.aircraft_manufacturer 
5049 5049
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5053,7 +5053,7 @@  discard block
 block discarded – undo
5053 5053
 		$sth->execute(array(':ident' => $ident));
5054 5054
 		$aircraft_array = array();
5055 5055
 		$temp_array = array();
5056
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5056
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5057 5057
 		{
5058 5058
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5059 5059
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5069,24 +5069,24 @@  discard block
 block discarded – undo
5069 5069
 	* @return Array the aircraft list
5070 5070
 	*
5071 5071
 	*/
5072
-	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5072
+	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5073 5073
 	{
5074
-		$filter_query = $this->getFilter($filters,true,true);
5075
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5076
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5074
+		$filter_query = $this->getFilter($filters, true, true);
5075
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5076
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5077 5077
 		
5078 5078
 
5079
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5079
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5080 5080
                     FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
5081 5081
                     GROUP BY spotter_output.aircraft_name 
5082 5082
 					ORDER BY aircraft_icao_count DESC";
5083 5083
  
5084 5084
 		
5085 5085
 		$sth = $this->db->prepare($query);
5086
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5086
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5087 5087
 		$aircraft_array = array();
5088 5088
 		$temp_array = array();
5089
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5089
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5090 5090
 		{
5091 5091
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5092 5092
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5102,33 +5102,33 @@  discard block
 block discarded – undo
5102 5102
 	* @return Array the aircraft list
5103 5103
 	*
5104 5104
 	*/
5105
-	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5105
+	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5106 5106
 	{
5107
-		$filter_query = $this->getFilter($filters,true,true);
5107
+		$filter_query = $this->getFilter($filters, true, true);
5108 5108
 		$Image = new Image($this->db);
5109
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5110
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5109
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5110
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5111 5111
 
5112
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
5112
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
5113 5113
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)   
5114 5114
                     GROUP BY spotter_output.registration 
5115 5115
 					ORDER BY registration_count DESC";
5116 5116
 
5117 5117
 		
5118 5118
 		$sth = $this->db->prepare($query);
5119
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5119
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5120 5120
       
5121 5121
 		$aircraft_array = array();
5122 5122
 		$temp_array = array();
5123 5123
         
5124
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5124
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5125 5125
 		{
5126 5126
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5127 5127
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5128 5128
 			$temp_array['registration'] = $row['registration'];
5129 5129
 			$temp_array['airline_name'] = $row['airline_name'];
5130 5130
 			$temp_array['image_thumbnail'] = "";
5131
-			if($row['registration'] != "")
5131
+			if ($row['registration'] != "")
5132 5132
 			{
5133 5133
 				$image_array = $Image->getSpotterImage($row['registration']);
5134 5134
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5148,25 +5148,25 @@  discard block
 block discarded – undo
5148 5148
 	* @return Array the aircraft manufacturer list
5149 5149
 	*
5150 5150
 	*/
5151
-	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5151
+	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5152 5152
 	{
5153
-		$filter_query = $this->getFilter($filters,true,true);
5154
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5155
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5153
+		$filter_query = $this->getFilter($filters, true, true);
5154
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5155
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5156 5156
 
5157
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5157
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5158 5158
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
5159 5159
                     GROUP BY spotter_output.aircraft_manufacturer 
5160 5160
 					ORDER BY aircraft_manufacturer_count DESC";
5161 5161
 
5162 5162
 		
5163 5163
 		$sth = $this->db->prepare($query);
5164
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5164
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5165 5165
       
5166 5166
 		$aircraft_array = array();
5167 5167
 		$temp_array = array();
5168 5168
         
5169
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5169
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5170 5170
 		{
5171 5171
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5172 5172
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5186,11 +5186,11 @@  discard block
 block discarded – undo
5186 5186
 	* @return Array the aircraft list
5187 5187
 	*
5188 5188
 	*/
5189
-	public function countAllAircraftTypesByCountry($country,$filters = array())
5189
+	public function countAllAircraftTypesByCountry($country, $filters = array())
5190 5190
 	{
5191
-		$filter_query = $this->getFilter($filters,true,true);
5192
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5193
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5191
+		$filter_query = $this->getFilter($filters, true, true);
5192
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5193
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5194 5194
                     FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
5195 5195
                     GROUP BY spotter_output.aircraft_name 
5196 5196
 			ORDER BY aircraft_icao_count DESC";
@@ -5202,7 +5202,7 @@  discard block
 block discarded – undo
5202 5202
 		$aircraft_array = array();
5203 5203
 		$temp_array = array();
5204 5204
         
5205
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5205
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5206 5206
 		{
5207 5207
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5208 5208
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5221,12 +5221,12 @@  discard block
 block discarded – undo
5221 5221
 	* @return Array the aircraft list
5222 5222
 	*
5223 5223
 	*/
5224
-	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5224
+	public function countAllAircraftRegistrationByCountry($country, $filters = array())
5225 5225
 	{
5226
-		$filter_query = $this->getFilter($filters,true,true);
5226
+		$filter_query = $this->getFilter($filters, true, true);
5227 5227
 		$Image = new Image($this->db);
5228
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5229
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
5228
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5229
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
5230 5230
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country)    
5231 5231
                     GROUP BY spotter_output.registration 
5232 5232
 					ORDER BY registration_count DESC";
@@ -5238,14 +5238,14 @@  discard block
 block discarded – undo
5238 5238
 		$aircraft_array = array();
5239 5239
 		$temp_array = array();
5240 5240
         
5241
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5241
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5242 5242
 		{
5243 5243
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5244 5244
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5245 5245
 			$temp_array['registration'] = $row['registration'];
5246 5246
 			$temp_array['airline_name'] = $row['airline_name'];
5247 5247
 			$temp_array['image_thumbnail'] = "";
5248
-			if($row['registration'] != "")
5248
+			if ($row['registration'] != "")
5249 5249
 			{
5250 5250
 				$image_array = $Image->getSpotterImage($row['registration']);
5251 5251
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5265,11 +5265,11 @@  discard block
 block discarded – undo
5265 5265
 	* @return Array the aircraft manufacturer list
5266 5266
 	*
5267 5267
 	*/
5268
-	public function countAllAircraftManufacturerByCountry($country,$filters = array())
5268
+	public function countAllAircraftManufacturerByCountry($country, $filters = array())
5269 5269
 	{
5270
-		$filter_query = $this->getFilter($filters,true,true);
5271
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5272
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5270
+		$filter_query = $this->getFilter($filters, true, true);
5271
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5272
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5273 5273
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country) 
5274 5274
                     GROUP BY spotter_output.aircraft_manufacturer 
5275 5275
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5281,7 +5281,7 @@  discard block
 block discarded – undo
5281 5281
 		$aircraft_array = array();
5282 5282
 		$temp_array = array();
5283 5283
         
5284
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5284
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5285 5285
 		{
5286 5286
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5287 5287
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5302,8 +5302,8 @@  discard block
 block discarded – undo
5302 5302
 	*/
5303 5303
 	public function countAllAircraftManufacturers($filters = array())
5304 5304
 	{
5305
-		$filter_query = $this->getFilter($filters,true,true);
5306
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5305
+		$filter_query = $this->getFilter($filters, true, true);
5306
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5307 5307
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5308 5308
                 $query .= " GROUP BY spotter_output.aircraft_manufacturer
5309 5309
 					ORDER BY aircraft_manufacturer_count DESC
@@ -5316,7 +5316,7 @@  discard block
 block discarded – undo
5316 5316
 		$manufacturer_array = array();
5317 5317
 		$temp_array = array();
5318 5318
         
5319
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5319
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5320 5320
 		{
5321 5321
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5322 5322
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5335,12 +5335,12 @@  discard block
 block discarded – undo
5335 5335
 	* @return Array the aircraft list
5336 5336
 	*
5337 5337
 	*/
5338
-	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5338
+	public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5339 5339
 	{
5340 5340
 		global $globalDBdriver;
5341 5341
 		$Image = new Image($this->db);
5342
-		$filter_query = $this->getFilter($filters,true,true);
5343
-		$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    
5342
+		$filter_query = $this->getFilter($filters, true, true);
5343
+		$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    
5344 5344
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5345 5345
                 if ($olderthanmonths > 0) {
5346 5346
             		if ($globalDBdriver == 'mysql') {
@@ -5368,7 +5368,7 @@  discard block
 block discarded – undo
5368 5368
 		$aircraft_array = array();
5369 5369
 		$temp_array = array();
5370 5370
         
5371
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5371
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5372 5372
 		{
5373 5373
 			$temp_array['registration'] = $row['registration'];
5374 5374
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -5376,7 +5376,7 @@  discard block
 block discarded – undo
5376 5376
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5377 5377
 			$temp_array['airline_name'] = $row['airline_name'];
5378 5378
 			$temp_array['image_thumbnail'] = "";
5379
-			if($row['registration'] != "")
5379
+			if ($row['registration'] != "")
5380 5380
 			{
5381 5381
 				$image_array = $Image->getSpotterImage($row['registration']);
5382 5382
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5395,12 +5395,12 @@  discard block
 block discarded – undo
5395 5395
 	* @return Array the aircraft list
5396 5396
 	*
5397 5397
 	*/
5398
-	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5398
+	public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5399 5399
 	{
5400 5400
 		global $globalDBdriver;
5401
-		$filter_query = $this->getFilter($filters,true,true);
5401
+		$filter_query = $this->getFilter($filters, true, true);
5402 5402
 		$Image = new Image($this->db);
5403
-		$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    
5403
+		$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    
5404 5404
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5405 5405
                 if ($olderthanmonths > 0) {
5406 5406
             		if ($globalDBdriver == 'mysql') {
@@ -5428,7 +5428,7 @@  discard block
 block discarded – undo
5428 5428
 		$aircraft_array = array();
5429 5429
 		$temp_array = array();
5430 5430
         
5431
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5431
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5432 5432
 		{
5433 5433
 			$temp_array['registration'] = $row['registration'];
5434 5434
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -5437,7 +5437,7 @@  discard block
 block discarded – undo
5437 5437
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5438 5438
 			$temp_array['airline_name'] = $row['airline_name'];
5439 5439
 			$temp_array['image_thumbnail'] = "";
5440
-			if($row['registration'] != "")
5440
+			if ($row['registration'] != "")
5441 5441
 			{
5442 5442
 				$image_array = $Image->getSpotterImage($row['registration']);
5443 5443
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5456,11 +5456,11 @@  discard block
 block discarded – undo
5456 5456
 	* @return Array the airport list
5457 5457
 	*
5458 5458
 	*/
5459
-	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5459
+	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5460 5460
 	{
5461 5461
 		global $globalDBdriver;
5462
-		$filter_query = $this->getFilter($filters,true,true);
5463
-		$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 
5462
+		$filter_query = $this->getFilter($filters, true, true);
5463
+		$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 
5464 5464
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA'";
5465 5465
                 if ($olderthanmonths > 0) {
5466 5466
             		if ($globalDBdriver == 'mysql') {
@@ -5489,7 +5489,7 @@  discard block
 block discarded – undo
5489 5489
 		$airport_array = array();
5490 5490
 		$temp_array = array();
5491 5491
         
5492
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5492
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5493 5493
 		{
5494 5494
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5495 5495
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5508,11 +5508,11 @@  discard block
 block discarded – undo
5508 5508
 	* @return Array the airport list
5509 5509
 	*
5510 5510
 	*/
5511
-	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5511
+	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5512 5512
 	{
5513 5513
 		global $globalDBdriver;
5514
-		$filter_query = $this->getFilter($filters,true,true);
5515
-		$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 
5514
+		$filter_query = $this->getFilter($filters, true, true);
5515
+		$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 
5516 5516
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' ";
5517 5517
                 if ($olderthanmonths > 0) {
5518 5518
             		if ($globalDBdriver == 'mysql') {
@@ -5541,7 +5541,7 @@  discard block
 block discarded – undo
5541 5541
 		$airport_array = array();
5542 5542
 		$temp_array = array();
5543 5543
         
5544
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5544
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5545 5545
 		{
5546 5546
 			$temp_array['airline_icao'] = $row['airline_icao'];
5547 5547
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -5561,11 +5561,11 @@  discard block
 block discarded – undo
5561 5561
 	* @return Array the airport list
5562 5562
 	*
5563 5563
 	*/
5564
-	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5564
+	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5565 5565
 	{
5566 5566
 		global $globalDBdriver;
5567
-		$filter_query = $this->getFilter($filters,true,true);
5568
-		$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
5567
+		$filter_query = $this->getFilter($filters, true, true);
5568
+		$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
5569 5569
 				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";
5570 5570
                 if ($olderthanmonths > 0) {
5571 5571
             		if ($globalDBdriver == 'mysql') {
@@ -5593,7 +5593,7 @@  discard block
 block discarded – undo
5593 5593
 		$airport_array = array();
5594 5594
 		$temp_array = array();
5595 5595
         
5596
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5596
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5597 5597
 		{
5598 5598
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5599 5599
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5612,11 +5612,11 @@  discard block
 block discarded – undo
5612 5612
 	* @return Array the airport list
5613 5613
 	*
5614 5614
 	*/
5615
-	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5615
+	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5616 5616
 	{
5617 5617
 		global $globalDBdriver;
5618
-		$filter_query = $this->getFilter($filters,true,true);
5619
-		$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
5618
+		$filter_query = $this->getFilter($filters, true, true);
5619
+		$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
5620 5620
 				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 ";
5621 5621
                 if ($olderthanmonths > 0) {
5622 5622
             		if ($globalDBdriver == 'mysql') {
@@ -5645,7 +5645,7 @@  discard block
 block discarded – undo
5645 5645
 		$airport_array = array();
5646 5646
 		$temp_array = array();
5647 5647
         
5648
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5648
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5649 5649
 		{
5650 5650
 			$temp_array['airline_icao'] = $row['airline_icao'];
5651 5651
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -5665,11 +5665,11 @@  discard block
 block discarded – undo
5665 5665
 	* @return Array the airport list
5666 5666
 	*
5667 5667
 	*/
5668
-	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
5668
+	public function countAllDepartureAirportsByAirline($airline_icao, $filters = array())
5669 5669
 	{
5670
-		$filter_query = $this->getFilter($filters,true,true);
5671
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5672
-		$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 
5670
+		$filter_query = $this->getFilter($filters, true, true);
5671
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5672
+		$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 
5673 5673
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao 
5674 5674
                     GROUP BY spotter_output.departure_airport_icao
5675 5675
 					ORDER BY airport_departure_icao_count DESC";
@@ -5681,7 +5681,7 @@  discard block
 block discarded – undo
5681 5681
 		$airport_array = array();
5682 5682
 		$temp_array = array();
5683 5683
         
5684
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5684
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5685 5685
 		{
5686 5686
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5687 5687
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5703,11 +5703,11 @@  discard block
 block discarded – undo
5703 5703
 	* @return Array the airport list
5704 5704
 	*
5705 5705
 	*/
5706
-	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
5706
+	public function countAllDepartureAirportCountriesByAirline($airline_icao, $filters = array())
5707 5707
 	{
5708
-		$filter_query = $this->getFilter($filters,true,true);
5709
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5710
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5708
+		$filter_query = $this->getFilter($filters, true, true);
5709
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5710
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5711 5711
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
5712 5712
                     GROUP BY spotter_output.departure_airport_country
5713 5713
 					ORDER BY airport_departure_country_count DESC";
@@ -5719,7 +5719,7 @@  discard block
 block discarded – undo
5719 5719
 		$airport_array = array();
5720 5720
 		$temp_array = array();
5721 5721
         
5722
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5722
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5723 5723
 		{
5724 5724
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5725 5725
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5738,11 +5738,11 @@  discard block
 block discarded – undo
5738 5738
 	* @return Array the airport list
5739 5739
 	*
5740 5740
 	*/
5741
-	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
5741
+	public function countAllDepartureAirportsByAircraft($aircraft_icao, $filters = array())
5742 5742
 	{
5743
-		$filter_query = $this->getFilter($filters,true,true);
5744
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5745
-		$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 
5743
+		$filter_query = $this->getFilter($filters, true, true);
5744
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5745
+		$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 
5746 5746
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao 
5747 5747
                     GROUP BY spotter_output.departure_airport_icao
5748 5748
 					ORDER BY airport_departure_icao_count DESC";
@@ -5754,7 +5754,7 @@  discard block
 block discarded – undo
5754 5754
 		$airport_array = array();
5755 5755
 		$temp_array = array();
5756 5756
         
5757
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5757
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5758 5758
 		{
5759 5759
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5760 5760
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5775,11 +5775,11 @@  discard block
 block discarded – undo
5775 5775
 	* @return Array the airport list
5776 5776
 	*
5777 5777
 	*/
5778
-	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
5778
+	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao, $filters = array())
5779 5779
 	{
5780
-		$filter_query = $this->getFilter($filters,true,true);
5781
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5782
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5780
+		$filter_query = $this->getFilter($filters, true, true);
5781
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5782
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5783 5783
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
5784 5784
                     GROUP BY spotter_output.departure_airport_country
5785 5785
 					ORDER BY airport_departure_country_count DESC";
@@ -5791,7 +5791,7 @@  discard block
 block discarded – undo
5791 5791
 		$airport_array = array();
5792 5792
 		$temp_array = array();
5793 5793
         
5794
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5794
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5795 5795
 		{
5796 5796
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5797 5797
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5809,11 +5809,11 @@  discard block
 block discarded – undo
5809 5809
 	* @return Array the airport list
5810 5810
 	*
5811 5811
 	*/
5812
-	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
5812
+	public function countAllDepartureAirportsByRegistration($registration, $filters = array())
5813 5813
 	{
5814
-		$filter_query = $this->getFilter($filters,true,true);
5815
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
5816
-		$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 
5814
+		$filter_query = $this->getFilter($filters, true, true);
5815
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
5816
+		$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 
5817 5817
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.registration = :registration 
5818 5818
                     GROUP BY spotter_output.departure_airport_icao
5819 5819
 					ORDER BY airport_departure_icao_count DESC";
@@ -5825,7 +5825,7 @@  discard block
 block discarded – undo
5825 5825
 		$airport_array = array();
5826 5826
 		$temp_array = array();
5827 5827
         
5828
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5828
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5829 5829
 		{
5830 5830
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5831 5831
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5846,11 +5846,11 @@  discard block
 block discarded – undo
5846 5846
 	* @return Array the airport list
5847 5847
 	*
5848 5848
 	*/
5849
-	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
5849
+	public function countAllDepartureAirportCountriesByRegistration($registration, $filters = array())
5850 5850
 	{
5851
-		$filter_query = $this->getFilter($filters,true,true);
5852
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
5853
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5851
+		$filter_query = $this->getFilter($filters, true, true);
5852
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
5853
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5854 5854
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration 
5855 5855
                     GROUP BY spotter_output.departure_airport_country
5856 5856
 					ORDER BY airport_departure_country_count DESC";
@@ -5862,7 +5862,7 @@  discard block
 block discarded – undo
5862 5862
 		$airport_array = array();
5863 5863
 		$temp_array = array();
5864 5864
         
5865
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5865
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5866 5866
 		{
5867 5867
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5868 5868
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5880,11 +5880,11 @@  discard block
 block discarded – undo
5880 5880
 	* @return Array the airport list
5881 5881
 	*
5882 5882
 	*/
5883
-	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
5883
+	public function countAllDepartureAirportsByAirport($airport_icao, $filters = array())
5884 5884
 	{
5885
-		$filter_query = $this->getFilter($filters,true,true);
5886
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5887
-		$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 
5885
+		$filter_query = $this->getFilter($filters, true, true);
5886
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5887
+		$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 
5888 5888
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao = :airport_icao 
5889 5889
                     GROUP BY spotter_output.departure_airport_icao
5890 5890
 					ORDER BY airport_departure_icao_count DESC";
@@ -5896,7 +5896,7 @@  discard block
 block discarded – undo
5896 5896
 		$airport_array = array();
5897 5897
 		$temp_array = array();
5898 5898
         
5899
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5899
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5900 5900
 		{
5901 5901
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5902 5902
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5917,11 +5917,11 @@  discard block
 block discarded – undo
5917 5917
 	* @return Array the airport list
5918 5918
 	*
5919 5919
 	*/
5920
-	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
5920
+	public function countAllDepartureAirportCountriesByAirport($airport_icao, $filters = array())
5921 5921
 	{
5922
-		$filter_query = $this->getFilter($filters,true,true);
5923
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5924
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5922
+		$filter_query = $this->getFilter($filters, true, true);
5923
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5924
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5925 5925
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao 
5926 5926
                     GROUP BY spotter_output.departure_airport_country
5927 5927
 					ORDER BY airport_departure_country_count DESC";
@@ -5933,7 +5933,7 @@  discard block
 block discarded – undo
5933 5933
 		$airport_array = array();
5934 5934
 		$temp_array = array();
5935 5935
         
5936
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5936
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5937 5937
 		{
5938 5938
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5939 5939
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5952,11 +5952,11 @@  discard block
 block discarded – undo
5952 5952
 	* @return Array the airport list
5953 5953
 	*
5954 5954
 	*/
5955
-	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
5955
+	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer, $filters = array())
5956 5956
 	{
5957
-		$filter_query = $this->getFilter($filters,true,true);
5958
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5959
-		$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 
5957
+		$filter_query = $this->getFilter($filters, true, true);
5958
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5959
+		$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 
5960 5960
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
5961 5961
                     GROUP BY spotter_output.departure_airport_icao
5962 5962
 					ORDER BY airport_departure_icao_count DESC";
@@ -5968,7 +5968,7 @@  discard block
 block discarded – undo
5968 5968
 		$airport_array = array();
5969 5969
 		$temp_array = array();
5970 5970
         
5971
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5971
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5972 5972
 		{
5973 5973
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5974 5974
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5989,11 +5989,11 @@  discard block
 block discarded – undo
5989 5989
 	* @return Array the airport list
5990 5990
 	*
5991 5991
 	*/
5992
-	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
5992
+	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
5993 5993
 	{
5994
-		$filter_query = $this->getFilter($filters,true,true);
5995
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5996
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5994
+		$filter_query = $this->getFilter($filters, true, true);
5995
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5996
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5997 5997
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
5998 5998
                     GROUP BY spotter_output.departure_airport_country
5999 5999
 					ORDER BY airport_departure_country_count DESC";
@@ -6005,7 +6005,7 @@  discard block
 block discarded – undo
6005 6005
 		$airport_array = array();
6006 6006
 		$temp_array = array();
6007 6007
         
6008
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6008
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6009 6009
 		{
6010 6010
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6011 6011
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6023,11 +6023,11 @@  discard block
 block discarded – undo
6023 6023
 	* @return Array the airport list
6024 6024
 	*
6025 6025
 	*/
6026
-	public function countAllDepartureAirportsByDate($date,$filters = array())
6026
+	public function countAllDepartureAirportsByDate($date, $filters = array())
6027 6027
 	{
6028 6028
 		global $globalTimezone, $globalDBdriver;
6029
-		$filter_query = $this->getFilter($filters,true,true);
6030
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6029
+		$filter_query = $this->getFilter($filters, true, true);
6030
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6031 6031
 		if ($globalTimezone != '') {
6032 6032
 			date_default_timezone_set($globalTimezone);
6033 6033
 			$datetime = new DateTime($date);
@@ -6035,12 +6035,12 @@  discard block
 block discarded – undo
6035 6035
 		} else $offset = '+00:00';
6036 6036
 
6037 6037
 		if ($globalDBdriver == 'mysql') {
6038
-			$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 
6038
+			$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6039 6039
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
6040 6040
 					GROUP BY spotter_output.departure_airport_icao
6041 6041
 					ORDER BY airport_departure_icao_count DESC";
6042 6042
 		} else {
6043
-			$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 
6043
+			$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 
6044 6044
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
6045 6045
 					GROUP BY spotter_output.departure_airport_icao
6046 6046
 					ORDER BY airport_departure_icao_count DESC";
@@ -6052,7 +6052,7 @@  discard block
 block discarded – undo
6052 6052
 		$airport_array = array();
6053 6053
 		$temp_array = array();
6054 6054
         
6055
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6055
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6056 6056
 		{
6057 6057
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6058 6058
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6073,11 +6073,11 @@  discard block
 block discarded – undo
6073 6073
 	* @return Array the airport list
6074 6074
 	*
6075 6075
 	*/
6076
-	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6076
+	public function countAllDepartureAirportCountriesByDate($date, $filters = array())
6077 6077
 	{
6078 6078
 		global $globalTimezone, $globalDBdriver;
6079
-		$filter_query = $this->getFilter($filters,true,true);
6080
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6079
+		$filter_query = $this->getFilter($filters, true, true);
6080
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6081 6081
 		if ($globalTimezone != '') {
6082 6082
 			date_default_timezone_set($globalTimezone);
6083 6083
 			$datetime = new DateTime($date);
@@ -6085,12 +6085,12 @@  discard block
 block discarded – undo
6085 6085
 		} else $offset = '+00:00';
6086 6086
 
6087 6087
 		if ($globalDBdriver == 'mysql') {
6088
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6088
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6089 6089
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
6090 6090
 					GROUP BY spotter_output.departure_airport_country
6091 6091
 					ORDER BY airport_departure_country_count DESC";
6092 6092
 		} else {
6093
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6093
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6094 6094
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
6095 6095
 					GROUP BY spotter_output.departure_airport_country
6096 6096
 					ORDER BY airport_departure_country_count DESC";
@@ -6102,7 +6102,7 @@  discard block
 block discarded – undo
6102 6102
 		$airport_array = array();
6103 6103
 		$temp_array = array();
6104 6104
         
6105
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6105
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6106 6106
 		{
6107 6107
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6108 6108
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6120,11 +6120,11 @@  discard block
 block discarded – undo
6120 6120
 	* @return Array the airport list
6121 6121
 	*
6122 6122
 	*/
6123
-	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6123
+	public function countAllDepartureAirportsByIdent($ident, $filters = array())
6124 6124
 	{
6125
-		$filter_query = $this->getFilter($filters,true,true);
6126
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6127
-		$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 
6125
+		$filter_query = $this->getFilter($filters, true, true);
6126
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6127
+		$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 
6128 6128
 		    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.ident = :ident 
6129 6129
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6130 6130
 		    ORDER BY airport_departure_icao_count DESC";
@@ -6136,7 +6136,7 @@  discard block
 block discarded – undo
6136 6136
 		$airport_array = array();
6137 6137
 		$temp_array = array();
6138 6138
         
6139
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6139
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6140 6140
 		{
6141 6141
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6142 6142
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6158,11 +6158,11 @@  discard block
 block discarded – undo
6158 6158
 	* @return Array the airport list
6159 6159
 	*
6160 6160
 	*/
6161
-	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
6161
+	public function countAllDepartureAirportCountriesByIdent($ident, $filters = array())
6162 6162
 	{
6163
-		$filter_query = $this->getFilter($filters,true,true);
6164
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6165
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6163
+		$filter_query = $this->getFilter($filters, true, true);
6164
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6165
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6166 6166
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident 
6167 6167
                     GROUP BY spotter_output.departure_airport_country
6168 6168
 					ORDER BY airport_departure_country_count DESC";
@@ -6174,7 +6174,7 @@  discard block
 block discarded – undo
6174 6174
 		$airport_array = array();
6175 6175
 		$temp_array = array();
6176 6176
         
6177
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6177
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6178 6178
 		{
6179 6179
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6180 6180
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6193,12 +6193,12 @@  discard block
 block discarded – undo
6193 6193
 	* @return Array the airport list
6194 6194
 	*
6195 6195
 	*/
6196
-	public function countAllDepartureAirportsByCountry($country,$filters = array())
6196
+	public function countAllDepartureAirportsByCountry($country, $filters = array())
6197 6197
 	{
6198
-		$filter_query = $this->getFilter($filters,true,true);
6199
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6198
+		$filter_query = $this->getFilter($filters, true, true);
6199
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6200 6200
 
6201
-		$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 
6201
+		$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 
6202 6202
 			FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
6203 6203
                     GROUP BY spotter_output.departure_airport_icao
6204 6204
 					ORDER BY airport_departure_icao_count DESC";
@@ -6210,7 +6210,7 @@  discard block
 block discarded – undo
6210 6210
 		$airport_array = array();
6211 6211
 		$temp_array = array();
6212 6212
         
6213
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6213
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6214 6214
 		{
6215 6215
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6216 6216
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6231,11 +6231,11 @@  discard block
 block discarded – undo
6231 6231
 	* @return Array the airport list
6232 6232
 	*
6233 6233
 	*/
6234
-	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
6234
+	public function countAllDepartureAirportCountriesByCountry($country, $filters = array())
6235 6235
 	{
6236
-		$filter_query = $this->getFilter($filters,true,true);
6237
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6238
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6236
+		$filter_query = $this->getFilter($filters, true, true);
6237
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6238
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6239 6239
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
6240 6240
                     GROUP BY spotter_output.departure_airport_country
6241 6241
 					ORDER BY airport_departure_country_count DESC";
@@ -6247,7 +6247,7 @@  discard block
 block discarded – undo
6247 6247
 		$airport_array = array();
6248 6248
 		$temp_array = array();
6249 6249
         
6250
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6250
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6251 6251
 		{
6252 6252
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6253 6253
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6265,11 +6265,11 @@  discard block
 block discarded – undo
6265 6265
 	* @return Array the airport list
6266 6266
 	*
6267 6267
 	*/
6268
-	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6268
+	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6269 6269
 	{
6270 6270
 		global $globalDBdriver;
6271
-		$filter_query = $this->getFilter($filters,true,true);
6272
-		$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 
6271
+		$filter_query = $this->getFilter($filters, true, true);
6272
+		$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 
6273 6273
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
6274 6274
                 if ($olderthanmonths > 0) {
6275 6275
             		if ($globalDBdriver == 'mysql') {
@@ -6304,7 +6304,7 @@  discard block
 block discarded – undo
6304 6304
 		$airport_array = array();
6305 6305
 		$temp_array = array();
6306 6306
         
6307
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6307
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6308 6308
 		{
6309 6309
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6310 6310
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6327,11 +6327,11 @@  discard block
 block discarded – undo
6327 6327
 	* @return Array the airport list
6328 6328
 	*
6329 6329
 	*/
6330
-	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6330
+	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6331 6331
 	{
6332 6332
 		global $globalDBdriver;
6333
-		$filter_query = $this->getFilter($filters,true,true);
6334
-		$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 
6333
+		$filter_query = $this->getFilter($filters, true, true);
6334
+		$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 
6335 6335
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' ";
6336 6336
                 if ($olderthanmonths > 0) {
6337 6337
             		if ($globalDBdriver == 'mysql') {
@@ -6366,7 +6366,7 @@  discard block
 block discarded – undo
6366 6366
 		$airport_array = array();
6367 6367
 		$temp_array = array();
6368 6368
         
6369
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6369
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6370 6370
 		{
6371 6371
 			$temp_array['airline_icao'] = $row['airline_icao'];
6372 6372
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
@@ -6391,11 +6391,11 @@  discard block
 block discarded – undo
6391 6391
 	* @return Array the airport list
6392 6392
 	*
6393 6393
 	*/
6394
-	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6394
+	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6395 6395
 	{
6396 6396
 		global $globalDBdriver;
6397
-		$filter_query = $this->getFilter($filters,true,true);
6398
-		$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 
6397
+		$filter_query = $this->getFilter($filters, true, true);
6398
+		$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 
6399 6399
 			FROM spotter_output, airport".$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";
6400 6400
                 if ($olderthanmonths > 0) {
6401 6401
             		if ($globalDBdriver == 'mysql') {
@@ -6429,7 +6429,7 @@  discard block
 block discarded – undo
6429 6429
 		$airport_array = array();
6430 6430
 		$temp_array = array();
6431 6431
         
6432
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6432
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6433 6433
 		{
6434 6434
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6435 6435
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6452,11 +6452,11 @@  discard block
 block discarded – undo
6452 6452
 	* @return Array the airport list
6453 6453
 	*
6454 6454
 	*/
6455
-	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6455
+	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6456 6456
 	{
6457 6457
 		global $globalDBdriver;
6458
-		$filter_query = $this->getFilter($filters,true,true);
6459
-		$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 
6458
+		$filter_query = $this->getFilter($filters, true, true);
6459
+		$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 
6460 6460
 			FROM spotter_output, airport".$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 ";
6461 6461
                 if ($olderthanmonths > 0) {
6462 6462
             		if ($globalDBdriver == 'mysql') {
@@ -6491,7 +6491,7 @@  discard block
 block discarded – undo
6491 6491
 		$airport_array = array();
6492 6492
 		$temp_array = array();
6493 6493
         
6494
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6494
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6495 6495
 		{
6496 6496
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6497 6497
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6517,9 +6517,9 @@  discard block
 block discarded – undo
6517 6517
 	*/
6518 6518
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
6519 6519
 	{
6520
-		$filter_query = $this->getFilter($filters,true,true);
6521
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6522
-		$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 
6520
+		$filter_query = $this->getFilter($filters, true, true);
6521
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6522
+		$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 
6523 6523
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao 
6524 6524
                     GROUP BY spotter_output.arrival_airport_icao
6525 6525
 					ORDER BY airport_arrival_icao_count DESC";
@@ -6530,7 +6530,7 @@  discard block
 block discarded – undo
6530 6530
 		$airport_array = array();
6531 6531
 		$temp_array = array();
6532 6532
         
6533
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6533
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6534 6534
 		{
6535 6535
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6536 6536
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6551,12 +6551,12 @@  discard block
 block discarded – undo
6551 6551
 	* @return Array the airport list
6552 6552
 	*
6553 6553
 	*/
6554
-	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
6554
+	public function countAllArrivalAirportCountriesByAirline($airline_icao, $filters = array())
6555 6555
 	{
6556
-		$filter_query = $this->getFilter($filters,true,true);
6557
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6556
+		$filter_query = $this->getFilter($filters, true, true);
6557
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6558 6558
 					
6559
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6559
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6560 6560
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
6561 6561
                     GROUP BY spotter_output.arrival_airport_country
6562 6562
 					ORDER BY airport_arrival_country_count DESC";
@@ -6568,7 +6568,7 @@  discard block
 block discarded – undo
6568 6568
 		$airport_array = array();
6569 6569
 		$temp_array = array();
6570 6570
         
6571
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6571
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6572 6572
 		{
6573 6573
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6574 6574
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6586,11 +6586,11 @@  discard block
 block discarded – undo
6586 6586
 	* @return Array the airport list
6587 6587
 	*
6588 6588
 	*/
6589
-	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
6589
+	public function countAllArrivalAirportsByAircraft($aircraft_icao, $filters = array())
6590 6590
 	{
6591
-		$filter_query = $this->getFilter($filters,true,true);
6592
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6593
-		$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 
6591
+		$filter_query = $this->getFilter($filters, true, true);
6592
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6593
+		$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 
6594 6594
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao 
6595 6595
                     GROUP BY spotter_output.arrival_airport_icao
6596 6596
 					ORDER BY airport_arrival_icao_count DESC";
@@ -6602,7 +6602,7 @@  discard block
 block discarded – undo
6602 6602
 		$airport_array = array();
6603 6603
 		$temp_array = array();
6604 6604
         
6605
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6605
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6606 6606
 		{
6607 6607
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6608 6608
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6624,11 +6624,11 @@  discard block
 block discarded – undo
6624 6624
 	* @return Array the airport list
6625 6625
 	*
6626 6626
 	*/
6627
-	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
6627
+	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao, $filters = array())
6628 6628
 	{
6629
-		$filter_query = $this->getFilter($filters,true,true);
6630
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6631
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6629
+		$filter_query = $this->getFilter($filters, true, true);
6630
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6631
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6632 6632
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
6633 6633
                     GROUP BY spotter_output.arrival_airport_country
6634 6634
 					ORDER BY airport_arrival_country_count DESC";
@@ -6640,7 +6640,7 @@  discard block
 block discarded – undo
6640 6640
 		$airport_array = array();
6641 6641
 		$temp_array = array();
6642 6642
         
6643
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6643
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6644 6644
 		{
6645 6645
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6646 6646
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6658,12 +6658,12 @@  discard block
 block discarded – undo
6658 6658
 	* @return Array the airport list
6659 6659
 	*
6660 6660
 	*/
6661
-	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
6661
+	public function countAllArrivalAirportsByRegistration($registration, $filters = array())
6662 6662
 	{
6663
-		$filter_query = $this->getFilter($filters,true,true);
6664
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6663
+		$filter_query = $this->getFilter($filters, true, true);
6664
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6665 6665
 
6666
-		$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 
6666
+		$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 
6667 6667
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.registration = :registration 
6668 6668
                     GROUP BY spotter_output.arrival_airport_icao
6669 6669
 					ORDER BY airport_arrival_icao_count DESC";
@@ -6675,7 +6675,7 @@  discard block
 block discarded – undo
6675 6675
 		$airport_array = array();
6676 6676
 		$temp_array = array();
6677 6677
         
6678
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6678
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6679 6679
 		{
6680 6680
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6681 6681
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6696,11 +6696,11 @@  discard block
 block discarded – undo
6696 6696
 	* @return Array the airport list
6697 6697
 	*
6698 6698
 	*/
6699
-	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
6699
+	public function countAllArrivalAirportCountriesByRegistration($registration, $filters = array())
6700 6700
 	{
6701
-		$filter_query = $this->getFilter($filters,true,true);
6702
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6703
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6701
+		$filter_query = $this->getFilter($filters, true, true);
6702
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6703
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6704 6704
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration 
6705 6705
                     GROUP BY spotter_output.arrival_airport_country
6706 6706
 					ORDER BY airport_arrival_country_count DESC";
@@ -6712,7 +6712,7 @@  discard block
 block discarded – undo
6712 6712
 		$airport_array = array();
6713 6713
 		$temp_array = array();
6714 6714
         
6715
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6715
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6716 6716
 		{
6717 6717
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6718 6718
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6731,11 +6731,11 @@  discard block
 block discarded – undo
6731 6731
 	* @return Array the airport list
6732 6732
 	*
6733 6733
 	*/
6734
-	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
6734
+	public function countAllArrivalAirportsByAirport($airport_icao, $filters = array())
6735 6735
 	{
6736
-		$filter_query = $this->getFilter($filters,true,true);
6737
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6738
-		$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 
6736
+		$filter_query = $this->getFilter($filters, true, true);
6737
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6738
+		$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 
6739 6739
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.departure_airport_icao = :airport_icao 
6740 6740
                     GROUP BY spotter_output.arrival_airport_icao
6741 6741
 					ORDER BY airport_arrival_icao_count DESC";
@@ -6747,7 +6747,7 @@  discard block
 block discarded – undo
6747 6747
 		$airport_array = array();
6748 6748
 		$temp_array = array();
6749 6749
         
6750
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6750
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6751 6751
 		{
6752 6752
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6753 6753
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6768,11 +6768,11 @@  discard block
 block discarded – undo
6768 6768
 	* @return Array the airport list
6769 6769
 	*
6770 6770
 	*/
6771
-	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
6771
+	public function countAllArrivalAirportCountriesByAirport($airport_icao, $filters = array())
6772 6772
 	{
6773
-		$filter_query = $this->getFilter($filters,true,true);
6774
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6775
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6773
+		$filter_query = $this->getFilter($filters, true, true);
6774
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6775
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6776 6776
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao 
6777 6777
                     GROUP BY spotter_output.arrival_airport_country
6778 6778
 					ORDER BY airport_arrival_country_count DESC";
@@ -6784,7 +6784,7 @@  discard block
 block discarded – undo
6784 6784
 		$airport_array = array();
6785 6785
 		$temp_array = array();
6786 6786
         
6787
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6787
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6788 6788
 		{
6789 6789
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6790 6790
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6802,11 +6802,11 @@  discard block
 block discarded – undo
6802 6802
 	* @return Array the airport list
6803 6803
 	*
6804 6804
 	*/
6805
-	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6805
+	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer, $filters = array())
6806 6806
 	{
6807
-		$filter_query = $this->getFilter($filters,true,true);
6808
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6809
-		$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 
6807
+		$filter_query = $this->getFilter($filters, true, true);
6808
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6809
+		$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 
6810 6810
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6811 6811
                     GROUP BY spotter_output.arrival_airport_icao
6812 6812
 					ORDER BY airport_arrival_icao_count DESC";
@@ -6818,7 +6818,7 @@  discard block
 block discarded – undo
6818 6818
 		$airport_array = array();
6819 6819
 		$temp_array = array();
6820 6820
         
6821
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6821
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6822 6822
 		{
6823 6823
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6824 6824
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6840,11 +6840,11 @@  discard block
 block discarded – undo
6840 6840
 	* @return Array the airport list
6841 6841
 	*
6842 6842
 	*/
6843
-	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6843
+	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
6844 6844
 	{
6845
-		$filter_query = $this->getFilter($filters,true,true);
6846
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6847
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6845
+		$filter_query = $this->getFilter($filters, true, true);
6846
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6847
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6848 6848
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6849 6849
                     GROUP BY spotter_output.arrival_airport_country
6850 6850
 					ORDER BY airport_arrival_country_count DESC";
@@ -6856,7 +6856,7 @@  discard block
 block discarded – undo
6856 6856
 		$airport_array = array();
6857 6857
 		$temp_array = array();
6858 6858
         
6859
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6859
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6860 6860
 		{
6861 6861
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6862 6862
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6875,11 +6875,11 @@  discard block
 block discarded – undo
6875 6875
 	* @return Array the airport list
6876 6876
 	*
6877 6877
 	*/
6878
-	public function countAllArrivalAirportsByDate($date,$filters = array())
6878
+	public function countAllArrivalAirportsByDate($date, $filters = array())
6879 6879
 	{
6880 6880
 		global $globalTimezone, $globalDBdriver;
6881
-		$filter_query = $this->getFilter($filters,true,true);
6882
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6881
+		$filter_query = $this->getFilter($filters, true, true);
6882
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6883 6883
 		if ($globalTimezone != '') {
6884 6884
 			date_default_timezone_set($globalTimezone);
6885 6885
 			$datetime = new DateTime($date);
@@ -6887,12 +6887,12 @@  discard block
 block discarded – undo
6887 6887
 		} else $offset = '+00:00';
6888 6888
 
6889 6889
 		if ($globalDBdriver == 'mysql') {
6890
-			$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 
6890
+			$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 
6891 6891
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
6892 6892
 					GROUP BY spotter_output.arrival_airport_icao
6893 6893
 					ORDER BY airport_arrival_icao_count DESC";
6894 6894
 		} else {
6895
-			$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 
6895
+			$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 
6896 6896
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
6897 6897
 					GROUP BY spotter_output.arrival_airport_icao
6898 6898
 					ORDER BY airport_arrival_icao_count DESC";
@@ -6904,7 +6904,7 @@  discard block
 block discarded – undo
6904 6904
 		$airport_array = array();
6905 6905
 		$temp_array = array();
6906 6906
         
6907
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6907
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6908 6908
 		{
6909 6909
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6910 6910
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6928,8 +6928,8 @@  discard block
 block discarded – undo
6928 6928
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
6929 6929
 	{
6930 6930
 		global $globalTimezone, $globalDBdriver;
6931
-		$filter_query = $this->getFilter($filters,true,true);
6932
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6931
+		$filter_query = $this->getFilter($filters, true, true);
6932
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6933 6933
 		if ($globalTimezone != '') {
6934 6934
 			date_default_timezone_set($globalTimezone);
6935 6935
 			$datetime = new DateTime($date);
@@ -6937,12 +6937,12 @@  discard block
 block discarded – undo
6937 6937
 		} else $offset = '+00:00';
6938 6938
 
6939 6939
 		if ($globalDBdriver == 'mysql') {
6940
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6940
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6941 6941
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
6942 6942
 					GROUP BY spotter_output.arrival_airport_country
6943 6943
 					ORDER BY airport_arrival_country_count DESC";
6944 6944
 		} else {
6945
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6945
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6946 6946
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
6947 6947
 					GROUP BY spotter_output.arrival_airport_country
6948 6948
 					ORDER BY airport_arrival_country_count DESC";
@@ -6954,7 +6954,7 @@  discard block
 block discarded – undo
6954 6954
 		$airport_array = array();
6955 6955
 		$temp_array = array();
6956 6956
         
6957
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6957
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6958 6958
 		{
6959 6959
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6960 6960
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6972,11 +6972,11 @@  discard block
 block discarded – undo
6972 6972
 	* @return Array the airport list
6973 6973
 	*
6974 6974
 	*/
6975
-	public function countAllArrivalAirportsByIdent($ident,$filters = array())
6975
+	public function countAllArrivalAirportsByIdent($ident, $filters = array())
6976 6976
 	{
6977
-		$filter_query = $this->getFilter($filters,true,true);
6978
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6979
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6977
+		$filter_query = $this->getFilter($filters, true, true);
6978
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6979
+		$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 
6980 6980
 		    FROM spotter_output".$filter_query." WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.ident = :ident  
6981 6981
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6982 6982
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -6988,7 +6988,7 @@  discard block
 block discarded – undo
6988 6988
 		$airport_array = array();
6989 6989
 		$temp_array = array();
6990 6990
         
6991
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6991
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6992 6992
 		{
6993 6993
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6994 6994
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7011,9 +7011,9 @@  discard block
 block discarded – undo
7011 7011
 	*/
7012 7012
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
7013 7013
 	{
7014
-		$filter_query = $this->getFilter($filters,true,true);
7015
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7016
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7014
+		$filter_query = $this->getFilter($filters, true, true);
7015
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7016
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7017 7017
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident 
7018 7018
                     GROUP BY spotter_output.arrival_airport_country
7019 7019
 					ORDER BY airport_arrival_country_count DESC";
@@ -7025,7 +7025,7 @@  discard block
 block discarded – undo
7025 7025
 		$airport_array = array();
7026 7026
 		$temp_array = array();
7027 7027
         
7028
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7028
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7029 7029
 		{
7030 7030
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7031 7031
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7044,11 +7044,11 @@  discard block
 block discarded – undo
7044 7044
 	* @return Array the airport list
7045 7045
 	*
7046 7046
 	*/
7047
-	public function countAllArrivalAirportsByCountry($country,$filters = array())
7047
+	public function countAllArrivalAirportsByCountry($country, $filters = array())
7048 7048
 	{
7049
-		$filter_query = $this->getFilter($filters,true,true);
7050
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7051
-		$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 
7049
+		$filter_query = $this->getFilter($filters, true, true);
7050
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7051
+		$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 
7052 7052
 			FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
7053 7053
                     GROUP BY spotter_output.arrival_airport_icao
7054 7054
 					ORDER BY airport_arrival_icao_count DESC";
@@ -7060,7 +7060,7 @@  discard block
 block discarded – undo
7060 7060
 		$airport_array = array();
7061 7061
 		$temp_array = array();
7062 7062
         
7063
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7063
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7064 7064
 		{
7065 7065
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7066 7066
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7081,11 +7081,11 @@  discard block
 block discarded – undo
7081 7081
 	* @return Array the airport list
7082 7082
 	*
7083 7083
 	*/
7084
-	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
7084
+	public function countAllArrivalAirportCountriesByCountry($country, $filters = array())
7085 7085
 	{
7086
-		$filter_query = $this->getFilter($filters,true,true);
7087
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7088
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7086
+		$filter_query = $this->getFilter($filters, true, true);
7087
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7088
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7089 7089
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
7090 7090
                     GROUP BY spotter_output.arrival_airport_country
7091 7091
 					ORDER BY airport_arrival_country_count DESC";
@@ -7097,7 +7097,7 @@  discard block
 block discarded – undo
7097 7097
 		$airport_array = array();
7098 7098
 		$temp_array = array();
7099 7099
         
7100
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7100
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7101 7101
 		{
7102 7102
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7103 7103
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7118,7 +7118,7 @@  discard block
 block discarded – undo
7118 7118
 	*/
7119 7119
 	public function countAllDepartureCountries($filters = array())
7120 7120
 	{
7121
-		$filter_query = $this->getFilter($filters,true,true);
7121
+		$filter_query = $this->getFilter($filters, true, true);
7122 7122
 		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7123 7123
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA'";
7124 7124
 		$query .= " GROUP BY spotter_output.departure_airport_country
@@ -7132,7 +7132,7 @@  discard block
 block discarded – undo
7132 7132
 		$airport_array = array();
7133 7133
 		$temp_array = array();
7134 7134
         
7135
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7135
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7136 7136
 		{
7137 7137
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
7138 7138
 			$temp_array['airport_departure_country'] = $row['departure_airport_country'];
@@ -7150,9 +7150,9 @@  discard block
 block discarded – undo
7150 7150
 	* @return Array the airport arrival list
7151 7151
 	*
7152 7152
 	*/
7153
-	public function countAllArrivalCountries($limit = true,$filters = array())
7153
+	public function countAllArrivalCountries($limit = true, $filters = array())
7154 7154
 	{
7155
-		$filter_query = $this->getFilter($filters,true,true);
7155
+		$filter_query = $this->getFilter($filters, true, true);
7156 7156
 		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7157 7157
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
7158 7158
 		$query .= " GROUP BY spotter_output.arrival_airport_country
@@ -7166,7 +7166,7 @@  discard block
 block discarded – undo
7166 7166
 		$airport_array = array();
7167 7167
 		$temp_array = array();
7168 7168
         
7169
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7169
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7170 7170
 		{
7171 7171
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
7172 7172
 			$temp_array['airport_arrival_country'] = $row['arrival_airport_country'];
@@ -7189,8 +7189,8 @@  discard block
 block discarded – undo
7189 7189
 	*/
7190 7190
 	public function countAllRoutes($filters = array())
7191 7191
 	{
7192
-		$filter_query = $this->getFilter($filters,true,true);
7193
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7192
+		$filter_query = $this->getFilter($filters, true, true);
7193
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7194 7194
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> 'NA'
7195 7195
                     GROUP BY route,spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7196 7196
                     ORDER BY route_count DESC
@@ -7203,7 +7203,7 @@  discard block
 block discarded – undo
7203 7203
 		$routes_array = array();
7204 7204
 		$temp_array = array();
7205 7205
         
7206
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7206
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7207 7207
 		{
7208 7208
 			$temp_array['route_count'] = $row['route_count'];
7209 7209
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7230,11 +7230,11 @@  discard block
 block discarded – undo
7230 7230
 	* @return Array the route list
7231 7231
 	*
7232 7232
 	*/
7233
-	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
7233
+	public function countAllRoutesByAircraft($aircraft_icao, $filters = array())
7234 7234
 	{
7235
-		$filter_query = $this->getFilter($filters,true,true);
7236
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7237
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7235
+		$filter_query = $this->getFilter($filters, true, true);
7236
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7237
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7238 7238
 			FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
7239 7239
                     GROUP BY route
7240 7240
                     ORDER BY route_count DESC";
@@ -7245,7 +7245,7 @@  discard block
 block discarded – undo
7245 7245
 		$routes_array = array();
7246 7246
 		$temp_array = array();
7247 7247
         
7248
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7248
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7249 7249
 		{
7250 7250
 			$temp_array['route_count'] = $row['route_count'];
7251 7251
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7272,9 +7272,9 @@  discard block
 block discarded – undo
7272 7272
 	*/
7273 7273
 	public function countAllRoutesByRegistration($registration, $filters = array())
7274 7274
 	{
7275
-		$filter_query = $this->getFilter($filters,true,true);
7275
+		$filter_query = $this->getFilter($filters, true, true);
7276 7276
 		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7277
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7277
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7278 7278
 			FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.registration = :registration 
7279 7279
                     GROUP BY route
7280 7280
                     ORDER BY route_count DESC";
@@ -7286,7 +7286,7 @@  discard block
 block discarded – undo
7286 7286
 		$routes_array = array();
7287 7287
 		$temp_array = array();
7288 7288
         
7289
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7289
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7290 7290
 		{
7291 7291
 			$temp_array['route_count'] = $row['route_count'];
7292 7292
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7314,9 +7314,9 @@  discard block
 block discarded – undo
7314 7314
 	*/
7315 7315
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
7316 7316
 	{
7317
-		$filter_query = $this->getFilter($filters,true,true);
7318
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7319
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7317
+		$filter_query = $this->getFilter($filters, true, true);
7318
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7319
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7320 7320
 			FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao 
7321 7321
                     GROUP BY route
7322 7322
                     ORDER BY route_count DESC";
@@ -7328,7 +7328,7 @@  discard block
 block discarded – undo
7328 7328
 		$routes_array = array();
7329 7329
 		$temp_array = array();
7330 7330
         
7331
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7331
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7332 7332
 		{
7333 7333
 			$temp_array['route_count'] = $row['route_count'];
7334 7334
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7356,9 +7356,9 @@  discard block
 block discarded – undo
7356 7356
 	*/
7357 7357
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
7358 7358
 	{
7359
-		$filter_query = $this->getFilter($filters,true,true);
7360
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7361
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7359
+		$filter_query = $this->getFilter($filters, true, true);
7360
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7361
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7362 7362
 			FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
7363 7363
                     GROUP BY route
7364 7364
                     ORDER BY route_count DESC";
@@ -7369,7 +7369,7 @@  discard block
 block discarded – undo
7369 7369
 		$routes_array = array();
7370 7370
 		$temp_array = array();
7371 7371
         
7372
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7372
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7373 7373
 		{
7374 7374
 			$temp_array['route_count'] = $row['route_count'];
7375 7375
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7397,9 +7397,9 @@  discard block
 block discarded – undo
7397 7397
 	*/
7398 7398
 	public function countAllRoutesByCountry($country, $filters = array())
7399 7399
 	{
7400
-		$filter_query = $this->getFilter($filters,true,true);
7401
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7402
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7400
+		$filter_query = $this->getFilter($filters, true, true);
7401
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7402
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7403 7403
 			FROM spotter_output".$filter_query." spotter_output.ident <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
7404 7404
                     GROUP BY route
7405 7405
                     ORDER BY route_count DESC";
@@ -7410,7 +7410,7 @@  discard block
 block discarded – undo
7410 7410
 		$routes_array = array();
7411 7411
 		$temp_array = array();
7412 7412
         
7413
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7413
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7414 7414
 		{
7415 7415
 			$temp_array['route_count'] = $row['route_count'];
7416 7416
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7438,8 +7438,8 @@  discard block
 block discarded – undo
7438 7438
 	public function countAllRoutesByDate($date, $filters = array())
7439 7439
 	{
7440 7440
 		global $globalTimezone, $globalDBdriver;
7441
-		$filter_query = $this->getFilter($filters,true,true);
7442
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7441
+		$filter_query = $this->getFilter($filters, true, true);
7442
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7443 7443
 		if ($globalTimezone != '') {
7444 7444
 			date_default_timezone_set($globalTimezone);
7445 7445
 			$datetime = new DateTime($date);
@@ -7447,12 +7447,12 @@  discard block
 block discarded – undo
7447 7447
 		} else $offset = '+00:00';
7448 7448
 		
7449 7449
 		if ($globalDBdriver == 'mysql') {
7450
-			$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7450
+			$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7451 7451
 					FROM spotter_output".$filter_query." spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
7452 7452
 					GROUP BY route
7453 7453
 					ORDER BY route_count DESC";
7454 7454
 		} else {
7455
-			$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7455
+			$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7456 7456
 					FROM spotter_output".$filter_query." spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
7457 7457
 					GROUP BY route
7458 7458
 					ORDER BY route_count DESC";
@@ -7464,7 +7464,7 @@  discard block
 block discarded – undo
7464 7464
 		$routes_array = array();
7465 7465
 		$temp_array = array();
7466 7466
         
7467
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7467
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7468 7468
 		{
7469 7469
 			$temp_array['route_count'] = $row['route_count'];
7470 7470
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7491,9 +7491,9 @@  discard block
 block discarded – undo
7491 7491
 	*/
7492 7492
 	public function countAllRoutesByIdent($ident, $filters = array())
7493 7493
 	{
7494
-		$filter_query = $this->getFilter($filters,true,true);
7495
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7496
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7494
+		$filter_query = $this->getFilter($filters, true, true);
7495
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7496
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7497 7497
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.ident = :ident   
7498 7498
                     GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7499 7499
                     ORDER BY route_count DESC";
@@ -7505,7 +7505,7 @@  discard block
 block discarded – undo
7505 7505
 		$routes_array = array();
7506 7506
 		$temp_array = array();
7507 7507
         
7508
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7508
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7509 7509
 		{
7510 7510
 			$temp_array['route_count'] = $row['route_count'];
7511 7511
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7532,9 +7532,9 @@  discard block
 block discarded – undo
7532 7532
 	*/
7533 7533
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
7534 7534
 	{
7535
-		$filter_query = $this->getFilter($filters,true,true);
7536
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7537
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7535
+		$filter_query = $this->getFilter($filters, true, true);
7536
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7537
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7538 7538
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
7539 7539
                     GROUP BY route
7540 7540
                     ORDER BY route_count DESC";
@@ -7546,7 +7546,7 @@  discard block
 block discarded – undo
7546 7546
 		$routes_array = array();
7547 7547
 		$temp_array = array();
7548 7548
         
7549
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7549
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7550 7550
 		{
7551 7551
 			$temp_array['route_count'] = $row['route_count'];
7552 7552
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7574,8 +7574,8 @@  discard block
 block discarded – undo
7574 7574
 	*/
7575 7575
 	public function countAllRoutesWithWaypoints($filters = array())
7576 7576
 	{
7577
-		$filter_query = $this->getFilter($filters,true,true);
7578
-		$query  = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7577
+		$filter_query = $this->getFilter($filters, true, true);
7578
+		$query = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7579 7579
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.waypoints <> '' 
7580 7580
                     GROUP BY route, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7581 7581
                     ORDER BY route_count DESC
@@ -7588,7 +7588,7 @@  discard block
 block discarded – undo
7588 7588
 		$routes_array = array();
7589 7589
 		$temp_array = array();
7590 7590
         
7591
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7591
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7592 7592
 		{
7593 7593
 			$temp_array['spotter_id'] = $row['spotter_id'];
7594 7594
 			$temp_array['route_count'] = $row['route_count'];
@@ -7613,11 +7613,11 @@  discard block
 block discarded – undo
7613 7613
 	* @return Array the callsign list
7614 7614
 	*
7615 7615
 	*/
7616
-	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
7616
+	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7617 7617
 	{
7618 7618
 		global $globalDBdriver;
7619
-		$filter_query = $this->getFilter($filters,true,true);
7620
-		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7619
+		$filter_query = $this->getFilter($filters, true, true);
7620
+		$query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7621 7621
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
7622 7622
 		 if ($olderthanmonths > 0) {
7623 7623
 			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
@@ -7636,7 +7636,7 @@  discard block
 block discarded – undo
7636 7636
 		$callsign_array = array();
7637 7637
 		$temp_array = array();
7638 7638
         
7639
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7639
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7640 7640
 		{
7641 7641
 			$temp_array['callsign_icao'] = $row['ident'];
7642 7642
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -7658,8 +7658,8 @@  discard block
 block discarded – undo
7658 7658
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7659 7659
 	{
7660 7660
 		global $globalDBdriver;
7661
-		$filter_query = $this->getFilter($filters,true,true);
7662
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7661
+		$filter_query = $this->getFilter($filters, true, true);
7662
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7663 7663
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
7664 7664
 		 if ($olderthanmonths > 0) {
7665 7665
 			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
@@ -7678,7 +7678,7 @@  discard block
 block discarded – undo
7678 7678
 		$callsign_array = array();
7679 7679
 		$temp_array = array();
7680 7680
         
7681
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7681
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7682 7682
 		{
7683 7683
 			$temp_array['callsign_icao'] = $row['ident'];
7684 7684
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -7732,7 +7732,7 @@  discard block
 block discarded – undo
7732 7732
 		$date_array = array();
7733 7733
 		$temp_array = array();
7734 7734
         
7735
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7735
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7736 7736
 		{
7737 7737
 			$temp_array['date_name'] = $row['date_name'];
7738 7738
 			$temp_array['date_count'] = $row['date_count'];
@@ -7757,15 +7757,15 @@  discard block
 block discarded – undo
7757 7757
 			$datetime = new DateTime();
7758 7758
 			$offset = $datetime->format('P');
7759 7759
 		} else $offset = '+00:00';
7760
-		$filter_query = $this->getFilter($filters,true,true);
7760
+		$filter_query = $this->getFilter($filters, true, true);
7761 7761
 		if ($globalDBdriver == 'mysql') {
7762
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7762
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7763 7763
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
7764 7764
 								GROUP BY spotter_output.airline_icao, date_name 
7765 7765
 								ORDER BY date_count DESC
7766 7766
 								LIMIT 10 OFFSET 0";
7767 7767
 		} else {
7768
-			$query  = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
7768
+			$query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
7769 7769
 								FROM spotter_output 
7770 7770
 								WHERE spotter_output.airline_icao <> '' 
7771 7771
 								GROUP BY spotter_output.airline_icao, date_name 
@@ -7780,7 +7780,7 @@  discard block
 block discarded – undo
7780 7780
 		$date_array = array();
7781 7781
 		$temp_array = array();
7782 7782
         
7783
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7783
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7784 7784
 		{
7785 7785
 			$temp_array['date_name'] = $row['date_name'];
7786 7786
 			$temp_array['date_count'] = $row['date_count'];
@@ -7806,7 +7806,7 @@  discard block
 block discarded – undo
7806 7806
 			$datetime = new DateTime();
7807 7807
 			$offset = $datetime->format('P');
7808 7808
 		} else $offset = '+00:00';
7809
-		$filter_query = $this->getFilter($filters,true,true);
7809
+		$filter_query = $this->getFilter($filters, true, true);
7810 7810
 		if ($globalDBdriver == 'mysql') {
7811 7811
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7812 7812
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -7827,7 +7827,7 @@  discard block
 block discarded – undo
7827 7827
 		$date_array = array();
7828 7828
 		$temp_array = array();
7829 7829
         
7830
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7830
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7831 7831
 		{
7832 7832
 			$temp_array['date_name'] = $row['date_name'];
7833 7833
 			$temp_array['date_count'] = $row['date_count'];
@@ -7852,7 +7852,7 @@  discard block
 block discarded – undo
7852 7852
 			$datetime = new DateTime();
7853 7853
 			$offset = $datetime->format('P');
7854 7854
 		} else $offset = '+00:00';
7855
-		$filter_query = $this->getFilter($filters,true,true);
7855
+		$filter_query = $this->getFilter($filters, true, true);
7856 7856
 		if ($globalDBdriver == 'mysql') {
7857 7857
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7858 7858
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)";
@@ -7873,7 +7873,7 @@  discard block
 block discarded – undo
7873 7873
 		$date_array = array();
7874 7874
 		$temp_array = array();
7875 7875
         
7876
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7876
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7877 7877
 		{
7878 7878
 			$temp_array['date_name'] = $row['date_name'];
7879 7879
 			$temp_array['date_count'] = $row['date_count'];
@@ -7894,7 +7894,7 @@  discard block
 block discarded – undo
7894 7894
 	public function countAllDatesLastMonthByAirlines($filters = array())
7895 7895
 	{
7896 7896
 		global $globalTimezone, $globalDBdriver;
7897
-		$filter_query = $this->getFilter($filters,true,true);
7897
+		$filter_query = $this->getFilter($filters, true, true);
7898 7898
 		if ($globalTimezone != '') {
7899 7899
 			date_default_timezone_set($globalTimezone);
7900 7900
 			$datetime = new DateTime();
@@ -7902,13 +7902,13 @@  discard block
 block discarded – undo
7902 7902
 		} else $offset = '+00:00';
7903 7903
 		
7904 7904
 		if ($globalDBdriver == 'mysql') {
7905
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7905
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7906 7906
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)
7907 7907
 								GROUP BY spotter_output.airline_icao, date_name 
7908 7908
 								ORDER BY spotter_output.date ASC";
7909 7909
 			$query_data = array(':offset' => $offset);
7910 7910
 		} else {
7911
-			$query  = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
7911
+			$query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
7912 7912
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS'
7913 7913
 								GROUP BY spotter_output.airline_icao, date_name 
7914 7914
 								ORDER BY date_name ASC";
@@ -7921,7 +7921,7 @@  discard block
 block discarded – undo
7921 7921
 		$date_array = array();
7922 7922
 		$temp_array = array();
7923 7923
         
7924
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7924
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7925 7925
 		{
7926 7926
 			$temp_array['date_name'] = $row['date_name'];
7927 7927
 			$temp_array['date_count'] = $row['date_count'];
@@ -7968,7 +7968,7 @@  discard block
 block discarded – undo
7968 7968
 		$date_array = array();
7969 7969
 		$temp_array = array();
7970 7970
         
7971
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7971
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7972 7972
 		{
7973 7973
 			$temp_array['month_name'] = $row['month_name'];
7974 7974
 			$temp_array['year_name'] = $row['year_name'];
@@ -7989,7 +7989,7 @@  discard block
 block discarded – undo
7989 7989
 	public function countAllMonthsByAirlines($filters = array())
7990 7990
 	{
7991 7991
 		global $globalTimezone, $globalDBdriver;
7992
-		$filter_query = $this->getFilter($filters,true,true);
7992
+		$filter_query = $this->getFilter($filters, true, true);
7993 7993
 		if ($globalTimezone != '') {
7994 7994
 			date_default_timezone_set($globalTimezone);
7995 7995
 			$datetime = new DateTime();
@@ -7997,12 +7997,12 @@  discard block
 block discarded – undo
7997 7997
 		} else $offset = '+00:00';
7998 7998
 
7999 7999
 		if ($globalDBdriver == 'mysql') {
8000
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
8000
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
8001 8001
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8002 8002
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
8003 8003
 								ORDER BY date_count DESC";
8004 8004
 		} else {
8005
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
8005
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
8006 8006
 								FROM spotter_output 
8007 8007
 								WHERE spotter_output.airline_icao <> '' 
8008 8008
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
@@ -8016,7 +8016,7 @@  discard block
 block discarded – undo
8016 8016
 		$date_array = array();
8017 8017
 		$temp_array = array();
8018 8018
         
8019
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8019
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8020 8020
 		{
8021 8021
 			$temp_array['month_name'] = $row['month_name'];
8022 8022
 			$temp_array['year_name'] = $row['year_name'];
@@ -8043,14 +8043,14 @@  discard block
 block discarded – undo
8043 8043
 			$datetime = new DateTime();
8044 8044
 			$offset = $datetime->format('P');
8045 8045
 		} else $offset = '+00:00';
8046
-		$filter_query = $this->getFilter($filters,true,true);
8046
+		$filter_query = $this->getFilter($filters, true, true);
8047 8047
 		if ($globalDBdriver == 'mysql') {
8048
-			$query  = "SELECT YEAR(CONVERT_TZ(s.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(s.date,'+00:00', :offset)) AS month_name, count(*) as date_count
8048
+			$query = "SELECT YEAR(CONVERT_TZ(s.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(s.date,'+00:00', :offset)) AS month_name, count(*) as date_count
8049 8049
 								FROM spotter_output s".$filter_query." s.airline_type = 'military'
8050 8050
 								GROUP BY year_name, month_name 
8051 8051
 								ORDER BY date_count DESC";
8052 8052
 		} else {
8053
-			$query  = "SELECT EXTRACT(YEAR FROM s.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM s.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
8053
+			$query = "SELECT EXTRACT(YEAR FROM s.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM s.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
8054 8054
 								FROM spotter_output s".$filter_query." s.airline_type = 'military'
8055 8055
 								GROUP BY year_name, month_name 
8056 8056
 								ORDER BY date_count DESC";
@@ -8062,7 +8062,7 @@  discard block
 block discarded – undo
8062 8062
 		$date_array = array();
8063 8063
 		$temp_array = array();
8064 8064
         
8065
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8065
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8066 8066
 		{
8067 8067
 			$temp_array['month_name'] = $row['month_name'];
8068 8068
 			$temp_array['year_name'] = $row['year_name'];
@@ -8088,15 +8088,15 @@  discard block
 block discarded – undo
8088 8088
 			$datetime = new DateTime();
8089 8089
 			$offset = $datetime->format('P');
8090 8090
 		} else $offset = '+00:00';
8091
-		$filter_query = $this->getFilter($filters,true,true);
8091
+		$filter_query = $this->getFilter($filters, true, true);
8092 8092
 
8093 8093
 		if ($globalDBdriver == 'mysql') {
8094
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
8094
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
8095 8095
 								FROM spotter_output".$filter_query." owner_name <> ''
8096 8096
 								GROUP BY year_name, month_name
8097 8097
 								ORDER BY date_count DESC";
8098 8098
 		} else {
8099
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
8099
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
8100 8100
 								FROM spotter_output".$filter_query." owner_name <> ''
8101 8101
 								GROUP BY year_name, month_name
8102 8102
 								ORDER BY date_count DESC";
@@ -8108,7 +8108,7 @@  discard block
 block discarded – undo
8108 8108
 		$date_array = array();
8109 8109
 		$temp_array = array();
8110 8110
         
8111
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8111
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8112 8112
 		{
8113 8113
 			$temp_array['month_name'] = $row['month_name'];
8114 8114
 			$temp_array['year_name'] = $row['year_name'];
@@ -8129,7 +8129,7 @@  discard block
 block discarded – undo
8129 8129
 	public function countAllMonthsOwnersByAirlines($filters = array())
8130 8130
 	{
8131 8131
 		global $globalTimezone, $globalDBdriver;
8132
-		$filter_query = $this->getFilter($filters,true,true);
8132
+		$filter_query = $this->getFilter($filters, true, true);
8133 8133
 		if ($globalTimezone != '') {
8134 8134
 			date_default_timezone_set($globalTimezone);
8135 8135
 			$datetime = new DateTime();
@@ -8137,12 +8137,12 @@  discard block
 block discarded – undo
8137 8137
 		} else $offset = '+00:00';
8138 8138
 
8139 8139
 		if ($globalDBdriver == 'mysql') {
8140
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
8140
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
8141 8141
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
8142 8142
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8143 8143
 								ORDER BY date_count DESC";
8144 8144
 		} else {
8145
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
8145
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
8146 8146
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
8147 8147
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8148 8148
 								ORDER BY date_count DESC";
@@ -8154,7 +8154,7 @@  discard block
 block discarded – undo
8154 8154
 		$date_array = array();
8155 8155
 		$temp_array = array();
8156 8156
         
8157
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8157
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8158 8158
 		{
8159 8159
 			$temp_array['month_name'] = $row['month_name'];
8160 8160
 			$temp_array['year_name'] = $row['year_name'];
@@ -8181,15 +8181,15 @@  discard block
 block discarded – undo
8181 8181
 			$datetime = new DateTime();
8182 8182
 			$offset = $datetime->format('P');
8183 8183
 		} else $offset = '+00:00';
8184
-		$filter_query = $this->getFilter($filters,true,true);
8184
+		$filter_query = $this->getFilter($filters, true, true);
8185 8185
 
8186 8186
 		if ($globalDBdriver == 'mysql') {
8187
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
8187
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
8188 8188
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
8189 8189
 								GROUP BY year_name, month_name
8190 8190
 								ORDER BY date_count DESC";
8191 8191
 		} else {
8192
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
8192
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
8193 8193
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
8194 8194
 								GROUP BY year_name, month_name
8195 8195
 								ORDER BY date_count DESC";
@@ -8201,7 +8201,7 @@  discard block
 block discarded – undo
8201 8201
 		$date_array = array();
8202 8202
 		$temp_array = array();
8203 8203
         
8204
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8204
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8205 8205
 		{
8206 8206
 			$temp_array['month_name'] = $row['month_name'];
8207 8207
 			$temp_array['year_name'] = $row['year_name'];
@@ -8222,7 +8222,7 @@  discard block
 block discarded – undo
8222 8222
 	public function countAllMonthsPilotsByAirlines($filters = array())
8223 8223
 	{
8224 8224
 		global $globalTimezone, $globalDBdriver;
8225
-		$filter_query = $this->getFilter($filters,true,true);
8225
+		$filter_query = $this->getFilter($filters, true, true);
8226 8226
 		if ($globalTimezone != '') {
8227 8227
 			date_default_timezone_set($globalTimezone);
8228 8228
 			$datetime = new DateTime();
@@ -8230,12 +8230,12 @@  discard block
 block discarded – undo
8230 8230
 		} else $offset = '+00:00';
8231 8231
 
8232 8232
 		if ($globalDBdriver == 'mysql') {
8233
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
8233
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
8234 8234
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
8235 8235
 								GROUP BY spotter_output.airline_icao,year_name, month_name
8236 8236
 								ORDER BY date_count DESC";
8237 8237
 		} else {
8238
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
8238
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
8239 8239
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
8240 8240
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8241 8241
 								ORDER BY date_count DESC";
@@ -8247,7 +8247,7 @@  discard block
 block discarded – undo
8247 8247
 		$date_array = array();
8248 8248
 		$temp_array = array();
8249 8249
         
8250
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8250
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8251 8251
 		{
8252 8252
 			$temp_array['month_name'] = $row['month_name'];
8253 8253
 			$temp_array['year_name'] = $row['year_name'];
@@ -8269,7 +8269,7 @@  discard block
 block discarded – undo
8269 8269
 	public function countAllMonthsAirlines($filters = array())
8270 8270
 	{
8271 8271
 		global $globalTimezone, $globalDBdriver;
8272
-		$filter_query = $this->getFilter($filters,true,true);
8272
+		$filter_query = $this->getFilter($filters, true, true);
8273 8273
 		if ($globalTimezone != '') {
8274 8274
 			date_default_timezone_set($globalTimezone);
8275 8275
 			$datetime = new DateTime();
@@ -8277,12 +8277,12 @@  discard block
 block discarded – undo
8277 8277
 		} else $offset = '+00:00';
8278 8278
 
8279 8279
 		if ($globalDBdriver == 'mysql') {
8280
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count
8280
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count
8281 8281
 								FROM spotter_output".$filter_query." airline_icao <> '' 
8282 8282
 								GROUP BY year_name, month_name
8283 8283
 								ORDER BY date_count DESC";
8284 8284
 		} else {
8285
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count
8285
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count
8286 8286
 								FROM spotter_output".$filter_query." airline_icao <> '' 
8287 8287
 								GROUP BY year_name, month_name
8288 8288
 								ORDER BY date_count DESC";
@@ -8294,7 +8294,7 @@  discard block
 block discarded – undo
8294 8294
 		$date_array = array();
8295 8295
 		$temp_array = array();
8296 8296
         
8297
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8297
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8298 8298
 		{
8299 8299
 			$temp_array['month_name'] = $row['month_name'];
8300 8300
 			$temp_array['year_name'] = $row['year_name'];
@@ -8320,15 +8320,15 @@  discard block
 block discarded – undo
8320 8320
 			$datetime = new DateTime();
8321 8321
 			$offset = $datetime->format('P');
8322 8322
 		} else $offset = '+00:00';
8323
-		$filter_query = $this->getFilter($filters,true,true);
8323
+		$filter_query = $this->getFilter($filters, true, true);
8324 8324
 
8325 8325
 		if ($globalDBdriver == 'mysql') {
8326
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
8326
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
8327 8327
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
8328 8328
 								GROUP BY year_name, month_name
8329 8329
 								ORDER BY date_count DESC";
8330 8330
 		} else {
8331
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
8331
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
8332 8332
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
8333 8333
 								GROUP BY year_name, month_name
8334 8334
 								ORDER BY date_count DESC";
@@ -8340,7 +8340,7 @@  discard block
 block discarded – undo
8340 8340
 		$date_array = array();
8341 8341
 		$temp_array = array();
8342 8342
         
8343
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8343
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8344 8344
 		{
8345 8345
 			$temp_array['month_name'] = $row['month_name'];
8346 8346
 			$temp_array['year_name'] = $row['year_name'];
@@ -8362,7 +8362,7 @@  discard block
 block discarded – undo
8362 8362
 	public function countAllMonthsAircraftsByAirlines($filters = array())
8363 8363
 	{
8364 8364
 		global $globalTimezone, $globalDBdriver;
8365
-		$filter_query = $this->getFilter($filters,true,true);
8365
+		$filter_query = $this->getFilter($filters, true, true);
8366 8366
 		if ($globalTimezone != '') {
8367 8367
 			date_default_timezone_set($globalTimezone);
8368 8368
 			$datetime = new DateTime();
@@ -8370,12 +8370,12 @@  discard block
 block discarded – undo
8370 8370
 		} else $offset = '+00:00';
8371 8371
 
8372 8372
 		if ($globalDBdriver == 'mysql') {
8373
-			$query  = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
8373
+			$query = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
8374 8374
 								FROM spotter_output".$filter_query." aircraft_icao <> ''  AND spotter_output.airline_icao <> '' 
8375 8375
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8376 8376
 								ORDER BY date_count DESC";
8377 8377
 		} else {
8378
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
8378
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
8379 8379
 								FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' 
8380 8380
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8381 8381
 								ORDER BY date_count DESC";
@@ -8387,7 +8387,7 @@  discard block
 block discarded – undo
8387 8387
 		$date_array = array();
8388 8388
 		$temp_array = array();
8389 8389
         
8390
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8390
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8391 8391
 		{
8392 8392
 			$temp_array['month_name'] = $row['month_name'];
8393 8393
 			$temp_array['year_name'] = $row['year_name'];
@@ -8414,15 +8414,15 @@  discard block
 block discarded – undo
8414 8414
 			$datetime = new DateTime();
8415 8415
 			$offset = $datetime->format('P');
8416 8416
 		} else $offset = '+00:00';
8417
-		$filter_query = $this->getFilter($filters,true,true);
8417
+		$filter_query = $this->getFilter($filters, true, true);
8418 8418
 
8419 8419
 		if ($globalDBdriver == 'mysql') {
8420
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
8420
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
8421 8421
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
8422 8422
 								GROUP BY year_name, month_name
8423 8423
 								ORDER BY date_count DESC";
8424 8424
 		} else {
8425
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
8425
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
8426 8426
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
8427 8427
 								GROUP BY year_name, month_name
8428 8428
 								ORDER BY date_count DESC";
@@ -8434,7 +8434,7 @@  discard block
 block discarded – undo
8434 8434
 		$date_array = array();
8435 8435
 		$temp_array = array();
8436 8436
         
8437
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8437
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8438 8438
 		{
8439 8439
 			$temp_array['month_name'] = $row['month_name'];
8440 8440
 			$temp_array['year_name'] = $row['year_name'];
@@ -8456,7 +8456,7 @@  discard block
 block discarded – undo
8456 8456
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
8457 8457
 	{
8458 8458
 		global $globalTimezone, $globalDBdriver;
8459
-		$filter_query = $this->getFilter($filters,true,true);
8459
+		$filter_query = $this->getFilter($filters, true, true);
8460 8460
 		if ($globalTimezone != '') {
8461 8461
 			date_default_timezone_set($globalTimezone);
8462 8462
 			$datetime = new DateTime();
@@ -8464,12 +8464,12 @@  discard block
 block discarded – undo
8464 8464
 		} else $offset = '+00:00';
8465 8465
 
8466 8466
 		if ($globalDBdriver == 'mysql') {
8467
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
8467
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
8468 8468
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
8469 8469
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8470 8470
 								ORDER BY date_count DESC";
8471 8471
 		} else {
8472
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
8472
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
8473 8473
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
8474 8474
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8475 8475
 								ORDER BY date_count DESC";
@@ -8481,7 +8481,7 @@  discard block
 block discarded – undo
8481 8481
 		$date_array = array();
8482 8482
 		$temp_array = array();
8483 8483
         
8484
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8484
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8485 8485
 		{
8486 8486
 			$temp_array['month_name'] = $row['month_name'];
8487 8487
 			$temp_array['year_name'] = $row['year_name'];
@@ -8509,7 +8509,7 @@  discard block
 block discarded – undo
8509 8509
 			$datetime = new DateTime();
8510 8510
 			$offset = $datetime->format('P');
8511 8511
 		} else $offset = '+00:00';
8512
-		$filter_query = $this->getFilter($filters,true,true);
8512
+		$filter_query = $this->getFilter($filters, true, true);
8513 8513
 		if ($globalDBdriver == 'mysql') {
8514 8514
 			$query  = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count
8515 8515
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
@@ -8530,7 +8530,7 @@  discard block
 block discarded – undo
8530 8530
 		$date_array = array();
8531 8531
 		$temp_array = array();
8532 8532
         
8533
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8533
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8534 8534
 		{
8535 8535
 			$temp_array['year_name'] = $row['year_name'];
8536 8536
 			$temp_array['month_name'] = $row['month_name'];
@@ -8550,7 +8550,7 @@  discard block
 block discarded – undo
8550 8550
 	* @return Array the hour list
8551 8551
 	*
8552 8552
 	*/
8553
-	public function countAllHours($orderby,$filters = array())
8553
+	public function countAllHours($orderby, $filters = array())
8554 8554
 	{
8555 8555
 		global $globalTimezone, $globalDBdriver;
8556 8556
 		if ($globalTimezone != '') {
@@ -8598,7 +8598,7 @@  discard block
 block discarded – undo
8598 8598
 		$hour_array = array();
8599 8599
 		$temp_array = array();
8600 8600
         
8601
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8601
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8602 8602
 		{
8603 8603
 			$temp_array['hour_name'] = $row['hour_name'];
8604 8604
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8618,7 +8618,7 @@  discard block
 block discarded – undo
8618 8618
 	public function countAllHoursByAirlines($orderby, $filters = array())
8619 8619
 	{
8620 8620
 		global $globalTimezone, $globalDBdriver;
8621
-		$filter_query = $this->getFilter($filters,true,true);
8621
+		$filter_query = $this->getFilter($filters, true, true);
8622 8622
 		if ($globalTimezone != '') {
8623 8623
 			date_default_timezone_set($globalTimezone);
8624 8624
 			$datetime = new DateTime();
@@ -8636,7 +8636,7 @@  discard block
 block discarded – undo
8636 8636
 		}
8637 8637
 		
8638 8638
 		if ($globalDBdriver == 'mysql') {
8639
-			$query  = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8639
+			$query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8640 8640
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8641 8641
 								GROUP BY spotter_output.airline_icao, hour_name 
8642 8642
 								".$orderby_sql;
@@ -8649,7 +8649,7 @@  discard block
 block discarded – undo
8649 8649
   */    
8650 8650
 		$query_data = array(':offset' => $offset);
8651 8651
 		} else {
8652
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8652
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8653 8653
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8654 8654
 								GROUP BY spotter_output.airline_icao, hour_name 
8655 8655
 								".$orderby_sql;
@@ -8662,7 +8662,7 @@  discard block
 block discarded – undo
8662 8662
 		$hour_array = array();
8663 8663
 		$temp_array = array();
8664 8664
         
8665
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8665
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8666 8666
 		{
8667 8667
 			$temp_array['hour_name'] = $row['hour_name'];
8668 8668
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8685,34 +8685,34 @@  discard block
 block discarded – undo
8685 8685
 	public function countAllHoursByAirline($airline_icao, $filters = array())
8686 8686
 	{
8687 8687
 		global $globalTimezone, $globalDBdriver;
8688
-		$filter_query = $this->getFilter($filters,true,true);
8688
+		$filter_query = $this->getFilter($filters, true, true);
8689 8689
 		if ($globalTimezone != '') {
8690 8690
 			date_default_timezone_set($globalTimezone);
8691 8691
 			$datetime = new DateTime();
8692 8692
 			$offset = $datetime->format('P');
8693 8693
 		} else $offset = '+00:00';
8694 8694
 
8695
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8695
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
8696 8696
 
8697 8697
 		if ($globalDBdriver == 'mysql') {
8698
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8698
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8699 8699
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
8700 8700
 								GROUP BY hour_name 
8701 8701
 								ORDER BY hour_name ASC";
8702 8702
 		} else {
8703
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8703
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8704 8704
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
8705 8705
 								GROUP BY hour_name 
8706 8706
 								ORDER BY hour_name ASC";
8707 8707
 		}
8708 8708
 		
8709 8709
 		$sth = $this->db->prepare($query);
8710
-		$sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset));
8710
+		$sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset));
8711 8711
       
8712 8712
 		$hour_array = array();
8713 8713
 		$temp_array = array();
8714 8714
         
8715
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8715
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8716 8716
 		{
8717 8717
 			$temp_array['hour_name'] = $row['hour_name'];
8718 8718
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8735,8 +8735,8 @@  discard block
 block discarded – undo
8735 8735
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
8736 8736
 	{
8737 8737
 		global $globalTimezone, $globalDBdriver;
8738
-		$filter_query = $this->getFilter($filters,true,true);
8739
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
8738
+		$filter_query = $this->getFilter($filters, true, true);
8739
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
8740 8740
 		if ($globalTimezone != '') {
8741 8741
 			date_default_timezone_set($globalTimezone);
8742 8742
 			$datetime = new DateTime();
@@ -8744,24 +8744,24 @@  discard block
 block discarded – undo
8744 8744
 		} else $offset = '+00:00';
8745 8745
 
8746 8746
 		if ($globalDBdriver == 'mysql') {
8747
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8747
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8748 8748
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
8749 8749
 								GROUP BY hour_name 
8750 8750
 								ORDER BY hour_name ASC";
8751 8751
 		} else {
8752
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8752
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8753 8753
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
8754 8754
 								GROUP BY hour_name 
8755 8755
 								ORDER BY hour_name ASC";
8756 8756
 		}
8757 8757
 		
8758 8758
 		$sth = $this->db->prepare($query);
8759
-		$sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset));
8759
+		$sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset));
8760 8760
       
8761 8761
 		$hour_array = array();
8762 8762
 		$temp_array = array();
8763 8763
         
8764
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8764
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8765 8765
 		{
8766 8766
 			$temp_array['hour_name'] = $row['hour_name'];
8767 8767
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8782,8 +8782,8 @@  discard block
 block discarded – undo
8782 8782
 	public function countAllHoursByRegistration($registration, $filters = array())
8783 8783
 	{
8784 8784
 		global $globalTimezone, $globalDBdriver;
8785
-		$filter_query = $this->getFilter($filters,true,true);
8786
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
8785
+		$filter_query = $this->getFilter($filters, true, true);
8786
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8787 8787
 		if ($globalTimezone != '') {
8788 8788
 			date_default_timezone_set($globalTimezone);
8789 8789
 			$datetime = new DateTime();
@@ -8791,24 +8791,24 @@  discard block
 block discarded – undo
8791 8791
 		} else $offset = '+00:00';
8792 8792
 
8793 8793
 		if ($globalDBdriver == 'mysql') {
8794
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8794
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8795 8795
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
8796 8796
 								GROUP BY hour_name 
8797 8797
 								ORDER BY hour_name ASC";
8798 8798
 		} else {
8799
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8799
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8800 8800
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
8801 8801
 								GROUP BY hour_name 
8802 8802
 								ORDER BY hour_name ASC";
8803 8803
 		}
8804 8804
 		
8805 8805
 		$sth = $this->db->prepare($query);
8806
-		$sth->execute(array(':registration' => $registration,':offset' => $offset));
8806
+		$sth->execute(array(':registration' => $registration, ':offset' => $offset));
8807 8807
       
8808 8808
 		$hour_array = array();
8809 8809
 		$temp_array = array();
8810 8810
         
8811
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8811
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8812 8812
 		{
8813 8813
 			$temp_array['hour_name'] = $row['hour_name'];
8814 8814
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8829,8 +8829,8 @@  discard block
 block discarded – undo
8829 8829
 	public function countAllHoursByAirport($airport_icao, $filters = array())
8830 8830
 	{
8831 8831
 		global $globalTimezone, $globalDBdriver;
8832
-		$filter_query = $this->getFilter($filters,true,true);
8833
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8832
+		$filter_query = $this->getFilter($filters, true, true);
8833
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8834 8834
 		if ($globalTimezone != '') {
8835 8835
 			date_default_timezone_set($globalTimezone);
8836 8836
 			$datetime = new DateTime();
@@ -8838,24 +8838,24 @@  discard block
 block discarded – undo
8838 8838
 		} else $offset = '+00:00';
8839 8839
 
8840 8840
 		if ($globalDBdriver == 'mysql') {
8841
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8841
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8842 8842
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
8843 8843
 								GROUP BY hour_name 
8844 8844
 								ORDER BY hour_name ASC";
8845 8845
 		} else {
8846
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8846
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8847 8847
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
8848 8848
 								GROUP BY hour_name 
8849 8849
 								ORDER BY hour_name ASC";
8850 8850
 		}
8851 8851
 		
8852 8852
 		$sth = $this->db->prepare($query);
8853
-		$sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset));
8853
+		$sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset));
8854 8854
       
8855 8855
 		$hour_array = array();
8856 8856
 		$temp_array = array();
8857 8857
         
8858
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8858
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8859 8859
 		{
8860 8860
 			$temp_array['hour_name'] = $row['hour_name'];
8861 8861
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8874,11 +8874,11 @@  discard block
 block discarded – undo
8874 8874
 	* @return Array the hour list
8875 8875
 	*
8876 8876
 	*/
8877
-	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
8877
+	public function countAllHoursByManufacturer($aircraft_manufacturer, $filters = array())
8878 8878
 	{
8879 8879
 		global $globalTimezone, $globalDBdriver;
8880
-		$filter_query = $this->getFilter($filters,true,true);
8881
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
8880
+		$filter_query = $this->getFilter($filters, true, true);
8881
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
8882 8882
 		if ($globalTimezone != '') {
8883 8883
 			date_default_timezone_set($globalTimezone);
8884 8884
 			$datetime = new DateTime();
@@ -8886,24 +8886,24 @@  discard block
 block discarded – undo
8886 8886
 		} else $offset = '+00:00';
8887 8887
 
8888 8888
 		if ($globalDBdriver == 'mysql') {
8889
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8889
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8890 8890
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
8891 8891
 								GROUP BY hour_name 
8892 8892
 								ORDER BY hour_name ASC";
8893 8893
 		} else {
8894
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8894
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8895 8895
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
8896 8896
 								GROUP BY hour_name 
8897 8897
 								ORDER BY hour_name ASC";
8898 8898
 		}
8899 8899
 		
8900 8900
 		$sth = $this->db->prepare($query);
8901
-		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset));
8901
+		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset));
8902 8902
       
8903 8903
 		$hour_array = array();
8904 8904
 		$temp_array = array();
8905 8905
         
8906
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8906
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8907 8907
 		{
8908 8908
 			$temp_array['hour_name'] = $row['hour_name'];
8909 8909
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8925,8 +8925,8 @@  discard block
 block discarded – undo
8925 8925
 	public function countAllHoursByDate($date, $filters = array())
8926 8926
 	{
8927 8927
 		global $globalTimezone, $globalDBdriver;
8928
-		$filter_query = $this->getFilter($filters,true,true);
8929
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
8928
+		$filter_query = $this->getFilter($filters, true, true);
8929
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
8930 8930
 		if ($globalTimezone != '') {
8931 8931
 			date_default_timezone_set($globalTimezone);
8932 8932
 			$datetime = new DateTime($date);
@@ -8934,12 +8934,12 @@  discard block
 block discarded – undo
8934 8934
 		} else $offset = '+00:00';
8935 8935
 
8936 8936
 		if ($globalDBdriver == 'mysql') {
8937
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8937
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8938 8938
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
8939 8939
 								GROUP BY hour_name 
8940 8940
 								ORDER BY hour_name ASC";
8941 8941
 		} else {
8942
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8942
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8943 8943
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date
8944 8944
 								GROUP BY hour_name 
8945 8945
 								ORDER BY hour_name ASC";
@@ -8951,7 +8951,7 @@  discard block
 block discarded – undo
8951 8951
 		$hour_array = array();
8952 8952
 		$temp_array = array();
8953 8953
         
8954
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8954
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8955 8955
 		{
8956 8956
 			$temp_array['hour_name'] = $row['hour_name'];
8957 8957
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8973,8 +8973,8 @@  discard block
 block discarded – undo
8973 8973
 	public function countAllHoursByIdent($ident, $filters = array())
8974 8974
 	{
8975 8975
 		global $globalTimezone, $globalDBdriver;
8976
-		$filter_query = $this->getFilter($filters,true,true);
8977
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
8976
+		$filter_query = $this->getFilter($filters, true, true);
8977
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
8978 8978
 		if ($globalTimezone != '') {
8979 8979
 			date_default_timezone_set($globalTimezone);
8980 8980
 			$datetime = new DateTime();
@@ -8982,12 +8982,12 @@  discard block
 block discarded – undo
8982 8982
 		} else $offset = '+00:00';
8983 8983
 
8984 8984
 		if ($globalDBdriver == 'mysql') {
8985
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8985
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8986 8986
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
8987 8987
 								GROUP BY hour_name 
8988 8988
 								ORDER BY hour_name ASC";
8989 8989
 		} else {
8990
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8990
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8991 8991
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
8992 8992
 								GROUP BY hour_name 
8993 8993
 								ORDER BY hour_name ASC";
@@ -8995,12 +8995,12 @@  discard block
 block discarded – undo
8995 8995
       
8996 8996
 		
8997 8997
 		$sth = $this->db->prepare($query);
8998
-		$sth->execute(array(':ident' => $ident,':offset' => $offset));
8998
+		$sth->execute(array(':ident' => $ident, ':offset' => $offset));
8999 8999
       
9000 9000
 		$hour_array = array();
9001 9001
 		$temp_array = array();
9002 9002
         
9003
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9003
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9004 9004
 		{
9005 9005
 			$temp_array['hour_name'] = $row['hour_name'];
9006 9006
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9019,12 +9019,12 @@  discard block
 block discarded – undo
9019 9019
 	* @return Array the hour list
9020 9020
 	*
9021 9021
 	*/
9022
-	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
9022
+	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
9023 9023
 	{
9024 9024
 		global $globalTimezone, $globalDBdriver;
9025
-		$filter_query = $this->getFilter($filters,true,true);
9026
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
9027
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
9025
+		$filter_query = $this->getFilter($filters, true, true);
9026
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
9027
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
9028 9028
 		if ($globalTimezone != '') {
9029 9029
 			date_default_timezone_set($globalTimezone);
9030 9030
 			$datetime = new DateTime();
@@ -9032,24 +9032,24 @@  discard block
 block discarded – undo
9032 9032
 		} else $offset = '+00:00';
9033 9033
 
9034 9034
 		if ($globalDBdriver == 'mysql') {
9035
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9035
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9036 9036
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
9037 9037
 								GROUP BY hour_name 
9038 9038
 								ORDER BY hour_name ASC";
9039 9039
 		} else {
9040
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9040
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9041 9041
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
9042 9042
 								GROUP BY hour_name 
9043 9043
 								ORDER BY hour_name ASC";
9044 9044
 		}
9045 9045
 		
9046 9046
 		$sth = $this->db->prepare($query);
9047
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset));
9047
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset));
9048 9048
       
9049 9049
 		$hour_array = array();
9050 9050
 		$temp_array = array();
9051 9051
         
9052
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9052
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9053 9053
 		{
9054 9054
 			$temp_array['hour_name'] = $row['hour_name'];
9055 9055
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9070,8 +9070,8 @@  discard block
 block discarded – undo
9070 9070
 	public function countAllHoursByCountry($country, $filters = array())
9071 9071
 	{
9072 9072
 		global $globalTimezone, $globalDBdriver;
9073
-		$filter_query = $this->getFilter($filters,true,true);
9074
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
9073
+		$filter_query = $this->getFilter($filters, true, true);
9074
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
9075 9075
 		if ($globalTimezone != '') {
9076 9076
 			date_default_timezone_set($globalTimezone);
9077 9077
 			$datetime = new DateTime();
@@ -9079,24 +9079,24 @@  discard block
 block discarded – undo
9079 9079
 		} else $offset = '+00:00';
9080 9080
 
9081 9081
 		if ($globalDBdriver == 'mysql') {
9082
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9082
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9083 9083
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
9084 9084
 								GROUP BY hour_name 
9085 9085
 								ORDER BY hour_name ASC";
9086 9086
 		} else {
9087
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9087
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9088 9088
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
9089 9089
 								GROUP BY hour_name 
9090 9090
 								ORDER BY hour_name ASC";
9091 9091
 		}
9092 9092
 		
9093 9093
 		$sth = $this->db->prepare($query);
9094
-		$sth->execute(array(':country' => $country,':offset' => $offset));
9094
+		$sth->execute(array(':country' => $country, ':offset' => $offset));
9095 9095
       
9096 9096
 		$hour_array = array();
9097 9097
 		$temp_array = array();
9098 9098
         
9099
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9099
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9100 9100
 		{
9101 9101
 			$temp_array['hour_name'] = $row['hour_name'];
9102 9102
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9118,8 +9118,8 @@  discard block
 block discarded – undo
9118 9118
 	*/
9119 9119
 	public function countOverallAircrafts($filters = array())
9120 9120
 	{
9121
-		$filter_query = $this->getFilter($filters,true,true);
9122
-		$query  = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
9121
+		$filter_query = $this->getFilter($filters, true, true);
9122
+		$query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
9123 9123
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
9124 9124
 		$sth = $this->db->prepare($query);
9125 9125
 		$sth->execute();
@@ -9134,8 +9134,8 @@  discard block
 block discarded – undo
9134 9134
 	*/
9135 9135
 	public function countOverallArrival($filters = array())
9136 9136
 	{
9137
-		$filter_query = $this->getFilter($filters,true,true);
9138
-		$query  = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
9137
+		$filter_query = $this->getFilter($filters, true, true);
9138
+		$query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
9139 9139
                     FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''";
9140 9140
 		
9141 9141
 		$sth = $this->db->prepare($query);
@@ -9151,8 +9151,8 @@  discard block
 block discarded – undo
9151 9151
 	*/
9152 9152
 	public function countOverallPilots($filters = array())
9153 9153
 	{
9154
-		$filter_query = $this->getFilter($filters,true,true);
9155
-		$query  = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
9154
+		$filter_query = $this->getFilter($filters, true, true);
9155
+		$query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
9156 9156
                     FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''";
9157 9157
 		$sth = $this->db->prepare($query);
9158 9158
 		$sth->execute();
@@ -9167,8 +9167,8 @@  discard block
 block discarded – undo
9167 9167
 	*/
9168 9168
 	public function countOverallOwners($filters = array())
9169 9169
 	{
9170
-		$filter_query = $this->getFilter($filters,true,true);
9171
-		$query  = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
9170
+		$filter_query = $this->getFilter($filters, true, true);
9171
+		$query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
9172 9172
                     FROM spotter_output".$filter_query." spotter_output.owner_name <> ''";
9173 9173
 		$sth = $this->db->prepare($query);
9174 9174
 		$sth->execute();
@@ -9201,8 +9201,8 @@  discard block
 block discarded – undo
9201 9201
 	*/
9202 9202
 	public function countOverallMilitaryFlights($filters = array())
9203 9203
 	{
9204
-		$filter_query = $this->getFilter($filters,true,true);
9205
-		$query  = "SELECT COUNT(s.spotter_id) AS flight_count  
9204
+		$filter_query = $this->getFilter($filters, true, true);
9205
+		$query = "SELECT COUNT(s.spotter_id) AS flight_count  
9206 9206
                     FROM spotter_output s, airlines a".$filter_query." s.airline_icao = a.icao AND a.type = 'military'";
9207 9207
       
9208 9208
 		$sth = $this->db->prepare($query);
@@ -9239,7 +9239,7 @@  discard block
 block discarded – undo
9239 9239
 	public function countAllHoursFromToday($filters = array())
9240 9240
 	{
9241 9241
 		global $globalTimezone, $globalDBdriver;
9242
-		$filter_query = $this->getFilter($filters,true,true);
9242
+		$filter_query = $this->getFilter($filters, true, true);
9243 9243
 		if ($globalTimezone != '') {
9244 9244
 			date_default_timezone_set($globalTimezone);
9245 9245
 			$datetime = new DateTime();
@@ -9247,12 +9247,12 @@  discard block
 block discarded – undo
9247 9247
 		} else $offset = '+00:00';
9248 9248
 
9249 9249
 		if ($globalDBdriver == 'mysql') {
9250
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9250
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9251 9251
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE()
9252 9252
 								GROUP BY hour_name 
9253 9253
 								ORDER BY hour_name ASC";
9254 9254
 		} else {
9255
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9255
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9256 9256
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date)
9257 9257
 								GROUP BY hour_name 
9258 9258
 								ORDER BY hour_name ASC";
@@ -9264,7 +9264,7 @@  discard block
 block discarded – undo
9264 9264
 		$hour_array = array();
9265 9265
 		$temp_array = array();
9266 9266
         
9267
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9267
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9268 9268
 		{
9269 9269
 			$temp_array['hour_name'] = $row['hour_name'];
9270 9270
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9283,14 +9283,14 @@  discard block
 block discarded – undo
9283 9283
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
9284 9284
 	{
9285 9285
 		global $global_query, $globalDBdriver, $globalTimezone;
9286
-		$filter_query = $this->getFilter($filters,true,true);
9286
+		$filter_query = $this->getFilter($filters, true, true);
9287 9287
 		date_default_timezone_set('UTC');
9288 9288
 		$limit_query = '';
9289 9289
 		if ($limit != "")
9290 9290
 		{
9291 9291
 			$limit_array = explode(",", $limit);
9292
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
9293
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
9292
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
9293
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
9294 9294
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
9295 9295
 			{
9296 9296
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
@@ -9343,7 +9343,7 @@  discard block
 block discarded – undo
9343 9343
 			    GROUP BY spotter_output.ident,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time, to_char(spotter_output.date,'HH')
9344 9344
 			    HAVING count(spotter_output.ident) > 5$orderby_query";
9345 9345
 			//echo $query;
9346
-			$spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone));
9346
+			$spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone));
9347 9347
 			/*
9348 9348
 			$sth = $this->db->prepare($query);
9349 9349
 			$sth->execute(array(':timezone' => $globalTimezone));
@@ -9362,9 +9362,9 @@  discard block
 block discarded – undo
9362 9362
 	*/
9363 9363
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
9364 9364
 	{
9365
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
9365
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
9366 9366
 
9367
-		$query  = "SELECT spotter_output.spotter_id
9367
+		$query = "SELECT spotter_output.spotter_id
9368 9368
 								FROM spotter_output 
9369 9369
 								WHERE spotter_output.flightaware_id = '".$flightaware_id."'";
9370 9370
         
@@ -9372,7 +9372,7 @@  discard block
 block discarded – undo
9372 9372
 		$sth = $this->db->prepare($query);
9373 9373
 		$sth->execute();
9374 9374
 
9375
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9375
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9376 9376
 		{
9377 9377
 			return $row['spotter_id'];
9378 9378
 		}
@@ -9397,23 +9397,23 @@  discard block
 block discarded – undo
9397 9397
 		}
9398 9398
 		
9399 9399
 		$current_date = date("Y-m-d H:i:s");
9400
-		$date = date("Y-m-d H:i:s",strtotime($dateString." UTC"));
9400
+		$date = date("Y-m-d H:i:s", strtotime($dateString." UTC"));
9401 9401
 		
9402 9402
 		$diff = abs(strtotime($current_date) - strtotime($date));
9403 9403
 
9404
-		$time_array['years'] = floor($diff / (365*60*60*24)); 
9404
+		$time_array['years'] = floor($diff/(365*60*60*24)); 
9405 9405
 		$years = $time_array['years'];
9406 9406
 		
9407
-		$time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
9407
+		$time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24));
9408 9408
 		$months = $time_array['months'];
9409 9409
 		
9410
-		$time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
9410
+		$time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24));
9411 9411
 		$days = $time_array['days'];
9412
-		$time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60));
9412
+		$time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60));
9413 9413
 		$hours = $time_array['hours'];
9414
-		$time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60);
9414
+		$time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60);
9415 9415
 		$minutes = $time_array['minutes'];
9416
-		$time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
9416
+		$time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
9417 9417
 		
9418 9418
 		return $time_array;	
9419 9419
 	}	
@@ -9439,63 +9439,63 @@  discard block
 block discarded – undo
9439 9439
 			$temp_array['direction_degree'] = $direction;
9440 9440
 			$temp_array['direction_shortname'] = "N";
9441 9441
 			$temp_array['direction_fullname'] = "North";
9442
-		} elseif ($direction >= 22.5 && $direction < 45){
9442
+		} elseif ($direction >= 22.5 && $direction < 45) {
9443 9443
 			$temp_array['direction_degree'] = $direction;
9444 9444
 			$temp_array['direction_shortname'] = "NNE";
9445 9445
 			$temp_array['direction_fullname'] = "North-Northeast";
9446
-		} elseif ($direction >= 45 && $direction < 67.5){
9446
+		} elseif ($direction >= 45 && $direction < 67.5) {
9447 9447
 			$temp_array['direction_degree'] = $direction;
9448 9448
 			$temp_array['direction_shortname'] = "NE";
9449 9449
 			$temp_array['direction_fullname'] = "Northeast";
9450
-		} elseif ($direction >= 67.5 && $direction < 90){
9450
+		} elseif ($direction >= 67.5 && $direction < 90) {
9451 9451
 			$temp_array['direction_degree'] = $direction;
9452 9452
 			$temp_array['direction_shortname'] = "ENE";
9453 9453
 			$temp_array['direction_fullname'] = "East-Northeast";
9454
-		} elseif ($direction >= 90 && $direction < 112.5){
9454
+		} elseif ($direction >= 90 && $direction < 112.5) {
9455 9455
 			$temp_array['direction_degree'] = $direction;
9456 9456
 			$temp_array['direction_shortname'] = "E";
9457 9457
 			$temp_array['direction_fullname'] = "East";
9458
-		} elseif ($direction >= 112.5 && $direction < 135){
9458
+		} elseif ($direction >= 112.5 && $direction < 135) {
9459 9459
 			$temp_array['direction_degree'] = $direction;
9460 9460
 			$temp_array['direction_shortname'] = "ESE";
9461 9461
 			$temp_array['direction_fullname'] = "East-Southeast";
9462
-		} elseif ($direction >= 135 && $direction < 157.5){
9462
+		} elseif ($direction >= 135 && $direction < 157.5) {
9463 9463
 			$temp_array['direction_degree'] = $direction;
9464 9464
 			$temp_array['direction_shortname'] = "SE";
9465 9465
 			$temp_array['direction_fullname'] = "Southeast";
9466
-		} elseif ($direction >= 157.5 && $direction < 180){
9466
+		} elseif ($direction >= 157.5 && $direction < 180) {
9467 9467
 			$temp_array['direction_degree'] = $direction;
9468 9468
 			$temp_array['direction_shortname'] = "SSE";
9469 9469
 			$temp_array['direction_fullname'] = "South-Southeast";
9470
-		} elseif ($direction >= 180 && $direction < 202.5){
9470
+		} elseif ($direction >= 180 && $direction < 202.5) {
9471 9471
 			$temp_array['direction_degree'] = $direction;
9472 9472
 			$temp_array['direction_shortname'] = "S";
9473 9473
 			$temp_array['direction_fullname'] = "South";
9474
-		} elseif ($direction >= 202.5 && $direction < 225){
9474
+		} elseif ($direction >= 202.5 && $direction < 225) {
9475 9475
 			$temp_array['direction_degree'] = $direction;
9476 9476
 			$temp_array['direction_shortname'] = "SSW";
9477 9477
 			$temp_array['direction_fullname'] = "South-Southwest";
9478
-		} elseif ($direction >= 225 && $direction < 247.5){
9478
+		} elseif ($direction >= 225 && $direction < 247.5) {
9479 9479
 			$temp_array['direction_degree'] = $direction;
9480 9480
 			$temp_array['direction_shortname'] = "SW";
9481 9481
 			$temp_array['direction_fullname'] = "Southwest";
9482
-		} elseif ($direction >= 247.5 && $direction < 270){
9482
+		} elseif ($direction >= 247.5 && $direction < 270) {
9483 9483
 			$temp_array['direction_degree'] = $direction;
9484 9484
 			$temp_array['direction_shortname'] = "WSW";
9485 9485
 			$temp_array['direction_fullname'] = "West-Southwest";
9486
-		} elseif ($direction >= 270 && $direction < 292.5){
9486
+		} elseif ($direction >= 270 && $direction < 292.5) {
9487 9487
 			$temp_array['direction_degree'] = $direction;
9488 9488
 			$temp_array['direction_shortname'] = "W";
9489 9489
 			$temp_array['direction_fullname'] = "West";
9490
-		} elseif ($direction >= 292.5 && $direction < 315){
9490
+		} elseif ($direction >= 292.5 && $direction < 315) {
9491 9491
 			$temp_array['direction_degree'] = $direction;
9492 9492
 			$temp_array['direction_shortname'] = "WNW";
9493 9493
 			$temp_array['direction_fullname'] = "West-Northwest";
9494
-		} elseif ($direction >= 315 && $direction < 337.5){
9494
+		} elseif ($direction >= 315 && $direction < 337.5) {
9495 9495
 			$temp_array['direction_degree'] = $direction;
9496 9496
 			$temp_array['direction_shortname'] = "NW";
9497 9497
 			$temp_array['direction_fullname'] = "Northwest";
9498
-		} elseif ($direction >= 337.5 && $direction < 360){
9498
+		} elseif ($direction >= 337.5 && $direction < 360) {
9499 9499
 			$temp_array['direction_degree'] = $direction;
9500 9500
 			$temp_array['direction_shortname'] = "NNW";
9501 9501
 			$temp_array['direction_fullname'] = "North-Northwest";
@@ -9548,9 +9548,9 @@  discard block
 block discarded – undo
9548 9548
 	*/
9549 9549
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
9550 9550
 	{
9551
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
9551
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
9552 9552
 	
9553
-		$query  = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9553
+		$query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9554 9554
 		
9555 9555
 		$sth = $this->db->prepare($query);
9556 9556
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -9573,9 +9573,9 @@  discard block
 block discarded – undo
9573 9573
 	*/
9574 9574
 	public function getAircraftTypeBymodeS($aircraft_modes)
9575 9575
 	{
9576
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
9576
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
9577 9577
 	
9578
-		$query  = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9578
+		$query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9579 9579
 		
9580 9580
 		$sth = $this->db->prepare($query);
9581 9581
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -9596,11 +9596,11 @@  discard block
 block discarded – undo
9596 9596
 	* @param Float $longitude longitute of the flight
9597 9597
 	* @return String the countrie
9598 9598
 	*/
9599
-	public function getCountryFromLatitudeLongitude($latitude,$longitude)
9599
+	public function getCountryFromLatitudeLongitude($latitude, $longitude)
9600 9600
 	{
9601 9601
 		global $globalDBdriver, $globalDebug;
9602
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9603
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9602
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
9603
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
9604 9604
 	
9605 9605
 		$Connection = new Connection($this->db);
9606 9606
 		if (!$Connection->tableExists('countries')) return '';
@@ -9640,19 +9640,19 @@  discard block
 block discarded – undo
9640 9640
 	*/
9641 9641
 	public function convertAircraftRegistration($registration)
9642 9642
 	{
9643
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9643
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9644 9644
 		$registration_prefix = '';
9645 9645
 		$registration_1 = substr($registration, 0, 1);
9646 9646
 		$registration_2 = substr($registration, 0, 2);
9647 9647
 
9648 9648
 		//first get the prefix based on two characters
9649
-		$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
9649
+		$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
9650 9650
       
9651 9651
 		
9652 9652
 		$sth = $this->db->prepare($query);
9653 9653
 		$sth->execute(array(':registration_2' => $registration_2));
9654 9654
         
9655
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9655
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9656 9656
 		{
9657 9657
 			$registration_prefix = $row['registration_prefix'];
9658 9658
 		}
@@ -9660,11 +9660,11 @@  discard block
 block discarded – undo
9660 9660
 		//if we didn't find a two chracter prefix lets just search the one with one character
9661 9661
 		if ($registration_prefix == '')
9662 9662
 		{
9663
-			$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
9663
+			$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
9664 9664
 			$sth = $this->db->prepare($query);
9665 9665
 			$sth->execute(array(':registration_1' => $registration_1));
9666 9666
 	        
9667
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9667
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9668 9668
 			{
9669 9669
 				$registration_prefix = $row['registration_prefix'];
9670 9670
 			}
@@ -9678,7 +9678,7 @@  discard block
 block discarded – undo
9678 9678
 			} else {
9679 9679
 				$registration = preg_replace("/^(.{1})/", "$1-", $registration);
9680 9680
 			}
9681
-		} else if(strlen($registration_prefix) == 2){
9681
+		} else if (strlen($registration_prefix) == 2) {
9682 9682
 			if (0 === strpos($registration, 'N')) {
9683 9683
 				$registration = preg_replace("/^(.{2})/", "$1", $registration);
9684 9684
 			} else {
@@ -9697,17 +9697,17 @@  discard block
 block discarded – undo
9697 9697
 	*/
9698 9698
 	public function countryFromAircraftRegistration($registration)
9699 9699
 	{
9700
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9700
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9701 9701
 		
9702 9702
 		$registration_prefix = '';
9703
-		$registration_test = explode('-',$registration);
9703
+		$registration_test = explode('-', $registration);
9704 9704
 		$country = '';
9705 9705
 		if ($registration_test[0] != $registration) {
9706 9706
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9707 9707
 	      
9708 9708
 			$sth = $this->db->prepare($query);
9709 9709
 			$sth->execute(array(':registration_1' => $registration_test[0]));
9710
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9710
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9711 9711
 			{
9712 9712
 				//$registration_prefix = $row['registration_prefix'];
9713 9713
 				$country = $row['country'];
@@ -9718,13 +9718,13 @@  discard block
 block discarded – undo
9718 9718
 
9719 9719
 			$country = '';
9720 9720
 			//first get the prefix based on two characters
9721
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
9721
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
9722 9722
       
9723 9723
 			
9724 9724
 			$sth = $this->db->prepare($query);
9725 9725
 			$sth->execute(array(':registration_2' => $registration_2));
9726 9726
         
9727
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9727
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9728 9728
 			{
9729 9729
 				$registration_prefix = $row['registration_prefix'];
9730 9730
 				$country = $row['country'];
@@ -9733,12 +9733,12 @@  discard block
 block discarded – undo
9733 9733
 			//if we didn't find a two chracter prefix lets just search the one with one character
9734 9734
 			if ($registration_prefix == "")
9735 9735
 			{
9736
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9736
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9737 9737
 	      
9738 9738
 				$sth = $this->db->prepare($query);
9739 9739
 				$sth->execute(array(':registration_1' => $registration_1));
9740 9740
 	        
9741
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
9741
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9742 9742
 				{
9743 9743
 					//$registration_prefix = $row['registration_prefix'];
9744 9744
 					$country = $row['country'];
@@ -9755,9 +9755,9 @@  discard block
 block discarded – undo
9755 9755
 	* @param String $flightaware_id flightaware_id from spotter_output table
9756 9756
 	* @param String $highlight New highlight value
9757 9757
 	*/
9758
-	public function setHighlightFlight($flightaware_id,$highlight) {
9758
+	public function setHighlightFlight($flightaware_id, $highlight) {
9759 9759
 		
9760
-		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
9760
+		$query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
9761 9761
 		$sth = $this->db->prepare($query);
9762 9762
 		$sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight));
9763 9763
 	}
@@ -9786,7 +9786,7 @@  discard block
 block discarded – undo
9786 9786
 		
9787 9787
 		$bitly_data = json_decode($bitly_data);
9788 9788
 		$bitly_url = '';
9789
-		if ($bitly_data->status_txt = "OK"){
9789
+		if ($bitly_data->status_txt = "OK") {
9790 9790
 			$bitly_url = $bitly_data->data->url;
9791 9791
 		}
9792 9792
 
@@ -9796,7 +9796,7 @@  discard block
 block discarded – undo
9796 9796
 
9797 9797
 	public function getOrderBy()
9798 9798
 	{
9799
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC"));
9799
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC"));
9800 9800
 		
9801 9801
 		return $orderby;
9802 9802
 		
@@ -9930,14 +9930,14 @@  discard block
 block discarded – undo
9930 9930
 		}
9931 9931
 		$sth = $this->db->prepare($query);
9932 9932
 		$sth->execute();
9933
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9933
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9934 9934
 		{
9935 9935
 			$departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']);
9936 9936
 			$arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']);
9937 9937
 			if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) {
9938
-				$update_query="UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id";
9938
+				$update_query = "UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id";
9939 9939
 				$sthu = $this->db->prepare($update_query);
9940
-				$sthu->execute(array(':fromicao' => $row['fromairport_icao'],':toicao' => $row['toairport_icao'],':spotter_id' => $row['spotter_id'],':departure_airport_name' => $departure_airport_array[0]['name'],':departure_airport_city' => $departure_airport_array[0]['city'],':departure_airport_country' => $departure_airport_array[0]['country'],':arrival_airport_name' => $arrival_airport_array[0]['name'],':arrival_airport_city' => $arrival_airport_array[0]['city'],':arrival_airport_country' => $arrival_airport_array[0]['country']));
9940
+				$sthu->execute(array(':fromicao' => $row['fromairport_icao'], ':toicao' => $row['toairport_icao'], ':spotter_id' => $row['spotter_id'], ':departure_airport_name' => $departure_airport_array[0]['name'], ':departure_airport_city' => $departure_airport_array[0]['city'], ':departure_airport_country' => $departure_airport_array[0]['country'], ':arrival_airport_name' => $arrival_airport_array[0]['name'], ':arrival_airport_city' => $arrival_airport_array[0]['city'], ':arrival_airport_country' => $arrival_airport_array[0]['country']));
9941 9941
 			}
9942 9942
 		}
9943 9943
 		
@@ -9950,7 +9950,7 @@  discard block
 block discarded – undo
9950 9950
 		}
9951 9951
 		$sth = $this->db->prepare($query);
9952 9952
 		$sth->execute();
9953
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9953
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9954 9954
 		{
9955 9955
 			if (is_numeric(substr($row['ident'], -1, 1)))
9956 9956
 			{
@@ -9959,11 +9959,11 @@  discard block
 block discarded – undo
9959 9959
 				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
9960 9960
 				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
9961 9961
 				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
9962
-				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
9962
+				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
9963 9963
 				if (isset($airline_array[0]['name'])) {
9964
-					$update_query  = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id";
9964
+					$update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id";
9965 9965
 					$sthu = $this->db->prepare($update_query);
9966
-					$sthu->execute(array(':airline_name' => $airline_array[0]['name'],':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id']));
9966
+					$sthu->execute(array(':airline_name' => $airline_array[0]['name'], ':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id']));
9967 9967
 				}
9968 9968
 			}
9969 9969
 		}
@@ -9983,18 +9983,18 @@  discard block
 block discarded – undo
9983 9983
 		}
9984 9984
 		$sth = $this->db->prepare($query);
9985 9985
 		$sth->execute();
9986
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9986
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9987 9987
 		{
9988 9988
 			if ($row['aircraft_icao'] != '') {
9989 9989
 				$aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']);
9990
-				if ($row['registration'] != ""){
9990
+				if ($row['registration'] != "") {
9991 9991
 					$image_array = $Image->getSpotterImage($row['registration']);
9992 9992
 					if (count($image_array) == 0) {
9993 9993
 						$Image->addSpotterImage($row['registration']);
9994 9994
 					}
9995 9995
 				}
9996 9996
 				if (count($aircraft_name) > 0) {
9997
-					$update_query  = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id";
9997
+					$update_query = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id";
9998 9998
 					$sthu = $this->db->prepare($update_query);
9999 9999
 					$sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id']));
10000 10000
 				}
@@ -10009,10 +10009,10 @@  discard block
 block discarded – undo
10009 10009
 		$query = "SELECT spotter_output.spotter_id, spotter_output.last_latitude, spotter_output.last_longitude, spotter_output.last_altitude, spotter_output.arrival_airport_icao, spotter_output.real_arrival_airport_icao FROM spotter_output";
10010 10010
 		$sth = $this->db->prepare($query);
10011 10011
 		$sth->execute();
10012
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10012
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10013 10013
 		{
10014 10014
 			if ($row['last_latitude'] != '' && $row['last_longitude'] != '') {
10015
-				$closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist);
10015
+				$closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist);
10016 10016
 				$airport_icao = '';
10017 10017
 				 if (isset($closestAirports[0])) {
10018 10018
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
@@ -10026,7 +10026,7 @@  discard block
 block discarded – undo
10026 10026
 								break;
10027 10027
 							}
10028 10028
 						}
10029
-					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
10029
+					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) {
10030 10030
 						$airport_icao = $closestAirports[0]['icao'];
10031 10031
 						if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." !  Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10032 10032
 					} else {
@@ -10037,28 +10037,28 @@  discard block
 block discarded – undo
10037 10037
 				}
10038 10038
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
10039 10039
 					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
10040
-					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10040
+					$update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10041 10041
 					$sthu = $this->db->prepare($update_query);
10042
-					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
10042
+					$sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id']));
10043 10043
 				}
10044 10044
 			}
10045 10045
 		}
10046 10046
 	}
10047 10047
 	
10048
-	public function closestAirports($origLat,$origLon,$dist = 10) {
10048
+	public function closestAirports($origLat, $origLon, $dist = 10) {
10049 10049
 		global $globalDBdriver;
10050
-		$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
10050
+		$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
10051 10051
 /*
10052 10052
 		$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - abs(latitude))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(abs(latitude)*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
10053 10053
                       FROM airport WHERE longitude between ($origLon-$dist/abs(cos(radians($origLat))*69)) and ($origLon+$dist/abs(cos(radians($origLat))*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
10054 10054
                       having distance < $dist ORDER BY distance limit 100;";
10055 10055
 */
10056 10056
 		if ($globalDBdriver == 'mysql') {
10057
-			$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 
10057
+			$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 
10058 10058
 	                      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)) 
10059 10059
 	                      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;";
10060 10060
                 } else {
10061
-			$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 
10061
+			$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 
10062 10062
 	                      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)) 
10063 10063
 	                      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;";
10064 10064
     		}
Please login to merge, or discard this patch.