Completed
Push — master ( 536398...4468a8 )
by Yannick
06:51 queued 47s
created
require/class.SpotterLive.php 1 patch
Spacing   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -16,64 +16,64 @@  discard block
 block discarded – undo
16 16
 	* @param Array $filter the filter
17 17
 	* @return Array the SQL part
18 18
 	*/
19
-	public function getFilter($filter = array(),$where = false,$and = false) {
19
+	public function getFilter($filter = array(), $where = false, $and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
21 21
 		$filters = array();
22 22
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
23 23
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
24 24
 				$filters = $globalStatsFilters[$globalFilterName];
25 25
 			} else {
26
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
26
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
27 27
 			}
28 28
 		}
29
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
29
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
30 30
 		$filter_query_join = '';
31 31
 		$filter_query_where = '';
32
-		foreach($filters as $flt) {
32
+		foreach ($filters as $flt) {
33 33
 			if (isset($flt['airlines']) && !empty($flt['airlines'])) {
34 34
 				if ($flt['airlines'][0] != '') {
35 35
 					if (isset($flt['source'])) {
36
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
36
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
37 37
 					} else {
38
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
38
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
39 39
 					}
40 40
 				}
41 41
 			}
42 42
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
43 43
 				if (isset($flt['source'])) {
44
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
44
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
45 45
 				} else {
46
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
46
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
47 47
 				}
48 48
 			}
49 49
 			if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']))) {
50 50
 				if (isset($flt['source'])) {
51
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
51
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
52 52
 				}
53 53
 			}
54 54
 		}
55 55
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
56 56
 			if ($filter['airlines'][0] != '') {
57
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
57
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
58 58
 			}
59 59
 		}
60 60
 		if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
61 61
 			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id ";
62 62
 		}
63 63
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
64
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
64
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
65 65
 		}
66 66
 		if (isset($filter['source']) && !empty($filter['source'])) {
67
-			$filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
67
+			$filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')";
68 68
 		}
69 69
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
70 70
 			$filter_query_where = " WHERE ident = '".$filter['ident']."'";
71 71
 		}
72 72
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
73 73
 			if ($filter_query_where == '') {
74
-				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
74
+				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
75 75
 			} else {
76
-				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
76
+				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
77 77
 			}
78 78
 		}
79 79
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
 		if ($limit != '')
100 100
 		{
101 101
 			$limit_array = explode(',', $limit);
102
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
103
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
102
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
103
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
104 104
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
105 105
 			{
106 106
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 		} else {
121 121
 			$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query.$orderby_query;
122 122
 		}
123
-		$spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true);
123
+		$spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true);
124 124
 
125 125
 		return $spotter_array;
126 126
 	}
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 		global $globalDBdriver, $globalLiveInterval;
137 137
 		date_default_timezone_set('UTC');
138 138
 
139
-		$filter_query = $this->getFilter($filter,true,true);
139
+		$filter_query = $this->getFilter($filter, true, true);
140 140
 
141 141
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
142 142
 		if ($globalDBdriver == 'mysql') {
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 //			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, a.aircraft_shadow FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate INNER JOIN (SELECT * FROM aircraft) a on spotter_live.aircraft_icao = a.icao';
145 145
 //			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query;
146 146
 
147
-			$query  = 'SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
147
+			$query = 'SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
148 148
 			FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao'.$filter_query." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'";
149 149
 
150 150
 //			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date ORDER BY spotter_live.date GROUP BY spotter_live.flightaware_id'.$filter_query;
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 			//$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE NOW() AT TIME ZONE 'UTC' - '30 SECONDS'->INTERVAL <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
155 155
 			//$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE NOW() AT TIME ZONE 'UTC' - '".$globalLiveInterval." SECONDS'->INTERVAL <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate$orderby_query";
156 156
 			//$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, a.aircraft_shadow FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_live.aircraft_icao = a.icao';
157
-			$query  = "SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
157
+			$query = "SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
158 158
 			FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao".$filter_query." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'";
159 159
 		}
160 160
 //		$spotter_array = Spotter->getDataFromDB($query.$limit_query);
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 		try {
164 164
 			$sth = $this->db->prepare($query);
165 165
 			$sth->execute();
166
-		} catch(PDOException $e) {
166
+		} catch (PDOException $e) {
167 167
 			echo $e->getMessage();
168 168
 			die;
169 169
 		}
@@ -183,12 +183,12 @@  discard block
 block discarded – undo
183 183
 		global $globalDBdriver, $globalLiveInterval;
184 184
 		date_default_timezone_set('UTC');
185 185
 
186
-		$filter_query = $this->getFilter($filter,true,true);
186
+		$filter_query = $this->getFilter($filter, true, true);
187 187
 
188 188
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
189 189
 		if ($globalDBdriver == 'mysql') {
190 190
 
191
-			$query  = 'SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
191
+			$query = 'SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
192 192
 			FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
193 193
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
194 194
                 } else {
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 			FROM spotter_live WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date 
198 198
 			".$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao ORDER BY spotter_live.flightaware_id, spotter_live.date';
199 199
 */
200
-			$query  = "SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
200
+			$query = "SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
201 201
 			FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category, icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
202 202
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
203 203
 //			echo $query;
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
     		try {
207 207
 			$sth = $this->db->prepare($query);
208 208
 			$sth->execute();
209
-		} catch(PDOException $e) {
209
+		} catch (PDOException $e) {
210 210
 			echo $e->getMessage();
211 211
 			die;
212 212
 		}
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 	public function getLiveSpotterCount($filter = array())
224 224
 	{
225 225
 		global $globalDBdriver, $globalLiveInterval;
226
-		$filter_query = $this->getFilter($filter,true,true);
226
+		$filter_query = $this->getFilter($filter, true, true);
227 227
 
228 228
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
229 229
 		if ($globalDBdriver == 'mysql') {
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 		try {
237 237
 			$sth = $this->db->prepare($query);
238 238
 			$sth->execute();
239
-		} catch(PDOException $e) {
239
+		} catch (PDOException $e) {
240 240
 			echo $e->getMessage();
241 241
 			die;
242 242
 		}
@@ -259,10 +259,10 @@  discard block
 block discarded – undo
259 259
 		$filter_query = $this->getFilter($filter);
260 260
 
261 261
 		if (is_array($coord)) {
262
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
263
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
264
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
265
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
262
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
263
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
264
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
265
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
266 266
 		} else return array();
267 267
 		if ($globalDBdriver == 'mysql') {
268 268
 			//$query  = "SELECT spotter_output.* FROM spotter_output WHERE spotter_output.flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
                 if ($interval == '1m')
316 316
                 {
317 317
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
318
-                } else if ($interval == '15m'){
318
+                } else if ($interval == '15m') {
319 319
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
320 320
                 } 
321 321
             }
@@ -323,14 +323,14 @@  discard block
 block discarded – undo
323 323
          $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
324 324
         }
325 325
 
326
-                $query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
326
+                $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
327 327
                    WHERE spotter_live.latitude <> '' 
328 328
                                    AND spotter_live.longitude <> '' 
329 329
                    ".$additional_query."
330 330
                    HAVING distance < :radius  
331 331
                                    ORDER BY distance";
332 332
 
333
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
333
+                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius));
334 334
 
335 335
                 return $spotter_array;
336 336
         }
@@ -348,9 +348,9 @@  discard block
 block discarded – undo
348 348
 		date_default_timezone_set('UTC');
349 349
 
350 350
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
351
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
351
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
352 352
 
353
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
353
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true);
354 354
 
355 355
 		return $spotter_array;
356 356
 	}
@@ -361,16 +361,16 @@  discard block
 block discarded – undo
361 361
 	* @return Array the spotter information
362 362
 	*
363 363
 	*/
364
-	public function getDateLiveSpotterDataByIdent($ident,$date)
364
+	public function getDateLiveSpotterDataByIdent($ident, $date)
365 365
 	{
366 366
 		$Spotter = new Spotter($this->db);
367 367
 		date_default_timezone_set('UTC');
368 368
 
369 369
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
370
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
370
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
371 371
 
372
-                $date = date('c',$date);
373
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
372
+                $date = date('c', $date);
373
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
374 374
 
375 375
 		return $spotter_array;
376 376
 	}
@@ -387,9 +387,9 @@  discard block
 block discarded – undo
387 387
 		date_default_timezone_set('UTC');
388 388
 
389 389
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
390
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
390
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
391 391
 
392
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true);
392
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true);
393 393
 
394 394
 		return $spotter_array;
395 395
 	}
@@ -400,15 +400,15 @@  discard block
 block discarded – undo
400 400
 	* @return Array the spotter information
401 401
 	*
402 402
 	*/
403
-	public function getDateLiveSpotterDataById($id,$date)
403
+	public function getDateLiveSpotterDataById($id, $date)
404 404
 	{
405 405
 		$Spotter = new Spotter($this->db);
406 406
 		date_default_timezone_set('UTC');
407 407
 
408 408
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
409
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
410
-                $date = date('c',$date);
411
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
409
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
410
+                $date = date('c', $date);
411
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true);
412 412
 
413 413
 		return $spotter_array;
414 414
 	}
@@ -425,13 +425,13 @@  discard block
 block discarded – undo
425 425
 		date_default_timezone_set('UTC');
426 426
 
427 427
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
428
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
428
+                $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
429 429
 
430 430
     		try {
431 431
 			
432 432
 			$sth = $this->db->prepare($query);
433 433
 			$sth->execute(array(':ident' => $ident));
434
-		} catch(PDOException $e) {
434
+		} catch (PDOException $e) {
435 435
 			echo $e->getMessage();
436 436
 			die;
437 437
 		}
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 	* @return Array the spotter information
447 447
 	*
448 448
 	*/
449
-	public function getAllLiveSpotterDataById($id,$liveinterval = false)
449
+	public function getAllLiveSpotterDataById($id, $liveinterval = false)
450 450
 	{
451 451
 		global $globalDBdriver, $globalLiveInterval;
452 452
 		date_default_timezone_set('UTC');
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 		try {
466 466
 			$sth = $this->db->prepare($query);
467 467
 			$sth->execute(array(':id' => $id));
468
-		} catch(PDOException $e) {
468
+		} catch (PDOException $e) {
469 469
 			echo $e->getMessage();
470 470
 			die;
471 471
 		}
@@ -483,12 +483,12 @@  discard block
 block discarded – undo
483 483
 	{
484 484
 		date_default_timezone_set('UTC');
485 485
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
486
-		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
486
+		$query = self::$global_query.' WHERE spotter_live.ident = :ident';
487 487
     		try {
488 488
 			
489 489
 			$sth = $this->db->prepare($query);
490 490
 			$sth->execute(array(':ident' => $ident));
491
-		} catch(PDOException $e) {
491
+		} catch (PDOException $e) {
492 492
 			echo $e->getMessage();
493 493
 			die;
494 494
 		}
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 			
519 519
 			$sth = $this->db->prepare($query);
520 520
 			$sth->execute();
521
-		} catch(PDOException $e) {
521
+		} catch (PDOException $e) {
522 522
 			return "error";
523 523
 		}
524 524
 
@@ -541,14 +541,14 @@  discard block
 block discarded – undo
541 541
 				
542 542
 				$sth = $this->db->prepare($query);
543 543
 				$sth->execute();
544
-			} catch(PDOException $e) {
544
+			} catch (PDOException $e) {
545 545
 				return "error";
546 546
 			}
547 547
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
548 548
                         $i = 0;
549
-                        $j =0;
549
+                        $j = 0;
550 550
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
551
-			foreach($all as $row)
551
+			foreach ($all as $row)
552 552
 			{
553 553
 				$i++;
554 554
 				$j++;
@@ -556,9 +556,9 @@  discard block
 block discarded – undo
556 556
 					if ($globalDebug) echo ".";
557 557
 				    	try {
558 558
 						
559
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
559
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
560 560
 						$sth->execute();
561
-					} catch(PDOException $e) {
561
+					} catch (PDOException $e) {
562 562
 						return "error";
563 563
 					}
564 564
                                 	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
@@ -569,9 +569,9 @@  discard block
 block discarded – undo
569 569
 			if ($i > 0) {
570 570
     				try {
571 571
 					
572
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
572
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
573 573
 					$sth->execute();
574
-				} catch(PDOException $e) {
574
+				} catch (PDOException $e) {
575 575
 					return "error";
576 576
 				}
577 577
 			}
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 				
585 585
 				$sth = $this->db->prepare($query);
586 586
 				$sth->execute();
587
-			} catch(PDOException $e) {
587
+			} catch (PDOException $e) {
588 588
 				return "error";
589 589
 			}
590 590
 /*			$query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN (";
@@ -632,13 +632,13 @@  discard block
 block discarded – undo
632 632
 	public function deleteLiveSpotterDataByIdent($ident)
633 633
 	{
634 634
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
635
-		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
635
+		$query = 'DELETE FROM spotter_live WHERE ident = :ident';
636 636
         
637 637
     		try {
638 638
 			
639 639
 			$sth = $this->db->prepare($query);
640 640
 			$sth->execute(array(':ident' => $ident));
641
-		} catch(PDOException $e) {
641
+		} catch (PDOException $e) {
642 642
 			return "error";
643 643
 		}
644 644
 
@@ -654,13 +654,13 @@  discard block
 block discarded – undo
654 654
 	public function deleteLiveSpotterDataById($id)
655 655
 	{
656 656
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
657
-		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
657
+		$query = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
658 658
         
659 659
     		try {
660 660
 			
661 661
 			$sth = $this->db->prepare($query);
662 662
 			$sth->execute(array(':id' => $id));
663
-		} catch(PDOException $e) {
663
+		} catch (PDOException $e) {
664 664
 			return "error";
665 665
 		}
666 666
 
@@ -678,13 +678,13 @@  discard block
 block discarded – undo
678 678
 	{
679 679
 		global $globalDBdriver, $globalTimezone;
680 680
 		if ($globalDBdriver == 'mysql') {
681
-			$query  = 'SELECT spotter_live.ident FROM spotter_live 
681
+			$query = 'SELECT spotter_live.ident FROM spotter_live 
682 682
 				WHERE spotter_live.ident = :ident 
683 683
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
684 684
 				AND spotter_live.date < UTC_TIMESTAMP()';
685 685
 			$query_data = array(':ident' => $ident);
686 686
 		} else {
687
-			$query  = "SELECT spotter_live.ident FROM spotter_live 
687
+			$query = "SELECT spotter_live.ident FROM spotter_live 
688 688
 				WHERE spotter_live.ident = :ident 
689 689
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
690 690
 				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -693,8 +693,8 @@  discard block
 block discarded – undo
693 693
 		
694 694
 		$sth = $this->db->prepare($query);
695 695
 		$sth->execute($query_data);
696
-		$ident_result='';
697
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
696
+		$ident_result = '';
697
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
698 698
 		{
699 699
 			$ident_result = $row['ident'];
700 700
 		}
@@ -711,13 +711,13 @@  discard block
 block discarded – undo
711 711
 	{
712 712
 		global $globalDBdriver, $globalTimezone;
713 713
 		if ($globalDBdriver == 'mysql') {
714
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
714
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
715 715
 				WHERE spotter_live.ident = :ident 
716 716
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
717 717
 //				AND spotter_live.date < UTC_TIMESTAMP()";
718 718
 			$query_data = array(':ident' => $ident);
719 719
 		} else {
720
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
720
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
721 721
 				WHERE spotter_live.ident = :ident 
722 722
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'";
723 723
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -726,8 +726,8 @@  discard block
 block discarded – undo
726 726
 		
727 727
 		$sth = $this->db->prepare($query);
728 728
 		$sth->execute($query_data);
729
-		$ident_result='';
730
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
729
+		$ident_result = '';
730
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
731 731
 		{
732 732
 			$ident_result = $row['flightaware_id'];
733 733
 		}
@@ -744,13 +744,13 @@  discard block
 block discarded – undo
744 744
 	{
745 745
 		global $globalDBdriver, $globalTimezone;
746 746
 		if ($globalDBdriver == 'mysql') {
747
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
747
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
748 748
 				WHERE spotter_live.flightaware_id = :id 
749 749
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
750 750
 //				AND spotter_live.date < UTC_TIMESTAMP()";
751 751
 			$query_data = array(':id' => $id);
752 752
 		} else {
753
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
753
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
754 754
 				WHERE spotter_live.flightaware_id = :id 
755 755
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
756 756
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -759,8 +759,8 @@  discard block
 block discarded – undo
759 759
 		
760 760
 		$sth = $this->db->prepare($query);
761 761
 		$sth->execute($query_data);
762
-		$ident_result='';
763
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
762
+		$ident_result = '';
763
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
764 764
 		{
765 765
 			$ident_result = $row['flightaware_id'];
766 766
 		}
@@ -777,13 +777,13 @@  discard block
 block discarded – undo
777 777
 	{
778 778
 		global $globalDBdriver, $globalTimezone;
779 779
 		if ($globalDBdriver == 'mysql') {
780
-			$query  = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
780
+			$query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
781 781
 				WHERE spotter_live.ModeS = :modes 
782 782
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
783 783
 //				AND spotter_live.date < UTC_TIMESTAMP()";
784 784
 			$query_data = array(':modes' => $modes);
785 785
 		} else {
786
-			$query  = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
786
+			$query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
787 787
 				WHERE spotter_live.ModeS = :modes 
788 788
 				AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '30 MINUTE'";
789 789
 //			//	AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
@@ -792,8 +792,8 @@  discard block
 block discarded – undo
792 792
 		
793 793
 		$sth = $this->db->prepare($query);
794 794
 		$sth->execute($query_data);
795
-		$ident_result='';
796
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
795
+		$ident_result = '';
796
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
797 797
 		{
798 798
 			//$ident_result = $row['spotter_live_id'];
799 799
 			$ident_result = $row['flightaware_id'];
@@ -812,7 +812,7 @@  discard block
 block discarded – undo
812 812
 	* @return String success or false
813 813
 	*
814 814
 	*/
815
-	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '')
815
+	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false, $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false, $format_source = '', $source_name = '', $over_country = '')
816 816
 	{
817 817
 		global $globalURL, $globalArchive, $globalDebug;
818 818
 		$Common = new Common();
@@ -906,26 +906,26 @@  discard block
 block discarded – undo
906 906
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
907 907
 
908 908
         
909
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
910
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
911
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
912
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
913
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
914
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
915
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
916
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
917
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
918
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
919
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
920
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
921
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
922
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
923
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
924
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
925
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
926
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
927
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
928
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
909
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
910
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
911
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
912
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
913
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
914
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
915
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
916
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
917
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
918
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
919
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
920
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
921
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
922
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
923
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
924
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
925
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
926
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
927
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
928
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
929 929
 
930 930
 		$airline_name = '';
931 931
 		$airline_icao = '';
@@ -947,26 +947,26 @@  discard block
 block discarded – undo
947 947
 		$arrival_airport_country = '';
948 948
 		
949 949
             	
950
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
951
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
952
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
953
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
950
+            	if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
951
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
952
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
953
+            	if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
954 954
             	
955
-		$query  = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) 
955
+		$query = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) 
956 956
 		VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)';
957 957
 
958
-		$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_shadow' => $aircraft_shadow,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk,':route_stop' => $route_stop,':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source,':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country);
958
+		$query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country);
959 959
 		//$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_array[0]['name'],':airline_icao' => $airline_array[0]['icao'],':airline_country' => $airline_array[0]['country'],':airline_type' => $airline_array[0]['type'],':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_array[0]['type'],':aircraft_manufacturer' => $aircraft_array[0]['manufacturer'],':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date);
960 960
 		try {
961 961
 			
962 962
 			$sth = $this->db->prepare($query);
963 963
 			$sth->execute($query_values);
964
-                } catch(PDOException $e) {
964
+                } catch (PDOException $e) {
965 965
                 	return "error : ".$e->getMessage();
966 966
                 }
967 967
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
968 968
 		    if ($globalDebug) echo '(Add to SBS archive : ';
969
-		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
969
+		    $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time, $arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country);
970 970
 		    if ($globalDebug) echo $result.')';
971 971
 		}
972 972
 		return "success";
@@ -975,7 +975,7 @@  discard block
 block discarded – undo
975 975
 
976 976
 	public function getOrderBy()
977 977
 	{
978
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC"));
978
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC"));
979 979
 		return $orderby;
980 980
 	}
981 981
 
Please login to merge, or discard this patch.
require/class.SpotterArchive.php 1 patch
Spacing   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -13,45 +13,45 @@  discard block
 block discarded – undo
13 13
     * @param Array $filter the filter
14 14
     * @return Array the SQL part
15 15
     */
16
-    public function getFilter($filter = array(),$where = false,$and = false) {
16
+    public function getFilter($filter = array(), $where = false, $and = false) {
17 17
 	global $globalFilter, $globalStatsFilters, $globalFilterName;
18 18
 	$filters = array();
19 19
 	if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
20 20
 		if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
21 21
 			$filters = $globalStatsFilters[$globalFilterName];
22 22
 		} else {
23
-			$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
23
+			$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
24 24
 		}
25 25
 	}
26
-	if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
26
+	if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
27 27
 	$filter_query_join = '';
28 28
 	$filter_query_where = '';
29
-	foreach($filters as $flt) {
29
+	foreach ($filters as $flt) {
30 30
 	    if (isset($flt['airlines']) && !empty($flt['airlines'])) {
31 31
 		if ($flt['airlines'][0] != '') {
32 32
 		    if (isset($flt['source'])) {
33
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
33
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
34 34
 		    } else {
35
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
35
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
36 36
 		    }
37 37
 		}
38 38
 	    }
39 39
 	    if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
40 40
 		if (isset($flt['source'])) {
41
-		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
41
+		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
42 42
 		} else {
43
-		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
43
+		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
44 44
 		}
45 45
 	    }
46 46
 	    if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']))) {
47 47
 		if (isset($flt['source'])) {
48
-		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
48
+		    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
49 49
 		}
50 50
 	    }
51 51
 	}
52 52
 	if (isset($filter['airlines']) && !empty($filter['airlines'])) {
53 53
 	    if ($filter['airlines'][0] != '') {
54
-		$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
54
+		$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
55 55
 	    }
56 56
 	}
57 57
 	
@@ -59,19 +59,19 @@  discard block
 block discarded – undo
59 59
 	    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive_output.flightaware_id ";
60 60
 	}
61 61
 	if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
62
-	    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
62
+	    $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id";
63 63
 	}
64 64
 	if (isset($filter['source']) && !empty($filter['source'])) {
65
-	    $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
65
+	    $filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')";
66 66
 	}
67 67
 	if (isset($filter['ident']) && !empty($filter['ident'])) {
68 68
 	    $filter_query_where = " WHERE ident = '".$filter['ident']."'";
69 69
 	}
70 70
 	if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
71 71
 	    if ($filter_query_where == '') {
72
-		$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
72
+		$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
73 73
 	    } else {
74
-		$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
74
+		$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
75 75
 	    }
76 76
 	}
77 77
 	if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
@@ -81,28 +81,28 @@  discard block
 block discarded – undo
81 81
     }
82 82
 
83 83
 	// Spotter_archive
84
-	public function addSpotterArchiveData($flightaware_id = '', $ident = '', $registration = '', $airline_name = '', $airline_icao = '', $airline_country = '', $airline_type = '', $aircraft_icao = '', $aircraft_shadow = '', $aircraft_name = '', $aircraft_manufacturer = '', $departure_airport_icao = '', $departure_airport_name = '', $departure_airport_city = '', $departure_airport_country = '', $departure_airport_time = '',$arrival_airport_icao = '', $arrival_airport_name = '', $arrival_airport_city ='', $arrival_airport_country = '', $arrival_airport_time = '', $route_stop = '', $date = '',$latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '',$verticalrate = '',$format_source = '', $source_name = '', $over_country = '') {
84
+	public function addSpotterArchiveData($flightaware_id = '', $ident = '', $registration = '', $airline_name = '', $airline_icao = '', $airline_country = '', $airline_type = '', $aircraft_icao = '', $aircraft_shadow = '', $aircraft_name = '', $aircraft_manufacturer = '', $departure_airport_icao = '', $departure_airport_name = '', $departure_airport_city = '', $departure_airport_country = '', $departure_airport_time = '', $arrival_airport_icao = '', $arrival_airport_name = '', $arrival_airport_city = '', $arrival_airport_country = '', $arrival_airport_time = '', $route_stop = '', $date = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $format_source = '', $source_name = '', $over_country = '') {
85 85
 		require_once(dirname(__FILE__).'/class.Spotter.php');
86 86
 		if ($over_country == '') {
87 87
 			$Spotter = new Spotter($this->db);
88
-			$data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude);
88
+			$data_country = $Spotter->getCountryFromLatitudeLongitude($latitude, $longitude);
89 89
 			if (!empty($data_country)) $country = $data_country['iso2'];
90 90
 			else $country = '';
91 91
 		} else $country = $over_country;
92
-		if ($airline_type === NULL) $airline_type ='';
92
+		if ($airline_type === NULL) $airline_type = '';
93 93
 	
94 94
 		//if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n";
95 95
 		//else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n";
96 96
 
97 97
 		// Route is not added in spotter_archive
98
-		$query  = "INSERT INTO spotter_archive (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, departure_airport_time,arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, arrival_airport_time, route_stop, date,latitude, longitude, waypoints, altitude, heading, ground_speed, squawk, ModeS, pilot_id, pilot_name, verticalrate,format_source,over_country,source_name)
98
+		$query = "INSERT INTO spotter_archive (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, departure_airport_time,arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, arrival_airport_time, route_stop, date,latitude, longitude, waypoints, altitude, heading, ground_speed, squawk, ModeS, pilot_id, pilot_name, verticalrate,format_source,over_country,source_name)
99 99
 		        VALUES (:flightaware_id, :ident, :registration, :airline_name, :airline_icao, :airline_country, :airline_type, :aircraft_icao, :aircraft_shadow, :aircraft_name, :aircraft_manufacturer, :departure_airport_icao, :departure_airport_name, :departure_airport_city, :departure_airport_country, :departure_airport_time,:arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :arrival_airport_time, :route_stop, :date,:latitude, :longitude, :waypoints, :altitude, :heading, :ground_speed, :squawk, :ModeS, :pilot_id, :pilot_name, :verticalrate, :format_source, :over_country, :source_name)";
100 100
 
101
-		$query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_name' => $aircraft_name, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date,':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name);
101
+		$query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_name' => $aircraft_name, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name);
102 102
 		try {
103 103
 			$sth = $this->db->prepare($query);
104 104
 			$sth->execute($query_values);
105
-		} catch(PDOException $e) {
105
+		} catch (PDOException $e) {
106 106
 			return "error : ".$e->getMessage();
107 107
 		}
108 108
 		return "success";
@@ -122,9 +122,9 @@  discard block
 block discarded – undo
122 122
 
123 123
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
124 124
                 //$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
125
-                $query  = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
125
+                $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
126 126
 
127
-                $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident));
127
+                $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident));
128 128
 
129 129
                 return $spotter_array;
130 130
         }
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
144 144
                 //$query  = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id";
145 145
                 //$query  = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
146
-                $query  = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1";
146
+                $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1";
147 147
 
148 148
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
149 149
                   /*
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
                 }
157 157
                 $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC);
158 158
                 */
159
-                $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id));
159
+                $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id));
160 160
 
161 161
                 return $spotter_array;
162 162
         }
@@ -171,14 +171,14 @@  discard block
 block discarded – undo
171 171
         {
172 172
                 date_default_timezone_set('UTC');
173 173
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
174
-                $query  = $this->global_query." WHERE spotter_archive.flightaware_id = :id";
174
+                $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id";
175 175
 
176 176
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
177 177
 
178 178
                 try {
179 179
                         $sth = $this->db->prepare($query);
180 180
                         $sth->execute(array(':id' => $id));
181
-                } catch(PDOException $e) {
181
+                } catch (PDOException $e) {
182 182
                         echo $e->getMessage();
183 183
                         die;
184 184
                 }
@@ -197,14 +197,14 @@  discard block
 block discarded – undo
197 197
         {
198 198
                 date_default_timezone_set('UTC');
199 199
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
200
-                $query  = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
200
+                $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id";
201 201
 
202 202
 //              $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id));
203 203
 
204 204
                 try {
205 205
                         $sth = $this->db->prepare($query);
206 206
                         $sth->execute(array(':id' => $id));
207
-                } catch(PDOException $e) {
207
+                } catch (PDOException $e) {
208 208
                         echo $e->getMessage();
209 209
                         die;
210 210
                 }
@@ -226,12 +226,12 @@  discard block
 block discarded – undo
226 226
                 date_default_timezone_set('UTC');
227 227
 
228 228
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
229
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
229
+                $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
230 230
 
231 231
                 try {
232 232
                         $sth = $this->db->prepare($query);
233 233
                         $sth->execute(array(':ident' => $ident));
234
-                } catch(PDOException $e) {
234
+                } catch (PDOException $e) {
235 235
                         echo $e->getMessage();
236 236
                         die;
237 237
                 }
@@ -252,12 +252,12 @@  discard block
 block discarded – undo
252 252
                 date_default_timezone_set('UTC');
253 253
 
254 254
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
255
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
255
+                $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date";
256 256
 
257 257
                 try {
258 258
                         $sth = $this->db->prepare($query);
259 259
                         $sth->execute(array(':id' => $id));
260
-                } catch(PDOException $e) {
260
+                } catch (PDOException $e) {
261 261
                         echo $e->getMessage();
262 262
                         die;
263 263
                 }
@@ -278,12 +278,12 @@  discard block
 block discarded – undo
278 278
                 date_default_timezone_set('UTC');
279 279
 
280 280
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
281
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date";
281
+                $query = "SELECT spotter_archive.altitude, spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date";
282 282
 
283 283
                 try {
284 284
                         $sth = $this->db->prepare($query);
285 285
                         $sth->execute(array(':id' => $id));
286
-                } catch(PDOException $e) {
286
+                } catch (PDOException $e) {
287 287
                         echo $e->getMessage();
288 288
                         die;
289 289
                 }
@@ -305,13 +305,13 @@  discard block
 block discarded – undo
305 305
                 date_default_timezone_set('UTC');
306 306
 
307 307
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
308
-                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
308
+                $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1";
309 309
 //                $query  = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident";
310 310
 
311 311
                 try {
312 312
                         $sth = $this->db->prepare($query);
313 313
                         $sth->execute(array(':ident' => $ident));
314
-                } catch(PDOException $e) {
314
+                } catch (PDOException $e) {
315 315
                         echo $e->getMessage();
316 316
                         die;
317 317
                 }
@@ -328,13 +328,13 @@  discard block
 block discarded – undo
328 328
         * @return Array the spotter information
329 329
         *
330 330
         */
331
-        public function getSpotterArchiveData($ident,$flightaware_id,$date)
331
+        public function getSpotterArchiveData($ident, $flightaware_id, $date)
332 332
         {
333 333
     		$Spotter = new Spotter($this->db);
334 334
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
335
-                $query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
335
+                $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
336 336
 
337
-                $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%'));
337
+                $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':flightaware_id' => $flightaware_id, ':date' => $date.'%'));
338 338
 
339 339
                 return $spotter_array;
340 340
         }
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
                 try {
348 348
                         $sth = $this->db->prepare($query);
349 349
                         $sth->execute();
350
-                } catch(PDOException $e) {
350
+                } catch (PDOException $e) {
351 351
                         echo $e->getMessage();
352 352
                         die;
353 353
                 }
@@ -359,24 +359,24 @@  discard block
 block discarded – undo
359 359
         * @return Array the spotter information
360 360
         *
361 361
         */
362
-        public function getMinLiveSpotterData($begindate,$enddate,$filter = array())
362
+        public function getMinLiveSpotterData($begindate, $enddate, $filter = array())
363 363
         {
364 364
                 global $globalDBdriver, $globalLiveInterval;
365 365
                 date_default_timezone_set('UTC');
366 366
 
367 367
                 $filter_query = '';
368 368
                 if (isset($filter['source']) && !empty($filter['source'])) {
369
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
369
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
370 370
                 }
371 371
                 // Use spotter_output also ?
372 372
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
373
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
373
+                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
374 374
                 }
375 375
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
376 376
                         $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
377 377
                 }
378 378
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
379
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
379
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
380 380
                 }
381 381
 
382 382
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -395,14 +395,14 @@  discard block
 block discarded – undo
395 395
 						GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id 
396 396
 				    AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao';
397 397
 */
398
-			$query  = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
398
+			$query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
399 399
 				    FROM spotter_archive 
400 400
 				    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao
401 401
 				    WHERE spotter_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' 
402 402
                         	    '.$filter_query.' ORDER BY flightaware_id';
403 403
                 } else {
404 404
                         //$query  = 'SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao';
405
-                        $query  = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
405
+                        $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
406 406
                         	    FROM spotter_archive 
407 407
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao
408 408
                         	    WHERE spotter_archive.date >= '."'".$begindate."'".' AND spotter_archive.date <= '."'".$enddate."'".'
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
                 try {
413 413
                         $sth = $this->db->prepare($query);
414 414
                         $sth->execute();
415
-                } catch(PDOException $e) {
415
+                } catch (PDOException $e) {
416 416
                         echo $e->getMessage();
417 417
                         die;
418 418
                 }
@@ -427,24 +427,24 @@  discard block
 block discarded – undo
427 427
         * @return Array the spotter information
428 428
         *
429 429
         */
430
-        public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array())
430
+        public function getMinLiveSpotterDataPlayback($begindate, $enddate, $filter = array())
431 431
         {
432 432
                 global $globalDBdriver, $globalLiveInterval;
433 433
                 date_default_timezone_set('UTC');
434 434
 
435 435
                 $filter_query = '';
436 436
                 if (isset($filter['source']) && !empty($filter['source'])) {
437
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
437
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
438 438
                 }
439 439
                 // Should use spotter_output also ?
440 440
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
441
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
441
+                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
442 442
                 }
443 443
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
444 444
                         $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
445 445
                 }
446 446
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
447
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
447
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
448 448
                 }
449 449
 
450 450
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
                     		    FROM spotter_archive 
455 455
                     		    INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao';
456 456
 			*/
457
-			$query  = 'SELECT a.aircraft_shadow, spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk 
457
+			$query = 'SELECT a.aircraft_shadow, spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk 
458 458
 				    FROM spotter_archive_output 
459 459
 				    LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive_output.aircraft_icao = a.icao 
460 460
 				    WHERE (spotter_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') 
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
                         	    WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".'
470 470
                         	    '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow';
471 471
                         */
472
-                        $query  = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow
472
+                        $query = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow
473 473
                         	    FROM spotter_archive_output 
474 474
                         	    INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao
475 475
                         	    WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".'
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
                 try {
482 482
                         $sth = $this->db->prepare($query);
483 483
                         $sth->execute();
484
-                } catch(PDOException $e) {
484
+                } catch (PDOException $e) {
485 485
                         echo $e->getMessage();
486 486
                         die;
487 487
                 }
@@ -496,23 +496,23 @@  discard block
 block discarded – undo
496 496
         * @return Array the spotter information
497 497
         *
498 498
         */
499
-        public function getLiveSpotterCount($begindate,$enddate,$filter = array())
499
+        public function getLiveSpotterCount($begindate, $enddate, $filter = array())
500 500
         {
501 501
                 global $globalDBdriver, $globalLiveInterval;
502 502
                 date_default_timezone_set('UTC');
503 503
 
504 504
                 $filter_query = '';
505 505
                 if (isset($filter['source']) && !empty($filter['source'])) {
506
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
506
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
507 507
                 }
508 508
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
509
-                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
509
+                        $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id ";
510 510
                 }
511 511
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
512 512
                         $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id ";
513 513
                 }
514 514
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
515
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
515
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
516 516
                 }
517 517
 
518 518
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
                 try {
528 528
                         $sth = $this->db->prepare($query);
529 529
                         $sth->execute();
530
-                } catch(PDOException $e) {
530
+                } catch (PDOException $e) {
531 531
                         echo $e->getMessage();
532 532
                         die;
533 533
                 }
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
     * @return Array the spotter information
548 548
     *
549 549
     */
550
-    public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array())
550
+    public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array())
551 551
     {
552 552
 	global $globalTimezone, $globalDBdriver;
553 553
 	require_once(dirname(__FILE__).'/class.Translation.php');
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 	        
570 570
 		$q_array = explode(" ", $q);
571 571
 		
572
-		foreach ($q_array as $q_item){
572
+		foreach ($q_array as $q_item) {
573 573
 		    $additional_query .= " AND (";
574 574
 		    $additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR ";
575 575
 		    $additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR ";
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 	
602 602
 	if ($registration != "")
603 603
 	{
604
-	    $registration = filter_var($registration,FILTER_SANITIZE_STRING);
604
+	    $registration = filter_var($registration, FILTER_SANITIZE_STRING);
605 605
 	    if (!is_string($registration))
606 606
 	    {
607 607
 		return false;
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 	
613 613
 	if ($aircraft_icao != "")
614 614
 	{
615
-	    $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
615
+	    $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
616 616
 	    if (!is_string($aircraft_icao))
617 617
 	    {
618 618
 		return false;
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 	
624 624
 	if ($aircraft_manufacturer != "")
625 625
 	{
626
-	    $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
626
+	    $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
627 627
 	    if (!is_string($aircraft_manufacturer))
628 628
 	    {
629 629
 		return false;
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
 	
645 645
 	if ($airline_icao != "")
646 646
 	{
647
-	    $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
647
+	    $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
648 648
 	    if (!is_string($airline_icao))
649 649
 	    {
650 650
 		return false;
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 	
656 656
 	if ($airline_country != "")
657 657
 	{
658
-	    $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
658
+	    $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING);
659 659
 	    if (!is_string($airline_country))
660 660
 	    {
661 661
 		return false;
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 	
667 667
 	if ($airline_type != "")
668 668
 	{
669
-	    $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
669
+	    $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
670 670
 	    if (!is_string($airline_type))
671 671
 	    {
672 672
 		return false;
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 	
689 689
 	if ($airport != "")
690 690
 	{
691
-	    $airport = filter_var($airport,FILTER_SANITIZE_STRING);
691
+	    $airport = filter_var($airport, FILTER_SANITIZE_STRING);
692 692
 	    if (!is_string($airport))
693 693
 	    {
694 694
 		return false;
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
 	
700 700
 	if ($airport_country != "")
701 701
 	{
702
-	    $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
702
+	    $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING);
703 703
 	    if (!is_string($airport_country))
704 704
 	    {
705 705
 		return false;
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
     
711 711
 	if ($callsign != "")
712 712
 	{
713
-	    $callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
713
+	    $callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
714 714
 	    if (!is_string($callsign))
715 715
 	    {
716 716
 		return false;
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
 		$translate = $Translation->ident2icao($callsign);
719 719
 		if ($translate != $callsign) {
720 720
 			$additional_query .= " AND (spotter_archive_output.ident = :callsign OR spotter_archive_output.ident = :translate)";
721
-			$query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate));
721
+			$query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate));
722 722
 		} else {
723 723
 			$additional_query .= " AND (spotter_archive_output.ident = '".$callsign."')";
724 724
 		}
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
 
728 728
 	if ($owner != "")
729 729
 	{
730
-	    $owner = filter_var($owner,FILTER_SANITIZE_STRING);
730
+	    $owner = filter_var($owner, FILTER_SANITIZE_STRING);
731 731
 	    if (!is_string($owner))
732 732
 	    {
733 733
 		return false;
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 
739 739
 	if ($pilot_name != "")
740 740
 	{
741
-	    $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
741
+	    $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
742 742
 	    if (!is_string($pilot_name))
743 743
 	    {
744 744
 		return false;
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 	
750 750
 	if ($pilot_id != "")
751 751
 	{
752
-	    $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
752
+	    $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT);
753 753
 	    if (!is_string($pilot_id))
754 754
 	    {
755 755
 		return false;
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 	
761 761
 	if ($departure_airport_route != "")
762 762
 	{
763
-	    $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
763
+	    $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING);
764 764
 	    if (!is_string($departure_airport_route))
765 765
 	    {
766 766
 		return false;
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
 	
772 772
 	if ($arrival_airport_route != "")
773 773
 	{
774
-	    $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
774
+	    $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING);
775 775
 	    if (!is_string($arrival_airport_route))
776 776
 	    {
777 777
 		return false;
@@ -784,8 +784,8 @@  discard block
 block discarded – undo
784 784
 	{
785 785
 	    $altitude_array = explode(",", $altitude);
786 786
 	    
787
-	    $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
788
-	    $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
787
+	    $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
788
+	    $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
789 789
 	    
790 790
 
791 791
 	    if ($altitude_array[1] != "")
@@ -803,8 +803,8 @@  discard block
 block discarded – undo
803 803
 	{
804 804
 	    $date_array = explode(",", $date_posted);
805 805
 	    
806
-	    $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
807
-	    $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
806
+	    $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
807
+	    $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
808 808
 	    
809 809
 	    if ($globalTimezone != '') {
810 810
 		date_default_timezone_set($globalTimezone);
@@ -836,8 +836,8 @@  discard block
 block discarded – undo
836 836
 	{
837 837
 	    $limit_array = explode(",", $limit);
838 838
 	    
839
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
840
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
839
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
840
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
841 841
 	    
842 842
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
843 843
 	    {
@@ -848,8 +848,8 @@  discard block
 block discarded – undo
848 848
 	
849 849
 
850 850
 	if ($origLat != "" && $origLon != "" && $dist != "") {
851
-		$dist = number_format($dist*0.621371,2,'.','');
852
-		$query="SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
851
+		$dist = number_format($dist*0.621371, 2, '.', '');
852
+		$query = "SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
853 853
                           FROM spotter_archive_output, spotter_archive WHERE spotter_output_archive.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/ABS(cos(radians($origLat))*69)) and ($origLon+$dist/ABS(cos(radians($origLat))*69)) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
854 854
                           AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query." ORDER BY distance";
855 855
 	} else {
@@ -866,12 +866,12 @@  discard block
 block discarded – undo
866 866
 			$additional_query .= " AND (spotter_archive_output.waypoints <> '')";
867 867
 		}
868 868
 
869
-		$query  = "SELECT spotter_archive_output.* FROM spotter_archive_output 
869
+		$query = "SELECT spotter_archive_output.* FROM spotter_archive_output 
870 870
 		    WHERE spotter_archive_output.ident <> '' 
871 871
 		    ".$additional_query."
872 872
 		    ".$filter_query.$orderby_query;
873 873
 	}
874
-	$spotter_array = $Spotter->getDataFromDB($query, $query_values,$limit_query);
874
+	$spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query);
875 875
 
876 876
 	return $spotter_array;
877 877
     }
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
                 try {
889 889
                         $sth = $this->db->prepare($query);
890 890
                         $sth->execute();
891
-                } catch(PDOException $e) {
891
+                } catch (PDOException $e) {
892 892
                         return "error";
893 893
                 }
894 894
 	}
@@ -925,8 +925,8 @@  discard block
 block discarded – undo
925 925
 	{
926 926
 	    $limit_array = explode(",", $limit);
927 927
 	    
928
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
929
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
928
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
929
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
930 930
 	    
931 931
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
932 932
 	    {
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
     * @return Array the airline country list
957 957
     *
958 958
     */
959
-    public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
959
+    public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '')
960 960
     {
961 961
 	global $globalDBdriver;
962 962
 	/*
@@ -985,7 +985,7 @@  discard block
 block discarded – undo
985 985
 	$flight_array = array();
986 986
 	$temp_array = array();
987 987
         
988
-	while($row = $sth->fetch(PDO::FETCH_ASSOC))
988
+	while ($row = $sth->fetch(PDO::FETCH_ASSOC))
989 989
 	{
990 990
 	    $temp_array['flight_count'] = $row['nb'];
991 991
 	    $temp_array['flight_country'] = $row['name'];
@@ -1002,14 +1002,14 @@  discard block
 block discarded – undo
1002 1002
     * @return Array the spotter information
1003 1003
     *
1004 1004
     */
1005
-    public function getDateArchiveSpotterDataById($id,$date)
1005
+    public function getDateArchiveSpotterDataById($id, $date)
1006 1006
     {
1007 1007
 	$Spotter = new Spotter($this->db);
1008 1008
 	date_default_timezone_set('UTC');
1009 1009
 	$id = filter_var($id, FILTER_SANITIZE_STRING);
1010
-	$query  = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC';
1011
-	$date = date('c',$date);
1012
-	$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date));
1010
+	$query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC';
1011
+	$date = date('c', $date);
1012
+	$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date));
1013 1013
 	return $spotter_array;
1014 1014
     }
1015 1015
 
@@ -1019,14 +1019,14 @@  discard block
 block discarded – undo
1019 1019
     * @return Array the spotter information
1020 1020
     *
1021 1021
     */
1022
-    public function getDateArchiveSpotterDataByIdent($ident,$date)
1022
+    public function getDateArchiveSpotterDataByIdent($ident, $date)
1023 1023
     {
1024 1024
 	$Spotter = new Spotter($this->db);
1025 1025
 	date_default_timezone_set('UTC');
1026 1026
 	$ident = filter_var($ident, FILTER_SANITIZE_STRING);
1027
-	$query  = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC';
1028
-	$date = date('c',$date);
1029
-	$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
1027
+	$query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC';
1028
+	$date = date('c', $date);
1029
+	$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
1030 1030
 	return $spotter_array;
1031 1031
     }
1032 1032
 
@@ -1036,7 +1036,7 @@  discard block
 block discarded – undo
1036 1036
     * @return Array the spotter information
1037 1037
     *
1038 1038
     */
1039
-    public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1039
+    public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array())
1040 1040
     {
1041 1041
 	global $global_query;
1042 1042
 	$Spotter = new Spotter();
@@ -1044,7 +1044,7 @@  discard block
 block discarded – undo
1044 1044
 	$query_values = array();
1045 1045
 	$limit_query = '';
1046 1046
 	$additional_query = '';
1047
-	$filter_query = $this->getFilter($filters,true,true);
1047
+	$filter_query = $this->getFilter($filters, true, true);
1048 1048
 	
1049 1049
 	if ($airport != "")
1050 1050
 	{
@@ -1061,8 +1061,8 @@  discard block
 block discarded – undo
1061 1061
 	{
1062 1062
 	    $limit_array = explode(",", $limit);
1063 1063
 	    
1064
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1065
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1064
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1065
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1066 1066
 	    
1067 1067
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1068 1068
 	    {
Please login to merge, or discard this patch.
install/class.update_schema.php 1 patch
Spacing   +130 added lines, -130 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
             try {
15 15
             	$sth = $Connection->db->prepare($query);
16 16
 		$sth->execute();
17
-    	    } catch(PDOException $e) {
17
+    	    } catch (PDOException $e) {
18 18
 		return "error : ".$e->getMessage()."\n";
19 19
     	    }
20 20
     	    while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
21
-    		$Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']);
21
+    		$Schedule->addSchedule($row['ident'], $row['departure_airport_icao'], $row['departure_airport_time'], $row['arrival_airport_icao'], $row['arrival_airport_time']);
22 22
     	    }
23 23
 	
24 24
 	}
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         	try {
51 51
             	    $sth = $Connection->db->prepare($query);
52 52
 		    $sth->execute();
53
-    		} catch(PDOException $e) {
53
+    		} catch (PDOException $e) {
54 54
 		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
55 55
     		}
56 56
     		// Copy schedules data to routes table
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         	try {
61 61
             	    $sth = $Connection->db->prepare($query);
62 62
 		    $sth->execute();
63
-    		} catch(PDOException $e) {
63
+    		} catch (PDOException $e) {
64 64
 		    return "error (delete schedule table) : ".$e->getMessage()."\n";
65 65
     		}
66 66
     		// Add source column
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     		try {
69 69
             	    $sth = $Connection->db->prepare($query);
70 70
 		    $sth->execute();
71
-    		} catch(PDOException $e) {
71
+    		} catch (PDOException $e) {
72 72
 		    return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n";
73 73
     		}
74 74
 		// Delete unused column
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     		try {
77 77
             	    $sth = $Connection->db->prepare($query);
78 78
 		    $sth->execute();
79
-    		} catch(PDOException $e) {
79
+    		} catch (PDOException $e) {
80 80
 		    return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n";
81 81
     		}
82 82
 		// Add ModeS column
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
     		try {
85 85
             	    $sth = $Connection->db->prepare($query);
86 86
 		    $sth->execute();
87
-    		} catch(PDOException $e) {
87
+    		} catch (PDOException $e) {
88 88
 		    return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n";
89 89
     		}
90 90
 		$query = "ALTER TABLE `spotter_live`  ADD `ModeS` VARCHAR(255)";
91 91
     		try {
92 92
             	    $sth = $Connection->db->prepare($query);
93 93
 		    $sth->execute();
94
-    		} catch(PDOException $e) {
94
+    		} catch (PDOException $e) {
95 95
 		    return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n";
96 96
     		}
97 97
     		// Add auto_increment for aircraft_modes
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     		try {
100 100
             	    $sth = $Connection->db->prepare($query);
101 101
 		    $sth->execute();
102
-    		} catch(PDOException $e) {
102
+    		} catch (PDOException $e) {
103 103
 		    return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n";
104 104
     		}
105 105
     		$error = '';
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         	try {
111 111
             	    $sth = $Connection->db->prepare($query);
112 112
 		    $sth->execute();
113
-    		} catch(PDOException $e) {
113
+    		} catch (PDOException $e) {
114 114
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
115 115
     		}
116 116
 		return $error;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         	try {
124 124
             	    $sth = $Connection->db->prepare($query);
125 125
 		    $sth->execute();
126
-    		} catch(PDOException $e) {
126
+    		} catch (PDOException $e) {
127 127
 		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
128 128
     		}
129 129
     		$error = '';
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         	try {
135 135
             	    $sth = $Connection->db->prepare($query);
136 136
 		    $sth->execute();
137
-    		} catch(PDOException $e) {
137
+    		} catch (PDOException $e) {
138 138
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
139 139
     		}
140 140
 		return $error;
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         	try {
148 148
             	    $sth = $Connection->db->prepare($query);
149 149
 		    $sth->execute();
150
-    		} catch(PDOException $e) {
150
+    		} catch (PDOException $e) {
151 151
 		    return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n";
152 152
     		}
153 153
     		// Add image_source_website column to spotter_image
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
         	try {
156 156
             	    $sth = $Connection->db->prepare($query);
157 157
 		    $sth->execute();
158
-    		} catch(PDOException $e) {
158
+    		} catch (PDOException $e) {
159 159
 		    return "error (add new columns to spotter_image) : ".$e->getMessage()."\n";
160 160
     		}
161 161
     		$error = '';
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         	try {
165 165
             	    $sth = $Connection->db->prepare($query);
166 166
 		    $sth->execute();
167
-    		} catch(PDOException $e) {
167
+    		} catch (PDOException $e) {
168 168
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
169 169
     		}
170 170
 		return $error;
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         	    try {
183 183
             		$sth = $Connection->db->prepare($query);
184 184
 			$sth->execute();
185
-    		    } catch(PDOException $e) {
185
+    		    } catch (PDOException $e) {
186 186
 			return "error (update schema_version) : ".$e->getMessage()."\n";
187 187
     		    }
188 188
     		}
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
         	try {
197 197
             	    $sth = $Connection->db->prepare($query);
198 198
 		    $sth->execute();
199
-    		} catch(PDOException $e) {
199
+    		} catch (PDOException $e) {
200 200
 		    return "error (add new columns to translation) : ".$e->getMessage()."\n";
201 201
     		}
202 202
     		// Add aircraft_shadow column to aircraft
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
         	try {
205 205
             	    $sth = $Connection->db->prepare($query);
206 206
 		    $sth->execute();
207
-    		} catch(PDOException $e) {
207
+    		} catch (PDOException $e) {
208 208
 		    return "error (add new column to aircraft) : ".$e->getMessage()."\n";
209 209
     		}
210 210
     		// Add aircraft_shadow column to spotter_live
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         	try {
213 213
             	    $sth = $Connection->db->prepare($query);
214 214
 		    $sth->execute();
215
-    		} catch(PDOException $e) {
215
+    		} catch (PDOException $e) {
216 216
 		    return "error (add new column to spotter_live) : ".$e->getMessage()."\n";
217 217
     		}
218 218
     		$error = '';
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         	try {
226 226
             	    $sth = $Connection->db->prepare($query);
227 227
 		    $sth->execute();
228
-    		} catch(PDOException $e) {
228
+    		} catch (PDOException $e) {
229 229
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
230 230
     		}
231 231
 		return $error;
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
 	private static function update_from_6() {
235 235
     		$Connection = new Connection();
236
-    		if (!$Connection->indexExists('spotter_output','flightaware_id')) {
236
+    		if (!$Connection->indexExists('spotter_output', 'flightaware_id')) {
237 237
     		    $query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id);
238 238
 			ALTER TABLE spotter_output ADD INDEX(date);
239 239
 			ALTER TABLE spotter_output ADD INDEX(ident);
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
         	    try {
251 251
             		$sth = $Connection->db->prepare($query);
252 252
 			$sth->execute();
253
-    		    } catch(PDOException $e) {
253
+    		    } catch (PDOException $e) {
254 254
 			return "error (add some indexes) : ".$e->getMessage()."\n";
255 255
     		    }
256 256
     		}
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         	try {
266 266
             	    $sth = $Connection->db->prepare($query);
267 267
 		    $sth->execute();
268
-    		} catch(PDOException $e) {
268
+    		} catch (PDOException $e) {
269 269
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
270 270
     		}
271 271
 		return $error;
@@ -274,12 +274,12 @@  discard block
 block discarded – undo
274 274
 	private static function update_from_7() {
275 275
 		global $globalDBname, $globalDBdriver;
276 276
     		$Connection = new Connection();
277
-    		$query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
277
+    		$query = "ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
278 278
     			ALTER TABLE spotter_output ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;";
279 279
         	try {
280 280
             	    $sth = $Connection->db->prepare($query);
281 281
 		    $sth->execute();
282
-    		} catch(PDOException $e) {
282
+    		} catch (PDOException $e) {
283 283
 		    return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
284 284
     		}
285 285
     		if ($globalDBdriver == 'mysql') {
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 		    try {
288 288
             		$sth = $Connection->db->prepare($query);
289 289
 			$sth->execute();
290
-    		    } catch(PDOException $e) {
290
+    		    } catch (PDOException $e) {
291 291
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
292 292
     		    }
293 293
     		    $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -299,15 +299,15 @@  discard block
 block discarded – undo
299 299
 				DROP TABLE spotter_archive;
300 300
 				RENAME TABLE copy TO spotter_archive;";
301 301
             	    } else {
302
-    			$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
302
+    			$query = "ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
303 303
             	    }
304 304
                 } else {
305
-    		    $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
305
+    		    $query = "ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
306 306
                 }
307 307
         	try {
308 308
             	    $sth = $Connection->db->prepare($query);
309 309
 		    $sth->execute();
310
-    		} catch(PDOException $e) {
310
+    		} catch (PDOException $e) {
311 311
 		    return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n";
312 312
     		}
313 313
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
         	try {
321 321
             	    $sth = $Connection->db->prepare($query);
322 322
 		    $sth->execute();
323
-    		} catch(PDOException $e) {
323
+    		} catch (PDOException $e) {
324 324
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
325 325
     		}
326 326
 		return $error;
@@ -339,14 +339,14 @@  discard block
 block discarded – undo
339 339
         	try {
340 340
             	    $sth = $Connection->db->prepare($query);
341 341
 		    $sth->execute();
342
-    		} catch(PDOException $e) {
342
+    		} catch (PDOException $e) {
343 343
 		    return "error (insert last_update values) : ".$e->getMessage()."\n";
344 344
     		}
345 345
 		$query = "UPDATE `config` SET `value` = '9' WHERE `name` = 'schema_version'";
346 346
         	try {
347 347
             	    $sth = $Connection->db->prepare($query);
348 348
 		    $sth->execute();
349
-    		} catch(PDOException $e) {
349
+    		} catch (PDOException $e) {
350 350
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
351 351
     		}
352 352
 		return $error;
@@ -354,12 +354,12 @@  discard block
 block discarded – undo
354 354
 
355 355
 	private static function update_from_9() {
356 356
     		$Connection = new Connection();
357
-    		$query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
357
+    		$query = "ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
358 358
     			ALTER TABLE spotter_output ADD verticalrate INT(11) NULL;";
359 359
         	try {
360 360
             	    $sth = $Connection->db->prepare($query);
361 361
 		    $sth->execute();
362
-    		} catch(PDOException $e) {
362
+    		} catch (PDOException $e) {
363 363
 		    return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
364 364
     		}
365 365
 		$error = '';
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
         	try {
372 372
             	    $sth = $Connection->db->prepare($query);
373 373
 		    $sth->execute();
374
-    		} catch(PDOException $e) {
374
+    		} catch (PDOException $e) {
375 375
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
376 376
     		}
377 377
 		return $error;
@@ -379,11 +379,11 @@  discard block
 block discarded – undo
379 379
 
380 380
 	private static function update_from_10() {
381 381
     		$Connection = new Connection();
382
-    		$query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
382
+    		$query = "ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
383 383
         	try {
384 384
             	    $sth = $Connection->db->prepare($query);
385 385
 		    $sth->execute();
386
-    		} catch(PDOException $e) {
386
+    		} catch (PDOException $e) {
387 387
 		    return "error (add new enum to ATC table) : ".$e->getMessage()."\n";
388 388
     		}
389 389
 		$error = '';
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
         	try {
402 402
             	    $sth = $Connection->db->prepare($query);
403 403
 		    $sth->execute();
404
-    		} catch(PDOException $e) {
404
+    		} catch (PDOException $e) {
405 405
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
406 406
     		}
407 407
 		return $error;
@@ -410,18 +410,18 @@  discard block
 block discarded – undo
410 410
 	private static function update_from_11() {
411 411
 		global $globalDBdriver, $globalDBname;
412 412
     		$Connection = new Connection();
413
-    		$query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
413
+    		$query = "ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
414 414
         	try {
415 415
             	    $sth = $Connection->db->prepare($query);
416 416
 		    $sth->execute();
417
-    		} catch(PDOException $e) {
417
+    		} catch (PDOException $e) {
418 418
 		    return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n";
419 419
     		}
420
-    		$query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
420
+    		$query = "ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
421 421
         	try {
422 422
             	    $sth = $Connection->db->prepare($query);
423 423
 		    $sth->execute();
424
-    		} catch(PDOException $e) {
424
+    		} catch (PDOException $e) {
425 425
 		    return "error (format_source column to spotter_live) : ".$e->getMessage()."\n";
426 426
     		}
427 427
     		if ($globalDBdriver == 'mysql') {
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 		    try {
430 430
             		$sth = $Connection->db->prepare($query);
431 431
 			$sth->execute();
432
-    		    } catch(PDOException $e) {
432
+    		    } catch (PDOException $e) {
433 433
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
434 434
     		    }
435 435
     		    $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -441,15 +441,15 @@  discard block
 block discarded – undo
441 441
 				DROP TABLE spotter_archive;
442 442
 				RENAME TABLE copy TO spotter_archive;";
443 443
             	    } else {
444
-    			$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
444
+    			$query = "ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
445 445
             	    }
446 446
                 } else {
447
-    		    $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
447
+    		    $query = "ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
448 448
                 }
449 449
         	try {
450 450
             	    $sth = $Connection->db->prepare($query);
451 451
 		    $sth->execute();
452
-    		} catch(PDOException $e) {
452
+    		} catch (PDOException $e) {
453 453
 		    return "error (add columns to spotter_archive) : ".$e->getMessage()."\n";
454 454
     		}
455 455
 
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
         	try {
460 460
             	    $sth = $Connection->db->prepare($query);
461 461
 		    $sth->execute();
462
-    		} catch(PDOException $e) {
462
+    		} catch (PDOException $e) {
463 463
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
464 464
     		}
465 465
 		return $error;
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
         	try {
488 488
             	    $sth = $Connection->db->prepare($query);
489 489
 		    $sth->execute();
490
-    		} catch(PDOException $e) {
490
+    		} catch (PDOException $e) {
491 491
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
492 492
     		}
493 493
 		return $error;
@@ -495,12 +495,12 @@  discard block
 block discarded – undo
495 495
 
496 496
 	private static function update_from_13() {
497 497
     		$Connection = new Connection();
498
-    		if (!$Connection->checkColumnName('spotter_archive_output','real_departure_airport_icao')) {
499
-    			$query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
498
+    		if (!$Connection->checkColumnName('spotter_archive_output', 'real_departure_airport_icao')) {
499
+    			$query = "ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
500 500
 			try {
501 501
 				$sth = $Connection->db->prepare($query);
502 502
 				$sth->execute();
503
-	    		} catch(PDOException $e) {
503
+	    		} catch (PDOException $e) {
504 504
 				return "error (update spotter_archive_output) : ".$e->getMessage()."\n";
505 505
     			}
506 506
 		}
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
         	try {
510 510
             	    $sth = $Connection->db->prepare($query);
511 511
 		    $sth->execute();
512
-    		} catch(PDOException $e) {
512
+    		} catch (PDOException $e) {
513 513
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
514 514
     		}
515 515
 		return $error;
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
         	try {
528 528
             	    $sth = $Connection->db->prepare($query);
529 529
 		    $sth->execute();
530
-    		} catch(PDOException $e) {
530
+    		} catch (PDOException $e) {
531 531
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
532 532
     		}
533 533
 		return $error;
@@ -538,11 +538,11 @@  discard block
 block discarded – undo
538 538
     		$Connection = new Connection();
539 539
 		$error = '';
540 540
     		// Add tables
541
-    		$query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
541
+    		$query = "ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
542 542
         	try {
543 543
             	    $sth = $Connection->db->prepare($query);
544 544
 		    $sth->execute();
545
-    		} catch(PDOException $e) {
545
+    		} catch (PDOException $e) {
546 546
 		    return "error (update stats) : ".$e->getMessage()."\n";
547 547
     		}
548 548
 		if ($error != '') return $error;
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
         	try {
551 551
             	    $sth = $Connection->db->prepare($query);
552 552
 		    $sth->execute();
553
-    		} catch(PDOException $e) {
553
+    		} catch (PDOException $e) {
554 554
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
555 555
     		}
556 556
 		return $error;
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
         	try {
572 572
             	    $sth = $Connection->db->prepare($query);
573 573
 		    $sth->execute();
574
-    		} catch(PDOException $e) {
574
+    		} catch (PDOException $e) {
575 575
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
576 576
     		}
577 577
 		return $error;
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
         	try {
590 590
             	    $sth = $Connection->db->prepare($query);
591 591
 		    $sth->execute();
592
-    		} catch(PDOException $e) {
592
+    		} catch (PDOException $e) {
593 593
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
594 594
     		}
595 595
 		return $error;
@@ -598,12 +598,12 @@  discard block
 block discarded – undo
598 598
     		$Connection = new Connection();
599 599
 		$error = '';
600 600
     		// Modify stats_airport table
601
-    		if (!$Connection->checkColumnName('stats_airport','airport_name')) {
601
+    		if (!$Connection->checkColumnName('stats_airport', 'airport_name')) {
602 602
     			$query = "ALTER TABLE `stats_airport` ADD `stats_type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)";
603 603
     	        	try {
604 604
 	            	    $sth = $Connection->db->prepare($query);
605 605
 			    $sth->execute();
606
-    			} catch(PDOException $e) {
606
+    			} catch (PDOException $e) {
607 607
 			    return "error (update stats) : ".$e->getMessage()."\n";
608 608
     			}
609 609
     		}
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
         	try {
613 613
             	    $sth = $Connection->db->prepare($query);
614 614
 		    $sth->execute();
615
-    		} catch(PDOException $e) {
615
+    		} catch (PDOException $e) {
616 616
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
617 617
     		}
618 618
 		return $error;
@@ -629,73 +629,73 @@  discard block
 block discarded – undo
629 629
         	try {
630 630
             	    $sth = $Connection->db->prepare($query);
631 631
 		    $sth->execute();
632
-    		} catch(PDOException $e) {
632
+    		} catch (PDOException $e) {
633 633
 		    return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n";
634 634
     		}
635 635
 		$query = "alter table spotter_archive add spotter_archive_id INT(11)";
636 636
         	try {
637 637
             	    $sth = $Connection->db->prepare($query);
638 638
 		    $sth->execute();
639
-    		} catch(PDOException $e) {
639
+    		} catch (PDOException $e) {
640 640
 		    return "error (add id again on spotter_archive) : ".$e->getMessage()."\n";
641 641
     		}
642
-		if (!$Connection->checkColumnName('spotter_archive','over_country')) {
642
+		if (!$Connection->checkColumnName('spotter_archive', 'over_country')) {
643 643
 			// Add column over_country
644 644
     			$query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
645 645
 			try {
646 646
             			$sth = $Connection->db->prepare($query);
647 647
 				$sth->execute();
648
-			} catch(PDOException $e) {
648
+			} catch (PDOException $e) {
649 649
 				return "error (add over_country) : ".$e->getMessage()."\n";
650 650
 			}
651 651
 		}
652
-		if (!$Connection->checkColumnName('spotter_live','over_country')) {
652
+		if (!$Connection->checkColumnName('spotter_live', 'over_country')) {
653 653
 			// Add column over_country
654 654
     			$query = "ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
655 655
 			try {
656 656
             			$sth = $Connection->db->prepare($query);
657 657
 				$sth->execute();
658
-			} catch(PDOException $e) {
658
+			} catch (PDOException $e) {
659 659
 				return "error (add over_country) : ".$e->getMessage()."\n";
660 660
 			}
661 661
 		}
662
-		if (!$Connection->checkColumnName('spotter_output','source_name')) {
662
+		if (!$Connection->checkColumnName('spotter_output', 'source_name')) {
663 663
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
664 664
     			$query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
665 665
 			try {
666 666
 				$sth = $Connection->db->prepare($query);
667 667
 				$sth->execute();
668
-			} catch(PDOException $e) {
668
+			} catch (PDOException $e) {
669 669
 				return "error (add source_name column) : ".$e->getMessage()."\n";
670 670
     			}
671 671
     		}
672
-		if (!$Connection->checkColumnName('spotter_live','source_name')) {
672
+		if (!$Connection->checkColumnName('spotter_live', 'source_name')) {
673 673
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
674 674
     			$query = "ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
675 675
 			try {
676 676
 				$sth = $Connection->db->prepare($query);
677 677
 				$sth->execute();
678
-			} catch(PDOException $e) {
678
+			} catch (PDOException $e) {
679 679
 				return "error (add source_name column) : ".$e->getMessage()."\n";
680 680
     			}
681 681
     		}
682
-		if (!$Connection->checkColumnName('spotter_archive_output','source_name')) {
682
+		if (!$Connection->checkColumnName('spotter_archive_output', 'source_name')) {
683 683
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
684 684
     			$query = "ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
685 685
 			try {
686 686
 				$sth = $Connection->db->prepare($query);
687 687
 				$sth->execute();
688
-			} catch(PDOException $e) {
688
+			} catch (PDOException $e) {
689 689
 				return "error (add source_name column) : ".$e->getMessage()."\n";
690 690
     			}
691 691
     		}
692
-		if (!$Connection->checkColumnName('spotter_archive','source_name')) {
692
+		if (!$Connection->checkColumnName('spotter_archive', 'source_name')) {
693 693
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
694 694
     			$query = "ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;";
695 695
 			try {
696 696
 				$sth = $Connection->db->prepare($query);
697 697
 				$sth->execute();
698
-			} catch(PDOException $e) {
698
+			} catch (PDOException $e) {
699 699
 				return "error (add source_name column) : ".$e->getMessage()."\n";
700 700
     			}
701 701
     		}
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
         	try {
705 705
             	    $sth = $Connection->db->prepare($query);
706 706
 		    $sth->execute();
707
-    		} catch(PDOException $e) {
707
+    		} catch (PDOException $e) {
708 708
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
709 709
     		}
710 710
 		return $error;
@@ -719,13 +719,13 @@  discard block
 block discarded – undo
719 719
 			$error .= create_db::import_file('../db/airlines.sql');
720 720
 			if ($error != '') return 'Import airlines.sql : '.$error;
721 721
 		}
722
-		if (!$Connection->checkColumnName('aircraft_modes','type_flight')) {
722
+		if (!$Connection->checkColumnName('aircraft_modes', 'type_flight')) {
723 723
 			// Add column over_country
724 724
     			$query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;";
725 725
         		try {
726 726
 				$sth = $Connection->db->prepare($query);
727 727
 				$sth->execute();
728
-			} catch(PDOException $e) {
728
+			} catch (PDOException $e) {
729 729
 				return "error (add over_country) : ".$e->getMessage()."\n";
730 730
     			}
731 731
     		}
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
         	try {
742 742
             	    $sth = $Connection->db->prepare($query);
743 743
 		    $sth->execute();
744
-    		} catch(PDOException $e) {
744
+    		} catch (PDOException $e) {
745 745
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
746 746
     		}
747 747
 		return $error;
@@ -750,13 +750,13 @@  discard block
 block discarded – undo
750 750
 	private static function update_from_21() {
751 751
 		$Connection = new Connection();
752 752
 		$error = '';
753
-		if (!$Connection->checkColumnName('stats_airport','stats_type')) {
753
+		if (!$Connection->checkColumnName('stats_airport', 'stats_type')) {
754 754
 			// Rename type to stats_type
755 755
 			$query = "ALTER TABLE `stats_airport` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats_flight` CHANGE `type` `stats_type` VARCHAR(50);";
756 756
 			try {
757 757
 				$sth = $Connection->db->prepare($query);
758 758
 				$sth->execute();
759
-			} catch(PDOException $e) {
759
+			} catch (PDOException $e) {
760 760
 				return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n";
761 761
 			}
762 762
 			if ($error != '') return $error;
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
         	try {
766 766
             	    $sth = $Connection->db->prepare($query);
767 767
 		    $sth->execute();
768
-    		} catch(PDOException $e) {
768
+    		} catch (PDOException $e) {
769 769
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
770 770
     		}
771 771
 		return $error;
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
         	try {
789 789
             	    $sth = $Connection->db->prepare($query);
790 790
 		    $sth->execute();
791
-    		} catch(PDOException $e) {
791
+    		} catch (PDOException $e) {
792 792
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
793 793
     		}
794 794
 		return $error;
@@ -815,17 +815,17 @@  discard block
 block discarded – undo
815 815
 			try {
816 816
 				$sth = $Connection->db->prepare($query);
817 817
 				$sth->execute();
818
-			} catch(PDOException $e) {
818
+			} catch (PDOException $e) {
819 819
 				return "error (create index on spotter_archive) : ".$e->getMessage()."\n";
820 820
 			}
821 821
 		}
822
-		if (!$Connection->checkColumnName('stats_aircraft','aircraft_manufacturer')) {
822
+		if (!$Connection->checkColumnName('stats_aircraft', 'aircraft_manufacturer')) {
823 823
 			// Add aircraft_manufacturer to stats_aircraft
824 824
     			$query = "ALTER TABLE stats_aircraft ADD aircraft_manufacturer VARCHAR(255) NULL";
825 825
 			try {
826 826
 				$sth = $Connection->db->prepare($query);
827 827
 				$sth->execute();
828
-			} catch(PDOException $e) {
828
+			} catch (PDOException $e) {
829 829
 				return "error (add aircraft_manufacturer column) : ".$e->getMessage()."\n";
830 830
     			}
831 831
     		}
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
 		try {
835 835
 			$sth = $Connection->db->prepare($query);
836 836
 			$sth->execute();
837
-		} catch(PDOException $e) {
837
+		} catch (PDOException $e) {
838 838
 			return "error (update schema_version) : ".$e->getMessage()."\n";
839 839
 		}
840 840
 		return $error;
@@ -850,23 +850,23 @@  discard block
 block discarded – undo
850 850
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
851 851
 		}
852 852
 		if ($error != '') return 'Import airlines.sql : '.$error;
853
-		if (!$Connection->checkColumnName('airlines','forsource')) {
853
+		if (!$Connection->checkColumnName('airlines', 'forsource')) {
854 854
 			// Add forsource to airlines
855 855
 			$query = "ALTER TABLE airlines ADD forsource VARCHAR(255) NULL DEFAULT NULL";
856 856
 			try {
857 857
 				$sth = $Connection->db->prepare($query);
858 858
 				$sth->execute();
859
-			} catch(PDOException $e) {
859
+			} catch (PDOException $e) {
860 860
 				return "error (add forsource column) : ".$e->getMessage()."\n";
861 861
 			}
862 862
 		}
863
-		if (!$Connection->checkColumnName('stats_aircraft','stats_airline')) {
863
+		if (!$Connection->checkColumnName('stats_aircraft', 'stats_airline')) {
864 864
 			// Add forsource to airlines
865 865
 			$query = "ALTER TABLE stats_aircraft ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
866 866
 			try {
867 867
 				$sth = $Connection->db->prepare($query);
868 868
 				$sth->execute();
869
-			} catch(PDOException $e) {
869
+			} catch (PDOException $e) {
870 870
 				return "error (add stats_airline & filter_name column in stats_aircraft) : ".$e->getMessage()."\n";
871 871
 			}
872 872
 			// Add unique key
@@ -878,17 +878,17 @@  discard block
 block discarded – undo
878 878
 			try {
879 879
 				$sth = $Connection->db->prepare($query);
880 880
 				$sth->execute();
881
-			} catch(PDOException $e) {
881
+			} catch (PDOException $e) {
882 882
 				return "error (add unique key in stats_aircraft) : ".$e->getMessage()."\n";
883 883
 			}
884 884
 		}
885
-		if (!$Connection->checkColumnName('stats_airport','stats_airline')) {
885
+		if (!$Connection->checkColumnName('stats_airport', 'stats_airline')) {
886 886
 			// Add forsource to airlines
887 887
 			$query = "ALTER TABLE stats_airport ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
888 888
 			try {
889 889
 				$sth = $Connection->db->prepare($query);
890 890
 				$sth->execute();
891
-			} catch(PDOException $e) {
891
+			} catch (PDOException $e) {
892 892
 				return "error (add filter_name column in stats_airport) : ".$e->getMessage()."\n";
893 893
 			}
894 894
 			// Add unique key
@@ -900,17 +900,17 @@  discard block
 block discarded – undo
900 900
 			try {
901 901
 				$sth = $Connection->db->prepare($query);
902 902
 				$sth->execute();
903
-			} catch(PDOException $e) {
903
+			} catch (PDOException $e) {
904 904
 				return "error (add unique key in stats_airport) : ".$e->getMessage()."\n";
905 905
 			}
906 906
 		}
907
-		if (!$Connection->checkColumnName('stats_country','stats_airline')) {
907
+		if (!$Connection->checkColumnName('stats_country', 'stats_airline')) {
908 908
 			// Add forsource to airlines
909 909
 			$query = "ALTER TABLE stats_country ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
910 910
 			try {
911 911
 				$sth = $Connection->db->prepare($query);
912 912
 				$sth->execute();
913
-			} catch(PDOException $e) {
913
+			} catch (PDOException $e) {
914 914
 				return "error (add stats_airline & filter_name column in stats_country) : ".$e->getMessage()."\n";
915 915
 			}
916 916
 			// Add unique key
@@ -922,36 +922,36 @@  discard block
 block discarded – undo
922 922
 			try {
923 923
 				$sth = $Connection->db->prepare($query);
924 924
 				$sth->execute();
925
-			} catch(PDOException $e) {
925
+			} catch (PDOException $e) {
926 926
 				return "error (add unique key in stats_airline) : ".$e->getMessage()."\n";
927 927
 			}
928 928
 		}
929
-		if (!$Connection->checkColumnName('stats_flight','stats_airline')) {
929
+		if (!$Connection->checkColumnName('stats_flight', 'stats_airline')) {
930 930
 			// Add forsource to airlines
931 931
 			$query = "ALTER TABLE stats_flight ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
932 932
 			try {
933 933
 				$sth = $Connection->db->prepare($query);
934 934
 				$sth->execute();
935
-			} catch(PDOException $e) {
935
+			} catch (PDOException $e) {
936 936
 				return "error (add stats_airline & filter_name column in stats_flight) : ".$e->getMessage()."\n";
937 937
 			}
938 938
 		}
939
-		if (!$Connection->checkColumnName('stats','stats_airline')) {
939
+		if (!$Connection->checkColumnName('stats', 'stats_airline')) {
940 940
 			// Add forsource to airlines
941 941
 			$query = "ALTER TABLE stats ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
942 942
 			try {
943 943
 				$sth = $Connection->db->prepare($query);
944 944
 				$sth->execute();
945
-			} catch(PDOException $e) {
945
+			} catch (PDOException $e) {
946 946
 				return "error (add stats_airline & filter_name column in stats) : ".$e->getMessage()."\n";
947 947
 			}
948
-			if ($globalDBdriver == 'mysql' && $Connection->indexExists('stats','type')) {
948
+			if ($globalDBdriver == 'mysql' && $Connection->indexExists('stats', 'type')) {
949 949
 				// Add unique key
950 950
 				$query = "drop index type on stats;ALTER TABLE stats ADD UNIQUE stats_type (stats_type,stats_date,stats_airline,filter_name);";
951 951
 				try {
952 952
 					$sth = $Connection->db->prepare($query);
953 953
 					$sth->execute();
954
-				} catch(PDOException $e) {
954
+				} catch (PDOException $e) {
955 955
 					return "error (add unique key in stats) : ".$e->getMessage()."\n";
956 956
 				}
957 957
 			} else {
@@ -964,18 +964,18 @@  discard block
 block discarded – undo
964 964
 				try {
965 965
 					$sth = $Connection->db->prepare($query);
966 966
 					$sth->execute();
967
-				} catch(PDOException $e) {
967
+				} catch (PDOException $e) {
968 968
 					return "error (add unique key in stats) : ".$e->getMessage()."\n";
969 969
 				}
970 970
 			}
971 971
 		}
972
-		if (!$Connection->checkColumnName('stats_registration','stats_airline')) {
972
+		if (!$Connection->checkColumnName('stats_registration', 'stats_airline')) {
973 973
 			// Add forsource to airlines
974 974
 			$query = "ALTER TABLE stats_registration ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
975 975
 			try {
976 976
 				$sth = $Connection->db->prepare($query);
977 977
 				$sth->execute();
978
-			} catch(PDOException $e) {
978
+			} catch (PDOException $e) {
979 979
 				return "error (add stats_airline & filter_name column in stats_registration) : ".$e->getMessage()."\n";
980 980
 			}
981 981
 			// Add unique key
@@ -987,17 +987,17 @@  discard block
 block discarded – undo
987 987
 			try {
988 988
 				$sth = $Connection->db->prepare($query);
989 989
 				$sth->execute();
990
-			} catch(PDOException $e) {
990
+			} catch (PDOException $e) {
991 991
 				return "error (add unique key in stats_registration) : ".$e->getMessage()."\n";
992 992
 			}
993 993
 		}
994
-		if (!$Connection->checkColumnName('stats_callsign','filter_name')) {
994
+		if (!$Connection->checkColumnName('stats_callsign', 'filter_name')) {
995 995
 			// Add forsource to airlines
996 996
 			$query = "ALTER TABLE stats_callsign ADD filter_name VARCHAR(255) NULL DEFAULT ''";
997 997
 			try {
998 998
 				$sth = $Connection->db->prepare($query);
999 999
 				$sth->execute();
1000
-			} catch(PDOException $e) {
1000
+			} catch (PDOException $e) {
1001 1001
 				return "error (add filter_name column in stats_callsign) : ".$e->getMessage()."\n";
1002 1002
 			}
1003 1003
 			// Add unique key
@@ -1009,17 +1009,17 @@  discard block
 block discarded – undo
1009 1009
 			try {
1010 1010
 				$sth = $Connection->db->prepare($query);
1011 1011
 				$sth->execute();
1012
-			} catch(PDOException $e) {
1012
+			} catch (PDOException $e) {
1013 1013
 				return "error (add unique key in stats_callsign) : ".$e->getMessage()."\n";
1014 1014
 			}
1015 1015
 		}
1016
-		if (!$Connection->checkColumnName('stats_airline','filter_name')) {
1016
+		if (!$Connection->checkColumnName('stats_airline', 'filter_name')) {
1017 1017
 			// Add forsource to airlines
1018 1018
 			$query = "ALTER TABLE stats_airline ADD filter_name VARCHAR(255) NULL DEFAULT ''";
1019 1019
 			try {
1020 1020
 				$sth = $Connection->db->prepare($query);
1021 1021
 				$sth->execute();
1022
-			} catch(PDOException $e) {
1022
+			} catch (PDOException $e) {
1023 1023
 				return "error (add filter_name column in stats_airline) : ".$e->getMessage()."\n";
1024 1024
 			}
1025 1025
 			// Add unique key
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
1031 1031
 			try {
1032 1032
 				$sth = $Connection->db->prepare($query);
1033 1033
 				$sth->execute();
1034
-			} catch(PDOException $e) {
1034
+			} catch (PDOException $e) {
1035 1035
 				return "error (add unique key in stats_callsign) : ".$e->getMessage()."\n";
1036 1036
 			}
1037 1037
 		}
@@ -1040,7 +1040,7 @@  discard block
 block discarded – undo
1040 1040
 		try {
1041 1041
 			$sth = $Connection->db->prepare($query);
1042 1042
 			$sth->execute();
1043
-		} catch(PDOException $e) {
1043
+		} catch (PDOException $e) {
1044 1044
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1045 1045
 		}
1046 1046
 		return $error;
@@ -1050,13 +1050,13 @@  discard block
 block discarded – undo
1050 1050
 		global $globalDBdriver;
1051 1051
 		$Connection = new Connection();
1052 1052
 		$error = '';
1053
-		if (!$Connection->checkColumnName('stats_owner','stats_airline')) {
1053
+		if (!$Connection->checkColumnName('stats_owner', 'stats_airline')) {
1054 1054
 			// Add forsource to airlines
1055 1055
 			$query = "ALTER TABLE stats_owner ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
1056 1056
 			try {
1057 1057
 				$sth = $Connection->db->prepare($query);
1058 1058
 				$sth->execute();
1059
-			} catch(PDOException $e) {
1059
+			} catch (PDOException $e) {
1060 1060
 				return "error (add stats_airline & filter_name column in stats_owner) : ".$e->getMessage()."\n";
1061 1061
 			}
1062 1062
 			// Add unique key
@@ -1068,17 +1068,17 @@  discard block
 block discarded – undo
1068 1068
 			try {
1069 1069
 				$sth = $Connection->db->prepare($query);
1070 1070
 				$sth->execute();
1071
-			} catch(PDOException $e) {
1071
+			} catch (PDOException $e) {
1072 1072
 				return "error (add unique key in stats_owner) : ".$e->getMessage()."\n";
1073 1073
 			}
1074 1074
 		}
1075
-		if (!$Connection->checkColumnName('stats_pilot','stats_airline')) {
1075
+		if (!$Connection->checkColumnName('stats_pilot', 'stats_airline')) {
1076 1076
 			// Add forsource to airlines
1077 1077
 			$query = "ALTER TABLE stats_pilot ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
1078 1078
 			try {
1079 1079
 				$sth = $Connection->db->prepare($query);
1080 1080
 				$sth->execute();
1081
-			} catch(PDOException $e) {
1081
+			} catch (PDOException $e) {
1082 1082
 				return "error (add stats_airline & filter_name column in stats_pilot) : ".$e->getMessage()."\n";
1083 1083
 			}
1084 1084
 			// Add unique key
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
 			try {
1091 1091
 				$sth = $Connection->db->prepare($query);
1092 1092
 				$sth->execute();
1093
-			} catch(PDOException $e) {
1093
+			} catch (PDOException $e) {
1094 1094
 				return "error (add unique key in stats_pilot) : ".$e->getMessage()."\n";
1095 1095
 			}
1096 1096
 		}
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
 		try {
1099 1099
 			$sth = $Connection->db->prepare($query);
1100 1100
 			$sth->execute();
1101
-		} catch(PDOException $e) {
1101
+		} catch (PDOException $e) {
1102 1102
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1103 1103
 		}
1104 1104
 		return $error;
@@ -1108,12 +1108,12 @@  discard block
 block discarded – undo
1108 1108
 		global $globalDBdriver;
1109 1109
 		$Connection = new Connection();
1110 1110
 		$error = '';
1111
-		if (!$Connection->checkColumnName('atc','format_source')) {
1111
+		if (!$Connection->checkColumnName('atc', 'format_source')) {
1112 1112
 			$query = "ALTER TABLE atc ADD format_source VARCHAR(255) DEFAULT NULL, ADD source_name VARCHAR(255) DEFAULT NULL";
1113 1113
 			try {
1114 1114
 				$sth = $Connection->db->prepare($query);
1115 1115
 				$sth->execute();
1116
-			} catch(PDOException $e) {
1116
+			} catch (PDOException $e) {
1117 1117
 				return "error (add format_source & source_name column in atc) : ".$e->getMessage()."\n";
1118 1118
 			}
1119 1119
 		}
@@ -1121,7 +1121,7 @@  discard block
 block discarded – undo
1121 1121
 		try {
1122 1122
 			$sth = $Connection->db->prepare($query);
1123 1123
 			$sth->execute();
1124
-		} catch(PDOException $e) {
1124
+		} catch (PDOException $e) {
1125 1125
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1126 1126
 		}
1127 1127
 		return $error;
@@ -1131,13 +1131,13 @@  discard block
 block discarded – undo
1131 1131
 		global $globalDBdriver;
1132 1132
 		$Connection = new Connection();
1133 1133
 		$error = '';
1134
-		if (!$Connection->checkColumnName('stats_pilot','format_source')) {
1134
+		if (!$Connection->checkColumnName('stats_pilot', 'format_source')) {
1135 1135
 			// Add forsource to airlines
1136 1136
 			$query = "ALTER TABLE stats_pilot ADD format_source VARCHAR(255) NULL DEFAULT ''";
1137 1137
 			try {
1138 1138
 				$sth = $Connection->db->prepare($query);
1139 1139
 				$sth->execute();
1140
-			} catch(PDOException $e) {
1140
+			} catch (PDOException $e) {
1141 1141
 				return "error (add format_source column in stats_pilot) : ".$e->getMessage()."\n";
1142 1142
 			}
1143 1143
 			// Add unique key
@@ -1149,7 +1149,7 @@  discard block
 block discarded – undo
1149 1149
 			try {
1150 1150
 				$sth = $Connection->db->prepare($query);
1151 1151
 				$sth->execute();
1152
-			} catch(PDOException $e) {
1152
+			} catch (PDOException $e) {
1153 1153
 				return "error (modify unique key in stats_pilot) : ".$e->getMessage()."\n";
1154 1154
 			}
1155 1155
 		}
@@ -1157,7 +1157,7 @@  discard block
 block discarded – undo
1157 1157
 		try {
1158 1158
 			$sth = $Connection->db->prepare($query);
1159 1159
 			$sth->execute();
1160
-		} catch(PDOException $e) {
1160
+		} catch (PDOException $e) {
1161 1161
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1162 1162
 		}
1163 1163
 		return $error;
@@ -1179,7 +1179,7 @@  discard block
 block discarded – undo
1179 1179
 		    try {
1180 1180
             		$sth = $Connection->db->prepare($query);
1181 1181
 		        $sth->execute();
1182
-		    } catch(PDOException $e) {
1182
+		    } catch (PDOException $e) {
1183 1183
 			return "error : ".$e->getMessage()."\n";
1184 1184
     		    }
1185 1185
     		    $result = $sth->fetch(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
require/class.Spotter.php 1 patch
Spacing   +1000 added lines, -1000 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 require_once(dirname(__FILE__).'/class.Image.php');
5 5
 $global_query = "SELECT spotter_output.* FROM spotter_output";
6 6
 
7
-class Spotter{
7
+class Spotter {
8 8
 	public $db;
9 9
 	
10 10
 	public function __construct($dbc = null) {
@@ -17,64 +17,64 @@  discard block
 block discarded – undo
17 17
 	* @param Array $filter the filter
18 18
 	* @return Array the SQL part
19 19
 	*/
20
-	public function getFilter($filter = array(),$where = false,$and = false) {
20
+	public function getFilter($filter = array(), $where = false, $and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
22 22
 		$filters = array();
23 23
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
24 24
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
25 25
 				$filters = $globalStatsFilters[$globalFilterName];
26 26
 			} else {
27
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
27
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
28 28
 			}
29 29
 		}
30
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
30
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
31 31
 		$filter_query_join = '';
32 32
 		$filter_query_where = '';
33
-		foreach($filters as $flt) {
33
+		foreach ($filters as $flt) {
34 34
 			if (isset($flt['airlines']) && !empty($flt['airlines'])) {
35 35
 				if ($flt['airlines'][0] != '') {
36 36
 					if (isset($flt['source'])) {
37
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
37
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
38 38
 					} else {
39
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
39
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
40 40
 					}
41 41
 				}
42 42
 			}
43 43
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
44 44
 				if (isset($flt['source'])) {
45
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
45
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
46 46
 				} else {
47
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
47
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
48 48
 				}
49 49
 			}
50 50
 			if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']))) {
51 51
 				if (isset($flt['source'])) {
52
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
52
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
53 53
 				}
54 54
 			}
55 55
 		}
56 56
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
57 57
 			if ($filter['airlines'][0] != '') {
58
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
58
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
59 59
 			}
60 60
 		}
61 61
 		if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
62 62
 			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_output.flightaware_id ";
63 63
 		}
64 64
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
65
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
65
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
66 66
 			}
67 67
 		if (isset($filter['source']) && !empty($filter['source'])) {
68
-			$filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
68
+			$filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')";
69 69
 		}
70 70
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
71 71
 			$filter_query_where = " WHERE ident = '".$filter['ident']."'";
72 72
 		}
73 73
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
74 74
 			if ($filter_query_where == '') {
75
-				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
75
+				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
76 76
 			} else {
77
-				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
77
+				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
78 78
 			}
79 79
 		}
80 80
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	* @return Array the spotter information
93 93
 	*
94 94
 	*/
95
-	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
95
+	public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false)
96 96
 	{
97 97
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
98 98
 		$Image = new Image($this->db);
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 			$sth = $this->db->prepare($query.$limitQuery);
123 123
 			$sth->execute($params);
124 124
 		} catch (PDOException $e) {
125
-			printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery);
125
+			printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery);
126 126
 			exit();
127 127
 		}
128 128
 		
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 		$spotter_array = array();
133 133
 		
134 134
 
135
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
135
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
136 136
 		{
137 137
 			$num_rows++;
138 138
 			$temp_array = array();
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 			if (isset($row['route_stop'])) {
178 178
 				$temp_array['route_stop'] = $row['route_stop'];
179 179
 				if ($row['route_stop'] != '') {
180
-					$allroute = explode(' ',$row['route_stop']);
180
+					$allroute = explode(' ', $row['route_stop']);
181 181
 			
182 182
 					foreach ($allroute as $route) {
183 183
 						$route_airport_array = $this->getAllAirportInfo($route);
@@ -232,11 +232,11 @@  discard block
 block discarded – undo
232 232
 				{
233 233
 					$temp_array['date'] = "about ".$dateArray['hours']." hours ago";
234 234
 				} else {
235
-					$temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC"));
235
+					$temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC"));
236 236
 				}
237 237
 				$temp_array['date_minutes_past'] = $dateArray['minutes'];
238
-				$temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC"));
239
-				$temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC"));
238
+				$temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC"));
239
+				$temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC"));
240 240
 				$temp_array['date_unix'] = strtotime($row['date']." UTC");
241 241
 			}
242 242
 			
@@ -270,9 +270,9 @@  discard block
 block discarded – undo
270 270
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
271 271
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
272 272
 					if (is_numeric(substr($row['ident'], 2, 1))) {
273
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2),$fromsource);
273
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2), $fromsource);
274 274
 					} elseif (is_numeric(substr($row['ident'], 3, 1))) {
275
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
275
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
276 276
 					} else {
277 277
 						$airline_array = $this->getAllAirlineInfo('NA');
278 278
 					}
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 				}
310 310
 			}
311 311
 			if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') {
312
-				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'],3));
312
+				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'], 3));
313 313
 				//$acars_array = ACARS->getLiveAcarsData('BA40YL');
314 314
 				if (count($acars_array) > 0) {
315 315
 					$temp_array['acars'] = $acars_array;
@@ -326,11 +326,11 @@  discard block
 block discarded – undo
326 326
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
327 327
 			}
328 328
 
329
-			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
329
+			if ($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
330 330
 			{
331 331
 				if ($globalIVAO) {
332
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
333
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
332
+					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('', $temp_array['aircraft_type'], $temp_array['airline_icao']);
333
+					else $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type']);
334 334
 				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
335 335
 				if (count($image_array) > 0) {
336 336
 					$temp_array['image'] = $image_array[0]['image'];
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 			if (isset($row['arrival_airport_time']) && $row['arrival_airport_time'] != '') {
354 354
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
355 355
 			}
356
-			if ((!isset($globalIVAO) || ! $globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
356
+			if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
357 357
 				if ($schedules === true) {
358 358
 					$schedule_array = $Schedule->getSchedule($temp_array['ident']);
359 359
 					//print_r($schedule_array);
@@ -435,12 +435,12 @@  discard block
 block discarded – undo
435 435
 			if (isset($row['squawk'])) {
436 436
 				$temp_array['squawk'] = $row['squawk'];
437 437
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
438
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
439
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
438
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['country_iso2']);
439
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
440 440
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
441
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
442
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
443
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
441
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['over_country']);
442
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
443
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
444 444
 			}
445 445
     			
446 446
 			$temp_array['query_number_rows'] = $num_rows;
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 	* @return Array the spotter information
460 460
 	*
461 461
 	*/
462
-	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
462
+	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array())
463 463
 	{
464 464
 		global $globalTimezone, $globalDBdriver;
465 465
 		require_once(dirname(__FILE__).'/class.Translation.php');
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
 
470 470
 		$query_values = array();
471 471
 		$additional_query = '';
472
-		$filter_query = $this->getFilter($filters,true,true);
472
+		$filter_query = $this->getFilter($filters, true, true);
473 473
 		if ($q != "")
474 474
 		{
475 475
 			if (!is_string($q))
@@ -477,8 +477,8 @@  discard block
 block discarded – undo
477 477
 				return false;
478 478
 			} else {
479 479
 				$q_array = explode(" ", $q);
480
-				foreach ($q_array as $q_item){
481
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
480
+				foreach ($q_array as $q_item) {
481
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
482 482
 					$additional_query .= " AND (";
483 483
 					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
484 484
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
@@ -510,37 +510,37 @@  discard block
 block discarded – undo
510 510
 
511 511
 		if ($registration != "")
512 512
 		{
513
-			$registration = filter_var($registration,FILTER_SANITIZE_STRING);
513
+			$registration = filter_var($registration, FILTER_SANITIZE_STRING);
514 514
 			if (!is_string($registration))
515 515
 			{
516 516
 				return false;
517 517
 			} else {
518 518
 				$additional_query .= " AND spotter_output.registration = :registration";
519
-				$query_values = array_merge($query_values,array(':registration' => $registration));
519
+				$query_values = array_merge($query_values, array(':registration' => $registration));
520 520
 			}
521 521
 		}
522 522
 
523 523
 		if ($aircraft_icao != "")
524 524
 		{
525
-			$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
525
+			$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
526 526
 			if (!is_string($aircraft_icao))
527 527
 			{
528 528
 				return false;
529 529
 			} else {
530 530
 				$additional_query .= " AND spotter_output.aircraft_icao = :aircraft_icao";
531
-				$query_values = array_merge($query_values,array(':aircraft_icao' => $aircraft_icao));
531
+				$query_values = array_merge($query_values, array(':aircraft_icao' => $aircraft_icao));
532 532
 			}
533 533
 		}
534 534
 
535 535
 		if ($aircraft_manufacturer != "")
536 536
 		{
537
-			$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
537
+			$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
538 538
 			if (!is_string($aircraft_manufacturer))
539 539
 			{
540 540
 				return false;
541 541
 			} else {
542 542
 				$additional_query .= " AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer";
543
-				$query_values = array_merge($query_values,array(':aircraft_manufacturer' => $aircraft_manufacturer));
543
+				$query_values = array_merge($query_values, array(':aircraft_manufacturer' => $aircraft_manufacturer));
544 544
 			}
545 545
 		}
546 546
 
@@ -556,25 +556,25 @@  discard block
 block discarded – undo
556 556
 
557 557
 		if ($airline_icao != "")
558 558
 		{
559
-			$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
559
+			$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
560 560
 			if (!is_string($airline_icao))
561 561
 			{
562 562
 				return false;
563 563
 			} else {
564 564
 				$additional_query .= " AND spotter_output.airline_icao = :airline_icao";
565
-				$query_values = array_merge($query_values,array(':airline_icao' => $airline_icao));
565
+				$query_values = array_merge($query_values, array(':airline_icao' => $airline_icao));
566 566
 			}
567 567
 		}
568 568
 
569 569
 		if ($airline_country != "")
570 570
 		{
571
-			$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
571
+			$airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING);
572 572
 			if (!is_string($airline_country))
573 573
 			{
574 574
 				return false;
575 575
 			} else {
576 576
 				$additional_query .= " AND spotter_output.airline_country = :airline_country";
577
-				$query_values = array_merge($query_values,array(':airline_country' => $airline_country));
577
+				$query_values = array_merge($query_values, array(':airline_country' => $airline_country));
578 578
 			}
579 579
 		}
580 580
 
@@ -601,31 +601,31 @@  discard block
 block discarded – undo
601 601
 
602 602
 		if ($airport != "")
603 603
 		{
604
-			$airport = filter_var($airport,FILTER_SANITIZE_STRING);
604
+			$airport = filter_var($airport, FILTER_SANITIZE_STRING);
605 605
 			if (!is_string($airport))
606 606
 			{
607 607
 				return false;
608 608
 			} else {
609 609
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :airport OR spotter_output.arrival_airport_icao = :airport)";
610
-				$query_values = array_merge($query_values,array(':airport' => $airport));
610
+				$query_values = array_merge($query_values, array(':airport' => $airport));
611 611
 			}
612 612
 		}
613 613
 
614 614
 		if ($airport_country != "")
615 615
 		{
616
-			$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
616
+			$airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING);
617 617
 			if (!is_string($airport_country))
618 618
 			{
619 619
 				return false;
620 620
 			} else {
621 621
 				$additional_query .= " AND (spotter_output.departure_airport_country = :airport_country OR spotter_output.arrival_airport_country = :airport_country)";
622
-				$query_values = array_merge($query_values,array(':airport_country' => $airport_country));
622
+				$query_values = array_merge($query_values, array(':airport_country' => $airport_country));
623 623
 			}
624 624
 		}
625 625
     
626 626
 		if ($callsign != "")
627 627
 		{
628
-			$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
628
+			$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
629 629
 			if (!is_string($callsign))
630 630
 			{
631 631
 				return false;
@@ -633,79 +633,79 @@  discard block
 block discarded – undo
633 633
 				$translate = $Translation->ident2icao($callsign);
634 634
 				if ($translate != $callsign) {
635 635
 					$additional_query .= " AND (spotter_output.ident = :callsign OR spotter_output.ident = :translate)";
636
-					$query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate));
636
+					$query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate));
637 637
 				} else {
638 638
 					$additional_query .= " AND spotter_output.ident = :callsign";
639
-					$query_values = array_merge($query_values,array(':callsign' => $callsign));
639
+					$query_values = array_merge($query_values, array(':callsign' => $callsign));
640 640
 				}
641 641
 			}
642 642
 		}
643 643
 
644 644
 		if ($owner != "")
645 645
 		{
646
-			$owner = filter_var($owner,FILTER_SANITIZE_STRING);
646
+			$owner = filter_var($owner, FILTER_SANITIZE_STRING);
647 647
 			if (!is_string($owner))
648 648
 			{
649 649
 				return false;
650 650
 			} else {
651 651
 				$additional_query .= " AND spotter_output.owner_name = :owner";
652
-				$query_values = array_merge($query_values,array(':owner' => $owner));
652
+				$query_values = array_merge($query_values, array(':owner' => $owner));
653 653
 			}
654 654
 		}
655 655
 
656 656
 		if ($pilot_name != "")
657 657
 		{
658
-			$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
658
+			$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
659 659
 			if (!is_string($pilot_name))
660 660
 			{
661 661
 				return false;
662 662
 			} else {
663 663
 				$additional_query .= " AND spotter_output.pilot_name = :pilot_name";
664
-				$query_values = array_merge($query_values,array(':pilot_name' => $pilot_name));
664
+				$query_values = array_merge($query_values, array(':pilot_name' => $pilot_name));
665 665
 			}
666 666
 		}
667 667
 
668 668
 		if ($pilot_id != "")
669 669
 		{
670
-			$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
670
+			$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT);
671 671
 			if (!is_string($pilot_id))
672 672
 			{
673 673
 				return false;
674 674
 			} else {
675 675
 				$additional_query .= " AND spotter_output.pilot_id = :pilot_id";
676
-				$query_values = array_merge($query_values,array(':pilot_id' => $pilot_id));
676
+				$query_values = array_merge($query_values, array(':pilot_id' => $pilot_id));
677 677
 			}
678 678
 		}
679 679
 
680 680
 		if ($departure_airport_route != "")
681 681
 		{
682
-			$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
682
+			$departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING);
683 683
 			if (!is_string($departure_airport_route))
684 684
 			{
685 685
 				return false;
686 686
 			} else {
687 687
 				$additional_query .= " AND spotter_output.departure_airport_icao = :departure_airport_route";
688
-				$query_values = array_merge($query_values,array(':departure_airport_route' => $departure_airport_route));
688
+				$query_values = array_merge($query_values, array(':departure_airport_route' => $departure_airport_route));
689 689
 			}
690 690
 		}
691 691
 
692 692
 		if ($arrival_airport_route != "")
693 693
 		{
694
-			$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
694
+			$arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING);
695 695
 			if (!is_string($arrival_airport_route))
696 696
 			{
697 697
 				return false;
698 698
 			} else {
699 699
 				$additional_query .= " AND spotter_output.arrival_airport_icao = :arrival_airport_route";
700
-				$query_values = array_merge($query_values,array(':arrival_airport_route' => $arrival_airport_route));
700
+				$query_values = array_merge($query_values, array(':arrival_airport_route' => $arrival_airport_route));
701 701
 			}
702 702
 		}
703 703
 
704 704
 		if ($altitude != "")
705 705
 		{
706 706
 			$altitude_array = explode(",", $altitude);
707
-			$altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
708
-			$altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
707
+			$altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
708
+			$altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
709 709
 
710 710
 			if ($altitude_array[1] != "")
711 711
 			{                
@@ -721,8 +721,8 @@  discard block
 block discarded – undo
721 721
 		if ($date_posted != "")
722 722
 		{
723 723
 			$date_array = explode(",", $date_posted);
724
-			$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
725
-			$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
724
+			$date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
725
+			$date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
726 726
 
727 727
 			if ($globalTimezone != '') {
728 728
 				date_default_timezone_set($globalTimezone);
@@ -753,8 +753,8 @@  discard block
 block discarded – undo
753 753
 		{
754 754
 			$limit_array = explode(",", $limit);
755 755
 			
756
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
757
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
756
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
757
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
758 758
 			
759 759
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
760 760
 			{
@@ -783,23 +783,23 @@  discard block
 block discarded – undo
783 783
 
784 784
 
785 785
 		if ($origLat != "" && $origLon != "" && $dist != "") {
786
-			$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
786
+			$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
787 787
 
788 788
 			if ($globalDBdriver == 'mysql') {
789
-				$query="SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance 
789
+				$query = "SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance 
790 790
 						FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND spotter_archive.longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and spotter_archive.latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
791 791
 						AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2)))) < $dist".$orderby_query;
792 792
 			} else {
793
-				$query="SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
793
+				$query = "SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
794 794
 						FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
795 795
 						AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query.$orderby_query;
796 796
 			}
797 797
 		} else {		
798
-			$query  = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' 
798
+			$query = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' 
799 799
 					".$additional_query."
800 800
 					".$orderby_query;
801 801
 		}
802
-		$spotter_array = $this->getDataFromDB($query, $query_values,$limit_query);
802
+		$spotter_array = $this->getDataFromDB($query, $query_values, $limit_query);
803 803
 		return $spotter_array;
804 804
 	}
805 805
 	
@@ -822,8 +822,8 @@  discard block
 block discarded – undo
822 822
 		{
823 823
 			$limit_array = explode(",", $limit);
824 824
 			
825
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
826
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
825
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
826
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
827 827
 			
828 828
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
829 829
 			{
@@ -840,9 +840,9 @@  discard block
 block discarded – undo
840 840
 			$orderby_query = " ORDER BY spotter_output.date DESC";
841 841
 		}
842 842
 
843
-		$query  = $global_query.$filter_query." ".$orderby_query;
843
+		$query = $global_query.$filter_query." ".$orderby_query;
844 844
 
845
-		$spotter_array = $this->getDataFromDB($query, array(),$limit_query,true);
845
+		$spotter_array = $this->getDataFromDB($query, array(), $limit_query, true);
846 846
 
847 847
 		return $spotter_array;
848 848
 	}
@@ -888,34 +888,34 @@  discard block
 block discarded – undo
888 888
 			{
889 889
 				return false;
890 890
 			} else {
891
-				if ($interval == "30m"){
891
+				if ($interval == "30m") {
892 892
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) <= $this_output.date ';
893
-				} else if ($interval == "1h"){
893
+				} else if ($interval == "1h") {
894 894
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) <= $this_output.date ';
895
-				} else if ($interval == "3h"){
895
+				} else if ($interval == "3h") {
896 896
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 3 HOUR) <= $this_output.date ';
897
-				} else if ($interval == "6h"){
897
+				} else if ($interval == "6h") {
898 898
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 6 HOUR) <= $this_output.date ';
899
-				} else if ($interval == "12h"){
899
+				} else if ($interval == "12h") {
900 900
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 HOUR) <= $this_output.date ';
901
-				} else if ($interval == "24h"){
901
+				} else if ($interval == "24h") {
902 902
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 24 HOUR) <= $this_output.date ';
903
-				} else if ($interval == "7d"){
903
+				} else if ($interval == "7d") {
904 904
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) <= $this_output.date ';
905
-				} else if ($interval == "30d"){
905
+				} else if ($interval == "30d") {
906 906
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 DAY) <= $this_output.date ';
907 907
 				} 
908 908
 			}
909 909
 		}
910 910
 
911
-		$query  = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output 
911
+		$query = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output 
912 912
                    WHERE spotter_output.latitude <> '' 
913 913
 				   AND spotter_output.longitude <> '' 
914 914
                    ".$additional_query."
915 915
                    HAVING distance < :radius  
916 916
 				   ORDER BY distance";
917 917
 
918
-		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius),$limit_query);
918
+		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius), $limit_query);
919 919
 
920 920
 		return $spotter_array;
921 921
 	}
@@ -927,21 +927,21 @@  discard block
 block discarded – undo
927 927
 	* @return Array the spotter information
928 928
 	*
929 929
 	*/
930
-	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
930
+	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '', $filter = array())
931 931
 	{
932 932
 		global $global_query;
933 933
 		
934 934
 		date_default_timezone_set('UTC');
935 935
 
936
-		$filter_query = $this->getFilter($filter,true,true);
936
+		$filter_query = $this->getFilter($filter, true, true);
937 937
 
938 938
 		$limit_query = '';
939 939
 		if ($limit != "")
940 940
 		{
941 941
 			$limit_array = explode(",", $limit);
942 942
 			
943
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
944
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
943
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
944
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
945 945
 			
946 946
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
947 947
 			{
@@ -958,7 +958,7 @@  discard block
 block discarded – undo
958 958
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
959 959
 		}
960 960
 
961
-		$query  = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
961
+		$query = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
962 962
 
963 963
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
964 964
 
@@ -977,15 +977,15 @@  discard block
 block discarded – undo
977 977
 		global $global_query;
978 978
 		
979 979
 		date_default_timezone_set('UTC');
980
-		$filter_query = $this->getFilter($filter,true,true);
980
+		$filter_query = $this->getFilter($filter, true, true);
981 981
 
982 982
 		$limit_query = '';
983 983
 		if ($limit != "")
984 984
 		{
985 985
 			$limit_array = explode(",", $limit);
986 986
 			
987
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
988
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
987
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
988
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
989 989
 			
990 990
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
991 991
 			{
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1003 1003
 		}
1004 1004
 
1005
-		$query  = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1005
+		$query = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1006 1006
 
1007 1007
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1008 1008
 
@@ -1016,20 +1016,20 @@  discard block
 block discarded – undo
1016 1016
 	* @return Array the spotter information
1017 1017
 	*
1018 1018
 	*/
1019
-	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1019
+	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '', $filter = array())
1020 1020
 	{
1021 1021
 		global $global_query;
1022 1022
 		
1023 1023
 		date_default_timezone_set('UTC');
1024
-		$filter_query = $this->getFilter($filter,true,true);
1024
+		$filter_query = $this->getFilter($filter, true, true);
1025 1025
 		
1026 1026
 		$limit_query = '';
1027 1027
 		if ($limit != "")
1028 1028
 		{
1029 1029
 			$limit_array = explode(",", $limit);
1030 1030
 			
1031
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1032
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1031
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1032
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1033 1033
 			
1034 1034
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1035 1035
 			{
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1047 1047
 		}
1048 1048
 
1049
-		$query  = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1049
+		$query = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1050 1050
 
1051 1051
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1052 1052
 
@@ -1066,7 +1066,7 @@  discard block
 block discarded – undo
1066 1066
 		
1067 1067
 		date_default_timezone_set('UTC');
1068 1068
 		
1069
-		$filter_query = $this->getFilter($filter,true,true);
1069
+		$filter_query = $this->getFilter($filter, true, true);
1070 1070
 		
1071 1071
 		$limit_query = '';
1072 1072
 		
@@ -1074,8 +1074,8 @@  discard block
 block discarded – undo
1074 1074
 		{
1075 1075
 			$limit_array = explode(",", $limit);
1076 1076
 			
1077
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1078
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1077
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1078
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1079 1079
 			
1080 1080
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1081 1081
 			{
@@ -1092,7 +1092,7 @@  discard block
 block discarded – undo
1092 1092
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1093 1093
 		}
1094 1094
 
1095
-		$query  = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1095
+		$query = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1096 1096
 
1097 1097
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1098 1098
 
@@ -1111,14 +1111,14 @@  discard block
 block discarded – undo
1111 1111
 		global $global_query;
1112 1112
 		
1113 1113
 		date_default_timezone_set('UTC');
1114
-		$filter_query = $this->getFilter($filter,true,true);
1114
+		$filter_query = $this->getFilter($filter, true, true);
1115 1115
 		$limit_query = '';
1116 1116
 		if ($limit != "")
1117 1117
 		{
1118 1118
 			$limit_array = explode(",", $limit);
1119 1119
 			
1120
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1121
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1120
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1121
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1122 1122
 			
1123 1123
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1124 1124
 			{
@@ -1135,7 +1135,7 @@  discard block
 block discarded – undo
1135 1135
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1136 1136
 		}
1137 1137
 
1138
-		$query  = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1138
+		$query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1139 1139
 
1140 1140
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1141 1141
 
@@ -1159,9 +1159,9 @@  discard block
 block discarded – undo
1159 1159
 		$query_values = array(':id' => $id);
1160 1160
 
1161 1161
 		//$query  = $global_query." WHERE spotter_output.ident <> '' ".$additional_query." ";
1162
-		$query  = $global_query." WHERE ".$additional_query." ";
1162
+		$query = $global_query." WHERE ".$additional_query." ";
1163 1163
 
1164
-		$spotter_array = $this->getDataFromDB($query,$query_values);
1164
+		$spotter_array = $this->getDataFromDB($query, $query_values);
1165 1165
 
1166 1166
 		return $spotter_array;
1167 1167
 	}
@@ -1199,8 +1199,8 @@  discard block
 block discarded – undo
1199 1199
 		{
1200 1200
 			$limit_array = explode(",", $limit);
1201 1201
 			
1202
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1203
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1202
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1203
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1204 1204
 			
1205 1205
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1206 1206
 			{
@@ -1241,7 +1241,7 @@  discard block
 block discarded – undo
1241 1241
 		$query_values = array();
1242 1242
 		$limit_query = '';
1243 1243
 		$additional_query = '';
1244
-		$filter_query = $this->getFilter($filter,true,true);
1244
+		$filter_query = $this->getFilter($filter, true, true);
1245 1245
 		
1246 1246
 		if ($aircraft_type != "")
1247 1247
 		{
@@ -1258,8 +1258,8 @@  discard block
 block discarded – undo
1258 1258
 		{
1259 1259
 			$limit_array = explode(",", $limit);
1260 1260
 			
1261
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1262
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1261
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1262
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1263 1263
 			
1264 1264
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1265 1265
 			{
@@ -1315,8 +1315,8 @@  discard block
 block discarded – undo
1315 1315
 		{
1316 1316
 			$limit_array = explode(",", $limit);
1317 1317
 			
1318
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1319
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1318
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1319
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1320 1320
 			
1321 1321
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1322 1322
 			{
@@ -1332,7 +1332,7 @@  discard block
 block discarded – undo
1332 1332
 		} else {
1333 1333
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1334 1334
 		}
1335
-		$filter_query = $this->getFilter($filter,true,true);
1335
+		$filter_query = $this->getFilter($filter, true, true);
1336 1336
 
1337 1337
 		//$query = $global_query.$filter_query." spotter_output.ident <> '' ".$additional_query." ".$orderby_query;
1338 1338
 		$query = $global_query.$filter_query." ".$additional_query." ".$orderby_query;
@@ -1351,7 +1351,7 @@  discard block
 block discarded – undo
1351 1351
 	* @return Array the spotter information
1352 1352
 	*
1353 1353
 	*/
1354
-	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1354
+	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '', $filters = array())
1355 1355
 	{
1356 1356
 		global $global_query;
1357 1357
 		
@@ -1360,7 +1360,7 @@  discard block
 block discarded – undo
1360 1360
 		$query_values = array();
1361 1361
 		$limit_query = '';
1362 1362
 		$additional_query = '';
1363
-		$filter_query = $this->getFilter($filters,true,true);
1363
+		$filter_query = $this->getFilter($filters, true, true);
1364 1364
 		
1365 1365
 		if ($airline != "")
1366 1366
 		{
@@ -1377,8 +1377,8 @@  discard block
 block discarded – undo
1377 1377
 		{
1378 1378
 			$limit_array = explode(",", $limit);
1379 1379
 			
1380
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1381
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1380
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1381
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1382 1382
 			
1383 1383
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1384 1384
 			{
@@ -1408,7 +1408,7 @@  discard block
 block discarded – undo
1408 1408
 	* @return Array the spotter information
1409 1409
 	*
1410 1410
 	*/
1411
-	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1411
+	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array())
1412 1412
 	{
1413 1413
 		global $global_query;
1414 1414
 		
@@ -1416,7 +1416,7 @@  discard block
 block discarded – undo
1416 1416
 		$query_values = array();
1417 1417
 		$limit_query = '';
1418 1418
 		$additional_query = '';
1419
-		$filter_query = $this->getFilter($filters,true,true);
1419
+		$filter_query = $this->getFilter($filters, true, true);
1420 1420
 		
1421 1421
 		if ($airport != "")
1422 1422
 		{
@@ -1433,8 +1433,8 @@  discard block
 block discarded – undo
1433 1433
 		{
1434 1434
 			$limit_array = explode(",", $limit);
1435 1435
 			
1436
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1437
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1436
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1437
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1438 1438
 			
1439 1439
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1440 1440
 			{
@@ -1466,7 +1466,7 @@  discard block
 block discarded – undo
1466 1466
 	* @return Array the spotter information
1467 1467
 	*
1468 1468
 	*/
1469
-	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1469
+	public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array())
1470 1470
 	{
1471 1471
 		global $global_query, $globalTimezone, $globalDBdriver;
1472 1472
 		
@@ -1474,7 +1474,7 @@  discard block
 block discarded – undo
1474 1474
 		$limit_query = '';
1475 1475
 		$additional_query = '';
1476 1476
 
1477
-		$filter_query = $this->getFilter($filter,true,true);
1477
+		$filter_query = $this->getFilter($filter, true, true);
1478 1478
 		
1479 1479
 		if ($date != "")
1480 1480
 		{
@@ -1500,8 +1500,8 @@  discard block
 block discarded – undo
1500 1500
 		{
1501 1501
 			$limit_array = explode(",", $limit);
1502 1502
 			
1503
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1504
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1503
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1504
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1505 1505
 			
1506 1506
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1507 1507
 			{
@@ -1531,7 +1531,7 @@  discard block
 block discarded – undo
1531 1531
 	* @return Array the spotter information
1532 1532
 	*
1533 1533
 	*/
1534
-	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1534
+	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '', $filters = array())
1535 1535
 	{
1536 1536
 		global $global_query;
1537 1537
 		
@@ -1540,7 +1540,7 @@  discard block
 block discarded – undo
1540 1540
 		$query_values = array();
1541 1541
 		$limit_query = '';
1542 1542
 		$additional_query = '';
1543
-		$filter_query = $this->getFilter($filters,true,true);
1543
+		$filter_query = $this->getFilter($filters, true, true);
1544 1544
 		if ($country != "")
1545 1545
 		{
1546 1546
 			if (!is_string($country))
@@ -1557,8 +1557,8 @@  discard block
 block discarded – undo
1557 1557
 		{
1558 1558
 			$limit_array = explode(",", $limit);
1559 1559
 			
1560
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1561
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1560
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1561
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1562 1562
 			
1563 1563
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1564 1564
 			{
@@ -1598,7 +1598,7 @@  discard block
 block discarded – undo
1598 1598
 		$query_values = array();
1599 1599
 		$additional_query = '';
1600 1600
 		$limit_query = '';
1601
-		$filter_query = $this->getFilter($filters,true,true);
1601
+		$filter_query = $this->getFilter($filters, true, true);
1602 1602
 		
1603 1603
 		if ($aircraft_manufacturer != "")
1604 1604
 		{
@@ -1615,8 +1615,8 @@  discard block
 block discarded – undo
1615 1615
 		{
1616 1616
 			$limit_array = explode(",", $limit);
1617 1617
 			
1618
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1619
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1618
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1619
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1620 1620
 			
1621 1621
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1622 1622
 			{
@@ -1658,14 +1658,14 @@  discard block
 block discarded – undo
1658 1658
 		$query_values = array();
1659 1659
 		$additional_query = '';
1660 1660
 		$limit_query = '';
1661
-		$filter_query = $this->getFilter($filters,true,true);
1661
+		$filter_query = $this->getFilter($filters, true, true);
1662 1662
 		if ($departure_airport_icao != "")
1663 1663
 		{
1664 1664
 			if (!is_string($departure_airport_icao))
1665 1665
 			{
1666 1666
 				return false;
1667 1667
 			} else {
1668
-				$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1668
+				$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1669 1669
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)";
1670 1670
 				$query_values = array(':departure_airport_icao' => $departure_airport_icao);
1671 1671
 			}
@@ -1677,9 +1677,9 @@  discard block
 block discarded – undo
1677 1677
 			{
1678 1678
 				return false;
1679 1679
 			} else {
1680
-				$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1680
+				$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1681 1681
 				$additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)";
1682
-				$query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao));
1682
+				$query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao));
1683 1683
 			}
1684 1684
 		}
1685 1685
 		
@@ -1687,8 +1687,8 @@  discard block
 block discarded – undo
1687 1687
 		{
1688 1688
 			$limit_array = explode(",", $limit);
1689 1689
 			
1690
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1691
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1690
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1691
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1692 1692
 			
1693 1693
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1694 1694
 			{
@@ -1727,15 +1727,15 @@  discard block
 block discarded – undo
1727 1727
 		global $global_query;
1728 1728
 		
1729 1729
 		date_default_timezone_set('UTC');
1730
-		$filter_query = $this->getFilter($filter,true,true);
1730
+		$filter_query = $this->getFilter($filter, true, true);
1731 1731
 		$limit_query = '';
1732 1732
 		
1733 1733
 		if ($limit != "")
1734 1734
 		{
1735 1735
 			$limit_array = explode(",", $limit);
1736 1736
 			
1737
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1738
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1737
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1738
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1739 1739
 			
1740 1740
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1741 1741
 			{
@@ -1752,7 +1752,7 @@  discard block
 block discarded – undo
1752 1752
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1753 1753
 		}
1754 1754
 
1755
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1755
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1756 1756
 
1757 1757
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1758 1758
 
@@ -1765,19 +1765,19 @@  discard block
 block discarded – undo
1765 1765
 	* @return String the highlight text
1766 1766
 	*
1767 1767
 	*/
1768
-	public function getHighlightByRegistration($registration,$filter = array())
1768
+	public function getHighlightByRegistration($registration, $filter = array())
1769 1769
 	{
1770 1770
 		global $global_query;
1771 1771
 		
1772 1772
 		date_default_timezone_set('UTC');
1773
-		$filter_query = $this->getFilter($filter,true,true);
1774
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
1773
+		$filter_query = $this->getFilter($filter, true, true);
1774
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
1775 1775
 		
1776
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1776
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1777 1777
 		$sth = $this->db->prepare($query);
1778 1778
 		$sth->execute(array(':registration' => $registration));
1779 1779
 
1780
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1780
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1781 1781
 		{
1782 1782
 			$highlight = $row['highlight'];
1783 1783
 		}
@@ -1793,14 +1793,14 @@  discard block
 block discarded – undo
1793 1793
 	* @return String usage
1794 1794
 	*
1795 1795
 	*/
1796
-	public function getSquawkUsage($squawk = '',$country = 'FR')
1796
+	public function getSquawkUsage($squawk = '', $country = 'FR')
1797 1797
 	{
1798 1798
 		
1799
-		$squawk = filter_var($squawk,FILTER_SANITIZE_STRING);
1800
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
1799
+		$squawk = filter_var($squawk, FILTER_SANITIZE_STRING);
1800
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
1801 1801
 
1802 1802
 		$query  = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1";
1803
-		$query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country);
1803
+		$query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country);
1804 1804
 		
1805 1805
 		$sth = $this->db->prepare($query);
1806 1806
 		$sth->execute($query_values);
@@ -1822,9 +1822,9 @@  discard block
 block discarded – undo
1822 1822
 	public function getAirportIcao($airport_iata = '')
1823 1823
 	{
1824 1824
 		
1825
-		$airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING);
1825
+		$airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING);
1826 1826
 
1827
-		$query  = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1827
+		$query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1828 1828
 		$query_values = array(':airport' => $airport_iata);
1829 1829
 		
1830 1830
 		$sth = $this->db->prepare($query);
@@ -1846,12 +1846,12 @@  discard block
 block discarded – undo
1846 1846
 	* @return Float distance to the airport
1847 1847
 	*
1848 1848
 	*/
1849
-	public function getAirportDistance($airport_icao,$latitude,$longitude)
1849
+	public function getAirportDistance($airport_icao, $latitude, $longitude)
1850 1850
 	{
1851 1851
 		
1852
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
1852
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
1853 1853
 
1854
-		$query  = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
1854
+		$query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
1855 1855
 		$query_values = array(':airport' => $airport_icao);
1856 1856
 		$sth = $this->db->prepare($query);
1857 1857
 		$sth->execute($query_values);
@@ -1861,7 +1861,7 @@  discard block
 block discarded – undo
1861 1861
 			$airport_latitude = $row['latitude'];
1862 1862
 			$airport_longitude = $row['longitude'];
1863 1863
 			$Common = new Common();
1864
-			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
1864
+			return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude);
1865 1865
 		} else return '';
1866 1866
 	}
1867 1867
 	
@@ -1875,11 +1875,11 @@  discard block
 block discarded – undo
1875 1875
 	public function getAllAirportInfo($airport = '')
1876 1876
 	{
1877 1877
 		
1878
-		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
1878
+		$airport = filter_var($airport, FILTER_SANITIZE_STRING);
1879 1879
 
1880 1880
 		$query_values = array();
1881 1881
 		if ($airport == 'NA') {
1882
-			return array(array('name' => 'Not available','city' => 'N/A', 'country' => 'N/A','iata' => 'NA','icao' => 'NA','altitude' => NULL,'latitude' => 0,'longitude' => 0,'type' => 'NA','home_link' => '','wikipedia_link' => '','image_thumb' => '', 'image' => ''));
1882
+			return array(array('name' => 'Not available', 'city' => 'N/A', 'country' => 'N/A', 'iata' => 'NA', 'icao' => 'NA', 'altitude' => NULL, 'latitude' => 0, 'longitude' => 0, 'type' => 'NA', 'home_link' => '', 'wikipedia_link' => '', 'image_thumb' => '', 'image' => ''));
1883 1883
 		} elseif ($airport == '') {
1884 1884
 			$query  = "SELECT airport.name, airport.city, airport.country, airport.iata, airport.icao, airport.latitude, airport.longitude, airport.altitude, airport.type, airport.home_link, airport.wikipedia_link, airport.image_thumb, airport.image FROM airport";
1885 1885
 		} else {
@@ -1927,14 +1927,14 @@  discard block
 block discarded – undo
1927 1927
 	{
1928 1928
 		$lst_countries = '';
1929 1929
 		foreach ($countries as $country) {
1930
-			$country = filter_var($country,FILTER_SANITIZE_STRING);
1930
+			$country = filter_var($country, FILTER_SANITIZE_STRING);
1931 1931
 			if ($lst_countries == '') {
1932 1932
 				$lst_countries = "'".$country."'";
1933 1933
 			} else {
1934 1934
 				$lst_countries .= ",'".$country."'";
1935 1935
 			}
1936 1936
 		}
1937
-		$query  = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
1937
+		$query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
1938 1938
 		
1939 1939
 		$sth = $this->db->prepare($query);
1940 1940
 		$sth->execute();
@@ -1942,7 +1942,7 @@  discard block
 block discarded – undo
1942 1942
 		$airport_array = array();
1943 1943
 		$temp_array = array();
1944 1944
 		
1945
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1945
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1946 1946
 		{
1947 1947
 			$temp_array['name'] = $row['name'];
1948 1948
 			$temp_array['city'] = $row['city'];
@@ -1970,10 +1970,10 @@  discard block
 block discarded – undo
1970 1970
 	{
1971 1971
 		global $globalDBdriver;
1972 1972
 		if (is_array($coord)) {
1973
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1974
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1975
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1976
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1973
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1974
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1975
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1976
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1977 1977
 		} else return array();
1978 1978
 		if ($globalDBdriver == 'mysql') {
1979 1979
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
@@ -1985,7 +1985,7 @@  discard block
 block discarded – undo
1985 1985
     
1986 1986
 		$airport_array = array();
1987 1987
 		
1988
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1988
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1989 1989
 		{
1990 1990
 			$temp_array = $row;
1991 1991
 
@@ -2005,13 +2005,13 @@  discard block
 block discarded – undo
2005 2005
 	public function getAllWaypointsInfobyCoord($coord)
2006 2006
 	{
2007 2007
 		if (is_array($coord)) {
2008
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2009
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2010
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2011
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2008
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2009
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2010
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2011
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2012 2012
 		} else return array();
2013 2013
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2014
-		$query  = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")";
2014
+		$query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")";
2015 2015
 		//$query  = "SELECT waypoints.* FROM waypoints";
2016 2016
 		//$query  = "SELECT waypoints.* FROM waypoints INNER JOIN (SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") w ON w.name_end = waypoints.name_begin OR w.name_begin = waypoints.name_begin OR w.name_begin = waypoints.name_end OR w.name_end = waypoints.name_end";
2017 2017
 		//$query = "SELECT * FROM waypoints LEFT JOIN waypoints w ON waypoints.name_end = w.name_begin WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
@@ -2023,7 +2023,7 @@  discard block
 block discarded – undo
2023 2023
     
2024 2024
 		$waypoints_array = array();
2025 2025
 		
2026
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2026
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2027 2027
 		{
2028 2028
 			$temp_array = $row;
2029 2029
 
@@ -2045,10 +2045,10 @@  discard block
 block discarded – undo
2045 2045
 	{
2046 2046
 		global $globalUseRealAirlines;
2047 2047
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2048
-		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2048
+		$airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING));
2049 2049
 		if ($airline_icao == 'NA') {
2050 2050
 			$airline_array = array();
2051
-			$airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2051
+			$airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2052 2052
 			return $airline_array;
2053 2053
 		} else {
2054 2054
 			if (strlen($airline_icao) == 2) {
@@ -2069,7 +2069,7 @@  discard block
 block discarded – undo
2069 2069
 			if ($fromsource === NULL) {
2070 2070
 				$sth->execute(array(':airline_icao' => $airline_icao));
2071 2071
 			} else {
2072
-				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2072
+				$sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource));
2073 2073
 			}
2074 2074
                         /*
2075 2075
 			$airline_array = array();
@@ -2111,12 +2111,12 @@  discard block
 block discarded – undo
2111 2111
 	*/
2112 2112
 	public function getAllAircraftInfo($aircraft_type)
2113 2113
 	{
2114
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2114
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2115 2115
 
2116 2116
 		if ($aircraft_type == 'NA') {
2117
-			return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2117
+			return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2118 2118
 		}
2119
-		$query  = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow FROM aircraft WHERE aircraft.icao = :aircraft_type";
2119
+		$query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow FROM aircraft WHERE aircraft.icao = :aircraft_type";
2120 2120
 		
2121 2121
 		$sth = $this->db->prepare($query);
2122 2122
 		$sth->execute(array(':aircraft_type' => $aircraft_type));
@@ -2148,7 +2148,7 @@  discard block
 block discarded – undo
2148 2148
 	*/
2149 2149
 	public function getAircraftIcao($aircraft_type)
2150 2150
 	{
2151
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2151
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2152 2152
 		$all_aircraft = array('737-300' => 'B733',
2153 2153
 				'777-200' => 'B772',
2154 2154
 				'777-200ER' => 'B772',
@@ -2160,10 +2160,10 @@  discard block
 block discarded – undo
2160 2160
 				'A380' => 'A388');
2161 2161
 		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2162 2162
 
2163
-		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2163
+		$query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2164 2164
 		$aircraft_type = strtoupper($aircraft_type);
2165 2165
 		$sth = $this->db->prepare($query);
2166
-		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2166
+		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,));
2167 2167
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2168 2168
 		if (isset($result[0]['icao'])) return $result[0]['icao'];
2169 2169
 		else return '';
@@ -2178,9 +2178,9 @@  discard block
 block discarded – undo
2178 2178
 	*/
2179 2179
 	public function getAllAircraftType($aircraft_modes)
2180 2180
 	{
2181
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
2181
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
2182 2182
 
2183
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
2183
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
2184 2184
 		
2185 2185
 		$sth = $this->db->prepare($query);
2186 2186
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -2201,8 +2201,8 @@  discard block
 block discarded – undo
2201 2201
 	*/
2202 2202
 	public function getOperator($operator)
2203 2203
 	{
2204
-		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
2205
-		$query  = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2204
+		$operator = filter_var($operator, FILTER_SANITIZE_STRING);
2205
+		$query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2206 2206
 		
2207 2207
 		$sth = $this->db->prepare($query);
2208 2208
 		$sth->execute(array(':operator' => $operator));
@@ -2223,9 +2223,9 @@  discard block
 block discarded – undo
2223 2223
 	*/
2224 2224
 	public function getRouteInfo($callsign)
2225 2225
 	{
2226
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2226
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
2227 2227
                 if ($callsign == '') return array();
2228
-		$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";
2228
+		$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";
2229 2229
 		
2230 2230
 		$sth = $this->db->prepare($query);
2231 2231
 		$sth->execute(array(':callsign' => $callsign));
@@ -2246,9 +2246,9 @@  discard block
 block discarded – undo
2246 2246
 	*/
2247 2247
 	public function getAircraftInfoByRegistration($registration)
2248 2248
 	{
2249
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2249
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2250 2250
 
2251
-		$query  = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration";
2251
+		$query = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration";
2252 2252
 		
2253 2253
 		$sth = $this->db->prepare($query);
2254 2254
 		$sth->execute(array(':registration' => $registration));
@@ -2256,7 +2256,7 @@  discard block
 block discarded – undo
2256 2256
 		$aircraft_array = array();
2257 2257
 		$temp_array = array();
2258 2258
 		
2259
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2259
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2260 2260
 		{
2261 2261
 			$temp_array['airline_icao'] = $row['airline_icao'];
2262 2262
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -2278,7 +2278,7 @@  discard block
 block discarded – undo
2278 2278
 	*/
2279 2279
 	public function getAircraftOwnerByRegistration($registration)
2280 2280
 	{
2281
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2281
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2282 2282
 		$Connection = new Connection($this->db);
2283 2283
 		if ($Connection->tableExists('aircraft_owner')) {
2284 2284
 			$query  = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1";
@@ -2300,7 +2300,7 @@  discard block
 block discarded – undo
2300 2300
 	public function getAllFlightsforSitemap()
2301 2301
 	{
2302 2302
 		//$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 ";
2303
-		$query  = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2303
+		$query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2304 2304
 		
2305 2305
 		$sth = $this->db->prepare($query);
2306 2306
 		$sth->execute();
@@ -2347,7 +2347,7 @@  discard block
 block discarded – undo
2347 2347
 		$manufacturer_array = array();
2348 2348
 		$temp_array = array();
2349 2349
 		
2350
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2350
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2351 2351
 		{
2352 2352
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
2353 2353
 
@@ -2373,7 +2373,7 @@  discard block
 block discarded – undo
2373 2373
 								ORDER BY spotter_output.aircraft_name ASC";
2374 2374
 								
2375 2375
 		*/
2376
-		$filter_query = $this->getFilter($filters,true,true);
2376
+		$filter_query = $this->getFilter($filters, true, true);
2377 2377
 		$query = "SELECT DISTINCT icao AS aircraft_icao, type AS aircraft_name, manufacturer AS aircraft_manufacturer FROM aircraft".$filter_query." icao <> '' ORDER BY aircraft_manufacturer ASC";
2378 2378
 		
2379 2379
 		$sth = $this->db->prepare($query);
@@ -2382,7 +2382,7 @@  discard block
 block discarded – undo
2382 2382
 		$aircraft_array = array();
2383 2383
 		$temp_array = array();
2384 2384
 		
2385
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2385
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2386 2386
 		{
2387 2387
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
2388 2388
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
@@ -2403,8 +2403,8 @@  discard block
 block discarded – undo
2403 2403
 	*/
2404 2404
 	public function getAllAircraftRegistrations($filters = array())
2405 2405
 	{
2406
-		$filter_query = $this->getFilter($filters,true,true);
2407
-		$query  = "SELECT DISTINCT spotter_output.registration 
2406
+		$filter_query = $this->getFilter($filters, true, true);
2407
+		$query = "SELECT DISTINCT spotter_output.registration 
2408 2408
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' 
2409 2409
 				ORDER BY spotter_output.registration ASC";
2410 2410
 
@@ -2414,7 +2414,7 @@  discard block
 block discarded – undo
2414 2414
 		$aircraft_array = array();
2415 2415
 		$temp_array = array();
2416 2416
 		
2417
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2417
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2418 2418
 		{
2419 2419
 			$temp_array['registration'] = $row['registration'];
2420 2420
 
@@ -2431,11 +2431,11 @@  discard block
 block discarded – undo
2431 2431
 	* @return Array list of source name
2432 2432
 	*
2433 2433
 	*/
2434
-	public function getAllSourceName($type = '',$filters = array())
2434
+	public function getAllSourceName($type = '', $filters = array())
2435 2435
 	{
2436
-		$filter_query = $this->getFilter($filters,true,true);
2436
+		$filter_query = $this->getFilter($filters, true, true);
2437 2437
 		$query_values = array();
2438
-		$query  = "SELECT DISTINCT spotter_output.source_name 
2438
+		$query = "SELECT DISTINCT spotter_output.source_name 
2439 2439
 				FROM spotter_output".$filter_query." spotter_output.source_name <> ''";
2440 2440
 		if ($type != '') {
2441 2441
 			$query_values = array(':type' => $type);
@@ -2450,7 +2450,7 @@  discard block
 block discarded – undo
2450 2450
 		$source_array = array();
2451 2451
 		$temp_array = array();
2452 2452
 		
2453
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2453
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2454 2454
 		{
2455 2455
 			$temp_array['source_name'] = $row['source_name'];
2456 2456
 			$source_array[] = $temp_array;
@@ -2466,11 +2466,11 @@  discard block
 block discarded – undo
2466 2466
 	* @return Array list of airline names
2467 2467
 	*
2468 2468
 	*/
2469
-	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2469
+	public function getAllAirlineNames($airline_type = '', $forsource = NULL, $filters = array())
2470 2470
 	{
2471
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2472
-		$filter_query = $this->getFilter($filters,true,true);
2473
-		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
2471
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2472
+		$filter_query = $this->getFilter($filters, true, true);
2473
+		$airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
2474 2474
 		if ($airline_type == '' || $airline_type == 'all') {
2475 2475
 			/*
2476 2476
 			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
@@ -2489,7 +2489,7 @@  discard block
 block discarded – undo
2489 2489
 				$query_data = array(':forsource' => $forsource);
2490 2490
 			}
2491 2491
 		} else {
2492
-			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2492
+			$query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2493 2493
 					FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
2494 2494
 					AND spotter_output.airline_type = :airline_type 
2495 2495
 					ORDER BY spotter_output.airline_icao ASC";
@@ -2502,7 +2502,7 @@  discard block
 block discarded – undo
2502 2502
 		$airline_array = array();
2503 2503
 		$temp_array = array();
2504 2504
 		
2505
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2505
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2506 2506
 		{
2507 2507
 			$temp_array['airline_icao'] = $row['airline_icao'];
2508 2508
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -2522,8 +2522,8 @@  discard block
 block discarded – undo
2522 2522
 	*/
2523 2523
 	public function getAllAirlineCountries($filters = array())
2524 2524
 	{
2525
-		$filter_query = $this->getFilter($filters,true,true);
2526
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2525
+		$filter_query = $this->getFilter($filters, true, true);
2526
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2527 2527
 				FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2528 2528
 				ORDER BY spotter_output.airline_country ASC";
2529 2529
 		
@@ -2534,7 +2534,7 @@  discard block
 block discarded – undo
2534 2534
 		$airline_array = array();
2535 2535
 		$temp_array = array();
2536 2536
 		
2537
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2537
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2538 2538
 		{
2539 2539
 			$temp_array['airline_country'] = $row['airline_country'];
2540 2540
 
@@ -2554,9 +2554,9 @@  discard block
 block discarded – undo
2554 2554
 	*/
2555 2555
 	public function getAllAirportNames($filters = array())
2556 2556
 	{
2557
-		$filter_query = $this->getFilter($filters,true,true);
2557
+		$filter_query = $this->getFilter($filters, true, true);
2558 2558
 		$airport_array = array();
2559
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country
2559
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country
2560 2560
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' 
2561 2561
 				ORDER BY spotter_output.departure_airport_city ASC";
2562 2562
 		
@@ -2565,7 +2565,7 @@  discard block
 block discarded – undo
2565 2565
 		$sth->execute();
2566 2566
 
2567 2567
 		$temp_array = array();
2568
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2568
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2569 2569
 		{
2570 2570
 			$temp_array['airport_icao'] = $row['airport_icao'];
2571 2571
 			$temp_array['airport_name'] = $row['airport_name'];
@@ -2575,14 +2575,14 @@  discard block
 block discarded – undo
2575 2575
 			$airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array;
2576 2576
 		}
2577 2577
 
2578
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country
2578
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country
2579 2579
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' 
2580 2580
 								ORDER BY spotter_output.arrival_airport_city ASC";
2581 2581
 					
2582 2582
 		$sth = $this->db->prepare($query);
2583 2583
 		$sth->execute();
2584 2584
 
2585
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2585
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2586 2586
 			{
2587 2587
 		//	if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao'])
2588 2588
 		//	{
@@ -2622,21 +2622,21 @@  discard block
 block discarded – undo
2622 2622
    
2623 2623
 		$temp_array = array();
2624 2624
 		
2625
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2625
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2626 2626
 		{
2627 2627
 			$temp_array['airport_country'] = $row['airport_country'];
2628 2628
 
2629 2629
 			$airport_array[$row['airport_country']] = $temp_array;
2630 2630
 		}
2631
-		$filter_query = $this->getFilter($filters,true,true);
2632
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2631
+		$filter_query = $this->getFilter($filters, true, true);
2632
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2633 2633
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2634 2634
 								ORDER BY spotter_output.arrival_airport_country ASC";
2635 2635
 					
2636 2636
 		$sth = $this->db->prepare($query);
2637 2637
 		$sth->execute();
2638 2638
 		
2639
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2639
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2640 2640
 		{
2641 2641
 			if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country'])
2642 2642
 			{
@@ -2659,9 +2659,9 @@  discard block
 block discarded – undo
2659 2659
 	*/
2660 2660
 	public function getAllCountries($filters = array())
2661 2661
 	{
2662
-		$Connection= new Connection($this->db);
2662
+		$Connection = new Connection($this->db);
2663 2663
 		if ($Connection->tableExists('countries')) {
2664
-			$query  = "SELECT countries.name AS airport_country
2664
+			$query = "SELECT countries.name AS airport_country
2665 2665
 				FROM countries
2666 2666
 				ORDER BY countries.name ASC";
2667 2667
 			$sth = $this->db->prepare($query);
@@ -2670,14 +2670,14 @@  discard block
 block discarded – undo
2670 2670
 			$temp_array = array();
2671 2671
 			$country_array = array();
2672 2672
 		
2673
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2673
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2674 2674
 			{
2675 2675
 				$temp_array['country'] = $row['airport_country'];
2676 2676
 				$country_array[$row['airport_country']] = $temp_array;
2677 2677
 			}
2678 2678
 		} else {
2679
-			$filter_query = $this->getFilter($filters,true,true);
2680
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2679
+			$filter_query = $this->getFilter($filters, true, true);
2680
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2681 2681
 								FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' 
2682 2682
 								ORDER BY spotter_output.departure_airport_country ASC";
2683 2683
 
@@ -2686,20 +2686,20 @@  discard block
 block discarded – undo
2686 2686
    
2687 2687
 			$temp_array = array();
2688 2688
 			$country_array = array();
2689
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2689
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2690 2690
 			{
2691 2691
 				$temp_array['country'] = $row['airport_country'];
2692 2692
 				$country_array[$row['airport_country']] = $temp_array;
2693 2693
 			}
2694 2694
 
2695
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2695
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2696 2696
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2697 2697
 								ORDER BY spotter_output.arrival_airport_country ASC";
2698 2698
 					
2699 2699
 		$sth = $this->db->prepare($query);
2700 2700
 		$sth->execute();
2701 2701
 		
2702
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2702
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2703 2703
 		{
2704 2704
 			if ($country_array[$row['airport_country']]['country'] != $row['airport_country'])
2705 2705
 			{
@@ -2709,14 +2709,14 @@  discard block
 block discarded – undo
2709 2709
 			}
2710 2710
 		}
2711 2711
 		
2712
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2712
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2713 2713
 								FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2714 2714
 								ORDER BY spotter_output.airline_country ASC";
2715 2715
 					
2716 2716
 		$sth = $this->db->prepare($query);
2717 2717
 		$sth->execute();
2718 2718
 		
2719
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2719
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2720 2720
 		{
2721 2721
 			if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country'])
2722 2722
 			{
@@ -2740,8 +2740,8 @@  discard block
 block discarded – undo
2740 2740
 	*/
2741 2741
 	public function getAllIdents($filters = array())
2742 2742
 	{
2743
-		$filter_query = $this->getFilter($filters,true,true);
2744
-		$query  = "SELECT DISTINCT spotter_output.ident
2743
+		$filter_query = $this->getFilter($filters, true, true);
2744
+		$query = "SELECT DISTINCT spotter_output.ident
2745 2745
 								FROM spotter_output".$filter_query." spotter_output.ident <> '' 
2746 2746
 								ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0";
2747 2747
 
@@ -2751,7 +2751,7 @@  discard block
 block discarded – undo
2751 2751
 		$ident_array = array();
2752 2752
 		$temp_array = array();
2753 2753
 		
2754
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2754
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2755 2755
 		{
2756 2756
 			$temp_array['ident'] = $row['ident'];
2757 2757
 			$ident_array[] = $temp_array;
@@ -2765,9 +2765,9 @@  discard block
 block discarded – undo
2765 2765
 	* @return Array number, icao, name and city of airports
2766 2766
 	*/
2767 2767
 
2768
-	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
2768
+	public function getLast7DaysAirportsDeparture($airport_icao = '', $filters = array()) {
2769 2769
 		global $globalTimezone, $globalDBdriver;
2770
-		$filter_query = $this->getFilter($filters,true,true);
2770
+		$filter_query = $this->getFilter($filters, true, true);
2771 2771
 		if ($globalTimezone != '') {
2772 2772
 			date_default_timezone_set($globalTimezone);
2773 2773
 			$datetime = new DateTime();
@@ -2832,7 +2832,7 @@  discard block
 block discarded – undo
2832 2832
 
2833 2833
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
2834 2834
 		global $globalTimezone, $globalDBdriver;
2835
-		$filter_query = $this->getFilter($filters,true,true);
2835
+		$filter_query = $this->getFilter($filters, true, true);
2836 2836
 		if ($globalTimezone != '') {
2837 2837
 			date_default_timezone_set($globalTimezone);
2838 2838
 			$datetime = new DateTime();
@@ -2916,7 +2916,7 @@  discard block
 block discarded – undo
2916 2916
 
2917 2917
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
2918 2918
 		global $globalTimezone, $globalDBdriver;
2919
-		$filter_query = $this->getFilter($filters,true,true);
2919
+		$filter_query = $this->getFilter($filters, true, true);
2920 2920
 		if ($globalTimezone != '') {
2921 2921
 			date_default_timezone_set($globalTimezone);
2922 2922
 			$datetime = new DateTime();
@@ -2949,9 +2949,9 @@  discard block
 block discarded – undo
2949 2949
 	* @return Array number, icao, name and city of airports
2950 2950
 	*/
2951 2951
 
2952
-	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
2952
+	public function getLast7DaysDetectedAirportsArrival($airport_icao = '', $filters = array()) {
2953 2953
 		global $globalTimezone, $globalDBdriver;
2954
-		$filter_query = $this->getFilter($filters,true,true);
2954
+		$filter_query = $this->getFilter($filters, true, true);
2955 2955
 		if ($globalTimezone != '') {
2956 2956
 			date_default_timezone_set($globalTimezone);
2957 2957
 			$datetime = new DateTime();
@@ -3083,12 +3083,12 @@  discard block
 block discarded – undo
3083 3083
 		} else $offset = '+00:00';
3084 3084
 
3085 3085
 		if ($globalDBdriver == 'mysql') {
3086
-			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3086
+			$query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3087 3087
 								FROM spotter_output
3088 3088
 								WHERE spotter_output.date <> '' 
3089 3089
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
3090 3090
 		} else {
3091
-			$query  = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3091
+			$query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3092 3092
 								FROM spotter_output
3093 3093
 								WHERE spotter_output.date <> '' 
3094 3094
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
@@ -3100,7 +3100,7 @@  discard block
 block discarded – undo
3100 3100
 		$date_array = array();
3101 3101
 		$temp_array = array();
3102 3102
 		
3103
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3103
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3104 3104
 		{
3105 3105
 			$temp_array['date'] = $row['date'];
3106 3106
 
@@ -3120,7 +3120,7 @@  discard block
 block discarded – undo
3120 3120
 	*/
3121 3121
 	public function getAllRoutes()
3122 3122
 	{
3123
-		$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 
3123
+		$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 
3124 3124
 				FROM spotter_output
3125 3125
 				WHERE spotter_output.ident <> '' 
3126 3126
 				GROUP BY route
@@ -3131,7 +3131,7 @@  discard block
 block discarded – undo
3131 3131
 
3132 3132
 		$routes_array = array();
3133 3133
 		$temp_array = array();
3134
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3134
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3135 3135
 		{
3136 3136
 			$temp_array['route'] = $row['route'];
3137 3137
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -3150,21 +3150,21 @@  discard block
 block discarded – undo
3150 3150
 	* @return String success or false
3151 3151
 	*
3152 3152
 	*/	
3153
-	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3153
+	public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL)
3154 3154
 	{
3155 3155
 		if (!is_numeric(substr($ident, 0, 3)))
3156 3156
 		{
3157 3157
 			if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3158
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3158
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3159 3159
 			} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3160
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3160
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3161 3161
 			} else {
3162 3162
 				$airline_array = $this->getAllAirlineInfo("NA");
3163 3163
 			}
3164 3164
 			if (count($airline_array) == 0) {
3165 3165
 				$airline_array = $this->getAllAirlineInfo("NA");
3166 3166
 			}
3167
-			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3167
+			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3168 3168
 				$airline_array = $this->getAllAirlineInfo("NA");
3169 3169
 			}
3170 3170
 		} else {
@@ -3177,7 +3177,7 @@  discard block
 block discarded – undo
3177 3177
 
3178 3178
 
3179 3179
 		$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';
3180
-                $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);
3180
+                $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);
3181 3181
 
3182 3182
 		try {
3183 3183
 			$sth = $this->db->prepare($query);
@@ -3198,11 +3198,11 @@  discard block
 block discarded – undo
3198 3198
 	* @return String success or false
3199 3199
 	*
3200 3200
 	*/	
3201
-	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3201
+	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '')
3202 3202
 	{
3203 3203
 		if ($groundspeed == '') $groundspeed = NULL;
3204 3204
 		$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';
3205
-                $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);
3205
+                $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);
3206 3206
 
3207 3207
 		try {
3208 3208
 			$sth = $this->db->prepare($query);
@@ -3242,7 +3242,7 @@  discard block
 block discarded – undo
3242 3242
 	* @param String $verticalrate vertival rate of flight
3243 3243
 	* @return String success or false
3244 3244
 	*/
3245
-	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 = '')
3245
+	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 = '')
3246 3246
 	{
3247 3247
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
3248 3248
 		
@@ -3266,13 +3266,13 @@  discard block
 block discarded – undo
3266 3266
 				if ($ModeS != '') {
3267 3267
 					$timeelapsed = microtime(true);
3268 3268
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3269
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3269
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3270 3270
 				} else {
3271
-					$myhex = explode('-',$flightaware_id);
3271
+					$myhex = explode('-', $flightaware_id);
3272 3272
 					if (count($myhex) > 0) {
3273 3273
 						$timeelapsed = microtime(true);
3274 3274
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3275
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3275
+						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3276 3276
 					}
3277 3277
 				}
3278 3278
 			}
@@ -3294,24 +3294,24 @@  discard block
 block discarded – undo
3294 3294
 				{
3295 3295
 					$timeelapsed = microtime(true);
3296 3296
 					if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3297
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3297
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3298 3298
 					} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3299
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3299
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3300 3300
 					} else {
3301 3301
 						$airline_array = $this->getAllAirlineInfo("NA");
3302 3302
 					}
3303 3303
 					if (count($airline_array) == 0) {
3304 3304
 						$airline_array = $this->getAllAirlineInfo("NA");
3305 3305
 					}
3306
-					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3306
+					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3307 3307
 						$airline_array = $this->getAllAirlineInfo("NA");
3308 3308
 					}
3309
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3309
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3310 3310
 
3311 3311
 				} else {
3312 3312
 					$timeelapsed = microtime(true);
3313 3313
 					$airline_array = $this->getAllAirlineInfo("NA");
3314
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3314
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3315 3315
 				}
3316 3316
 			}
3317 3317
 		} else $airline_array = array();
@@ -3328,27 +3328,27 @@  discard block
 block discarded – undo
3328 3328
 				{
3329 3329
 					$timeelapsed = microtime(true);
3330 3330
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3331
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3331
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3332 3332
 				} else {
3333 3333
 					$timeelapsed = microtime(true);
3334 3334
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3335
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3335
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3336 3336
 				}
3337 3337
 			}
3338 3338
 		} else {
3339 3339
 			if ($ModeS != '') {
3340 3340
 				$timeelapsed = microtime(true);
3341 3341
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3342
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3342
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3343 3343
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3344 3344
 				{
3345 3345
 					$timeelapsed = microtime(true);
3346 3346
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3347
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3347
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3348 3348
 				} else {
3349 3349
 					$timeelapsed = microtime(true);
3350 3350
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3351
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3351
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3352 3352
 				}
3353 3353
 			}
3354 3354
 		}
@@ -3363,7 +3363,7 @@  discard block
 block discarded – undo
3363 3363
 			} else {
3364 3364
 				$timeelapsed = microtime(true);
3365 3365
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3366
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3366
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3367 3367
 			}
3368 3368
 		}
3369 3369
 		
@@ -3377,7 +3377,7 @@  discard block
 block discarded – undo
3377 3377
 			} else {
3378 3378
 				$timeelapsed = microtime(true);
3379 3379
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3380
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3380
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3381 3381
 			}
3382 3382
 		}
3383 3383
 
@@ -3441,7 +3441,7 @@  discard block
 block discarded – undo
3441 3441
 		{
3442 3442
 			$timeelapsed = microtime(true);
3443 3443
 			$image_array = $Image->getSpotterImage($registration);
3444
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3444
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3445 3445
 			if (!isset($image_array[0]['registration']))
3446 3446
 			{
3447 3447
 				//echo "Add image !!!! \n";
@@ -3449,7 +3449,7 @@  discard block
 block discarded – undo
3449 3449
 			}
3450 3450
 			$timeelapsed = microtime(true);
3451 3451
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3452
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3452
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3453 3453
 			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3454 3454
 		}
3455 3455
     
@@ -3457,33 +3457,33 @@  discard block
 block discarded – undo
3457 3457
 		{
3458 3458
             		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3459 3459
             		else $airline_icao = '';
3460
-			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3460
+			$image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao);
3461 3461
 			if (!isset($image_array[0]['registration']))
3462 3462
 			{
3463 3463
 				//echo "Add image !!!! \n";
3464
-				$Image->addSpotterImage('',$aircraft_icao,$airline_icao);
3464
+				$Image->addSpotterImage('', $aircraft_icao, $airline_icao);
3465 3465
 			}
3466 3466
 		}
3467 3467
     
3468
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
3469
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
3470
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
3471
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3472
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
3473
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
3474
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3475
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3476
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
3477
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3478
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
3479
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3480
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
3481
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
3482
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
3483
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
3484
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
3485
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
3486
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
3468
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
3469
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
3470
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
3471
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3472
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
3473
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
3474
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3475
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3476
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
3477
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3478
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
3479
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3480
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
3481
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
3482
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
3483
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
3484
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
3485
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
3486
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
3487 3487
 	
3488 3488
 		if (count($airline_array) == 0) 
3489 3489
 		{
@@ -3511,7 +3511,7 @@  discard block
 block discarded – undo
3511 3511
                 if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3512 3512
                 if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3513 3513
                 if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3514
-                $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) 
3514
+                $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) 
3515 3515
                 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)";
3516 3516
 
3517 3517
                 $airline_name = $airline_array[0]['name'];
@@ -3521,7 +3521,7 @@  discard block
 block discarded – undo
3521 3521
 		if ($airline_type == '') {
3522 3522
 			$timeelapsed = microtime(true);
3523 3523
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3524
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3524
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3525 3525
 		}
3526 3526
 		if ($airline_type == null) $airline_type = '';
3527 3527
                 $aircraft_type = $aircraft_array[0]['type'];
@@ -3532,7 +3532,7 @@  discard block
 block discarded – undo
3532 3532
                 $arrival_airport_name = $arrival_airport_array[0]['name'];
3533 3533
                 $arrival_airport_city = $arrival_airport_array[0]['city'];
3534 3534
                 $arrival_airport_country = $arrival_airport_array[0]['country'];
3535
-                $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);
3535
+                $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);
3536 3536
 
3537 3537
 		try {
3538 3538
 		        
@@ -3558,13 +3558,13 @@  discard block
 block discarded – undo
3558 3558
 	{
3559 3559
 		global $globalDBdriver, $globalTimezone;
3560 3560
 		if ($globalDBdriver == 'mysql') {
3561
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3561
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3562 3562
 								WHERE spotter_output.ident = :ident 
3563 3563
 								AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
3564 3564
 								AND spotter_output.date < UTC_TIMESTAMP()";
3565 3565
 			$query_data = array(':ident' => $ident);
3566 3566
 		} else {
3567
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3567
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3568 3568
 								WHERE spotter_output.ident = :ident 
3569 3569
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3570 3570
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
@@ -3573,8 +3573,8 @@  discard block
 block discarded – undo
3573 3573
 		
3574 3574
 		$sth = $this->db->prepare($query);
3575 3575
 		$sth->execute($query_data);
3576
-    		$ident_result='';
3577
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3576
+    		$ident_result = '';
3577
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3578 3578
 		{
3579 3579
 			$ident_result = $row['ident'];
3580 3580
 		}
@@ -3600,8 +3600,8 @@  discard block
 block discarded – undo
3600 3600
 				return false;
3601 3601
 			} else {
3602 3602
 				$q_array = explode(" ", $q);
3603
-				foreach ($q_array as $q_item){
3604
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
3603
+				foreach ($q_array as $q_item) {
3604
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
3605 3605
 					$additional_query .= " AND (";
3606 3606
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
3607 3607
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
@@ -3616,11 +3616,11 @@  discard block
 block discarded – undo
3616 3616
 			}
3617 3617
 		}
3618 3618
 		if ($globalDBdriver == 'mysql') {
3619
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3619
+			$query = "SELECT spotter_output.* FROM spotter_output 
3620 3620
 				WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
3621 3621
 				AND spotter_output.date < UTC_TIMESTAMP()";
3622 3622
 		} else {
3623
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3623
+			$query = "SELECT spotter_output.* FROM spotter_output 
3624 3624
 				WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
3625 3625
 				AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
3626 3626
 		}
@@ -3637,11 +3637,11 @@  discard block
 block discarded – undo
3637 3637
 	* @return Array the airline list
3638 3638
 	*
3639 3639
 	*/
3640
-	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3640
+	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3641 3641
 	{
3642 3642
 		global $globalDBdriver;
3643
-		$filter_query = $this->getFilter($filters,true,true);
3644
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3643
+		$filter_query = $this->getFilter($filters, true, true);
3644
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3645 3645
 		 			FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA' ";
3646 3646
 		if ($olderthanmonths > 0) {
3647 3647
 			if ($globalDBdriver == 'mysql') {
@@ -3665,7 +3665,7 @@  discard block
 block discarded – undo
3665 3665
  
3666 3666
 		$airline_array = array();
3667 3667
 		$temp_array = array();
3668
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3668
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3669 3669
 		{
3670 3670
 			$temp_array['airline_name'] = $row['airline_name'];
3671 3671
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3682,11 +3682,11 @@  discard block
 block discarded – undo
3682 3682
 	* @return Array the pilots list
3683 3683
 	*
3684 3684
 	*/
3685
-	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3685
+	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3686 3686
 	{
3687 3687
 		global $globalDBdriver;
3688
-		$filter_query = $this->getFilter($filters,true,true);
3689
-		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3688
+		$filter_query = $this->getFilter($filters, true, true);
3689
+		$query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3690 3690
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3691 3691
                 if ($olderthanmonths > 0) {
3692 3692
             		if ($globalDBdriver == 'mysql') {
@@ -3712,7 +3712,7 @@  discard block
 block discarded – undo
3712 3712
 		$airline_array = array();
3713 3713
 		$temp_array = array();
3714 3714
         
3715
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3715
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3716 3716
 		{
3717 3717
 			$temp_array['pilot_name'] = $row['pilot_name'];
3718 3718
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -3732,7 +3732,7 @@  discard block
 block discarded – undo
3732 3732
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3733 3733
 	{
3734 3734
 		global $globalDBdriver;
3735
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3735
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
3736 3736
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
3737 3737
                 if ($olderthanmonths > 0) {
3738 3738
             		if ($globalDBdriver == 'mysql') {
@@ -3758,7 +3758,7 @@  discard block
 block discarded – undo
3758 3758
 		$airline_array = array();
3759 3759
 		$temp_array = array();
3760 3760
         
3761
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3761
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3762 3762
 		{
3763 3763
 			$temp_array['pilot_name'] = $row['pilot_name'];
3764 3764
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -3776,11 +3776,11 @@  discard block
 block discarded – undo
3776 3776
 	* @return Array the pilots list
3777 3777
 	*
3778 3778
 	*/
3779
-	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3779
+	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3780 3780
 	{
3781 3781
 		global $globalDBdriver;
3782
-		$filter_query = $this->getFilter($filters,true,true);
3783
-		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3782
+		$filter_query = $this->getFilter($filters, true, true);
3783
+		$query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3784 3784
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3785 3785
                 if ($olderthanmonths > 0) {
3786 3786
             		if ($globalDBdriver == 'mysql') {
@@ -3806,7 +3806,7 @@  discard block
 block discarded – undo
3806 3806
 		$airline_array = array();
3807 3807
 		$temp_array = array();
3808 3808
         
3809
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3809
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3810 3810
 		{
3811 3811
 			$temp_array['owner_name'] = $row['owner_name'];
3812 3812
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -3821,11 +3821,11 @@  discard block
 block discarded – undo
3821 3821
 	* @return Array the pilots list
3822 3822
 	*
3823 3823
 	*/
3824
-	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3824
+	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3825 3825
 	{
3826 3826
 		global $globalDBdriver;
3827
-		$filter_query = $this->getFilter($filters,true,true);
3828
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3827
+		$filter_query = $this->getFilter($filters, true, true);
3828
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3829 3829
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3830 3830
                 if ($olderthanmonths > 0) {
3831 3831
             		if ($globalDBdriver == 'mysql') {
@@ -3851,7 +3851,7 @@  discard block
 block discarded – undo
3851 3851
 		$airline_array = array();
3852 3852
 		$temp_array = array();
3853 3853
         
3854
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3854
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3855 3855
 		{
3856 3856
 			$temp_array['owner_name'] = $row['owner_name'];
3857 3857
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -3867,11 +3867,11 @@  discard block
 block discarded – undo
3867 3867
 	* @return Array the airline list
3868 3868
 	*
3869 3869
 	*/
3870
-	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
3870
+	public function countAllAirlinesByAircraft($aircraft_icao, $filters = array())
3871 3871
 	{
3872
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3873
-		$filter_query = $this->getFilter($filters,true,true);
3874
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3872
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3873
+		$filter_query = $this->getFilter($filters, true, true);
3874
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3875 3875
 		 	    FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
3876 3876
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
3877 3877
 			    ORDER BY airline_count DESC";
@@ -3883,7 +3883,7 @@  discard block
 block discarded – undo
3883 3883
 		$airline_array = array();
3884 3884
 		$temp_array = array();
3885 3885
         
3886
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3886
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3887 3887
 		{
3888 3888
 			$temp_array['airline_name'] = $row['airline_name'];
3889 3889
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3903,11 +3903,11 @@  discard block
 block discarded – undo
3903 3903
 	* @return Array the airline country list
3904 3904
 	*
3905 3905
 	*/
3906
-	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
3906
+	public function countAllAirlineCountriesByAircraft($aircraft_icao, $filters = array())
3907 3907
 	{
3908
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3909
-		$filter_query = $this->getFilter($filters,true,true);
3910
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3908
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3909
+		$filter_query = $this->getFilter($filters, true, true);
3910
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3911 3911
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
3912 3912
                     GROUP BY spotter_output.airline_country
3913 3913
 					ORDER BY airline_country_count DESC
@@ -3920,7 +3920,7 @@  discard block
 block discarded – undo
3920 3920
 		$airline_country_array = array();
3921 3921
 		$temp_array = array();
3922 3922
         
3923
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3923
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3924 3924
 		{
3925 3925
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
3926 3926
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -3939,11 +3939,11 @@  discard block
 block discarded – undo
3939 3939
 	* @return Array the airline list
3940 3940
 	*
3941 3941
 	*/
3942
-	public function countAllAirlinesByAirport($airport_icao,$filters = array())
3942
+	public function countAllAirlinesByAirport($airport_icao, $filters = array())
3943 3943
 	{
3944
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
3945
-		$filter_query = $this->getFilter($filters,true,true);
3946
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3944
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
3945
+		$filter_query = $this->getFilter($filters, true, true);
3946
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3947 3947
 		    FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao ) 
3948 3948
                     GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country
3949 3949
 		    ORDER BY airline_count DESC";
@@ -3955,7 +3955,7 @@  discard block
 block discarded – undo
3955 3955
 		$airline_array = array();
3956 3956
 		$temp_array = array();
3957 3957
         
3958
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3958
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3959 3959
 		{
3960 3960
 			$temp_array['airline_name'] = $row['airline_name'];
3961 3961
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3974,11 +3974,11 @@  discard block
 block discarded – undo
3974 3974
 	* @return Array the airline country list
3975 3975
 	*
3976 3976
 	*/
3977
-	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
3977
+	public function countAllAirlineCountriesByAirport($airport_icao, $filters = array())
3978 3978
 	{
3979
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
3980
-		$filter_query = $this->getFilter($filters,true,true);
3981
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3979
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
3980
+		$filter_query = $this->getFilter($filters, true, true);
3981
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3982 3982
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao )
3983 3983
 					GROUP BY spotter_output.airline_country
3984 3984
 					ORDER BY airline_country_count DESC
@@ -3991,7 +3991,7 @@  discard block
 block discarded – undo
3991 3991
 		$airline_country_array = array();
3992 3992
 		$temp_array = array();
3993 3993
         
3994
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3994
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3995 3995
 		{
3996 3996
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
3997 3997
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4008,11 +4008,11 @@  discard block
 block discarded – undo
4008 4008
 	* @return Array the airline list
4009 4009
 	*
4010 4010
 	*/
4011
-	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4011
+	public function countAllAirlinesByManufacturer($aircraft_manufacturer, $filters = array())
4012 4012
 	{
4013
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4014
-		$filter_query = $this->getFilter($filters,true,true);
4015
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4013
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4014
+		$filter_query = $this->getFilter($filters, true, true);
4015
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4016 4016
 		 			FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4017 4017
 					GROUP BY spotter_output.airline_name
4018 4018
 					ORDER BY airline_count DESC";
@@ -4023,7 +4023,7 @@  discard block
 block discarded – undo
4023 4023
 		$airline_array = array();
4024 4024
 		$temp_array = array();
4025 4025
         
4026
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4026
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4027 4027
 		{
4028 4028
 			$temp_array['airline_name'] = $row['airline_name'];
4029 4029
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4043,11 +4043,11 @@  discard block
 block discarded – undo
4043 4043
 	* @return Array the airline country list
4044 4044
 	*
4045 4045
 	*/
4046
-	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4046
+	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer, $filters = array())
4047 4047
 	{
4048
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4049
-		$filter_query = $this->getFilter($filters,true,true);
4050
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4048
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4049
+		$filter_query = $this->getFilter($filters, true, true);
4050
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4051 4051
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4052 4052
 					GROUP BY spotter_output.airline_country
4053 4053
 					ORDER BY airline_country_count DESC
@@ -4060,7 +4060,7 @@  discard block
 block discarded – undo
4060 4060
 		$airline_country_array = array();
4061 4061
 		$temp_array = array();
4062 4062
         
4063
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4063
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4064 4064
 		{
4065 4065
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4066 4066
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4076,11 +4076,11 @@  discard block
 block discarded – undo
4076 4076
 	* @return Array the airline list
4077 4077
 	*
4078 4078
 	*/
4079
-	public function countAllAirlinesByDate($date,$filters = array())
4079
+	public function countAllAirlinesByDate($date, $filters = array())
4080 4080
 	{
4081 4081
 		global $globalTimezone, $globalDBdriver;
4082
-		$filter_query = $this->getFilter($filters,true,true);
4083
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4082
+		$filter_query = $this->getFilter($filters, true, true);
4083
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4084 4084
 		if ($globalTimezone != '') {
4085 4085
 			date_default_timezone_set($globalTimezone);
4086 4086
 			$datetime = new DateTime($date);
@@ -4088,12 +4088,12 @@  discard block
 block discarded – undo
4088 4088
 		} else $offset = '+00:00';
4089 4089
 
4090 4090
 		if ($globalDBdriver == 'mysql') {
4091
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4091
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4092 4092
 		 			FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4093 4093
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country 
4094 4094
 					ORDER BY airline_count DESC";
4095 4095
 		} else {
4096
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4096
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4097 4097
 		 			FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4098 4098
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country
4099 4099
 					ORDER BY airline_count DESC";
@@ -4104,7 +4104,7 @@  discard block
 block discarded – undo
4104 4104
 
4105 4105
 		$airline_array = array();
4106 4106
 		$temp_array = array();
4107
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4107
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4108 4108
 		{
4109 4109
 			$temp_array['airline_name'] = $row['airline_name'];
4110 4110
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4124,11 +4124,11 @@  discard block
 block discarded – undo
4124 4124
 	* @return Array the airline country list
4125 4125
 	*
4126 4126
 	*/
4127
-	public function countAllAirlineCountriesByDate($date,$filters = array())
4127
+	public function countAllAirlineCountriesByDate($date, $filters = array())
4128 4128
 	{
4129 4129
 		global $globalTimezone, $globalDBdriver;
4130
-		$filter_query = $this->getFilter($filters,true,true);
4131
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4130
+		$filter_query = $this->getFilter($filters, true, true);
4131
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4132 4132
 		if ($globalTimezone != '') {
4133 4133
 			date_default_timezone_set($globalTimezone);
4134 4134
 			$datetime = new DateTime($date);
@@ -4136,13 +4136,13 @@  discard block
 block discarded – undo
4136 4136
 		} else $offset = '+00:00';
4137 4137
 		
4138 4138
 		if ($globalDBdriver == 'mysql') {
4139
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4139
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4140 4140
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4141 4141
 					GROUP BY spotter_output.airline_country
4142 4142
 					ORDER BY airline_country_count DESC
4143 4143
 					LIMIT 10 OFFSET 0";
4144 4144
 		} else {
4145
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4145
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4146 4146
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4147 4147
 					GROUP BY spotter_output.airline_country
4148 4148
 					ORDER BY airline_country_count DESC
@@ -4154,7 +4154,7 @@  discard block
 block discarded – undo
4154 4154
  
4155 4155
 		$airline_country_array = array();
4156 4156
 		$temp_array = array();
4157
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4157
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4158 4158
 		{
4159 4159
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4160 4160
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4171,11 +4171,11 @@  discard block
 block discarded – undo
4171 4171
 	* @return Array the airline list
4172 4172
 	*
4173 4173
 	*/
4174
-	public function countAllAirlinesByIdent($ident,$filters = array())
4174
+	public function countAllAirlinesByIdent($ident, $filters = array())
4175 4175
 	{
4176
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4177
-		$filter_query = $this->getFilter($filters,true,true);
4178
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4176
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4177
+		$filter_query = $this->getFilter($filters, true, true);
4178
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4179 4179
 		 		FROM spotter_output".$filter_query." spotter_output.ident = :ident  
4180 4180
 				GROUP BY spotter_output.airline_name
4181 4181
 				ORDER BY airline_count DESC";
@@ -4187,7 +4187,7 @@  discard block
 block discarded – undo
4187 4187
 		$airline_array = array();
4188 4188
 		$temp_array = array();
4189 4189
         
4190
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4190
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4191 4191
 		{
4192 4192
 			$temp_array['airline_name'] = $row['airline_name'];
4193 4193
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4205,25 +4205,25 @@  discard block
 block discarded – undo
4205 4205
 	* @return Array the airline list
4206 4206
 	*
4207 4207
 	*/
4208
-	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4208
+	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4209 4209
 	{
4210
-		$filter_query = $this->getFilter($filters,true,true);
4211
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4212
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4210
+		$filter_query = $this->getFilter($filters, true, true);
4211
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4212
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4213 4213
 
4214
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4214
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4215 4215
 		 			FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4216 4216
 					GROUP BY spotter_output.airline_name
4217 4217
 					ORDER BY airline_count DESC";
4218 4218
       
4219 4219
 		
4220 4220
 		$sth = $this->db->prepare($query);
4221
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4221
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4222 4222
       
4223 4223
 		$airline_array = array();
4224 4224
 		$temp_array = array();
4225 4225
         
4226
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4226
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4227 4227
 		{
4228 4228
 			$temp_array['airline_name'] = $row['airline_name'];
4229 4229
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4241,13 +4241,13 @@  discard block
 block discarded – undo
4241 4241
 	* @return Array the airline country list
4242 4242
 	*
4243 4243
 	*/
4244
-	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4244
+	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4245 4245
 	{
4246
-		$filter_query = $this->getFilter($filters,true,true);
4247
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4248
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4246
+		$filter_query = $this->getFilter($filters, true, true);
4247
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4248
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4249 4249
       
4250
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4250
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4251 4251
 		 		FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4252 4252
 				GROUP BY spotter_output.airline_country
4253 4253
 				ORDER BY airline_country_count DESC
@@ -4255,11 +4255,11 @@  discard block
 block discarded – undo
4255 4255
       
4256 4256
 		
4257 4257
 		$sth = $this->db->prepare($query);
4258
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4258
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4259 4259
       
4260 4260
 		$airline_country_array = array();
4261 4261
 		$temp_array = array();
4262
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4262
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4263 4263
 		{
4264 4264
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4265 4265
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4277,11 +4277,11 @@  discard block
 block discarded – undo
4277 4277
 	* @return Array the airline list
4278 4278
 	*
4279 4279
 	*/
4280
-	public function countAllAirlinesByCountry($country,$filters = array())
4280
+	public function countAllAirlinesByCountry($country, $filters = array())
4281 4281
 	{
4282
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4283
-		$filter_query = $this->getFilter($filters,true,true);
4284
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4282
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4283
+		$filter_query = $this->getFilter($filters, true, true);
4284
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4285 4285
 		 	    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
4286 4286
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4287 4287
 			    ORDER BY airline_count DESC";
@@ -4292,7 +4292,7 @@  discard block
 block discarded – undo
4292 4292
 
4293 4293
 		$airline_array = array();
4294 4294
 		$temp_array = array();
4295
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4295
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4296 4296
 		{
4297 4297
 			$temp_array['airline_name'] = $row['airline_name'];
4298 4298
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4311,11 +4311,11 @@  discard block
 block discarded – undo
4311 4311
 	* @return Array the airline country list
4312 4312
 	*
4313 4313
 	*/
4314
-	public function countAllAirlineCountriesByCountry($country,$filters = array())
4314
+	public function countAllAirlineCountriesByCountry($country, $filters = array())
4315 4315
 	{
4316
-		$filter_query = $this->getFilter($filters,true,true);
4317
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4318
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4316
+		$filter_query = $this->getFilter($filters, true, true);
4317
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4318
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4319 4319
 		 		FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
4320 4320
 				GROUP BY spotter_output.airline_country
4321 4321
 				ORDER BY airline_country_count DESC
@@ -4327,7 +4327,7 @@  discard block
 block discarded – undo
4327 4327
 
4328 4328
 		$airline_country_array = array();
4329 4329
 		$temp_array = array();
4330
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4330
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4331 4331
 		{
4332 4332
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4333 4333
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4346,8 +4346,8 @@  discard block
 block discarded – undo
4346 4346
 	*/
4347 4347
 	public function countAllAirlineCountries($limit = true, $filters = array())
4348 4348
 	{
4349
-		$filter_query = $this->getFilter($filters,true,true);
4350
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4349
+		$filter_query = $this->getFilter($filters, true, true);
4350
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4351 4351
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' 
4352 4352
 					GROUP BY spotter_output.airline_country
4353 4353
 					ORDER BY airline_country_count DESC";
@@ -4358,7 +4358,7 @@  discard block
 block discarded – undo
4358 4358
 
4359 4359
 		$airline_array = array();
4360 4360
 		$temp_array = array();
4361
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4361
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4362 4362
 		{
4363 4363
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4364 4364
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4374,11 +4374,11 @@  discard block
 block discarded – undo
4374 4374
 	* @return Array the airline country list
4375 4375
 	*
4376 4376
 	*/
4377
-	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
4377
+	public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '')
4378 4378
 	{
4379 4379
 		global $globalDBdriver;
4380 4380
 		//$filter_query = $this->getFilter($filters,true,true);
4381
-		$Connection= new Connection($this->db);
4381
+		$Connection = new Connection($this->db);
4382 4382
 		if (!$Connection->tableExists('countries')) return array();
4383 4383
 		/*
4384 4384
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -4413,7 +4413,7 @@  discard block
 block discarded – undo
4413 4413
 		$flight_array = array();
4414 4414
 		$temp_array = array();
4415 4415
         
4416
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4416
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4417 4417
 		{
4418 4418
 			$temp_array['flight_count'] = $row['nb'];
4419 4419
 			$temp_array['flight_country'] = $row['name'];
@@ -4431,12 +4431,12 @@  discard block
 block discarded – undo
4431 4431
 	* @return Array the aircraft list
4432 4432
 	*
4433 4433
 	*/
4434
-	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4434
+	public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4435 4435
 	{
4436 4436
 		global $globalDBdriver;
4437
-		$filter_query = $this->getFilter($filters,true,true);
4437
+		$filter_query = $this->getFilter($filters, true, true);
4438 4438
 
4439
-		$query  = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4439
+		$query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4440 4440
 		    FROM spotter_output ".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> ''";
4441 4441
 		if ($olderthanmonths > 0) {
4442 4442
 			if ($globalDBdriver == 'mysql') {
@@ -4461,7 +4461,7 @@  discard block
 block discarded – undo
4461 4461
 
4462 4462
 		$aircraft_array = array();
4463 4463
 		$temp_array = array();
4464
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4464
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4465 4465
 		{
4466 4466
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4467 4467
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4478,11 +4478,11 @@  discard block
 block discarded – undo
4478 4478
 	* @return Array the aircraft list
4479 4479
 	*
4480 4480
 	*/
4481
-	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4481
+	public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4482 4482
 	{
4483 4483
 		global $globalDBdriver;
4484
-		$filter_query = $this->getFilter($filters,true,true);
4485
-		$query  = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4484
+		$filter_query = $this->getFilter($filters, true, true);
4485
+		$query = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4486 4486
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA' ";
4487 4487
 		if ($olderthanmonths > 0) {
4488 4488
 			if ($globalDBdriver == 'mysql') {
@@ -4507,7 +4507,7 @@  discard block
 block discarded – undo
4507 4507
 
4508 4508
 		$aircraft_array = array();
4509 4509
 		$temp_array = array();
4510
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4510
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4511 4511
 		{
4512 4512
 			$temp_array['airline_icao'] = $row['airline_icao'];
4513 4513
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -4526,13 +4526,13 @@  discard block
 block discarded – undo
4526 4526
 	* @return Array the aircraft list
4527 4527
 	*
4528 4528
 	*/
4529
-	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
4529
+	public function countAllAircraftRegistrationByAircraft($aircraft_icao, $filters = array())
4530 4530
 	{
4531 4531
 		$Image = new Image($this->db);
4532
-		$filter_query = $this->getFilter($filters,true,true);
4533
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4532
+		$filter_query = $this->getFilter($filters, true, true);
4533
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4534 4534
 
4535
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4535
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4536 4536
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao  
4537 4537
 				GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4538 4538
 				ORDER BY registration_count DESC";
@@ -4543,14 +4543,14 @@  discard block
 block discarded – undo
4543 4543
 		$aircraft_array = array();
4544 4544
 		$temp_array = array();
4545 4545
         
4546
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4546
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4547 4547
 		{
4548 4548
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4549 4549
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4550 4550
 			$temp_array['registration'] = $row['registration'];
4551 4551
 			$temp_array['airline_name'] = $row['airline_name'];
4552 4552
 			$temp_array['image_thumbnail'] = "";
4553
-			if($row['registration'] != "")
4553
+			if ($row['registration'] != "")
4554 4554
 			{
4555 4555
 				$image_array = $Image->getSpotterImage($row['registration']);
4556 4556
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4569,11 +4569,11 @@  discard block
 block discarded – undo
4569 4569
 	* @return Array the aircraft list
4570 4570
 	*
4571 4571
 	*/
4572
-	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
4572
+	public function countAllAircraftTypesByAirline($airline_icao, $filters = array())
4573 4573
 	{
4574
-		$filter_query = $this->getFilter($filters,true,true);
4575
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4576
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4574
+		$filter_query = $this->getFilter($filters, true, true);
4575
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4576
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4577 4577
 			    FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao 
4578 4578
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
4579 4579
 			    ORDER BY aircraft_icao_count DESC";
@@ -4584,7 +4584,7 @@  discard block
 block discarded – undo
4584 4584
 		$aircraft_array = array();
4585 4585
 		$temp_array = array();
4586 4586
 
4587
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4587
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4588 4588
 		{
4589 4589
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4590 4590
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4602,13 +4602,13 @@  discard block
 block discarded – undo
4602 4602
 	* @return Array the aircraft list
4603 4603
 	*
4604 4604
 	*/
4605
-	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
4605
+	public function countAllAircraftRegistrationByAirline($airline_icao, $filters = array())
4606 4606
 	{
4607
-		$filter_query = $this->getFilter($filters,true,true);
4607
+		$filter_query = $this->getFilter($filters, true, true);
4608 4608
 		$Image = new Image($this->db);
4609
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4609
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4610 4610
 
4611
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
4611
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
4612 4612
 			    FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao 
4613 4613
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
4614 4614
 			    ORDER BY registration_count DESC";
@@ -4618,14 +4618,14 @@  discard block
 block discarded – undo
4618 4618
 
4619 4619
 		$aircraft_array = array();
4620 4620
 		$temp_array = array();
4621
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4621
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4622 4622
 		{
4623 4623
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4624 4624
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4625 4625
 			$temp_array['registration'] = $row['registration'];
4626 4626
 			$temp_array['airline_name'] = $row['airline_name'];
4627 4627
 			$temp_array['image_thumbnail'] = "";
4628
-			if($row['registration'] != "")
4628
+			if ($row['registration'] != "")
4629 4629
 			{
4630 4630
 				$image_array = $Image->getSpotterImage($row['registration']);
4631 4631
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4644,11 +4644,11 @@  discard block
 block discarded – undo
4644 4644
 	* @return Array the aircraft list
4645 4645
 	*
4646 4646
 	*/
4647
-	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
4647
+	public function countAllAircraftManufacturerByAirline($airline_icao, $filters = array())
4648 4648
 	{
4649
-		$filter_query = $this->getFilter($filters,true,true);
4650
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4651
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4649
+		$filter_query = $this->getFilter($filters, true, true);
4650
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4651
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4652 4652
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao 
4653 4653
 				GROUP BY spotter_output.aircraft_manufacturer 
4654 4654
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -4659,7 +4659,7 @@  discard block
 block discarded – undo
4659 4659
 		$aircraft_array = array();
4660 4660
 		$temp_array = array();
4661 4661
 
4662
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4662
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4663 4663
 		{
4664 4664
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4665 4665
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4676,12 +4676,12 @@  discard block
 block discarded – undo
4676 4676
 	* @return Array the aircraft list
4677 4677
 	*
4678 4678
 	*/
4679
-	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
4679
+	public function countAllAircraftTypesByAirport($airport_icao, $filters = array())
4680 4680
 	{
4681
-		$filter_query = $this->getFilter($filters,true,true);
4682
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4681
+		$filter_query = $this->getFilter($filters, true, true);
4682
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4683 4683
 
4684
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4684
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4685 4685
 				FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) 
4686 4686
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
4687 4687
 				ORDER BY aircraft_icao_count DESC";
@@ -4691,7 +4691,7 @@  discard block
 block discarded – undo
4691 4691
 
4692 4692
 		$aircraft_array = array();
4693 4693
 		$temp_array = array();
4694
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4694
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4695 4695
 		{
4696 4696
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4697 4697
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4709,13 +4709,13 @@  discard block
 block discarded – undo
4709 4709
 	* @return Array the aircraft list
4710 4710
 	*
4711 4711
 	*/
4712
-	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
4712
+	public function countAllAircraftRegistrationByAirport($airport_icao, $filters = array())
4713 4713
 	{
4714
-		$filter_query = $this->getFilter($filters,true,true);
4714
+		$filter_query = $this->getFilter($filters, true, true);
4715 4715
 		$Image = new Image($this->db);
4716
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4716
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4717 4717
 
4718
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4718
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4719 4719
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)   
4720 4720
                     GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
4721 4721
 		    ORDER BY registration_count DESC";
@@ -4725,14 +4725,14 @@  discard block
 block discarded – undo
4725 4725
 
4726 4726
 		$aircraft_array = array();
4727 4727
 		$temp_array = array();
4728
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4728
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4729 4729
 		{
4730 4730
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4731 4731
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4732 4732
 			$temp_array['registration'] = $row['registration'];
4733 4733
 			$temp_array['airline_name'] = $row['airline_name'];
4734 4734
 			$temp_array['image_thumbnail'] = "";
4735
-			if($row['registration'] != "")
4735
+			if ($row['registration'] != "")
4736 4736
 			{
4737 4737
 				$image_array = $Image->getSpotterImage($row['registration']);
4738 4738
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4750,11 +4750,11 @@  discard block
 block discarded – undo
4750 4750
 	* @return Array the aircraft list
4751 4751
 	*
4752 4752
 	*/
4753
-	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
4753
+	public function countAllAircraftManufacturerByAirport($airport_icao, $filters = array())
4754 4754
 	{
4755
-		$filter_query = $this->getFilter($filters,true,true);
4756
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4757
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4755
+		$filter_query = $this->getFilter($filters, true, true);
4756
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4757
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4758 4758
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)  
4759 4759
                     GROUP BY spotter_output.aircraft_manufacturer 
4760 4760
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -4765,7 +4765,7 @@  discard block
 block discarded – undo
4765 4765
 
4766 4766
 		$aircraft_array = array();
4767 4767
 		$temp_array = array();
4768
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4768
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4769 4769
 		{
4770 4770
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4771 4771
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4780,12 +4780,12 @@  discard block
 block discarded – undo
4780 4780
 	* @return Array the aircraft list
4781 4781
 	*
4782 4782
 	*/
4783
-	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
4783
+	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer, $filters = array())
4784 4784
 	{
4785
-		$filter_query = $this->getFilter($filters,true,true);
4786
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4785
+		$filter_query = $this->getFilter($filters, true, true);
4786
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4787 4787
 
4788
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4788
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4789 4789
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
4790 4790
                     GROUP BY spotter_output.aircraft_name 
4791 4791
 					ORDER BY aircraft_icao_count DESC";
@@ -4794,7 +4794,7 @@  discard block
 block discarded – undo
4794 4794
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
4795 4795
 		$aircraft_array = array();
4796 4796
 		$temp_array = array();
4797
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4797
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4798 4798
 		{
4799 4799
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4800 4800
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4813,11 +4813,11 @@  discard block
 block discarded – undo
4813 4813
 	*/
4814 4814
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
4815 4815
 	{
4816
-		$filter_query = $this->getFilter($filters,true,true);
4816
+		$filter_query = $this->getFilter($filters, true, true);
4817 4817
 		$Image = new Image($this->db);
4818
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4818
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4819 4819
 
4820
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
4820
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
4821 4821
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
4822 4822
                     GROUP BY spotter_output.registration 
4823 4823
 					ORDER BY registration_count DESC";
@@ -4827,14 +4827,14 @@  discard block
 block discarded – undo
4827 4827
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
4828 4828
 		$aircraft_array = array();
4829 4829
 		$temp_array = array();
4830
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4830
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4831 4831
 		{
4832 4832
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4833 4833
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4834 4834
 			$temp_array['registration'] = $row['registration'];
4835 4835
 			$temp_array['airline_name'] = $row['airline_name'];
4836 4836
 			$temp_array['image_thumbnail'] = "";
4837
-			if($row['registration'] != "")
4837
+			if ($row['registration'] != "")
4838 4838
 			{
4839 4839
 				$image_array = $Image->getSpotterImage($row['registration']);
4840 4840
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4851,11 +4851,11 @@  discard block
 block discarded – undo
4851 4851
 	* @return Array the aircraft list
4852 4852
 	*
4853 4853
 	*/
4854
-	public function countAllAircraftTypesByDate($date,$filters = array())
4854
+	public function countAllAircraftTypesByDate($date, $filters = array())
4855 4855
 	{
4856 4856
 		global $globalTimezone, $globalDBdriver;
4857
-		$filter_query = $this->getFilter($filters,true,true);
4858
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4857
+		$filter_query = $this->getFilter($filters, true, true);
4858
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4859 4859
 		if ($globalTimezone != '') {
4860 4860
 			date_default_timezone_set($globalTimezone);
4861 4861
 			$datetime = new DateTime($date);
@@ -4863,12 +4863,12 @@  discard block
 block discarded – undo
4863 4863
 		} else $offset = '+00:00';
4864 4864
 
4865 4865
 		if ($globalDBdriver == 'mysql') {
4866
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4866
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4867 4867
 					FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
4868 4868
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
4869 4869
 					ORDER BY aircraft_icao_count DESC";
4870 4870
 		} else {
4871
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4871
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4872 4872
 					FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
4873 4873
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
4874 4874
 					ORDER BY aircraft_icao_count DESC";
@@ -4879,7 +4879,7 @@  discard block
 block discarded – undo
4879 4879
 
4880 4880
 		$aircraft_array = array();
4881 4881
 		$temp_array = array();
4882
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4882
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4883 4883
 		{
4884 4884
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4885 4885
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4897,12 +4897,12 @@  discard block
 block discarded – undo
4897 4897
 	* @return Array the aircraft list
4898 4898
 	*
4899 4899
 	*/
4900
-	public function countAllAircraftRegistrationByDate($date,$filters = array())
4900
+	public function countAllAircraftRegistrationByDate($date, $filters = array())
4901 4901
 	{
4902 4902
 		global $globalTimezone, $globalDBdriver;
4903
-		$filter_query = $this->getFilter($filters,true,true);
4903
+		$filter_query = $this->getFilter($filters, true, true);
4904 4904
 		$Image = new Image($this->db);
4905
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4905
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4906 4906
 		if ($globalTimezone != '') {
4907 4907
 			date_default_timezone_set($globalTimezone);
4908 4908
 			$datetime = new DateTime($date);
@@ -4910,12 +4910,12 @@  discard block
 block discarded – undo
4910 4910
 		} else $offset = '+00:00';
4911 4911
 
4912 4912
 		if ($globalDBdriver == 'mysql') {
4913
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
4913
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
4914 4914
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4915 4915
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
4916 4916
 					ORDER BY registration_count DESC";
4917 4917
 		} else {
4918
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name    
4918
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name    
4919 4919
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4920 4920
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
4921 4921
 					ORDER BY registration_count DESC";
@@ -4926,14 +4926,14 @@  discard block
 block discarded – undo
4926 4926
 
4927 4927
 		$aircraft_array = array();
4928 4928
 		$temp_array = array();
4929
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4929
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4930 4930
 		{
4931 4931
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4932 4932
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4933 4933
 			$temp_array['registration'] = $row['registration'];
4934 4934
 			$temp_array['airline_name'] = $row['airline_name'];
4935 4935
 			$temp_array['image_thumbnail'] = "";
4936
-			if($row['registration'] != "")
4936
+			if ($row['registration'] != "")
4937 4937
 			{
4938 4938
 				$image_array = $Image->getSpotterImage($row['registration']);
4939 4939
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4952,11 +4952,11 @@  discard block
 block discarded – undo
4952 4952
 	* @return Array the aircraft manufacturer list
4953 4953
 	*
4954 4954
 	*/
4955
-	public function countAllAircraftManufacturerByDate($date,$filters = array())
4955
+	public function countAllAircraftManufacturerByDate($date, $filters = array())
4956 4956
 	{
4957 4957
 		global $globalTimezone, $globalDBdriver;
4958
-		$filter_query = $this->getFilter($filters,true,true);
4959
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4958
+		$filter_query = $this->getFilter($filters, true, true);
4959
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4960 4960
 		if ($globalTimezone != '') {
4961 4961
 			date_default_timezone_set($globalTimezone);
4962 4962
 			$datetime = new DateTime($date);
@@ -4964,12 +4964,12 @@  discard block
 block discarded – undo
4964 4964
 		} else $offset = '+00:00';
4965 4965
 
4966 4966
 		if ($globalDBdriver == 'mysql') {
4967
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4967
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4968 4968
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4969 4969
 				GROUP BY spotter_output.aircraft_manufacturer 
4970 4970
 				ORDER BY aircraft_manufacturer_count DESC";
4971 4971
 		} else {
4972
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4972
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4973 4973
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4974 4974
 				GROUP BY spotter_output.aircraft_manufacturer 
4975 4975
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -4981,7 +4981,7 @@  discard block
 block discarded – undo
4981 4981
 		$aircraft_array = array();
4982 4982
 		$temp_array = array();
4983 4983
 
4984
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4984
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4985 4985
 		{
4986 4986
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4987 4987
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4998,11 +4998,11 @@  discard block
 block discarded – undo
4998 4998
 	* @return Array the aircraft list
4999 4999
 	*
5000 5000
 	*/
5001
-	public function countAllAircraftTypesByIdent($ident,$filters = array())
5001
+	public function countAllAircraftTypesByIdent($ident, $filters = array())
5002 5002
 	{
5003
-		$filter_query = $this->getFilter($filters,true,true);
5004
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5005
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5003
+		$filter_query = $this->getFilter($filters, true, true);
5004
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5005
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5006 5006
 				FROM spotter_output".$filter_query." spotter_output.ident = :ident 
5007 5007
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
5008 5008
 				ORDER BY aircraft_icao_count DESC";
@@ -5013,7 +5013,7 @@  discard block
 block discarded – undo
5013 5013
 		$aircraft_array = array();
5014 5014
 		$temp_array = array();
5015 5015
 
5016
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5016
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5017 5017
 		{
5018 5018
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5019 5019
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5031,13 +5031,13 @@  discard block
 block discarded – undo
5031 5031
 	* @return Array the aircraft list
5032 5032
 	*
5033 5033
 	*/
5034
-	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5034
+	public function countAllAircraftRegistrationByIdent($ident, $filters = array())
5035 5035
 	{
5036
-		$filter_query = $this->getFilter($filters,true,true);
5036
+		$filter_query = $this->getFilter($filters, true, true);
5037 5037
 		$Image = new Image($this->db);
5038
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5038
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5039 5039
 
5040
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5040
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5041 5041
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.ident = :ident   
5042 5042
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
5043 5043
 		    ORDER BY registration_count DESC";
@@ -5049,14 +5049,14 @@  discard block
 block discarded – undo
5049 5049
 		$aircraft_array = array();
5050 5050
 		$temp_array = array();
5051 5051
         
5052
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5052
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5053 5053
 		{
5054 5054
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5055 5055
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5056 5056
 			$temp_array['registration'] = $row['registration'];
5057 5057
 			$temp_array['airline_name'] = $row['airline_name'];
5058 5058
 			$temp_array['image_thumbnail'] = "";
5059
-			if($row['registration'] != "")
5059
+			if ($row['registration'] != "")
5060 5060
 			{
5061 5061
 				$image_array = $Image->getSpotterImage($row['registration']);
5062 5062
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5075,11 +5075,11 @@  discard block
 block discarded – undo
5075 5075
 	* @return Array the aircraft manufacturer list
5076 5076
 	*
5077 5077
 	*/
5078
-	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5078
+	public function countAllAircraftManufacturerByIdent($ident, $filters = array())
5079 5079
 	{
5080
-		$filter_query = $this->getFilter($filters,true,true);
5081
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5082
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5080
+		$filter_query = $this->getFilter($filters, true, true);
5081
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5082
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5083 5083
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident  
5084 5084
                     GROUP BY spotter_output.aircraft_manufacturer 
5085 5085
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5089,7 +5089,7 @@  discard block
 block discarded – undo
5089 5089
 		$sth->execute(array(':ident' => $ident));
5090 5090
 		$aircraft_array = array();
5091 5091
 		$temp_array = array();
5092
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5092
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5093 5093
 		{
5094 5094
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5095 5095
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5105,24 +5105,24 @@  discard block
 block discarded – undo
5105 5105
 	* @return Array the aircraft list
5106 5106
 	*
5107 5107
 	*/
5108
-	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5108
+	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5109 5109
 	{
5110
-		$filter_query = $this->getFilter($filters,true,true);
5111
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5112
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5110
+		$filter_query = $this->getFilter($filters, true, true);
5111
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5112
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5113 5113
 		
5114 5114
 
5115
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5115
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5116 5116
                     FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
5117 5117
                     GROUP BY spotter_output.aircraft_name 
5118 5118
 					ORDER BY aircraft_icao_count DESC";
5119 5119
  
5120 5120
 		
5121 5121
 		$sth = $this->db->prepare($query);
5122
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5122
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5123 5123
 		$aircraft_array = array();
5124 5124
 		$temp_array = array();
5125
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5125
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5126 5126
 		{
5127 5127
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5128 5128
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5138,33 +5138,33 @@  discard block
 block discarded – undo
5138 5138
 	* @return Array the aircraft list
5139 5139
 	*
5140 5140
 	*/
5141
-	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5141
+	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5142 5142
 	{
5143
-		$filter_query = $this->getFilter($filters,true,true);
5143
+		$filter_query = $this->getFilter($filters, true, true);
5144 5144
 		$Image = new Image($this->db);
5145
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5146
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5145
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5146
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5147 5147
 
5148
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
5148
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
5149 5149
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)   
5150 5150
                     GROUP BY spotter_output.registration 
5151 5151
 					ORDER BY registration_count DESC";
5152 5152
 
5153 5153
 		
5154 5154
 		$sth = $this->db->prepare($query);
5155
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5155
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5156 5156
       
5157 5157
 		$aircraft_array = array();
5158 5158
 		$temp_array = array();
5159 5159
         
5160
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5160
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5161 5161
 		{
5162 5162
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5163 5163
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5164 5164
 			$temp_array['registration'] = $row['registration'];
5165 5165
 			$temp_array['airline_name'] = $row['airline_name'];
5166 5166
 			$temp_array['image_thumbnail'] = "";
5167
-			if($row['registration'] != "")
5167
+			if ($row['registration'] != "")
5168 5168
 			{
5169 5169
 				$image_array = $Image->getSpotterImage($row['registration']);
5170 5170
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5184,25 +5184,25 @@  discard block
 block discarded – undo
5184 5184
 	* @return Array the aircraft manufacturer list
5185 5185
 	*
5186 5186
 	*/
5187
-	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5187
+	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5188 5188
 	{
5189
-		$filter_query = $this->getFilter($filters,true,true);
5190
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5191
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5189
+		$filter_query = $this->getFilter($filters, true, true);
5190
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5191
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5192 5192
 
5193
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5193
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5194 5194
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
5195 5195
                     GROUP BY spotter_output.aircraft_manufacturer 
5196 5196
 					ORDER BY aircraft_manufacturer_count DESC";
5197 5197
 
5198 5198
 		
5199 5199
 		$sth = $this->db->prepare($query);
5200
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5200
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5201 5201
       
5202 5202
 		$aircraft_array = array();
5203 5203
 		$temp_array = array();
5204 5204
         
5205
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5205
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5206 5206
 		{
5207 5207
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5208 5208
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5222,11 +5222,11 @@  discard block
 block discarded – undo
5222 5222
 	* @return Array the aircraft list
5223 5223
 	*
5224 5224
 	*/
5225
-	public function countAllAircraftTypesByCountry($country,$filters = array())
5225
+	public function countAllAircraftTypesByCountry($country, $filters = array())
5226 5226
 	{
5227
-		$filter_query = $this->getFilter($filters,true,true);
5228
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5229
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5227
+		$filter_query = $this->getFilter($filters, true, true);
5228
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5229
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5230 5230
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
5231 5231
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5232 5232
 			    ORDER BY aircraft_icao_count DESC";
@@ -5238,7 +5238,7 @@  discard block
 block discarded – undo
5238 5238
 		$aircraft_array = array();
5239 5239
 		$temp_array = array();
5240 5240
         
5241
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5241
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5242 5242
 		{
5243 5243
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5244 5244
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5257,12 +5257,12 @@  discard block
 block discarded – undo
5257 5257
 	* @return Array the aircraft list
5258 5258
 	*
5259 5259
 	*/
5260
-	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5260
+	public function countAllAircraftRegistrationByCountry($country, $filters = array())
5261 5261
 	{
5262
-		$filter_query = $this->getFilter($filters,true,true);
5262
+		$filter_query = $this->getFilter($filters, true, true);
5263 5263
 		$Image = new Image($this->db);
5264
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5265
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
5264
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5265
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
5266 5266
 			    FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country)    
5267 5267
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5268 5268
 			    ORDER BY registration_count DESC";
@@ -5274,14 +5274,14 @@  discard block
 block discarded – undo
5274 5274
 		$aircraft_array = array();
5275 5275
 		$temp_array = array();
5276 5276
         
5277
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5277
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5278 5278
 		{
5279 5279
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5280 5280
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5281 5281
 			$temp_array['registration'] = $row['registration'];
5282 5282
 			$temp_array['airline_name'] = $row['airline_name'];
5283 5283
 			$temp_array['image_thumbnail'] = "";
5284
-			if($row['registration'] != "")
5284
+			if ($row['registration'] != "")
5285 5285
 			{
5286 5286
 				$image_array = $Image->getSpotterImage($row['registration']);
5287 5287
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5301,11 +5301,11 @@  discard block
 block discarded – undo
5301 5301
 	* @return Array the aircraft manufacturer list
5302 5302
 	*
5303 5303
 	*/
5304
-	public function countAllAircraftManufacturerByCountry($country,$filters = array())
5304
+	public function countAllAircraftManufacturerByCountry($country, $filters = array())
5305 5305
 	{
5306
-		$filter_query = $this->getFilter($filters,true,true);
5307
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5308
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5306
+		$filter_query = $this->getFilter($filters, true, true);
5307
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5308
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5309 5309
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country) 
5310 5310
                     GROUP BY spotter_output.aircraft_manufacturer 
5311 5311
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5317,7 +5317,7 @@  discard block
 block discarded – undo
5317 5317
 		$aircraft_array = array();
5318 5318
 		$temp_array = array();
5319 5319
         
5320
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5320
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5321 5321
 		{
5322 5322
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5323 5323
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5338,8 +5338,8 @@  discard block
 block discarded – undo
5338 5338
 	*/
5339 5339
 	public function countAllAircraftManufacturers($filters = array())
5340 5340
 	{
5341
-		$filter_query = $this->getFilter($filters,true,true);
5342
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5341
+		$filter_query = $this->getFilter($filters, true, true);
5342
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5343 5343
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5344 5344
                 $query .= " GROUP BY spotter_output.aircraft_manufacturer
5345 5345
 					ORDER BY aircraft_manufacturer_count DESC
@@ -5352,7 +5352,7 @@  discard block
 block discarded – undo
5352 5352
 		$manufacturer_array = array();
5353 5353
 		$temp_array = array();
5354 5354
         
5355
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5355
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5356 5356
 		{
5357 5357
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5358 5358
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5371,12 +5371,12 @@  discard block
 block discarded – undo
5371 5371
 	* @return Array the aircraft list
5372 5372
 	*
5373 5373
 	*/
5374
-	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5374
+	public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5375 5375
 	{
5376 5376
 		global $globalDBdriver;
5377 5377
 		$Image = new Image($this->db);
5378
-		$filter_query = $this->getFilter($filters,true,true);
5379
-		$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    
5378
+		$filter_query = $this->getFilter($filters, true, true);
5379
+		$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    
5380 5380
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5381 5381
                 if ($olderthanmonths > 0) {
5382 5382
             		if ($globalDBdriver == 'mysql') {
@@ -5404,7 +5404,7 @@  discard block
 block discarded – undo
5404 5404
 		$aircraft_array = array();
5405 5405
 		$temp_array = array();
5406 5406
         
5407
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5407
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5408 5408
 		{
5409 5409
 			$temp_array['registration'] = $row['registration'];
5410 5410
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -5412,7 +5412,7 @@  discard block
 block discarded – undo
5412 5412
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5413 5413
 			$temp_array['airline_name'] = $row['airline_name'];
5414 5414
 			$temp_array['image_thumbnail'] = "";
5415
-			if($row['registration'] != "")
5415
+			if ($row['registration'] != "")
5416 5416
 			{
5417 5417
 				$image_array = $Image->getSpotterImage($row['registration']);
5418 5418
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5431,12 +5431,12 @@  discard block
 block discarded – undo
5431 5431
 	* @return Array the aircraft list
5432 5432
 	*
5433 5433
 	*/
5434
-	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5434
+	public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5435 5435
 	{
5436 5436
 		global $globalDBdriver;
5437
-		$filter_query = $this->getFilter($filters,true,true);
5437
+		$filter_query = $this->getFilter($filters, true, true);
5438 5438
 		$Image = new Image($this->db);
5439
-		$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    
5439
+		$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    
5440 5440
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5441 5441
                 if ($olderthanmonths > 0) {
5442 5442
             		if ($globalDBdriver == 'mysql') {
@@ -5464,7 +5464,7 @@  discard block
 block discarded – undo
5464 5464
 		$aircraft_array = array();
5465 5465
 		$temp_array = array();
5466 5466
         
5467
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5467
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5468 5468
 		{
5469 5469
 			$temp_array['registration'] = $row['registration'];
5470 5470
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -5473,7 +5473,7 @@  discard block
 block discarded – undo
5473 5473
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5474 5474
 			$temp_array['airline_name'] = $row['airline_name'];
5475 5475
 			$temp_array['image_thumbnail'] = "";
5476
-			if($row['registration'] != "")
5476
+			if ($row['registration'] != "")
5477 5477
 			{
5478 5478
 				$image_array = $Image->getSpotterImage($row['registration']);
5479 5479
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5492,11 +5492,11 @@  discard block
 block discarded – undo
5492 5492
 	* @return Array the airport list
5493 5493
 	*
5494 5494
 	*/
5495
-	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5495
+	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5496 5496
 	{
5497 5497
 		global $globalDBdriver;
5498
-		$filter_query = $this->getFilter($filters,true,true);
5499
-		$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 
5498
+		$filter_query = $this->getFilter($filters, true, true);
5499
+		$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 
5500 5500
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA'";
5501 5501
                 if ($olderthanmonths > 0) {
5502 5502
             		if ($globalDBdriver == 'mysql') {
@@ -5525,7 +5525,7 @@  discard block
 block discarded – undo
5525 5525
 		$airport_array = array();
5526 5526
 		$temp_array = array();
5527 5527
         
5528
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5528
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5529 5529
 		{
5530 5530
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5531 5531
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5544,11 +5544,11 @@  discard block
 block discarded – undo
5544 5544
 	* @return Array the airport list
5545 5545
 	*
5546 5546
 	*/
5547
-	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5547
+	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5548 5548
 	{
5549 5549
 		global $globalDBdriver;
5550
-		$filter_query = $this->getFilter($filters,true,true);
5551
-		$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 
5550
+		$filter_query = $this->getFilter($filters, true, true);
5551
+		$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 
5552 5552
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' ";
5553 5553
                 if ($olderthanmonths > 0) {
5554 5554
             		if ($globalDBdriver == 'mysql') {
@@ -5577,7 +5577,7 @@  discard block
 block discarded – undo
5577 5577
 		$airport_array = array();
5578 5578
 		$temp_array = array();
5579 5579
         
5580
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5580
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5581 5581
 		{
5582 5582
 			$temp_array['airline_icao'] = $row['airline_icao'];
5583 5583
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -5597,11 +5597,11 @@  discard block
 block discarded – undo
5597 5597
 	* @return Array the airport list
5598 5598
 	*
5599 5599
 	*/
5600
-	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5600
+	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5601 5601
 	{
5602 5602
 		global $globalDBdriver;
5603
-		$filter_query = $this->getFilter($filters,true,true);
5604
-		$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
5603
+		$filter_query = $this->getFilter($filters, true, true);
5604
+		$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
5605 5605
 				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";
5606 5606
                 if ($olderthanmonths > 0) {
5607 5607
             		if ($globalDBdriver == 'mysql') {
@@ -5629,7 +5629,7 @@  discard block
 block discarded – undo
5629 5629
 		$airport_array = array();
5630 5630
 		$temp_array = array();
5631 5631
         
5632
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5632
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5633 5633
 		{
5634 5634
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5635 5635
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5648,11 +5648,11 @@  discard block
 block discarded – undo
5648 5648
 	* @return Array the airport list
5649 5649
 	*
5650 5650
 	*/
5651
-	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5651
+	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5652 5652
 	{
5653 5653
 		global $globalDBdriver;
5654
-		$filter_query = $this->getFilter($filters,true,true);
5655
-		$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
5654
+		$filter_query = $this->getFilter($filters, true, true);
5655
+		$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
5656 5656
 				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 ";
5657 5657
                 if ($olderthanmonths > 0) {
5658 5658
             		if ($globalDBdriver == 'mysql') {
@@ -5681,7 +5681,7 @@  discard block
 block discarded – undo
5681 5681
 		$airport_array = array();
5682 5682
 		$temp_array = array();
5683 5683
         
5684
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5684
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5685 5685
 		{
5686 5686
 			$temp_array['airline_icao'] = $row['airline_icao'];
5687 5687
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -5701,11 +5701,11 @@  discard block
 block discarded – undo
5701 5701
 	* @return Array the airport list
5702 5702
 	*
5703 5703
 	*/
5704
-	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
5704
+	public function countAllDepartureAirportsByAirline($airline_icao, $filters = array())
5705 5705
 	{
5706
-		$filter_query = $this->getFilter($filters,true,true);
5707
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5708
-		$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 
5706
+		$filter_query = $this->getFilter($filters, true, true);
5707
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5708
+		$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 
5709 5709
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao 
5710 5710
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5711 5711
 			    ORDER BY airport_departure_icao_count DESC";
@@ -5717,7 +5717,7 @@  discard block
 block discarded – undo
5717 5717
 		$airport_array = array();
5718 5718
 		$temp_array = array();
5719 5719
         
5720
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5720
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5721 5721
 		{
5722 5722
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5723 5723
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5739,11 +5739,11 @@  discard block
 block discarded – undo
5739 5739
 	* @return Array the airport list
5740 5740
 	*
5741 5741
 	*/
5742
-	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
5742
+	public function countAllDepartureAirportCountriesByAirline($airline_icao, $filters = array())
5743 5743
 	{
5744
-		$filter_query = $this->getFilter($filters,true,true);
5745
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5746
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5744
+		$filter_query = $this->getFilter($filters, true, true);
5745
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5746
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5747 5747
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
5748 5748
                     GROUP BY spotter_output.departure_airport_country
5749 5749
 					ORDER BY airport_departure_country_count DESC";
@@ -5755,7 +5755,7 @@  discard block
 block discarded – undo
5755 5755
 		$airport_array = array();
5756 5756
 		$temp_array = array();
5757 5757
         
5758
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5758
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5759 5759
 		{
5760 5760
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5761 5761
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5774,11 +5774,11 @@  discard block
 block discarded – undo
5774 5774
 	* @return Array the airport list
5775 5775
 	*
5776 5776
 	*/
5777
-	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
5777
+	public function countAllDepartureAirportsByAircraft($aircraft_icao, $filters = array())
5778 5778
 	{
5779
-		$filter_query = $this->getFilter($filters,true,true);
5780
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5781
-		$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 
5779
+		$filter_query = $this->getFilter($filters, true, true);
5780
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5781
+		$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 
5782 5782
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao 
5783 5783
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5784 5784
 			    ORDER BY airport_departure_icao_count DESC";
@@ -5790,7 +5790,7 @@  discard block
 block discarded – undo
5790 5790
 		$airport_array = array();
5791 5791
 		$temp_array = array();
5792 5792
         
5793
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5793
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5794 5794
 		{
5795 5795
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5796 5796
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5811,11 +5811,11 @@  discard block
 block discarded – undo
5811 5811
 	* @return Array the airport list
5812 5812
 	*
5813 5813
 	*/
5814
-	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
5814
+	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao, $filters = array())
5815 5815
 	{
5816
-		$filter_query = $this->getFilter($filters,true,true);
5817
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5818
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5816
+		$filter_query = $this->getFilter($filters, true, true);
5817
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5818
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5819 5819
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
5820 5820
                     GROUP BY spotter_output.departure_airport_country
5821 5821
 					ORDER BY airport_departure_country_count DESC";
@@ -5827,7 +5827,7 @@  discard block
 block discarded – undo
5827 5827
 		$airport_array = array();
5828 5828
 		$temp_array = array();
5829 5829
         
5830
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5830
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5831 5831
 		{
5832 5832
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5833 5833
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5845,11 +5845,11 @@  discard block
 block discarded – undo
5845 5845
 	* @return Array the airport list
5846 5846
 	*
5847 5847
 	*/
5848
-	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
5848
+	public function countAllDepartureAirportsByRegistration($registration, $filters = array())
5849 5849
 	{
5850
-		$filter_query = $this->getFilter($filters,true,true);
5851
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
5852
-		$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 
5850
+		$filter_query = $this->getFilter($filters, true, true);
5851
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
5852
+		$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 
5853 5853
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.registration = :registration 
5854 5854
                     GROUP BY spotter_output.departure_airport_icao
5855 5855
 					ORDER BY airport_departure_icao_count DESC";
@@ -5861,7 +5861,7 @@  discard block
 block discarded – undo
5861 5861
 		$airport_array = array();
5862 5862
 		$temp_array = array();
5863 5863
         
5864
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5864
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5865 5865
 		{
5866 5866
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5867 5867
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5882,11 +5882,11 @@  discard block
 block discarded – undo
5882 5882
 	* @return Array the airport list
5883 5883
 	*
5884 5884
 	*/
5885
-	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
5885
+	public function countAllDepartureAirportCountriesByRegistration($registration, $filters = array())
5886 5886
 	{
5887
-		$filter_query = $this->getFilter($filters,true,true);
5888
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
5889
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5887
+		$filter_query = $this->getFilter($filters, true, true);
5888
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
5889
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5890 5890
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration 
5891 5891
                     GROUP BY spotter_output.departure_airport_country
5892 5892
 					ORDER BY airport_departure_country_count DESC";
@@ -5898,7 +5898,7 @@  discard block
 block discarded – undo
5898 5898
 		$airport_array = array();
5899 5899
 		$temp_array = array();
5900 5900
         
5901
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5901
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5902 5902
 		{
5903 5903
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5904 5904
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5916,11 +5916,11 @@  discard block
 block discarded – undo
5916 5916
 	* @return Array the airport list
5917 5917
 	*
5918 5918
 	*/
5919
-	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
5919
+	public function countAllDepartureAirportsByAirport($airport_icao, $filters = array())
5920 5920
 	{
5921
-		$filter_query = $this->getFilter($filters,true,true);
5922
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5923
-		$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 
5921
+		$filter_query = $this->getFilter($filters, true, true);
5922
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5923
+		$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 
5924 5924
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao = :airport_icao 
5925 5925
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5926 5926
 			    ORDER BY airport_departure_icao_count DESC";
@@ -5932,7 +5932,7 @@  discard block
 block discarded – undo
5932 5932
 		$airport_array = array();
5933 5933
 		$temp_array = array();
5934 5934
         
5935
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5935
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5936 5936
 		{
5937 5937
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5938 5938
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5953,11 +5953,11 @@  discard block
 block discarded – undo
5953 5953
 	* @return Array the airport list
5954 5954
 	*
5955 5955
 	*/
5956
-	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
5956
+	public function countAllDepartureAirportCountriesByAirport($airport_icao, $filters = array())
5957 5957
 	{
5958
-		$filter_query = $this->getFilter($filters,true,true);
5959
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5960
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5958
+		$filter_query = $this->getFilter($filters, true, true);
5959
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5960
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5961 5961
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao 
5962 5962
                     GROUP BY spotter_output.departure_airport_country
5963 5963
 					ORDER BY airport_departure_country_count DESC";
@@ -5969,7 +5969,7 @@  discard block
 block discarded – undo
5969 5969
 		$airport_array = array();
5970 5970
 		$temp_array = array();
5971 5971
         
5972
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5972
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5973 5973
 		{
5974 5974
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5975 5975
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5988,11 +5988,11 @@  discard block
 block discarded – undo
5988 5988
 	* @return Array the airport list
5989 5989
 	*
5990 5990
 	*/
5991
-	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
5991
+	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer, $filters = array())
5992 5992
 	{
5993
-		$filter_query = $this->getFilter($filters,true,true);
5994
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5995
-		$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 
5993
+		$filter_query = $this->getFilter($filters, true, true);
5994
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5995
+		$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 
5996 5996
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
5997 5997
                     GROUP BY spotter_output.departure_airport_icao
5998 5998
 					ORDER BY airport_departure_icao_count DESC";
@@ -6004,7 +6004,7 @@  discard block
 block discarded – undo
6004 6004
 		$airport_array = array();
6005 6005
 		$temp_array = array();
6006 6006
         
6007
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6007
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6008 6008
 		{
6009 6009
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6010 6010
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6025,11 +6025,11 @@  discard block
 block discarded – undo
6025 6025
 	* @return Array the airport list
6026 6026
 	*
6027 6027
 	*/
6028
-	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6028
+	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
6029 6029
 	{
6030
-		$filter_query = $this->getFilter($filters,true,true);
6031
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6032
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6030
+		$filter_query = $this->getFilter($filters, true, true);
6031
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6032
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6033 6033
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6034 6034
                     GROUP BY spotter_output.departure_airport_country
6035 6035
 					ORDER BY airport_departure_country_count DESC";
@@ -6041,7 +6041,7 @@  discard block
 block discarded – undo
6041 6041
 		$airport_array = array();
6042 6042
 		$temp_array = array();
6043 6043
         
6044
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6044
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6045 6045
 		{
6046 6046
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6047 6047
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6059,11 +6059,11 @@  discard block
 block discarded – undo
6059 6059
 	* @return Array the airport list
6060 6060
 	*
6061 6061
 	*/
6062
-	public function countAllDepartureAirportsByDate($date,$filters = array())
6062
+	public function countAllDepartureAirportsByDate($date, $filters = array())
6063 6063
 	{
6064 6064
 		global $globalTimezone, $globalDBdriver;
6065
-		$filter_query = $this->getFilter($filters,true,true);
6066
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6065
+		$filter_query = $this->getFilter($filters, true, true);
6066
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6067 6067
 		if ($globalTimezone != '') {
6068 6068
 			date_default_timezone_set($globalTimezone);
6069 6069
 			$datetime = new DateTime($date);
@@ -6071,12 +6071,12 @@  discard block
 block discarded – undo
6071 6071
 		} else $offset = '+00:00';
6072 6072
 
6073 6073
 		if ($globalDBdriver == 'mysql') {
6074
-			$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 
6074
+			$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6075 6075
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
6076 6076
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6077 6077
 					ORDER BY airport_departure_icao_count DESC";
6078 6078
 		} else {
6079
-			$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 
6079
+			$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 
6080 6080
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
6081 6081
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6082 6082
 					ORDER BY airport_departure_icao_count DESC";
@@ -6088,7 +6088,7 @@  discard block
 block discarded – undo
6088 6088
 		$airport_array = array();
6089 6089
 		$temp_array = array();
6090 6090
         
6091
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6091
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6092 6092
 		{
6093 6093
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6094 6094
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6109,11 +6109,11 @@  discard block
 block discarded – undo
6109 6109
 	* @return Array the airport list
6110 6110
 	*
6111 6111
 	*/
6112
-	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6112
+	public function countAllDepartureAirportCountriesByDate($date, $filters = array())
6113 6113
 	{
6114 6114
 		global $globalTimezone, $globalDBdriver;
6115
-		$filter_query = $this->getFilter($filters,true,true);
6116
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6115
+		$filter_query = $this->getFilter($filters, true, true);
6116
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6117 6117
 		if ($globalTimezone != '') {
6118 6118
 			date_default_timezone_set($globalTimezone);
6119 6119
 			$datetime = new DateTime($date);
@@ -6121,12 +6121,12 @@  discard block
 block discarded – undo
6121 6121
 		} else $offset = '+00:00';
6122 6122
 
6123 6123
 		if ($globalDBdriver == 'mysql') {
6124
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6124
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6125 6125
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
6126 6126
 					GROUP BY spotter_output.departure_airport_country
6127 6127
 					ORDER BY airport_departure_country_count DESC";
6128 6128
 		} else {
6129
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6129
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6130 6130
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
6131 6131
 					GROUP BY spotter_output.departure_airport_country
6132 6132
 					ORDER BY airport_departure_country_count DESC";
@@ -6138,7 +6138,7 @@  discard block
 block discarded – undo
6138 6138
 		$airport_array = array();
6139 6139
 		$temp_array = array();
6140 6140
         
6141
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6141
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6142 6142
 		{
6143 6143
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6144 6144
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6156,11 +6156,11 @@  discard block
 block discarded – undo
6156 6156
 	* @return Array the airport list
6157 6157
 	*
6158 6158
 	*/
6159
-	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6159
+	public function countAllDepartureAirportsByIdent($ident, $filters = array())
6160 6160
 	{
6161
-		$filter_query = $this->getFilter($filters,true,true);
6162
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6163
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6161
+		$filter_query = $this->getFilter($filters, true, true);
6162
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6163
+		$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 
6164 6164
 		    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.ident = :ident 
6165 6165
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6166 6166
 		    ORDER BY airport_departure_icao_count DESC";
@@ -6172,7 +6172,7 @@  discard block
 block discarded – undo
6172 6172
 		$airport_array = array();
6173 6173
 		$temp_array = array();
6174 6174
         
6175
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6175
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6176 6176
 		{
6177 6177
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6178 6178
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6194,11 +6194,11 @@  discard block
 block discarded – undo
6194 6194
 	* @return Array the airport list
6195 6195
 	*
6196 6196
 	*/
6197
-	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
6197
+	public function countAllDepartureAirportCountriesByIdent($ident, $filters = array())
6198 6198
 	{
6199
-		$filter_query = $this->getFilter($filters,true,true);
6200
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6201
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6199
+		$filter_query = $this->getFilter($filters, true, true);
6200
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6201
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6202 6202
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident 
6203 6203
                     GROUP BY spotter_output.departure_airport_country
6204 6204
 					ORDER BY airport_departure_country_count DESC";
@@ -6210,7 +6210,7 @@  discard block
 block discarded – undo
6210 6210
 		$airport_array = array();
6211 6211
 		$temp_array = array();
6212 6212
         
6213
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6213
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6214 6214
 		{
6215 6215
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6216 6216
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6229,12 +6229,12 @@  discard block
 block discarded – undo
6229 6229
 	* @return Array the airport list
6230 6230
 	*
6231 6231
 	*/
6232
-	public function countAllDepartureAirportsByCountry($country,$filters = array())
6232
+	public function countAllDepartureAirportsByCountry($country, $filters = array())
6233 6233
 	{
6234
-		$filter_query = $this->getFilter($filters,true,true);
6235
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6234
+		$filter_query = $this->getFilter($filters, true, true);
6235
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6236 6236
 
6237
-		$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 
6237
+		$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 
6238 6238
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
6239 6239
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6240 6240
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6246,7 +6246,7 @@  discard block
 block discarded – undo
6246 6246
 		$airport_array = array();
6247 6247
 		$temp_array = array();
6248 6248
         
6249
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6249
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6250 6250
 		{
6251 6251
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6252 6252
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6267,11 +6267,11 @@  discard block
 block discarded – undo
6267 6267
 	* @return Array the airport list
6268 6268
 	*
6269 6269
 	*/
6270
-	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
6270
+	public function countAllDepartureAirportCountriesByCountry($country, $filters = array())
6271 6271
 	{
6272
-		$filter_query = $this->getFilter($filters,true,true);
6273
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6274
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6272
+		$filter_query = $this->getFilter($filters, true, true);
6273
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6274
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6275 6275
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
6276 6276
                     GROUP BY spotter_output.departure_airport_country
6277 6277
 					ORDER BY airport_departure_country_count DESC";
@@ -6283,7 +6283,7 @@  discard block
 block discarded – undo
6283 6283
 		$airport_array = array();
6284 6284
 		$temp_array = array();
6285 6285
         
6286
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6286
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6287 6287
 		{
6288 6288
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6289 6289
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6301,11 +6301,11 @@  discard block
 block discarded – undo
6301 6301
 	* @return Array the airport list
6302 6302
 	*
6303 6303
 	*/
6304
-	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6304
+	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6305 6305
 	{
6306 6306
 		global $globalDBdriver;
6307
-		$filter_query = $this->getFilter($filters,true,true);
6308
-		$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 
6307
+		$filter_query = $this->getFilter($filters, true, true);
6308
+		$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 
6309 6309
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
6310 6310
                 if ($olderthanmonths > 0) {
6311 6311
             		if ($globalDBdriver == 'mysql') {
@@ -6340,7 +6340,7 @@  discard block
 block discarded – undo
6340 6340
 		$airport_array = array();
6341 6341
 		$temp_array = array();
6342 6342
         
6343
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6343
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6344 6344
 		{
6345 6345
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6346 6346
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6363,11 +6363,11 @@  discard block
 block discarded – undo
6363 6363
 	* @return Array the airport list
6364 6364
 	*
6365 6365
 	*/
6366
-	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6366
+	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6367 6367
 	{
6368 6368
 		global $globalDBdriver;
6369
-		$filter_query = $this->getFilter($filters,true,true);
6370
-		$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 
6369
+		$filter_query = $this->getFilter($filters, true, true);
6370
+		$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 
6371 6371
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' ";
6372 6372
                 if ($olderthanmonths > 0) {
6373 6373
             		if ($globalDBdriver == 'mysql') {
@@ -6402,7 +6402,7 @@  discard block
 block discarded – undo
6402 6402
 		$airport_array = array();
6403 6403
 		$temp_array = array();
6404 6404
         
6405
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6405
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6406 6406
 		{
6407 6407
 			$temp_array['airline_icao'] = $row['airline_icao'];
6408 6408
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
@@ -6427,11 +6427,11 @@  discard block
 block discarded – undo
6427 6427
 	* @return Array the airport list
6428 6428
 	*
6429 6429
 	*/
6430
-	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6430
+	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6431 6431
 	{
6432 6432
 		global $globalDBdriver;
6433
-		$filter_query = $this->getFilter($filters,true,true);
6434
-		$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 
6433
+		$filter_query = $this->getFilter($filters, true, true);
6434
+		$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 
6435 6435
 			FROM airport,spotter_output".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao";
6436 6436
                 if ($olderthanmonths > 0) {
6437 6437
             		if ($globalDBdriver == 'mysql') {
@@ -6465,7 +6465,7 @@  discard block
 block discarded – undo
6465 6465
 		$airport_array = array();
6466 6466
 		$temp_array = array();
6467 6467
         
6468
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6468
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6469 6469
 		{
6470 6470
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6471 6471
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6488,11 +6488,11 @@  discard block
 block discarded – undo
6488 6488
 	* @return Array the airport list
6489 6489
 	*
6490 6490
 	*/
6491
-	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6491
+	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6492 6492
 	{
6493 6493
 		global $globalDBdriver;
6494
-		$filter_query = $this->getFilter($filters,true,true);
6495
-		$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 
6494
+		$filter_query = $this->getFilter($filters, true, true);
6495
+		$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 
6496 6496
 			FROM airport,spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao ";
6497 6497
                 if ($olderthanmonths > 0) {
6498 6498
             		if ($globalDBdriver == 'mysql') {
@@ -6527,7 +6527,7 @@  discard block
 block discarded – undo
6527 6527
 		$airport_array = array();
6528 6528
 		$temp_array = array();
6529 6529
         
6530
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6530
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6531 6531
 		{
6532 6532
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6533 6533
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6553,9 +6553,9 @@  discard block
 block discarded – undo
6553 6553
 	*/
6554 6554
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
6555 6555
 	{
6556
-		$filter_query = $this->getFilter($filters,true,true);
6557
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6558
-		$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 
6556
+		$filter_query = $this->getFilter($filters, true, true);
6557
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6558
+		$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 
6559 6559
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao 
6560 6560
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6561 6561
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -6566,7 +6566,7 @@  discard block
 block discarded – undo
6566 6566
 		$airport_array = array();
6567 6567
 		$temp_array = array();
6568 6568
         
6569
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6569
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6570 6570
 		{
6571 6571
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6572 6572
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6587,12 +6587,12 @@  discard block
 block discarded – undo
6587 6587
 	* @return Array the airport list
6588 6588
 	*
6589 6589
 	*/
6590
-	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
6590
+	public function countAllArrivalAirportCountriesByAirline($airline_icao, $filters = array())
6591 6591
 	{
6592
-		$filter_query = $this->getFilter($filters,true,true);
6593
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6592
+		$filter_query = $this->getFilter($filters, true, true);
6593
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6594 6594
 					
6595
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6595
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6596 6596
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
6597 6597
                     GROUP BY spotter_output.arrival_airport_country
6598 6598
 					ORDER BY airport_arrival_country_count DESC";
@@ -6604,7 +6604,7 @@  discard block
 block discarded – undo
6604 6604
 		$airport_array = array();
6605 6605
 		$temp_array = array();
6606 6606
         
6607
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6607
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6608 6608
 		{
6609 6609
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6610 6610
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6622,11 +6622,11 @@  discard block
 block discarded – undo
6622 6622
 	* @return Array the airport list
6623 6623
 	*
6624 6624
 	*/
6625
-	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
6625
+	public function countAllArrivalAirportsByAircraft($aircraft_icao, $filters = array())
6626 6626
 	{
6627
-		$filter_query = $this->getFilter($filters,true,true);
6628
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6629
-		$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 
6627
+		$filter_query = $this->getFilter($filters, true, true);
6628
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6629
+		$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 
6630 6630
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao 
6631 6631
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6632 6632
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -6638,7 +6638,7 @@  discard block
 block discarded – undo
6638 6638
 		$airport_array = array();
6639 6639
 		$temp_array = array();
6640 6640
         
6641
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6641
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6642 6642
 		{
6643 6643
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6644 6644
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6660,11 +6660,11 @@  discard block
 block discarded – undo
6660 6660
 	* @return Array the airport list
6661 6661
 	*
6662 6662
 	*/
6663
-	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
6663
+	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao, $filters = array())
6664 6664
 	{
6665
-		$filter_query = $this->getFilter($filters,true,true);
6666
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6667
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6665
+		$filter_query = $this->getFilter($filters, true, true);
6666
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6667
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6668 6668
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
6669 6669
                     GROUP BY spotter_output.arrival_airport_country
6670 6670
 					ORDER BY airport_arrival_country_count DESC";
@@ -6676,7 +6676,7 @@  discard block
 block discarded – undo
6676 6676
 		$airport_array = array();
6677 6677
 		$temp_array = array();
6678 6678
         
6679
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6679
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6680 6680
 		{
6681 6681
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6682 6682
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6694,12 +6694,12 @@  discard block
 block discarded – undo
6694 6694
 	* @return Array the airport list
6695 6695
 	*
6696 6696
 	*/
6697
-	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
6697
+	public function countAllArrivalAirportsByRegistration($registration, $filters = array())
6698 6698
 	{
6699
-		$filter_query = $this->getFilter($filters,true,true);
6700
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6699
+		$filter_query = $this->getFilter($filters, true, true);
6700
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6701 6701
 
6702
-		$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 
6702
+		$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 
6703 6703
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.registration = :registration 
6704 6704
                     GROUP BY spotter_output.arrival_airport_icao
6705 6705
 					ORDER BY airport_arrival_icao_count DESC";
@@ -6711,7 +6711,7 @@  discard block
 block discarded – undo
6711 6711
 		$airport_array = array();
6712 6712
 		$temp_array = array();
6713 6713
         
6714
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6714
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6715 6715
 		{
6716 6716
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6717 6717
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6732,11 +6732,11 @@  discard block
 block discarded – undo
6732 6732
 	* @return Array the airport list
6733 6733
 	*
6734 6734
 	*/
6735
-	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
6735
+	public function countAllArrivalAirportCountriesByRegistration($registration, $filters = array())
6736 6736
 	{
6737
-		$filter_query = $this->getFilter($filters,true,true);
6738
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6739
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6737
+		$filter_query = $this->getFilter($filters, true, true);
6738
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6739
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6740 6740
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration 
6741 6741
                     GROUP BY spotter_output.arrival_airport_country
6742 6742
 					ORDER BY airport_arrival_country_count DESC";
@@ -6748,7 +6748,7 @@  discard block
 block discarded – undo
6748 6748
 		$airport_array = array();
6749 6749
 		$temp_array = array();
6750 6750
         
6751
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6751
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6752 6752
 		{
6753 6753
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6754 6754
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6767,11 +6767,11 @@  discard block
 block discarded – undo
6767 6767
 	* @return Array the airport list
6768 6768
 	*
6769 6769
 	*/
6770
-	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
6770
+	public function countAllArrivalAirportsByAirport($airport_icao, $filters = array())
6771 6771
 	{
6772
-		$filter_query = $this->getFilter($filters,true,true);
6773
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6774
-		$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 
6772
+		$filter_query = $this->getFilter($filters, true, true);
6773
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6774
+		$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 
6775 6775
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.departure_airport_icao = :airport_icao 
6776 6776
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6777 6777
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -6783,7 +6783,7 @@  discard block
 block discarded – undo
6783 6783
 		$airport_array = array();
6784 6784
 		$temp_array = array();
6785 6785
         
6786
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6786
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6787 6787
 		{
6788 6788
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6789 6789
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6804,11 +6804,11 @@  discard block
 block discarded – undo
6804 6804
 	* @return Array the airport list
6805 6805
 	*
6806 6806
 	*/
6807
-	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
6807
+	public function countAllArrivalAirportCountriesByAirport($airport_icao, $filters = array())
6808 6808
 	{
6809
-		$filter_query = $this->getFilter($filters,true,true);
6810
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6811
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6809
+		$filter_query = $this->getFilter($filters, true, true);
6810
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6811
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6812 6812
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao 
6813 6813
                     GROUP BY spotter_output.arrival_airport_country
6814 6814
 					ORDER BY airport_arrival_country_count DESC";
@@ -6820,7 +6820,7 @@  discard block
 block discarded – undo
6820 6820
 		$airport_array = array();
6821 6821
 		$temp_array = array();
6822 6822
         
6823
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6823
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6824 6824
 		{
6825 6825
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6826 6826
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6838,11 +6838,11 @@  discard block
 block discarded – undo
6838 6838
 	* @return Array the airport list
6839 6839
 	*
6840 6840
 	*/
6841
-	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6841
+	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer, $filters = array())
6842 6842
 	{
6843
-		$filter_query = $this->getFilter($filters,true,true);
6844
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6845
-		$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 
6843
+		$filter_query = $this->getFilter($filters, true, true);
6844
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6845
+		$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 
6846 6846
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6847 6847
                     GROUP BY spotter_output.arrival_airport_icao
6848 6848
 					ORDER BY airport_arrival_icao_count DESC";
@@ -6854,7 +6854,7 @@  discard block
 block discarded – undo
6854 6854
 		$airport_array = array();
6855 6855
 		$temp_array = array();
6856 6856
         
6857
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6857
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6858 6858
 		{
6859 6859
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6860 6860
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6876,11 +6876,11 @@  discard block
 block discarded – undo
6876 6876
 	* @return Array the airport list
6877 6877
 	*
6878 6878
 	*/
6879
-	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6879
+	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
6880 6880
 	{
6881
-		$filter_query = $this->getFilter($filters,true,true);
6882
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6883
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6881
+		$filter_query = $this->getFilter($filters, true, true);
6882
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6883
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6884 6884
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6885 6885
                     GROUP BY spotter_output.arrival_airport_country
6886 6886
 					ORDER BY airport_arrival_country_count DESC";
@@ -6892,7 +6892,7 @@  discard block
 block discarded – undo
6892 6892
 		$airport_array = array();
6893 6893
 		$temp_array = array();
6894 6894
         
6895
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6895
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6896 6896
 		{
6897 6897
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6898 6898
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6911,11 +6911,11 @@  discard block
 block discarded – undo
6911 6911
 	* @return Array the airport list
6912 6912
 	*
6913 6913
 	*/
6914
-	public function countAllArrivalAirportsByDate($date,$filters = array())
6914
+	public function countAllArrivalAirportsByDate($date, $filters = array())
6915 6915
 	{
6916 6916
 		global $globalTimezone, $globalDBdriver;
6917
-		$filter_query = $this->getFilter($filters,true,true);
6918
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6917
+		$filter_query = $this->getFilter($filters, true, true);
6918
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6919 6919
 		if ($globalTimezone != '') {
6920 6920
 			date_default_timezone_set($globalTimezone);
6921 6921
 			$datetime = new DateTime($date);
@@ -6923,12 +6923,12 @@  discard block
 block discarded – undo
6923 6923
 		} else $offset = '+00:00';
6924 6924
 
6925 6925
 		if ($globalDBdriver == 'mysql') {
6926
-			$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 
6926
+			$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 
6927 6927
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
6928 6928
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6929 6929
 					ORDER BY airport_arrival_icao_count DESC";
6930 6930
 		} else {
6931
-			$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 
6931
+			$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 
6932 6932
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
6933 6933
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6934 6934
 					ORDER BY airport_arrival_icao_count DESC";
@@ -6940,7 +6940,7 @@  discard block
 block discarded – undo
6940 6940
 		$airport_array = array();
6941 6941
 		$temp_array = array();
6942 6942
         
6943
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6943
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6944 6944
 		{
6945 6945
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6946 6946
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6964,8 +6964,8 @@  discard block
 block discarded – undo
6964 6964
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
6965 6965
 	{
6966 6966
 		global $globalTimezone, $globalDBdriver;
6967
-		$filter_query = $this->getFilter($filters,true,true);
6968
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6967
+		$filter_query = $this->getFilter($filters, true, true);
6968
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6969 6969
 		if ($globalTimezone != '') {
6970 6970
 			date_default_timezone_set($globalTimezone);
6971 6971
 			$datetime = new DateTime($date);
@@ -6973,12 +6973,12 @@  discard block
 block discarded – undo
6973 6973
 		} else $offset = '+00:00';
6974 6974
 
6975 6975
 		if ($globalDBdriver == 'mysql') {
6976
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6976
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6977 6977
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
6978 6978
 					GROUP BY spotter_output.arrival_airport_country
6979 6979
 					ORDER BY airport_arrival_country_count DESC";
6980 6980
 		} else {
6981
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6981
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6982 6982
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
6983 6983
 					GROUP BY spotter_output.arrival_airport_country
6984 6984
 					ORDER BY airport_arrival_country_count DESC";
@@ -6990,7 +6990,7 @@  discard block
 block discarded – undo
6990 6990
 		$airport_array = array();
6991 6991
 		$temp_array = array();
6992 6992
         
6993
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6993
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6994 6994
 		{
6995 6995
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6996 6996
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7008,11 +7008,11 @@  discard block
 block discarded – undo
7008 7008
 	* @return Array the airport list
7009 7009
 	*
7010 7010
 	*/
7011
-	public function countAllArrivalAirportsByIdent($ident,$filters = array())
7011
+	public function countAllArrivalAirportsByIdent($ident, $filters = array())
7012 7012
 	{
7013
-		$filter_query = $this->getFilter($filters,true,true);
7014
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7015
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7013
+		$filter_query = $this->getFilter($filters, true, true);
7014
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7015
+		$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 
7016 7016
 		    FROM spotter_output".$filter_query." WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.ident = :ident  
7017 7017
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7018 7018
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -7024,7 +7024,7 @@  discard block
 block discarded – undo
7024 7024
 		$airport_array = array();
7025 7025
 		$temp_array = array();
7026 7026
         
7027
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7027
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7028 7028
 		{
7029 7029
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7030 7030
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7047,9 +7047,9 @@  discard block
 block discarded – undo
7047 7047
 	*/
7048 7048
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
7049 7049
 	{
7050
-		$filter_query = $this->getFilter($filters,true,true);
7051
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7052
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7050
+		$filter_query = $this->getFilter($filters, true, true);
7051
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7052
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7053 7053
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident 
7054 7054
                     GROUP BY spotter_output.arrival_airport_country
7055 7055
 					ORDER BY airport_arrival_country_count DESC";
@@ -7061,7 +7061,7 @@  discard block
 block discarded – undo
7061 7061
 		$airport_array = array();
7062 7062
 		$temp_array = array();
7063 7063
         
7064
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7064
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7065 7065
 		{
7066 7066
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7067 7067
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7080,11 +7080,11 @@  discard block
 block discarded – undo
7080 7080
 	* @return Array the airport list
7081 7081
 	*
7082 7082
 	*/
7083
-	public function countAllArrivalAirportsByCountry($country,$filters = array())
7083
+	public function countAllArrivalAirportsByCountry($country, $filters = array())
7084 7084
 	{
7085
-		$filter_query = $this->getFilter($filters,true,true);
7086
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7087
-		$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 
7085
+		$filter_query = $this->getFilter($filters, true, true);
7086
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7087
+		$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 
7088 7088
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
7089 7089
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7090 7090
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7096,7 +7096,7 @@  discard block
 block discarded – undo
7096 7096
 		$airport_array = array();
7097 7097
 		$temp_array = array();
7098 7098
         
7099
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7099
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7100 7100
 		{
7101 7101
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7102 7102
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7117,11 +7117,11 @@  discard block
 block discarded – undo
7117 7117
 	* @return Array the airport list
7118 7118
 	*
7119 7119
 	*/
7120
-	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
7120
+	public function countAllArrivalAirportCountriesByCountry($country, $filters = array())
7121 7121
 	{
7122
-		$filter_query = $this->getFilter($filters,true,true);
7123
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7124
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7122
+		$filter_query = $this->getFilter($filters, true, true);
7123
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7124
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7125 7125
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
7126 7126
                     GROUP BY spotter_output.arrival_airport_country
7127 7127
 					ORDER BY airport_arrival_country_count DESC";
@@ -7133,7 +7133,7 @@  discard block
 block discarded – undo
7133 7133
 		$airport_array = array();
7134 7134
 		$temp_array = array();
7135 7135
         
7136
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7136
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7137 7137
 		{
7138 7138
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7139 7139
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7154,7 +7154,7 @@  discard block
 block discarded – undo
7154 7154
 	*/
7155 7155
 	public function countAllDepartureCountries($filters = array())
7156 7156
 	{
7157
-		$filter_query = $this->getFilter($filters,true,true);
7157
+		$filter_query = $this->getFilter($filters, true, true);
7158 7158
 		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7159 7159
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA'";
7160 7160
 		$query .= " GROUP BY spotter_output.departure_airport_country
@@ -7168,7 +7168,7 @@  discard block
 block discarded – undo
7168 7168
 		$airport_array = array();
7169 7169
 		$temp_array = array();
7170 7170
         
7171
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7171
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7172 7172
 		{
7173 7173
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
7174 7174
 			$temp_array['airport_departure_country'] = $row['departure_airport_country'];
@@ -7186,9 +7186,9 @@  discard block
 block discarded – undo
7186 7186
 	* @return Array the airport arrival list
7187 7187
 	*
7188 7188
 	*/
7189
-	public function countAllArrivalCountries($limit = true,$filters = array())
7189
+	public function countAllArrivalCountries($limit = true, $filters = array())
7190 7190
 	{
7191
-		$filter_query = $this->getFilter($filters,true,true);
7191
+		$filter_query = $this->getFilter($filters, true, true);
7192 7192
 		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7193 7193
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
7194 7194
 		$query .= " GROUP BY spotter_output.arrival_airport_country
@@ -7202,7 +7202,7 @@  discard block
 block discarded – undo
7202 7202
 		$airport_array = array();
7203 7203
 		$temp_array = array();
7204 7204
         
7205
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7205
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7206 7206
 		{
7207 7207
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
7208 7208
 			$temp_array['airport_arrival_country'] = $row['arrival_airport_country'];
@@ -7225,8 +7225,8 @@  discard block
 block discarded – undo
7225 7225
 	*/
7226 7226
 	public function countAllRoutes($filters = array())
7227 7227
 	{
7228
-		$filter_query = $this->getFilter($filters,true,true);
7229
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7228
+		$filter_query = $this->getFilter($filters, true, true);
7229
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7230 7230
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> 'NA'
7231 7231
                     GROUP BY route,spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7232 7232
                     ORDER BY route_count DESC
@@ -7239,7 +7239,7 @@  discard block
 block discarded – undo
7239 7239
 		$routes_array = array();
7240 7240
 		$temp_array = array();
7241 7241
         
7242
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7242
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7243 7243
 		{
7244 7244
 			$temp_array['route_count'] = $row['route_count'];
7245 7245
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7266,11 +7266,11 @@  discard block
 block discarded – undo
7266 7266
 	* @return Array the route list
7267 7267
 	*
7268 7268
 	*/
7269
-	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
7269
+	public function countAllRoutesByAircraft($aircraft_icao, $filters = array())
7270 7270
 	{
7271
-		$filter_query = $this->getFilter($filters,true,true);
7272
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7273
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7271
+		$filter_query = $this->getFilter($filters, true, true);
7272
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7273
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7274 7274
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
7275 7275
 			    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7276 7276
 			    ORDER BY route_count DESC";
@@ -7281,7 +7281,7 @@  discard block
 block discarded – undo
7281 7281
 		$routes_array = array();
7282 7282
 		$temp_array = array();
7283 7283
         
7284
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7284
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7285 7285
 		{
7286 7286
 			$temp_array['route_count'] = $row['route_count'];
7287 7287
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7308,9 +7308,9 @@  discard block
 block discarded – undo
7308 7308
 	*/
7309 7309
 	public function countAllRoutesByRegistration($registration, $filters = array())
7310 7310
 	{
7311
-		$filter_query = $this->getFilter($filters,true,true);
7311
+		$filter_query = $this->getFilter($filters, true, true);
7312 7312
 		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7313
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7313
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7314 7314
 			FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.registration = :registration 
7315 7315
                     GROUP BY route
7316 7316
                     ORDER BY route_count DESC";
@@ -7322,7 +7322,7 @@  discard block
 block discarded – undo
7322 7322
 		$routes_array = array();
7323 7323
 		$temp_array = array();
7324 7324
         
7325
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7325
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7326 7326
 		{
7327 7327
 			$temp_array['route_count'] = $row['route_count'];
7328 7328
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7350,9 +7350,9 @@  discard block
 block discarded – undo
7350 7350
 	*/
7351 7351
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
7352 7352
 	{
7353
-		$filter_query = $this->getFilter($filters,true,true);
7354
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7355
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7353
+		$filter_query = $this->getFilter($filters, true, true);
7354
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7355
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7356 7356
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao 
7357 7357
 			    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7358 7358
 			    ORDER BY route_count DESC";
@@ -7364,7 +7364,7 @@  discard block
 block discarded – undo
7364 7364
 		$routes_array = array();
7365 7365
 		$temp_array = array();
7366 7366
         
7367
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7367
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7368 7368
 		{
7369 7369
 			$temp_array['route_count'] = $row['route_count'];
7370 7370
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7392,9 +7392,9 @@  discard block
 block discarded – undo
7392 7392
 	*/
7393 7393
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
7394 7394
 	{
7395
-		$filter_query = $this->getFilter($filters,true,true);
7396
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7397
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7395
+		$filter_query = $this->getFilter($filters, true, true);
7396
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7397
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7398 7398
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
7399 7399
 			    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7400 7400
 			    ORDER BY route_count DESC";
@@ -7405,7 +7405,7 @@  discard block
 block discarded – undo
7405 7405
 		$routes_array = array();
7406 7406
 		$temp_array = array();
7407 7407
         
7408
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7408
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7409 7409
 		{
7410 7410
 			$temp_array['route_count'] = $row['route_count'];
7411 7411
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7433,9 +7433,9 @@  discard block
 block discarded – undo
7433 7433
 	*/
7434 7434
 	public function countAllRoutesByCountry($country, $filters = array())
7435 7435
 	{
7436
-		$filter_query = $this->getFilter($filters,true,true);
7437
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7438
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7436
+		$filter_query = $this->getFilter($filters, true, true);
7437
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7438
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7439 7439
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
7440 7440
 			    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7441 7441
 			    ORDER BY route_count DESC";
@@ -7446,7 +7446,7 @@  discard block
 block discarded – undo
7446 7446
 		$routes_array = array();
7447 7447
 		$temp_array = array();
7448 7448
         
7449
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7449
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7450 7450
 		{
7451 7451
 			$temp_array['route_count'] = $row['route_count'];
7452 7452
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7474,8 +7474,8 @@  discard block
 block discarded – undo
7474 7474
 	public function countAllRoutesByDate($date, $filters = array())
7475 7475
 	{
7476 7476
 		global $globalTimezone, $globalDBdriver;
7477
-		$filter_query = $this->getFilter($filters,true,true);
7478
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7477
+		$filter_query = $this->getFilter($filters, true, true);
7478
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7479 7479
 		if ($globalTimezone != '') {
7480 7480
 			date_default_timezone_set($globalTimezone);
7481 7481
 			$datetime = new DateTime($date);
@@ -7483,12 +7483,12 @@  discard block
 block discarded – undo
7483 7483
 		} else $offset = '+00:00';
7484 7484
 		
7485 7485
 		if ($globalDBdriver == 'mysql') {
7486
-			$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7486
+			$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7487 7487
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
7488 7488
 				    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7489 7489
 				    ORDER BY route_count DESC";
7490 7490
 		} else {
7491
-			$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7491
+			$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7492 7492
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
7493 7493
 				    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7494 7494
 				    ORDER BY route_count DESC";
@@ -7500,7 +7500,7 @@  discard block
 block discarded – undo
7500 7500
 		$routes_array = array();
7501 7501
 		$temp_array = array();
7502 7502
         
7503
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7503
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7504 7504
 		{
7505 7505
 			$temp_array['route_count'] = $row['route_count'];
7506 7506
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7527,9 +7527,9 @@  discard block
 block discarded – undo
7527 7527
 	*/
7528 7528
 	public function countAllRoutesByIdent($ident, $filters = array())
7529 7529
 	{
7530
-		$filter_query = $this->getFilter($filters,true,true);
7531
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7532
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7530
+		$filter_query = $this->getFilter($filters, true, true);
7531
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7532
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7533 7533
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.ident = :ident   
7534 7534
                     GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7535 7535
                     ORDER BY route_count DESC";
@@ -7541,7 +7541,7 @@  discard block
 block discarded – undo
7541 7541
 		$routes_array = array();
7542 7542
 		$temp_array = array();
7543 7543
         
7544
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7544
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7545 7545
 		{
7546 7546
 			$temp_array['route_count'] = $row['route_count'];
7547 7547
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7568,9 +7568,9 @@  discard block
 block discarded – undo
7568 7568
 	*/
7569 7569
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
7570 7570
 	{
7571
-		$filter_query = $this->getFilter($filters,true,true);
7572
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7573
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7571
+		$filter_query = $this->getFilter($filters, true, true);
7572
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7573
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7574 7574
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
7575 7575
                     GROUP BY route
7576 7576
                     ORDER BY route_count DESC";
@@ -7582,7 +7582,7 @@  discard block
 block discarded – undo
7582 7582
 		$routes_array = array();
7583 7583
 		$temp_array = array();
7584 7584
         
7585
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7585
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7586 7586
 		{
7587 7587
 			$temp_array['route_count'] = $row['route_count'];
7588 7588
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7610,8 +7610,8 @@  discard block
 block discarded – undo
7610 7610
 	*/
7611 7611
 	public function countAllRoutesWithWaypoints($filters = array())
7612 7612
 	{
7613
-		$filter_query = $this->getFilter($filters,true,true);
7614
-		$query  = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7613
+		$filter_query = $this->getFilter($filters, true, true);
7614
+		$query = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7615 7615
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.waypoints <> '' 
7616 7616
                     GROUP BY route, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7617 7617
                     ORDER BY route_count DESC
@@ -7624,7 +7624,7 @@  discard block
 block discarded – undo
7624 7624
 		$routes_array = array();
7625 7625
 		$temp_array = array();
7626 7626
         
7627
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7627
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7628 7628
 		{
7629 7629
 			$temp_array['spotter_id'] = $row['spotter_id'];
7630 7630
 			$temp_array['route_count'] = $row['route_count'];
@@ -7649,11 +7649,11 @@  discard block
 block discarded – undo
7649 7649
 	* @return Array the callsign list
7650 7650
 	*
7651 7651
 	*/
7652
-	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
7652
+	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7653 7653
 	{
7654 7654
 		global $globalDBdriver;
7655
-		$filter_query = $this->getFilter($filters,true,true);
7656
-		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7655
+		$filter_query = $this->getFilter($filters, true, true);
7656
+		$query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7657 7657
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
7658 7658
 		 if ($olderthanmonths > 0) {
7659 7659
 			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
@@ -7672,7 +7672,7 @@  discard block
 block discarded – undo
7672 7672
 		$callsign_array = array();
7673 7673
 		$temp_array = array();
7674 7674
         
7675
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7675
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7676 7676
 		{
7677 7677
 			$temp_array['callsign_icao'] = $row['ident'];
7678 7678
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -7694,8 +7694,8 @@  discard block
 block discarded – undo
7694 7694
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7695 7695
 	{
7696 7696
 		global $globalDBdriver;
7697
-		$filter_query = $this->getFilter($filters,true,true);
7698
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7697
+		$filter_query = $this->getFilter($filters, true, true);
7698
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7699 7699
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
7700 7700
 		 if ($olderthanmonths > 0) {
7701 7701
 			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
@@ -7714,7 +7714,7 @@  discard block
 block discarded – undo
7714 7714
 		$callsign_array = array();
7715 7715
 		$temp_array = array();
7716 7716
         
7717
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7717
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7718 7718
 		{
7719 7719
 			$temp_array['callsign_icao'] = $row['ident'];
7720 7720
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -7768,7 +7768,7 @@  discard block
 block discarded – undo
7768 7768
 		$date_array = array();
7769 7769
 		$temp_array = array();
7770 7770
         
7771
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7771
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7772 7772
 		{
7773 7773
 			$temp_array['date_name'] = $row['date_name'];
7774 7774
 			$temp_array['date_count'] = $row['date_count'];
@@ -7793,15 +7793,15 @@  discard block
 block discarded – undo
7793 7793
 			$datetime = new DateTime();
7794 7794
 			$offset = $datetime->format('P');
7795 7795
 		} else $offset = '+00:00';
7796
-		$filter_query = $this->getFilter($filters,true,true);
7796
+		$filter_query = $this->getFilter($filters, true, true);
7797 7797
 		if ($globalDBdriver == 'mysql') {
7798
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7798
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7799 7799
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
7800 7800
 								GROUP BY spotter_output.airline_icao, date_name 
7801 7801
 								ORDER BY date_count DESC
7802 7802
 								LIMIT 10 OFFSET 0";
7803 7803
 		} else {
7804
-			$query  = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
7804
+			$query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
7805 7805
 								FROM spotter_output 
7806 7806
 								WHERE spotter_output.airline_icao <> '' 
7807 7807
 								GROUP BY spotter_output.airline_icao, date_name 
@@ -7816,7 +7816,7 @@  discard block
 block discarded – undo
7816 7816
 		$date_array = array();
7817 7817
 		$temp_array = array();
7818 7818
         
7819
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7819
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7820 7820
 		{
7821 7821
 			$temp_array['date_name'] = $row['date_name'];
7822 7822
 			$temp_array['date_count'] = $row['date_count'];
@@ -7842,7 +7842,7 @@  discard block
 block discarded – undo
7842 7842
 			$datetime = new DateTime();
7843 7843
 			$offset = $datetime->format('P');
7844 7844
 		} else $offset = '+00:00';
7845
-		$filter_query = $this->getFilter($filters,true,true);
7845
+		$filter_query = $this->getFilter($filters, true, true);
7846 7846
 		if ($globalDBdriver == 'mysql') {
7847 7847
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7848 7848
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -7863,7 +7863,7 @@  discard block
 block discarded – undo
7863 7863
 		$date_array = array();
7864 7864
 		$temp_array = array();
7865 7865
         
7866
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7866
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7867 7867
 		{
7868 7868
 			$temp_array['date_name'] = $row['date_name'];
7869 7869
 			$temp_array['date_count'] = $row['date_count'];
@@ -7888,7 +7888,7 @@  discard block
 block discarded – undo
7888 7888
 			$datetime = new DateTime();
7889 7889
 			$offset = $datetime->format('P');
7890 7890
 		} else $offset = '+00:00';
7891
-		$filter_query = $this->getFilter($filters,true,true);
7891
+		$filter_query = $this->getFilter($filters, true, true);
7892 7892
 		if ($globalDBdriver == 'mysql') {
7893 7893
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7894 7894
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)";
@@ -7909,7 +7909,7 @@  discard block
 block discarded – undo
7909 7909
 		$date_array = array();
7910 7910
 		$temp_array = array();
7911 7911
         
7912
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7912
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7913 7913
 		{
7914 7914
 			$temp_array['date_name'] = $row['date_name'];
7915 7915
 			$temp_array['date_count'] = $row['date_count'];
@@ -7930,7 +7930,7 @@  discard block
 block discarded – undo
7930 7930
 	public function countAllDatesLastMonthByAirlines($filters = array())
7931 7931
 	{
7932 7932
 		global $globalTimezone, $globalDBdriver;
7933
-		$filter_query = $this->getFilter($filters,true,true);
7933
+		$filter_query = $this->getFilter($filters, true, true);
7934 7934
 		if ($globalTimezone != '') {
7935 7935
 			date_default_timezone_set($globalTimezone);
7936 7936
 			$datetime = new DateTime();
@@ -7938,13 +7938,13 @@  discard block
 block discarded – undo
7938 7938
 		} else $offset = '+00:00';
7939 7939
 		
7940 7940
 		if ($globalDBdriver == 'mysql') {
7941
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7941
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7942 7942
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)
7943 7943
 								GROUP BY spotter_output.airline_icao, date_name 
7944 7944
 								ORDER BY spotter_output.date ASC";
7945 7945
 			$query_data = array(':offset' => $offset);
7946 7946
 		} else {
7947
-			$query  = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
7947
+			$query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
7948 7948
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS'
7949 7949
 								GROUP BY spotter_output.airline_icao, date_name 
7950 7950
 								ORDER BY date_name ASC";
@@ -7957,7 +7957,7 @@  discard block
 block discarded – undo
7957 7957
 		$date_array = array();
7958 7958
 		$temp_array = array();
7959 7959
         
7960
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7960
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7961 7961
 		{
7962 7962
 			$temp_array['date_name'] = $row['date_name'];
7963 7963
 			$temp_array['date_count'] = $row['date_count'];
@@ -8004,7 +8004,7 @@  discard block
 block discarded – undo
8004 8004
 		$date_array = array();
8005 8005
 		$temp_array = array();
8006 8006
         
8007
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8007
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8008 8008
 		{
8009 8009
 			$temp_array['month_name'] = $row['month_name'];
8010 8010
 			$temp_array['year_name'] = $row['year_name'];
@@ -8025,7 +8025,7 @@  discard block
 block discarded – undo
8025 8025
 	public function countAllMonthsByAirlines($filters = array())
8026 8026
 	{
8027 8027
 		global $globalTimezone, $globalDBdriver;
8028
-		$filter_query = $this->getFilter($filters,true,true);
8028
+		$filter_query = $this->getFilter($filters, true, true);
8029 8029
 		if ($globalTimezone != '') {
8030 8030
 			date_default_timezone_set($globalTimezone);
8031 8031
 			$datetime = new DateTime();
@@ -8033,12 +8033,12 @@  discard block
 block discarded – undo
8033 8033
 		} else $offset = '+00:00';
8034 8034
 
8035 8035
 		if ($globalDBdriver == 'mysql') {
8036
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
8036
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
8037 8037
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8038 8038
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
8039 8039
 								ORDER BY date_count DESC";
8040 8040
 		} else {
8041
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
8041
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
8042 8042
 								FROM spotter_output 
8043 8043
 								WHERE spotter_output.airline_icao <> '' 
8044 8044
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
@@ -8052,7 +8052,7 @@  discard block
 block discarded – undo
8052 8052
 		$date_array = array();
8053 8053
 		$temp_array = array();
8054 8054
         
8055
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8055
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8056 8056
 		{
8057 8057
 			$temp_array['month_name'] = $row['month_name'];
8058 8058
 			$temp_array['year_name'] = $row['year_name'];
@@ -8079,14 +8079,14 @@  discard block
 block discarded – undo
8079 8079
 			$datetime = new DateTime();
8080 8080
 			$offset = $datetime->format('P');
8081 8081
 		} else $offset = '+00:00';
8082
-		$filter_query = $this->getFilter($filters,true,true);
8082
+		$filter_query = $this->getFilter($filters, true, true);
8083 8083
 		if ($globalDBdriver == 'mysql') {
8084
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
8084
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
8085 8085
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
8086 8086
 								GROUP BY year_name, month_name 
8087 8087
 								ORDER BY date_count DESC";
8088 8088
 		} else {
8089
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
8089
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
8090 8090
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
8091 8091
 								GROUP BY year_name, month_name 
8092 8092
 								ORDER BY date_count DESC";
@@ -8098,7 +8098,7 @@  discard block
 block discarded – undo
8098 8098
 		$date_array = array();
8099 8099
 		$temp_array = array();
8100 8100
         
8101
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8101
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8102 8102
 		{
8103 8103
 			$temp_array['month_name'] = $row['month_name'];
8104 8104
 			$temp_array['year_name'] = $row['year_name'];
@@ -8124,15 +8124,15 @@  discard block
 block discarded – undo
8124 8124
 			$datetime = new DateTime();
8125 8125
 			$offset = $datetime->format('P');
8126 8126
 		} else $offset = '+00:00';
8127
-		$filter_query = $this->getFilter($filters,true,true);
8127
+		$filter_query = $this->getFilter($filters, true, true);
8128 8128
 
8129 8129
 		if ($globalDBdriver == 'mysql') {
8130
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
8130
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
8131 8131
 								FROM spotter_output".$filter_query." owner_name <> ''
8132 8132
 								GROUP BY year_name, month_name
8133 8133
 								ORDER BY date_count DESC";
8134 8134
 		} else {
8135
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
8135
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
8136 8136
 								FROM spotter_output".$filter_query." owner_name <> ''
8137 8137
 								GROUP BY year_name, month_name
8138 8138
 								ORDER BY date_count DESC";
@@ -8144,7 +8144,7 @@  discard block
 block discarded – undo
8144 8144
 		$date_array = array();
8145 8145
 		$temp_array = array();
8146 8146
         
8147
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8147
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8148 8148
 		{
8149 8149
 			$temp_array['month_name'] = $row['month_name'];
8150 8150
 			$temp_array['year_name'] = $row['year_name'];
@@ -8165,7 +8165,7 @@  discard block
 block discarded – undo
8165 8165
 	public function countAllMonthsOwnersByAirlines($filters = array())
8166 8166
 	{
8167 8167
 		global $globalTimezone, $globalDBdriver;
8168
-		$filter_query = $this->getFilter($filters,true,true);
8168
+		$filter_query = $this->getFilter($filters, true, true);
8169 8169
 		if ($globalTimezone != '') {
8170 8170
 			date_default_timezone_set($globalTimezone);
8171 8171
 			$datetime = new DateTime();
@@ -8173,12 +8173,12 @@  discard block
 block discarded – undo
8173 8173
 		} else $offset = '+00:00';
8174 8174
 
8175 8175
 		if ($globalDBdriver == 'mysql') {
8176
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
8176
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
8177 8177
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
8178 8178
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8179 8179
 								ORDER BY date_count DESC";
8180 8180
 		} else {
8181
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
8181
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
8182 8182
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
8183 8183
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8184 8184
 								ORDER BY date_count DESC";
@@ -8190,7 +8190,7 @@  discard block
 block discarded – undo
8190 8190
 		$date_array = array();
8191 8191
 		$temp_array = array();
8192 8192
         
8193
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8193
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8194 8194
 		{
8195 8195
 			$temp_array['month_name'] = $row['month_name'];
8196 8196
 			$temp_array['year_name'] = $row['year_name'];
@@ -8217,15 +8217,15 @@  discard block
 block discarded – undo
8217 8217
 			$datetime = new DateTime();
8218 8218
 			$offset = $datetime->format('P');
8219 8219
 		} else $offset = '+00:00';
8220
-		$filter_query = $this->getFilter($filters,true,true);
8220
+		$filter_query = $this->getFilter($filters, true, true);
8221 8221
 
8222 8222
 		if ($globalDBdriver == 'mysql') {
8223
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
8223
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
8224 8224
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
8225 8225
 								GROUP BY year_name, month_name
8226 8226
 								ORDER BY date_count DESC";
8227 8227
 		} else {
8228
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
8228
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
8229 8229
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
8230 8230
 								GROUP BY year_name, month_name
8231 8231
 								ORDER BY date_count DESC";
@@ -8237,7 +8237,7 @@  discard block
 block discarded – undo
8237 8237
 		$date_array = array();
8238 8238
 		$temp_array = array();
8239 8239
         
8240
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8240
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8241 8241
 		{
8242 8242
 			$temp_array['month_name'] = $row['month_name'];
8243 8243
 			$temp_array['year_name'] = $row['year_name'];
@@ -8258,7 +8258,7 @@  discard block
 block discarded – undo
8258 8258
 	public function countAllMonthsPilotsByAirlines($filters = array())
8259 8259
 	{
8260 8260
 		global $globalTimezone, $globalDBdriver;
8261
-		$filter_query = $this->getFilter($filters,true,true);
8261
+		$filter_query = $this->getFilter($filters, true, true);
8262 8262
 		if ($globalTimezone != '') {
8263 8263
 			date_default_timezone_set($globalTimezone);
8264 8264
 			$datetime = new DateTime();
@@ -8266,12 +8266,12 @@  discard block
 block discarded – undo
8266 8266
 		} else $offset = '+00:00';
8267 8267
 
8268 8268
 		if ($globalDBdriver == 'mysql') {
8269
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
8269
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
8270 8270
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
8271 8271
 								GROUP BY spotter_output.airline_icao,year_name, month_name
8272 8272
 								ORDER BY date_count DESC";
8273 8273
 		} else {
8274
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
8274
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
8275 8275
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
8276 8276
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8277 8277
 								ORDER BY date_count DESC";
@@ -8283,7 +8283,7 @@  discard block
 block discarded – undo
8283 8283
 		$date_array = array();
8284 8284
 		$temp_array = array();
8285 8285
         
8286
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8286
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8287 8287
 		{
8288 8288
 			$temp_array['month_name'] = $row['month_name'];
8289 8289
 			$temp_array['year_name'] = $row['year_name'];
@@ -8305,7 +8305,7 @@  discard block
 block discarded – undo
8305 8305
 	public function countAllMonthsAirlines($filters = array())
8306 8306
 	{
8307 8307
 		global $globalTimezone, $globalDBdriver;
8308
-		$filter_query = $this->getFilter($filters,true,true);
8308
+		$filter_query = $this->getFilter($filters, true, true);
8309 8309
 		if ($globalTimezone != '') {
8310 8310
 			date_default_timezone_set($globalTimezone);
8311 8311
 			$datetime = new DateTime();
@@ -8313,12 +8313,12 @@  discard block
 block discarded – undo
8313 8313
 		} else $offset = '+00:00';
8314 8314
 
8315 8315
 		if ($globalDBdriver == 'mysql') {
8316
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count
8316
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count
8317 8317
 								FROM spotter_output".$filter_query." airline_icao <> '' 
8318 8318
 								GROUP BY year_name, month_name
8319 8319
 								ORDER BY date_count DESC";
8320 8320
 		} else {
8321
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count
8321
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count
8322 8322
 								FROM spotter_output".$filter_query." airline_icao <> '' 
8323 8323
 								GROUP BY year_name, month_name
8324 8324
 								ORDER BY date_count DESC";
@@ -8330,7 +8330,7 @@  discard block
 block discarded – undo
8330 8330
 		$date_array = array();
8331 8331
 		$temp_array = array();
8332 8332
         
8333
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8333
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8334 8334
 		{
8335 8335
 			$temp_array['month_name'] = $row['month_name'];
8336 8336
 			$temp_array['year_name'] = $row['year_name'];
@@ -8356,15 +8356,15 @@  discard block
 block discarded – undo
8356 8356
 			$datetime = new DateTime();
8357 8357
 			$offset = $datetime->format('P');
8358 8358
 		} else $offset = '+00:00';
8359
-		$filter_query = $this->getFilter($filters,true,true);
8359
+		$filter_query = $this->getFilter($filters, true, true);
8360 8360
 
8361 8361
 		if ($globalDBdriver == 'mysql') {
8362
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
8362
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
8363 8363
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
8364 8364
 								GROUP BY year_name, month_name
8365 8365
 								ORDER BY date_count DESC";
8366 8366
 		} else {
8367
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
8367
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
8368 8368
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
8369 8369
 								GROUP BY year_name, month_name
8370 8370
 								ORDER BY date_count DESC";
@@ -8376,7 +8376,7 @@  discard block
 block discarded – undo
8376 8376
 		$date_array = array();
8377 8377
 		$temp_array = array();
8378 8378
         
8379
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8379
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8380 8380
 		{
8381 8381
 			$temp_array['month_name'] = $row['month_name'];
8382 8382
 			$temp_array['year_name'] = $row['year_name'];
@@ -8398,7 +8398,7 @@  discard block
 block discarded – undo
8398 8398
 	public function countAllMonthsAircraftsByAirlines($filters = array())
8399 8399
 	{
8400 8400
 		global $globalTimezone, $globalDBdriver;
8401
-		$filter_query = $this->getFilter($filters,true,true);
8401
+		$filter_query = $this->getFilter($filters, true, true);
8402 8402
 		if ($globalTimezone != '') {
8403 8403
 			date_default_timezone_set($globalTimezone);
8404 8404
 			$datetime = new DateTime();
@@ -8406,12 +8406,12 @@  discard block
 block discarded – undo
8406 8406
 		} else $offset = '+00:00';
8407 8407
 
8408 8408
 		if ($globalDBdriver == 'mysql') {
8409
-			$query  = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
8409
+			$query = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
8410 8410
 								FROM spotter_output".$filter_query." aircraft_icao <> ''  AND spotter_output.airline_icao <> '' 
8411 8411
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8412 8412
 								ORDER BY date_count DESC";
8413 8413
 		} else {
8414
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
8414
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
8415 8415
 								FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' 
8416 8416
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8417 8417
 								ORDER BY date_count DESC";
@@ -8423,7 +8423,7 @@  discard block
 block discarded – undo
8423 8423
 		$date_array = array();
8424 8424
 		$temp_array = array();
8425 8425
         
8426
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8426
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8427 8427
 		{
8428 8428
 			$temp_array['month_name'] = $row['month_name'];
8429 8429
 			$temp_array['year_name'] = $row['year_name'];
@@ -8450,15 +8450,15 @@  discard block
 block discarded – undo
8450 8450
 			$datetime = new DateTime();
8451 8451
 			$offset = $datetime->format('P');
8452 8452
 		} else $offset = '+00:00';
8453
-		$filter_query = $this->getFilter($filters,true,true);
8453
+		$filter_query = $this->getFilter($filters, true, true);
8454 8454
 
8455 8455
 		if ($globalDBdriver == 'mysql') {
8456
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
8456
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
8457 8457
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
8458 8458
 								GROUP BY year_name, month_name
8459 8459
 								ORDER BY date_count DESC";
8460 8460
 		} else {
8461
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
8461
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
8462 8462
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
8463 8463
 								GROUP BY year_name, month_name
8464 8464
 								ORDER BY date_count DESC";
@@ -8470,7 +8470,7 @@  discard block
 block discarded – undo
8470 8470
 		$date_array = array();
8471 8471
 		$temp_array = array();
8472 8472
         
8473
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8473
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8474 8474
 		{
8475 8475
 			$temp_array['month_name'] = $row['month_name'];
8476 8476
 			$temp_array['year_name'] = $row['year_name'];
@@ -8492,7 +8492,7 @@  discard block
 block discarded – undo
8492 8492
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
8493 8493
 	{
8494 8494
 		global $globalTimezone, $globalDBdriver;
8495
-		$filter_query = $this->getFilter($filters,true,true);
8495
+		$filter_query = $this->getFilter($filters, true, true);
8496 8496
 		if ($globalTimezone != '') {
8497 8497
 			date_default_timezone_set($globalTimezone);
8498 8498
 			$datetime = new DateTime();
@@ -8500,12 +8500,12 @@  discard block
 block discarded – undo
8500 8500
 		} else $offset = '+00:00';
8501 8501
 
8502 8502
 		if ($globalDBdriver == 'mysql') {
8503
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
8503
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
8504 8504
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
8505 8505
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8506 8506
 								ORDER BY date_count DESC";
8507 8507
 		} else {
8508
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
8508
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
8509 8509
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
8510 8510
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8511 8511
 								ORDER BY date_count DESC";
@@ -8517,7 +8517,7 @@  discard block
 block discarded – undo
8517 8517
 		$date_array = array();
8518 8518
 		$temp_array = array();
8519 8519
         
8520
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8520
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8521 8521
 		{
8522 8522
 			$temp_array['month_name'] = $row['month_name'];
8523 8523
 			$temp_array['year_name'] = $row['year_name'];
@@ -8545,7 +8545,7 @@  discard block
 block discarded – undo
8545 8545
 			$datetime = new DateTime();
8546 8546
 			$offset = $datetime->format('P');
8547 8547
 		} else $offset = '+00:00';
8548
-		$filter_query = $this->getFilter($filters,true,true);
8548
+		$filter_query = $this->getFilter($filters, true, true);
8549 8549
 		if ($globalDBdriver == 'mysql') {
8550 8550
 			$query  = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count
8551 8551
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
@@ -8566,7 +8566,7 @@  discard block
 block discarded – undo
8566 8566
 		$date_array = array();
8567 8567
 		$temp_array = array();
8568 8568
         
8569
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8569
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8570 8570
 		{
8571 8571
 			$temp_array['year_name'] = $row['year_name'];
8572 8572
 			$temp_array['month_name'] = $row['month_name'];
@@ -8586,7 +8586,7 @@  discard block
 block discarded – undo
8586 8586
 	* @return Array the hour list
8587 8587
 	*
8588 8588
 	*/
8589
-	public function countAllHours($orderby,$filters = array())
8589
+	public function countAllHours($orderby, $filters = array())
8590 8590
 	{
8591 8591
 		global $globalTimezone, $globalDBdriver;
8592 8592
 		if ($globalTimezone != '') {
@@ -8634,7 +8634,7 @@  discard block
 block discarded – undo
8634 8634
 		$hour_array = array();
8635 8635
 		$temp_array = array();
8636 8636
         
8637
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8637
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8638 8638
 		{
8639 8639
 			$temp_array['hour_name'] = $row['hour_name'];
8640 8640
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8654,7 +8654,7 @@  discard block
 block discarded – undo
8654 8654
 	public function countAllHoursByAirlines($orderby, $filters = array())
8655 8655
 	{
8656 8656
 		global $globalTimezone, $globalDBdriver;
8657
-		$filter_query = $this->getFilter($filters,true,true);
8657
+		$filter_query = $this->getFilter($filters, true, true);
8658 8658
 		if ($globalTimezone != '') {
8659 8659
 			date_default_timezone_set($globalTimezone);
8660 8660
 			$datetime = new DateTime();
@@ -8672,7 +8672,7 @@  discard block
 block discarded – undo
8672 8672
 		}
8673 8673
 		
8674 8674
 		if ($globalDBdriver == 'mysql') {
8675
-			$query  = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8675
+			$query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8676 8676
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8677 8677
 								GROUP BY spotter_output.airline_icao, hour_name 
8678 8678
 								".$orderby_sql;
@@ -8685,7 +8685,7 @@  discard block
 block discarded – undo
8685 8685
   */    
8686 8686
 		$query_data = array(':offset' => $offset);
8687 8687
 		} else {
8688
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8688
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8689 8689
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8690 8690
 								GROUP BY spotter_output.airline_icao, hour_name 
8691 8691
 								".$orderby_sql;
@@ -8698,7 +8698,7 @@  discard block
 block discarded – undo
8698 8698
 		$hour_array = array();
8699 8699
 		$temp_array = array();
8700 8700
         
8701
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8701
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8702 8702
 		{
8703 8703
 			$temp_array['hour_name'] = $row['hour_name'];
8704 8704
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8721,34 +8721,34 @@  discard block
 block discarded – undo
8721 8721
 	public function countAllHoursByAirline($airline_icao, $filters = array())
8722 8722
 	{
8723 8723
 		global $globalTimezone, $globalDBdriver;
8724
-		$filter_query = $this->getFilter($filters,true,true);
8724
+		$filter_query = $this->getFilter($filters, true, true);
8725 8725
 		if ($globalTimezone != '') {
8726 8726
 			date_default_timezone_set($globalTimezone);
8727 8727
 			$datetime = new DateTime();
8728 8728
 			$offset = $datetime->format('P');
8729 8729
 		} else $offset = '+00:00';
8730 8730
 
8731
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8731
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
8732 8732
 
8733 8733
 		if ($globalDBdriver == 'mysql') {
8734
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8734
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8735 8735
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
8736 8736
 								GROUP BY hour_name 
8737 8737
 								ORDER BY hour_name ASC";
8738 8738
 		} else {
8739
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8739
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8740 8740
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
8741 8741
 								GROUP BY hour_name 
8742 8742
 								ORDER BY hour_name ASC";
8743 8743
 		}
8744 8744
 		
8745 8745
 		$sth = $this->db->prepare($query);
8746
-		$sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset));
8746
+		$sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset));
8747 8747
       
8748 8748
 		$hour_array = array();
8749 8749
 		$temp_array = array();
8750 8750
         
8751
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8751
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8752 8752
 		{
8753 8753
 			$temp_array['hour_name'] = $row['hour_name'];
8754 8754
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8771,8 +8771,8 @@  discard block
 block discarded – undo
8771 8771
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
8772 8772
 	{
8773 8773
 		global $globalTimezone, $globalDBdriver;
8774
-		$filter_query = $this->getFilter($filters,true,true);
8775
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
8774
+		$filter_query = $this->getFilter($filters, true, true);
8775
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
8776 8776
 		if ($globalTimezone != '') {
8777 8777
 			date_default_timezone_set($globalTimezone);
8778 8778
 			$datetime = new DateTime();
@@ -8780,24 +8780,24 @@  discard block
 block discarded – undo
8780 8780
 		} else $offset = '+00:00';
8781 8781
 
8782 8782
 		if ($globalDBdriver == 'mysql') {
8783
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8783
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8784 8784
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
8785 8785
 								GROUP BY hour_name 
8786 8786
 								ORDER BY hour_name ASC";
8787 8787
 		} else {
8788
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8788
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8789 8789
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
8790 8790
 								GROUP BY hour_name 
8791 8791
 								ORDER BY hour_name ASC";
8792 8792
 		}
8793 8793
 		
8794 8794
 		$sth = $this->db->prepare($query);
8795
-		$sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset));
8795
+		$sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset));
8796 8796
       
8797 8797
 		$hour_array = array();
8798 8798
 		$temp_array = array();
8799 8799
         
8800
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8800
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8801 8801
 		{
8802 8802
 			$temp_array['hour_name'] = $row['hour_name'];
8803 8803
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8818,8 +8818,8 @@  discard block
 block discarded – undo
8818 8818
 	public function countAllHoursByRegistration($registration, $filters = array())
8819 8819
 	{
8820 8820
 		global $globalTimezone, $globalDBdriver;
8821
-		$filter_query = $this->getFilter($filters,true,true);
8822
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
8821
+		$filter_query = $this->getFilter($filters, true, true);
8822
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8823 8823
 		if ($globalTimezone != '') {
8824 8824
 			date_default_timezone_set($globalTimezone);
8825 8825
 			$datetime = new DateTime();
@@ -8827,24 +8827,24 @@  discard block
 block discarded – undo
8827 8827
 		} else $offset = '+00:00';
8828 8828
 
8829 8829
 		if ($globalDBdriver == 'mysql') {
8830
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8830
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8831 8831
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
8832 8832
 								GROUP BY hour_name 
8833 8833
 								ORDER BY hour_name ASC";
8834 8834
 		} else {
8835
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8835
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8836 8836
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
8837 8837
 								GROUP BY hour_name 
8838 8838
 								ORDER BY hour_name ASC";
8839 8839
 		}
8840 8840
 		
8841 8841
 		$sth = $this->db->prepare($query);
8842
-		$sth->execute(array(':registration' => $registration,':offset' => $offset));
8842
+		$sth->execute(array(':registration' => $registration, ':offset' => $offset));
8843 8843
       
8844 8844
 		$hour_array = array();
8845 8845
 		$temp_array = array();
8846 8846
         
8847
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8847
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8848 8848
 		{
8849 8849
 			$temp_array['hour_name'] = $row['hour_name'];
8850 8850
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8865,8 +8865,8 @@  discard block
 block discarded – undo
8865 8865
 	public function countAllHoursByAirport($airport_icao, $filters = array())
8866 8866
 	{
8867 8867
 		global $globalTimezone, $globalDBdriver;
8868
-		$filter_query = $this->getFilter($filters,true,true);
8869
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8868
+		$filter_query = $this->getFilter($filters, true, true);
8869
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8870 8870
 		if ($globalTimezone != '') {
8871 8871
 			date_default_timezone_set($globalTimezone);
8872 8872
 			$datetime = new DateTime();
@@ -8874,24 +8874,24 @@  discard block
 block discarded – undo
8874 8874
 		} else $offset = '+00:00';
8875 8875
 
8876 8876
 		if ($globalDBdriver == 'mysql') {
8877
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8877
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8878 8878
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
8879 8879
 								GROUP BY hour_name 
8880 8880
 								ORDER BY hour_name ASC";
8881 8881
 		} else {
8882
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8882
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8883 8883
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
8884 8884
 								GROUP BY hour_name 
8885 8885
 								ORDER BY hour_name ASC";
8886 8886
 		}
8887 8887
 		
8888 8888
 		$sth = $this->db->prepare($query);
8889
-		$sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset));
8889
+		$sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset));
8890 8890
       
8891 8891
 		$hour_array = array();
8892 8892
 		$temp_array = array();
8893 8893
         
8894
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8894
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8895 8895
 		{
8896 8896
 			$temp_array['hour_name'] = $row['hour_name'];
8897 8897
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8910,11 +8910,11 @@  discard block
 block discarded – undo
8910 8910
 	* @return Array the hour list
8911 8911
 	*
8912 8912
 	*/
8913
-	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
8913
+	public function countAllHoursByManufacturer($aircraft_manufacturer, $filters = array())
8914 8914
 	{
8915 8915
 		global $globalTimezone, $globalDBdriver;
8916
-		$filter_query = $this->getFilter($filters,true,true);
8917
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
8916
+		$filter_query = $this->getFilter($filters, true, true);
8917
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
8918 8918
 		if ($globalTimezone != '') {
8919 8919
 			date_default_timezone_set($globalTimezone);
8920 8920
 			$datetime = new DateTime();
@@ -8922,24 +8922,24 @@  discard block
 block discarded – undo
8922 8922
 		} else $offset = '+00:00';
8923 8923
 
8924 8924
 		if ($globalDBdriver == 'mysql') {
8925
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8925
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8926 8926
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
8927 8927
 								GROUP BY hour_name 
8928 8928
 								ORDER BY hour_name ASC";
8929 8929
 		} else {
8930
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8930
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8931 8931
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
8932 8932
 								GROUP BY hour_name 
8933 8933
 								ORDER BY hour_name ASC";
8934 8934
 		}
8935 8935
 		
8936 8936
 		$sth = $this->db->prepare($query);
8937
-		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset));
8937
+		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset));
8938 8938
       
8939 8939
 		$hour_array = array();
8940 8940
 		$temp_array = array();
8941 8941
         
8942
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8942
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8943 8943
 		{
8944 8944
 			$temp_array['hour_name'] = $row['hour_name'];
8945 8945
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8961,8 +8961,8 @@  discard block
 block discarded – undo
8961 8961
 	public function countAllHoursByDate($date, $filters = array())
8962 8962
 	{
8963 8963
 		global $globalTimezone, $globalDBdriver;
8964
-		$filter_query = $this->getFilter($filters,true,true);
8965
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
8964
+		$filter_query = $this->getFilter($filters, true, true);
8965
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
8966 8966
 		if ($globalTimezone != '') {
8967 8967
 			date_default_timezone_set($globalTimezone);
8968 8968
 			$datetime = new DateTime($date);
@@ -8970,12 +8970,12 @@  discard block
 block discarded – undo
8970 8970
 		} else $offset = '+00:00';
8971 8971
 
8972 8972
 		if ($globalDBdriver == 'mysql') {
8973
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8973
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8974 8974
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
8975 8975
 								GROUP BY hour_name 
8976 8976
 								ORDER BY hour_name ASC";
8977 8977
 		} else {
8978
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8978
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8979 8979
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date
8980 8980
 								GROUP BY hour_name 
8981 8981
 								ORDER BY hour_name ASC";
@@ -8987,7 +8987,7 @@  discard block
 block discarded – undo
8987 8987
 		$hour_array = array();
8988 8988
 		$temp_array = array();
8989 8989
         
8990
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8990
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8991 8991
 		{
8992 8992
 			$temp_array['hour_name'] = $row['hour_name'];
8993 8993
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9009,8 +9009,8 @@  discard block
 block discarded – undo
9009 9009
 	public function countAllHoursByIdent($ident, $filters = array())
9010 9010
 	{
9011 9011
 		global $globalTimezone, $globalDBdriver;
9012
-		$filter_query = $this->getFilter($filters,true,true);
9013
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
9012
+		$filter_query = $this->getFilter($filters, true, true);
9013
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
9014 9014
 		if ($globalTimezone != '') {
9015 9015
 			date_default_timezone_set($globalTimezone);
9016 9016
 			$datetime = new DateTime();
@@ -9018,12 +9018,12 @@  discard block
 block discarded – undo
9018 9018
 		} else $offset = '+00:00';
9019 9019
 
9020 9020
 		if ($globalDBdriver == 'mysql') {
9021
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9021
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9022 9022
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
9023 9023
 								GROUP BY hour_name 
9024 9024
 								ORDER BY hour_name ASC";
9025 9025
 		} else {
9026
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9026
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9027 9027
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
9028 9028
 								GROUP BY hour_name 
9029 9029
 								ORDER BY hour_name ASC";
@@ -9031,12 +9031,12 @@  discard block
 block discarded – undo
9031 9031
       
9032 9032
 		
9033 9033
 		$sth = $this->db->prepare($query);
9034
-		$sth->execute(array(':ident' => $ident,':offset' => $offset));
9034
+		$sth->execute(array(':ident' => $ident, ':offset' => $offset));
9035 9035
       
9036 9036
 		$hour_array = array();
9037 9037
 		$temp_array = array();
9038 9038
         
9039
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9039
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9040 9040
 		{
9041 9041
 			$temp_array['hour_name'] = $row['hour_name'];
9042 9042
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9055,12 +9055,12 @@  discard block
 block discarded – undo
9055 9055
 	* @return Array the hour list
9056 9056
 	*
9057 9057
 	*/
9058
-	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
9058
+	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
9059 9059
 	{
9060 9060
 		global $globalTimezone, $globalDBdriver;
9061
-		$filter_query = $this->getFilter($filters,true,true);
9062
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
9063
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
9061
+		$filter_query = $this->getFilter($filters, true, true);
9062
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
9063
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
9064 9064
 		if ($globalTimezone != '') {
9065 9065
 			date_default_timezone_set($globalTimezone);
9066 9066
 			$datetime = new DateTime();
@@ -9068,24 +9068,24 @@  discard block
 block discarded – undo
9068 9068
 		} else $offset = '+00:00';
9069 9069
 
9070 9070
 		if ($globalDBdriver == 'mysql') {
9071
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9071
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9072 9072
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
9073 9073
 								GROUP BY hour_name 
9074 9074
 								ORDER BY hour_name ASC";
9075 9075
 		} else {
9076
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9076
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9077 9077
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
9078 9078
 								GROUP BY hour_name 
9079 9079
 								ORDER BY hour_name ASC";
9080 9080
 		}
9081 9081
 		
9082 9082
 		$sth = $this->db->prepare($query);
9083
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset));
9083
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset));
9084 9084
       
9085 9085
 		$hour_array = array();
9086 9086
 		$temp_array = array();
9087 9087
         
9088
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9088
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9089 9089
 		{
9090 9090
 			$temp_array['hour_name'] = $row['hour_name'];
9091 9091
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9106,8 +9106,8 @@  discard block
 block discarded – undo
9106 9106
 	public function countAllHoursByCountry($country, $filters = array())
9107 9107
 	{
9108 9108
 		global $globalTimezone, $globalDBdriver;
9109
-		$filter_query = $this->getFilter($filters,true,true);
9110
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
9109
+		$filter_query = $this->getFilter($filters, true, true);
9110
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
9111 9111
 		if ($globalTimezone != '') {
9112 9112
 			date_default_timezone_set($globalTimezone);
9113 9113
 			$datetime = new DateTime();
@@ -9115,24 +9115,24 @@  discard block
 block discarded – undo
9115 9115
 		} else $offset = '+00:00';
9116 9116
 
9117 9117
 		if ($globalDBdriver == 'mysql') {
9118
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9118
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9119 9119
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
9120 9120
 								GROUP BY hour_name 
9121 9121
 								ORDER BY hour_name ASC";
9122 9122
 		} else {
9123
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9123
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9124 9124
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
9125 9125
 								GROUP BY hour_name 
9126 9126
 								ORDER BY hour_name ASC";
9127 9127
 		}
9128 9128
 		
9129 9129
 		$sth = $this->db->prepare($query);
9130
-		$sth->execute(array(':country' => $country,':offset' => $offset));
9130
+		$sth->execute(array(':country' => $country, ':offset' => $offset));
9131 9131
       
9132 9132
 		$hour_array = array();
9133 9133
 		$temp_array = array();
9134 9134
         
9135
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9135
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9136 9136
 		{
9137 9137
 			$temp_array['hour_name'] = $row['hour_name'];
9138 9138
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9154,8 +9154,8 @@  discard block
 block discarded – undo
9154 9154
 	*/
9155 9155
 	public function countOverallAircrafts($filters = array())
9156 9156
 	{
9157
-		$filter_query = $this->getFilter($filters,true,true);
9158
-		$query  = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
9157
+		$filter_query = $this->getFilter($filters, true, true);
9158
+		$query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
9159 9159
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
9160 9160
 		$sth = $this->db->prepare($query);
9161 9161
 		$sth->execute();
@@ -9170,8 +9170,8 @@  discard block
 block discarded – undo
9170 9170
 	*/
9171 9171
 	public function countOverallArrival($filters = array())
9172 9172
 	{
9173
-		$filter_query = $this->getFilter($filters,true,true);
9174
-		$query  = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
9173
+		$filter_query = $this->getFilter($filters, true, true);
9174
+		$query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
9175 9175
                     FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''";
9176 9176
 		
9177 9177
 		$sth = $this->db->prepare($query);
@@ -9187,8 +9187,8 @@  discard block
 block discarded – undo
9187 9187
 	*/
9188 9188
 	public function countOverallPilots($filters = array())
9189 9189
 	{
9190
-		$filter_query = $this->getFilter($filters,true,true);
9191
-		$query  = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
9190
+		$filter_query = $this->getFilter($filters, true, true);
9191
+		$query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
9192 9192
                     FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''";
9193 9193
 		$sth = $this->db->prepare($query);
9194 9194
 		$sth->execute();
@@ -9203,8 +9203,8 @@  discard block
 block discarded – undo
9203 9203
 	*/
9204 9204
 	public function countOverallOwners($filters = array())
9205 9205
 	{
9206
-		$filter_query = $this->getFilter($filters,true,true);
9207
-		$query  = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
9206
+		$filter_query = $this->getFilter($filters, true, true);
9207
+		$query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
9208 9208
                     FROM spotter_output".$filter_query." spotter_output.owner_name <> ''";
9209 9209
 		$sth = $this->db->prepare($query);
9210 9210
 		$sth->execute();
@@ -9237,8 +9237,8 @@  discard block
 block discarded – undo
9237 9237
 	*/
9238 9238
 	public function countOverallMilitaryFlights($filters = array())
9239 9239
 	{
9240
-		$filter_query = $this->getFilter($filters,true,true);
9241
-		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
9240
+		$filter_query = $this->getFilter($filters, true, true);
9241
+		$query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
9242 9242
                     FROM airlines,spotter_output".$filter_query." spotter_output.airline_icao = airlines.icao AND airlines.type = 'military'";
9243 9243
       
9244 9244
 		$sth = $this->db->prepare($query);
@@ -9275,7 +9275,7 @@  discard block
 block discarded – undo
9275 9275
 	public function countAllHoursFromToday($filters = array())
9276 9276
 	{
9277 9277
 		global $globalTimezone, $globalDBdriver;
9278
-		$filter_query = $this->getFilter($filters,true,true);
9278
+		$filter_query = $this->getFilter($filters, true, true);
9279 9279
 		if ($globalTimezone != '') {
9280 9280
 			date_default_timezone_set($globalTimezone);
9281 9281
 			$datetime = new DateTime();
@@ -9283,12 +9283,12 @@  discard block
 block discarded – undo
9283 9283
 		} else $offset = '+00:00';
9284 9284
 
9285 9285
 		if ($globalDBdriver == 'mysql') {
9286
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9286
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9287 9287
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE()
9288 9288
 								GROUP BY hour_name 
9289 9289
 								ORDER BY hour_name ASC";
9290 9290
 		} else {
9291
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9291
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9292 9292
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date)
9293 9293
 								GROUP BY hour_name 
9294 9294
 								ORDER BY hour_name ASC";
@@ -9300,7 +9300,7 @@  discard block
 block discarded – undo
9300 9300
 		$hour_array = array();
9301 9301
 		$temp_array = array();
9302 9302
         
9303
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9303
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9304 9304
 		{
9305 9305
 			$temp_array['hour_name'] = $row['hour_name'];
9306 9306
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9319,14 +9319,14 @@  discard block
 block discarded – undo
9319 9319
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
9320 9320
 	{
9321 9321
 		global $global_query, $globalDBdriver, $globalTimezone;
9322
-		$filter_query = $this->getFilter($filters,true,true);
9322
+		$filter_query = $this->getFilter($filters, true, true);
9323 9323
 		date_default_timezone_set('UTC');
9324 9324
 		$limit_query = '';
9325 9325
 		if ($limit != "")
9326 9326
 		{
9327 9327
 			$limit_array = explode(",", $limit);
9328
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
9329
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
9328
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
9329
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
9330 9330
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
9331 9331
 			{
9332 9332
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
@@ -9379,7 +9379,7 @@  discard block
 block discarded – undo
9379 9379
 			    GROUP BY spotter_output.ident,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time, to_char(spotter_output.date,'HH')
9380 9380
 			    HAVING count(spotter_output.ident) > 5$orderby_query";
9381 9381
 			//echo $query;
9382
-			$spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone));
9382
+			$spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone));
9383 9383
 			/*
9384 9384
 			$sth = $this->db->prepare($query);
9385 9385
 			$sth->execute(array(':timezone' => $globalTimezone));
@@ -9398,9 +9398,9 @@  discard block
 block discarded – undo
9398 9398
 	*/
9399 9399
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
9400 9400
 	{
9401
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
9401
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
9402 9402
 
9403
-		$query  = "SELECT spotter_output.spotter_id
9403
+		$query = "SELECT spotter_output.spotter_id
9404 9404
 								FROM spotter_output 
9405 9405
 								WHERE spotter_output.flightaware_id = '".$flightaware_id."'";
9406 9406
         
@@ -9408,7 +9408,7 @@  discard block
 block discarded – undo
9408 9408
 		$sth = $this->db->prepare($query);
9409 9409
 		$sth->execute();
9410 9410
 
9411
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9411
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9412 9412
 		{
9413 9413
 			return $row['spotter_id'];
9414 9414
 		}
@@ -9433,23 +9433,23 @@  discard block
 block discarded – undo
9433 9433
 		}
9434 9434
 		
9435 9435
 		$current_date = date("Y-m-d H:i:s");
9436
-		$date = date("Y-m-d H:i:s",strtotime($dateString." UTC"));
9436
+		$date = date("Y-m-d H:i:s", strtotime($dateString." UTC"));
9437 9437
 		
9438 9438
 		$diff = abs(strtotime($current_date) - strtotime($date));
9439 9439
 
9440
-		$time_array['years'] = floor($diff / (365*60*60*24)); 
9440
+		$time_array['years'] = floor($diff/(365*60*60*24)); 
9441 9441
 		$years = $time_array['years'];
9442 9442
 		
9443
-		$time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
9443
+		$time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24));
9444 9444
 		$months = $time_array['months'];
9445 9445
 		
9446
-		$time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
9446
+		$time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24));
9447 9447
 		$days = $time_array['days'];
9448
-		$time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60));
9448
+		$time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60));
9449 9449
 		$hours = $time_array['hours'];
9450
-		$time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60);
9450
+		$time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60);
9451 9451
 		$minutes = $time_array['minutes'];
9452
-		$time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
9452
+		$time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
9453 9453
 		
9454 9454
 		return $time_array;	
9455 9455
 	}	
@@ -9475,63 +9475,63 @@  discard block
 block discarded – undo
9475 9475
 			$temp_array['direction_degree'] = $direction;
9476 9476
 			$temp_array['direction_shortname'] = "N";
9477 9477
 			$temp_array['direction_fullname'] = "North";
9478
-		} elseif ($direction >= 22.5 && $direction < 45){
9478
+		} elseif ($direction >= 22.5 && $direction < 45) {
9479 9479
 			$temp_array['direction_degree'] = $direction;
9480 9480
 			$temp_array['direction_shortname'] = "NNE";
9481 9481
 			$temp_array['direction_fullname'] = "North-Northeast";
9482
-		} elseif ($direction >= 45 && $direction < 67.5){
9482
+		} elseif ($direction >= 45 && $direction < 67.5) {
9483 9483
 			$temp_array['direction_degree'] = $direction;
9484 9484
 			$temp_array['direction_shortname'] = "NE";
9485 9485
 			$temp_array['direction_fullname'] = "Northeast";
9486
-		} elseif ($direction >= 67.5 && $direction < 90){
9486
+		} elseif ($direction >= 67.5 && $direction < 90) {
9487 9487
 			$temp_array['direction_degree'] = $direction;
9488 9488
 			$temp_array['direction_shortname'] = "ENE";
9489 9489
 			$temp_array['direction_fullname'] = "East-Northeast";
9490
-		} elseif ($direction >= 90 && $direction < 112.5){
9490
+		} elseif ($direction >= 90 && $direction < 112.5) {
9491 9491
 			$temp_array['direction_degree'] = $direction;
9492 9492
 			$temp_array['direction_shortname'] = "E";
9493 9493
 			$temp_array['direction_fullname'] = "East";
9494
-		} elseif ($direction >= 112.5 && $direction < 135){
9494
+		} elseif ($direction >= 112.5 && $direction < 135) {
9495 9495
 			$temp_array['direction_degree'] = $direction;
9496 9496
 			$temp_array['direction_shortname'] = "ESE";
9497 9497
 			$temp_array['direction_fullname'] = "East-Southeast";
9498
-		} elseif ($direction >= 135 && $direction < 157.5){
9498
+		} elseif ($direction >= 135 && $direction < 157.5) {
9499 9499
 			$temp_array['direction_degree'] = $direction;
9500 9500
 			$temp_array['direction_shortname'] = "SE";
9501 9501
 			$temp_array['direction_fullname'] = "Southeast";
9502
-		} elseif ($direction >= 157.5 && $direction < 180){
9502
+		} elseif ($direction >= 157.5 && $direction < 180) {
9503 9503
 			$temp_array['direction_degree'] = $direction;
9504 9504
 			$temp_array['direction_shortname'] = "SSE";
9505 9505
 			$temp_array['direction_fullname'] = "South-Southeast";
9506
-		} elseif ($direction >= 180 && $direction < 202.5){
9506
+		} elseif ($direction >= 180 && $direction < 202.5) {
9507 9507
 			$temp_array['direction_degree'] = $direction;
9508 9508
 			$temp_array['direction_shortname'] = "S";
9509 9509
 			$temp_array['direction_fullname'] = "South";
9510
-		} elseif ($direction >= 202.5 && $direction < 225){
9510
+		} elseif ($direction >= 202.5 && $direction < 225) {
9511 9511
 			$temp_array['direction_degree'] = $direction;
9512 9512
 			$temp_array['direction_shortname'] = "SSW";
9513 9513
 			$temp_array['direction_fullname'] = "South-Southwest";
9514
-		} elseif ($direction >= 225 && $direction < 247.5){
9514
+		} elseif ($direction >= 225 && $direction < 247.5) {
9515 9515
 			$temp_array['direction_degree'] = $direction;
9516 9516
 			$temp_array['direction_shortname'] = "SW";
9517 9517
 			$temp_array['direction_fullname'] = "Southwest";
9518
-		} elseif ($direction >= 247.5 && $direction < 270){
9518
+		} elseif ($direction >= 247.5 && $direction < 270) {
9519 9519
 			$temp_array['direction_degree'] = $direction;
9520 9520
 			$temp_array['direction_shortname'] = "WSW";
9521 9521
 			$temp_array['direction_fullname'] = "West-Southwest";
9522
-		} elseif ($direction >= 270 && $direction < 292.5){
9522
+		} elseif ($direction >= 270 && $direction < 292.5) {
9523 9523
 			$temp_array['direction_degree'] = $direction;
9524 9524
 			$temp_array['direction_shortname'] = "W";
9525 9525
 			$temp_array['direction_fullname'] = "West";
9526
-		} elseif ($direction >= 292.5 && $direction < 315){
9526
+		} elseif ($direction >= 292.5 && $direction < 315) {
9527 9527
 			$temp_array['direction_degree'] = $direction;
9528 9528
 			$temp_array['direction_shortname'] = "WNW";
9529 9529
 			$temp_array['direction_fullname'] = "West-Northwest";
9530
-		} elseif ($direction >= 315 && $direction < 337.5){
9530
+		} elseif ($direction >= 315 && $direction < 337.5) {
9531 9531
 			$temp_array['direction_degree'] = $direction;
9532 9532
 			$temp_array['direction_shortname'] = "NW";
9533 9533
 			$temp_array['direction_fullname'] = "Northwest";
9534
-		} elseif ($direction >= 337.5 && $direction < 360){
9534
+		} elseif ($direction >= 337.5 && $direction < 360) {
9535 9535
 			$temp_array['direction_degree'] = $direction;
9536 9536
 			$temp_array['direction_shortname'] = "NNW";
9537 9537
 			$temp_array['direction_fullname'] = "North-Northwest";
@@ -9584,9 +9584,9 @@  discard block
 block discarded – undo
9584 9584
 	*/
9585 9585
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
9586 9586
 	{
9587
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
9587
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
9588 9588
 	
9589
-		$query  = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9589
+		$query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9590 9590
 		
9591 9591
 		$sth = $this->db->prepare($query);
9592 9592
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -9609,9 +9609,9 @@  discard block
 block discarded – undo
9609 9609
 	*/
9610 9610
 	public function getAircraftTypeBymodeS($aircraft_modes)
9611 9611
 	{
9612
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
9612
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
9613 9613
 	
9614
-		$query  = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9614
+		$query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9615 9615
 		
9616 9616
 		$sth = $this->db->prepare($query);
9617 9617
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -9632,11 +9632,11 @@  discard block
 block discarded – undo
9632 9632
 	* @param Float $longitude longitute of the flight
9633 9633
 	* @return String the countrie
9634 9634
 	*/
9635
-	public function getCountryFromLatitudeLongitude($latitude,$longitude)
9635
+	public function getCountryFromLatitudeLongitude($latitude, $longitude)
9636 9636
 	{
9637 9637
 		global $globalDBdriver, $globalDebug;
9638
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9639
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9638
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
9639
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
9640 9640
 	
9641 9641
 		$Connection = new Connection($this->db);
9642 9642
 		if (!$Connection->tableExists('countries')) return '';
@@ -9676,19 +9676,19 @@  discard block
 block discarded – undo
9676 9676
 	*/
9677 9677
 	public function convertAircraftRegistration($registration)
9678 9678
 	{
9679
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9679
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9680 9680
 		$registration_prefix = '';
9681 9681
 		$registration_1 = substr($registration, 0, 1);
9682 9682
 		$registration_2 = substr($registration, 0, 2);
9683 9683
 
9684 9684
 		//first get the prefix based on two characters
9685
-		$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
9685
+		$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
9686 9686
       
9687 9687
 		
9688 9688
 		$sth = $this->db->prepare($query);
9689 9689
 		$sth->execute(array(':registration_2' => $registration_2));
9690 9690
         
9691
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9691
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9692 9692
 		{
9693 9693
 			$registration_prefix = $row['registration_prefix'];
9694 9694
 		}
@@ -9696,11 +9696,11 @@  discard block
 block discarded – undo
9696 9696
 		//if we didn't find a two chracter prefix lets just search the one with one character
9697 9697
 		if ($registration_prefix == '')
9698 9698
 		{
9699
-			$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
9699
+			$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
9700 9700
 			$sth = $this->db->prepare($query);
9701 9701
 			$sth->execute(array(':registration_1' => $registration_1));
9702 9702
 	        
9703
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9703
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9704 9704
 			{
9705 9705
 				$registration_prefix = $row['registration_prefix'];
9706 9706
 			}
@@ -9714,7 +9714,7 @@  discard block
 block discarded – undo
9714 9714
 			} else {
9715 9715
 				$registration = preg_replace("/^(.{1})/", "$1-", $registration);
9716 9716
 			}
9717
-		} else if(strlen($registration_prefix) == 2){
9717
+		} else if (strlen($registration_prefix) == 2) {
9718 9718
 			if (0 === strpos($registration, 'N')) {
9719 9719
 				$registration = preg_replace("/^(.{2})/", "$1", $registration);
9720 9720
 			} else {
@@ -9733,17 +9733,17 @@  discard block
 block discarded – undo
9733 9733
 	*/
9734 9734
 	public function countryFromAircraftRegistration($registration)
9735 9735
 	{
9736
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9736
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9737 9737
 		
9738 9738
 		$registration_prefix = '';
9739
-		$registration_test = explode('-',$registration);
9739
+		$registration_test = explode('-', $registration);
9740 9740
 		$country = '';
9741 9741
 		if ($registration_test[0] != $registration) {
9742 9742
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9743 9743
 	      
9744 9744
 			$sth = $this->db->prepare($query);
9745 9745
 			$sth->execute(array(':registration_1' => $registration_test[0]));
9746
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9746
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9747 9747
 			{
9748 9748
 				//$registration_prefix = $row['registration_prefix'];
9749 9749
 				$country = $row['country'];
@@ -9754,13 +9754,13 @@  discard block
 block discarded – undo
9754 9754
 
9755 9755
 			$country = '';
9756 9756
 			//first get the prefix based on two characters
9757
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
9757
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
9758 9758
       
9759 9759
 			
9760 9760
 			$sth = $this->db->prepare($query);
9761 9761
 			$sth->execute(array(':registration_2' => $registration_2));
9762 9762
         
9763
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9763
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9764 9764
 			{
9765 9765
 				$registration_prefix = $row['registration_prefix'];
9766 9766
 				$country = $row['country'];
@@ -9769,12 +9769,12 @@  discard block
 block discarded – undo
9769 9769
 			//if we didn't find a two chracter prefix lets just search the one with one character
9770 9770
 			if ($registration_prefix == "")
9771 9771
 			{
9772
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9772
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9773 9773
 	      
9774 9774
 				$sth = $this->db->prepare($query);
9775 9775
 				$sth->execute(array(':registration_1' => $registration_1));
9776 9776
 	        
9777
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
9777
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9778 9778
 				{
9779 9779
 					//$registration_prefix = $row['registration_prefix'];
9780 9780
 					$country = $row['country'];
@@ -9791,9 +9791,9 @@  discard block
 block discarded – undo
9791 9791
 	* @param String $flightaware_id flightaware_id from spotter_output table
9792 9792
 	* @param String $highlight New highlight value
9793 9793
 	*/
9794
-	public function setHighlightFlight($flightaware_id,$highlight) {
9794
+	public function setHighlightFlight($flightaware_id, $highlight) {
9795 9795
 		
9796
-		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
9796
+		$query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
9797 9797
 		$sth = $this->db->prepare($query);
9798 9798
 		$sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight));
9799 9799
 	}
@@ -9822,7 +9822,7 @@  discard block
 block discarded – undo
9822 9822
 		
9823 9823
 		$bitly_data = json_decode($bitly_data);
9824 9824
 		$bitly_url = '';
9825
-		if ($bitly_data->status_txt = "OK"){
9825
+		if ($bitly_data->status_txt = "OK") {
9826 9826
 			$bitly_url = $bitly_data->data->url;
9827 9827
 		}
9828 9828
 
@@ -9832,7 +9832,7 @@  discard block
 block discarded – undo
9832 9832
 
9833 9833
 	public function getOrderBy()
9834 9834
 	{
9835
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC"));
9835
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC"));
9836 9836
 		
9837 9837
 		return $orderby;
9838 9838
 		
@@ -9966,14 +9966,14 @@  discard block
 block discarded – undo
9966 9966
 		}
9967 9967
 		$sth = $this->db->prepare($query);
9968 9968
 		$sth->execute();
9969
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9969
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9970 9970
 		{
9971 9971
 			$departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']);
9972 9972
 			$arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']);
9973 9973
 			if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) {
9974
-				$update_query="UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id";
9974
+				$update_query = "UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id";
9975 9975
 				$sthu = $this->db->prepare($update_query);
9976
-				$sthu->execute(array(':fromicao' => $row['fromairport_icao'],':toicao' => $row['toairport_icao'],':spotter_id' => $row['spotter_id'],':departure_airport_name' => $departure_airport_array[0]['name'],':departure_airport_city' => $departure_airport_array[0]['city'],':departure_airport_country' => $departure_airport_array[0]['country'],':arrival_airport_name' => $arrival_airport_array[0]['name'],':arrival_airport_city' => $arrival_airport_array[0]['city'],':arrival_airport_country' => $arrival_airport_array[0]['country']));
9976
+				$sthu->execute(array(':fromicao' => $row['fromairport_icao'], ':toicao' => $row['toairport_icao'], ':spotter_id' => $row['spotter_id'], ':departure_airport_name' => $departure_airport_array[0]['name'], ':departure_airport_city' => $departure_airport_array[0]['city'], ':departure_airport_country' => $departure_airport_array[0]['country'], ':arrival_airport_name' => $arrival_airport_array[0]['name'], ':arrival_airport_city' => $arrival_airport_array[0]['city'], ':arrival_airport_country' => $arrival_airport_array[0]['country']));
9977 9977
 			}
9978 9978
 		}
9979 9979
 		
@@ -9986,7 +9986,7 @@  discard block
 block discarded – undo
9986 9986
 		}
9987 9987
 		$sth = $this->db->prepare($query);
9988 9988
 		$sth->execute();
9989
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9989
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9990 9990
 		{
9991 9991
 			if (is_numeric(substr($row['ident'], -1, 1)))
9992 9992
 			{
@@ -9995,11 +9995,11 @@  discard block
 block discarded – undo
9995 9995
 				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
9996 9996
 				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
9997 9997
 				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
9998
-				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
9998
+				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
9999 9999
 				if (isset($airline_array[0]['name'])) {
10000
-					$update_query  = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id";
10000
+					$update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id";
10001 10001
 					$sthu = $this->db->prepare($update_query);
10002
-					$sthu->execute(array(':airline_name' => $airline_array[0]['name'],':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id']));
10002
+					$sthu->execute(array(':airline_name' => $airline_array[0]['name'], ':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id']));
10003 10003
 				}
10004 10004
 			}
10005 10005
 		}
@@ -10019,18 +10019,18 @@  discard block
 block discarded – undo
10019 10019
 		}
10020 10020
 		$sth = $this->db->prepare($query);
10021 10021
 		$sth->execute();
10022
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10022
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10023 10023
 		{
10024 10024
 			if ($row['aircraft_icao'] != '') {
10025 10025
 				$aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']);
10026
-				if ($row['registration'] != ""){
10026
+				if ($row['registration'] != "") {
10027 10027
 					$image_array = $Image->getSpotterImage($row['registration']);
10028 10028
 					if (!isset($image_array[0]['registration'])) {
10029 10029
 						$Image->addSpotterImage($row['registration']);
10030 10030
 					}
10031 10031
 				}
10032 10032
 				if (count($aircraft_name) > 0) {
10033
-					$update_query  = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id";
10033
+					$update_query = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id";
10034 10034
 					$sthu = $this->db->prepare($update_query);
10035 10035
 					$sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id']));
10036 10036
 				}
@@ -10045,10 +10045,10 @@  discard block
 block discarded – undo
10045 10045
 		$query = "SELECT spotter_output.spotter_id, spotter_output.last_latitude, spotter_output.last_longitude, spotter_output.last_altitude, spotter_output.arrival_airport_icao, spotter_output.real_arrival_airport_icao FROM spotter_output";
10046 10046
 		$sth = $this->db->prepare($query);
10047 10047
 		$sth->execute();
10048
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10048
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10049 10049
 		{
10050 10050
 			if ($row['last_latitude'] != '' && $row['last_longitude'] != '') {
10051
-				$closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist);
10051
+				$closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist);
10052 10052
 				$airport_icao = '';
10053 10053
 				 if (isset($closestAirports[0])) {
10054 10054
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
@@ -10062,7 +10062,7 @@  discard block
 block discarded – undo
10062 10062
 								break;
10063 10063
 							}
10064 10064
 						}
10065
-					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
10065
+					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) {
10066 10066
 						$airport_icao = $closestAirports[0]['icao'];
10067 10067
 						if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." !  Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10068 10068
 					} else {
@@ -10073,28 +10073,28 @@  discard block
 block discarded – undo
10073 10073
 				}
10074 10074
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
10075 10075
 					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
10076
-					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10076
+					$update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10077 10077
 					$sthu = $this->db->prepare($update_query);
10078
-					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
10078
+					$sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id']));
10079 10079
 				}
10080 10080
 			}
10081 10081
 		}
10082 10082
 	}
10083 10083
 	
10084
-	public function closestAirports($origLat,$origLon,$dist = 10) {
10084
+	public function closestAirports($origLat, $origLon, $dist = 10) {
10085 10085
 		global $globalDBdriver;
10086
-		$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
10086
+		$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
10087 10087
 /*
10088 10088
 		$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - abs(latitude))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(abs(latitude)*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
10089 10089
                       FROM airport WHERE longitude between ($origLon-$dist/abs(cos(radians($origLat))*69)) and ($origLon+$dist/abs(cos(radians($origLat))*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
10090 10090
                       having distance < $dist ORDER BY distance limit 100;";
10091 10091
 */
10092 10092
 		if ($globalDBdriver == 'mysql') {
10093
-			$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 
10093
+			$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 
10094 10094
 	                      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)) 
10095 10095
 	                      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;";
10096 10096
                 } else {
10097
-			$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 
10097
+			$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 
10098 10098
 	                      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)) 
10099 10099
 	                      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;";
10100 10100
     		}
Please login to merge, or discard this patch.
require/class.Stats.php 1 patch
Spacing   +302 added lines, -302 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
17 17
 		$this->db = $Connection->db();
18 18
         }
19 19
               
20
-	public function addLastStatsUpdate($type,$stats_date) {
20
+	public function addLastStatsUpdate($type, $stats_date) {
21 21
                 $query = "DELETE FROM config WHERE name = :type;
22 22
             		INSERT INTO config (name,value) VALUES (:type,:stats_date);";
23
-                $query_values = array('type' => $type,':stats_date' => $stats_date);
23
+                $query_values = array('type' => $type, ':stats_date' => $stats_date);
24 24
                  try {
25 25
                         $sth = $this->db->prepare($query);
26 26
                         $sth->execute($query_values);
27
-                } catch(PDOException $e) {
27
+                } catch (PDOException $e) {
28 28
                         return "error : ".$e->getMessage();
29 29
                 }
30 30
         }
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
                  try {
35 35
                         $sth = $this->db->prepare($query);
36 36
                         $sth->execute(array(':type' => $type));
37
-                } catch(PDOException $e) {
37
+                } catch (PDOException $e) {
38 38
                         echo "error : ".$e->getMessage();
39 39
                 }
40 40
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -46,43 +46,43 @@  discard block
 block discarded – undo
46 46
                  try {
47 47
                         $sth = $this->db->prepare($query);
48 48
                         $sth->execute(array(':filter_name' => $filter_name));
49
-                } catch(PDOException $e) {
49
+                } catch (PDOException $e) {
50 50
                         echo "error : ".$e->getMessage();
51 51
                 }
52 52
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
53 53
                 return $all;
54 54
         }
55
-	public function getAllAircraftTypes($stats_airline = '',$filter_name = '') {
55
+	public function getAllAircraftTypes($stats_airline = '', $filter_name = '') {
56 56
 		if ($filter_name == '') $filter_name = $this->filter_name;
57 57
                 $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
58 58
                  try {
59 59
                         $sth = $this->db->prepare($query);
60
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
61
-                } catch(PDOException $e) {
60
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
61
+                } catch (PDOException $e) {
62 62
                         echo "error : ".$e->getMessage();
63 63
                 }
64 64
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
65 65
                 return $all;
66 66
         }
67
-	public function getAllManufacturers($stats_airline = '',$filter_name = '') {
67
+	public function getAllManufacturers($stats_airline = '', $filter_name = '') {
68 68
 		if ($filter_name == '') $filter_name = $this->filter_name;
69 69
                 $query = "SELECT DISTINCT(aircraft_manufacturer) FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND aircraft_manufacturer <> '' ORDER BY aircraft_manufacturer ASC";
70 70
                  try {
71 71
                         $sth = $this->db->prepare($query);
72
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
73
-                } catch(PDOException $e) {
72
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
73
+                } catch (PDOException $e) {
74 74
                         echo "error : ".$e->getMessage();
75 75
                 }
76 76
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
77 77
                 return $all;
78 78
         }
79
-	public function getAllAirportNames($stats_airline = '',$filter_name = '') {
79
+	public function getAllAirportNames($stats_airline = '', $filter_name = '') {
80 80
 		if ($filter_name == '') $filter_name = $this->filter_name;
81 81
                 $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC";
82 82
                  try {
83 83
                         $sth = $this->db->prepare($query);
84
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
85
-                } catch(PDOException $e) {
84
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
85
+                } catch (PDOException $e) {
86 86
                         echo "error : ".$e->getMessage();
87 87
                 }
88 88
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -97,22 +97,22 @@  discard block
 block discarded – undo
97 97
 		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";
98 98
                  try {
99 99
                         $sth = $this->db->prepare($query);
100
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
101
-                } catch(PDOException $e) {
100
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
101
+                } catch (PDOException $e) {
102 102
                         echo "error : ".$e->getMessage();
103 103
                 }
104 104
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
105 105
                 if (empty($all)) {
106 106
             	    $filters = array('airlines' => array($stats_airline));
107 107
             	    if ($filter_name != '') {
108
-            		    $filters = array_merge($filters,$globalStatsFilters[$filter_name]);
108
+            		    $filters = array_merge($filters, $globalStatsFilters[$filter_name]);
109 109
             	    }
110 110
             	    $Spotter = new Spotter($this->db);
111
-            	    $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters);
111
+            	    $all = $Spotter->countAllAircraftTypes($limit, 0, '', $filters);
112 112
                 }
113 113
                 return $all;
114 114
 	}
115
-	public function countAllAirlineCountries($limit = true,$filter_name = '') {
115
+	public function countAllAirlineCountries($limit = true, $filter_name = '') {
116 116
 		global $globalStatsFilters;
117 117
 		if ($filter_name == '') $filter_name = $this->filter_name;
118 118
 		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";
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
                  try {
121 121
                         $sth = $this->db->prepare($query);
122 122
                         $sth->execute(array(':filter_name' => $filter_name));
123
-                } catch(PDOException $e) {
123
+                } catch (PDOException $e) {
124 124
                         echo "error : ".$e->getMessage();
125 125
                 }
126 126
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -128,28 +128,28 @@  discard block
 block discarded – undo
128 128
             		$Spotter = new Spotter($this->db);
129 129
             		$filters = array();
130 130
             		if ($filter_name != '') {
131
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
131
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
132 132
 			}
133
-            		$all = $Spotter->countAllAirlineCountries($limit,$filters);
133
+            		$all = $Spotter->countAllAirlineCountries($limit, $filters);
134 134
                 }
135 135
                 return $all;
136 136
 	}
137
-	public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '') {
137
+	public function countAllAircraftManufacturers($limit = true, $stats_airline = '', $filter_name = '') {
138 138
 		global $globalStatsFilters;
139 139
 		if ($filter_name == '') $filter_name = $this->filter_name;
140 140
 		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";
141 141
 		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";
142 142
                  try {
143 143
                         $sth = $this->db->prepare($query);
144
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
145
-                } catch(PDOException $e) {
144
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
145
+                } catch (PDOException $e) {
146 146
                         echo "error : ".$e->getMessage();
147 147
                 }
148 148
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
149 149
                 if (empty($all)) {
150 150
             		$filters = array('airlines' => array($stats_airline));
151 151
             		if ($filter_name != '') {
152
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
152
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
153 153
 			}
154 154
             		$Spotter = new Spotter($this->db);
155 155
 			$all = $Spotter->countAllAircraftManufacturers($filters);
@@ -164,18 +164,18 @@  discard block
 block discarded – undo
164 164
 		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";
165 165
                  try {
166 166
                         $sth = $this->db->prepare($query);
167
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
168
-                } catch(PDOException $e) {
167
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
168
+                } catch (PDOException $e) {
169 169
                         echo "error : ".$e->getMessage();
170 170
                 }
171 171
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
172 172
                 if (empty($all)) {
173 173
 			$filters = array('airlines' => array($stats_airline));
174 174
 			if ($filter_name != '') {
175
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
175
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
176 176
 			}
177 177
 			$Spotter = new Spotter($this->db);
178
-			$all = $Spotter->countAllArrivalCountries($limit,$filters);
178
+			$all = $Spotter->countAllArrivalCountries($limit, $filters);
179 179
                 }
180 180
                 return $all;
181 181
 	}
@@ -186,15 +186,15 @@  discard block
 block discarded – undo
186 186
 		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";
187 187
                  try {
188 188
                         $sth = $this->db->prepare($query);
189
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
190
-                } catch(PDOException $e) {
189
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
190
+                } catch (PDOException $e) {
191 191
                         echo "error : ".$e->getMessage();
192 192
                 }
193 193
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
194 194
                 if (empty($all)) {
195 195
 			$filters = array('airlines' => array($stats_airline));
196 196
 			if ($filter_name != '') {
197
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
197
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
198 198
 			}
199 199
 			$Spotter = new Spotter($this->db);
200 200
 			$all = $Spotter->countAllDepartureCountries($filters);
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
                 return $all;
203 203
 	}
204 204
 
205
-	public function countAllAirlines($limit = true,$filter_name = '') {
205
+	public function countAllAirlines($limit = true, $filter_name = '') {
206 206
 		global $globalStatsFilters;
207 207
 		if ($filter_name == '') $filter_name = $this->filter_name;
208 208
 		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";
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
                  try {
211 211
                         $sth = $this->db->prepare($query);
212 212
                         $sth->execute(array(':filter_name' => $filter_name));
213
-                } catch(PDOException $e) {
213
+                } catch (PDOException $e) {
214 214
                         echo "error : ".$e->getMessage();
215 215
                 }
216 216
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -218,58 +218,58 @@  discard block
 block discarded – undo
218 218
 	                $Spotter = new Spotter($this->db);
219 219
             		$filters = array();
220 220
             		if ($filter_name != '') {
221
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
221
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
222 222
 			}
223 223
 
224
-    		        $all = $Spotter->countAllAirlines($limit,0,'',$filters);
224
+    		        $all = $Spotter->countAllAirlines($limit, 0, '', $filters);
225 225
                 }
226 226
                 return $all;
227 227
 	}
228
-	public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '') {
228
+	public function countAllAircraftRegistrations($limit = true, $stats_airline = '', $filter_name = '') {
229 229
 		global $globalStatsFilters;
230 230
 		if ($filter_name == '') $filter_name = $this->filter_name;
231 231
 		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";
232 232
 		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";
233 233
                  try {
234 234
                         $sth = $this->db->prepare($query);
235
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
236
-                } catch(PDOException $e) {
235
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
236
+                } catch (PDOException $e) {
237 237
                         echo "error : ".$e->getMessage();
238 238
                 }
239 239
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
240 240
                 if (empty($all)) {
241 241
 			$filters = array('airlines' => array($stats_airline));
242 242
 			if ($filter_name != '') {
243
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
243
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
244 244
 			}
245 245
 	                $Spotter = new Spotter($this->db);
246
-    		        $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters);
246
+    		        $all = $Spotter->countAllAircraftRegistrations($limit, 0, '', $filters);
247 247
                 }
248 248
                 return $all;
249 249
 	}
250
-	public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '') {
250
+	public function countAllCallsigns($limit = true, $stats_airline = '', $filter_name = '') {
251 251
 		global $globalStatsFilters;
252 252
 		if ($filter_name == '') $filter_name = $this->filter_name;
253 253
 		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";
254 254
 		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";
255 255
 		 try {
256 256
 			$sth = $this->db->prepare($query);
257
-			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
258
-		} catch(PDOException $e) {
257
+			$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
258
+		} catch (PDOException $e) {
259 259
 			echo "error : ".$e->getMessage();
260 260
 		}
261 261
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
262 262
 		if (empty($all)) {
263 263
 			$filters = array('airlines' => array($stats_airline));
264 264
 			if ($filter_name != '') {
265
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
265
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
266 266
 			}
267 267
 			$Spotter = new Spotter($this->db);
268
-			$all = $Spotter->countAllCallsigns($limit,0,'',$filters);
268
+			$all = $Spotter->countAllCallsigns($limit, 0, '', $filters);
269 269
 		}
270 270
 		return $all;
271 271
 	}
272
-	public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '') {
272
+	public function countAllFlightOverCountries($limit = true, $stats_airline = '', $filter_name = '') {
273 273
 		$Connection = new Connection();
274 274
 		if ($filter_name == '') $filter_name = $this->filter_name;
275 275
 		if ($Connection->tableExists('countries')) {
@@ -277,8 +277,8 @@  discard block
 block discarded – undo
277 277
 			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";
278 278
 			 try {
279 279
 				$sth = $this->db->prepare($query);
280
-				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
281
-			} catch(PDOException $e) {
280
+				$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
281
+			} catch (PDOException $e) {
282 282
 				echo "error : ".$e->getMessage();
283 283
 			}
284 284
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -293,70 +293,70 @@  discard block
 block discarded – undo
293 293
 			return array();
294 294
 		}
295 295
 	}
296
-	public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '') {
296
+	public function countAllPilots($limit = true, $stats_airline = '', $filter_name = '') {
297 297
 		global $globalStatsFilters;
298 298
 		if ($filter_name == '') $filter_name = $this->filter_name;
299 299
 		if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0";
300 300
 		else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC";
301 301
                  try {
302 302
                         $sth = $this->db->prepare($query);
303
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
304
-                } catch(PDOException $e) {
303
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
304
+                } catch (PDOException $e) {
305 305
                         echo "error : ".$e->getMessage();
306 306
                 }
307 307
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
308 308
                 if (empty($all)) {
309 309
 			$filters = array('airlines' => array($stats_airline));
310 310
 			if ($filter_name != '') {
311
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
311
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
312 312
 			}
313 313
             		$Spotter = new Spotter($this->db);
314
-            		$all = $Spotter->countAllPilots($limit,0,'',$filters);
314
+            		$all = $Spotter->countAllPilots($limit, 0, '', $filters);
315 315
                 }
316 316
                 return $all;
317 317
 	}
318
-	public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '') {
318
+	public function countAllOwners($limit = true, $stats_airline = '', $filter_name = '') {
319 319
 		global $globalStatsFilters;
320 320
 		if ($filter_name == '') $filter_name = $this->filter_name;
321 321
 		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";
322 322
 		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";
323 323
                  try {
324 324
                         $sth = $this->db->prepare($query);
325
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
326
-                } catch(PDOException $e) {
325
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
326
+                } catch (PDOException $e) {
327 327
                         echo "error : ".$e->getMessage();
328 328
                 }
329 329
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
330 330
                 if (empty($all)) {
331 331
 			$filters = array('airlines' => array($stats_airline));
332 332
 			if ($filter_name != '') {
333
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
333
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
334 334
 			}
335 335
             		$Spotter = new Spotter($this->db);
336
-            		$all = $Spotter->countAllOwners($limit,0,'',$filters);
336
+            		$all = $Spotter->countAllOwners($limit, 0, '', $filters);
337 337
                 }
338 338
                 return $all;
339 339
 	}
340
-	public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '') {
340
+	public function countAllDepartureAirports($limit = true, $stats_airline = '', $filter_name = '') {
341 341
 		global $globalStatsFilters;
342 342
 		if ($filter_name == '') $filter_name = $this->filter_name;
343 343
 		if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
344 344
 		else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
345 345
                  try {
346 346
                         $sth = $this->db->prepare($query);
347
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
348
-                } catch(PDOException $e) {
347
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
348
+                } catch (PDOException $e) {
349 349
                         echo "error : ".$e->getMessage();
350 350
                 }
351 351
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
352 352
                 if (empty($all)) {
353 353
 			$filters = array('airlines' => array($stats_airline));
354 354
             		if ($filter_name != '') {
355
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
355
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
356 356
 			}
357 357
             		$Spotter = new Spotter($this->db);
358
-            		$pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters);
359
-        		$dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters);
358
+            		$pall = $Spotter->countAllDepartureAirports($limit, 0, '', $filters);
359
+        		$dall = $Spotter->countAllDetectedDepartureAirports($limit, 0, '', $filters);
360 360
         		$all = array();
361 361
         		foreach ($pall as $value) {
362 362
         			$icao = $value['airport_departure_icao'];
@@ -373,30 +373,30 @@  discard block
 block discarded – undo
373 373
         		foreach ($all as $key => $row) {
374 374
         			$count[$key] = $row['airport_departure_icao_count'];
375 375
         		}
376
-        		array_multisort($count,SORT_DESC,$all);
376
+        		array_multisort($count, SORT_DESC, $all);
377 377
                 }
378 378
                 return $all;
379 379
 	}
380
-	public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '') {
380
+	public function countAllArrivalAirports($limit = true, $stats_airline = '', $filter_name = '') {
381 381
 		global $globalStatsFilters;
382 382
 		if ($filter_name == '') $filter_name = $this->filter_name;
383 383
 		if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0";
384 384
 		else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
385 385
 		try {
386 386
 			$sth = $this->db->prepare($query);
387
-			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
388
-		} catch(PDOException $e) {
387
+			$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
388
+		} catch (PDOException $e) {
389 389
 			echo "error : ".$e->getMessage();
390 390
 		}
391 391
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
392 392
 		if (empty($all)) {
393 393
 			$filters = array('airlines' => array($stats_airline));
394 394
 			if ($filter_name != '') {
395
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
395
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
396 396
 			}
397 397
 			$Spotter = new Spotter($this->db);
398
-			$pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters);
399
-			$dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters);
398
+			$pall = $Spotter->countAllArrivalAirports($limit, 0, '', false, $filters);
399
+			$dall = $Spotter->countAllDetectedArrivalAirports($limit, 0, '', false, $filters);
400 400
         		$all = array();
401 401
         		foreach ($pall as $value) {
402 402
         			$icao = $value['airport_arrival_icao'];
@@ -413,12 +413,12 @@  discard block
 block discarded – undo
413 413
         		foreach ($all as $key => $row) {
414 414
         			$count[$key] = $row['airport_arrival_icao_count'];
415 415
         		}
416
-        		array_multisort($count,SORT_DESC,$all);
416
+        		array_multisort($count, SORT_DESC, $all);
417 417
                 }
418 418
  
419 419
                 return $all;
420 420
 	}
421
-	public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') {
421
+	public function countAllMonthsLastYear($limit = true, $stats_airline = '', $filter_name = '') {
422 422
 		global $globalDBdriver, $globalStatsFilters;
423 423
 		if ($filter_name == '') $filter_name = $this->filter_name;
424 424
 		if ($globalDBdriver == 'mysql') {
@@ -428,18 +428,18 @@  discard block
 block discarded – undo
428 428
 			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";
429 429
 			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";
430 430
 		}
431
-		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
431
+		$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
432 432
                  try {
433 433
                         $sth = $this->db->prepare($query);
434 434
                         $sth->execute($query_data);
435
-                } catch(PDOException $e) {
435
+                } catch (PDOException $e) {
436 436
                         echo "error : ".$e->getMessage();
437 437
                 }
438 438
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
439 439
                 if (empty($all)) {
440 440
 			$filters = array('airlines' => array($stats_airline));
441 441
 			if ($filter_name != '') {
442
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
442
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
443 443
 			}
444 444
             		$Spotter = new Spotter($this->db);
445 445
             		$all = $Spotter->countAllMonthsLastYear($filters);
@@ -448,29 +448,29 @@  discard block
 block discarded – undo
448 448
                 return $all;
449 449
 	}
450 450
 	
451
-	public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') {
451
+	public function countAllDatesLastMonth($stats_airline = '', $filter_name = '') {
452 452
 		global $globalStatsFilters;
453 453
 		if ($filter_name == '') $filter_name = $this->filter_name;
454 454
 		$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";
455
-		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
455
+		$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
456 456
                  try {
457 457
                         $sth = $this->db->prepare($query);
458 458
                         $sth->execute($query_data);
459
-                } catch(PDOException $e) {
459
+                } catch (PDOException $e) {
460 460
                         echo "error : ".$e->getMessage();
461 461
                 }
462 462
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
463 463
                 if (empty($all)) {
464 464
 			$filters = array('airlines' => array($stats_airline));
465 465
 			if ($filter_name != '') {
466
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
466
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
467 467
 			}
468 468
             		$Spotter = new Spotter($this->db);
469 469
             		$all = $Spotter->countAllDatesLastMonth($filters);
470 470
                 }
471 471
                 return $all;
472 472
 	}
473
-	public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') {
473
+	public function countAllDatesLast7Days($stats_airline = '', $filter_name = '') {
474 474
 		global $globalDBdriver, $globalStatsFilters;
475 475
 		if ($filter_name == '') $filter_name = $this->filter_name;
476 476
 		if ($globalDBdriver == 'mysql') {
@@ -478,40 +478,40 @@  discard block
 block discarded – undo
478 478
 		} else {
479 479
 			$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";
480 480
 		}
481
-		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
481
+		$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
482 482
                  try {
483 483
                         $sth = $this->db->prepare($query);
484 484
                         $sth->execute($query_data);
485
-                } catch(PDOException $e) {
485
+                } catch (PDOException $e) {
486 486
                         echo "error : ".$e->getMessage();
487 487
                 }
488 488
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
489 489
                 if (empty($all)) {
490 490
 			$filters = array('airlines' => array($stats_airline));
491 491
 			if ($filter_name != '') {
492
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
492
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
493 493
 			}
494 494
             		$Spotter = new Spotter($this->db);
495 495
             		$all = $Spotter->countAllDatesLast7Days($filters);
496 496
                 }
497 497
                 return $all;
498 498
 	}
499
-	public function countAllDates($stats_airline = '',$filter_name = '') {
499
+	public function countAllDates($stats_airline = '', $filter_name = '') {
500 500
 		global $globalStatsFilters;
501 501
 		if ($filter_name == '') $filter_name = $this->filter_name;
502 502
 		$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";
503
-		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
503
+		$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
504 504
                  try {
505 505
                         $sth = $this->db->prepare($query);
506 506
                         $sth->execute($query_data);
507
-                } catch(PDOException $e) {
507
+                } catch (PDOException $e) {
508 508
                         echo "error : ".$e->getMessage();
509 509
                 }
510 510
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
511 511
                 if (empty($all)) {
512 512
 			$filters = array('airlines' => array($stats_airline));
513 513
 			if ($filter_name != '') {
514
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
514
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
515 515
 			}
516 516
             		$Spotter = new Spotter($this->db);
517 517
             		$all = $Spotter->countAllDates($filters);
@@ -526,35 +526,35 @@  discard block
 block discarded – undo
526 526
                  try {
527 527
                         $sth = $this->db->prepare($query);
528 528
                         $sth->execute($query_data);
529
-                } catch(PDOException $e) {
529
+                } catch (PDOException $e) {
530 530
                         echo "error : ".$e->getMessage();
531 531
                 }
532 532
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
533 533
                 if (empty($all)) {
534 534
             		$filters = array();
535 535
             		if ($filter_name != '') {
536
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
536
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
537 537
 			}
538 538
             		$Spotter = new Spotter($this->db);
539 539
             		$all = $Spotter->countAllDatesByAirlines($filters);
540 540
                 }
541 541
                 return $all;
542 542
 	}
543
-	public function countAllMonths($stats_airline = '',$filter_name = '') {
543
+	public function countAllMonths($stats_airline = '', $filter_name = '') {
544 544
 		global $globalStatsFilters;
545 545
 		if ($filter_name == '') $filter_name = $this->filter_name;
546 546
 	    	$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";
547 547
                  try {
548 548
                         $sth = $this->db->prepare($query);
549 549
                         $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
550
-                } catch(PDOException $e) {
550
+                } catch (PDOException $e) {
551 551
                         echo "error : ".$e->getMessage();
552 552
                 }
553 553
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
554 554
                 if (empty($all)) {
555 555
 			$filters = array('airlines' => array($stats_airline));
556 556
 			if ($filter_name != '') {
557
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
557
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
558 558
 			}
559 559
             		$Spotter = new Spotter($this->db);
560 560
             		$all = $Spotter->countAllMonths($filters);
@@ -568,21 +568,21 @@  discard block
 block discarded – undo
568 568
                  try {
569 569
                         $sth = $this->db->prepare($query);
570 570
                         $sth->execute(array(':filter_name' => $filter_name));
571
-                } catch(PDOException $e) {
571
+                } catch (PDOException $e) {
572 572
                         echo "error : ".$e->getMessage();
573 573
                 }
574 574
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
575 575
                 if (empty($all)) {
576 576
             		$filters = array();
577 577
             		if ($filter_name != '') {
578
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
578
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
579 579
 			}
580 580
             		$Spotter = new Spotter($this->db);
581 581
             		$all = $Spotter->countAllMilitaryMonths($filters);
582 582
                 }
583 583
                 return $all;
584 584
 	}
585
-	public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') {
585
+	public function countAllHours($orderby = 'hour', $limit = true, $stats_airline = '', $filter_name = '') {
586 586
 		global $globalTimezone, $globalDBdriver, $globalStatsFilters;
587 587
 		if ($filter_name == '') $filter_name = $this->filter_name;
588 588
 		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";
@@ -599,17 +599,17 @@  discard block
 block discarded – undo
599 599
                  try {
600 600
                         $sth = $this->db->prepare($query);
601 601
                         $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
602
-                } catch(PDOException $e) {
602
+                } catch (PDOException $e) {
603 603
                         echo "error : ".$e->getMessage();
604 604
                 }
605 605
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
606 606
                 if (empty($all)) {
607 607
 			$filters = array('airlines' => array($stats_airline));
608 608
 			if ($filter_name != '') {
609
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
609
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
610 610
 			}
611 611
             		$Spotter = new Spotter($this->db);
612
-            		$all = $Spotter->countAllHours($orderby,$filters);
612
+            		$all = $Spotter->countAllHours($orderby, $filters);
613 613
                 }
614 614
                 return $all;
615 615
 	}
@@ -617,11 +617,11 @@  discard block
 block discarded – undo
617 617
 	public function countOverallFlights($stats_airline = '', $filter_name = '') {
618 618
 		global $globalStatsFilters;
619 619
 		if ($filter_name == '') $filter_name = $this->filter_name;
620
-		$all = $this->getSumStats('flights_bymonth',date('Y'),$stats_airline,$filter_name);
620
+		$all = $this->getSumStats('flights_bymonth', date('Y'), $stats_airline, $filter_name);
621 621
 		if (empty($all)) {
622 622
 			$filters = array('airlines' => array($stats_airline));
623 623
 			if ($filter_name != '') {
624
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
624
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
625 625
 			}
626 626
 			$Spotter = new Spotter($this->db);
627 627
 			$all = $Spotter->countOverallFlights($filters);
@@ -631,39 +631,39 @@  discard block
 block discarded – undo
631 631
 	public function countOverallMilitaryFlights($filter_name = '') {
632 632
 		global $globalStatsFilters;
633 633
 		if ($filter_name == '') $filter_name = $this->filter_name;
634
-		$all = $this->getSumStats('military_flights_bymonth',date('Y'),'',$filter_name);
634
+		$all = $this->getSumStats('military_flights_bymonth', date('Y'), '', $filter_name);
635 635
 		if (empty($all)) {
636 636
 		        $filters = array();
637 637
             		if ($filter_name != '') {
638
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
638
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
639 639
 			}
640 640
 			$Spotter = new Spotter($this->db);
641 641
 			$all = $Spotter->countOverallMilitaryFlights($filters);
642 642
 		}
643 643
 		return $all;
644 644
 	}
645
-	public function countOverallArrival($stats_airline = '',$filter_name = '') {
645
+	public function countOverallArrival($stats_airline = '', $filter_name = '') {
646 646
 		global $globalStatsFilters;
647 647
 		if ($filter_name == '') $filter_name = $this->filter_name;
648
-		$all = $this->getSumStats('realarrivals_bymonth',date('Y'),$stats_airline,$filter_name);
648
+		$all = $this->getSumStats('realarrivals_bymonth', date('Y'), $stats_airline, $filter_name);
649 649
 		if (empty($all)) {
650 650
 			$filters = array('airlines' => array($stats_airline));
651 651
 			if ($filter_name != '') {
652
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
652
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
653 653
 			}
654 654
 			$Spotter = new Spotter($this->db);
655 655
 			$all = $Spotter->countOverallArrival($filters);
656 656
 		}
657 657
 		return $all;
658 658
 	}
659
-	public function countOverallAircrafts($stats_airline = '',$filter_name = '') {
659
+	public function countOverallAircrafts($stats_airline = '', $filter_name = '') {
660 660
 		global $globalStatsFilters;
661 661
 		if ($filter_name == '') $filter_name = $this->filter_name;
662
-		$all = $this->getSumStats('aircrafts_bymonth',date('Y'),$stats_airline,$filter_name);
662
+		$all = $this->getSumStats('aircrafts_bymonth', date('Y'), $stats_airline, $filter_name);
663 663
 		if (empty($all)) {
664 664
 			$filters = array('airlines' => array($stats_airline));
665 665
 			if ($filter_name != '') {
666
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
666
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
667 667
 			}
668 668
 			$Spotter = new Spotter($this->db);
669 669
 			$all = $Spotter->countOverallAircrafts($filters);
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
                  try {
678 678
                         $sth = $this->db->prepare($query);
679 679
                         $sth->execute(array(':filter_name' => $filter_name));
680
-                } catch(PDOException $e) {
680
+                } catch (PDOException $e) {
681 681
                         echo "error : ".$e->getMessage();
682 682
                 }
683 683
                 $result = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -686,14 +686,14 @@  discard block
 block discarded – undo
686 686
 		if (empty($all)) {
687 687
             		$filters = array();
688 688
             		if ($filter_name != '') {
689
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
689
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
690 690
 			}
691 691
 			$Spotter = new Spotter($this->db);
692 692
 			$all = $Spotter->countOverallAirlines($filters);
693 693
 		}
694 694
 		return $all;
695 695
 	}
696
-	public function countOverallOwners($stats_airline = '',$filter_name = '') {
696
+	public function countOverallOwners($stats_airline = '', $filter_name = '') {
697 697
 		global $globalStatsFilters;
698 698
 		if ($filter_name == '') $filter_name = $this->filter_name;
699 699
 		/*
@@ -707,25 +707,25 @@  discard block
 block discarded – undo
707 707
                 $result = $sth->fetchAll(PDO::FETCH_ASSOC);
708 708
                 $all = $result[0]['nb_owner'];
709 709
                 */
710
-		$all = $this->getSumStats('owners_bymonth',date('Y'),$stats_airline,$filter_name);
710
+		$all = $this->getSumStats('owners_bymonth', date('Y'), $stats_airline, $filter_name);
711 711
 		if (empty($all)) {
712 712
 			$filters = array('airlines' => array($stats_airline));
713 713
 			if ($filter_name != '') {
714
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
714
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
715 715
 			}
716 716
 			$Spotter = new Spotter($this->db);
717 717
 			$all = $Spotter->countOverallOwners($filters);
718 718
 		}
719 719
 		return $all;
720 720
 	}
721
-	public function countOverallPilots($stats_airline = '',$filter_name = '') {
721
+	public function countOverallPilots($stats_airline = '', $filter_name = '') {
722 722
 		global $globalStatsFilters;
723 723
 		if ($filter_name == '') $filter_name = $this->filter_name;
724
-		$all = $this->getSumStats('pilots_bymonth',date('Y'),$stats_airline,$filter_name);
724
+		$all = $this->getSumStats('pilots_bymonth', date('Y'), $stats_airline, $filter_name);
725 725
 		if (empty($all)) {
726 726
 			$filters = array('airlines' => array($stats_airline));
727 727
 			if ($filter_name != '') {
728
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
728
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
729 729
 			}
730 730
 			$Spotter = new Spotter($this->db);
731 731
 			$all = $Spotter->countOverallPilots($filters);
@@ -733,33 +733,33 @@  discard block
 block discarded – undo
733 733
 		return $all;
734 734
 	}
735 735
 
736
-	public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') {
736
+	public function getLast7DaysAirports($airport_icao = '', $stats_airline = '', $filter_name = '') {
737 737
 		if ($filter_name == '') $filter_name = $this->filter_name;
738 738
 		$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";
739
-		$query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
739
+		$query_values = array(':airport_icao' => $airport_icao, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
740 740
                  try {
741 741
                         $sth = $this->db->prepare($query);
742 742
                         $sth->execute($query_values);
743
-                } catch(PDOException $e) {
743
+                } catch (PDOException $e) {
744 744
                         echo "error : ".$e->getMessage();
745 745
                 }
746 746
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
747 747
                 return $all;
748 748
 	}
749
-	public function getStats($type,$stats_airline = '', $filter_name = '') {
749
+	public function getStats($type, $stats_airline = '', $filter_name = '') {
750 750
 		if ($filter_name == '') $filter_name = $this->filter_name;
751 751
                 $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date";
752
-                $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
752
+                $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
753 753
                  try {
754 754
                         $sth = $this->db->prepare($query);
755 755
                         $sth->execute($query_values);
756
-                } catch(PDOException $e) {
756
+                } catch (PDOException $e) {
757 757
                         echo "error : ".$e->getMessage();
758 758
                 }
759 759
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
760 760
                 return $all;
761 761
         }
762
-	public function getSumStats($type,$year,$stats_airline = '',$filter_name = '') {
762
+	public function getSumStats($type, $year, $stats_airline = '', $filter_name = '') {
763 763
 		if ($filter_name == '') $filter_name = $this->filter_name;
764 764
     		global $globalArchiveMonths, $globalDBdriver;
765 765
     		if ($globalDBdriver == 'mysql') {
@@ -767,11 +767,11 @@  discard block
 block discarded – undo
767 767
 	        } else {
768 768
             		$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";
769 769
                 }
770
-                $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
770
+                $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
771 771
                  try {
772 772
                         $sth = $this->db->prepare($query);
773 773
                         $sth->execute($query_values);
774
-                } catch(PDOException $e) {
774
+                } catch (PDOException $e) {
775 775
                         echo "error : ".$e->getMessage();
776 776
                 }
777 777
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
                  try {
790 790
                         $sth = $this->db->prepare($query);
791 791
                         $sth->execute($query_values);
792
-                } catch(PDOException $e) {
792
+                } catch (PDOException $e) {
793 793
                         echo "error : ".$e->getMessage();
794 794
                 }
795 795
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
                  try {
807 807
                         $sth = $this->db->prepare($query);
808 808
                         $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
809
-                } catch(PDOException $e) {
809
+                } catch (PDOException $e) {
810 810
                         echo "error : ".$e->getMessage();
811 811
                 }
812 812
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
                  try {
824 824
                         $sth = $this->db->prepare($query);
825 825
                         $sth->execute(array(':filter_name' => $filter_name));
826
-                } catch(PDOException $e) {
826
+                } catch (PDOException $e) {
827 827
                         echo "error : ".$e->getMessage();
828 828
                 }
829 829
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
                  try {
841 841
                         $sth = $this->db->prepare($query);
842 842
                         $sth->execute(array(':filter_name' => $filter_name));
843
-                } catch(PDOException $e) {
843
+                } catch (PDOException $e) {
844 844
                         echo "error : ".$e->getMessage();
845 845
                 }
846 846
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -857,14 +857,14 @@  discard block
 block discarded – undo
857 857
                  try {
858 858
                         $sth = $this->db->prepare($query);
859 859
                         $sth->execute(array(':filter_name' => $filter_name));
860
-                } catch(PDOException $e) {
860
+                } catch (PDOException $e) {
861 861
                         echo "error : ".$e->getMessage();
862 862
                 }
863 863
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
864 864
                 return $all[0]['total'];
865 865
         }
866 866
 
867
-	public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
867
+	public function addStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') {
868 868
 		global $globalDBdriver;
869 869
 		if ($filter_name == '') $filter_name = $this->filter_name;
870 870
 		if ($globalDBdriver == 'mysql') {
@@ -872,15 +872,15 @@  discard block
 block discarded – undo
872 872
                 } else {
873 873
 			$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);"; 
874 874
 		}
875
-                $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
875
+                $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
876 876
                  try {
877 877
                         $sth = $this->db->prepare($query);
878 878
                         $sth->execute($query_values);
879
-                } catch(PDOException $e) {
879
+                } catch (PDOException $e) {
880 880
                         return "error : ".$e->getMessage();
881 881
                 }
882 882
         }
883
-	public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
883
+	public function updateStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') {
884 884
 		global $globalDBdriver;
885 885
 		if ($filter_name == '') $filter_name = $this->filter_name;
886 886
 		if ($globalDBdriver == 'mysql') {
@@ -889,219 +889,219 @@  discard block
 block discarded – undo
889 889
             		//$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date";
890 890
 			$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);"; 
891 891
                 }
892
-                $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
892
+                $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
893 893
                  try {
894 894
                         $sth = $this->db->prepare($query);
895 895
                         $sth->execute($query_values);
896
-                } catch(PDOException $e) {
896
+                } catch (PDOException $e) {
897 897
                         return "error : ".$e->getMessage();
898 898
                 }
899 899
         }
900
-	public function getStatsSource($date,$stats_type = '') {
900
+	public function getStatsSource($date, $stats_type = '') {
901 901
 		if ($stats_type == '') {
902 902
 			$query = "SELECT * FROM stats_source WHERE stats_date = :date ORDER BY source_name";
903 903
 			$query_values = array(':date' => $date);
904 904
 		} else {
905 905
 			$query = "SELECT * FROM stats_source WHERE stats_date = :date AND stats_type = :stats_type ORDER BY source_name";
906
-			$query_values = array(':date' => $date,':stats_type' => $stats_type);
906
+			$query_values = array(':date' => $date, ':stats_type' => $stats_type);
907 907
 		}
908 908
                  try {
909 909
                         $sth = $this->db->prepare($query);
910 910
                         $sth->execute($query_values);
911
-                } catch(PDOException $e) {
911
+                } catch (PDOException $e) {
912 912
                         echo "error : ".$e->getMessage();
913 913
                 }
914 914
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
915 915
                 return $all;
916 916
         }
917 917
 
918
-	public function addStatSource($data,$source_name,$stats_type,$date) {
918
+	public function addStatSource($data, $source_name, $stats_type, $date) {
919 919
 		global $globalDBdriver;
920 920
 		if ($globalDBdriver == 'mysql') {
921 921
 			$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";
922 922
 		} else {
923 923
 			$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);"; 
924 924
                 }
925
-                $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type);
925
+                $query_values = array(':data' => $data, ':stats_date' => $date, ':source_name' => $source_name, ':stats_type' => $stats_type);
926 926
                  try {
927 927
                         $sth = $this->db->prepare($query);
928 928
                         $sth->execute($query_values);
929
-                } catch(PDOException $e) {
929
+                } catch (PDOException $e) {
930 930
                         return "error : ".$e->getMessage();
931 931
                 }
932 932
         }
933
-	public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') {
933
+	public function addStatFlight($type, $date_name, $cnt, $stats_airline = '', $filter_name = '') {
934 934
                 $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)";
935
-                $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
935
+                $query_values = array(':type' => $type, ':flight_date' => $date_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
936 936
                  try {
937 937
                         $sth = $this->db->prepare($query);
938 938
                         $sth->execute($query_values);
939
-                } catch(PDOException $e) {
939
+                } catch (PDOException $e) {
940 940
                         return "error : ".$e->getMessage();
941 941
                 }
942 942
         }
943
-	public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '') {
943
+	public function addStatAircraftRegistration($registration, $cnt, $aircraft_icao = '', $airline_icao = '', $filter_name = '') {
944 944
 		global $globalDBdriver;
945 945
 		if ($globalDBdriver == 'mysql') {
946 946
 			$query = "INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline,filter_name) VALUES (:aircraft_icao,:registration,:cnt,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt";
947 947
 		} else {
948 948
 			$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);"; 
949 949
 		}
950
-                $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
950
+                $query_values = array(':aircraft_icao' => $aircraft_icao, ':registration' => $registration, ':cnt' => $cnt, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
951 951
                  try {
952 952
                         $sth = $this->db->prepare($query);
953 953
                         $sth->execute($query_values);
954
-                } catch(PDOException $e) {
954
+                } catch (PDOException $e) {
955 955
                         return "error : ".$e->getMessage();
956 956
                 }
957 957
         }
958
-	public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '') {
958
+	public function addStatCallsign($callsign_icao, $cnt, $airline_icao = '', $filter_name = '') {
959 959
 		global $globalDBdriver;
960 960
 		if ($globalDBdriver == 'mysql') {
961 961
 			$query = "INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt,filter_name) VALUES (:callsign_icao,:airline_icao,:cnt,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt";
962 962
 		} else {
963 963
 			$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);"; 
964 964
 		}
965
-                $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name);
965
+                $query_values = array(':callsign_icao' => $callsign_icao, ':airline_icao' => $airline_icao, ':cnt' => $cnt, ':filter_name' => $filter_name);
966 966
                  try {
967 967
                         $sth = $this->db->prepare($query);
968 968
                         $sth->execute($query_values);
969
-                } catch(PDOException $e) {
969
+                } catch (PDOException $e) {
970 970
                         return "error : ".$e->getMessage();
971 971
                 }
972 972
         }
973
-	public function addStatCountry($iso2,$iso3,$name,$cnt,$filter_name = '') {
973
+	public function addStatCountry($iso2, $iso3, $name, $cnt, $filter_name = '') {
974 974
 		global $globalDBdriver;
975 975
 		if ($globalDBdriver == 'mysql') {
976 976
 			$query = "INSERT INTO stats_country (iso2,iso3,name,cnt,filter_name) VALUES (:iso2,:iso3,:name,:cnt,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt";
977 977
 		} else {
978 978
 			$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);"; 
979 979
 		}
980
-                $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name);
980
+                $query_values = array(':iso2' => $iso2, ':iso3' => $iso3, ':name' => $name, ':cnt' => $cnt, ':filter_name' => $filter_name);
981 981
                  try {
982 982
                         $sth = $this->db->prepare($query);
983 983
                         $sth->execute($query_values);
984
-                } catch(PDOException $e) {
984
+                } catch (PDOException $e) {
985 985
                         return "error : ".$e->getMessage();
986 986
                 }
987 987
         }
988
-	public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '') {
988
+	public function addStatAircraft($aircraft_icao, $cnt, $aircraft_name = '', $aircraft_manufacturer = '', $airline_icao = '', $filter_name = '') {
989 989
 		global $globalDBdriver;
990 990
 		if ($globalDBdriver == 'mysql') {
991 991
 			$query = "INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline, filter_name) VALUES (:aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer, stats_airline = :stats_airline";
992 992
 		} else {
993 993
 			$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);"; 
994 994
 		}
995
-                $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);
995
+                $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);
996 996
                  try {
997 997
                         $sth = $this->db->prepare($query);
998 998
                         $sth->execute($query_values);
999
-                } catch(PDOException $e) {
999
+                } catch (PDOException $e) {
1000 1000
                         return "error : ".$e->getMessage();
1001 1001
                 }
1002 1002
         }
1003
-	public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '') {
1003
+	public function addStatAirline($airline_icao, $cnt, $airline_name = '', $filter_name = '') {
1004 1004
 		global $globalDBdriver;
1005 1005
 		if ($globalDBdriver == 'mysql') {
1006 1006
 			$query = "INSERT INTO stats_airline (airline_icao,airline_name,cnt,filter_name) VALUES (:airline_icao,:airline_name,:cnt,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt,airline_name = :airline_name";
1007 1007
 		} else {
1008 1008
 			$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);"; 
1009 1009
 		}
1010
-                $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name);
1010
+                $query_values = array(':airline_icao' => $airline_icao, ':airline_name' => $airline_name, ':cnt' => $cnt, ':filter_name' => $filter_name);
1011 1011
                  try {
1012 1012
                         $sth = $this->db->prepare($query);
1013 1013
                         $sth->execute($query_values);
1014
-                } catch(PDOException $e) {
1014
+                } catch (PDOException $e) {
1015 1015
                         return "error : ".$e->getMessage();
1016 1016
                 }
1017 1017
         }
1018
-	public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '') {
1018
+	public function addStatOwner($owner_name, $cnt, $stats_airline = '', $filter_name = '') {
1019 1019
 		global $globalDBdriver;
1020 1020
 		if ($globalDBdriver == 'mysql') {
1021 1021
 			$query = "INSERT INTO stats_owner (owner_name,cnt,stats_airline,filter_name) VALUES (:owner_name,:cnt,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt";
1022 1022
 		} else {
1023 1023
 			$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);"; 
1024 1024
 		}
1025
-                $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1025
+                $query_values = array(':owner_name' => $owner_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
1026 1026
                  try {
1027 1027
                         $sth = $this->db->prepare($query);
1028 1028
                         $sth->execute($query_values);
1029
-                } catch(PDOException $e) {
1029
+                } catch (PDOException $e) {
1030 1030
                         return "error : ".$e->getMessage();
1031 1031
                 }
1032 1032
         }
1033
-	public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '',$format_source = '') {
1033
+	public function addStatPilot($pilot_id, $cnt, $pilot_name, $stats_airline = '', $filter_name = '', $format_source = '') {
1034 1034
 		global $globalDBdriver;
1035 1035
 		if ($globalDBdriver == 'mysql') {
1036 1036
 			$query = "INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name,format_source) VALUES (:pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name,:format_source) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, pilot_name = :pilot_name";
1037 1037
 		} else {
1038 1038
 			$query = "UPDATE stats_pilot SET cnt = cnt+:cnt, pilot_name = :pilot_name WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source; INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name,format_source) SELECT :pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name,:format_source WHERE NOT EXISTS (SELECT 1 FROM stats_pilot WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source);"; 
1039 1039
 		}
1040
-                $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name,':format_source' => $format_source);
1040
+                $query_values = array(':pilot_id' => $pilot_id, ':cnt' => $cnt, ':pilot_name' => $pilot_name, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':format_source' => $format_source);
1041 1041
                  try {
1042 1042
                         $sth = $this->db->prepare($query);
1043 1043
                         $sth->execute($query_values);
1044
-                } catch(PDOException $e) {
1044
+                } catch (PDOException $e) {
1045 1045
                         return "error : ".$e->getMessage();
1046 1046
                 }
1047 1047
         }
1048
-	public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') {
1048
+	public function addStatDepartureAirports($airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') {
1049 1049
 		global $globalDBdriver;
1050 1050
 		if ($globalDBdriver == 'mysql') {
1051 1051
 			$query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:departure,'yearly',:date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE departure = departure+:departure";
1052 1052
 		} else {
1053 1053
 			$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);"; 
1054 1054
 		}
1055
-                $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);
1055
+                $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);
1056 1056
                  try {
1057 1057
                         $sth = $this->db->prepare($query);
1058 1058
                         $sth->execute($query_values);
1059
-                } catch(PDOException $e) {
1059
+                } catch (PDOException $e) {
1060 1060
                         return "error : ".$e->getMessage();
1061 1061
                 }
1062 1062
         }
1063
-	public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') {
1063
+	public function addStatDepartureAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') {
1064 1064
 		global $globalDBdriver;
1065 1065
 		if ($globalDBdriver == 'mysql') {
1066 1066
 			$query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE departure = :departure";
1067 1067
 		} else {
1068 1068
 			$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);"; 
1069 1069
 		}
1070
-                $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);
1070
+                $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);
1071 1071
                  try {
1072 1072
                         $sth = $this->db->prepare($query);
1073 1073
                         $sth->execute($query_values);
1074
-                } catch(PDOException $e) {
1074
+                } catch (PDOException $e) {
1075 1075
                         return "error : ".$e->getMessage();
1076 1076
                 }
1077 1077
         }
1078
-	public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') {
1078
+	public function addStatArrivalAirports($airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') {
1079 1079
 		global $globalDBdriver;
1080 1080
 		if ($globalDBdriver == 'mysql') {
1081 1081
 			$query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE arrival = arrival+:arrival";
1082 1082
 		} else {
1083 1083
 			$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);"; 
1084 1084
 		}
1085
-                $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);
1085
+                $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);
1086 1086
                  try {
1087 1087
                         $sth = $this->db->prepare($query);
1088 1088
                         $sth->execute($query_values);
1089
-                } catch(PDOException $e) {
1089
+                } catch (PDOException $e) {
1090 1090
                         return "error : ".$e->getMessage();
1091 1091
                 }
1092 1092
         }
1093
-	public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') {
1093
+	public function addStatArrivalAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') {
1094 1094
 		global $globalDBdriver;
1095 1095
 		if ($globalDBdriver == 'mysql') {
1096 1096
 			$query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'daily',:date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE arrival = :arrival";
1097 1097
 		} else {
1098 1098
 			$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);"; 
1099 1099
 		}
1100
-                $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);
1100
+                $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);
1101 1101
                  try {
1102 1102
                         $sth = $this->db->prepare($query);
1103 1103
                         $sth->execute($query_values);
1104
-                } catch(PDOException $e) {
1104
+                } catch (PDOException $e) {
1105 1105
                         return "error : ".$e->getMessage();
1106 1106
                 }
1107 1107
         }
@@ -1112,7 +1112,7 @@  discard block
 block discarded – undo
1112 1112
                  try {
1113 1113
                         $sth = $this->db->prepare($query);
1114 1114
                         $sth->execute($query_values);
1115
-                } catch(PDOException $e) {
1115
+                } catch (PDOException $e) {
1116 1116
                         return "error : ".$e->getMessage();
1117 1117
                 }
1118 1118
         }
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
                  try {
1123 1123
                         $sth = $this->db->prepare($query);
1124 1124
                         $sth->execute($query_values);
1125
-                } catch(PDOException $e) {
1125
+                } catch (PDOException $e) {
1126 1126
                         return "error : ".$e->getMessage();
1127 1127
                 }
1128 1128
         }
@@ -1132,7 +1132,7 @@  discard block
 block discarded – undo
1132 1132
                  try {
1133 1133
                         $sth = $this->db->prepare($query);
1134 1134
                         $sth->execute($query_values);
1135
-                } catch(PDOException $e) {
1135
+                } catch (PDOException $e) {
1136 1136
                         return "error : ".$e->getMessage();
1137 1137
                 }
1138 1138
         }
@@ -1371,40 +1371,40 @@  discard block
 block discarded – undo
1371 1371
 				$last_update_day = $last_update[0]['value'];
1372 1372
 			} else $last_update_day = '2012-12-12 12:12:12';
1373 1373
 			$Spotter = new Spotter($this->db);
1374
-			$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day);
1374
+			$alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day);
1375 1375
 			foreach ($alldata as $number) {
1376
-				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer']);
1376
+				$this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer']);
1377 1377
 			}
1378 1378
 			if ($globalDebug) echo 'Count all airlines...'."\n";
1379
-			$alldata = $Spotter->countAllAirlines(false,0,$last_update_day);
1379
+			$alldata = $Spotter->countAllAirlines(false, 0, $last_update_day);
1380 1380
 			foreach ($alldata as $number) {
1381
-				$this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name']);
1381
+				$this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name']);
1382 1382
 			}
1383 1383
 			if ($globalDebug) echo 'Count all registrations...'."\n";
1384
-			$alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day);
1384
+			$alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day);
1385 1385
 			foreach ($alldata as $number) {
1386
-				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao']);
1386
+				$this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao']);
1387 1387
 			}
1388 1388
 			if ($globalDebug) echo 'Count all callsigns...'."\n";
1389
-			$alldata = $Spotter->countAllCallsigns(false,0,$last_update_day);
1389
+			$alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day);
1390 1390
 			foreach ($alldata as $number) {
1391
-				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']);
1391
+				$this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao']);
1392 1392
 			}
1393 1393
 			if ($globalDebug) echo 'Count all owners...'."\n";
1394
-			$alldata = $Spotter->countAllOwners(false,0,$last_update_day);
1394
+			$alldata = $Spotter->countAllOwners(false, 0, $last_update_day);
1395 1395
 			foreach ($alldata as $number) {
1396
-				$this->addStatOwner($number['owner_name'],$number['owner_count']);
1396
+				$this->addStatOwner($number['owner_name'], $number['owner_count']);
1397 1397
 			}
1398 1398
 			if ($globalDebug) echo 'Count all pilots...'."\n";
1399
-			$alldata = $Spotter->countAllPilots(false,0,$last_update_day);
1399
+			$alldata = $Spotter->countAllPilots(false, 0, $last_update_day);
1400 1400
 			foreach ($alldata as $number) {
1401
-				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source']);
1401
+				$this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', '', $number['format_source']);
1402 1402
 			}
1403 1403
 			
1404 1404
 			if ($globalDebug) echo 'Count all departure airports...'."\n";
1405
-			$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day);
1405
+			$pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day);
1406 1406
 			if ($globalDebug) echo 'Count all detected departure airports...'."\n";
1407
-        		$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day);
1407
+        		$dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day);
1408 1408
 			if ($globalDebug) echo 'Order departure airports...'."\n";
1409 1409
 	        	$alldata = array();
1410 1410
 	        	
@@ -1422,14 +1422,14 @@  discard block
 block discarded – undo
1422 1422
     			foreach ($alldata as $key => $row) {
1423 1423
     				$count[$key] = $row['airport_departure_icao_count'];
1424 1424
         		}
1425
-			array_multisort($count,SORT_DESC,$alldata);
1425
+			array_multisort($count, SORT_DESC, $alldata);
1426 1426
 			foreach ($alldata as $number) {
1427
-				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count']);
1427
+				echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count']);
1428 1428
 			}
1429 1429
 			if ($globalDebug) echo 'Count all arrival airports...'."\n";
1430
-			$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day);
1430
+			$pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day);
1431 1431
 			if ($globalDebug) echo 'Count all detected arrival airports...'."\n";
1432
-        		$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day);
1432
+        		$dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day);
1433 1433
 			if ($globalDebug) echo 'Order arrival airports...'."\n";
1434 1434
 	        	$alldata = array();
1435 1435
     			foreach ($pall as $value) {
@@ -1446,16 +1446,16 @@  discard block
 block discarded – undo
1446 1446
         		foreach ($alldata as $key => $row) {
1447 1447
         			$count[$key] = $row['airport_arrival_icao_count'];
1448 1448
 	        	}
1449
-    			array_multisort($count,SORT_DESC,$alldata);
1449
+    			array_multisort($count, SORT_DESC, $alldata);
1450 1450
                         foreach ($alldata as $number) {
1451
-				echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count']);
1451
+				echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count']);
1452 1452
 			}
1453 1453
 			if ($Connection->tableExists('countries')) {
1454 1454
 				if ($globalDebug) echo 'Count all flights by countries...'."\n";
1455 1455
 				$SpotterArchive = new SpotterArchive();
1456
-				$alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day);
1456
+				$alldata = $SpotterArchive->countAllFlightOverCountries(false, 0, $last_update_day);
1457 1457
 				foreach ($alldata as $number) {
1458
-					$this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count']);
1458
+					$this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count']);
1459 1459
 				}
1460 1460
 			}
1461 1461
 			
@@ -1469,37 +1469,37 @@  discard block
 block discarded – undo
1469 1469
 			$lastyear = false;
1470 1470
 			foreach ($alldata as $number) {
1471 1471
 				if ($number['year_name'] != date('Y')) $lastyear = true;
1472
-				$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'])));
1472
+				$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'])));
1473 1473
 			}
1474 1474
 			if ($globalDebug) echo 'Count all military flights by months...'."\n";
1475 1475
 			$alldata = $Spotter->countAllMilitaryMonths();
1476 1476
 			foreach ($alldata as $number) {
1477
-				$this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1477
+				$this->addStat('military_flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1478 1478
 			}
1479 1479
 			if ($globalDebug) echo 'Count all owners by months...'."\n";
1480 1480
 			$alldata = $Spotter->countAllMonthsOwners();
1481 1481
 			foreach ($alldata as $number) {
1482
-				$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1482
+				$this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1483 1483
 			}
1484 1484
 			if ($globalDebug) echo 'Count all pilots by months...'."\n";
1485 1485
 			$alldata = $Spotter->countAllMonthsPilots();
1486 1486
 			foreach ($alldata as $number) {
1487
-				$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1487
+				$this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1488 1488
 			}
1489 1489
 			if ($globalDebug) echo 'Count all airlines by months...'."\n";
1490 1490
 			$alldata = $Spotter->countAllMonthsAirlines();
1491 1491
 			foreach ($alldata as $number) {
1492
-				$this->addStat('airlines_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1492
+				$this->addStat('airlines_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1493 1493
 			}
1494 1494
 			if ($globalDebug) echo 'Count all aircrafts by months...'."\n";
1495 1495
 			$alldata = $Spotter->countAllMonthsAircrafts();
1496 1496
 			foreach ($alldata as $number) {
1497
-				$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1497
+				$this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1498 1498
 			}
1499 1499
 			if ($globalDebug) echo 'Count all real arrivals by months...'."\n";
1500 1500
 			$alldata = $Spotter->countAllMonthsRealArrivals();
1501 1501
 			foreach ($alldata as $number) {
1502
-				$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1502
+				$this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1503 1503
 			}
1504 1504
 			if ($globalDebug) echo 'Airports data...'."\n";
1505 1505
 			if ($globalDebug) echo '...Departure'."\n";
@@ -1544,7 +1544,7 @@  discard block
 block discarded – undo
1544 1544
     			}
1545 1545
     			$alldata = $pall;
1546 1546
 			foreach ($alldata as $number) {
1547
-				$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']);
1547
+				$this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count']);
1548 1548
 			}
1549 1549
 			echo '...Arrival'."\n";
1550 1550
 			$pall = $Spotter->getLast7DaysAirportsArrival();
@@ -1586,7 +1586,7 @@  discard block
 block discarded – undo
1586 1586
     			}
1587 1587
     			$alldata = $pall;
1588 1588
 			foreach ($alldata as $number) {
1589
-				$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']);
1589
+				$this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count']);
1590 1590
 			}
1591 1591
 
1592 1592
 			echo 'Flights data...'."\n";
@@ -1594,28 +1594,28 @@  discard block
 block discarded – undo
1594 1594
 			echo '-> countAllDatesLastMonth...'."\n";
1595 1595
 			$alldata = $Spotter->countAllDatesLastMonth();
1596 1596
 			foreach ($alldata as $number) {
1597
-				$this->addStatFlight('month',$number['date_name'],$number['date_count']);
1597
+				$this->addStatFlight('month', $number['date_name'], $number['date_count']);
1598 1598
 			}
1599 1599
 			echo '-> countAllDates...'."\n";
1600 1600
 			$previousdata = $this->countAllDates();
1601 1601
 			$previousdatabyairlines = $this->countAllDatesByAirlines();
1602 1602
 			$this->deleteStatFlight('date');
1603
-			$alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates());
1603
+			$alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates());
1604 1604
 			$values = array();
1605 1605
 			foreach ($alldata as $cnt) {
1606 1606
 				$values[] = $cnt['date_count'];
1607 1607
 			}
1608
-			array_multisort($values,SORT_DESC,$alldata);
1609
-			array_splice($alldata,11);
1608
+			array_multisort($values, SORT_DESC, $alldata);
1609
+			array_splice($alldata, 11);
1610 1610
 			foreach ($alldata as $number) {
1611
-				$this->addStatFlight('date',$number['date_name'],$number['date_count']);
1611
+				$this->addStatFlight('date', $number['date_name'], $number['date_count']);
1612 1612
 			}
1613 1613
 			
1614 1614
 			$this->deleteStatFlight('hour');
1615 1615
 			echo '-> countAllHours...'."\n";
1616 1616
 			$alldata = $Spotter->countAllHours('hour');
1617 1617
 			foreach ($alldata as $number) {
1618
-				$this->addStatFlight('hour',$number['hour_name'],$number['hour_count']);
1618
+				$this->addStatFlight('hour', $number['hour_name'], $number['hour_count']);
1619 1619
 			}
1620 1620
 
1621 1621
 
@@ -1624,34 +1624,34 @@  discard block
 block discarded – undo
1624 1624
 			echo '--- Stats by airlines ---'."\n";
1625 1625
 			if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n";
1626 1626
 			$Spotter = new Spotter($this->db);
1627
-			$alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day);
1627
+			$alldata = $Spotter->countAllAircraftTypesByAirlines(false, 0, $last_update_day);
1628 1628
 			foreach ($alldata as $number) {
1629
-				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao']);
1629
+				$this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], $number['airline_icao']);
1630 1630
 			}
1631 1631
 			if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n";
1632
-			$alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day);
1632
+			$alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false, 0, $last_update_day);
1633 1633
 			foreach ($alldata as $number) {
1634
-				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao']);
1634
+				$this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], $number['airline_icao']);
1635 1635
 			}
1636 1636
 			if ($globalDebug) echo 'Count all callsigns by airlines...'."\n";
1637
-			$alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day);
1637
+			$alldata = $Spotter->countAllCallsignsByAirlines(false, 0, $last_update_day);
1638 1638
 			foreach ($alldata as $number) {
1639
-				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']);
1639
+				$this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao']);
1640 1640
 			}
1641 1641
 			if ($globalDebug) echo 'Count all owners by airlines...'."\n";
1642
-			$alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day);
1642
+			$alldata = $Spotter->countAllOwnersByAirlines(false, 0, $last_update_day);
1643 1643
 			foreach ($alldata as $number) {
1644
-				$this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao']);
1644
+				$this->addStatOwner($number['owner_name'], $number['owner_count'], $number['airline_icao']);
1645 1645
 			}
1646 1646
 			if ($globalDebug) echo 'Count all pilots by airlines...'."\n";
1647
-			$alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day);
1647
+			$alldata = $Spotter->countAllPilotsByAirlines(false, 0, $last_update_day);
1648 1648
 			foreach ($alldata as $number) {
1649
-				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source']);
1649
+				$this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], $number['airline_icao'], '', $number['format_source']);
1650 1650
 			}
1651 1651
 			if ($globalDebug) echo 'Count all departure airports by airlines...'."\n";
1652
-			$pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day);
1652
+			$pall = $Spotter->countAllDepartureAirportsByAirlines(false, 0, $last_update_day);
1653 1653
 			if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n";
1654
-       			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day);
1654
+       			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false, 0, $last_update_day);
1655 1655
 			if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n";
1656 1656
 	        	//$alldata = array();
1657 1657
     			foreach ($dall as $value) {
@@ -1671,12 +1671,12 @@  discard block
 block discarded – undo
1671 1671
     			}
1672 1672
     			$alldata = $pall;
1673 1673
 			foreach ($alldata as $number) {
1674
-				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']);
1674
+				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']);
1675 1675
 			}
1676 1676
 			if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n";
1677
-			$pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day);
1677
+			$pall = $Spotter->countAllArrivalAirportsByAirlines(false, 0, $last_update_day);
1678 1678
 			if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n";
1679
-        		$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day);
1679
+        		$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false, 0, $last_update_day);
1680 1680
 			if ($globalDebug) echo 'Order arrival airports by airlines...'."\n";
1681 1681
 	        	//$alldata = array();
1682 1682
     			foreach ($dall as $value) {
@@ -1696,7 +1696,7 @@  discard block
 block discarded – undo
1696 1696
     			}
1697 1697
     			$alldata = $pall;
1698 1698
                         foreach ($alldata as $number) {
1699
-				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']);
1699
+				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']);
1700 1700
 			}
1701 1701
 			if ($globalDebug) echo 'Count all flights by months by airlines...'."\n";
1702 1702
 			$Spotter = new Spotter($this->db);
@@ -1704,27 +1704,27 @@  discard block
 block discarded – undo
1704 1704
 			$lastyear = false;
1705 1705
 			foreach ($alldata as $number) {
1706 1706
 				if ($number['year_name'] != date('Y')) $lastyear = true;
1707
-				$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']);
1707
+				$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']);
1708 1708
 			}
1709 1709
 			if ($globalDebug) echo 'Count all owners by months by airlines...'."\n";
1710 1710
 			$alldata = $Spotter->countAllMonthsOwnersByAirlines();
1711 1711
 			foreach ($alldata as $number) {
1712
-				$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1712
+				$this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
1713 1713
 			}
1714 1714
 			if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n";
1715 1715
 			$alldata = $Spotter->countAllMonthsPilotsByAirlines();
1716 1716
 			foreach ($alldata as $number) {
1717
-				$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1717
+				$this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
1718 1718
 			}
1719 1719
 			if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n";
1720 1720
 			$alldata = $Spotter->countAllMonthsAircraftsByAirlines();
1721 1721
 			foreach ($alldata as $number) {
1722
-				$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1722
+				$this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
1723 1723
 			}
1724 1724
 			if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n";
1725 1725
 			$alldata = $Spotter->countAllMonthsRealArrivalsByAirlines();
1726 1726
 			foreach ($alldata as $number) {
1727
-				$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1727
+				$this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
1728 1728
 			}
1729 1729
 			if ($globalDebug) echo '...Departure'."\n";
1730 1730
 			$pall = $Spotter->getLast7DaysAirportsDepartureByAirlines();
@@ -1747,7 +1747,7 @@  discard block
 block discarded – undo
1747 1747
     			}
1748 1748
     			$alldata = $pall;
1749 1749
 			foreach ($alldata as $number) {
1750
-				$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']);
1750
+				$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']);
1751 1751
 			}
1752 1752
 			if ($globalDebug) echo '...Arrival'."\n";
1753 1753
 			$pall = $Spotter->getLast7DaysAirportsArrivalByAirlines();
@@ -1770,32 +1770,32 @@  discard block
 block discarded – undo
1770 1770
     			}
1771 1771
     			$alldata = $pall;
1772 1772
 			foreach ($alldata as $number) {
1773
-				$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']);
1773
+				$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']);
1774 1774
 			}
1775 1775
 
1776 1776
 			if ($globalDebug) echo 'Flights data...'."\n";
1777 1777
 			if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n";
1778 1778
 			$alldata = $Spotter->countAllDatesLastMonthByAirlines();
1779 1779
 			foreach ($alldata as $number) {
1780
-				$this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']);
1780
+				$this->addStatFlight('month', $number['date_name'], $number['date_count'], $number['airline_icao']);
1781 1781
 			}
1782 1782
 			if ($globalDebug) echo '-> countAllDates...'."\n";
1783 1783
 			//$previousdata = $this->countAllDatesByAirlines();
1784
-			$alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines());
1784
+			$alldata = $Common->array_merge_noappend($previousdatabyairlines, $Spotter->countAllDatesByAirlines());
1785 1785
 			$values = array();
1786 1786
 			foreach ($alldata as $cnt) {
1787 1787
 				$values[] = $cnt['date_count'];
1788 1788
 			}
1789
-			array_multisort($values,SORT_DESC,$alldata);
1790
-			array_splice($alldata,11);
1789
+			array_multisort($values, SORT_DESC, $alldata);
1790
+			array_splice($alldata, 11);
1791 1791
 			foreach ($alldata as $number) {
1792
-				$this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']);
1792
+				$this->addStatFlight('date', $number['date_name'], $number['date_count'], $number['airline_icao']);
1793 1793
 			}
1794 1794
 			
1795 1795
 			if ($globalDebug) echo '-> countAllHours...'."\n";
1796 1796
 			$alldata = $Spotter->countAllHoursByAirlines('hour');
1797 1797
 			foreach ($alldata as $number) {
1798
-				$this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']);
1798
+				$this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], $number['airline_icao']);
1799 1799
 			}
1800 1800
 			
1801 1801
 
@@ -1806,33 +1806,33 @@  discard block
 block discarded – undo
1806 1806
 				// Count by filter
1807 1807
 				if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n";
1808 1808
 				$Spotter = new Spotter($this->db);
1809
-				$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter);
1809
+				$alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day, $filter);
1810 1810
 				foreach ($alldata as $number) {
1811
-					$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'',$filter_name);
1811
+					$this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', $filter_name);
1812 1812
 				}
1813
-				$alldata = $Spotter->countAllAirlines(false,0,$last_update_day,$filter);
1813
+				$alldata = $Spotter->countAllAirlines(false, 0, $last_update_day, $filter);
1814 1814
 				foreach ($alldata as $number) {
1815
-					$this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],$filter_name);
1815
+					$this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], $filter_name);
1816 1816
 				}
1817
-				$alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day,$filter);
1817
+				$alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day, $filter);
1818 1818
 				foreach ($alldata as $number) {
1819
-					$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'',$filter_name);
1819
+					$this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', $filter_name);
1820 1820
 				}
1821
-				$alldata = $Spotter->countAllCallsigns(false,0,$last_update_day,$filter);
1821
+				$alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day, $filter);
1822 1822
 				foreach ($alldata as $number) {
1823
-					$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],'',$filter_name);
1823
+					$this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], '', $filter_name);
1824 1824
 				}
1825
-				$alldata = $Spotter->countAllOwners(false,0,$last_update_day,$filter);
1825
+				$alldata = $Spotter->countAllOwners(false, 0, $last_update_day, $filter);
1826 1826
 				foreach ($alldata as $number) {
1827
-					$this->addStatOwner($number['owner_name'],$number['owner_count'],'',$filter_name);
1827
+					$this->addStatOwner($number['owner_name'], $number['owner_count'], '', $filter_name);
1828 1828
 				}
1829
-				$alldata = $Spotter->countAllPilots(false,0,$last_update_day,$filter);
1829
+				$alldata = $Spotter->countAllPilots(false, 0, $last_update_day, $filter);
1830 1830
 				foreach ($alldata as $number) {
1831
-					$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name,$number['format_source']);
1831
+					$this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', $filter_name, $number['format_source']);
1832 1832
 				}
1833 1833
     			
1834
-				$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter);
1835
-	       			$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter);
1834
+				$pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day, $filter);
1835
+	       			$dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day, $filter);
1836 1836
 		        	$alldata = array();
1837 1837
 	    			foreach ($pall as $value) {
1838 1838
 		        		$icao = $value['airport_departure_icao'];
@@ -1848,12 +1848,12 @@  discard block
 block discarded – undo
1848 1848
     				foreach ($alldata as $key => $row) {
1849 1849
     					$count[$key] = $row['airport_departure_icao_count'];
1850 1850
     				}
1851
-				array_multisort($count,SORT_DESC,$alldata);
1851
+				array_multisort($count, SORT_DESC, $alldata);
1852 1852
 				foreach ($alldata as $number) {
1853
-    					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);
1853
+    					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);
1854 1854
 				}
1855
-				$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,$filter);
1856
-    				$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,$filter);
1855
+				$pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day, $filter);
1856
+    				$dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day, $filter);
1857 1857
 				$alldata = array();
1858 1858
     				foreach ($pall as $value) {
1859 1859
 		        		$icao = $value['airport_arrival_icao'];
@@ -1869,36 +1869,36 @@  discard block
 block discarded – undo
1869 1869
         			foreach ($alldata as $key => $row) {
1870 1870
     					$count[$key] = $row['airport_arrival_icao_count'];
1871 1871
 		        	}
1872
-        			array_multisort($count,SORT_DESC,$alldata);
1872
+        			array_multisort($count, SORT_DESC, $alldata);
1873 1873
 				foreach ($alldata as $number) {
1874
-					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);
1874
+					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);
1875 1875
 				}
1876 1876
 				$Spotter = new Spotter($this->db);
1877 1877
 				$alldata = $Spotter->countAllMonths($filter);
1878 1878
 				$lastyear = false;
1879 1879
 				foreach ($alldata as $number) {
1880 1880
 					if ($number['year_name'] != date('Y')) $lastyear = true;
1881
-					$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);
1881
+					$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);
1882 1882
 				}
1883 1883
 				$alldata = $Spotter->countAllMonthsOwners($filter);
1884 1884
 				foreach ($alldata as $number) {
1885
-					$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1885
+					$this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
1886 1886
 				}
1887 1887
 				$alldata = $Spotter->countAllMonthsPilots($filter);
1888 1888
 				foreach ($alldata as $number) {
1889
-					$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1889
+					$this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
1890 1890
 				}
1891 1891
 				$alldata = $Spotter->countAllMonthsAircrafts($filter);
1892 1892
 				foreach ($alldata as $number) {
1893
-					$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1893
+					$this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
1894 1894
 				}
1895 1895
 				$alldata = $Spotter->countAllMonthsRealArrivals($filter);
1896 1896
 				foreach ($alldata as $number) {
1897
-					$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1897
+					$this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
1898 1898
 				}
1899 1899
 				echo '...Departure'."\n";
1900
-				$pall = $Spotter->getLast7DaysAirportsDeparture('',$filter);
1901
-        			$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter);
1900
+				$pall = $Spotter->getLast7DaysAirportsDeparture('', $filter);
1901
+        			$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('', $filter);
1902 1902
 				foreach ($dall as $value) {
1903 1903
     					$icao = $value['departure_airport_icao'];
1904 1904
     					$ddate = $value['date'];
@@ -1916,11 +1916,11 @@  discard block
 block discarded – undo
1916 1916
     				}
1917 1917
 	    			$alldata = $pall;
1918 1918
 				foreach ($alldata as $number) {
1919
-					$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);
1919
+					$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);
1920 1920
 				}
1921 1921
 				echo '...Arrival'."\n";
1922
-				$pall = $Spotter->getLast7DaysAirportsArrival('',$filter);
1923
-    				$dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter);
1922
+				$pall = $Spotter->getLast7DaysAirportsArrival('', $filter);
1923
+    				$dall = $Spotter->getLast7DaysDetectedAirportsArrival('', $filter);
1924 1924
 				foreach ($dall as $value) {
1925 1925
 					$icao = $value['arrival_airport_icao'];
1926 1926
 					$ddate = $value['date'];
@@ -1938,32 +1938,32 @@  discard block
 block discarded – undo
1938 1938
     				}
1939 1939
     				$alldata = $pall;
1940 1940
 				foreach ($alldata as $number) {
1941
-					$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);
1941
+					$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);
1942 1942
 				}
1943 1943
     
1944 1944
 				echo 'Flights data...'."\n";
1945 1945
 				echo '-> countAllDatesLastMonth...'."\n";
1946 1946
 				$alldata = $Spotter->countAllDatesLastMonth($filter);
1947 1947
 				foreach ($alldata as $number) {
1948
-					$this->addStatFlight('month',$number['date_name'],$number['date_count'], '',$filter_name);
1948
+					$this->addStatFlight('month', $number['date_name'], $number['date_count'], '', $filter_name);
1949 1949
 				}
1950 1950
 				echo '-> countAllDates...'."\n";
1951
-				$previousdata = $this->countAllDates('',$filter_name);
1952
-				$alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter));
1951
+				$previousdata = $this->countAllDates('', $filter_name);
1952
+				$alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter));
1953 1953
 				$values = array();
1954 1954
 				foreach ($alldata as $cnt) {
1955 1955
 					$values[] = $cnt['date_count'];
1956 1956
 				}
1957
-				array_multisort($values,SORT_DESC,$alldata);
1958
-				array_splice($alldata,11);
1957
+				array_multisort($values, SORT_DESC, $alldata);
1958
+				array_splice($alldata, 11);
1959 1959
 				foreach ($alldata as $number) {
1960
-					$this->addStatFlight('date',$number['date_name'],$number['date_count'],'',$filter_name);
1960
+					$this->addStatFlight('date', $number['date_name'], $number['date_count'], '', $filter_name);
1961 1961
 				}
1962 1962
 				
1963 1963
 				echo '-> countAllHours...'."\n";
1964
-				$alldata = $Spotter->countAllHours('hour',$filter);
1964
+				$alldata = $Spotter->countAllHours('hour', $filter);
1965 1965
 				foreach ($alldata as $number) {
1966
-					$this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],'',$filter_name);
1966
+					$this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], '', $filter_name);
1967 1967
 				}
1968 1968
 			}
1969 1969
 	
@@ -1974,16 +1974,16 @@  discard block
 block discarded – undo
1974 1974
 				// SUM all previous month to put as year
1975 1975
 				$previous_year = date('Y');
1976 1976
 				$previous_year--;
1977
-				$this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
1978
-				$this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
1979
-				$this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
1980
-				$this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
1977
+				$this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
1978
+				$this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
1979
+				$this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
1980
+				$this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
1981 1981
 				$allairlines = $this->getAllAirlineNames();
1982 1982
 				foreach ($allairlines as $data) {
1983
-					$this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
1984
-					$this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
1985
-					$this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
1986
-					$this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
1983
+					$this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
1984
+					$this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
1985
+					$this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
1986
+					$this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
1987 1987
 				}
1988 1988
 				
1989 1989
 				if (isset($globalArchiveYear) && $globalArchiveYear) {
@@ -1992,7 +1992,7 @@  discard block
 block discarded – undo
1992 1992
 						try {
1993 1993
 							$sth = $this->db->prepare($query);
1994 1994
 							$sth->execute();
1995
-						} catch(PDOException $e) {
1995
+						} catch (PDOException $e) {
1996 1996
 							return "error : ".$e->getMessage().' - query : '.$query."\n";
1997 1997
 						}
1998 1998
 					}
@@ -2001,7 +2001,7 @@  discard block
 block discarded – undo
2001 2001
 					try {
2002 2002
 						$sth = $this->db->prepare($query);
2003 2003
 						$sth->execute();
2004
-					} catch(PDOException $e) {
2004
+					} catch (PDOException $e) {
2005 2005
 						return "error : ".$e->getMessage().' - query : '.$query."\n";
2006 2006
 					}
2007 2007
 				}
@@ -2023,7 +2023,7 @@  discard block
 block discarded – undo
2023 2023
 					try {
2024 2024
 						$sth = $this->db->prepare($query);
2025 2025
 						$sth->execute();
2026
-					} catch(PDOException $e) {
2026
+					} catch (PDOException $e) {
2027 2027
 						return "error : ".$e->getMessage();
2028 2028
 					}
2029 2029
 				}
@@ -2037,13 +2037,13 @@  discard block
 block discarded – undo
2037 2037
 				try {
2038 2038
 					$sth = $this->db->prepare($query);
2039 2039
 					$sth->execute();
2040
-				} catch(PDOException $e) {
2040
+				} catch (PDOException $e) {
2041 2041
 					return "error : ".$e->getMessage();
2042 2042
 				}
2043 2043
 			}
2044 2044
 			echo 'Insert last stats update date...'."\n";
2045 2045
 			date_default_timezone_set('UTC');
2046
-			$this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s'));
2046
+			$this->addLastStatsUpdate('last_update_stats', date('Y-m-d G:i:s'));
2047 2047
 		//}
2048 2048
 	}
2049 2049
 }
Please login to merge, or discard this patch.
install/class.update_db.php 1 patch
Spacing   +253 added lines, -253 removed lines patch added patch discarded remove patch
@@ -24,20 +24,20 @@  discard block
 block discarded – undo
24 24
 		fclose($fp);
25 25
 	}
26 26
 
27
-	public static function gunzip($in_file,$out_file_name = '') {
27
+	public static function gunzip($in_file, $out_file_name = '') {
28 28
 		//echo $in_file.' -> '.$out_file_name."\n";
29 29
 		$buffer_size = 4096; // read 4kb at a time
30 30
 		if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); 
31 31
 		if ($in_file != '' && file_exists($in_file)) {
32 32
 			// PHP version of Ubuntu use gzopen64 instead of gzopen
33
-			if (function_exists('gzopen')) $file = gzopen($in_file,'rb');
34
-			elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb');
33
+			if (function_exists('gzopen')) $file = gzopen($in_file, 'rb');
34
+			elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb');
35 35
 			else {
36 36
 				echo 'gzopen not available';
37 37
 				die;
38 38
 			}
39 39
 			$out_file = fopen($out_file_name, 'wb'); 
40
-			while(!gzeof($file)) {
40
+			while (!gzeof($file)) {
41 41
 				fwrite($out_file, gzread($file, $buffer_size));
42 42
 			}  
43 43
 			fclose($out_file);
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 		try {
62 62
 			self::$db_sqlite = new PDO('sqlite:'.$database);
63 63
 			self::$db_sqlite->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
64
-		} catch(PDOException $e) {
64
+		} catch (PDOException $e) {
65 65
 			return "error : ".$e->getMessage();
66 66
 		}
67 67
 	}
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 			//$Connection = new Connection();
77 77
 			$sth = $Connection->db->prepare($query);
78 78
                         $sth->execute(array(':source' => $database_file));
79
-                } catch(PDOException $e) {
79
+                } catch (PDOException $e) {
80 80
                         return "error : ".$e->getMessage();
81 81
                 }
82 82
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 		try {
88 88
                         $sth = update_db::$db_sqlite->prepare($query);
89 89
                         $sth->execute();
90
-                } catch(PDOException $e) {
90
+                } catch (PDOException $e) {
91 91
                         return "error : ".$e->getMessage();
92 92
                 }
93 93
 		//$query_dest = 'INSERT INTO routes (`RouteID`,`CallSign`,`Operator_ICAO`,`FromAirport_ICAO`,`ToAirport_ICAO`,`RouteStop`,`Source`) VALUES (:RouteID, :CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)';
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
 			if ($globalTransaction) $Connection->db->beginTransaction();
99 99
             		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
100 100
 				//$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file);
101
-				$query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file);
101
+				$query_dest_values = array(':CallSign' => $values['Callsign'], ':Operator_ICAO' => $values['operator_icao'], ':FromAirport_ICAO' => $values['FromAirportIcao'], ':ToAirport_ICAO' => $values['ToAirportIcao'], ':routestop' => $values['AllStop'], ':source' => $database_file);
102 102
 				$sth_dest->execute($query_dest_values);
103 103
             		}
104 104
 			if ($globalTransaction) $Connection->db->commit();
105
-		} catch(PDOException $e) {
105
+		} catch (PDOException $e) {
106 106
 			if ($globalTransaction) $Connection->db->rollBack(); 
107 107
 			return "error : ".$e->getMessage();
108 108
 		}
@@ -118,26 +118,26 @@  discard block
 block discarded – undo
118 118
 			//$Connection = new Connection();
119 119
 			$sth = $Connection->db->prepare($query);
120 120
                         $sth->execute(array(':source' => 'oneworld'));
121
-                } catch(PDOException $e) {
121
+                } catch (PDOException $e) {
122 122
                         return "error : ".$e->getMessage();
123 123
                 }
124 124
 
125 125
     		if ($globalDebug) echo " - Add routes to DB -";
126 126
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
127 127
 		$Spotter = new Spotter();
128
-		if ($fh = fopen($database_file,"r")) {
128
+		if ($fh = fopen($database_file, "r")) {
129 129
 			$query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)';
130 130
 			$Connection = new Connection();
131 131
 			$sth_dest = $Connection->db->prepare($query_dest);
132 132
 			if ($globalTransaction) $Connection->db->beginTransaction();
133 133
 			while (!feof($fh)) {
134
-				$line = fgetcsv($fh,9999,',');
134
+				$line = fgetcsv($fh, 9999, ',');
135 135
 				if ($line[0] != '') {
136 136
 					if (($line[2] == '-' || ($line[2] != '-' && (strtotime($line[2]) > time()))) && ($line[3] == '-' || ($line[3] != '-' && (strtotime($line[3]) < time())))) {
137 137
 						try {
138
-							$query_dest_values = array(':CallSign' => str_replace('*','',$line[7]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[5],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[6],':routestop' => '',':source' => 'oneworld');
138
+							$query_dest_values = array(':CallSign' => str_replace('*', '', $line[7]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[5], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[6], ':routestop' => '', ':source' => 'oneworld');
139 139
 							$sth_dest->execute($query_dest_values);
140
-						} catch(PDOException $e) {
140
+						} catch (PDOException $e) {
141 141
 							if ($globalTransaction) $Connection->db->rollBack(); 
142 142
 							return "error : ".$e->getMessage();
143 143
 						}
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 			//$Connection = new Connection();
160 160
 			$sth = $Connection->db->prepare($query);
161 161
                         $sth->execute(array(':source' => 'skyteam'));
162
-                } catch(PDOException $e) {
162
+                } catch (PDOException $e) {
163 163
                         return "error : ".$e->getMessage();
164 164
                 }
165 165
 
@@ -167,24 +167,24 @@  discard block
 block discarded – undo
167 167
 
168 168
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
169 169
 		$Spotter = new Spotter();
170
-		if ($fh = fopen($database_file,"r")) {
170
+		if ($fh = fopen($database_file, "r")) {
171 171
 			$query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)';
172 172
 			$Connection = new Connection();
173 173
 			$sth_dest = $Connection->db->prepare($query_dest);
174 174
 			try {
175 175
 				if ($globalTransaction) $Connection->db->beginTransaction();
176 176
 				while (!feof($fh)) {
177
-					$line = fgetcsv($fh,9999,',');
177
+					$line = fgetcsv($fh, 9999, ',');
178 178
 					if ($line[0] != '') {
179
-						$datebe = explode('  -  ',$line[2]);
179
+						$datebe = explode('  -  ', $line[2]);
180 180
 						if (strtotime($datebe[0]) > time() && strtotime($datebe[1]) < time()) {
181
-							$query_dest_values = array(':CallSign' => str_replace('*','',$line[6]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[4],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[5],':routestop' => '',':source' => 'skyteam');
181
+							$query_dest_values = array(':CallSign' => str_replace('*', '', $line[6]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[4], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[5], ':routestop' => '', ':source' => 'skyteam');
182 182
 							$sth_dest->execute($query_dest_values);
183 183
 						}
184 184
 					}
185 185
 				}
186 186
 				if ($globalTransaction) $Connection->db->commit();
187
-			} catch(PDOException $e) {
187
+			} catch (PDOException $e) {
188 188
 				if ($globalTransaction) $Connection->db->rollBack(); 
189 189
 				return "error : ".$e->getMessage();
190 190
 			}
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 			$Connection = new Connection();
200 200
 			$sth = $Connection->db->prepare($query);
201 201
                         $sth->execute(array(':source' => $database_file));
202
-                } catch(PDOException $e) {
202
+                } catch (PDOException $e) {
203 203
                         return "error : ".$e->getMessage();
204 204
                 }
205 205
 		$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source";
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 			$Connection = new Connection();
208 208
 			$sth = $Connection->db->prepare($query);
209 209
                         $sth->execute(array(':source' => $database_file));
210
-                } catch(PDOException $e) {
210
+                } catch (PDOException $e) {
211 211
                         return "error : ".$e->getMessage();
212 212
                 }
213 213
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 		try {
217 217
                         $sth = update_db::$db_sqlite->prepare($query);
218 218
                         $sth->execute();
219
-                } catch(PDOException $e) {
219
+                } catch (PDOException $e) {
220 220
                         return "error : ".$e->getMessage();
221 221
                 }
222 222
 		//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
@@ -233,15 +233,15 @@  discard block
 block discarded – undo
233 233
 			//$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']);
234 234
 				if ($values['UserString4'] == 'M') $type = 'military';
235 235
 				else $type = null;
236
-				$query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type);
236
+				$query_dest_values = array(':LastModified' => $values['LastModified'], ':ModeS' => $values['ModeS'], ':ModeSCountry' => $values['ModeSCountry'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':type' => $type);
237 237
 				$sth_dest->execute($query_dest_values);
238 238
 				if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') {
239
-				    $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']);
239
+				    $query_dest_owner_values = array(':registration' => $values['Registration'], ':source' => $database_file, ':owner' => $values['RegisteredOwners']);
240 240
 				    $sth_dest_owner->execute($query_dest_owner_values);
241 241
 				}
242 242
             		}
243 243
 			if ($globalTransaction) $Connection->db->commit();
244
-		} catch(PDOException $e) {
244
+		} catch (PDOException $e) {
245 245
 			return "error : ".$e->getMessage();
246 246
 		}
247 247
 
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 			$Connection = new Connection();
251 251
 			$sth = $Connection->db->prepare($query);
252 252
                         $sth->execute(array(':source' => $database_file));
253
-                } catch(PDOException $e) {
253
+                } catch (PDOException $e) {
254 254
                         return "error : ".$e->getMessage();
255 255
                 }
256 256
 		return '';
@@ -265,11 +265,11 @@  discard block
 block discarded – undo
265 265
 			$Connection = new Connection();
266 266
 			$sth = $Connection->db->prepare($query);
267 267
                         $sth->execute(array(':source' => $database_file));
268
-                } catch(PDOException $e) {
268
+                } catch (PDOException $e) {
269 269
                         return "error : ".$e->getMessage();
270 270
                 }
271 271
 		
272
-		if ($fh = fopen($database_file,"r")) {
272
+		if ($fh = fopen($database_file, "r")) {
273 273
 			//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
274 274
 			$query_dest = 'INSERT INTO aircraft_modes (ModeS,Registration,ICAOTypeCode,Source) VALUES (:ModeS,:Registration,:ICAOTypeCode,:source)';
275 275
 		
@@ -279,13 +279,13 @@  discard block
 block discarded – undo
279 279
 				if ($globalTransaction) $Connection->db->beginTransaction();
280 280
             			while (!feof($fh)) {
281 281
             				$values = array();
282
-            				$line = $Common->hex2str(fgets($fh,9999));
282
+            				$line = $Common->hex2str(fgets($fh, 9999));
283 283
 					//FFFFFF                     RIDEAU VALLEY SOARINGASW-20               C-FBKN MZ 123.400
284
-            				$values['ModeS'] = substr($line,0,6);
285
-            				$values['Registration'] = trim(substr($line,69,6));
286
-            				$aircraft_name = trim(substr($line,48,6));
284
+            				$values['ModeS'] = substr($line, 0, 6);
285
+            				$values['Registration'] = trim(substr($line, 69, 6));
286
+            				$aircraft_name = trim(substr($line, 48, 6));
287 287
             				// Check if we can find ICAO, else set it to GLID
288
-            				$aircraft_name_split = explode(' ',$aircraft_name);
288
+            				$aircraft_name_split = explode(' ', $aircraft_name);
289 289
             				$search_more = '';
290 290
             				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
291 291
             				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
@@ -297,20 +297,20 @@  discard block
 block discarded – undo
297 297
 	            				if (isset($result['icao']) && $result['icao'] != '') {
298 298
 	            				    $values['ICAOTypeCode'] = $result['icao'];
299 299
 	            				} 
300
-					} catch(PDOException $e) {
300
+					} catch (PDOException $e) {
301 301
 						return "error : ".$e->getMessage();
302 302
 					}
303 303
 					if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID';
304 304
 					// Add data to db
305 305
 					if ($values['ModeS'] != '' && $values['Registration'] != '' && $values['Registration'] != '0000') {
306 306
 						//$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']);
307
-						$query_dest_values = array(':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file);
307
+						$query_dest_values = array(':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file);
308 308
 						//print_r($query_dest_values);
309 309
 						$sth_dest->execute($query_dest_values);
310 310
 					}
311 311
 				}
312 312
 				if ($globalTransaction) $Connection->db->commit();
313
-			} catch(PDOException $e) {
313
+			} catch (PDOException $e) {
314 314
 				return "error : ".$e->getMessage();
315 315
 			}
316 316
 		}
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 			$Connection = new Connection();
321 321
 			$sth = $Connection->db->prepare($query);
322 322
                         $sth->execute(array(':source' => $database_file));
323
-                } catch(PDOException $e) {
323
+                } catch (PDOException $e) {
324 324
                         return "error : ".$e->getMessage();
325 325
                 }
326 326
 		return '';
@@ -334,11 +334,11 @@  discard block
 block discarded – undo
334 334
 			$Connection = new Connection();
335 335
 			$sth = $Connection->db->prepare($query);
336 336
                         $sth->execute(array(':source' => $database_file));
337
-                } catch(PDOException $e) {
337
+                } catch (PDOException $e) {
338 338
                         return "error : ".$e->getMessage();
339 339
                 }
340 340
 		
341
-		if ($fh = fopen($database_file,"r")) {
341
+		if ($fh = fopen($database_file, "r")) {
342 342
 			//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
343 343
 			$query_dest = 'INSERT INTO aircraft_modes (ModeS,Registration,ICAOTypeCode,Source) VALUES (:ModeS,:Registration,:ICAOTypeCode,:source)';
344 344
 		
@@ -346,9 +346,9 @@  discard block
 block discarded – undo
346 346
 			$sth_dest = $Connection->db->prepare($query_dest);
347 347
 			try {
348 348
 				if ($globalTransaction) $Connection->db->beginTransaction();
349
-				$tmp = fgetcsv($fh,9999,',',"'");
349
+				$tmp = fgetcsv($fh, 9999, ',', "'");
350 350
             			while (!feof($fh)) {
351
-            				$line = fgetcsv($fh,9999,',',"'");
351
+            				$line = fgetcsv($fh, 9999, ',', "'");
352 352
             				
353 353
 					//FFFFFF                     RIDEAU VALLEY SOARINGASW-20               C-FBKN MZ 123.400
354 354
 					//print_r($line);
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
             				$values['Registration'] = $line[3];
357 357
             				$aircraft_name = $line[2];
358 358
             				// Check if we can find ICAO, else set it to GLID
359
-            				$aircraft_name_split = explode(' ',$aircraft_name);
359
+            				$aircraft_name_split = explode(' ', $aircraft_name);
360 360
             				$search_more = '';
361 361
             				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
362 362
             				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
@@ -365,20 +365,20 @@  discard block
 block discarded – undo
365 365
                                     		$sth_search->execute();
366 366
 	            				$result = $sth_search->fetch(PDO::FETCH_ASSOC);
367 367
 	            				if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao'];
368
-					} catch(PDOException $e) {
368
+					} catch (PDOException $e) {
369 369
 						return "error : ".$e->getMessage();
370 370
 					}
371 371
 					//if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID';
372 372
 					// Add data to db
373 373
 					if ($values['ModeS'] != '' && $values['Registration'] != '' && $values['Registration'] != '0000' && $values['ICAOTypeCode'] != '') {
374 374
 						//$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']);
375
-						$query_dest_values = array(':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file);
375
+						$query_dest_values = array(':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file);
376 376
 						//print_r($query_dest_values);
377 377
 						$sth_dest->execute($query_dest_values);
378 378
 					}
379 379
 				}
380 380
 				if ($globalTransaction) $Connection->db->commit();
381
-			} catch(PDOException $e) {
381
+			} catch (PDOException $e) {
382 382
 				return "error : ".$e->getMessage();
383 383
 			}
384 384
 		}
@@ -388,13 +388,13 @@  discard block
 block discarded – undo
388 388
 			$Connection = new Connection();
389 389
 			$sth = $Connection->db->prepare($query);
390 390
                         $sth->execute(array(':source' => $database_file));
391
-                } catch(PDOException $e) {
391
+                } catch (PDOException $e) {
392 392
                         return "error : ".$e->getMessage();
393 393
                 }
394 394
 		return '';
395 395
 	}
396 396
 
397
-	public static function retrieve_owner($database_file,$country = 'F') {
397
+	public static function retrieve_owner($database_file, $country = 'F') {
398 398
 		global $globalTransaction;
399 399
 		//$query = 'TRUNCATE TABLE aircraft_modes';
400 400
 		$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source";
@@ -402,11 +402,11 @@  discard block
 block discarded – undo
402 402
 			$Connection = new Connection();
403 403
 			$sth = $Connection->db->prepare($query);
404 404
                         $sth->execute(array(':source' => $database_file));
405
-                } catch(PDOException $e) {
405
+                } catch (PDOException $e) {
406 406
                         return "error : ".$e->getMessage();
407 407
                 }
408 408
 		
409
-		if ($fh = fopen($database_file,"r")) {
409
+		if ($fh = fopen($database_file, "r")) {
410 410
 			//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
411 411
 			$query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)';
412 412
 		
@@ -414,9 +414,9 @@  discard block
 block discarded – undo
414 414
 			$sth_dest = $Connection->db->prepare($query_dest);
415 415
 			try {
416 416
 				if ($globalTransaction) $Connection->db->beginTransaction();
417
-				$tmp = fgetcsv($fh,9999,',','"');
417
+				$tmp = fgetcsv($fh, 9999, ',', '"');
418 418
             			while (!feof($fh)) {
419
-            				$line = fgetcsv($fh,9999,',','"');
419
+            				$line = fgetcsv($fh, 9999, ',', '"');
420 420
             				$values = array();
421 421
             				//print_r($line);
422 422
             				if ($country == 'F') {
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
             				    $values['base'] = $line[4];
425 425
             				    $values['owner'] = $line[5];
426 426
             				    if ($line[6] == '') $values['date_first_reg'] = null;
427
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
427
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6]));
428 428
 					    $values['cancel'] = $line[7];
429 429
 					} elseif ($country == 'EI') {
430 430
 					    // TODO : add modeS & reg to aircraft_modes
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
             				    $values['base'] = $line[3];
433 433
             				    $values['owner'] = $line[2];
434 434
             				    if ($line[1] == '') $values['date_first_reg'] = null;
435
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
435
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[1]));
436 436
 					    $values['cancel'] = '';
437 437
 					} elseif ($country == 'HB') {
438 438
 					    // TODO : add modeS & reg to aircraft_modes
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
             				    $values['base'] = null;
448 448
             				    $values['owner'] = $line[5];
449 449
             				    if ($line[18] == '') $values['date_first_reg'] = null;
450
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
450
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[18]));
451 451
 					    $values['cancel'] = '';
452 452
 					} elseif ($country == 'VH') {
453 453
 					    // TODO : add modeS & reg to aircraft_modes
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
             				    $values['base'] = null;
456 456
             				    $values['owner'] = $line[12];
457 457
             				    if ($line[28] == '') $values['date_first_reg'] = null;
458
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
458
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[28]));
459 459
 
460 460
 					    $values['cancel'] = $line[39];
461 461
 					} elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') {
@@ -475,28 +475,28 @@  discard block
 block discarded – undo
475 475
             				    $values['base'] = null;
476 476
             				    $values['owner'] = $line[8];
477 477
             				    if ($line[7] == '') $values['date_first_reg'] = null;
478
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
478
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7]));
479 479
 					    $values['cancel'] = '';
480 480
 					} elseif ($country == 'PP') {
481 481
             				    $values['registration'] = $line[0];
482 482
             				    $values['base'] = null;
483 483
             				    $values['owner'] = $line[4];
484 484
             				    if ($line[6] == '') $values['date_first_reg'] = null;
485
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
485
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6]));
486 486
 					    $values['cancel'] = $line[7];
487 487
 					} elseif ($country == 'E7') {
488 488
             				    $values['registration'] = $line[0];
489 489
             				    $values['base'] = null;
490 490
             				    $values['owner'] = $line[4];
491 491
             				    if ($line[5] == '') $values['date_first_reg'] = null;
492
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
492
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[5]));
493 493
 					    $values['cancel'] = '';
494 494
 					} elseif ($country == '8Q') {
495 495
             				    $values['registration'] = $line[0];
496 496
             				    $values['base'] = null;
497 497
             				    $values['owner'] = $line[3];
498 498
             				    if ($line[7] == '') $values['date_first_reg'] = null;
499
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
499
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7]));
500 500
 					    $values['cancel'] = '';
501 501
 					} elseif ($country == 'ZK' || $country == 'OM' || $country == 'TF') {
502 502
             				    $values['registration'] = $line[0];
@@ -506,12 +506,12 @@  discard block
 block discarded – undo
506 506
 					    $values['cancel'] = '';
507 507
 					}
508 508
 					if ($values['cancel'] == '' && $values['registration'] != null) {
509
-						$query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file);
509
+						$query_dest_values = array(':registration' => $values['registration'], ':base' => $values['base'], ':date_first_reg' => $values['date_first_reg'], ':owner' => $values['owner'], ':source' => $database_file);
510 510
 						$sth_dest->execute($query_dest_values);
511 511
 					}
512 512
 				}
513 513
 				if ($globalTransaction) $Connection->db->commit();
514
-			} catch(PDOException $e) {
514
+			} catch (PDOException $e) {
515 515
 				return "error : ".$e->getMessage();
516 516
 			}
517 517
 		}
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
 			$Connection = new Connection();
627 627
 			$sth = $Connection->db->prepare($query);
628 628
                         $sth->execute();
629
-                } catch(PDOException $e) {
629
+                } catch (PDOException $e) {
630 630
                         return "error : ".$e->getMessage();
631 631
                 }
632 632
 
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
 			$Connection = new Connection();
637 637
 			$sth = $Connection->db->prepare($query);
638 638
                         $sth->execute();
639
-                } catch(PDOException $e) {
639
+                } catch (PDOException $e) {
640 640
                         return "error : ".$e->getMessage();
641 641
                 }
642 642
 
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
 		if ($globalTransaction) $Connection->db->beginTransaction();
648 648
   
649 649
 		$i = 0;
650
-		while($row = sparql_fetch_array($result))
650
+		while ($row = sparql_fetch_array($result))
651 651
 		{
652 652
 			if ($i >= 1) {
653 653
 			//print_r($row);
@@ -667,31 +667,31 @@  discard block
 block discarded – undo
667 667
 				$row['image'] = '';
668 668
 				$row['image_thumb'] = '';
669 669
 			} else {
670
-				$image = str_replace(' ','_',$row['image']);
670
+				$image = str_replace(' ', '_', $row['image']);
671 671
 				$digest = md5($image);
672
-				$folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image . '/220px-' . $image;
673
-				$row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/' . $folder;
674
-				$folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image;
675
-				$row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/' . $folder;
672
+				$folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image.'/220px-'.$image;
673
+				$row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/'.$folder;
674
+				$folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image;
675
+				$row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/'.$folder;
676 676
 			}
677 677
 			
678
-			$country = explode('-',$row['country']);
678
+			$country = explode('-', $row['country']);
679 679
 			$row['country'] = $country[0];
680 680
 			
681 681
 			$row['type'] = trim($row['type']);
682
-			if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i',$row['name'])) {
682
+			if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i', $row['name'])) {
683 683
 				$row['type'] = 'Military';
684 684
 			} elseif ($row['type'] == 'http://dbpedia.org/resource/Airport' || $row['type'] == 'Civil' || $row['type'] == 'Public use' || $row['type'] == 'Public' || $row['type'] == 'http://dbpedia.org/resource/Civilian' || $row['type'] == 'Public, Civilian' || $row['type'] == 'Public / Military' || $row['type'] == 'Private & Civilian' || $row['type'] == 'Civilian and Military' || $row['type'] == 'Public/military' || $row['type'] == 'Active With Few Facilities' || $row['type'] == '?ivilian' || $row['type'] == 'Civil/Military' || $row['type'] == 'NA' || $row['type'] == 'Public/Military') {
685 685
 				$row['type'] = 'small_airport';
686 686
 			}
687 687
 			
688
-			$row['city'] = urldecode(str_replace('_',' ',str_replace('http://dbpedia.org/resource/','',$row['city'])));
689
-			$query_dest_values = array(':airport_id' => $i, ':name' => $row['name'],':iata' => $row['iata'],':icao' => $row['icao'],':latitude' => $row['latitude'],':longitude' => $row['longitude'],':altitude' => $row['altitude'],':type' => $row['type'],':city' => $row['city'],':country' => $row['country'],':home_link' => $row['homepage'],':wikipedia_link' => $row['wikipedia_page'],':image' => $row['image'],':image_thumb' => $row['image_thumb']);
688
+			$row['city'] = urldecode(str_replace('_', ' ', str_replace('http://dbpedia.org/resource/', '', $row['city'])));
689
+			$query_dest_values = array(':airport_id' => $i, ':name' => $row['name'], ':iata' => $row['iata'], ':icao' => $row['icao'], ':latitude' => $row['latitude'], ':longitude' => $row['longitude'], ':altitude' => $row['altitude'], ':type' => $row['type'], ':city' => $row['city'], ':country' => $row['country'], ':home_link' => $row['homepage'], ':wikipedia_link' => $row['wikipedia_page'], ':image' => $row['image'], ':image_thumb' => $row['image_thumb']);
690 690
 			//print_r($query_dest_values);
691 691
 			
692 692
 			try {
693 693
 				$sth_dest->execute($query_dest_values);
694
-			} catch(PDOException $e) {
694
+			} catch (PDOException $e) {
695 695
 				return "error : ".$e->getMessage();
696 696
 			}
697 697
 			}
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
 			$Connection = new Connection();
706 706
 			$sth = $Connection->db->prepare($query);
707 707
                         $sth->execute();
708
-                } catch(PDOException $e) {
708
+                } catch (PDOException $e) {
709 709
                         return "error : ".$e->getMessage();
710 710
                 }
711 711
 
@@ -713,12 +713,12 @@  discard block
 block discarded – undo
713 713
 		if ($globalDebug) echo "Insert Not available Airport...\n";
714 714
 		$query = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`,`image`,`image_thumb`)
715 715
 		    VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image, :image_thumb)";
716
-		$query_values = array(':airport_id' => $i, ':name' => 'Not available',':iata' => 'NA',':icao' => 'NA',':latitude' => '0',':longitude' => '0',':altitude' => '0',':type' => 'NA',':city' => 'N/A',':country' => 'N/A',':home_link' => '',':wikipedia_link' => '',':image' => '',':image_thumb' => '');
716
+		$query_values = array(':airport_id' => $i, ':name' => 'Not available', ':iata' => 'NA', ':icao' => 'NA', ':latitude' => '0', ':longitude' => '0', ':altitude' => '0', ':type' => 'NA', ':city' => 'N/A', ':country' => 'N/A', ':home_link' => '', ':wikipedia_link' => '', ':image' => '', ':image_thumb' => '');
717 717
 		try {
718 718
 			$Connection = new Connection();
719 719
 			$sth = $Connection->db->prepare($query);
720 720
                         $sth->execute($query_values);
721
-                } catch(PDOException $e) {
721
+                } catch (PDOException $e) {
722 722
                         return "error : ".$e->getMessage();
723 723
                 }
724 724
 		$i++;
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
 		echo "Download data from ourairports.com...\n";
737 737
 		$delimiter = ',';
738 738
 		$out_file = $tmp_dir.'airports.csv';
739
-		update_db::download('http://ourairports.com/data/airports.csv',$out_file);
739
+		update_db::download('http://ourairports.com/data/airports.csv', $out_file);
740 740
 		if (!file_exists($out_file) || !is_readable($out_file)) return FALSE;
741 741
 		echo "Add data from ourairports.com...\n";
742 742
 
@@ -747,32 +747,32 @@  discard block
 block discarded – undo
747 747
 			//$Connection->db->beginTransaction();
748 748
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
749 749
 			{
750
-				if(!$header) $header = $row;
750
+				if (!$header) $header = $row;
751 751
 				else {
752 752
 					$data = array();
753 753
 					$data = array_combine($header, $row);
754 754
 					try {
755 755
 						$sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE `icao` = :icao');
756 756
 						$sth->execute(array(':icao' => $data['gps_code']));
757
-					} catch(PDOException $e) {
757
+					} catch (PDOException $e) {
758 758
 						return "error : ".$e->getMessage();
759 759
 					}
760 760
 					if ($sth->fetchColumn() > 0) {
761 761
 						$query = 'UPDATE airport SET `type` = :type WHERE icao = :icao';
762 762
 						try {
763 763
 							$sth = $Connection->db->prepare($query);
764
-							$sth->execute(array(':icao' => $data['gps_code'],':type' => $data['type']));
765
-						} catch(PDOException $e) {
764
+							$sth->execute(array(':icao' => $data['gps_code'], ':type' => $data['type']));
765
+						} catch (PDOException $e) {
766 766
 							return "error : ".$e->getMessage();
767 767
 						}
768 768
 					} else {
769 769
 						$query = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`)
770 770
 						    VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link)";
771
-						$query_values = array(':airport_id' => $i, ':name' => $data['name'],':iata' => $data['iata_code'],':icao' => $data['gps_code'],':latitude' => $data['latitude_deg'],':longitude' => $data['longitude_deg'],':altitude' => $data['elevation_ft'],':type' => $data['type'],':city' => $data['municipality'],':country' => $data['iso_country'],':home_link' => $data['home_link'],':wikipedia_link' => $data['wikipedia_link']);
771
+						$query_values = array(':airport_id' => $i, ':name' => $data['name'], ':iata' => $data['iata_code'], ':icao' => $data['gps_code'], ':latitude' => $data['latitude_deg'], ':longitude' => $data['longitude_deg'], ':altitude' => $data['elevation_ft'], ':type' => $data['type'], ':city' => $data['municipality'], ':country' => $data['iso_country'], ':home_link' => $data['home_link'], ':wikipedia_link' => $data['wikipedia_link']);
772 772
 						try {
773 773
 							$sth = $Connection->db->prepare($query);
774 774
 							$sth->execute($query_values);
775
-						} catch(PDOException $e) {
775
+						} catch (PDOException $e) {
776 776
 							return "error : ".$e->getMessage();
777 777
 						}
778 778
 						$i++;
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
 
786 786
 		echo "Download data from another free database...\n";
787 787
 		$out_file = $tmp_dir.'GlobalAirportDatabase.zip';
788
-		update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file);
788
+		update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip', $out_file);
789 789
 		if (!file_exists($out_file) || !is_readable($out_file)) return FALSE;
790 790
 		update_db::unzip($out_file);
791 791
 		$header = NULL;
@@ -797,15 +797,15 @@  discard block
 block discarded – undo
797 797
 			//$Connection->db->beginTransaction();
798 798
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
799 799
 			{
800
-				if(!$header) $header = $row;
800
+				if (!$header) $header = $row;
801 801
 				else {
802 802
 					$data = $row;
803 803
 
804 804
 					$query = 'UPDATE airport SET `city` = :city, `country` = :country WHERE icao = :icao';
805 805
 					try {
806 806
 						$sth = $Connection->db->prepare($query);
807
-						$sth->execute(array(':icao' => $data[0],':city' => ucwords(strtolower($data[3])),':country' => ucwords(strtolower($data[4]))));
808
-					} catch(PDOException $e) {
807
+						$sth->execute(array(':icao' => $data[0], ':city' => ucwords(strtolower($data[3])), ':country' => ucwords(strtolower($data[4]))));
808
+					} catch (PDOException $e) {
809 809
 						return "error : ".$e->getMessage();
810 810
 					}
811 811
 				}
@@ -819,15 +819,15 @@  discard block
 block discarded – undo
819 819
 		try {
820 820
 			$sth = $Connection->db->prepare("SELECT icao FROM airport WHERE `name` LIKE '%Air Base%'");
821 821
 			$sth->execute();
822
-		} catch(PDOException $e) {
822
+		} catch (PDOException $e) {
823 823
 			return "error : ".$e->getMessage();
824 824
 		}
825 825
 		while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
826 826
 			$query2 = 'UPDATE airport SET `type` = :type WHERE icao = :icao';
827 827
 			try {
828 828
 				$sth2 = $Connection->db->prepare($query2);
829
-				$sth2->execute(array(':icao' => $row['icao'],':type' => 'military'));
830
-			} catch(PDOException $e) {
829
+				$sth2->execute(array(':icao' => $row['icao'], ':type' => 'military'));
830
+			} catch (PDOException $e) {
831 831
 				return "error : ".$e->getMessage();
832 832
 			}
833 833
 		}
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
 			$Connection = new Connection();
852 852
 			$sth = $Connection->db->prepare($query);
853 853
                         $sth->execute(array(':source' => 'translation.csv'));
854
-                } catch(PDOException $e) {
854
+                } catch (PDOException $e) {
855 855
                         return "error : ".$e->getMessage();
856 856
                 }
857 857
 
@@ -868,7 +868,7 @@  discard block
 block discarded – undo
868 868
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
869 869
 			{
870 870
 				$i++;
871
-				if($i > 12) {
871
+				if ($i > 12) {
872 872
 					$data = $row;
873 873
 					$operator = $data[2];
874 874
 					if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) {
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
                                                 //echo substr($operator, 0, 2)."\n";;
877 877
                                                 if (count($airline_array) > 0) {
878 878
 							//print_r($airline_array);
879
-							$operator = $airline_array[0]['icao'].substr($operator,2);
879
+							$operator = $airline_array[0]['icao'].substr($operator, 2);
880 880
                                                 }
881 881
                                         }
882 882
 					
@@ -884,14 +884,14 @@  discard block
 block discarded – undo
884 884
 					if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) {
885 885
                                                 $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2));
886 886
                                                 if (count($airline_array) > 0) {
887
-                                            		$operator_correct = $airline_array[0]['icao'].substr($operator_correct,2);
887
+                                            		$operator_correct = $airline_array[0]['icao'].substr($operator_correct, 2);
888 888
                                             	}
889 889
                                         }
890 890
 					$query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)';
891 891
 					try {
892 892
 						$sth = $Connection->db->prepare($query);
893
-						$sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $operator,':Operator_correct' => $operator_correct, ':source' => 'translation.csv'));
894
-					} catch(PDOException $e) {
893
+						$sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $operator, ':Operator_correct' => $operator_correct, ':source' => 'translation.csv'));
894
+					} catch (PDOException $e) {
895 895
 						return "error : ".$e->getMessage();
896 896
 					}
897 897
 				}
@@ -911,7 +911,7 @@  discard block
 block discarded – undo
911 911
 			$Connection = new Connection();
912 912
 			$sth = $Connection->db->prepare($query);
913 913
                         $sth->execute(array(':source' => 'website_fam'));
914
-                } catch(PDOException $e) {
914
+                } catch (PDOException $e) {
915 915
                         return "error : ".$e->getMessage();
916 916
                 }
917 917
 
@@ -931,8 +931,8 @@  discard block
 block discarded – undo
931 931
 					$query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)';
932 932
 					try {
933 933
 						$sth = $Connection->db->prepare($query);
934
-						$sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $data[2],':Operator_correct' => $data[3], ':source' => 'website_fam'));
935
-					} catch(PDOException $e) {
934
+						$sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $data[2], ':Operator_correct' => $data[3], ':source' => 'website_fam'));
935
+					} catch (PDOException $e) {
936 936
 						return "error : ".$e->getMessage();
937 937
 					}
938 938
 				}
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
 			$Connection = new Connection();
952 952
 			$sth = $Connection->db->prepare($query);
953 953
                         $sth->execute(array(':source' => 'website_fam'));
954
-                } catch(PDOException $e) {
954
+                } catch (PDOException $e) {
955 955
                         return "error : ".$e->getMessage();
956 956
                 }
957 957
 
@@ -971,8 +971,8 @@  discard block
 block discarded – undo
971 971
 					$query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)';
972 972
 					try {
973 973
 						$sth = $Connection->db->prepare($query);
974
-						$sth->execute(array(':FirstCreated' => $data[0],':LastModified' => $data[1],':ModeS' => $data[2],':ModeSCountry' => $data[3], ':Registration' => $data[4],':ICAOTypeCode' => $data[5],':type_flight' => $data[6],':source' => 'website_fam'));
975
-					} catch(PDOException $e) {
974
+						$sth->execute(array(':FirstCreated' => $data[0], ':LastModified' => $data[1], ':ModeS' => $data[2], ':ModeSCountry' => $data[3], ':Registration' => $data[4], ':ICAOTypeCode' => $data[5], ':type_flight' => $data[6], ':source' => 'website_fam'));
975
+					} catch (PDOException $e) {
976 976
 						return "error : ".$e->getMessage();
977 977
 					}
978 978
 				}
@@ -991,7 +991,7 @@  discard block
 block discarded – undo
991 991
 			$Connection = new Connection();
992 992
 			$sth = $Connection->db->prepare($query);
993 993
                         $sth->execute(array(':source' => 'website_fam'));
994
-                } catch(PDOException $e) {
994
+                } catch (PDOException $e) {
995 995
                         return "error : ".$e->getMessage();
996 996
                 }
997 997
 
@@ -1011,8 +1011,8 @@  discard block
 block discarded – undo
1011 1011
 					$query = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign,:Operator_ICAO,:FromAirport_ICAO,:FromAirport_Time,:ToAirport_ICAO,:ToAirport_Time,:RouteStop,:source)';
1012 1012
 					try {
1013 1013
 						$sth = $Connection->db->prepare($query);
1014
-						$sth->execute(array(':CallSign' => $data[0],':Operator_ICAO' => $data[1],':FromAirport_ICAO' => $data[2],':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4],':ToAirport_Time' => $data[5],':RouteStop' => $data[6],':source' => 'website_fam'));
1015
-					} catch(PDOException $e) {
1014
+						$sth->execute(array(':CallSign' => $data[0], ':Operator_ICAO' => $data[1], ':FromAirport_ICAO' => $data[2], ':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4], ':ToAirport_Time' => $data[5], ':RouteStop' => $data[6], ':source' => 'website_fam'));
1015
+					} catch (PDOException $e) {
1016 1016
 						return "error : ".$e->getMessage();
1017 1017
 					}
1018 1018
 				}
@@ -1024,7 +1024,7 @@  discard block
 block discarded – undo
1024 1024
 		return '';
1025 1025
         }
1026 1026
 
1027
-	public static function tle($filename,$tletype) {
1027
+	public static function tle($filename, $tletype) {
1028 1028
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
1029 1029
 		global $tmp_dir, $globalTransaction;
1030 1030
 		//$Spotter = new Spotter();
@@ -1034,7 +1034,7 @@  discard block
 block discarded – undo
1034 1034
 			$Connection = new Connection();
1035 1035
 			$sth = $Connection->db->prepare($query);
1036 1036
                         $sth->execute(array(':source' => $filename));
1037
-                } catch(PDOException $e) {
1037
+                } catch (PDOException $e) {
1038 1038
                         return "error : ".$e->getMessage();
1039 1039
                 }
1040 1040
 		
@@ -1059,8 +1059,8 @@  discard block
 block discarded – undo
1059 1059
 					$query = 'INSERT INTO tle (tle_name,tle_tle1,tle_tle2,tle_type,tle_source) VALUES (:name, :tle1, :tle2, :type, :source)';
1060 1060
 					try {
1061 1061
 						$sth = $Connection->db->prepare($query);
1062
-						$sth->execute(array(':name' => $dbdata['name'],':tle1' => $dbdata['tle1'],':tle2' => $dbdata['tle2'], ':type' => $tletype,':source' => $filename));
1063
-					} catch(PDOException $e) {
1062
+						$sth->execute(array(':name' => $dbdata['name'], ':tle1' => $dbdata['tle1'], ':tle2' => $dbdata['tle2'], ':type' => $tletype, ':source' => $filename));
1063
+					} catch (PDOException $e) {
1064 1064
 						return "error : ".$e->getMessage();
1065 1065
 					}
1066 1066
 
@@ -1080,28 +1080,28 @@  discard block
 block discarded – undo
1080 1080
         */
1081 1081
         private static function table2array($data) {
1082 1082
                 $html = str_get_html($data);
1083
-                $tabledata=array();
1084
-                foreach($html->find('tr') as $element)
1083
+                $tabledata = array();
1084
+                foreach ($html->find('tr') as $element)
1085 1085
                 {
1086 1086
                         $td = array();
1087
-                        foreach( $element->find('th') as $row)
1087
+                        foreach ($element->find('th') as $row)
1088 1088
                         {
1089 1089
                                 $td [] = trim($row->plaintext);
1090 1090
                         }
1091
-                        $td=array_filter($td);
1091
+                        $td = array_filter($td);
1092 1092
                         $tabledata[] = $td;
1093 1093
 
1094 1094
                         $td = array();
1095 1095
                         $tdi = array();
1096
-                        foreach( $element->find('td') as $row)
1096
+                        foreach ($element->find('td') as $row)
1097 1097
                         {
1098 1098
                                 $td [] = trim($row->plaintext);
1099 1099
                                 $tdi [] = trim($row->innertext);
1100 1100
                         }
1101
-                        $td=array_filter($td);
1102
-                        $tdi=array_filter($tdi);
1101
+                        $td = array_filter($td);
1102
+                        $tdi = array_filter($tdi);
1103 1103
                     //    $tabledata[]=array_merge($td,$tdi);
1104
-                        $tabledata[]=$td;
1104
+                        $tabledata[] = $td;
1105 1105
                 }
1106 1106
                 return(array_filter($tabledata));
1107 1107
         }
@@ -1174,13 +1174,13 @@  discard block
 block discarded – undo
1174 1174
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1175 1175
 			{
1176 1176
 				$i++;
1177
-				if($i > 3 && count($row) > 2) {
1177
+				if ($i > 3 && count($row) > 2) {
1178 1178
 					$data = array_values(array_filter($row));
1179 1179
 					$cntdata = count($data);
1180 1180
 					if ($cntdata > 10) {
1181 1181
 						$value = $data[9];
1182 1182
 						
1183
-						for ($i =10;$i < $cntdata;$i++) {
1183
+						for ($i = 10; $i < $cntdata; $i++) {
1184 1184
 							$value .= ' '.$data[$i];
1185 1185
 						}
1186 1186
 						$data[9] = $value;
@@ -1190,8 +1190,8 @@  discard block
 block discarded – undo
1190 1190
 						$query = 'INSERT INTO waypoints (name_begin,latitude_begin,longitude_begin,name_end,latitude_end,longitude_end,high,base,top,segment_name) VALUES (:name_begin, :latitude_begin, :longitude_begin, :name_end, :latitude_end, :longitude_end, :high, :base, :top, :segment_name)';
1191 1191
 						try {
1192 1192
 							$sth = $Connection->db->prepare($query);
1193
-							$sth->execute(array(':name_begin' => $data[0],':latitude_begin' => $data[1],':longitude_begin' => $data[2],':name_end' => $data[3], ':latitude_end' => $data[4], ':longitude_end' => $data[5], ':high' => $data[6], ':base' => $data[7], ':top' => $data[8], ':segment_name' => $data[9]));
1194
-						} catch(PDOException $e) {
1193
+							$sth->execute(array(':name_begin' => $data[0], ':latitude_begin' => $data[1], ':longitude_begin' => $data[2], ':name_end' => $data[3], ':latitude_end' => $data[4], ':longitude_end' => $data[5], ':high' => $data[6], ':base' => $data[7], ':top' => $data[8], ':segment_name' => $data[9]));
1194
+						} catch (PDOException $e) {
1195 1195
 							return "error : ".$e->getMessage();
1196 1196
 						}
1197 1197
 					}
@@ -1212,7 +1212,7 @@  discard block
 block discarded – undo
1212 1212
 			$Connection = new Connection();
1213 1213
 			$sth = $Connection->db->prepare($query);
1214 1214
                         $sth->execute();
1215
-                } catch(PDOException $e) {
1215
+                } catch (PDOException $e) {
1216 1216
                         return "error : ".$e->getMessage();
1217 1217
                 }
1218 1218
 
@@ -1224,12 +1224,12 @@  discard block
 block discarded – undo
1224 1224
 			if ($globalTransaction) $Connection->db->beginTransaction();
1225 1225
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1226 1226
 			{
1227
-				if(count($row) > 1) {
1227
+				if (count($row) > 1) {
1228 1228
 					$query = "INSERT INTO airlines (name,icao,active,forsource) VALUES (:name, :icao, 'Y','ivao')";
1229 1229
 					try {
1230 1230
 						$sth = $Connection->db->prepare($query);
1231
-						$sth->execute(array(':name' => $row[1],':icao' => $row[0]));
1232
-					} catch(PDOException $e) {
1231
+						$sth->execute(array(':name' => $row[1], ':icao' => $row[0]));
1232
+					} catch (PDOException $e) {
1233 1233
 						return "error : ".$e->getMessage();
1234 1234
 					}
1235 1235
 				}
@@ -1249,21 +1249,21 @@  discard block
 block discarded – undo
1249 1249
 			try {
1250 1250
 				$sth = $Connection->db->prepare($query);
1251 1251
                     		$sth->execute();
1252
-	                } catch(PDOException $e) {
1252
+	                } catch (PDOException $e) {
1253 1253
 				return "error : ".$e->getMessage();
1254 1254
 	                }
1255 1255
 	        }
1256 1256
 
1257 1257
 
1258
-		if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql');
1258
+		if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz', $tmp_dir.'airspace.sql');
1259 1259
 		else {
1260
-			update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql');
1260
+			update_db::gunzip('../db/pgsql/airspace.sql.gz', $tmp_dir.'airspace.sql');
1261 1261
 			$query = "CREATE EXTENSION postgis";
1262
-			$Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']);
1262
+			$Connection = new Connection(null, null, $_SESSION['database_root'], $_SESSION['database_rootpass']);
1263 1263
 			try {
1264 1264
 				$sth = $Connection->db->prepare($query);
1265 1265
 				$sth->execute();
1266
-			} catch(PDOException $e) {
1266
+			} catch (PDOException $e) {
1267 1267
 				return "error : ".$e->getMessage();
1268 1268
 			}
1269 1269
 		}
@@ -1276,7 +1276,7 @@  discard block
 block discarded – undo
1276 1276
 		include_once('class.create_db.php');
1277 1277
 		require_once(dirname(__FILE__).'/../require/class.NOTAM.php');
1278 1278
 		if ($globalDebug) echo "NOTAM from FlightAirMap website : Download...";
1279
-		update_db::download('http://data.flightairmap.fr/data/notam.txt.gz',$tmp_dir.'notam.txt.gz');
1279
+		update_db::download('http://data.flightairmap.fr/data/notam.txt.gz', $tmp_dir.'notam.txt.gz');
1280 1280
 		$error = '';
1281 1281
 		if (file_exists($tmp_dir.'notam.txt.gz')) {
1282 1282
 			if ($globalDebug) echo "Gunzip...";
@@ -1308,14 +1308,14 @@  discard block
 block discarded – undo
1308 1308
 			try {
1309 1309
 				$sth = $Connection->db->prepare($query);
1310 1310
             	        	$sth->execute();
1311
-	                } catch(PDOException $e) {
1311
+	                } catch (PDOException $e) {
1312 1312
     	                	echo "error : ".$e->getMessage();
1313 1313
 	                }
1314 1314
 		}
1315 1315
 		if ($globalDBdriver == 'mysql') {
1316
-			update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql');
1316
+			update_db::gunzip('../db/countries.sql.gz', $tmp_dir.'countries.sql');
1317 1317
 		} else {
1318
-			update_db::gunzip('../db/pgsql/countries.sql.gz',$tmp_dir.'countries.sql');
1318
+			update_db::gunzip('../db/pgsql/countries.sql.gz', $tmp_dir.'countries.sql');
1319 1319
 		}
1320 1320
 		$error = create_db::import_file($tmp_dir.'countries.sql');
1321 1321
 		return $error;
@@ -1328,7 +1328,7 @@  discard block
 block discarded – undo
1328 1328
 //		update_db::unzip($tmp_dir.'AptNav.zip');
1329 1329
 //		update_db::download('https://gitorious.org/fg/fgdata/raw/e81f8a15424a175a7b715f8f7eb8f4147b802a27:Navaids/awy.dat.gz',$tmp_dir.'awy.dat.gz');
1330 1330
 //		update_db::download('http://sourceforge.net/p/flightgear/fgdata/ci/next/tree/Navaids/awy.dat.gz?format=raw',$tmp_dir.'awy.dat.gz','http://sourceforge.net');
1331
-		update_db::download('http://pkgs.fedoraproject.org/repo/extras/FlightGear-Atlas/awy.dat.gz/f530c9d1c4b31a288ba88dcc8224268b/awy.dat.gz',$tmp_dir.'awy.dat.gz','http://sourceforge.net');
1331
+		update_db::download('http://pkgs.fedoraproject.org/repo/extras/FlightGear-Atlas/awy.dat.gz/f530c9d1c4b31a288ba88dcc8224268b/awy.dat.gz', $tmp_dir.'awy.dat.gz', 'http://sourceforge.net');
1332 1332
 		update_db::gunzip($tmp_dir.'awy.dat.gz');
1333 1333
 		$error = update_db::waypoints($tmp_dir.'awy.dat');
1334 1334
 		return $error;
@@ -1348,7 +1348,7 @@  discard block
 block discarded – undo
1348 1348
 			update_db::ivao_airlines($tmp_dir.'data/airlines.dat');
1349 1349
 			if ($globalDebug) echo "Copy airlines logos to airlines images directory...";
1350 1350
 			if (is_writable(dirname(__FILE__).'/../images/airlines')) {
1351
-				if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo.";
1351
+				if (!$Common->xcopy($tmp_dir.'logos/', dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo.";
1352 1352
 			} else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable";
1353 1353
 		} else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed.";
1354 1354
 		if ($error != '') {
@@ -1361,7 +1361,7 @@  discard block
 block discarded – undo
1361 1361
 		global $tmp_dir, $globalDebug;
1362 1362
 		$error = '';
1363 1363
 		if ($globalDebug) echo "Routes : Download...";
1364
-		update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz');
1364
+		update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz', $tmp_dir.'StandingData.sqb.gz');
1365 1365
 		if (file_exists($tmp_dir.'StandingData.sqb.gz')) {
1366 1366
 			if ($globalDebug) echo "Gunzip...";
1367 1367
 			update_db::gunzip($tmp_dir.'StandingData.sqb.gz');
@@ -1377,7 +1377,7 @@  discard block
 block discarded – undo
1377 1377
 		global $tmp_dir, $globalDebug;
1378 1378
 		$error = '';
1379 1379
 		if ($globalDebug) echo "Schedules Oneworld : Download...";
1380
-		update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz');
1380
+		update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz', $tmp_dir.'oneworld.csv.gz');
1381 1381
 		if (file_exists($tmp_dir.'oneworld.csv.gz')) {
1382 1382
 			if ($globalDebug) echo "Gunzip...";
1383 1383
 			update_db::gunzip($tmp_dir.'oneworld.csv.gz');
@@ -1393,7 +1393,7 @@  discard block
 block discarded – undo
1393 1393
 		global $tmp_dir, $globalDebug;
1394 1394
 		$error = '';
1395 1395
 		if ($globalDebug) echo "Schedules Skyteam : Download...";
1396
-		update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz');
1396
+		update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz', $tmp_dir.'skyteam.csv.gz');
1397 1397
 		if (file_exists($tmp_dir.'skyteam.csv.gz')) {
1398 1398
 			if ($globalDebug) echo "Gunzip...";
1399 1399
 			update_db::gunzip($tmp_dir.'skyteam.csv.gz');
@@ -1421,7 +1421,7 @@  discard block
 block discarded – undo
1421 1421
 */
1422 1422
 		if ($globalDebug) echo "Modes : Download...";
1423 1423
 //		update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb');
1424
-		update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz');
1424
+		update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz', $tmp_dir.'BaseStation.sqb.gz');
1425 1425
 
1426 1426
 //		if (file_exists($tmp_dir.'basestation_latest.zip')) {
1427 1427
 		if (file_exists($tmp_dir.'BaseStation.sqb.gz')) {
@@ -1441,7 +1441,7 @@  discard block
 block discarded – undo
1441 1441
 	public static function update_ModeS_flarm() {
1442 1442
 		global $tmp_dir, $globalDebug;
1443 1443
 		if ($globalDebug) echo "Modes Flarmnet: Download...";
1444
-		update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln');
1444
+		update_db::download('http://flarmnet.org/files/data.fln', $tmp_dir.'data.fln');
1445 1445
 		if (file_exists($tmp_dir.'data.fln')) {
1446 1446
 			if ($globalDebug) echo "Add to DB...";
1447 1447
 			$error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln');
@@ -1455,7 +1455,7 @@  discard block
 block discarded – undo
1455 1455
 	public static function update_ModeS_ogn() {
1456 1456
 		global $tmp_dir, $globalDebug;
1457 1457
 		if ($globalDebug) echo "Modes OGN: Download...";
1458
-		update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv');
1458
+		update_db::download('http://ddb.glidernet.org/download/', $tmp_dir.'ogn.csv');
1459 1459
 		if (file_exists($tmp_dir.'ogn.csv')) {
1460 1460
 			if ($globalDebug) echo "Add to DB...";
1461 1461
 			$error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv');
@@ -1470,173 +1470,173 @@  discard block
 block discarded – undo
1470 1470
 		global $tmp_dir, $globalDebug;
1471 1471
 		
1472 1472
 		if ($globalDebug) echo "Owner France: Download...";
1473
-		update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv');
1473
+		update_db::download('http://antonakis.co.uk/registers/France.txt', $tmp_dir.'owner_f.csv');
1474 1474
 		if (file_exists($tmp_dir.'owner_f.csv')) {
1475 1475
 			if ($globalDebug) echo "Add to DB...";
1476
-			$error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F');
1476
+			$error = update_db::retrieve_owner($tmp_dir.'owner_f.csv', 'F');
1477 1477
 		} else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed.";
1478 1478
 		if ($error != '') {
1479 1479
 			return $error;
1480 1480
 		} elseif ($globalDebug) echo "Done\n";
1481 1481
 		
1482 1482
 		if ($globalDebug) echo "Owner Ireland: Download...";
1483
-		update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv');
1483
+		update_db::download('http://antonakis.co.uk/registers/Ireland.txt', $tmp_dir.'owner_ei.csv');
1484 1484
 		if (file_exists($tmp_dir.'owner_ei.csv')) {
1485 1485
 			if ($globalDebug) echo "Add to DB...";
1486
-			$error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI');
1486
+			$error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv', 'EI');
1487 1487
 		} else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed.";
1488 1488
 		if ($error != '') {
1489 1489
 			return $error;
1490 1490
 		} elseif ($globalDebug) echo "Done\n";
1491 1491
 		if ($globalDebug) echo "Owner Switzerland: Download...";
1492
-		update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv');
1492
+		update_db::download('http://antonakis.co.uk/registers/Switzerland.txt', $tmp_dir.'owner_hb.csv');
1493 1493
 		if (file_exists($tmp_dir.'owner_hb.csv')) {
1494 1494
 			if ($globalDebug) echo "Add to DB...";
1495
-			$error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB');
1495
+			$error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv', 'HB');
1496 1496
 		} else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed.";
1497 1497
 		if ($error != '') {
1498 1498
 			return $error;
1499 1499
 		} elseif ($globalDebug) echo "Done\n";
1500 1500
 		if ($globalDebug) echo "Owner Czech Republic: Download...";
1501
-		update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv');
1501
+		update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt', $tmp_dir.'owner_ok.csv');
1502 1502
 		if (file_exists($tmp_dir.'owner_ok.csv')) {
1503 1503
 			if ($globalDebug) echo "Add to DB...";
1504
-			$error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK');
1504
+			$error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv', 'OK');
1505 1505
 		} else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed.";
1506 1506
 		if ($error != '') {
1507 1507
 			return $error;
1508 1508
 		} elseif ($globalDebug) echo "Done\n";
1509 1509
 		if ($globalDebug) echo "Owner Australia: Download...";
1510
-		update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv');
1510
+		update_db::download('http://antonakis.co.uk/registers/Australia.txt', $tmp_dir.'owner_vh.csv');
1511 1511
 		if (file_exists($tmp_dir.'owner_vh.csv')) {
1512 1512
 			if ($globalDebug) echo "Add to DB...";
1513
-			$error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH');
1513
+			$error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv', 'VH');
1514 1514
 		} else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed.";
1515 1515
 		if ($error != '') {
1516 1516
 			return $error;
1517 1517
 		} elseif ($globalDebug) echo "Done\n";
1518 1518
 		if ($globalDebug) echo "Owner Austria: Download...";
1519
-		update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv');
1519
+		update_db::download('http://antonakis.co.uk/registers/Austria.txt', $tmp_dir.'owner_oe.csv');
1520 1520
 		if (file_exists($tmp_dir.'owner_oe.csv')) {
1521 1521
 			if ($globalDebug) echo "Add to DB...";
1522
-			$error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE');
1522
+			$error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv', 'OE');
1523 1523
 		} else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed.";
1524 1524
 		if ($error != '') {
1525 1525
 			return $error;
1526 1526
 		} elseif ($globalDebug) echo "Done\n";
1527 1527
 		if ($globalDebug) echo "Owner Chile: Download...";
1528
-		update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv');
1528
+		update_db::download('http://antonakis.co.uk/registers/Chile.txt', $tmp_dir.'owner_cc.csv');
1529 1529
 		if (file_exists($tmp_dir.'owner_cc.csv')) {
1530 1530
 			if ($globalDebug) echo "Add to DB...";
1531
-			$error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC');
1531
+			$error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv', 'CC');
1532 1532
 		} else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed.";
1533 1533
 		if ($error != '') {
1534 1534
 			return $error;
1535 1535
 		} elseif ($globalDebug) echo "Done\n";
1536 1536
 		if ($globalDebug) echo "Owner Colombia: Download...";
1537
-		update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv');
1537
+		update_db::download('http://antonakis.co.uk/registers/Colombia.txt', $tmp_dir.'owner_hj.csv');
1538 1538
 		if (file_exists($tmp_dir.'owner_hj.csv')) {
1539 1539
 			if ($globalDebug) echo "Add to DB...";
1540
-			$error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ');
1540
+			$error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv', 'HJ');
1541 1541
 		} else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed.";
1542 1542
 		if ($error != '') {
1543 1543
 			return $error;
1544 1544
 		} elseif ($globalDebug) echo "Done\n";
1545 1545
 		if ($globalDebug) echo "Owner Bosnia Herzegobina: Download...";
1546
-		update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv');
1546
+		update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt', $tmp_dir.'owner_e7.csv');
1547 1547
 		if (file_exists($tmp_dir.'owner_e7.csv')) {
1548 1548
 			if ($globalDebug) echo "Add to DB...";
1549
-			$error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7');
1549
+			$error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv', 'E7');
1550 1550
 		} else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed.";
1551 1551
 		if ($error != '') {
1552 1552
 			return $error;
1553 1553
 		} elseif ($globalDebug) echo "Done\n";
1554 1554
 		if ($globalDebug) echo "Owner Brazil: Download...";
1555
-		update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv');
1555
+		update_db::download('http://antonakis.co.uk/registers/Brazil.txt', $tmp_dir.'owner_pp.csv');
1556 1556
 		if (file_exists($tmp_dir.'owner_pp.csv')) {
1557 1557
 			if ($globalDebug) echo "Add to DB...";
1558
-			$error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP');
1558
+			$error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv', 'PP');
1559 1559
 		} else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed.";
1560 1560
 		if ($error != '') {
1561 1561
 			return $error;
1562 1562
 		} elseif ($globalDebug) echo "Done\n";
1563 1563
 		if ($globalDebug) echo "Owner Cayman Islands: Download...";
1564
-		update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv');
1564
+		update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt', $tmp_dir.'owner_vp.csv');
1565 1565
 		if (file_exists($tmp_dir.'owner_vp.csv')) {
1566 1566
 			if ($globalDebug) echo "Add to DB...";
1567
-			$error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP');
1567
+			$error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv', 'VP');
1568 1568
 		} else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed.";
1569 1569
 		if ($error != '') {
1570 1570
 			return $error;
1571 1571
 		} elseif ($globalDebug) echo "Done\n";
1572 1572
 		if ($globalDebug) echo "Owner Croatia: Download...";
1573
-		update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv');
1573
+		update_db::download('http://antonakis.co.uk/registers/Croatia.txt', $tmp_dir.'owner_9a.csv');
1574 1574
 		if (file_exists($tmp_dir.'owner_9a.csv')) {
1575 1575
 			if ($globalDebug) echo "Add to DB...";
1576
-			$error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A');
1576
+			$error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv', '9A');
1577 1577
 		} else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed.";
1578 1578
 		if ($error != '') {
1579 1579
 			return $error;
1580 1580
 		} elseif ($globalDebug) echo "Done\n";
1581 1581
 		if ($globalDebug) echo "Owner Luxembourg: Download...";
1582
-		update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv');
1582
+		update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt', $tmp_dir.'owner_lx.csv');
1583 1583
 		if (file_exists($tmp_dir.'owner_lx.csv')) {
1584 1584
 			if ($globalDebug) echo "Add to DB...";
1585
-			$error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX');
1585
+			$error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv', 'LX');
1586 1586
 		} else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed.";
1587 1587
 		if ($error != '') {
1588 1588
 			return $error;
1589 1589
 		} elseif ($globalDebug) echo "Done\n";
1590 1590
 		if ($globalDebug) echo "Owner Maldives: Download...";
1591
-		update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv');
1591
+		update_db::download('http://antonakis.co.uk/registers/Maldives.txt', $tmp_dir.'owner_8q.csv');
1592 1592
 		if (file_exists($tmp_dir.'owner_8q.csv')) {
1593 1593
 			if ($globalDebug) echo "Add to DB...";
1594
-			$error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q');
1594
+			$error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv', '8Q');
1595 1595
 		} else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed.";
1596 1596
 		if ($error != '') {
1597 1597
 			return $error;
1598 1598
 		} elseif ($globalDebug) echo "Done\n";
1599 1599
 		if ($globalDebug) echo "Owner New Zealand: Download...";
1600
-		update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv');
1600
+		update_db::download('http://antonakis.co.uk/registers/NewZealand.txt', $tmp_dir.'owner_zk.csv');
1601 1601
 		if (file_exists($tmp_dir.'owner_zk.csv')) {
1602 1602
 			if ($globalDebug) echo "Add to DB...";
1603
-			$error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK');
1603
+			$error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv', 'ZK');
1604 1604
 		} else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed.";
1605 1605
 		if ($error != '') {
1606 1606
 			return $error;
1607 1607
 		} elseif ($globalDebug) echo "Done\n";
1608 1608
 		if ($globalDebug) echo "Owner Papua New Guinea: Download...";
1609
-		update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv');
1609
+		update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt', $tmp_dir.'owner_p2.csv');
1610 1610
 		if (file_exists($tmp_dir.'owner_p2.csv')) {
1611 1611
 			if ($globalDebug) echo "Add to DB...";
1612
-			$error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2');
1612
+			$error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv', 'P2');
1613 1613
 		} else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed.";
1614 1614
 		if ($error != '') {
1615 1615
 			return $error;
1616 1616
 		} elseif ($globalDebug) echo "Done\n";
1617 1617
 		if ($globalDebug) echo "Owner Slovakia: Download...";
1618
-		update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv');
1618
+		update_db::download('http://antonakis.co.uk/registers/Slovakia.txt', $tmp_dir.'owner_om.csv');
1619 1619
 		if (file_exists($tmp_dir.'owner_om.csv')) {
1620 1620
 			if ($globalDebug) echo "Add to DB...";
1621
-			$error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM');
1621
+			$error = update_db::retrieve_owner($tmp_dir.'owner_om.csv', 'OM');
1622 1622
 		} else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed.";
1623 1623
 		if ($error != '') {
1624 1624
 			return $error;
1625 1625
 		} elseif ($globalDebug) echo "Done\n";
1626 1626
 		if ($globalDebug) echo "Owner Ecuador: Download...";
1627
-		update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv');
1627
+		update_db::download('http://antonakis.co.uk/registers/Ecuador.txt', $tmp_dir.'owner_hc.csv');
1628 1628
 		if (file_exists($tmp_dir.'owner_hc.csv')) {
1629 1629
 			if ($globalDebug) echo "Add to DB...";
1630
-			$error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC');
1630
+			$error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv', 'HC');
1631 1631
 		} else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed.";
1632 1632
 		if ($error != '') {
1633 1633
 			return $error;
1634 1634
 		} elseif ($globalDebug) echo "Done\n";
1635 1635
 		if ($globalDebug) echo "Owner Iceland: Download...";
1636
-		update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv');
1636
+		update_db::download('http://antonakis.co.uk/registers/Iceland.txt', $tmp_dir.'owner_tf.csv');
1637 1637
 		if (file_exists($tmp_dir.'owner_tf.csv')) {
1638 1638
 			if ($globalDebug) echo "Add to DB...";
1639
-			$error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF');
1639
+			$error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv', 'TF');
1640 1640
 		} else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed.";
1641 1641
 		if ($error != '') {
1642 1642
 			return $error;
@@ -1648,7 +1648,7 @@  discard block
 block discarded – undo
1648 1648
 		global $tmp_dir, $globalDebug;
1649 1649
 		$error = '';
1650 1650
 		if ($globalDebug) echo "Translation : Download...";
1651
-		update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip');
1651
+		update_db::download('http://www.acarsd.org/download/translation.php', $tmp_dir.'translation.zip');
1652 1652
 		if (file_exists($tmp_dir.'translation.zip')) {
1653 1653
 			if ($globalDebug) echo "Unzip...";
1654 1654
 			update_db::unzip($tmp_dir.'translation.zip');
@@ -1664,7 +1664,7 @@  discard block
 block discarded – undo
1664 1664
 	public static function update_translation_fam() {
1665 1665
 		global $tmp_dir, $globalDebug;
1666 1666
 		if ($globalDebug) echo "Translation from FlightAirMap website : Download...";
1667
-		update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz');
1667
+		update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz', $tmp_dir.'translation.tsv.gz');
1668 1668
 		if (file_exists($tmp_dir.'translation.tsv.gz')) {
1669 1669
 			if ($globalDebug) echo "Gunzip...";
1670 1670
 			update_db::gunzip($tmp_dir.'translation.tsv.gz');
@@ -1679,7 +1679,7 @@  discard block
 block discarded – undo
1679 1679
 	public static function update_ModeS_fam() {
1680 1680
 		global $tmp_dir, $globalDebug;
1681 1681
 		if ($globalDebug) echo "ModeS from FlightAirMap website : Download...";
1682
-		update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz');
1682
+		update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz', $tmp_dir.'modes.tsv.gz');
1683 1683
 		if (file_exists($tmp_dir.'modes.tsv.gz')) {
1684 1684
 			if ($globalDebug) echo "Gunzip...";
1685 1685
 			update_db::gunzip($tmp_dir.'modes.tsv.gz');
@@ -1694,7 +1694,7 @@  discard block
 block discarded – undo
1694 1694
 	public static function update_routes_fam() {
1695 1695
 		global $tmp_dir, $globalDebug;
1696 1696
 		if ($globalDebug) echo "Routes from FlightAirMap website : Download...";
1697
-		update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz');
1697
+		update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz', $tmp_dir.'routes.tsv.gz');
1698 1698
 		if (file_exists($tmp_dir.'routes.tsv.gz')) {
1699 1699
 			if ($globalDebug) echo "Gunzip...";
1700 1700
 			update_db::gunzip($tmp_dir.'routes.tsv.gz');
@@ -1713,18 +1713,18 @@  discard block
 block discarded – undo
1713 1713
 		$error = '';
1714 1714
 		if ($globalDebug) echo "Airspace from FlightAirMap website : Download...";
1715 1715
 		if ($globalDBdriver == 'mysql') {
1716
-			update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5');
1716
+			update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5');
1717 1717
 		} else {
1718
-			update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5');
1718
+			update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5');
1719 1719
 		}
1720 1720
 		if (file_exists($tmp_dir.'airspace.sql.gz.md5')) {
1721
-			$airspace_md5_file = explode(' ',file_get_contents($tmp_dir.'airspace.sql.gz.md5'));
1721
+			$airspace_md5_file = explode(' ', file_get_contents($tmp_dir.'airspace.sql.gz.md5'));
1722 1722
 			$airspace_md5 = $airspace_md5_file[0];
1723 1723
 			if (!update_db::check_airspace_version($airspace_md5)) {
1724 1724
 				if ($globalDBdriver == 'mysql') {
1725
-					update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz',$tmp_dir.'airspace.sql.gz');
1725
+					update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz', $tmp_dir.'airspace.sql.gz');
1726 1726
 				} else {
1727
-					update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz');
1727
+					update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz', $tmp_dir.'airspace.sql.gz');
1728 1728
 				}
1729 1729
 				if (file_exists($tmp_dir.'airspace.sql.gz')) {
1730 1730
 					if ($globalDebug) echo "Gunzip...";
@@ -1736,7 +1736,7 @@  discard block
 block discarded – undo
1736 1736
 						try {
1737 1737
 							$sth = $Connection->db->prepare($query);
1738 1738
     	    	    					$sth->execute();
1739
-			            		} catch(PDOException $e) {
1739
+			            		} catch (PDOException $e) {
1740 1740
 							return "error : ".$e->getMessage();
1741 1741
 		            			}
1742 1742
 		    			}
@@ -1754,15 +1754,15 @@  discard block
 block discarded – undo
1754 1754
 	public static function update_tle() {
1755 1755
 		global $tmp_dir, $globalDebug;
1756 1756
 		if ($globalDebug) echo "Download TLE : Download...";
1757
-		$alltle = array('stations.txt','gps-ops.txt','glo-ops.txt','galileo.txt','weather.txt','noaa.txt','goes.txt','resource.txt','dmc.txt','tdrss.txt','geo.txt','intelsat.txt','gorizont.txt',
1758
-		'raduga.txt','molniya.txt','iridium.txt','orbcomm.txt','globalstar.txt','amateur.txt','x-comm.txt','other-comm.txt','sbas.txt','nnss.txt','musson.txt','science.txt','geodetic.txt',
1759
-		'engineering.txt','education.txt','military.txt','radar.txt','cubesat.txt','other.txt','tle-new.txt');
1757
+		$alltle = array('stations.txt', 'gps-ops.txt', 'glo-ops.txt', 'galileo.txt', 'weather.txt', 'noaa.txt', 'goes.txt', 'resource.txt', 'dmc.txt', 'tdrss.txt', 'geo.txt', 'intelsat.txt', 'gorizont.txt',
1758
+		'raduga.txt', 'molniya.txt', 'iridium.txt', 'orbcomm.txt', 'globalstar.txt', 'amateur.txt', 'x-comm.txt', 'other-comm.txt', 'sbas.txt', 'nnss.txt', 'musson.txt', 'science.txt', 'geodetic.txt',
1759
+		'engineering.txt', 'education.txt', 'military.txt', 'radar.txt', 'cubesat.txt', 'other.txt', 'tle-new.txt');
1760 1760
 		foreach ($alltle as $filename) {
1761 1761
 			if ($globalDebug) echo "downloading ".$filename.'...';
1762
-			update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename);
1762
+			update_db::download('http://celestrak.com/NORAD/elements/'.$filename, $tmp_dir.$filename);
1763 1763
 			if (file_exists($tmp_dir.$filename)) {
1764 1764
 				if ($globalDebug) echo "Add to DB ".$filename."...";
1765
-				$error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename));
1765
+				$error = update_db::tle($tmp_dir.$filename, str_replace('.txt', '', $filename));
1766 1766
 			} else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed.";
1767 1767
 			if ($error != '') {
1768 1768
 				echo $error."\n";
@@ -1775,32 +1775,32 @@  discard block
 block discarded – undo
1775 1775
 		global $tmp_dir, $globalDebug;
1776 1776
 		$error = '';
1777 1777
 		if ($globalDebug) echo "Models from FlightAirMap website : Download...";
1778
-		update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',$tmp_dir.'models.md5sum');
1778
+		update_db::download('http://data.flightairmap.fr/data/models/models.md5sum', $tmp_dir.'models.md5sum');
1779 1779
 		if (file_exists($tmp_dir.'models.md5sum')) {
1780 1780
 			if ($globalDebug) echo "Check files...\n";
1781 1781
 			$newmodelsdb = array();
1782
-			if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) {
1783
-				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
1782
+			if (($handle = fopen($tmp_dir.'models.md5sum', 'r')) !== FALSE) {
1783
+				while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) {
1784 1784
 					$model = trim($row[2]);
1785 1785
 					$newmodelsdb[$model] = trim($row[0]);
1786 1786
 				}
1787 1787
 			}
1788 1788
 			$modelsdb = array();
1789 1789
 			if (file_exists(dirname(__FILE__).'/../models/models.md5sum')) {
1790
-				if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum','r')) !== FALSE) {
1791
-					while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
1790
+				if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum', 'r')) !== FALSE) {
1791
+					while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) {
1792 1792
 						$model = trim($row[2]);
1793 1793
 						$modelsdb[$model] = trim($row[0]);
1794 1794
 					}
1795 1795
 				}
1796 1796
 			}
1797
-			$diff = array_diff($newmodelsdb,$modelsdb);
1797
+			$diff = array_diff($newmodelsdb, $modelsdb);
1798 1798
 			foreach ($diff as $key => $value) {
1799 1799
 				if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n";
1800
-				update_db::download('http://data.flightairmap.fr/data/models/'.$key,dirname(__FILE__).'/../models/'.$key);
1800
+				update_db::download('http://data.flightairmap.fr/data/models/'.$key, dirname(__FILE__).'/../models/'.$key);
1801 1801
 				
1802 1802
 			}
1803
-			update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum');
1803
+			update_db::download('http://data.flightairmap.fr/data/models/models.md5sum', dirname(__FILE__).'/../models/models.md5sum');
1804 1804
 		} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
1805 1805
 		if ($error != '') {
1806 1806
 			return $error;
@@ -1812,32 +1812,32 @@  discard block
 block discarded – undo
1812 1812
 		global $tmp_dir, $globalDebug;
1813 1813
 		$error = '';
1814 1814
 		if ($globalDebug) echo "Space models from FlightAirMap website : Download...";
1815
-		update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum');
1815
+		update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum', $tmp_dir.'space_models.md5sum');
1816 1816
 		if (file_exists($tmp_dir.'space_models.md5sum')) {
1817 1817
 			if ($globalDebug) echo "Check files...\n";
1818 1818
 			$newmodelsdb = array();
1819
-			if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) {
1820
-				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
1819
+			if (($handle = fopen($tmp_dir.'space_models.md5sum', 'r')) !== FALSE) {
1820
+				while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) {
1821 1821
 					$model = trim($row[2]);
1822 1822
 					$newmodelsdb[$model] = trim($row[0]);
1823 1823
 				}
1824 1824
 			}
1825 1825
 			$modelsdb = array();
1826 1826
 			if (file_exists(dirname(__FILE__).'/../models/space/space_models.md5sum')) {
1827
-				if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum','r')) !== FALSE) {
1828
-					while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
1827
+				if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum', 'r')) !== FALSE) {
1828
+					while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) {
1829 1829
 						$model = trim($row[2]);
1830 1830
 						$modelsdb[$model] = trim($row[0]);
1831 1831
 					}
1832 1832
 				}
1833 1833
 			}
1834
-			$diff = array_diff($newmodelsdb,$modelsdb);
1834
+			$diff = array_diff($newmodelsdb, $modelsdb);
1835 1835
 			foreach ($diff as $key => $value) {
1836 1836
 				if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n";
1837
-				update_db::download('http://data.flightairmap.fr/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key);
1837
+				update_db::download('http://data.flightairmap.fr/data/models/space/'.$key, dirname(__FILE__).'/../models/space/'.$key);
1838 1838
 				
1839 1839
 			}
1840
-			update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum');
1840
+			update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum', dirname(__FILE__).'/../models/space/space_models.md5sum');
1841 1841
 		} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
1842 1842
 		if ($error != '') {
1843 1843
 			return $error;
@@ -1860,8 +1860,8 @@  discard block
 block discarded – undo
1860 1860
 		*/
1861 1861
 		if (file_exists($tmp_dir.'aircrafts.html')) {
1862 1862
 		    //var_dump(file_get_html($tmp_dir.'aircrafts.html'));
1863
-		    $fh = fopen($tmp_dir.'aircrafts.html',"r");
1864
-		    $result = fread($fh,100000000);
1863
+		    $fh = fopen($tmp_dir.'aircrafts.html', "r");
1864
+		    $result = fread($fh, 100000000);
1865 1865
 		    //echo $result;
1866 1866
 		    //var_dump(str_get_html($result));
1867 1867
 		    //print_r(self::table2array($result));
@@ -1879,23 +1879,23 @@  discard block
 block discarded – undo
1879 1879
 			$Connection = new Connection();
1880 1880
 			$sth = $Connection->db->prepare($query);
1881 1881
                         $sth->execute();
1882
-                } catch(PDOException $e) {
1882
+                } catch (PDOException $e) {
1883 1883
                         return "error : ".$e->getMessage();
1884 1884
                 }
1885 1885
 
1886 1886
 		$error = '';
1887 1887
 		if ($globalDebug) echo "Notam : Download...";
1888
-		update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss');
1888
+		update_db::download($globalNOTAMSource, $tmp_dir.'notam.rss');
1889 1889
 		if (file_exists($tmp_dir.'notam.rss')) {
1890
-			$notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true);
1890
+			$notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')), true);
1891 1891
 			foreach ($notams['channel']['item'] as $notam) {
1892
-				$title = explode(':',$notam['title']);
1892
+				$title = explode(':', $notam['title']);
1893 1893
 				$data['ref'] = trim($title[0]);
1894 1894
 				unset($title[0]);
1895
-				$data['title'] = trim(implode(':',$title));
1896
-				$description = strip_tags($notam['description'],'<pre>');
1897
-				preg_match(':^(.*?)<pre>:',$description,$match);
1898
-				$q = explode('/',$match[1]);
1895
+				$data['title'] = trim(implode(':', $title));
1896
+				$description = strip_tags($notam['description'], '<pre>');
1897
+				preg_match(':^(.*?)<pre>:', $description, $match);
1898
+				$q = explode('/', $match[1]);
1899 1899
 				$data['fir'] = $q[0];
1900 1900
 				$data['code'] = $q[1];
1901 1901
 				$ifrvfr = $q[2];
@@ -1911,30 +1911,30 @@  discard block
 block discarded – undo
1911 1911
 				$data['lower_limit'] = $q[5];
1912 1912
 				$data['upper_limit'] = $q[6];
1913 1913
 				$latlonrad = $q[7];
1914
-				sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius);
1915
-				$latitude = $Common->convertDec($las,'latitude');
1916
-				$longitude = $Common->convertDec($lns,'longitude');
1914
+				sscanf($latlonrad, '%4c%c%5c%c%3d', $las, $lac, $lns, $lnc, $radius);
1915
+				$latitude = $Common->convertDec($las, 'latitude');
1916
+				$longitude = $Common->convertDec($lns, 'longitude');
1917 1917
 				if ($lac == 'S') $latitude = '-'.$latitude;
1918 1918
 				if ($lnc == 'W') $longitude = '-'.$longitude;
1919 1919
 				$data['center_latitude'] = $latitude;
1920 1920
 				$data['center_longitude'] = $longitude;
1921 1921
 				$data['radius'] = intval($radius);
1922 1922
 				
1923
-				preg_match(':<pre>(.*?)</pre>:',$description,$match);
1923
+				preg_match(':<pre>(.*?)</pre>:', $description, $match);
1924 1924
 				$data['text'] = $match[1];
1925
-				preg_match(':</pre>(.*?)$:',$description,$match);
1925
+				preg_match(':</pre>(.*?)$:', $description, $match);
1926 1926
 				$fromto = $match[1];
1927
-				preg_match('#FROM:(.*?)TO:#',$fromto,$match);
1927
+				preg_match('#FROM:(.*?)TO:#', $fromto, $match);
1928 1928
 				$fromall = trim($match[1]);
1929
-				preg_match('#^(.*?) \((.*?)\)$#',$fromall,$match);
1929
+				preg_match('#^(.*?) \((.*?)\)$#', $fromall, $match);
1930 1930
 				$from = trim($match[1]);
1931
-				$data['date_begin'] = date("Y-m-d H:i:s",strtotime($from));
1932
-				preg_match('#TO:(.*?)$#',$fromto,$match);
1931
+				$data['date_begin'] = date("Y-m-d H:i:s", strtotime($from));
1932
+				preg_match('#TO:(.*?)$#', $fromto, $match);
1933 1933
 				$toall = trim($match[1]);
1934
-				if (!preg_match(':Permanent:',$toall)) {
1935
-					preg_match('#^(.*?) \((.*?)\)#',$toall,$match);
1934
+				if (!preg_match(':Permanent:', $toall)) {
1935
+					preg_match('#^(.*?) \((.*?)\)#', $toall, $match);
1936 1936
 					$to = trim($match[1]);
1937
-					$data['date_end'] = date("Y-m-d H:i:s",strtotime($to));
1937
+					$data['date_end'] = date("Y-m-d H:i:s", strtotime($to));
1938 1938
 					$data['permanent'] = 0;
1939 1939
 				} else {
1940 1940
 				    $data['date_end'] = NULL;
@@ -1942,7 +1942,7 @@  discard block
 block discarded – undo
1942 1942
 				}
1943 1943
 				$data['full_notam'] = $notam['title'].'<br>'.$notam['description'];
1944 1944
 				$NOTAM = new NOTAM();
1945
-				$NOTAM->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['center_latitude'],$data['center_longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1945
+				$NOTAM->addNOTAM($data['ref'], $data['title'], '', $data['fir'], $data['code'], '', $data['scope'], $data['lower_limit'], $data['upper_limit'], $data['center_latitude'], $data['center_longitude'], $data['radius'], $data['date_begin'], $data['date_end'], $data['permanent'], $data['text'], $data['full_notam']);
1946 1946
 				unset($data);
1947 1947
 			} 
1948 1948
 		} else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed.";
@@ -1965,16 +1965,16 @@  discard block
 block discarded – undo
1965 1965
 				$Connection = new Connection();
1966 1966
 				$sth = $Connection->db->prepare($query);
1967 1967
 				$sth->execute();
1968
-			} catch(PDOException $e) {
1968
+			} catch (PDOException $e) {
1969 1969
 				return "error : ".$e->getMessage();
1970 1970
 			}
1971 1971
 		}
1972 1972
 		$Common = new Common();
1973 1973
 		$airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json');
1974
-		$airspace_json = json_decode($airspace_lst,true);
1974
+		$airspace_json = json_decode($airspace_lst, true);
1975 1975
 		foreach ($airspace_json['records'] as $airspace) {
1976 1976
 			if ($globalDebug) echo $airspace['name']."...\n";
1977
-			update_db::download($airspace['uri'],$tmp_dir.$airspace['name']);
1977
+			update_db::download($airspace['uri'], $tmp_dir.$airspace['name']);
1978 1978
 			if (file_exists($tmp_dir.$airspace['name'])) {
1979 1979
 				file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name'])));
1980 1980
 				//system('recode l9..utf8 '.$tmp_dir.$airspace['name']);
@@ -1998,7 +1998,7 @@  discard block
 block discarded – undo
1998 1998
 			$Connection = new Connection();
1999 1999
 			$sth = $Connection->db->prepare($query);
2000 2000
                         $sth->execute();
2001
-                } catch(PDOException $e) {
2001
+                } catch (PDOException $e) {
2002 2002
                         return "error : ".$e->getMessage();
2003 2003
                 }
2004 2004
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -2013,7 +2013,7 @@  discard block
 block discarded – undo
2013 2013
 			$Connection = new Connection();
2014 2014
 			$sth = $Connection->db->prepare($query);
2015 2015
                         $sth->execute();
2016
-                } catch(PDOException $e) {
2016
+                } catch (PDOException $e) {
2017 2017
                         return "error : ".$e->getMessage();
2018 2018
                 }
2019 2019
 	}
@@ -2024,7 +2024,7 @@  discard block
 block discarded – undo
2024 2024
 			$Connection = new Connection();
2025 2025
 			$sth = $Connection->db->prepare($query);
2026 2026
                         $sth->execute(array(':version' => $version));
2027
-                } catch(PDOException $e) {
2027
+                } catch (PDOException $e) {
2028 2028
                         return "error : ".$e->getMessage();
2029 2029
                 }
2030 2030
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -2040,7 +2040,7 @@  discard block
 block discarded – undo
2040 2040
 			$Connection = new Connection();
2041 2041
 			$sth = $Connection->db->prepare($query);
2042 2042
                         $sth->execute(array(':version' => $version));
2043
-                } catch(PDOException $e) {
2043
+                } catch (PDOException $e) {
2044 2044
                         return "error : ".$e->getMessage();
2045 2045
                 }
2046 2046
 	}
@@ -2056,7 +2056,7 @@  discard block
 block discarded – undo
2056 2056
 			$Connection = new Connection();
2057 2057
 			$sth = $Connection->db->prepare($query);
2058 2058
                         $sth->execute();
2059
-                } catch(PDOException $e) {
2059
+                } catch (PDOException $e) {
2060 2060
                         return "error : ".$e->getMessage();
2061 2061
                 }
2062 2062
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -2071,7 +2071,7 @@  discard block
 block discarded – undo
2071 2071
 			$Connection = new Connection();
2072 2072
 			$sth = $Connection->db->prepare($query);
2073 2073
                         $sth->execute();
2074
-                } catch(PDOException $e) {
2074
+                } catch (PDOException $e) {
2075 2075
                         return "error : ".$e->getMessage();
2076 2076
                 }
2077 2077
 	}
@@ -2086,7 +2086,7 @@  discard block
 block discarded – undo
2086 2086
 			$Connection = new Connection();
2087 2087
 			$sth = $Connection->db->prepare($query);
2088 2088
                         $sth->execute();
2089
-                } catch(PDOException $e) {
2089
+                } catch (PDOException $e) {
2090 2090
                         return "error : ".$e->getMessage();
2091 2091
                 }
2092 2092
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -2101,7 +2101,7 @@  discard block
 block discarded – undo
2101 2101
 			$Connection = new Connection();
2102 2102
 			$sth = $Connection->db->prepare($query);
2103 2103
                         $sth->execute();
2104
-                } catch(PDOException $e) {
2104
+                } catch (PDOException $e) {
2105 2105
                         return "error : ".$e->getMessage();
2106 2106
                 }
2107 2107
 	}
@@ -2117,7 +2117,7 @@  discard block
 block discarded – undo
2117 2117
 			$Connection = new Connection();
2118 2118
 			$sth = $Connection->db->prepare($query);
2119 2119
                         $sth->execute();
2120
-                } catch(PDOException $e) {
2120
+                } catch (PDOException $e) {
2121 2121
                         return "error : ".$e->getMessage();
2122 2122
                 }
2123 2123
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -2132,7 +2132,7 @@  discard block
 block discarded – undo
2132 2132
 			$Connection = new Connection();
2133 2133
 			$sth = $Connection->db->prepare($query);
2134 2134
                         $sth->execute();
2135
-                } catch(PDOException $e) {
2135
+                } catch (PDOException $e) {
2136 2136
                         return "error : ".$e->getMessage();
2137 2137
                 }
2138 2138
 	}
@@ -2147,7 +2147,7 @@  discard block
 block discarded – undo
2147 2147
 			$Connection = new Connection();
2148 2148
 			$sth = $Connection->db->prepare($query);
2149 2149
                         $sth->execute();
2150
-                } catch(PDOException $e) {
2150
+                } catch (PDOException $e) {
2151 2151
                         return "error : ".$e->getMessage();
2152 2152
                 }
2153 2153
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -2162,7 +2162,7 @@  discard block
 block discarded – undo
2162 2162
 			$Connection = new Connection();
2163 2163
 			$sth = $Connection->db->prepare($query);
2164 2164
                         $sth->execute();
2165
-                } catch(PDOException $e) {
2165
+                } catch (PDOException $e) {
2166 2166
                         return "error : ".$e->getMessage();
2167 2167
                 }
2168 2168
 	}
@@ -2177,7 +2177,7 @@  discard block
 block discarded – undo
2177 2177
 			$Connection = new Connection();
2178 2178
 			$sth = $Connection->db->prepare($query);
2179 2179
                         $sth->execute();
2180
-                } catch(PDOException $e) {
2180
+                } catch (PDOException $e) {
2181 2181
                         return "error : ".$e->getMessage();
2182 2182
                 }
2183 2183
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -2192,7 +2192,7 @@  discard block
 block discarded – undo
2192 2192
 			$Connection = new Connection();
2193 2193
 			$sth = $Connection->db->prepare($query);
2194 2194
                         $sth->execute();
2195
-                } catch(PDOException $e) {
2195
+                } catch (PDOException $e) {
2196 2196
                         return "error : ".$e->getMessage();
2197 2197
                 }
2198 2198
 	}
Please login to merge, or discard this patch.
space-data.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 <button type="button" class="close">&times;</button>
8 8
 <?php
9 9
 
10
-$sat = filter_input(INPUT_GET,'sat',FILTER_SANITIZE_STRING);
10
+$sat = filter_input(INPUT_GET, 'sat', FILTER_SANITIZE_STRING);
11 11
 $sat = urldecode($sat);
12 12
 
13 13
 if ($sat == 'ISS (ZARYA)') {
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	$aircraft_name = 'INTEGRAL';
43 43
 //	$ground_speed = 14970;
44 44
 	$launch_date = '17 October 2002';
45
-} elseif (strpos($sat,'IRIDIUM') !== false) {
45
+} elseif (strpos($sat, 'IRIDIUM') !== false) {
46 46
 	$image = 'https://upload.wikimedia.org/wikipedia/commons/b/b6/Iridium_Satellite.jpg';
47 47
 	$image_copyright = 'Cliff';
48 48
 	$ident = 'Iridium satellite constellation';
@@ -50,22 +50,22 @@  discard block
 block discarded – undo
50 50
 	$aircraft_name = $sat;
51 51
 //	$ground_speed = 14970;
52 52
 //	$launch_date = '29 september 2011';
53
-} elseif (strpos($sat,'ORBCOMM') !== false) {
53
+} elseif (strpos($sat, 'ORBCOMM') !== false) {
54 54
 	$ident = 'Orbcomm';
55 55
 	$aircraft_wiki = 'https://en.wikipedia.org/wiki/Orbcomm_(satellite)';
56 56
 	$aircraft_name = $sat;
57
-} elseif (strpos($sat,'GLOBALSTAR') !== false) {
57
+} elseif (strpos($sat, 'GLOBALSTAR') !== false) {
58 58
 	$ident = 'Globalstar';
59 59
 	$aircraft_wiki = 'https://en.wikipedia.org/wiki/Globalstar';
60 60
 	$aircraft_name = $sat;
61
-} elseif (strpos($sat,'OSCAR 7') !== false) {
61
+} elseif (strpos($sat, 'OSCAR 7') !== false) {
62 62
 	$image = 'https://upload.wikimedia.org/wikipedia/en/a/ad/AMSAT-OSCAR_7.jpg';
63 63
 	$image_copyright = 'Amsat.org';
64 64
 	$ident = 'AMSAT-OSCAR 7';
65 65
 	$aircraft_wiki = 'https://en.wikipedia.org/wiki/AMSAT-OSCAR_7';
66 66
 	$aircraft_name = $sat;
67 67
 	$launch_date = '15 November 1974';
68
-} elseif (strpos($sat,'santaclaus') !== false) {
68
+} elseif (strpos($sat, 'santaclaus') !== false) {
69 69
 	$image = 'https://upload.wikimedia.org/wikipedia/commons/4/49/Jonathan_G_Meath_portrays_Santa_Claus.jpg';
70 70
 	$image_copyright = 'Jonathan G Meath';
71 71
 	$ident = 'Santa Claus';
Please login to merge, or discard this patch.
index.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 require_once('require/class.Language.php');
5 5
 require_once('require/class.Satellite.php');
6 6
 
7
-$trackident = filter_input(INPUT_GET,'trackid',FILTER_SANITIZE_STRING);
7
+$trackident = filter_input(INPUT_GET, 'trackid', FILTER_SANITIZE_STRING);
8 8
 if ($trackident != '') {
9 9
 	require_once('require/class.SpotterLive.php');
10 10
 	$SpotterLive = new SpotterLive();
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 		$spotterid = $Spotter->getSpotterIDBasedOnFlightAwareID($trackident);
15 15
 		header('Location: '.$globalURL.'/flightid/'.$spotterid);
16 16
 	} else {
17
-		setcookie('MapTrack',$resulttrackident[0]['flightaware_id']);
17
+		setcookie('MapTrack', $resulttrackident[0]['flightaware_id']);
18 18
 	}
19 19
 } else {
20 20
 	unset($_COOKIE['MapTrack']);
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		        <div class="form-group">
168 168
 			    <label>From (UTC):</label>
169 169
 		            <div class='input-group date' id='datetimepicker1'>
170
-            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required />
170
+            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a", $_COOKIE['archive_begin']); ?>" required />
171 171
 		                <span class="input-group-addon">
172 172
             			    <span class="glyphicon glyphicon-calendar"></span>
173 173
 		                </span>
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 		        <div class="form-group">
177 177
 			    <label>To (UTC):</label>
178 178
 		            <div class='input-group date' id='datetimepicker2'>
179
-		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" />
179
+		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a", $_COOKIE['archive_end']); ?>" />
180 180
             			<span class="input-group-addon">
181 181
 		                    <span class="glyphicon glyphicon-calendar"></span>
182 182
             			</span>
@@ -301,8 +301,8 @@  discard block
 block discarded – undo
301 301
 		    <li><?php echo _("Type of Terrain:"); ?>
302 302
 			<select  class="selectpicker" onchange="terrainType(this);">
303 303
 			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
304
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
305
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
304
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected'; ?>>ellipsoid</option>
305
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected'; ?>>vr terrain</option>
306 306
 			</select>
307 307
 		    </li>
308 308
 <?php
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 ?>
326 326
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
327 327
 <?php
328
-	if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
328
+	if (time() > mktime(0, 0, 0, 12, 1, date("Y")) && time() < mktime(0, 0, 0, 12, 31, date("Y"))) {
329 329
 ?>
330 330
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><?php echo _("Show Santa Claus now"); ?></label></div></li>
331 331
 <?php
@@ -439,10 +439,10 @@  discard block
 block discarded – undo
439 439
 					$Spotter = new Spotter();
440 440
 					$allairlinenames = $Spotter->getAllAirlineNames();
441 441
 				}
442
-				foreach($allairlinenames as $airline) {
442
+				foreach ($allairlinenames as $airline) {
443 443
 					$airline_name = $airline['airline_name'];
444
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
445
-					if (isset($_COOKIE['Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['Airlines']))) {
444
+					if (strlen($airline_name) > 30) $airline_name = substr($airline_name, 0, 30).'...';
445
+					if (isset($_COOKIE['Airlines']) && in_array($airline['airline_icao'], explode(',', $_COOKIE['Airlines']))) {
446 446
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
447 447
 					} else {
448 448
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
@@ -458,8 +458,8 @@  discard block
 block discarded – undo
458 458
 			<select class="selectpicker" multiple onchange="sources(this);">
459 459
 			    <?php
460 460
 				$Spotter = new Spotter();
461
-				foreach($Spotter->getAllSourceName('aprs') as $source) {
462
-					if (isset($_COOKIE['Sources']) && in_array($source['source_name'],explode(',',$_COOKIE['Sources']))) {
461
+				foreach ($Spotter->getAllSourceName('aprs') as $source) {
462
+					if (isset($_COOKIE['Sources']) && in_array($source['source_name'], explode(',', $_COOKIE['Sources']))) {
463 463
 						echo '<option value="'.$source['source_name'].'" selected>'.$source['source_name'].'</option>';
464 464
 					} else {
465 465
 						echo '<option value="'.$source['source_name'].'">'.$source['source_name'].'</option>';
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
532 532
 					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
533 533
 					
534
-					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
534
+					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'], explode(',', $_COOKIE['sattypes']))) {
535 535
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
536 536
 					} else {
537 537
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
Please login to merge, or discard this patch.
live-santa-czml.php 1 patch
Spacing   +290 added lines, -290 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 //	$output .= ',"clock": {"interval" : "'.date("c",time()-$globalLiveInterval).'/'.date("c").'","currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"range" : "LOOP_STOP","step": "SYSTEM_CLOCK_MULTIPLIER"}';
28 28
 
29 29
 //	$output .= ',"clock": {"interval" : "'.date("c",time()-$globalLiveInterval).'/'.date("c").'","currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}';
30
-$output .= ',"clock": {"currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"';
30
+$output .= ',"clock": {"currentTime" : "'.date("c", time() - $globalLiveInterval).'","multiplier" : 1,"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"';
31 31
 if (!isset($_GET['now'])) $output .= ',"interval": "'.date("Y").'-12-24T02:00:00Z/'.date("Y").'-12-25T02:00:00Z"';
32 32
 $output .= '}';
33 33
 //$output .= ',"clock": {"currentTime" : "'.date("c",time()).'","multiplier" : 300,"range" : "UNBOUNDED","step": "TICK_DEPENDENT"}';
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 if (!isset($_GET['now'])) {
60 60
 	$output .= '"epoch" : "'.date("Y").'-12-24T02:00:00Z",';
61 61
 } else {
62
-	$output .= '"epoch" : "'.date("c",time() - $globalLiveInterval).'",';
62
+	$output .= '"epoch" : "'.date("c", time() - $globalLiveInterval).'",';
63 63
 }
64 64
 //$output .= '"type": "Point",';
65 65
 //$output .= '"interpolationAlgorithm" : "LAGRANGE",';
@@ -113,581 +113,581 @@  discard block
 block discarded – undo
113 113
 */
114 114
 $i = 0;
115 115
 $output .= $i.',-114.4,82.7,150000,';
116
-$i = $i+300;
116
+$i = $i + 300;
117 117
 $output .= $i.',-173.300003,64.379997,150000,';
118
-$i = $i+300;
118
+$i = $i + 300;
119 119
 $output .= $i.',177.479995,64.75,150000,';
120
-$i = $i+300;
120
+$i = $i + 300;
121 121
 $output .= $i.',158.65,53.016667,150000,';
122
-$i = $i+300;
122
+$i = $i + 300;
123 123
 $output .= $i.',165.545318,11.626074,150000,';
124
-$i = $i+300;
124
+$i = $i + 300;
125 125
 $output .= $i.',171.1300517813333,7.07999665990053,150000,';
126
-$i = $i+300;
126
+$i = $i + 300;
127 127
 $output .= $i.',179.380004,-16.469999,150000,';
128
-$i = $i+300;
128
+$i = $i + 300;
129 129
 $output .= $i.',178.429992,-18.129999,150000,';
130
-$i = $i+300;
130
+$i = $i + 300;
131 131
 $output .= $i.',174.759994,-36.849998,150000,';
132
-$i = $i+300;
132
+$i = $i + 300;
133 133
 $output .= $i.',176.839996,-39.639999,150000,';
134
-$i = $i+300;
134
+$i = $i + 300;
135 135
 $output .= $i.',174.779998,-41.279998,150000,';
136
-$i = $i+300;
136
+$i = $i + 300;
137 137
 $output .= $i.',172.639999,-43.529998,150000,';
138
-$i = $i+300;
138
+$i = $i + 300;
139 139
 $output .= $i.',167.838199,-46.986747,150000,';
140
-$i = $i+300;
140
+$i = $i + 300;
141 141
 $output .= $i.',168.320999,-17.740391,150000,';
142
-$i = $i+300;
142
+$i = $i + 300;
143 143
 $output .= $i.',167.149993,-15.51,150000,';
144
-$i = $i+300;
144
+$i = $i + 300;
145 145
 $output .= $i.',159.910003,-9.43,150000,';
146
-$i = $i+300;
146
+$i = $i + 300;
147 147
 $output .= $i.',156.850006,-8.1,150000,';
148
-$i = $i+300;
148
+$i = $i + 300;
149 149
 $output .= $i.',158.160003,6.92,150000,';
150
-$i = $i+300;
150
+$i = $i + 300;
151 151
 $output .= $i.',150.017702,45.873311,150000,';
152
-$i = $i+300;
152
+$i = $i + 300;
153 153
 $output .= $i.',154.796487,49.429802,150000,';
154
-$i = $i+300;
154
+$i = $i + 300;
155 155
 $output .= $i.',142.7262,46.948978,150000,';
156
-$i = $i+300;
156
+$i = $i + 300;
157 157
 $output .= $i.',150.800003,59.569999,150000,';
158
-$i = $i+300;
158
+$i = $i + 300;
159 159
 $output .= $i.',135.119995,48.419998,150000,';
160
-$i = $i+300;
160
+$i = $i + 300;
161 161
 $output .= $i.',131.899993,43.130001,150000,';
162
-$i = $i+300;
162
+$i = $i + 300;
163 163
 $output .= $i.',142.212096,27.070652,150000,';
164
-$i = $i+300;
164
+$i = $i + 300;
165 165
 $output .= $i.',141.312779,24.78389,150000,';
166
-$i = $i+300;
166
+$i = $i + 300;
167 167
 $output .= $i.',144.79373,13.444305,150000,';
168
-$i = $i+300;
168
+$i = $i + 300;
169 169
 $output .= $i.',151.783334,8.45,150000,';
170
-$i = $i+300;
170
+$i = $i + 300;
171 171
 $output .= $i.',151.749999,7.416667,150000,';
172
-$i = $i+300;
172
+$i = $i + 300;
173 173
 $output .= $i.',152.160003,-4.199999,150000,';
174
-$i = $i+300;
174
+$i = $i + 300;
175 175
 $output .= $i.',146.990005,-6.719999,150000,';
176
-$i = $i+300;
176
+$i = $i + 300;
177 177
 $output .= $i.',143.211639,-9.085352,150000,';
178
-$i = $i+300;
178
+$i = $i + 300;
179 179
 $output .= $i.',146.779998,-19.26,150000,';
180
-$i = $i+300;
180
+$i = $i + 300;
181 181
 $output .= $i.',149.179992,-21.139999,150000,';
182
-$i = $i+300;
182
+$i = $i + 300;
183 183
 $output .= $i.',153.020004,-27.459999,150000,';
184
-$i = $i+300;
184
+$i = $i + 300;
185 185
 $output .= $i.',151.210006,-33.869998,150000,';
186
-$i = $i+300;
186
+$i = $i + 300;
187 187
 $output .= $i.',147.291199,-42.85088,150000,';
188
-$i = $i+300;
188
+$i = $i + 300;
189 189
 $output .= $i.',138.600006,-34.93,150000,';
190
-$i = $i+300;
190
+$i = $i + 300;
191 191
 $output .= $i.',133.869995,-23.7,150000,';
192
-$i = $i+300;
192
+$i = $i + 300;
193 193
 $output .= $i.',130.850006,-12.43,150000,';
194
-$i = $i+300;
194
+$i = $i + 300;
195 195
 $output .= $i.',143.62,-3.56,150000,';
196
-$i = $i+300;
196
+$i = $i + 300;
197 197
 $output .= $i.',134.5552,7.3608,150000,';
198
-$i = $i+300;
198
+$i = $i + 300;
199 199
 $output .= $i.',135.169998,34.68,150000,';
200
-$i = $i+300;
200
+$i = $i + 300;
201 201
 $output .= $i.',138.690002,35.169998,150000,';
202
-$i = $i+300;
202
+$i = $i + 300;
203 203
 $output .= $i.',139.770004,35.669998,150000,';
204
-$i = $i+300;
204
+$i = $i + 300;
205 205
 $output .= $i.',140.740005,40.830001,150000,';
206
-$i = $i+300;
206
+$i = $i + 300;
207 207
 $output .= $i.',128.600006,35.869998,150000,';
208
-$i = $i+300;
208
+$i = $i + 300;
209 209
 $output .= $i.',125.925925,38.950981,150000,';
210
-$i = $i+300;
210
+$i = $i + 300;
211 211
 $output .= $i.',129.771118,62.093056,150000,';
212
-$i = $i+300;
212
+$i = $i + 300;
213 213
 $output .= $i.',104.239997,52.330001,150000,';
214
-$i = $i+300;
214
+$i = $i + 300;
215 215
 $output .= $i.',114.5056,48.060478,150000,';
216
-$i = $i+300;
216
+$i = $i + 300;
217 217
 $output .= $i.',106.580001,29.569999,150000,';
218
-$i = $i+300;
218
+$i = $i + 300;
219 219
 $output .= $i.',121.470001,31.229999,150000,';
220
-$i = $i+300;
220
+$i = $i + 300;
221 221
 $output .= $i.',113.25,23.12,150000,';
222
-$i = $i+300;
222
+$i = $i + 300;
223 223
 $output .= $i.',114.177465,22.307184,150000,';
224
-$i = $i+300;
224
+$i = $i + 300;
225 225
 $output .= $i.',121.639999,18.36,150000,';
226
-$i = $i+300;
226
+$i = $i + 300;
227 227
 $output .= $i.',122.080001,6.92,150000,';
228
-$i = $i+300;
228
+$i = $i + 300;
229 229
 $output .= $i.',114.639999,4.809999,150000,';
230
-$i = $i+300;
230
+$i = $i + 300;
231 231
 $output .= $i.',119.412399,-5.152193,150000,';
232
-$i = $i+300;
232
+$i = $i + 300;
233 233
 $output .= $i.',122.230003,-17.959999,150000,';
234
-$i = $i+300;
234
+$i = $i + 300;
235 235
 $output .= $i.',115.839996,-31.959999,150000,';
236
-$i = $i+300;
236
+$i = $i + 300;
237 237
 $output .= $i.',105.680687,-10.428593,150000,';
238
-$i = $i+300;
238
+$i = $i + 300;
239 239
 $output .= $i.',104.75,-2.99,150000,';
240
-$i = $i+300;
240
+$i = $i + 300;
241 241
 $output .= $i.',113.029998,3.17,150000,';
242
-$i = $i+300;
242
+$i = $i + 300;
243 243
 $output .= $i.',100.720001,4.86,150000,';
244
-$i = $i+300;
244
+$i = $i + 300;
245 245
 $output .= $i.',104.18,10.609999,150000,';
246
-$i = $i+300;
246
+$i = $i + 300;
247 247
 $output .= $i.',103.864403,13.36866,150000,';
248
-$i = $i+300;
248
+$i = $i + 300;
249 249
 $output .= $i.',99.330001,9.14,150000,';
250
-$i = $i+300;
250
+$i = $i + 300;
251 251
 $output .= $i.',105.073303,18.30217,150000,';
252
-$i = $i+300;
252
+$i = $i + 300;
253 253
 $output .= $i.',91.132088,29.6507,150000,';
254
-$i = $i+300;
254
+$i = $i + 300;
255 255
 $output .= $i.',116.477651,40.332809,150000,';
256
-$i = $i+300;
256
+$i = $i + 300;
257 257
 $output .= $i.',93.059997,56.02,150000,';
258
-$i = $i+300;
258
+$i = $i + 300;
259 259
 $output .= $i.',86.18,69.410003,150000,';
260
-$i = $i+300;
260
+$i = $i + 300;
261 261
 $output .= $i.',88.202881,69.315422,150000,';
262
-$i = $i+300;
262
+$i = $i + 300;
263 263
 $output .= $i.',73.400001,55,150000,';
264
-$i = $i+300;
264
+$i = $i + 300;
265 265
 $output .= $i.',76.949996,52.299999,150000,';
266
-$i = $i+300;
266
+$i = $i + 300;
267 267
 $output .= $i.',78.379997,42.490001,150000,';
268
-$i = $i+300;
268
+$i = $i + 300;
269 269
 $output .= $i.',69.779998,37.919998,150000,';
270
-$i = $i+300;
270
+$i = $i + 300;
271 271
 $output .= $i.',86.933333,27.983333,150000,';
272
-$i = $i+300;
272
+$i = $i + 300;
273 273
 $output .= $i.',84.870002,27.02,150000,';
274
-$i = $i+300;
274
+$i = $i + 300;
275 275
 $output .= $i.',88.36,22.569999,150000,';
276
-$i = $i+300;
276
+$i = $i + 300;
277 277
 $output .= $i.',90.389999,23.7,150000,';
278
-$i = $i+300;
278
+$i = $i + 300;
279 279
 $output .= $i.',97.04,20.78,150000,';
280
-$i = $i+300;
280
+$i = $i + 300;
281 281
 $output .= $i.',92.762917,11.66857,150000,';
282
-$i = $i+300;
282
+$i = $i + 300;
283 283
 $output .= $i.',50.23720550537109,-46.10261535644531,150000,';
284
-$i = $i+300;
284
+$i = $i + 300;
285 285
 $output .= $i.',72.422489,-7.336367,150000,';
286
-$i = $i+300;
286
+$i = $i + 300;
287 287
 $output .= $i.',73.510915,4.174199,150000,';
288
-$i = $i+300;
288
+$i = $i + 300;
289 289
 $output .= $i.',81.050003,6.989999,150000,';
290
-$i = $i+300;
290
+$i = $i + 300;
291 291
 $output .= $i.',72.819999,18.959999,150000,';
292
-$i = $i+300;
292
+$i = $i + 300;
293 293
 $output .= $i.',78.042222,27.174167,150000,';
294
-$i = $i+300;
294
+$i = $i + 300;
295 295
 $output .= $i.',71.449996,30.2,150000,';
296
-$i = $i+300;
296
+$i = $i + 300;
297 297
 $output .= $i.',67.109993,36.703819,150000,';
298
-$i = $i+300;
298
+$i = $i + 300;
299 299
 $output .= $i.',54.36,39.509998,150000,';
300
-$i = $i+300;
300
+$i = $i + 300;
301 301
 $output .= $i.',63.726529,40.214486,150000,';
302
-$i = $i+300;
302
+$i = $i + 300;
303 303
 $output .= $i.',58.853439,48.251126,150000,';
304
-$i = $i+300;
304
+$i = $i + 300;
305 305
 $output .= $i.',56.23246,58.00024,150000,';
306
-$i = $i+300;
306
+$i = $i + 300;
307 307
 $output .= $i.',49.659999,58.599998,150000,';
308
-$i = $i+300;
308
+$i = $i + 300;
309 309
 $output .= $i.',50.150001,53.2,150000,';
310
-$i = $i+300;
310
+$i = $i + 300;
311 311
 $output .= $i.',44.11,41.979999,150000,';
312
-$i = $i+300;
312
+$i = $i + 300;
313 313
 $output .= $i.',49.893226,40.38344,150000,';
314
-$i = $i+300;
314
+$i = $i + 300;
315 315
 $output .= $i.',44.75,40.5,150000,';
316
-$i = $i+300;
316
+$i = $i + 300;
317 317
 $output .= $i.',50.95,34.650001,150000,';
318
-$i = $i+300;
318
+$i = $i + 300;
319 319
 $output .= $i.',56.27433,27.18717,150000,';
320
-$i = $i+300;
320
+$i = $i + 300;
321 321
 $output .= $i.',54.989491,25.005817,150000,';
322
-$i = $i+300;
322
+$i = $i + 300;
323 323
 $output .= $i.',59.549999,22.569999,150000,';
324
-$i = $i+300;
324
+$i = $i + 300;
325 325
 $output .= $i.',47.58318996007591,-9.722414273737707,150000,';
326
-$i = $i+300;
326
+$i = $i + 300;
327 327
 $output .= $i.',57.471008,-20.26026,150000,';
328
-$i = $i+300;
328
+$i = $i + 300;
329 329
 $output .= $i.',37.946460723877,-46.6428451538086,150000,';
330
-$i = $i+300;
330
+$i = $i + 300;
331 331
 $output .= $i.',53,-67.5,150000,';
332
-$i = $i+300;
332
+$i = $i + 300;
333 333
 $output .= $i.',46.99004,-25.03233,150000,';
334
-$i = $i+300;
334
+$i = $i + 300;
335 335
 $output .= $i.',46.310001,-15.72,150000,';
336
-$i = $i+300;
336
+$i = $i + 300;
337 337
 $output .= $i.',44.41203117370608,-12.22338294982911,150000,';
338
-$i = $i+300;
338
+$i = $i + 300;
339 339
 $output .= $i.',39.3822,-6.097406,150000,';
340
-$i = $i+300;
340
+$i = $i + 300;
341 341
 $output .= $i.',39.659999,-4.039999,150000,';
342
-$i = $i+300;
342
+$i = $i + 300;
343 343
 $output .= $i.',40.033333,7.916667,150000,';
344
-$i = $i+300;
344
+$i = $i + 300;
345 345
 $output .= $i.',42.549999,16.899999,150000,';
346
-$i = $i+300;
346
+$i = $i + 300;
347 347
 $output .= $i.',43.970001,26.37,150000,';
348
-$i = $i+300;
348
+$i = $i + 300;
349 349
 $output .= $i.',41.12,30.455,150000,';
350
-$i = $i+300;
350
+$i = $i + 300;
351 351
 $output .= $i.',38.278671,34.547951,150000,';
352
-$i = $i+300;
352
+$i = $i + 300;
353 353
 $output .= $i.',37.619998,55.75,150000,';
354
-$i = $i+300;
354
+$i = $i + 300;
355 355
 $output .= $i.',30.453329,59.951889,150000,';
356
-$i = $i+300;
356
+$i = $i + 300;
357 357
 $output .= $i.',23.12,63.84,150000,';
358
-$i = $i+300;
358
+$i = $i + 300;
359 359
 $output .= $i.',26.709999,58.380001,150000,';
360
-$i = $i+300;
360
+$i = $i + 300;
361 361
 $output .= $i.',25.42,57.549999,150000,';
362
-$i = $i+300;
362
+$i = $i + 300;
363 363
 $output .= $i.',23.319999,55.93,150000,';
364
-$i = $i+300;
364
+$i = $i + 300;
365 365
 $output .= $i.',26.1,52.119998,150000,';
366
-$i = $i+300;
366
+$i = $i + 300;
367 367
 $output .= $i.',32.259998,48.5,150000,';
368
-$i = $i+300;
368
+$i = $i + 300;
369 369
 $output .= $i.',28.829999,47.029998,150000,';
370
-$i = $i+300;
370
+$i = $i + 300;
371 371
 $output .= $i.',25.61,45.659999,150000,';
372
-$i = $i+300;
372
+$i = $i + 300;
373 373
 $output .= $i.',27.469999,42.509998,150000,';
374
-$i = $i+300;
374
+$i = $i + 300;
375 375
 $output .= $i.',23.729999,37.979999,150000,';
376
-$i = $i+300;
376
+$i = $i + 300;
377 377
 $output .= $i.',27.149999,38.43,150000,';
378
-$i = $i+300;
378
+$i = $i + 300;
379 379
 $output .= $i.',31.132659,29.977088,150000,';
380
-$i = $i+300;
380
+$i = $i + 300;
381 381
 $output .= $i.',32.659999,13.17,150000,';
382
-$i = $i+300;
382
+$i = $i + 300;
383 383
 $output .= $i.',33.599998,1.71,150000,';
384
-$i = $i+300;
384
+$i = $i + 300;
385 385
 $output .= $i.',25.92,-2.95,150000,';
386
-$i = $i+300;
386
+$i = $i + 300;
387 387
 $output .= $i.',28.45,-14.439999,150000,';
388
-$i = $i+300;
388
+$i = $i + 300;
389 389
 $output .= $i.',30.819999,-20.059999,150000,';
390
-$i = $i+300;
390
+$i = $i + 300;
391 391
 $output .= $i.',21.639999,-21.7,150000,';
392
-$i = $i+300;
392
+$i = $i + 300;
393 393
 $output .= $i.',25.59,-33.959999,150000,';
394
-$i = $i+300;
394
+$i = $i + 300;
395 395
 $output .= $i.',18.129999,-26.579999,150000,';
396
-$i = $i+300;
396
+$i = $i + 300;
397 397
 $output .= $i.',13.767777,-10.722417,150000,';
398
-$i = $i+300;
398
+$i = $i + 300;
399 399
 $output .= $i.',10.13,-0.15,150000,';
400
-$i = $i+300;
400
+$i = $i + 300;
401 401
 $output .= $i.',20.67,5.76,150000,';
402
-$i = $i+300;
402
+$i = $i + 300;
403 403
 $output .= $i.',9.71,4.059999,150000,';
404
-$i = $i+300;
404
+$i = $i + 300;
405 405
 $output .= $i.',7.44,10.52,150000,';
406
-$i = $i+300;
406
+$i = $i + 300;
407 407
 $output .= $i.',18.69,12.189999,150000,';
408
-$i = $i+300;
408
+$i = $i + 300;
409 409
 $output .= $i.',7.98,17,150000,';
410
-$i = $i+300;
410
+$i = $i + 300;
411 411
 $output .= $i.',14.42,27.069999,150000,';
412
-$i = $i+300;
412
+$i = $i + 300;
413 413
 $output .= $i.',3.678539,32.489059,150000,';
414
-$i = $i+300;
414
+$i = $i + 300;
415 415
 $output .= $i.',-7.619999,33.599998,150000,';
416
-$i = $i+300;
416
+$i = $i + 300;
417 417
 $output .= $i.',13.611066,38.129963,150000,';
418
-$i = $i+300;
418
+$i = $i + 300;
419 419
 $output .= $i.',12.482323,41.895466,150000,';
420
-$i = $i+300;
420
+$i = $i + 300;
421 421
 $output .= $i.',17.189752,44.763891,150000,';
422
-$i = $i+300;
422
+$i = $i + 300;
423 423
 $output .= $i.',16.45,43.509998,150000,';
424
-$i = $i+300;
424
+$i = $i + 300;
425 425
 $output .= $i.',14.51,46.060001,150000,';
426
-$i = $i+300;
426
+$i = $i + 300;
427 427
 $output .= $i.',21.629999,47.54,150000,';
428
-$i = $i+300;
428
+$i = $i + 300;
429 429
 $output .= $i.',16.37,48.220001,150000,';
430
-$i = $i+300;
430
+$i = $i + 300;
431 431
 $output .= $i.',10.736111,47.554444,150000,';
432
-$i = $i+300;
432
+$i = $i + 300;
433 433
 $output .= $i.',14.43,50.080001,150000,';
434
-$i = $i+300;
434
+$i = $i + 300;
435 435
 $output .= $i.',17.129999,48.159999,150000,';
436
-$i = $i+300;
436
+$i = $i + 300;
437 437
 $output .= $i.',22.569999,51.240001,150000,';
438
-$i = $i+300;
438
+$i = $i + 300;
439 439
 $output .= $i.',13.411895,52.523781,150000,';
440
-$i = $i+300;
440
+$i = $i + 300;
441 441
 $output .= $i.',10.039999,56.470001,150000,';
442
-$i = $i+300;
442
+$i = $i + 300;
443 443
 $output .= $i.',13.02,55.61,150000,';
444
-$i = $i+300;
444
+$i = $i + 300;
445 445
 $output .= $i.',17.329999,62.400001,150000,';
446
-$i = $i+300;
446
+$i = $i + 300;
447 447
 $output .= $i.',14.229999,78.059997,150000,';
448
-$i = $i+300;
448
+$i = $i + 300;
449 449
 $output .= $i.',10.399999,63.439998,150000,';
450
-$i = $i+300;
450
+$i = $i + 300;
451 451
 $output .= $i.',2.350966,48.856558,150000,';
452
-$i = $i+300;
452
+$i = $i + 300;
453 453
 $output .= $i.',7.42,43.75,150000,';
454
-$i = $i+300;
454
+$i = $i + 300;
455 455
 $output .= $i.',1.57,42.54,150000,';
456
-$i = $i+300;
456
+$i = $i + 300;
457 457
 $output .= $i.',-0.991293,37.605651,150000,';
458
-$i = $i+300;
458
+$i = $i + 300;
459 459
 $output .= $i.',-7.429999,39.29,150000,';
460
-$i = $i+300;
460
+$i = $i + 300;
461 461
 $output .= $i.',-11.4053,16.5889,150000,';
462
-$i = $i+300;
462
+$i = $i + 300;
463 463
 $output .= $i.',-3.009999,16.78,150000,';
464
-$i = $i+300;
464
+$i = $i + 300;
465 465
 $output .= $i.',-5.36008,5.83885,150000,';
466
-$i = $i+300;
466
+$i = $i + 300;
467 467
 $output .= $i.',-12.3,11.319999,150000,';
468
-$i = $i+300;
468
+$i = $i + 300;
469 469
 $output .= $i.',-16.239999,12.829999,150000,';
470
-$i = $i+300;
470
+$i = $i + 300;
471 471
 $output .= $i.',-16.2507,28.457661,150000,';
472
-$i = $i+300;
472
+$i = $i + 300;
473 473
 $output .= $i.',-0.126197,51.500197,150000,';
474
-$i = $i+300;
474
+$i = $i + 300;
475 475
 $output .= $i.',-2.968111,56.461428,150000,';
476
-$i = $i+300;
476
+$i = $i + 300;
477 477
 $output .= $i.',-7.308429,54.998539,150000,';
478
-$i = $i+300;
478
+$i = $i + 300;
479 479
 $output .= $i.',-8.92,52.7,150000,';
480
-$i = $i+300;
480
+$i = $i + 300;
481 481
 $output .= $i.',-19.000959,63.427502,150000,';
482
-$i = $i+300;
482
+$i = $i + 300;
483 483
 $output .= $i.',-28.364049911499,38.47212219238281,150000,';
484
-$i = $i+300;
484
+$i = $i + 300;
485 485
 $output .= $i.',-23.76,15.279999,150000,';
486
-$i = $i+300;
486
+$i = $i + 300;
487 487
 $output .= $i.',-36.511219,-54.274151,150000,';
488
-$i = $i+300;
488
+$i = $i + 300;
489 489
 $output .= $i.',-58.979999,-51.830001,150000,';
490
-$i = $i+300;
490
+$i = $i + 300;
491 491
 $output .= $i.',-64.190002,-31.399999,150000,';
492
-$i = $i+300;
492
+$i = $i + 300;
493 493
 $output .= $i.',-54.18,-32.36,150000,';
494
-$i = $i+300;
494
+$i = $i + 300;
495 495
 $output .= $i.',-43.2,-22.909999,150000,';
496
-$i = $i+300;
496
+$i = $i + 300;
497 497
 $output .= $i.',-37.333333,65.666667,150000,';
498
-$i = $i+300;
498
+$i = $i + 300;
499 499
 $output .= $i.',-69.345131,77.48262,150000,';
500
-$i = $i+300;
500
+$i = $i + 300;
501 501
 $output .= $i.',-55.65049,48.929001,150000,';
502
-$i = $i+300;
502
+$i = $i + 300;
503 503
 $output .= $i.',-63.530471,44.681263,150000,';
504
-$i = $i+300;
504
+$i = $i + 300;
505 505
 $output .= $i.',-66.647818,45.957319,150000,';
506
-$i = $i+300;
506
+$i = $i + 300;
507 507
 $output .= $i.',-59.630001,13.18,150000,';
508
-$i = $i+300;
508
+$i = $i + 300;
509 509
 $output .= $i.',-61.744888,12.06526,150000,';
510
-$i = $i+300;
510
+$i = $i + 300;
511 511
 $output .= $i.',-61.171322,10.30501,150000,';
512
-$i = $i+300;
512
+$i = $i + 300;
513 513
 $output .= $i.',-67.470001,7.9,150000,';
514
-$i = $i+300;
514
+$i = $i + 300;
515 515
 $output .= $i.',-58.159999,6.789999,150000,';
516
-$i = $i+300;
516
+$i = $i + 300;
517 517
 $output .= $i.',-60.02,-3.119999,150000,';
518
-$i = $i+300;
518
+$i = $i + 300;
519 519
 $output .= $i.',-56.45,-14.409999,150000,';
520
-$i = $i+300;
520
+$i = $i + 300;
521 521
 $output .= $i.',-65.260002,-19.059999,150000,';
522
-$i = $i+300;
522
+$i = $i + 300;
523 523
 $output .= $i.',-56.636503,-24.158676,150000,';
524
-$i = $i+300;
524
+$i = $i + 300;
525 525
 $output .= $i.',-56.509998,-33.409999,150000,';
526
-$i = $i+300;
526
+$i = $i + 300;
527 527
 $output .= $i.',-68.523514,-50.021889,150000,';
528
-$i = $i+300;
528
+$i = $i + 300;
529 529
 $output .= $i.',-72.505127,-51.732529,150000,';
530
-$i = $i+300;
530
+$i = $i + 300;
531 531
 $output .= $i.',-71.639999,-33.04,150000,';
532
-$i = $i+300;
532
+$i = $i + 300;
533 533
 $output .= $i.',-72.515821,-13.162849,150000,';
534
-$i = $i+300;
534
+$i = $i + 300;
535 535
 $output .= $i.',-76.970001,-6.03,150000,';
536
-$i = $i+300;
536
+$i = $i + 300;
537 537
 $output .= $i.',-78.620002,-1.24,150000,';
538
-$i = $i+300;
538
+$i = $i + 300;
539 539
 $output .= $i.',-76.739997,8.1,150000,';
540
-$i = $i+300;
540
+$i = $i + 300;
541 541
 $output .= $i.',-79.879913,9.368985,150000,';
542
-$i = $i+300;
542
+$i = $i + 300;
543 543
 $output .= $i.',-76.949996,18,150000,';
544
-$i = $i+300;
544
+$i = $i + 300;
545 545
 $output .= $i.',-72.699996,19.11,150000,';
546
-$i = $i+300;
546
+$i = $i + 300;
547 547
 $output .= $i.',-75.220001,20.149999,150000,';
548
-$i = $i+300;
548
+$i = $i + 300;
549 549
 $output .= $i.',-73.682953,20.95027,150000,';
550
-$i = $i+300;
550
+$i = $i + 300;
551 551
 $output .= $i.',-80.605,28.405556,150000,';
552
-$i = $i+300;
552
+$i = $i + 300;
553 553
 $output .= $i.',-84.388056,33.748889,150000,';
554
-$i = $i+300;
554
+$i = $i + 300;
555 555
 $output .= $i.',-79.931111,32.776389,150000,';
556
-$i = $i+300;
556
+$i = $i + 300;
557 557
 $output .= $i.',-83.920833,35.960556,150000,';
558
-$i = $i+300;
558
+$i = $i + 300;
559 559
 $output .= $i.',-84.500278,38.049167,150000,';
560
-$i = $i+300;
560
+$i = $i + 300;
561 561
 $output .= $i.',-77.460833,38.303056,150000,';
562
-$i = $i+300;
562
+$i = $i + 300;
563 563
 $output .= $i.',-82.515556,40.758333,150000,';
564
-$i = $i+300;
564
+$i = $i + 300;
565 565
 $output .= $i.',-83.045833,42.331389,150000,';
566
-$i = $i+300;
566
+$i = $i + 300;
567 567
 $output .= $i.',-74.006389,40.714167,150000,';
568
-$i = $i+300;
568
+$i = $i + 300;
569 569
 $output .= $i.',-71.802778,42.2625,150000,';
570
-$i = $i+300;
570
+$i = $i + 300;
571 571
 $output .= $i.',-72.973056,43.610556,150000,';
572
-$i = $i+300;
572
+$i = $i + 300;
573 573
 $output .= $i.',-68.0125,46.860556,150000,';
574
-$i = $i+300;
574
+$i = $i + 300;
575 575
 $output .= $i.',-72.581779,46.357398,150000,';
576
-$i = $i+300;
576
+$i = $i + 300;
577 577
 $output .= $i.',-78.53632621543271,52.72737572958358,150000,';
578
-$i = $i+300;
578
+$i = $i + 300;
579 579
 $output .= $i.',-66.921779,52.940118,150000,';
580
-$i = $i+300;
580
+$i = $i + 300;
581 581
 $output .= $i.',-75.652573,62.201069,150000,';
582
-$i = $i+300;
582
+$i = $i + 300;
583 583
 $output .= $i.',-64.865257,67.935417,150000,';
584
-$i = $i+300;
584
+$i = $i + 300;
585 585
 $output .= $i.',-94.969443,74.716943,150000,';
586
-$i = $i+300;
586
+$i = $i + 300;
587 587
 $output .= $i.',-82.793909,76.395731,150000,';
588
-$i = $i+300;
588
+$i = $i + 300;
589 589
 $output .= $i.',-97.49276733398439,69.18675994873048,150000,';
590
-$i = $i+300;
590
+$i = $i + 300;
591 591
 $output .= $i.',-90.5537452697754,63.36753463745121,150000,';
592
-$i = $i+300;
592
+$i = $i + 300;
593 593
 $output .= $i.',-89.270113,48.412197,150000,';
594
-$i = $i+300;
594
+$i = $i + 300;
595 595
 $output .= $i.',-79.604159,43.68731,150000,';
596
-$i = $i+300;
596
+$i = $i + 300;
597 597
 $output .= $i.',-89.401111,43.073056,150000,';
598
-$i = $i+300;
598
+$i = $i + 300;
599 599
 $output .= $i.',-94.633611,42.395278,150000,';
600
-$i = $i+300;
600
+$i = $i + 300;
601 601
 $output .= $i.',-89.588889,40.693611,150000,';
602
-$i = $i+300;
602
+$i = $i + 300;
603 603
 $output .= $i.',-90.197778,38.627222,150000,';
604
-$i = $i+300;
604
+$i = $i + 300;
605 605
 $output .= $i.',-90.704167,35.842222,150000,';
606
-$i = $i+300;
606
+$i = $i + 300;
607 607
 $output .= $i.',-91.061667,33.41,150000,';
608
-$i = $i+300;
608
+$i = $i + 300;
609 609
 $output .= $i.',-92.445,31.311111,150000,';
610
-$i = $i+300;
610
+$i = $i + 300;
611 611
 $output .= $i.',-98.493333,29.423889,150000,';
612
-$i = $i+300;
612
+$i = $i + 300;
613 613
 $output .= $i.',-103.349998,20.67,150000,';
614
-$i = $i+300;
614
+$i = $i + 300;
615 615
 $output .= $i.',-86.830001,21.17,150000,';
616
-$i = $i+300;
616
+$i = $i + 300;
617 617
 $output .= $i.',-89.529998,14.979999,150000,';
618
-$i = $i+300;
618
+$i = $i + 300;
619 619
 $output .= $i.',-87.449996,13.42,150000,';
620
-$i = $i+300;
620
+$i = $i + 300;
621 621
 $output .= $i.',-83.709999,9.369999,150000,';
622
-$i = $i+300;
622
+$i = $i + 300;
623 623
 $output .= $i.',-91.5149765,-0.3781085,150000,';
624
-$i = $i+300;
624
+$i = $i + 300;
625 625
 $output .= $i.',-109.425598,-27.1546,150000,';
626
-$i = $i+300;
626
+$i = $i + 300;
627 627
 $output .= $i.',-109.9142,22.88093,150000,';
628
-$i = $i+300;
628
+$i = $i + 300;
629 629
 $output .= $i.',-110.910003,27.92,150000,';
630
-$i = $i+300;
630
+$i = $i + 300;
631 631
 $output .= $i.',-110.925833,32.221667,150000,';
632
-$i = $i+300;
632
+$i = $i + 300;
633 633
 $output .= $i.',-104.526667,33.395,150000,';
634
-$i = $i+300;
634
+$i = $i + 300;
635 635
 $output .= $i.',-113.061111,37.6775,150000,';
636
-$i = $i+300;
636
+$i = $i + 300;
637 637
 $output .= $i.',-104.820833,38.833889,150000,';
638
-$i = $i+300;
638
+$i = $i + 300;
639 639
 $output .= $i.',-108.73,42.833056,150000,';
640
-$i = $i+300;
640
+$i = $i + 300;
641 641
 $output .= $i.',-113.895,45.175833,150000,';
642
-$i = $i+300;
642
+$i = $i + 300;
643 643
 $output .= $i.',-113.993056,46.872222,150000,';
644
-$i = $i+300;
644
+$i = $i + 300;
645 645
 $output .= $i.',-114.080796,51.039877,150000,';
646
-$i = $i+300;
646
+$i = $i + 300;
647 647
 $output .= $i.',-102.3889594419702,57.15883691318781,150000,';
648
-$i = $i+300;
648
+$i = $i + 300;
649 649
 $output .= $i.',-118.0333,66.0833,150000,';
650
-$i = $i+300;
650
+$i = $i + 300;
651 651
 $output .= $i.',-140.55,64.45,150000,';
652
-$i = $i+300;
652
+$i = $i + 300;
653 653
 $output .= $i.',-122.690386,58.80667,150000,';
654
-$i = $i+300;
654
+$i = $i + 300;
655 655
 $output .= $i.',-121.92985,50.686341,150000,';
656
-$i = $i+300;
656
+$i = $i + 300;
657 657
 $output .= $i.',-122.330833,47.606389,150000,';
658
-$i = $i+300;
658
+$i = $i + 300;
659 659
 $output .= $i.',-122.274167,47.564167,150000,';
660
-$i = $i+300;
660
+$i = $i + 300;
661 661
 $output .= $i.',-122.968503,45.309901,150000,';
662
-$i = $i+300;
662
+$i = $i + 300;
663 663
 $output .= $i.',-122.874444,42.326667,150000,';
664
-$i = $i+300;
664
+$i = $i + 300;
665 665
 $output .= $i.',-122.390556,40.586667,150000,';
666
-$i = $i+300;
666
+$i = $i + 300;
667 667
 $output .= $i.',-117.068611,39.493333,150000,';
668
-$i = $i+300;
668
+$i = $i + 300;
669 669
 $output .= $i.',-122.418333,37.775,150000,';
670
-$i = $i+300;
670
+$i = $i + 300;
671 671
 $output .= $i.',-117.108333,34.207778,150000,';
672
-$i = $i+300;
672
+$i = $i + 300;
673 673
 $output .= $i.',-116.544444,33.830278,150000,';
674
-$i = $i+300;
674
+$i = $i + 300;
675 675
 $output .= $i.',-117.156389,32.715278,150000,';
676
-$i = $i+300;
676
+$i = $i + 300;
677 677
 $output .= $i.',-149.891667,61.218333,150000,';
678
-$i = $i+300;
678
+$i = $i + 300;
679 679
 $output .= $i.',-155.566389,62.948889,150000,';
680
-$i = $i+300;
680
+$i = $i + 300;
681 681
 $output .= $i.',-165.406389,64.501111,150000,';
682
-$i = $i+300;
682
+$i = $i + 300;
683 683
 $output .= $i.',-155.09,19.729722,150000,';
684
-$i = $i+300;
684
+$i = $i + 300;
685 685
 $output .= $i.',-156.337974,20.804858,150000,';
686
-$i = $i+300;
686
+$i = $i + 300;
687 687
 $output .= $i.',-157.043209,21.141189,150000,';
688
-$i = $i+300;
688
+$i = $i + 300;
689 689
 $output .= $i.',-158.009167,21.386667,150000,';
690
-$i = $i+300;
690
+$i = $i + 300;
691 691
 $output .= $i.',-159.371111,21.981111,150000';
692 692
 
693 693
 $output .= ']}}';
Please login to merge, or discard this patch.