Completed
Push — master ( ed4a23...e0ac49 )
by Yannick
06:21
created
require/class.Stats.php 2 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.
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 1 patch
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.