Completed
Push — master ( 210d86...07e4af )
by Yannick
05:25
created
require/class.Stats.php 4 patches
Doc Comments   +32 added lines patch added patch discarded remove patch
@@ -13,6 +13,10 @@  discard block
 block discarded – undo
13 13
 		$this->db = $Connection->db();
14 14
         }
15 15
               
16
+	/**
17
+	 * @param string $type
18
+	 * @param string $stats_date
19
+	 */
16 20
 	public function addLastStatsUpdate($type,$stats_date) {
17 21
                 $query = "DELETE FROM config WHERE name = :type;
18 22
             		INSERT INTO config (name,value) VALUES (:type,:stats_date);";
@@ -578,6 +582,11 @@  discard block
 block discarded – undo
578 582
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
579 583
                 return $all;
580 584
         }
585
+
586
+	/**
587
+	 * @param string $type
588
+	 * @param string $year
589
+	 */
581 590
 	public function getSumStats($type,$year,$stats_airline = '') {
582 591
     		global $globalArchiveMonths, $globalDBdriver;
583 592
     		if ($globalDBdriver == 'mysql') {
@@ -677,6 +686,10 @@  discard block
 block discarded – undo
677 686
                 return $all[0]['total'];
678 687
         }
679 688
 
689
+	/**
690
+	 * @param string $type
691
+	 * @param string $stats_date
692
+	 */
680 693
 	public function addStat($type,$cnt,$stats_date,$stats_airline = '') {
681 694
 		global $globalDBdriver;
682 695
 		if ($globalDBdriver == 'mysql') {
@@ -708,6 +721,10 @@  discard block
 block discarded – undo
708 721
                         return "error : ".$e->getMessage();
709 722
                 }
710 723
         }
724
+
725
+	/**
726
+	 * @param string $date
727
+	 */
711 728
 	public function getStatsSource($date,$stats_type = '') {
712 729
 		if ($stats_type == '') {
713 730
 			$query = "SELECT * FROM stats_source WHERE stats_date = :date ORDER BY source_name";
@@ -726,6 +743,9 @@  discard block
 block discarded – undo
726 743
                 return $all;
727 744
         }
728 745
 
746
+	/**
747
+	 * @param string $stats_type
748
+	 */
729 749
 	public function addStatSource($data,$source_name,$stats_type,$date) {
730 750
 		global $globalDBdriver;
731 751
 		if ($globalDBdriver == 'mysql') {
@@ -741,6 +761,10 @@  discard block
 block discarded – undo
741 761
                         return "error : ".$e->getMessage();
742 762
                 }
743 763
         }
764
+
765
+	/**
766
+	 * @param string $type
767
+	 */
744 768
 	public function addStatFlight($type,$date_name,$cnt,$stats_airline = '') {
745 769
                 $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline) VALUES (:type,:flight_date,:cnt,:stats_airline)";
746 770
                 $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline);
@@ -927,6 +951,10 @@  discard block
 block discarded – undo
927 951
                         return "error : ".$e->getMessage();
928 952
                 }
929 953
         }
954
+
955
+	/**
956
+	 * @param string $type
957
+	 */
930 958
 	public function deleteStatFlight($type) {
931 959
                 $query = "DELETE FROM stats_flight WHERE stats_type = :type";
932 960
                 $query_values = array(':type' => $type);
@@ -937,6 +965,10 @@  discard block
 block discarded – undo
937 965
                         return "error : ".$e->getMessage();
938 966
                 }
939 967
         }
968
+
969
+	/**
970
+	 * @param string $type
971
+	 */
940 972
 	public function deleteStatAirport($type) {
941 973
                 $query = "DELETE FROM stats_airport WHERE stats_type = :type";
942 974
                 $query_values = array(':type' => $type);
Please login to merge, or discard this patch.
Braces   +383 added lines, -133 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@  discard block
 block discarded – undo
12 12
 	
13 13
 	public function __construct($dbc = null) {
14 14
 		global $globalFilterName;
15
-		if (isset($globalFilterName)) $this->filter_name = $globalFilterName;
15
+		if (isset($globalFilterName)) {
16
+			$this->filter_name = $globalFilterName;
17
+		}
16 18
 		$Connection = new Connection($dbc);
17 19
 		$this->db = $Connection->db();
18 20
         }
@@ -41,7 +43,9 @@  discard block
 block discarded – undo
41 43
                 return $all;
42 44
         }
43 45
 	public function getAllAirlineNames($filter_name = '') {
44
-		if ($filter_name == '') $filter_name = $this->filter_name;
46
+		if ($filter_name == '') {
47
+			$filter_name = $this->filter_name;
48
+		}
45 49
                 $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC";
46 50
                  try {
47 51
                         $sth = $this->db->prepare($query);
@@ -53,7 +57,9 @@  discard block
 block discarded – undo
53 57
                 return $all;
54 58
         }
55 59
 	public function getAllAircraftTypes($stats_airline = '',$filter_name = '') {
56
-		if ($filter_name == '') $filter_name = $this->filter_name;
60
+		if ($filter_name == '') {
61
+			$filter_name = $this->filter_name;
62
+		}
57 63
                 $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
58 64
                  try {
59 65
                         $sth = $this->db->prepare($query);
@@ -65,7 +71,9 @@  discard block
 block discarded – undo
65 71
                 return $all;
66 72
         }
67 73
 	public function getAllManufacturers($stats_airline = '',$filter_name = '') {
68
-		if ($filter_name == '') $filter_name = $this->filter_name;
74
+		if ($filter_name == '') {
75
+			$filter_name = $this->filter_name;
76
+		}
69 77
                 $query = "SELECT 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 78
                  try {
71 79
                         $sth = $this->db->prepare($query);
@@ -77,7 +85,9 @@  discard block
 block discarded – undo
77 85
                 return $all;
78 86
         }
79 87
 	public function getAllAirportNames($stats_airline = '',$filter_name = '') {
80
-		if ($filter_name == '') $filter_name = $this->filter_name;
88
+		if ($filter_name == '') {
89
+			$filter_name = $this->filter_name;
90
+		}
81 91
                 $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 92
                  try {
83 93
                         $sth = $this->db->prepare($query);
@@ -92,9 +102,14 @@  discard block
 block discarded – undo
92 102
 
93 103
 	public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '') {
94 104
 		global $globalStatsFilters;
95
-		if ($filter_name == '') $filter_name = $this->filter_name;
96
-		if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0";
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";
105
+		if ($filter_name == '') {
106
+			$filter_name = $this->filter_name;
107
+		}
108
+		if ($limit) {
109
+			$query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0";
110
+		} else {
111
+			$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";
112
+		}
98 113
                  try {
99 114
                         $sth = $this->db->prepare($query);
100 115
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -114,9 +129,14 @@  discard block
 block discarded – undo
114 129
 	}
115 130
 	public function countAllAirlineCountries($limit = true,$filter_name = '') {
116 131
 		global $globalStatsFilters;
117
-		if ($filter_name == '') $filter_name = $this->filter_name;
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";
119
-		else $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC";
132
+		if ($filter_name == '') {
133
+			$filter_name = $this->filter_name;
134
+		}
135
+		if ($limit) {
136
+			$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";
137
+		} else {
138
+			$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";
139
+		}
120 140
                  try {
121 141
                         $sth = $this->db->prepare($query);
122 142
                         $sth->execute(array(':filter_name' => $filter_name));
@@ -136,9 +156,14 @@  discard block
 block discarded – undo
136 156
 	}
137 157
 	public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '') {
138 158
 		global $globalStatsFilters;
139
-		if ($filter_name == '') $filter_name = $this->filter_name;
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
-		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";
159
+		if ($filter_name == '') {
160
+			$filter_name = $this->filter_name;
161
+		}
162
+		if ($limit) {
163
+			$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";
164
+		} else {
165
+			$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";
166
+		}
142 167
                  try {
143 168
                         $sth = $this->db->prepare($query);
144 169
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -159,9 +184,14 @@  discard block
 block discarded – undo
159 184
 
160 185
 	public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '') {
161 186
 		global $globalStatsFilters;
162
-		if ($filter_name == '') $filter_name = $this->filter_name;
163
-		if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0";
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";
187
+		if ($filter_name == '') {
188
+			$filter_name = $this->filter_name;
189
+		}
190
+		if ($limit) {
191
+			$query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0";
192
+		} else {
193
+			$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";
194
+		}
165 195
                  try {
166 196
                         $sth = $this->db->prepare($query);
167 197
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -181,9 +211,14 @@  discard block
 block discarded – undo
181 211
 	}
182 212
 	public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '') {
183 213
 		global $globalStatsFilters;
184
-		if ($filter_name == '') $filter_name = $this->filter_name;
185
-		if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
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";
214
+		if ($filter_name == '') {
215
+			$filter_name = $this->filter_name;
216
+		}
217
+		if ($limit) {
218
+			$query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
219
+		} else {
220
+			$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";
221
+		}
187 222
                  try {
188 223
                         $sth = $this->db->prepare($query);
189 224
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -204,9 +239,14 @@  discard block
 block discarded – undo
204 239
 
205 240
 	public function countAllAirlines($limit = true,$filter_name = '') {
206 241
 		global $globalStatsFilters;
207
-		if ($filter_name == '') $filter_name = $this->filter_name;
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";
209
-		else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC";
242
+		if ($filter_name == '') {
243
+			$filter_name = $this->filter_name;
244
+		}
245
+		if ($limit) {
246
+			$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";
247
+		} else {
248
+			$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";
249
+		}
210 250
                  try {
211 251
                         $sth = $this->db->prepare($query);
212 252
                         $sth->execute(array(':filter_name' => $filter_name));
@@ -227,9 +267,14 @@  discard block
 block discarded – undo
227 267
 	}
228 268
 	public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '') {
229 269
 		global $globalStatsFilters;
230
-		if ($filter_name == '') $filter_name = $this->filter_name;
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
-		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";
270
+		if ($filter_name == '') {
271
+			$filter_name = $this->filter_name;
272
+		}
273
+		if ($limit) {
274
+			$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";
275
+		} else {
276
+			$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";
277
+		}
233 278
                  try {
234 279
                         $sth = $this->db->prepare($query);
235 280
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -249,9 +294,14 @@  discard block
 block discarded – undo
249 294
 	}
250 295
 	public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '') {
251 296
 		global $globalStatsFilters;
252
-		if ($filter_name == '') $filter_name = $this->filter_name;
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
-		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";
297
+		if ($filter_name == '') {
298
+			$filter_name = $this->filter_name;
299
+		}
300
+		if ($limit) {
301
+			$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";
302
+		} else {
303
+			$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";
304
+		}
255 305
 		 try {
256 306
 			$sth = $this->db->prepare($query);
257 307
 			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -271,10 +321,15 @@  discard block
 block discarded – undo
271 321
 	}
272 322
 	public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '') {
273 323
 		$Connection = new Connection();
274
-		if ($filter_name == '') $filter_name = $this->filter_name;
324
+		if ($filter_name == '') {
325
+			$filter_name = $this->filter_name;
326
+		}
275 327
 		if ($Connection->tableExists('countries')) {
276
-			if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0";
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";
328
+			if ($limit) {
329
+				$query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0";
330
+			} else {
331
+				$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";
332
+			}
278 333
 			 try {
279 334
 				$sth = $this->db->prepare($query);
280 335
 				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -295,9 +350,14 @@  discard block
 block discarded – undo
295 350
 	}
296 351
 	public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '') {
297 352
 		global $globalStatsFilters;
298
-		if ($filter_name == '') $filter_name = $this->filter_name;
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
-		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";
353
+		if ($filter_name == '') {
354
+			$filter_name = $this->filter_name;
355
+		}
356
+		if ($limit) {
357
+			$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";
358
+		} else {
359
+			$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";
360
+		}
301 361
                  try {
302 362
                         $sth = $this->db->prepare($query);
303 363
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -317,9 +377,14 @@  discard block
 block discarded – undo
317 377
 	}
318 378
 	public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '') {
319 379
 		global $globalStatsFilters;
320
-		if ($filter_name == '') $filter_name = $this->filter_name;
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
-		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";
380
+		if ($filter_name == '') {
381
+			$filter_name = $this->filter_name;
382
+		}
383
+		if ($limit) {
384
+			$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";
385
+		} else {
386
+			$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";
387
+		}
323 388
                  try {
324 389
                         $sth = $this->db->prepare($query);
325 390
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -339,9 +404,14 @@  discard block
 block discarded – undo
339 404
 	}
340 405
 	public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '') {
341 406
 		global $globalStatsFilters;
342
-		if ($filter_name == '') $filter_name = $this->filter_name;
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
-		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";
407
+		if ($filter_name == '') {
408
+			$filter_name = $this->filter_name;
409
+		}
410
+		if ($limit) {
411
+			$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";
412
+		} else {
413
+			$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";
414
+		}
345 415
                  try {
346 416
                         $sth = $this->db->prepare($query);
347 417
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -367,7 +437,9 @@  discard block
 block discarded – undo
367 437
         			$icao = $value['airport_departure_icao'];
368 438
         			if (isset($all[$icao])) {
369 439
         				$all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
370
-        			} else $all[$icao] = $value;
440
+        			} else {
441
+        				$all[$icao] = $value;
442
+        			}
371 443
         		}
372 444
         		$count = array();
373 445
         		foreach ($all as $key => $row) {
@@ -379,9 +451,14 @@  discard block
 block discarded – undo
379 451
 	}
380 452
 	public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '') {
381 453
 		global $globalStatsFilters;
382
-		if ($filter_name == '') $filter_name = $this->filter_name;
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
-		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";
454
+		if ($filter_name == '') {
455
+			$filter_name = $this->filter_name;
456
+		}
457
+		if ($limit) {
458
+			$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";
459
+		} else {
460
+			$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";
461
+		}
385 462
 		try {
386 463
 			$sth = $this->db->prepare($query);
387 464
 			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -407,7 +484,9 @@  discard block
 block discarded – undo
407 484
         			$icao = $value['airport_arrival_icao'];
408 485
         			if (isset($all[$icao])) {
409 486
         				$all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
410
-        			} else $all[$icao] = $value;
487
+        			} else {
488
+        				$all[$icao] = $value;
489
+        			}
411 490
         		}
412 491
         		$count = array();
413 492
         		foreach ($all as $key => $row) {
@@ -420,13 +499,21 @@  discard block
 block discarded – undo
420 499
 	}
421 500
 	public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') {
422 501
 		global $globalDBdriver, $globalStatsFilters;
423
-		if ($filter_name == '') $filter_name = $this->filter_name;
502
+		if ($filter_name == '') {
503
+			$filter_name = $this->filter_name;
504
+		}
424 505
 		if ($globalDBdriver == 'mysql') {
425
-			if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
426
-			else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
506
+			if ($limit) {
507
+				$query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
508
+			} else {
509
+				$query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
510
+			}
427 511
 		} else {
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
-			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";
512
+			if ($limit) {
513
+				$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";
514
+			} else {
515
+				$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";
516
+			}
430 517
 		}
431 518
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
432 519
                  try {
@@ -450,7 +537,9 @@  discard block
 block discarded – undo
450 537
 	
451 538
 	public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') {
452 539
 		global $globalStatsFilters;
453
-		if ($filter_name == '') $filter_name = $this->filter_name;
540
+		if ($filter_name == '') {
541
+			$filter_name = $this->filter_name;
542
+		}
454 543
 		$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 544
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
456 545
                  try {
@@ -472,7 +561,9 @@  discard block
 block discarded – undo
472 561
 	}
473 562
 	public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') {
474 563
 		global $globalDBdriver, $globalStatsFilters;
475
-		if ($filter_name == '') $filter_name = $this->filter_name;
564
+		if ($filter_name == '') {
565
+			$filter_name = $this->filter_name;
566
+		}
476 567
 		if ($globalDBdriver == 'mysql') {
477 568
 			$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND stats_airline = :stats_airline AND filter_name = :filter_name";
478 569
 		} else {
@@ -498,7 +589,9 @@  discard block
 block discarded – undo
498 589
 	}
499 590
 	public function countAllDates($stats_airline = '',$filter_name = '') {
500 591
 		global $globalStatsFilters;
501
-		if ($filter_name == '') $filter_name = $this->filter_name;
592
+		if ($filter_name == '') {
593
+			$filter_name = $this->filter_name;
594
+		}
502 595
 		$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 596
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
504 597
                  try {
@@ -520,7 +613,9 @@  discard block
 block discarded – undo
520 613
 	}
521 614
 	public function countAllDatesByAirlines($filter_name = '') {
522 615
 		global $globalStatsFilters;
523
-		if ($filter_name == '') $filter_name = $this->filter_name;
616
+		if ($filter_name == '') {
617
+			$filter_name = $this->filter_name;
618
+		}
524 619
 		$query = "SELECT stats_airline as airline_icao, flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND filter_name = :filter_name";
525 620
 		$query_data = array('filter_name' => $filter_name);
526 621
                  try {
@@ -542,7 +637,9 @@  discard block
 block discarded – undo
542 637
 	}
543 638
 	public function countAllMonths($stats_airline = '',$filter_name = '') {
544 639
 		global $globalStatsFilters;
545
-		if ($filter_name == '') $filter_name = $this->filter_name;
640
+		if ($filter_name == '') {
641
+			$filter_name = $this->filter_name;
642
+		}
546 643
 	    	$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 644
                  try {
548 645
                         $sth = $this->db->prepare($query);
@@ -563,7 +660,9 @@  discard block
 block discarded – undo
563 660
 	}
564 661
 	public function countAllMilitaryMonths($filter_name = '') {
565 662
 		global $globalStatsFilters;
566
-		if ($filter_name == '') $filter_name = $this->filter_name;
663
+		if ($filter_name == '') {
664
+			$filter_name = $this->filter_name;
665
+		}
567 666
 	    	$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name";
568 667
                  try {
569 668
                         $sth = $this->db->prepare($query);
@@ -584,9 +683,14 @@  discard block
 block discarded – undo
584 683
 	}
585 684
 	public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') {
586 685
 		global $globalTimezone, $globalDBdriver, $globalStatsFilters;
587
-		if ($filter_name == '') $filter_name = $this->filter_name;
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";
589
-		else $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
686
+		if ($filter_name == '') {
687
+			$filter_name = $this->filter_name;
688
+		}
689
+		if ($limit) {
690
+			$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";
691
+		} else {
692
+			$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";
693
+		}
590 694
 		if ($orderby == 'hour') {
591 695
 			/*
592 696
 			if ($globalDBdriver == 'mysql') {
@@ -595,7 +699,9 @@  discard block
 block discarded – undo
595 699
 			*/
596 700
 			$query .= " ORDER BY CAST(flight_date AS integer) ASC";
597 701
 		}
598
-		if ($orderby == 'count') $query .= " ORDER BY hour_count DESC";
702
+		if ($orderby == 'count') {
703
+			$query .= " ORDER BY hour_count DESC";
704
+		}
599 705
                  try {
600 706
                         $sth = $this->db->prepare($query);
601 707
                         $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
@@ -616,7 +722,9 @@  discard block
 block discarded – undo
616 722
 	
617 723
 	public function countOverallFlights($stats_airline = '', $filter_name = '') {
618 724
 		global $globalStatsFilters;
619
-		if ($filter_name == '') $filter_name = $this->filter_name;
725
+		if ($filter_name == '') {
726
+			$filter_name = $this->filter_name;
727
+		}
620 728
 		$all = $this->getSumStats('flights_bymonth',date('Y'),$stats_airline,$filter_name);
621 729
 		if (empty($all)) {
622 730
 			$filters = array('airlines' => array($stats_airline));
@@ -630,7 +738,9 @@  discard block
 block discarded – undo
630 738
 	}
631 739
 	public function countOverallMilitaryFlights($filter_name = '') {
632 740
 		global $globalStatsFilters;
633
-		if ($filter_name == '') $filter_name = $this->filter_name;
741
+		if ($filter_name == '') {
742
+			$filter_name = $this->filter_name;
743
+		}
634 744
 		$all = $this->getSumStats('military_flights_bymonth',date('Y'),'',$filter_name);
635 745
 		if (empty($all)) {
636 746
 		        $filters = array();
@@ -644,7 +754,9 @@  discard block
 block discarded – undo
644 754
 	}
645 755
 	public function countOverallArrival($stats_airline = '',$filter_name = '') {
646 756
 		global $globalStatsFilters;
647
-		if ($filter_name == '') $filter_name = $this->filter_name;
757
+		if ($filter_name == '') {
758
+			$filter_name = $this->filter_name;
759
+		}
648 760
 		$all = $this->getSumStats('realarrivals_bymonth',date('Y'),$stats_airline,$filter_name);
649 761
 		if (empty($all)) {
650 762
 			$filters = array('airlines' => array($stats_airline));
@@ -658,7 +770,9 @@  discard block
 block discarded – undo
658 770
 	}
659 771
 	public function countOverallAircrafts($stats_airline = '',$filter_name = '') {
660 772
 		global $globalStatsFilters;
661
-		if ($filter_name == '') $filter_name = $this->filter_name;
773
+		if ($filter_name == '') {
774
+			$filter_name = $this->filter_name;
775
+		}
662 776
 		$all = $this->getSumStats('aircrafts_bymonth',date('Y'),$stats_airline,$filter_name);
663 777
 		if (empty($all)) {
664 778
 			$filters = array('airlines' => array($stats_airline));
@@ -672,7 +786,9 @@  discard block
 block discarded – undo
672 786
 	}
673 787
 	public function countOverallAirlines($filter_name = '') {
674 788
 		global $globalStatsFilters;
675
-		if ($filter_name == '') $filter_name = $this->filter_name;
789
+		if ($filter_name == '') {
790
+			$filter_name = $this->filter_name;
791
+		}
676 792
 		$query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name";
677 793
                  try {
678 794
                         $sth = $this->db->prepare($query);
@@ -695,7 +811,9 @@  discard block
 block discarded – undo
695 811
 	}
696 812
 	public function countOverallOwners($stats_airline = '',$filter_name = '') {
697 813
 		global $globalStatsFilters;
698
-		if ($filter_name == '') $filter_name = $this->filter_name;
814
+		if ($filter_name == '') {
815
+			$filter_name = $this->filter_name;
816
+		}
699 817
 		/*
700 818
 		$query = "SELECT COUNT(*) AS nb_owner FROM stats_owner";
701 819
                  try {
@@ -720,7 +838,9 @@  discard block
 block discarded – undo
720 838
 	}
721 839
 	public function countOverallPilots($stats_airline = '',$filter_name = '') {
722 840
 		global $globalStatsFilters;
723
-		if ($filter_name == '') $filter_name = $this->filter_name;
841
+		if ($filter_name == '') {
842
+			$filter_name = $this->filter_name;
843
+		}
724 844
 		$all = $this->getSumStats('pilots_bymonth',date('Y'),$stats_airline,$filter_name);
725 845
 		if (empty($all)) {
726 846
 			$filters = array('airlines' => array($stats_airline));
@@ -734,7 +854,9 @@  discard block
 block discarded – undo
734 854
 	}
735 855
 
736 856
 	public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') {
737
-		if ($filter_name == '') $filter_name = $this->filter_name;
857
+		if ($filter_name == '') {
858
+			$filter_name = $this->filter_name;
859
+		}
738 860
 		$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 861
 		$query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
740 862
                  try {
@@ -747,7 +869,9 @@  discard block
 block discarded – undo
747 869
                 return $all;
748 870
 	}
749 871
 	public function getStats($type,$stats_airline = '', $filter_name = '') {
750
-		if ($filter_name == '') $filter_name = $this->filter_name;
872
+		if ($filter_name == '') {
873
+			$filter_name = $this->filter_name;
874
+		}
751 875
                 $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date";
752 876
                 $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
753 877
                  try {
@@ -760,7 +884,9 @@  discard block
 block discarded – undo
760 884
                 return $all;
761 885
         }
762 886
 	public function getSumStats($type,$year,$stats_airline = '',$filter_name = '') {
763
-		if ($filter_name == '') $filter_name = $this->filter_name;
887
+		if ($filter_name == '') {
888
+			$filter_name = $this->filter_name;
889
+		}
764 890
     		global $globalArchiveMonths, $globalDBdriver;
765 891
     		if ($globalDBdriver == 'mysql') {
766 892
 	                $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name";
@@ -779,7 +905,9 @@  discard block
 block discarded – undo
779 905
         }
780 906
 	public function getStatsTotal($type, $stats_airline = '', $filter_name = '') {
781 907
     		global $globalArchiveMonths, $globalDBdriver;
782
-		if ($filter_name == '') $filter_name = $this->filter_name;
908
+		if ($filter_name == '') {
909
+			$filter_name = $this->filter_name;
910
+		}
783 911
     		if ($globalDBdriver == 'mysql') {
784 912
 			$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
785 913
 		} else {
@@ -797,7 +925,9 @@  discard block
 block discarded – undo
797 925
         }
798 926
 	public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') {
799 927
     		global $globalArchiveMonths, $globalDBdriver;
800
-		if ($filter_name == '') $filter_name = $this->filter_name;
928
+		if ($filter_name == '') {
929
+			$filter_name = $this->filter_name;
930
+		}
801 931
     		if ($globalDBdriver == 'mysql') {
802 932
 			$query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name";
803 933
                 } else {
@@ -814,7 +944,9 @@  discard block
 block discarded – undo
814 944
         }
815 945
 	public function getStatsAirlineTotal($filter_name = '') {
816 946
     		global $globalArchiveMonths, $globalDBdriver;
817
-		if ($filter_name == '') $filter_name = $this->filter_name;
947
+		if ($filter_name == '') {
948
+			$filter_name = $this->filter_name;
949
+		}
818 950
     		if ($globalDBdriver == 'mysql') {
819 951
 			$query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name";
820 952
                 } else {
@@ -831,7 +963,9 @@  discard block
 block discarded – undo
831 963
         }
832 964
 	public function getStatsOwnerTotal($filter_name = '') {
833 965
     		global $globalArchiveMonths, $globalDBdriver;
834
-		if ($filter_name == '') $filter_name = $this->filter_name;
966
+		if ($filter_name == '') {
967
+			$filter_name = $this->filter_name;
968
+		}
835 969
     		if ($globalDBdriver == 'mysql') {
836 970
 			$query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name";
837 971
 		} else {
@@ -848,7 +982,9 @@  discard block
 block discarded – undo
848 982
         }
849 983
 	public function getStatsPilotTotal($filter_name = '') {
850 984
     		global $globalArchiveMonths, $globalDBdriver;
851
-		if ($filter_name == '') $filter_name = $this->filter_name;
985
+		if ($filter_name == '') {
986
+			$filter_name = $this->filter_name;
987
+		}
852 988
     		if ($globalDBdriver == 'mysql') {
853 989
             		$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
854 990
             	} else {
@@ -866,7 +1002,9 @@  discard block
 block discarded – undo
866 1002
 
867 1003
 	public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
868 1004
 		global $globalDBdriver;
869
-		if ($filter_name == '') $filter_name = $this->filter_name;
1005
+		if ($filter_name == '') {
1006
+			$filter_name = $this->filter_name;
1007
+		}
870 1008
 		if ($globalDBdriver == 'mysql') {
871 1009
 			$query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = :cnt";
872 1010
                 } else {
@@ -882,7 +1020,9 @@  discard block
 block discarded – undo
882 1020
         }
883 1021
 	public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
884 1022
 		global $globalDBdriver;
885
-		if ($filter_name == '') $filter_name = $this->filter_name;
1023
+		if ($filter_name == '') {
1024
+			$filter_name = $this->filter_name;
1025
+		}
886 1026
 		if ($globalDBdriver == 'mysql') {
887 1027
 			$query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date";
888 1028
 		} else {
@@ -1365,47 +1505,69 @@  discard block
 block discarded – undo
1365 1505
 			$this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s'));
1366 1506
 		} else {
1367 1507
 		*/
1368
-			if ($globalDebug) echo 'Update stats !'."\n";
1369
-			if ($globalDebug) echo 'Count all aircraft types...'."\n";
1508
+			if ($globalDebug) {
1509
+				echo 'Update stats !'."\n";
1510
+			}
1511
+			if ($globalDebug) {
1512
+				echo 'Count all aircraft types...'."\n";
1513
+			}
1370 1514
 			if (isset($last_update[0]['value'])) {
1371 1515
 				$last_update_day = $last_update[0]['value'];
1372
-			} else $last_update_day = '2012-12-12 12:12:12';
1516
+			} else {
1517
+				$last_update_day = '2012-12-12 12:12:12';
1518
+			}
1373 1519
 			$Spotter = new Spotter($this->db);
1374 1520
 			$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day);
1375 1521
 			foreach ($alldata as $number) {
1376 1522
 				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer']);
1377 1523
 			}
1378
-			if ($globalDebug) echo 'Count all airlines...'."\n";
1524
+			if ($globalDebug) {
1525
+				echo 'Count all airlines...'."\n";
1526
+			}
1379 1527
 			$alldata = $Spotter->countAllAirlines(false,0,$last_update_day);
1380 1528
 			foreach ($alldata as $number) {
1381 1529
 				$this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name']);
1382 1530
 			}
1383
-			if ($globalDebug) echo 'Count all registrations...'."\n";
1531
+			if ($globalDebug) {
1532
+				echo 'Count all registrations...'."\n";
1533
+			}
1384 1534
 			$alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day);
1385 1535
 			foreach ($alldata as $number) {
1386 1536
 				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao']);
1387 1537
 			}
1388
-			if ($globalDebug) echo 'Count all callsigns...'."\n";
1538
+			if ($globalDebug) {
1539
+				echo 'Count all callsigns...'."\n";
1540
+			}
1389 1541
 			$alldata = $Spotter->countAllCallsigns(false,0,$last_update_day);
1390 1542
 			foreach ($alldata as $number) {
1391 1543
 				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']);
1392 1544
 			}
1393
-			if ($globalDebug) echo 'Count all owners...'."\n";
1545
+			if ($globalDebug) {
1546
+				echo 'Count all owners...'."\n";
1547
+			}
1394 1548
 			$alldata = $Spotter->countAllOwners(false,0,$last_update_day);
1395 1549
 			foreach ($alldata as $number) {
1396 1550
 				$this->addStatOwner($number['owner_name'],$number['owner_count']);
1397 1551
 			}
1398
-			if ($globalDebug) echo 'Count all pilots...'."\n";
1552
+			if ($globalDebug) {
1553
+				echo 'Count all pilots...'."\n";
1554
+			}
1399 1555
 			$alldata = $Spotter->countAllPilots(false,0,$last_update_day);
1400 1556
 			foreach ($alldata as $number) {
1401 1557
 				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name']);
1402 1558
 			}
1403 1559
 			
1404
-			if ($globalDebug) echo 'Count all departure airports...'."\n";
1560
+			if ($globalDebug) {
1561
+				echo 'Count all departure airports...'."\n";
1562
+			}
1405 1563
 			$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day);
1406
-			if ($globalDebug) echo 'Count all detected departure airports...'."\n";
1564
+			if ($globalDebug) {
1565
+				echo 'Count all detected departure airports...'."\n";
1566
+			}
1407 1567
         		$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day);
1408
-			if ($globalDebug) echo 'Order departure airports...'."\n";
1568
+			if ($globalDebug) {
1569
+				echo 'Order departure airports...'."\n";
1570
+			}
1409 1571
 	        	$alldata = array();
1410 1572
 	        	
1411 1573
     			foreach ($pall as $value) {
@@ -1416,7 +1578,9 @@  discard block
 block discarded – undo
1416 1578
     				$icao = $value['airport_departure_icao'];
1417 1579
         			if (isset($alldata[$icao])) {
1418 1580
     					$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1419
-        			} else $alldata[$icao] = $value;
1581
+        			} else {
1582
+        				$alldata[$icao] = $value;
1583
+        			}
1420 1584
 			}
1421 1585
     			$count = array();
1422 1586
     			foreach ($alldata as $key => $row) {
@@ -1426,11 +1590,17 @@  discard block
 block discarded – undo
1426 1590
 			foreach ($alldata as $number) {
1427 1591
 				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 1592
 			}
1429
-			if ($globalDebug) echo 'Count all arrival airports...'."\n";
1593
+			if ($globalDebug) {
1594
+				echo 'Count all arrival airports...'."\n";
1595
+			}
1430 1596
 			$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day);
1431
-			if ($globalDebug) echo 'Count all detected arrival airports...'."\n";
1597
+			if ($globalDebug) {
1598
+				echo 'Count all detected arrival airports...'."\n";
1599
+			}
1432 1600
         		$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day);
1433
-			if ($globalDebug) echo 'Order arrival airports...'."\n";
1601
+			if ($globalDebug) {
1602
+				echo 'Order arrival airports...'."\n";
1603
+			}
1434 1604
 	        	$alldata = array();
1435 1605
     			foreach ($pall as $value) {
1436 1606
 	        		$icao = $value['airport_arrival_icao'];
@@ -1440,7 +1610,9 @@  discard block
 block discarded – undo
1440 1610
     				$icao = $value['airport_arrival_icao'];
1441 1611
         			if (isset($alldata[$icao])) {
1442 1612
         				$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1443
-	        		} else $alldata[$icao] = $value;
1613
+	        		} else {
1614
+	        			$alldata[$icao] = $value;
1615
+	        		}
1444 1616
     			}
1445 1617
         		$count = array();
1446 1618
         		foreach ($alldata as $key => $row) {
@@ -1451,7 +1623,9 @@  discard block
 block discarded – undo
1451 1623
 				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 1624
 			}
1453 1625
 			if ($Connection->tableExists('countries')) {
1454
-				if ($globalDebug) echo 'Count all flights by countries...'."\n";
1626
+				if ($globalDebug) {
1627
+					echo 'Count all flights by countries...'."\n";
1628
+				}
1455 1629
 				$SpotterArchive = new SpotterArchive();
1456 1630
 				$alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day);
1457 1631
 				foreach ($alldata as $number) {
@@ -1463,46 +1637,66 @@  discard block
 block discarded – undo
1463 1637
 			// Add by month using getstat if month finish...
1464 1638
 
1465 1639
 			//if (date('m',strtotime($last_update_day)) != date('m')) {
1466
-			if ($globalDebug) echo 'Count all flights by months...'."\n";
1640
+			if ($globalDebug) {
1641
+				echo 'Count all flights by months...'."\n";
1642
+			}
1467 1643
 			$Spotter = new Spotter($this->db);
1468 1644
 			$alldata = $Spotter->countAllMonths();
1469 1645
 			$lastyear = false;
1470 1646
 			foreach ($alldata as $number) {
1471
-				if ($number['year_name'] != date('Y')) $lastyear = true;
1647
+				if ($number['year_name'] != date('Y')) {
1648
+					$lastyear = true;
1649
+				}
1472 1650
 				$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 1651
 			}
1474
-			if ($globalDebug) echo 'Count all military flights by months...'."\n";
1652
+			if ($globalDebug) {
1653
+				echo 'Count all military flights by months...'."\n";
1654
+			}
1475 1655
 			$alldata = $Spotter->countAllMilitaryMonths();
1476 1656
 			foreach ($alldata as $number) {
1477 1657
 				$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 1658
 			}
1479
-			if ($globalDebug) echo 'Count all owners by months...'."\n";
1659
+			if ($globalDebug) {
1660
+				echo 'Count all owners by months...'."\n";
1661
+			}
1480 1662
 			$alldata = $Spotter->countAllMonthsOwners();
1481 1663
 			foreach ($alldata as $number) {
1482 1664
 				$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 1665
 			}
1484
-			if ($globalDebug) echo 'Count all pilots by months...'."\n";
1666
+			if ($globalDebug) {
1667
+				echo 'Count all pilots by months...'."\n";
1668
+			}
1485 1669
 			$alldata = $Spotter->countAllMonthsPilots();
1486 1670
 			foreach ($alldata as $number) {
1487 1671
 				$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 1672
 			}
1489
-			if ($globalDebug) echo 'Count all airlines by months...'."\n";
1673
+			if ($globalDebug) {
1674
+				echo 'Count all airlines by months...'."\n";
1675
+			}
1490 1676
 			$alldata = $Spotter->countAllMonthsAirlines();
1491 1677
 			foreach ($alldata as $number) {
1492 1678
 				$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 1679
 			}
1494
-			if ($globalDebug) echo 'Count all aircrafts by months...'."\n";
1680
+			if ($globalDebug) {
1681
+				echo 'Count all aircrafts by months...'."\n";
1682
+			}
1495 1683
 			$alldata = $Spotter->countAllMonthsAircrafts();
1496 1684
 			foreach ($alldata as $number) {
1497 1685
 				$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 1686
 			}
1499
-			if ($globalDebug) echo 'Count all real arrivals by months...'."\n";
1687
+			if ($globalDebug) {
1688
+				echo 'Count all real arrivals by months...'."\n";
1689
+			}
1500 1690
 			$alldata = $Spotter->countAllMonthsRealArrivals();
1501 1691
 			foreach ($alldata as $number) {
1502 1692
 				$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 1693
 			}
1504
-			if ($globalDebug) echo 'Airports data...'."\n";
1505
-			if ($globalDebug) echo '...Departure'."\n";
1694
+			if ($globalDebug) {
1695
+				echo 'Airports data...'."\n";
1696
+			}
1697
+			if ($globalDebug) {
1698
+				echo '...Departure'."\n";
1699
+			}
1506 1700
 			$this->deleteStatAirport('daily');
1507 1701
 //			$pall = $Spotter->getLast7DaysAirportsDeparture();
1508 1702
   //      		$dall = $Spotter->getLast7DaysDetectedAirportsDeparture();
@@ -1622,37 +1816,53 @@  discard block
 block discarded – undo
1622 1816
 
1623 1817
 			// Count by airlines
1624 1818
 			echo '--- Stats by airlines ---'."\n";
1625
-			if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n";
1819
+			if ($globalDebug) {
1820
+				echo 'Count all aircraft types by airlines...'."\n";
1821
+			}
1626 1822
 			$Spotter = new Spotter($this->db);
1627 1823
 			$alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day);
1628 1824
 			foreach ($alldata as $number) {
1629 1825
 				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao']);
1630 1826
 			}
1631
-			if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n";
1827
+			if ($globalDebug) {
1828
+				echo 'Count all aircraft registrations by airlines...'."\n";
1829
+			}
1632 1830
 			$alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day);
1633 1831
 			foreach ($alldata as $number) {
1634 1832
 				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao']);
1635 1833
 			}
1636
-			if ($globalDebug) echo 'Count all callsigns by airlines...'."\n";
1834
+			if ($globalDebug) {
1835
+				echo 'Count all callsigns by airlines...'."\n";
1836
+			}
1637 1837
 			$alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day);
1638 1838
 			foreach ($alldata as $number) {
1639 1839
 				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']);
1640 1840
 			}
1641
-			if ($globalDebug) echo 'Count all owners by airlines...'."\n";
1841
+			if ($globalDebug) {
1842
+				echo 'Count all owners by airlines...'."\n";
1843
+			}
1642 1844
 			$alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day);
1643 1845
 			foreach ($alldata as $number) {
1644 1846
 				$this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao']);
1645 1847
 			}
1646
-			if ($globalDebug) echo 'Count all pilots by airlines...'."\n";
1848
+			if ($globalDebug) {
1849
+				echo 'Count all pilots by airlines...'."\n";
1850
+			}
1647 1851
 			$alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day);
1648 1852
 			foreach ($alldata as $number) {
1649 1853
 				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao']);
1650 1854
 			}
1651
-			if ($globalDebug) echo 'Count all departure airports by airlines...'."\n";
1855
+			if ($globalDebug) {
1856
+				echo 'Count all departure airports by airlines...'."\n";
1857
+			}
1652 1858
 			$pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day);
1653
-			if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n";
1859
+			if ($globalDebug) {
1860
+				echo 'Count all detected departure airports by airlines...'."\n";
1861
+			}
1654 1862
        			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day);
1655
-			if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n";
1863
+			if ($globalDebug) {
1864
+				echo 'Order detected departure airports by airlines...'."\n";
1865
+			}
1656 1866
 	        	//$alldata = array();
1657 1867
     			foreach ($dall as $value) {
1658 1868
     				$icao = $value['airport_departure_icao'];
@@ -1673,11 +1883,17 @@  discard block
 block discarded – undo
1673 1883
 			foreach ($alldata as $number) {
1674 1884
 				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 1885
 			}
1676
-			if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n";
1886
+			if ($globalDebug) {
1887
+				echo 'Count all arrival airports by airlines...'."\n";
1888
+			}
1677 1889
 			$pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day);
1678
-			if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n";
1890
+			if ($globalDebug) {
1891
+				echo 'Count all detected arrival airports by airlines...'."\n";
1892
+			}
1679 1893
         		$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day);
1680
-			if ($globalDebug) echo 'Order arrival airports by airlines...'."\n";
1894
+			if ($globalDebug) {
1895
+				echo 'Order arrival airports by airlines...'."\n";
1896
+			}
1681 1897
 	        	//$alldata = array();
1682 1898
     			foreach ($dall as $value) {
1683 1899
     				$icao = $value['airport_arrival_icao'];
@@ -1698,35 +1914,49 @@  discard block
 block discarded – undo
1698 1914
                         foreach ($alldata as $number) {
1699 1915
 				echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao']);
1700 1916
 			}
1701
-			if ($globalDebug) echo 'Count all flights by months by airlines...'."\n";
1917
+			if ($globalDebug) {
1918
+				echo 'Count all flights by months by airlines...'."\n";
1919
+			}
1702 1920
 			$Spotter = new Spotter($this->db);
1703 1921
 			$alldata = $Spotter->countAllMonthsByAirlines();
1704 1922
 			$lastyear = false;
1705 1923
 			foreach ($alldata as $number) {
1706
-				if ($number['year_name'] != date('Y')) $lastyear = true;
1924
+				if ($number['year_name'] != date('Y')) {
1925
+					$lastyear = true;
1926
+				}
1707 1927
 				$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 1928
 			}
1709
-			if ($globalDebug) echo 'Count all owners by months by airlines...'."\n";
1929
+			if ($globalDebug) {
1930
+				echo 'Count all owners by months by airlines...'."\n";
1931
+			}
1710 1932
 			$alldata = $Spotter->countAllMonthsOwnersByAirlines();
1711 1933
 			foreach ($alldata as $number) {
1712 1934
 				$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 1935
 			}
1714
-			if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n";
1936
+			if ($globalDebug) {
1937
+				echo 'Count all pilots by months by airlines...'."\n";
1938
+			}
1715 1939
 			$alldata = $Spotter->countAllMonthsPilotsByAirlines();
1716 1940
 			foreach ($alldata as $number) {
1717 1941
 				$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 1942
 			}
1719
-			if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n";
1943
+			if ($globalDebug) {
1944
+				echo 'Count all aircrafts by months by airlines...'."\n";
1945
+			}
1720 1946
 			$alldata = $Spotter->countAllMonthsAircraftsByAirlines();
1721 1947
 			foreach ($alldata as $number) {
1722 1948
 				$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 1949
 			}
1724
-			if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n";
1950
+			if ($globalDebug) {
1951
+				echo 'Count all real arrivals by months by airlines...'."\n";
1952
+			}
1725 1953
 			$alldata = $Spotter->countAllMonthsRealArrivalsByAirlines();
1726 1954
 			foreach ($alldata as $number) {
1727 1955
 				$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 1956
 			}
1729
-			if ($globalDebug) echo '...Departure'."\n";
1957
+			if ($globalDebug) {
1958
+				echo '...Departure'."\n";
1959
+			}
1730 1960
 			$pall = $Spotter->getLast7DaysAirportsDepartureByAirlines();
1731 1961
         		$dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines();
1732 1962
     			foreach ($dall as $value) {
@@ -1749,7 +1979,9 @@  discard block
 block discarded – undo
1749 1979
 			foreach ($alldata as $number) {
1750 1980
 				$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 1981
 			}
1752
-			if ($globalDebug) echo '...Arrival'."\n";
1982
+			if ($globalDebug) {
1983
+				echo '...Arrival'."\n";
1984
+			}
1753 1985
 			$pall = $Spotter->getLast7DaysAirportsArrivalByAirlines();
1754 1986
         		$dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines();
1755 1987
     			foreach ($dall as $value) {
@@ -1773,13 +2005,19 @@  discard block
 block discarded – undo
1773 2005
 				$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 2006
 			}
1775 2007
 
1776
-			if ($globalDebug) echo 'Flights data...'."\n";
1777
-			if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n";
2008
+			if ($globalDebug) {
2009
+				echo 'Flights data...'."\n";
2010
+			}
2011
+			if ($globalDebug) {
2012
+				echo '-> countAllDatesLastMonth...'."\n";
2013
+			}
1778 2014
 			$alldata = $Spotter->countAllDatesLastMonthByAirlines();
1779 2015
 			foreach ($alldata as $number) {
1780 2016
 				$this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']);
1781 2017
 			}
1782
-			if ($globalDebug) echo '-> countAllDates...'."\n";
2018
+			if ($globalDebug) {
2019
+				echo '-> countAllDates...'."\n";
2020
+			}
1783 2021
 			//$previousdata = $this->countAllDatesByAirlines();
1784 2022
 			$alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines());
1785 2023
 			$values = array();
@@ -1792,19 +2030,25 @@  discard block
 block discarded – undo
1792 2030
 				$this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']);
1793 2031
 			}
1794 2032
 			
1795
-			if ($globalDebug) echo '-> countAllHours...'."\n";
2033
+			if ($globalDebug) {
2034
+				echo '-> countAllHours...'."\n";
2035
+			}
1796 2036
 			$alldata = $Spotter->countAllHoursByAirlines('hour');
1797 2037
 			foreach ($alldata as $number) {
1798 2038
 				$this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']);
1799 2039
 			}
1800 2040
 			
1801 2041
 
1802
-			if (!isset($globalStatsFilters) || $globalStatsFilters == '') $globalStatsFilters = array();
2042
+			if (!isset($globalStatsFilters) || $globalStatsFilters == '') {
2043
+				$globalStatsFilters = array();
2044
+			}
1803 2045
 			foreach ($globalStatsFilters as $name => $filter) {
1804 2046
 				//$filter_name = $filter['name'];
1805 2047
 				$filter_name = $name;
1806 2048
 				// Count by filter
1807
-				if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n";
2049
+				if ($globalDebug) {
2050
+					echo '--- Stats for filter '.$filter_name.' ---'."\n";
2051
+				}
1808 2052
 				$Spotter = new Spotter($this->db);
1809 2053
 				$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter);
1810 2054
 				foreach ($alldata as $number) {
@@ -1842,7 +2086,9 @@  discard block
 block discarded – undo
1842 2086
 	    				$icao = $value['airport_departure_icao'];
1843 2087
         				if (isset($alldata[$icao])) {
1844 2088
     						$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1845
-        				} else $alldata[$icao] = $value;
2089
+        				} else {
2090
+        					$alldata[$icao] = $value;
2091
+        				}
1846 2092
 				}
1847 2093
 	    			$count = array();
1848 2094
     				foreach ($alldata as $key => $row) {
@@ -1863,7 +2109,9 @@  discard block
 block discarded – undo
1863 2109
 	    				$icao = $value['airport_arrival_icao'];
1864 2110
         				if (isset($alldata[$icao])) {
1865 2111
         					$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1866
-		        		} else $alldata[$icao] = $value;
2112
+		        		} else {
2113
+		        			$alldata[$icao] = $value;
2114
+		        		}
1867 2115
 	    			}
1868 2116
         			$count = array();
1869 2117
         			foreach ($alldata as $key => $row) {
@@ -1877,7 +2125,9 @@  discard block
 block discarded – undo
1877 2125
 				$alldata = $Spotter->countAllMonths($filter);
1878 2126
 				$lastyear = false;
1879 2127
 				foreach ($alldata as $number) {
1880
-					if ($number['year_name'] != date('Y')) $lastyear = true;
2128
+					if ($number['year_name'] != date('Y')) {
2129
+						$lastyear = true;
2130
+					}
1881 2131
 					$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 2132
 				}
1883 2133
 				$alldata = $Spotter->countAllMonthsOwners($filter);
Please login to merge, or discard this patch.
Indentation   +825 added lines, -825 removed lines patch added patch discarded remove patch
@@ -15,79 +15,79 @@  discard block
 block discarded – undo
15 15
 		if (isset($globalFilterName)) $this->filter_name = $globalFilterName;
16 16
 		$Connection = new Connection($dbc);
17 17
 		$this->db = $Connection->db();
18
-        }
18
+		}
19 19
               
20 20
 	public function addLastStatsUpdate($type,$stats_date) {
21
-                $query = "DELETE FROM config WHERE name = :type;
21
+				$query = "DELETE FROM config WHERE name = :type;
22 22
             		INSERT INTO config (name,value) VALUES (:type,:stats_date);";
23
-                $query_values = array('type' => $type,':stats_date' => $stats_date);
24
-                 try {
25
-                        $sth = $this->db->prepare($query);
26
-                        $sth->execute($query_values);
27
-                } catch(PDOException $e) {
28
-                        return "error : ".$e->getMessage();
29
-                }
30
-        }
23
+				$query_values = array('type' => $type,':stats_date' => $stats_date);
24
+				 try {
25
+						$sth = $this->db->prepare($query);
26
+						$sth->execute($query_values);
27
+				} catch(PDOException $e) {
28
+						return "error : ".$e->getMessage();
29
+				}
30
+		}
31 31
 
32 32
 	public function getLastStatsUpdate($type = 'last_update_stats') {
33
-                $query = "SELECT value FROM config WHERE name = :type";
34
-                 try {
35
-                        $sth = $this->db->prepare($query);
36
-                        $sth->execute(array(':type' => $type));
37
-                } catch(PDOException $e) {
38
-                        echo "error : ".$e->getMessage();
39
-                }
40
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
41
-                return $all;
42
-        }
33
+				$query = "SELECT value FROM config WHERE name = :type";
34
+				 try {
35
+						$sth = $this->db->prepare($query);
36
+						$sth->execute(array(':type' => $type));
37
+				} catch(PDOException $e) {
38
+						echo "error : ".$e->getMessage();
39
+				}
40
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
41
+				return $all;
42
+		}
43 43
 	public function getAllAirlineNames($filter_name = '') {
44 44
 		if ($filter_name == '') $filter_name = $this->filter_name;
45
-                $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC";
46
-                 try {
47
-                        $sth = $this->db->prepare($query);
48
-                        $sth->execute(array(':filter_name' => $filter_name));
49
-                } catch(PDOException $e) {
50
-                        echo "error : ".$e->getMessage();
51
-                }
52
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
53
-                return $all;
54
-        }
45
+				$query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC";
46
+				 try {
47
+						$sth = $this->db->prepare($query);
48
+						$sth->execute(array(':filter_name' => $filter_name));
49
+				} catch(PDOException $e) {
50
+						echo "error : ".$e->getMessage();
51
+				}
52
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
53
+				return $all;
54
+		}
55 55
 	public function getAllAircraftTypes($stats_airline = '',$filter_name = '') {
56 56
 		if ($filter_name == '') $filter_name = $this->filter_name;
57
-                $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
58
-                 try {
59
-                        $sth = $this->db->prepare($query);
60
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
61
-                } catch(PDOException $e) {
62
-                        echo "error : ".$e->getMessage();
63
-                }
64
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
65
-                return $all;
66
-        }
57
+				$query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
58
+				 try {
59
+						$sth = $this->db->prepare($query);
60
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
61
+				} catch(PDOException $e) {
62
+						echo "error : ".$e->getMessage();
63
+				}
64
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
65
+				return $all;
66
+		}
67 67
 	public function getAllManufacturers($stats_airline = '',$filter_name = '') {
68 68
 		if ($filter_name == '') $filter_name = $this->filter_name;
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
-                 try {
71
-                        $sth = $this->db->prepare($query);
72
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
73
-                } catch(PDOException $e) {
74
-                        echo "error : ".$e->getMessage();
75
-                }
76
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
77
-                return $all;
78
-        }
69
+				$query = "SELECT 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
+				 try {
71
+						$sth = $this->db->prepare($query);
72
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
73
+				} catch(PDOException $e) {
74
+						echo "error : ".$e->getMessage();
75
+				}
76
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
77
+				return $all;
78
+		}
79 79
 	public function getAllAirportNames($stats_airline = '',$filter_name = '') {
80 80
 		if ($filter_name == '') $filter_name = $this->filter_name;
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
-                 try {
83
-                        $sth = $this->db->prepare($query);
84
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
85
-                } catch(PDOException $e) {
86
-                        echo "error : ".$e->getMessage();
87
-                }
88
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
89
-                return $all;
90
-        }
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
+				 try {
83
+						$sth = $this->db->prepare($query);
84
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
85
+				} catch(PDOException $e) {
86
+						echo "error : ".$e->getMessage();
87
+				}
88
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
89
+				return $all;
90
+		}
91 91
 
92 92
 
93 93
 	public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '') {
@@ -95,66 +95,66 @@  discard block
 block discarded – undo
95 95
 		if ($filter_name == '') $filter_name = $this->filter_name;
96 96
 		if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0";
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
-                 try {
99
-                        $sth = $this->db->prepare($query);
100
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
101
-                } catch(PDOException $e) {
102
-                        echo "error : ".$e->getMessage();
103
-                }
104
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
105
-                if (empty($all)) {
106
-            	    $filters = array('airlines' => array($stats_airline));
107
-            	    if ($filter_name != '') {
108
-            		    $filters = array_merge($filters,$globalStatsFilters[$filter_name]);
109
-            	    }
110
-            	    $Spotter = new Spotter($this->db);
111
-            	    $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters);
112
-                }
113
-                return $all;
98
+				 try {
99
+						$sth = $this->db->prepare($query);
100
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
101
+				} catch(PDOException $e) {
102
+						echo "error : ".$e->getMessage();
103
+				}
104
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
105
+				if (empty($all)) {
106
+					$filters = array('airlines' => array($stats_airline));
107
+					if ($filter_name != '') {
108
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
109
+					}
110
+					$Spotter = new Spotter($this->db);
111
+					$all = $Spotter->countAllAircraftTypes($limit,0,'',$filters);
112
+				}
113
+				return $all;
114 114
 	}
115 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";
119 119
 		else $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC";
120
-                 try {
121
-                        $sth = $this->db->prepare($query);
122
-                        $sth->execute(array(':filter_name' => $filter_name));
123
-                } catch(PDOException $e) {
124
-                        echo "error : ".$e->getMessage();
125
-                }
126
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
127
-                if (empty($all)) {
128
-            		$Spotter = new Spotter($this->db);
129
-            		$filters = array();
130
-            		if ($filter_name != '') {
131
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
132
-			}
133
-            		$all = $Spotter->countAllAirlineCountries($limit,$filters);
134
-                }
135
-                return $all;
120
+				 try {
121
+						$sth = $this->db->prepare($query);
122
+						$sth->execute(array(':filter_name' => $filter_name));
123
+				} catch(PDOException $e) {
124
+						echo "error : ".$e->getMessage();
125
+				}
126
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
127
+				if (empty($all)) {
128
+					$Spotter = new Spotter($this->db);
129
+					$filters = array();
130
+					if ($filter_name != '') {
131
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
132
+			}
133
+					$all = $Spotter->countAllAirlineCountries($limit,$filters);
134
+				}
135
+				return $all;
136 136
 	}
137 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
-                 try {
143
-                        $sth = $this->db->prepare($query);
144
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
145
-                } catch(PDOException $e) {
146
-                        echo "error : ".$e->getMessage();
147
-                }
148
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
149
-                if (empty($all)) {
150
-            		$filters = array('airlines' => array($stats_airline));
151
-            		if ($filter_name != '') {
152
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
142
+				 try {
143
+						$sth = $this->db->prepare($query);
144
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
145
+				} catch(PDOException $e) {
146
+						echo "error : ".$e->getMessage();
147
+				}
148
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
149
+				if (empty($all)) {
150
+					$filters = array('airlines' => array($stats_airline));
151
+					if ($filter_name != '') {
152
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
153 153
 			}
154
-            		$Spotter = new Spotter($this->db);
154
+					$Spotter = new Spotter($this->db);
155 155
 			$all = $Spotter->countAllAircraftManufacturers($filters);
156
-                }
157
-                return $all;
156
+				}
157
+				return $all;
158 158
 	}
159 159
 
160 160
 	public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '') {
@@ -162,44 +162,44 @@  discard block
 block discarded – undo
162 162
 		if ($filter_name == '') $filter_name = $this->filter_name;
163 163
 		if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0";
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
-                 try {
166
-                        $sth = $this->db->prepare($query);
167
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
168
-                } catch(PDOException $e) {
169
-                        echo "error : ".$e->getMessage();
170
-                }
171
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
172
-                if (empty($all)) {
165
+				 try {
166
+						$sth = $this->db->prepare($query);
167
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
168
+				} catch(PDOException $e) {
169
+						echo "error : ".$e->getMessage();
170
+				}
171
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
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 178
 			$all = $Spotter->countAllArrivalCountries($limit,$filters);
179
-                }
180
-                return $all;
179
+				}
180
+				return $all;
181 181
 	}
182 182
 	public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '') {
183 183
 		global $globalStatsFilters;
184 184
 		if ($filter_name == '') $filter_name = $this->filter_name;
185 185
 		if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
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
-                 try {
188
-                        $sth = $this->db->prepare($query);
189
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
190
-                } catch(PDOException $e) {
191
-                        echo "error : ".$e->getMessage();
192
-                }
193
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
194
-                if (empty($all)) {
187
+				 try {
188
+						$sth = $this->db->prepare($query);
189
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
190
+				} catch(PDOException $e) {
191
+						echo "error : ".$e->getMessage();
192
+				}
193
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
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);
201
-                }
202
-                return $all;
201
+				}
202
+				return $all;
203 203
 	}
204 204
 
205 205
 	public function countAllAirlines($limit = true,$filter_name = '') {
@@ -207,45 +207,45 @@  discard block
 block discarded – undo
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";
209 209
 		else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC";
210
-                 try {
211
-                        $sth = $this->db->prepare($query);
212
-                        $sth->execute(array(':filter_name' => $filter_name));
213
-                } catch(PDOException $e) {
214
-                        echo "error : ".$e->getMessage();
215
-                }
216
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
217
-                if (empty($all)) {
218
-	                $Spotter = new Spotter($this->db);
219
-            		$filters = array();
220
-            		if ($filter_name != '') {
221
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
210
+				 try {
211
+						$sth = $this->db->prepare($query);
212
+						$sth->execute(array(':filter_name' => $filter_name));
213
+				} catch(PDOException $e) {
214
+						echo "error : ".$e->getMessage();
215
+				}
216
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
217
+				if (empty($all)) {
218
+					$Spotter = new Spotter($this->db);
219
+					$filters = array();
220
+					if ($filter_name != '') {
221
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
222 222
 			}
223 223
 
224
-    		        $all = $Spotter->countAllAirlines($limit,0,'',$filters);
225
-                }
226
-                return $all;
224
+					$all = $Spotter->countAllAirlines($limit,0,'',$filters);
225
+				}
226
+				return $all;
227 227
 	}
228 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
-                 try {
234
-                        $sth = $this->db->prepare($query);
235
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
236
-                } catch(PDOException $e) {
237
-                        echo "error : ".$e->getMessage();
238
-                }
239
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
240
-                if (empty($all)) {
233
+				 try {
234
+						$sth = $this->db->prepare($query);
235
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
236
+				} catch(PDOException $e) {
237
+						echo "error : ".$e->getMessage();
238
+				}
239
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
240
+				if (empty($all)) {
241 241
 			$filters = array('airlines' => array($stats_airline));
242 242
 			if ($filter_name != '') {
243 243
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
244 244
 			}
245
-	                $Spotter = new Spotter($this->db);
246
-    		        $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters);
247
-                }
248
-                return $all;
245
+					$Spotter = new Spotter($this->db);
246
+					$all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters);
247
+				}
248
+				return $all;
249 249
 	}
250 250
 	public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '') {
251 251
 		global $globalStatsFilters;
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 				echo "error : ".$e->getMessage();
283 283
 			}
284 284
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
285
-                /*
285
+				/*
286 286
                 if (empty($all)) {
287 287
 	                $Spotter = new Spotter($this->db);
288 288
     		        $all = $Spotter->countAllFlightOverCountries($limit);
@@ -298,84 +298,84 @@  discard block
 block discarded – undo
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
-                 try {
302
-                        $sth = $this->db->prepare($query);
303
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
304
-                } catch(PDOException $e) {
305
-                        echo "error : ".$e->getMessage();
306
-                }
307
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
308
-                if (empty($all)) {
301
+				 try {
302
+						$sth = $this->db->prepare($query);
303
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
304
+				} catch(PDOException $e) {
305
+						echo "error : ".$e->getMessage();
306
+				}
307
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
308
+				if (empty($all)) {
309 309
 			$filters = array('airlines' => array($stats_airline));
310 310
 			if ($filter_name != '') {
311 311
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
312 312
 			}
313
-            		$Spotter = new Spotter($this->db);
314
-            		$all = $Spotter->countAllPilots($limit,0,'',$filters);
315
-                }
316
-                return $all;
313
+					$Spotter = new Spotter($this->db);
314
+					$all = $Spotter->countAllPilots($limit,0,'',$filters);
315
+				}
316
+				return $all;
317 317
 	}
318 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
-                 try {
324
-                        $sth = $this->db->prepare($query);
325
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
326
-                } catch(PDOException $e) {
327
-                        echo "error : ".$e->getMessage();
328
-                }
329
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
330
-                if (empty($all)) {
323
+				 try {
324
+						$sth = $this->db->prepare($query);
325
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
326
+				} catch(PDOException $e) {
327
+						echo "error : ".$e->getMessage();
328
+				}
329
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
330
+				if (empty($all)) {
331 331
 			$filters = array('airlines' => array($stats_airline));
332 332
 			if ($filter_name != '') {
333 333
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
334 334
 			}
335
-            		$Spotter = new Spotter($this->db);
336
-            		$all = $Spotter->countAllOwners($limit,0,'',$filters);
337
-                }
338
-                return $all;
335
+					$Spotter = new Spotter($this->db);
336
+					$all = $Spotter->countAllOwners($limit,0,'',$filters);
337
+				}
338
+				return $all;
339 339
 	}
340 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
-                 try {
346
-                        $sth = $this->db->prepare($query);
347
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
348
-                } catch(PDOException $e) {
349
-                        echo "error : ".$e->getMessage();
350
-                }
351
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
352
-                if (empty($all)) {
345
+				 try {
346
+						$sth = $this->db->prepare($query);
347
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
348
+				} catch(PDOException $e) {
349
+						echo "error : ".$e->getMessage();
350
+				}
351
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
352
+				if (empty($all)) {
353 353
 			$filters = array('airlines' => array($stats_airline));
354
-            		if ($filter_name != '') {
355
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
356
-			}
357
-            		$Spotter = new Spotter($this->db);
358
-            		$pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters);
359
-        		$dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters);
360
-        		$all = array();
361
-        		foreach ($pall as $value) {
362
-        			$icao = $value['airport_departure_icao'];
363
-        			$all[$icao] = $value;
364
-        		}
354
+					if ($filter_name != '') {
355
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
356
+			}
357
+					$Spotter = new Spotter($this->db);
358
+					$pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters);
359
+				$dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters);
360
+				$all = array();
361
+				foreach ($pall as $value) {
362
+					$icao = $value['airport_departure_icao'];
363
+					$all[$icao] = $value;
364
+				}
365 365
         		
366
-        		foreach ($dall as $value) {
367
-        			$icao = $value['airport_departure_icao'];
368
-        			if (isset($all[$icao])) {
369
-        				$all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
370
-        			} else $all[$icao] = $value;
371
-        		}
372
-        		$count = array();
373
-        		foreach ($all as $key => $row) {
374
-        			$count[$key] = $row['airport_departure_icao_count'];
375
-        		}
376
-        		array_multisort($count,SORT_DESC,$all);
377
-                }
378
-                return $all;
366
+				foreach ($dall as $value) {
367
+					$icao = $value['airport_departure_icao'];
368
+					if (isset($all[$icao])) {
369
+						$all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
370
+					} else $all[$icao] = $value;
371
+				}
372
+				$count = array();
373
+				foreach ($all as $key => $row) {
374
+					$count[$key] = $row['airport_departure_icao_count'];
375
+				}
376
+				array_multisort($count,SORT_DESC,$all);
377
+				}
378
+				return $all;
379 379
 	}
380 380
 	public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '') {
381 381
 		global $globalStatsFilters;
@@ -397,26 +397,26 @@  discard block
 block discarded – undo
397 397
 			$Spotter = new Spotter($this->db);
398 398
 			$pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters);
399 399
 			$dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters);
400
-        		$all = array();
401
-        		foreach ($pall as $value) {
402
-        			$icao = $value['airport_arrival_icao'];
403
-        			$all[$icao] = $value;
404
-        		}
400
+				$all = array();
401
+				foreach ($pall as $value) {
402
+					$icao = $value['airport_arrival_icao'];
403
+					$all[$icao] = $value;
404
+				}
405 405
         		
406
-        		foreach ($dall as $value) {
407
-        			$icao = $value['airport_arrival_icao'];
408
-        			if (isset($all[$icao])) {
409
-        				$all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
410
-        			} else $all[$icao] = $value;
411
-        		}
412
-        		$count = array();
413
-        		foreach ($all as $key => $row) {
414
-        			$count[$key] = $row['airport_arrival_icao_count'];
415
-        		}
416
-        		array_multisort($count,SORT_DESC,$all);
417
-                }
406
+				foreach ($dall as $value) {
407
+					$icao = $value['airport_arrival_icao'];
408
+					if (isset($all[$icao])) {
409
+						$all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
410
+					} else $all[$icao] = $value;
411
+				}
412
+				$count = array();
413
+				foreach ($all as $key => $row) {
414
+					$count[$key] = $row['airport_arrival_icao_count'];
415
+				}
416
+				array_multisort($count,SORT_DESC,$all);
417
+				}
418 418
  
419
-                return $all;
419
+				return $all;
420 420
 	}
421 421
 	public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') {
422 422
 		global $globalDBdriver, $globalStatsFilters;
@@ -429,23 +429,23 @@  discard block
 block discarded – undo
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 431
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
432
-                 try {
433
-                        $sth = $this->db->prepare($query);
434
-                        $sth->execute($query_data);
435
-                } catch(PDOException $e) {
436
-                        echo "error : ".$e->getMessage();
437
-                }
438
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
439
-                if (empty($all)) {
432
+				 try {
433
+						$sth = $this->db->prepare($query);
434
+						$sth->execute($query_data);
435
+				} catch(PDOException $e) {
436
+						echo "error : ".$e->getMessage();
437
+				}
438
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
439
+				if (empty($all)) {
440 440
 			$filters = array('airlines' => array($stats_airline));
441 441
 			if ($filter_name != '') {
442 442
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
443 443
 			}
444
-            		$Spotter = new Spotter($this->db);
445
-            		$all = $Spotter->countAllMonthsLastYear($filters);
446
-                }
444
+					$Spotter = new Spotter($this->db);
445
+					$all = $Spotter->countAllMonthsLastYear($filters);
446
+				}
447 447
                 
448
-                return $all;
448
+				return $all;
449 449
 	}
450 450
 	
451 451
 	public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') {
@@ -453,22 +453,22 @@  discard block
 block discarded – undo
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 455
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
456
-                 try {
457
-                        $sth = $this->db->prepare($query);
458
-                        $sth->execute($query_data);
459
-                } catch(PDOException $e) {
460
-                        echo "error : ".$e->getMessage();
461
-                }
462
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
463
-                if (empty($all)) {
456
+				 try {
457
+						$sth = $this->db->prepare($query);
458
+						$sth->execute($query_data);
459
+				} catch(PDOException $e) {
460
+						echo "error : ".$e->getMessage();
461
+				}
462
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
463
+				if (empty($all)) {
464 464
 			$filters = array('airlines' => array($stats_airline));
465 465
 			if ($filter_name != '') {
466 466
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
467 467
 			}
468
-            		$Spotter = new Spotter($this->db);
469
-            		$all = $Spotter->countAllDatesLastMonth($filters);
470
-                }
471
-                return $all;
468
+					$Spotter = new Spotter($this->db);
469
+					$all = $Spotter->countAllDatesLastMonth($filters);
470
+				}
471
+				return $all;
472 472
 	}
473 473
 	public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') {
474 474
 		global $globalDBdriver, $globalStatsFilters;
@@ -479,108 +479,108 @@  discard block
 block discarded – undo
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 481
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
482
-                 try {
483
-                        $sth = $this->db->prepare($query);
484
-                        $sth->execute($query_data);
485
-                } catch(PDOException $e) {
486
-                        echo "error : ".$e->getMessage();
487
-                }
488
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
489
-                if (empty($all)) {
482
+				 try {
483
+						$sth = $this->db->prepare($query);
484
+						$sth->execute($query_data);
485
+				} catch(PDOException $e) {
486
+						echo "error : ".$e->getMessage();
487
+				}
488
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
489
+				if (empty($all)) {
490 490
 			$filters = array('airlines' => array($stats_airline));
491 491
 			if ($filter_name != '') {
492 492
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
493 493
 			}
494
-            		$Spotter = new Spotter($this->db);
495
-            		$all = $Spotter->countAllDatesLast7Days($filters);
496
-                }
497
-                return $all;
494
+					$Spotter = new Spotter($this->db);
495
+					$all = $Spotter->countAllDatesLast7Days($filters);
496
+				}
497
+				return $all;
498 498
 	}
499 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 503
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
504
-                 try {
505
-                        $sth = $this->db->prepare($query);
506
-                        $sth->execute($query_data);
507
-                } catch(PDOException $e) {
508
-                        echo "error : ".$e->getMessage();
509
-                }
510
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
511
-                if (empty($all)) {
504
+				 try {
505
+						$sth = $this->db->prepare($query);
506
+						$sth->execute($query_data);
507
+				} catch(PDOException $e) {
508
+						echo "error : ".$e->getMessage();
509
+				}
510
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
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
-            		$Spotter = new Spotter($this->db);
517
-            		$all = $Spotter->countAllDates($filters);
518
-                }
519
-                return $all;
516
+					$Spotter = new Spotter($this->db);
517
+					$all = $Spotter->countAllDates($filters);
518
+				}
519
+				return $all;
520 520
 	}
521 521
 	public function countAllDatesByAirlines($filter_name = '') {
522 522
 		global $globalStatsFilters;
523 523
 		if ($filter_name == '') $filter_name = $this->filter_name;
524 524
 		$query = "SELECT stats_airline as airline_icao, flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND filter_name = :filter_name";
525 525
 		$query_data = array('filter_name' => $filter_name);
526
-                 try {
527
-                        $sth = $this->db->prepare($query);
528
-                        $sth->execute($query_data);
529
-                } catch(PDOException $e) {
530
-                        echo "error : ".$e->getMessage();
531
-                }
532
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
533
-                if (empty($all)) {
534
-            		$filters = array();
535
-            		if ($filter_name != '') {
536
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
537
-			}
538
-            		$Spotter = new Spotter($this->db);
539
-            		$all = $Spotter->countAllDatesByAirlines($filters);
540
-                }
541
-                return $all;
526
+				 try {
527
+						$sth = $this->db->prepare($query);
528
+						$sth->execute($query_data);
529
+				} catch(PDOException $e) {
530
+						echo "error : ".$e->getMessage();
531
+				}
532
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
533
+				if (empty($all)) {
534
+					$filters = array();
535
+					if ($filter_name != '') {
536
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
537
+			}
538
+					$Spotter = new Spotter($this->db);
539
+					$all = $Spotter->countAllDatesByAirlines($filters);
540
+				}
541
+				return $all;
542 542
 	}
543 543
 	public function countAllMonths($stats_airline = '',$filter_name = '') {
544 544
 		global $globalStatsFilters;
545 545
 		if ($filter_name == '') $filter_name = $this->filter_name;
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
-                 try {
548
-                        $sth = $this->db->prepare($query);
549
-                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
550
-                } catch(PDOException $e) {
551
-                        echo "error : ".$e->getMessage();
552
-                }
553
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
554
-                if (empty($all)) {
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
+				 try {
548
+						$sth = $this->db->prepare($query);
549
+						$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
550
+				} catch(PDOException $e) {
551
+						echo "error : ".$e->getMessage();
552
+				}
553
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
554
+				if (empty($all)) {
555 555
 			$filters = array('airlines' => array($stats_airline));
556 556
 			if ($filter_name != '') {
557 557
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
558 558
 			}
559
-            		$Spotter = new Spotter($this->db);
560
-            		$all = $Spotter->countAllMonths($filters);
561
-                }
562
-                return $all;
559
+					$Spotter = new Spotter($this->db);
560
+					$all = $Spotter->countAllMonths($filters);
561
+				}
562
+				return $all;
563 563
 	}
564 564
 	public function countAllMilitaryMonths($filter_name = '') {
565 565
 		global $globalStatsFilters;
566 566
 		if ($filter_name == '') $filter_name = $this->filter_name;
567
-	    	$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name";
568
-                 try {
569
-                        $sth = $this->db->prepare($query);
570
-                        $sth->execute(array(':filter_name' => $filter_name));
571
-                } catch(PDOException $e) {
572
-                        echo "error : ".$e->getMessage();
573
-                }
574
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
575
-                if (empty($all)) {
576
-            		$filters = array();
577
-            		if ($filter_name != '') {
578
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
579
-			}
580
-            		$Spotter = new Spotter($this->db);
581
-            		$all = $Spotter->countAllMilitaryMonths($filters);
582
-                }
583
-                return $all;
567
+			$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name";
568
+				 try {
569
+						$sth = $this->db->prepare($query);
570
+						$sth->execute(array(':filter_name' => $filter_name));
571
+				} catch(PDOException $e) {
572
+						echo "error : ".$e->getMessage();
573
+				}
574
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
575
+				if (empty($all)) {
576
+					$filters = array();
577
+					if ($filter_name != '') {
578
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
579
+			}
580
+					$Spotter = new Spotter($this->db);
581
+					$all = $Spotter->countAllMilitaryMonths($filters);
582
+				}
583
+				return $all;
584 584
 	}
585 585
 	public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') {
586 586
 		global $globalTimezone, $globalDBdriver, $globalStatsFilters;
@@ -596,22 +596,22 @@  discard block
 block discarded – undo
596 596
 			$query .= " ORDER BY CAST(flight_date AS integer) ASC";
597 597
 		}
598 598
 		if ($orderby == 'count') $query .= " ORDER BY hour_count DESC";
599
-                 try {
600
-                        $sth = $this->db->prepare($query);
601
-                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
602
-                } catch(PDOException $e) {
603
-                        echo "error : ".$e->getMessage();
604
-                }
605
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
606
-                if (empty($all)) {
599
+				 try {
600
+						$sth = $this->db->prepare($query);
601
+						$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
602
+				} catch(PDOException $e) {
603
+						echo "error : ".$e->getMessage();
604
+				}
605
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
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
-            		$Spotter = new Spotter($this->db);
612
-            		$all = $Spotter->countAllHours($orderby,$filters);
613
-                }
614
-                return $all;
611
+					$Spotter = new Spotter($this->db);
612
+					$all = $Spotter->countAllHours($orderby,$filters);
613
+				}
614
+				return $all;
615 615
 	}
616 616
 	
617 617
 	public function countOverallFlights($stats_airline = '', $filter_name = '') {
@@ -633,9 +633,9 @@  discard block
 block discarded – undo
633 633
 		if ($filter_name == '') $filter_name = $this->filter_name;
634 634
 		$all = $this->getSumStats('military_flights_bymonth',date('Y'),'',$filter_name);
635 635
 		if (empty($all)) {
636
-		        $filters = array();
637
-            		if ($filter_name != '') {
638
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
636
+				$filters = array();
637
+					if ($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);
@@ -674,19 +674,19 @@  discard block
 block discarded – undo
674 674
 		global $globalStatsFilters;
675 675
 		if ($filter_name == '') $filter_name = $this->filter_name;
676 676
 		$query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name";
677
-                 try {
678
-                        $sth = $this->db->prepare($query);
679
-                        $sth->execute(array(':filter_name' => $filter_name));
680
-                } catch(PDOException $e) {
681
-                        echo "error : ".$e->getMessage();
682
-                }
683
-                $result = $sth->fetchAll(PDO::FETCH_ASSOC);
684
-                $all = $result[0]['nb_airline'];
677
+				 try {
678
+						$sth = $this->db->prepare($query);
679
+						$sth->execute(array(':filter_name' => $filter_name));
680
+				} catch(PDOException $e) {
681
+						echo "error : ".$e->getMessage();
682
+				}
683
+				$result = $sth->fetchAll(PDO::FETCH_ASSOC);
684
+				$all = $result[0]['nb_airline'];
685 685
 		//$all = $this->getSumStats('airlines_bymonth',date('Y'));
686 686
 		if (empty($all)) {
687
-            		$filters = array();
688
-            		if ($filter_name != '') {
689
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
687
+					$filters = array();
688
+					if ($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);
@@ -737,166 +737,166 @@  discard block
 block discarded – undo
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 739
 		$query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
740
-                 try {
741
-                        $sth = $this->db->prepare($query);
742
-                        $sth->execute($query_values);
743
-                } catch(PDOException $e) {
744
-                        echo "error : ".$e->getMessage();
745
-                }
746
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
747
-                return $all;
740
+				 try {
741
+						$sth = $this->db->prepare($query);
742
+						$sth->execute($query_values);
743
+				} catch(PDOException $e) {
744
+						echo "error : ".$e->getMessage();
745
+				}
746
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
747
+				return $all;
748 748
 	}
749 749
 	public function getStats($type,$stats_airline = '', $filter_name = '') {
750 750
 		if ($filter_name == '') $filter_name = $this->filter_name;
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);
753
-                 try {
754
-                        $sth = $this->db->prepare($query);
755
-                        $sth->execute($query_values);
756
-                } catch(PDOException $e) {
757
-                        echo "error : ".$e->getMessage();
758
-                }
759
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
760
-                return $all;
761
-        }
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);
753
+				 try {
754
+						$sth = $this->db->prepare($query);
755
+						$sth->execute($query_values);
756
+				} catch(PDOException $e) {
757
+						echo "error : ".$e->getMessage();
758
+				}
759
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
760
+				return $all;
761
+		}
762 762
 	public function getSumStats($type,$year,$stats_airline = '',$filter_name = '') {
763 763
 		if ($filter_name == '') $filter_name = $this->filter_name;
764
-    		global $globalArchiveMonths, $globalDBdriver;
765
-    		if ($globalDBdriver == 'mysql') {
766
-	                $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name";
767
-	        } else {
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
-                }
770
-                $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
771
-                 try {
772
-                        $sth = $this->db->prepare($query);
773
-                        $sth->execute($query_values);
774
-                } catch(PDOException $e) {
775
-                        echo "error : ".$e->getMessage();
776
-                }
777
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
778
-                return $all[0]['total'];
779
-        }
764
+			global $globalArchiveMonths, $globalDBdriver;
765
+			if ($globalDBdriver == 'mysql') {
766
+					$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name";
767
+			} else {
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
+				}
770
+				$query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
771
+				 try {
772
+						$sth = $this->db->prepare($query);
773
+						$sth->execute($query_values);
774
+				} catch(PDOException $e) {
775
+						echo "error : ".$e->getMessage();
776
+				}
777
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
778
+				return $all[0]['total'];
779
+		}
780 780
 	public function getStatsTotal($type, $stats_airline = '', $filter_name = '') {
781
-    		global $globalArchiveMonths, $globalDBdriver;
781
+			global $globalArchiveMonths, $globalDBdriver;
782 782
 		if ($filter_name == '') $filter_name = $this->filter_name;
783
-    		if ($globalDBdriver == 'mysql') {
783
+			if ($globalDBdriver == 'mysql') {
784 784
 			$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
785 785
 		} else {
786 786
 			$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveMonths." MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
787
-                }
788
-                $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
789
-                 try {
790
-                        $sth = $this->db->prepare($query);
791
-                        $sth->execute($query_values);
792
-                } catch(PDOException $e) {
793
-                        echo "error : ".$e->getMessage();
794
-                }
795
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
796
-                return $all[0]['total'];
797
-        }
787
+				}
788
+				$query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
789
+				 try {
790
+						$sth = $this->db->prepare($query);
791
+						$sth->execute($query_values);
792
+				} catch(PDOException $e) {
793
+						echo "error : ".$e->getMessage();
794
+				}
795
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
796
+				return $all[0]['total'];
797
+		}
798 798
 	public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') {
799
-    		global $globalArchiveMonths, $globalDBdriver;
799
+			global $globalArchiveMonths, $globalDBdriver;
800 800
 		if ($filter_name == '') $filter_name = $this->filter_name;
801
-    		if ($globalDBdriver == 'mysql') {
801
+			if ($globalDBdriver == 'mysql') {
802 802
 			$query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name";
803
-                } else {
803
+				} else {
804 804
 			$query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name";
805
-                }
806
-                 try {
807
-                        $sth = $this->db->prepare($query);
808
-                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
809
-                } catch(PDOException $e) {
810
-                        echo "error : ".$e->getMessage();
811
-                }
812
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
813
-                return $all[0]['total'];
814
-        }
805
+				}
806
+				 try {
807
+						$sth = $this->db->prepare($query);
808
+						$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
809
+				} catch(PDOException $e) {
810
+						echo "error : ".$e->getMessage();
811
+				}
812
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
813
+				return $all[0]['total'];
814
+		}
815 815
 	public function getStatsAirlineTotal($filter_name = '') {
816
-    		global $globalArchiveMonths, $globalDBdriver;
816
+			global $globalArchiveMonths, $globalDBdriver;
817 817
 		if ($filter_name == '') $filter_name = $this->filter_name;
818
-    		if ($globalDBdriver == 'mysql') {
818
+			if ($globalDBdriver == 'mysql') {
819 819
 			$query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name";
820
-                } else {
820
+				} else {
821 821
 			$query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name";
822
-                }
823
-                 try {
824
-                        $sth = $this->db->prepare($query);
825
-                        $sth->execute(array(':filter_name' => $filter_name));
826
-                } catch(PDOException $e) {
827
-                        echo "error : ".$e->getMessage();
828
-                }
829
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
830
-                return $all[0]['total'];
831
-        }
822
+				}
823
+				 try {
824
+						$sth = $this->db->prepare($query);
825
+						$sth->execute(array(':filter_name' => $filter_name));
826
+				} catch(PDOException $e) {
827
+						echo "error : ".$e->getMessage();
828
+				}
829
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
830
+				return $all[0]['total'];
831
+		}
832 832
 	public function getStatsOwnerTotal($filter_name = '') {
833
-    		global $globalArchiveMonths, $globalDBdriver;
833
+			global $globalArchiveMonths, $globalDBdriver;
834 834
 		if ($filter_name == '') $filter_name = $this->filter_name;
835
-    		if ($globalDBdriver == 'mysql') {
835
+			if ($globalDBdriver == 'mysql') {
836 836
 			$query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name";
837 837
 		} else {
838 838
 			$query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name";
839
-                }
840
-                 try {
841
-                        $sth = $this->db->prepare($query);
842
-                        $sth->execute(array(':filter_name' => $filter_name));
843
-                } catch(PDOException $e) {
844
-                        echo "error : ".$e->getMessage();
845
-                }
846
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
847
-                return $all[0]['total'];
848
-        }
839
+				}
840
+				 try {
841
+						$sth = $this->db->prepare($query);
842
+						$sth->execute(array(':filter_name' => $filter_name));
843
+				} catch(PDOException $e) {
844
+						echo "error : ".$e->getMessage();
845
+				}
846
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
847
+				return $all[0]['total'];
848
+		}
849 849
 	public function getStatsPilotTotal($filter_name = '') {
850
-    		global $globalArchiveMonths, $globalDBdriver;
850
+			global $globalArchiveMonths, $globalDBdriver;
851 851
 		if ($filter_name == '') $filter_name = $this->filter_name;
852
-    		if ($globalDBdriver == 'mysql') {
853
-            		$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
854
-            	} else {
855
-            		$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
856
-            	}
857
-                 try {
858
-                        $sth = $this->db->prepare($query);
859
-                        $sth->execute(array(':filter_name' => $filter_name));
860
-                } catch(PDOException $e) {
861
-                        echo "error : ".$e->getMessage();
862
-                }
863
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
864
-                return $all[0]['total'];
865
-        }
852
+			if ($globalDBdriver == 'mysql') {
853
+					$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
854
+				} else {
855
+					$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
856
+				}
857
+				 try {
858
+						$sth = $this->db->prepare($query);
859
+						$sth->execute(array(':filter_name' => $filter_name));
860
+				} catch(PDOException $e) {
861
+						echo "error : ".$e->getMessage();
862
+				}
863
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
864
+				return $all[0]['total'];
865
+		}
866 866
 
867 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') {
871 871
 			$query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = :cnt";
872
-                } else {
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);
876
-                 try {
877
-                        $sth = $this->db->prepare($query);
878
-                        $sth->execute($query_values);
879
-                } catch(PDOException $e) {
880
-                        return "error : ".$e->getMessage();
881
-                }
882
-        }
875
+				$query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
876
+				 try {
877
+						$sth = $this->db->prepare($query);
878
+						$sth->execute($query_values);
879
+				} catch(PDOException $e) {
880
+						return "error : ".$e->getMessage();
881
+				}
882
+		}
883 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') {
887 887
 			$query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date";
888 888
 		} else {
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";
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
-                }
892
-                $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
893
-                 try {
894
-                        $sth = $this->db->prepare($query);
895
-                        $sth->execute($query_values);
896
-                } catch(PDOException $e) {
897
-                        return "error : ".$e->getMessage();
898
-                }
899
-        }
891
+				}
892
+				$query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
893
+				 try {
894
+						$sth = $this->db->prepare($query);
895
+						$sth->execute($query_values);
896
+				} catch(PDOException $e) {
897
+						return "error : ".$e->getMessage();
898
+				}
899
+		}
900 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";
@@ -905,15 +905,15 @@  discard block
 block discarded – undo
905 905
 			$query = "SELECT * FROM stats_source WHERE stats_date = :date AND stats_type = :stats_type ORDER BY source_name";
906 906
 			$query_values = array(':date' => $date,':stats_type' => $stats_type);
907 907
 		}
908
-                 try {
909
-                        $sth = $this->db->prepare($query);
910
-                        $sth->execute($query_values);
911
-                } catch(PDOException $e) {
912
-                        echo "error : ".$e->getMessage();
913
-                }
914
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
915
-                return $all;
916
-        }
908
+				 try {
909
+						$sth = $this->db->prepare($query);
910
+						$sth->execute($query_values);
911
+				} catch(PDOException $e) {
912
+						echo "error : ".$e->getMessage();
913
+				}
914
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
915
+				return $all;
916
+		}
917 917
 
918 918
 	public function addStatSource($data,$source_name,$stats_type,$date) {
919 919
 		global $globalDBdriver;
@@ -921,25 +921,25 @@  discard block
 block discarded – undo
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
-                }
925
-                $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type);
926
-                 try {
927
-                        $sth = $this->db->prepare($query);
928
-                        $sth->execute($query_values);
929
-                } catch(PDOException $e) {
930
-                        return "error : ".$e->getMessage();
931
-                }
932
-        }
924
+				}
925
+				$query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type);
926
+				 try {
927
+						$sth = $this->db->prepare($query);
928
+						$sth->execute($query_values);
929
+				} catch(PDOException $e) {
930
+						return "error : ".$e->getMessage();
931
+				}
932
+		}
933 933
 	public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') {
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);
936
-                 try {
937
-                        $sth = $this->db->prepare($query);
938
-                        $sth->execute($query_values);
939
-                } catch(PDOException $e) {
940
-                        return "error : ".$e->getMessage();
941
-                }
942
-        }
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);
936
+				 try {
937
+						$sth = $this->db->prepare($query);
938
+						$sth->execute($query_values);
939
+				} catch(PDOException $e) {
940
+						return "error : ".$e->getMessage();
941
+				}
942
+		}
943 943
 	public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '') {
944 944
 		global $globalDBdriver;
945 945
 		if ($globalDBdriver == 'mysql') {
@@ -947,14 +947,14 @@  discard block
 block discarded – undo
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);
951
-                 try {
952
-                        $sth = $this->db->prepare($query);
953
-                        $sth->execute($query_values);
954
-                } catch(PDOException $e) {
955
-                        return "error : ".$e->getMessage();
956
-                }
957
-        }
950
+				$query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
951
+				 try {
952
+						$sth = $this->db->prepare($query);
953
+						$sth->execute($query_values);
954
+				} catch(PDOException $e) {
955
+						return "error : ".$e->getMessage();
956
+				}
957
+		}
958 958
 	public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '') {
959 959
 		global $globalDBdriver;
960 960
 		if ($globalDBdriver == 'mysql') {
@@ -962,14 +962,14 @@  discard block
 block discarded – undo
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);
966
-                 try {
967
-                        $sth = $this->db->prepare($query);
968
-                        $sth->execute($query_values);
969
-                } catch(PDOException $e) {
970
-                        return "error : ".$e->getMessage();
971
-                }
972
-        }
965
+				$query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name);
966
+				 try {
967
+						$sth = $this->db->prepare($query);
968
+						$sth->execute($query_values);
969
+				} catch(PDOException $e) {
970
+						return "error : ".$e->getMessage();
971
+				}
972
+		}
973 973
 	public function addStatCountry($iso2,$iso3,$name,$cnt,$filter_name = '') {
974 974
 		global $globalDBdriver;
975 975
 		if ($globalDBdriver == 'mysql') {
@@ -977,14 +977,14 @@  discard block
 block discarded – undo
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);
981
-                 try {
982
-                        $sth = $this->db->prepare($query);
983
-                        $sth->execute($query_values);
984
-                } catch(PDOException $e) {
985
-                        return "error : ".$e->getMessage();
986
-                }
987
-        }
980
+				$query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name);
981
+				 try {
982
+						$sth = $this->db->prepare($query);
983
+						$sth->execute($query_values);
984
+				} catch(PDOException $e) {
985
+						return "error : ".$e->getMessage();
986
+				}
987
+		}
988 988
 	public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '') {
989 989
 		global $globalDBdriver;
990 990
 		if ($globalDBdriver == 'mysql') {
@@ -992,14 +992,14 @@  discard block
 block discarded – undo
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);
996
-                 try {
997
-                        $sth = $this->db->prepare($query);
998
-                        $sth->execute($query_values);
999
-                } catch(PDOException $e) {
1000
-                        return "error : ".$e->getMessage();
1001
-                }
1002
-        }
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
+				 try {
997
+						$sth = $this->db->prepare($query);
998
+						$sth->execute($query_values);
999
+				} catch(PDOException $e) {
1000
+						return "error : ".$e->getMessage();
1001
+				}
1002
+		}
1003 1003
 	public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '') {
1004 1004
 		global $globalDBdriver;
1005 1005
 		if ($globalDBdriver == 'mysql') {
@@ -1007,14 +1007,14 @@  discard block
 block discarded – undo
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);
1011
-                 try {
1012
-                        $sth = $this->db->prepare($query);
1013
-                        $sth->execute($query_values);
1014
-                } catch(PDOException $e) {
1015
-                        return "error : ".$e->getMessage();
1016
-                }
1017
-        }
1010
+				$query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name);
1011
+				 try {
1012
+						$sth = $this->db->prepare($query);
1013
+						$sth->execute($query_values);
1014
+				} catch(PDOException $e) {
1015
+						return "error : ".$e->getMessage();
1016
+				}
1017
+		}
1018 1018
 	public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '') {
1019 1019
 		global $globalDBdriver;
1020 1020
 		if ($globalDBdriver == 'mysql') {
@@ -1022,14 +1022,14 @@  discard block
 block discarded – undo
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);
1026
-                 try {
1027
-                        $sth = $this->db->prepare($query);
1028
-                        $sth->execute($query_values);
1029
-                } catch(PDOException $e) {
1030
-                        return "error : ".$e->getMessage();
1031
-                }
1032
-        }
1025
+				$query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1026
+				 try {
1027
+						$sth = $this->db->prepare($query);
1028
+						$sth->execute($query_values);
1029
+				} catch(PDOException $e) {
1030
+						return "error : ".$e->getMessage();
1031
+				}
1032
+		}
1033 1033
 	public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '',$format_source = '') {
1034 1034
 		global $globalDBdriver;
1035 1035
 		if ($globalDBdriver == 'mysql') {
@@ -1037,14 +1037,14 @@  discard block
 block discarded – undo
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);
1041
-                 try {
1042
-                        $sth = $this->db->prepare($query);
1043
-                        $sth->execute($query_values);
1044
-                } catch(PDOException $e) {
1045
-                        return "error : ".$e->getMessage();
1046
-                }
1047
-        }
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
+				 try {
1042
+						$sth = $this->db->prepare($query);
1043
+						$sth->execute($query_values);
1044
+				} catch(PDOException $e) {
1045
+						return "error : ".$e->getMessage();
1046
+				}
1047
+		}
1048 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') {
@@ -1052,14 +1052,14 @@  discard block
 block discarded – undo
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);
1056
-                 try {
1057
-                        $sth = $this->db->prepare($query);
1058
-                        $sth->execute($query_values);
1059
-                } catch(PDOException $e) {
1060
-                        return "error : ".$e->getMessage();
1061
-                }
1062
-        }
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
+				 try {
1057
+						$sth = $this->db->prepare($query);
1058
+						$sth->execute($query_values);
1059
+				} catch(PDOException $e) {
1060
+						return "error : ".$e->getMessage();
1061
+				}
1062
+		}
1063 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') {
@@ -1067,14 +1067,14 @@  discard block
 block discarded – undo
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);
1071
-                 try {
1072
-                        $sth = $this->db->prepare($query);
1073
-                        $sth->execute($query_values);
1074
-                } catch(PDOException $e) {
1075
-                        return "error : ".$e->getMessage();
1076
-                }
1077
-        }
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
+				 try {
1072
+						$sth = $this->db->prepare($query);
1073
+						$sth->execute($query_values);
1074
+				} catch(PDOException $e) {
1075
+						return "error : ".$e->getMessage();
1076
+				}
1077
+		}
1078 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') {
@@ -1082,14 +1082,14 @@  discard block
 block discarded – undo
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);
1086
-                 try {
1087
-                        $sth = $this->db->prepare($query);
1088
-                        $sth->execute($query_values);
1089
-                } catch(PDOException $e) {
1090
-                        return "error : ".$e->getMessage();
1091
-                }
1092
-        }
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
+				 try {
1087
+						$sth = $this->db->prepare($query);
1088
+						$sth->execute($query_values);
1089
+				} catch(PDOException $e) {
1090
+						return "error : ".$e->getMessage();
1091
+				}
1092
+		}
1093 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') {
@@ -1097,52 +1097,52 @@  discard block
 block discarded – undo
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);
1101
-                 try {
1102
-                        $sth = $this->db->prepare($query);
1103
-                        $sth->execute($query_values);
1104
-                } catch(PDOException $e) {
1105
-                        return "error : ".$e->getMessage();
1106
-                }
1107
-        }
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
+				 try {
1102
+						$sth = $this->db->prepare($query);
1103
+						$sth->execute($query_values);
1104
+				} catch(PDOException $e) {
1105
+						return "error : ".$e->getMessage();
1106
+				}
1107
+		}
1108 1108
 
1109 1109
 	public function deleteStat($id) {
1110
-                $query = "DELETE FROM stats WHERE stats_id = :id";
1111
-                $query_values = array(':id' => $id);
1112
-                 try {
1113
-                        $sth = $this->db->prepare($query);
1114
-                        $sth->execute($query_values);
1115
-                } catch(PDOException $e) {
1116
-                        return "error : ".$e->getMessage();
1117
-                }
1118
-        }
1110
+				$query = "DELETE FROM stats WHERE stats_id = :id";
1111
+				$query_values = array(':id' => $id);
1112
+				 try {
1113
+						$sth = $this->db->prepare($query);
1114
+						$sth->execute($query_values);
1115
+				} catch(PDOException $e) {
1116
+						return "error : ".$e->getMessage();
1117
+				}
1118
+		}
1119 1119
 	public function deleteStatFlight($type) {
1120
-                $query = "DELETE FROM stats_flight WHERE stats_type = :type";
1121
-                $query_values = array(':type' => $type);
1122
-                 try {
1123
-                        $sth = $this->db->prepare($query);
1124
-                        $sth->execute($query_values);
1125
-                } catch(PDOException $e) {
1126
-                        return "error : ".$e->getMessage();
1127
-                }
1128
-        }
1120
+				$query = "DELETE FROM stats_flight WHERE stats_type = :type";
1121
+				$query_values = array(':type' => $type);
1122
+				 try {
1123
+						$sth = $this->db->prepare($query);
1124
+						$sth->execute($query_values);
1125
+				} catch(PDOException $e) {
1126
+						return "error : ".$e->getMessage();
1127
+				}
1128
+		}
1129 1129
 	public function deleteStatAirport($type) {
1130
-                $query = "DELETE FROM stats_airport WHERE stats_type = :type";
1131
-                $query_values = array(':type' => $type);
1132
-                 try {
1133
-                        $sth = $this->db->prepare($query);
1134
-                        $sth->execute($query_values);
1135
-                } catch(PDOException $e) {
1136
-                        return "error : ".$e->getMessage();
1137
-                }
1138
-        }
1130
+				$query = "DELETE FROM stats_airport WHERE stats_type = :type";
1131
+				$query_values = array(':type' => $type);
1132
+				 try {
1133
+						$sth = $this->db->prepare($query);
1134
+						$sth->execute($query_values);
1135
+				} catch(PDOException $e) {
1136
+						return "error : ".$e->getMessage();
1137
+				}
1138
+		}
1139 1139
         
1140
-        public function addOldStats() {
1141
-    		global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters;
1142
-    		$Common = new Common();
1143
-    		$Connection = new Connection();
1144
-    		date_default_timezone_set('UTC');
1145
-    		$last_update = $this->getLastStatsUpdate('last_update_stats');
1140
+		public function addOldStats() {
1141
+			global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters;
1142
+			$Common = new Common();
1143
+			$Connection = new Connection();
1144
+			date_default_timezone_set('UTC');
1145
+			$last_update = $this->getLastStatsUpdate('last_update_stats');
1146 1146
 		//print_r($last_update);
1147 1147
 		/*
1148 1148
 		$flightsbymonth = $this->getStats('flights_by_month');
@@ -1404,24 +1404,24 @@  discard block
 block discarded – undo
1404 1404
 			if ($globalDebug) echo 'Count all departure airports...'."\n";
1405 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
-	        	$alldata = array();
1409
+				$alldata = array();
1410 1410
 	        	
1411
-    			foreach ($pall as $value) {
1412
-	        		$icao = $value['airport_departure_icao'];
1413
-    				$alldata[$icao] = $value;
1414
-	        	}
1415
-	        	foreach ($dall as $value) {
1416
-    				$icao = $value['airport_departure_icao'];
1417
-        			if (isset($alldata[$icao])) {
1418
-    					$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1419
-        			} else $alldata[$icao] = $value;
1420
-			}
1421
-    			$count = array();
1422
-    			foreach ($alldata as $key => $row) {
1423
-    				$count[$key] = $row['airport_departure_icao_count'];
1424
-        		}
1411
+				foreach ($pall as $value) {
1412
+					$icao = $value['airport_departure_icao'];
1413
+					$alldata[$icao] = $value;
1414
+				}
1415
+				foreach ($dall as $value) {
1416
+					$icao = $value['airport_departure_icao'];
1417
+					if (isset($alldata[$icao])) {
1418
+						$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1419
+					} else $alldata[$icao] = $value;
1420
+			}
1421
+				$count = array();
1422
+				foreach ($alldata as $key => $row) {
1423
+					$count[$key] = $row['airport_departure_icao_count'];
1424
+				}
1425 1425
 			array_multisort($count,SORT_DESC,$alldata);
1426 1426
 			foreach ($alldata as $number) {
1427 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']);
@@ -1429,25 +1429,25 @@  discard block
 block discarded – undo
1429 1429
 			if ($globalDebug) echo 'Count all arrival airports...'."\n";
1430 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
-	        	$alldata = array();
1435
-    			foreach ($pall as $value) {
1436
-	        		$icao = $value['airport_arrival_icao'];
1437
-    				$alldata[$icao] = $value;
1438
-	        	}
1439
-	        	foreach ($dall as $value) {
1440
-    				$icao = $value['airport_arrival_icao'];
1441
-        			if (isset($alldata[$icao])) {
1442
-        				$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1443
-	        		} else $alldata[$icao] = $value;
1444
-    			}
1445
-        		$count = array();
1446
-        		foreach ($alldata as $key => $row) {
1447
-        			$count[$key] = $row['airport_arrival_icao_count'];
1448
-	        	}
1449
-    			array_multisort($count,SORT_DESC,$alldata);
1450
-                        foreach ($alldata as $number) {
1434
+				$alldata = array();
1435
+				foreach ($pall as $value) {
1436
+					$icao = $value['airport_arrival_icao'];
1437
+					$alldata[$icao] = $value;
1438
+				}
1439
+				foreach ($dall as $value) {
1440
+					$icao = $value['airport_arrival_icao'];
1441
+					if (isset($alldata[$icao])) {
1442
+						$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1443
+					} else $alldata[$icao] = $value;
1444
+				}
1445
+				$count = array();
1446
+				foreach ($alldata as $key => $row) {
1447
+					$count[$key] = $row['airport_arrival_icao_count'];
1448
+				}
1449
+				array_multisort($count,SORT_DESC,$alldata);
1450
+						foreach ($alldata as $number) {
1451 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')) {
@@ -1507,8 +1507,8 @@  discard block
 block discarded – undo
1507 1507
 //			$pall = $Spotter->getLast7DaysAirportsDeparture();
1508 1508
   //      		$dall = $Spotter->getLast7DaysDetectedAirportsDeparture();
1509 1509
 			$pall = $Spotter->getLast7DaysAirportsDeparture();
1510
-        		$dall = $Spotter->getLast7DaysDetectedAirportsDeparture();
1511
-        		/*
1510
+				$dall = $Spotter->getLast7DaysDetectedAirportsDeparture();
1511
+				/*
1512 1512
 	        	$alldata = array();
1513 1513
     			foreach ($pall as $value) {
1514 1514
 	        		$icao = $value['departure_airport_icao'];
@@ -1527,29 +1527,29 @@  discard block
 block discarded – undo
1527 1527
 	        	}
1528 1528
     			array_multisort($count,SORT_DESC,$alldata);
1529 1529
     			*/
1530
-    			foreach ($dall as $value) {
1531
-    				$icao = $value['departure_airport_icao'];
1532
-    				$ddate = $value['date'];
1533
-    				$find = false;
1534
-    				foreach ($pall as $pvalue) {
1535
-    					if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1536
-    						$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1537
-    						$find = true;
1538
-    						break;
1539
-    					}
1540
-    				}
1541
-    				if ($find === false) {
1542
-    					$pall[] = $value;
1543
-    				}
1544
-    			}
1545
-    			$alldata = $pall;
1530
+				foreach ($dall as $value) {
1531
+					$icao = $value['departure_airport_icao'];
1532
+					$ddate = $value['date'];
1533
+					$find = false;
1534
+					foreach ($pall as $pvalue) {
1535
+						if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1536
+							$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1537
+							$find = true;
1538
+							break;
1539
+						}
1540
+					}
1541
+					if ($find === false) {
1542
+						$pall[] = $value;
1543
+					}
1544
+				}
1545
+				$alldata = $pall;
1546 1546
 			foreach ($alldata as $number) {
1547 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();
1551
-        		$dall = $Spotter->getLast7DaysDetectedAirportsArrival();
1552
-        		/*
1551
+				$dall = $Spotter->getLast7DaysDetectedAirportsArrival();
1552
+				/*
1553 1553
 	        	$alldata = array();
1554 1554
     			foreach ($pall as $value) {
1555 1555
 	        		$icao = $value['arrival_airport_icao'];
@@ -1569,22 +1569,22 @@  discard block
 block discarded – undo
1569 1569
     			*/
1570 1570
 
1571 1571
 
1572
-    			foreach ($dall as $value) {
1573
-    				$icao = $value['arrival_airport_icao'];
1574
-    				$ddate = $value['date'];
1575
-    				$find = false;
1576
-    				foreach ($pall as $pvalue) {
1577
-    					if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1578
-    						$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1579
-    						$find = true;
1580
-    						break;
1581
-    					}
1582
-    				}
1583
-    				if ($find === false) {
1584
-    					$pall[] = $value;
1585
-    				}
1586
-    			}
1587
-    			$alldata = $pall;
1572
+				foreach ($dall as $value) {
1573
+					$icao = $value['arrival_airport_icao'];
1574
+					$ddate = $value['date'];
1575
+					$find = false;
1576
+					foreach ($pall as $pvalue) {
1577
+						if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1578
+							$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1579
+							$find = true;
1580
+							break;
1581
+						}
1582
+					}
1583
+					if ($find === false) {
1584
+						$pall[] = $value;
1585
+					}
1586
+				}
1587
+				$alldata = $pall;
1588 1588
 			foreach ($alldata as $number) {
1589 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
 			}
@@ -1651,51 +1651,51 @@  discard block
 block discarded – undo
1651 1651
 			if ($globalDebug) echo 'Count all departure airports by airlines...'."\n";
1652 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
-	        	//$alldata = array();
1657
-    			foreach ($dall as $value) {
1658
-    				$icao = $value['airport_departure_icao'];
1659
-    				$dicao = $value['airline_icao'];
1660
-    				$find = false;
1661
-    				foreach ($pall as $pvalue) {
1662
-    					if ($pvalue['airport_departure_icao'] == $icao && $pvalue['airline_icao'] = $dicao) {
1663
-    						$pvalue['airport_departure_icao_count'] = $pvalue['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1664
-    						$find = true;
1665
-    						break;
1666
-    					}
1667
-    				}
1668
-    				if ($find === false) {
1669
-    					$pall[] = $value;
1670
-    				}
1671
-    			}
1672
-    			$alldata = $pall;
1656
+				//$alldata = array();
1657
+				foreach ($dall as $value) {
1658
+					$icao = $value['airport_departure_icao'];
1659
+					$dicao = $value['airline_icao'];
1660
+					$find = false;
1661
+					foreach ($pall as $pvalue) {
1662
+						if ($pvalue['airport_departure_icao'] == $icao && $pvalue['airline_icao'] = $dicao) {
1663
+							$pvalue['airport_departure_icao_count'] = $pvalue['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1664
+							$find = true;
1665
+							break;
1666
+						}
1667
+					}
1668
+					if ($find === false) {
1669
+						$pall[] = $value;
1670
+					}
1671
+				}
1672
+				$alldata = $pall;
1673 1673
 			foreach ($alldata as $number) {
1674 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 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
-	        	//$alldata = array();
1682
-    			foreach ($dall as $value) {
1683
-    				$icao = $value['airport_arrival_icao'];
1684
-    				$dicao = $value['airline_icao'];
1685
-    				$find = false;
1686
-    				foreach ($pall as $pvalue) {
1687
-    					if ($pvalue['airport_arrival_icao'] == $icao && $pvalue['airline_icao'] = $dicao) {
1688
-    						$pvalue['airport_arrival_icao_count'] = $pvalue['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1689
-    						$find = true;
1690
-    						break;
1691
-    					}
1692
-    				}
1693
-    				if ($find === false) {
1694
-    					$pall[] = $value;
1695
-    				}
1696
-    			}
1697
-    			$alldata = $pall;
1698
-                        foreach ($alldata as $number) {
1681
+				//$alldata = array();
1682
+				foreach ($dall as $value) {
1683
+					$icao = $value['airport_arrival_icao'];
1684
+					$dicao = $value['airline_icao'];
1685
+					$find = false;
1686
+					foreach ($pall as $pvalue) {
1687
+						if ($pvalue['airport_arrival_icao'] == $icao && $pvalue['airline_icao'] = $dicao) {
1688
+							$pvalue['airport_arrival_icao_count'] = $pvalue['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1689
+							$find = true;
1690
+							break;
1691
+						}
1692
+					}
1693
+					if ($find === false) {
1694
+						$pall[] = $value;
1695
+					}
1696
+				}
1697
+				$alldata = $pall;
1698
+						foreach ($alldata as $number) {
1699 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";
@@ -1728,47 +1728,47 @@  discard block
 block discarded – undo
1728 1728
 			}
1729 1729
 			if ($globalDebug) echo '...Departure'."\n";
1730 1730
 			$pall = $Spotter->getLast7DaysAirportsDepartureByAirlines();
1731
-        		$dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines();
1732
-    			foreach ($dall as $value) {
1733
-    				$icao = $value['departure_airport_icao'];
1734
-    				$airline = $value['airline_icao'];
1735
-    				$ddate = $value['date'];
1736
-    				$find = false;
1737
-    				foreach ($pall as $pvalue) {
1738
-    					if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] = $airline) {
1739
-    						$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1740
-    						$find = true;
1741
-    						break;
1742
-    					}
1743
-    				}
1744
-    				if ($find === false) {
1745
-    					$pall[] = $value;
1746
-    				}
1747
-    			}
1748
-    			$alldata = $pall;
1731
+				$dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines();
1732
+				foreach ($dall as $value) {
1733
+					$icao = $value['departure_airport_icao'];
1734
+					$airline = $value['airline_icao'];
1735
+					$ddate = $value['date'];
1736
+					$find = false;
1737
+					foreach ($pall as $pvalue) {
1738
+						if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] = $airline) {
1739
+							$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1740
+							$find = true;
1741
+							break;
1742
+						}
1743
+					}
1744
+					if ($find === false) {
1745
+						$pall[] = $value;
1746
+					}
1747
+				}
1748
+				$alldata = $pall;
1749 1749
 			foreach ($alldata as $number) {
1750 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();
1754
-        		$dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines();
1755
-    			foreach ($dall as $value) {
1756
-    				$icao = $value['arrival_airport_icao'];
1757
-    				$airline = $value['airline_icao'];
1758
-    				$ddate = $value['date'];
1759
-    				$find = false;
1760
-    				foreach ($pall as $pvalue) {
1761
-    					if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] == $airline) {
1762
-    						$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1763
-    						$find = true;
1764
-    						break;
1765
-    					}
1766
-    				}
1767
-    				if ($find === false) {
1768
-    					$pall[] = $value;
1769
-    				}
1770
-    			}
1771
-    			$alldata = $pall;
1754
+				$dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines();
1755
+				foreach ($dall as $value) {
1756
+					$icao = $value['arrival_airport_icao'];
1757
+					$airline = $value['airline_icao'];
1758
+					$ddate = $value['date'];
1759
+					$find = false;
1760
+					foreach ($pall as $pvalue) {
1761
+						if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] == $airline) {
1762
+							$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1763
+							$find = true;
1764
+							break;
1765
+						}
1766
+					}
1767
+					if ($find === false) {
1768
+						$pall[] = $value;
1769
+					}
1770
+				}
1771
+				$alldata = $pall;
1772 1772
 			foreach ($alldata as $number) {
1773 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
 			}
@@ -1832,44 +1832,44 @@  discard block
 block discarded – undo
1832 1832
 				}
1833 1833
     			
1834 1834
 				$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter);
1835
-	       			$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter);
1836
-		        	$alldata = array();
1837
-	    			foreach ($pall as $value) {
1838
-		        		$icao = $value['airport_departure_icao'];
1839
-    					$alldata[$icao] = $value;
1840
-	    			}
1841
-		        	foreach ($dall as $value) {
1842
-	    				$icao = $value['airport_departure_icao'];
1843
-        				if (isset($alldata[$icao])) {
1844
-    						$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1845
-        				} else $alldata[$icao] = $value;
1846
-				}
1847
-	    			$count = array();
1848
-    				foreach ($alldata as $key => $row) {
1849
-    					$count[$key] = $row['airport_departure_icao_count'];
1850
-    				}
1835
+		   			$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter);
1836
+					$alldata = array();
1837
+					foreach ($pall as $value) {
1838
+						$icao = $value['airport_departure_icao'];
1839
+						$alldata[$icao] = $value;
1840
+					}
1841
+					foreach ($dall as $value) {
1842
+						$icao = $value['airport_departure_icao'];
1843
+						if (isset($alldata[$icao])) {
1844
+							$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1845
+						} else $alldata[$icao] = $value;
1846
+				}
1847
+					$count = array();
1848
+					foreach ($alldata as $key => $row) {
1849
+						$count[$key] = $row['airport_departure_icao_count'];
1850
+					}
1851 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 1855
 				$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,$filter);
1856
-    				$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,$filter);
1856
+					$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,$filter);
1857 1857
 				$alldata = array();
1858
-    				foreach ($pall as $value) {
1859
-		        		$icao = $value['airport_arrival_icao'];
1860
-    					$alldata[$icao] = $value;
1861
-	    			}
1862
-		        	foreach ($dall as $value) {
1863
-	    				$icao = $value['airport_arrival_icao'];
1864
-        				if (isset($alldata[$icao])) {
1865
-        					$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1866
-		        		} else $alldata[$icao] = $value;
1867
-	    			}
1868
-        			$count = array();
1869
-        			foreach ($alldata as $key => $row) {
1870
-    					$count[$key] = $row['airport_arrival_icao_count'];
1871
-		        	}
1872
-        			array_multisort($count,SORT_DESC,$alldata);
1858
+					foreach ($pall as $value) {
1859
+						$icao = $value['airport_arrival_icao'];
1860
+						$alldata[$icao] = $value;
1861
+					}
1862
+					foreach ($dall as $value) {
1863
+						$icao = $value['airport_arrival_icao'];
1864
+						if (isset($alldata[$icao])) {
1865
+							$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1866
+						} else $alldata[$icao] = $value;
1867
+					}
1868
+					$count = array();
1869
+					foreach ($alldata as $key => $row) {
1870
+						$count[$key] = $row['airport_arrival_icao_count'];
1871
+					}
1872
+					array_multisort($count,SORT_DESC,$alldata);
1873 1873
 				foreach ($alldata as $number) {
1874 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
 				}
@@ -1898,45 +1898,45 @@  discard block
 block discarded – undo
1898 1898
 				}
1899 1899
 				echo '...Departure'."\n";
1900 1900
 				$pall = $Spotter->getLast7DaysAirportsDeparture('',$filter);
1901
-        			$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter);
1901
+					$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter);
1902 1902
 				foreach ($dall as $value) {
1903
-    					$icao = $value['departure_airport_icao'];
1904
-    					$ddate = $value['date'];
1905
-    					$find = false;
1906
-    					foreach ($pall as $pvalue) {
1907
-    						if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1908
-    							$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1909
-	    						$find = true;
1910
-    							break;
1911
-    						}
1912
-    					}
1913
-    					if ($find === false) {
1914
-    						$pall[] = $value;
1915
-	    				}
1916
-    				}
1917
-	    			$alldata = $pall;
1903
+						$icao = $value['departure_airport_icao'];
1904
+						$ddate = $value['date'];
1905
+						$find = false;
1906
+						foreach ($pall as $pvalue) {
1907
+							if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1908
+								$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1909
+								$find = true;
1910
+								break;
1911
+							}
1912
+						}
1913
+						if ($find === false) {
1914
+							$pall[] = $value;
1915
+						}
1916
+					}
1917
+					$alldata = $pall;
1918 1918
 				foreach ($alldata as $number) {
1919 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 1922
 				$pall = $Spotter->getLast7DaysAirportsArrival('',$filter);
1923
-    				$dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter);
1923
+					$dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter);
1924 1924
 				foreach ($dall as $value) {
1925 1925
 					$icao = $value['arrival_airport_icao'];
1926 1926
 					$ddate = $value['date'];
1927
-    					$find = false;
1927
+						$find = false;
1928 1928
 					foreach ($pall as $pvalue) {
1929
-    						if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1930
-    							$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1931
-    							$find = true;
1932
-    							break;
1933
-	    					}
1934
-    					}
1935
-    					if ($find === false) {
1936
-    						$pall[] = $value;
1937
-	    				}
1938
-    				}
1939
-    				$alldata = $pall;
1929
+							if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1930
+								$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1931
+								$find = true;
1932
+								break;
1933
+							}
1934
+						}
1935
+						if ($find === false) {
1936
+							$pall[] = $value;
1937
+						}
1938
+					}
1939
+					$alldata = $pall;
1940 1940
 				foreach ($alldata as $number) {
1941 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
 				}
Please login to merge, or discard this 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.
require/class.SpotterLive.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 	/**
15 15
 	* Get SQL query part for filter used
16 16
 	* @param Array $filter the filter
17
-	* @return Array the SQL part
17
+	* @return string the SQL part
18 18
 	*/
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter;
Please login to merge, or discard this patch.
Indentation   +203 added lines, -203 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 
13 13
 
14 14
 	/**
15
-	* Get SQL query part for filter used
16
-	* @param Array $filter the filter
17
-	* @return Array the SQL part
18
-	*/
15
+	 * Get SQL query part for filter used
16
+	 * @param Array $filter the filter
17
+	 * @return Array the SQL part
18
+	 */
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter;
21 21
 		if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter);
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
 	}
51 51
 
52 52
 	/**
53
-	* Gets all the spotter information based on the latest data entry
54
-	*
55
-	* @return Array the spotter information
56
-	*
57
-	*/
53
+	 * Gets all the spotter information based on the latest data entry
54
+	 *
55
+	 * @return Array the spotter information
56
+	 *
57
+	 */
58 58
 	public function getLiveSpotterData($limit = '', $sort = '', $filter = array())
59 59
 	{
60 60
 		global $globalDBdriver, $globalLiveInterval;
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
 	}
94 94
 
95 95
 	/**
96
-	* Gets Minimal Live Spotter data
97
-	*
98
-	* @return Array the spotter information
99
-	*
100
-	*/
96
+	 * Gets Minimal Live Spotter data
97
+	 *
98
+	 * @return Array the spotter information
99
+	 *
100
+	 */
101 101
 	public function getMinLiveSpotterData($filter = array())
102 102
 	{
103 103
 		global $globalDBdriver, $globalLiveInterval;
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
 	}
143 143
 
144 144
 	/**
145
-	* Gets Minimal Live Spotter data since xx seconds
146
-	*
147
-	* @return Array the spotter information
148
-	*
149
-	*/
145
+	 * Gets Minimal Live Spotter data since xx seconds
146
+	 *
147
+	 * @return Array the spotter information
148
+	 *
149
+	 */
150 150
 	public function getMinLastLiveSpotterData($filter = array())
151 151
 	{
152 152
 		global $globalDBdriver, $globalLiveInterval;
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 			$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 
161 161
 			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 
162 162
 			ORDER BY spotter_live.flightaware_id, spotter_live.date';
163
-                } else {
163
+				} else {
164 164
 /*
165 165
 			$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 
166 166
 			FROM spotter_live WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 //			echo $query;
173 173
 		}
174 174
 
175
-    		try {
175
+			try {
176 176
 			$sth = $this->db->prepare($query);
177 177
 			$sth->execute();
178 178
 		} catch(PDOException $e) {
@@ -184,11 +184,11 @@  discard block
 block discarded – undo
184 184
 	}
185 185
 
186 186
 	/**
187
-	* Gets number of latest data entry
188
-	*
189
-	* @return String number of entry
190
-	*
191
-	*/
187
+	 * Gets number of latest data entry
188
+	 *
189
+	 * @return String number of entry
190
+	 *
191
+	 */
192 192
 	public function getLiveSpotterCount($filter = array())
193 193
 	{
194 194
 		global $globalDBdriver, $globalLiveInterval;
@@ -214,11 +214,11 @@  discard block
 block discarded – undo
214 214
 	}
215 215
 
216 216
 	/**
217
-	* Gets all the spotter information based on the latest data entry and coord
218
-	*
219
-	* @return Array the spotter information
220
-	*
221
-	*/
217
+	 * Gets all the spotter information based on the latest data entry and coord
218
+	 *
219
+	 * @return Array the spotter information
220
+	 *
221
+	 */
222 222
 	public function getLiveSpotterDatabyCoord($coord, $filter = array())
223 223
 	{
224 224
 		global $globalDBdriver, $globalLiveInterval;
@@ -243,11 +243,11 @@  discard block
 block discarded – undo
243 243
 	}
244 244
 
245 245
 	/**
246
-	* Gets all the spotter information based on a user's latitude and longitude
247
-	*
248
-	* @return Array the spotter information
249
-	*
250
-	*/
246
+	 * Gets all the spotter information based on a user's latitude and longitude
247
+	 *
248
+	 * @return Array the spotter information
249
+	 *
250
+	 */
251 251
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
252 252
 	{
253 253
 		$Spotter = new Spotter($this->db);
@@ -257,145 +257,145 @@  discard block
 block discarded – undo
257 257
 				return false;
258 258
 			}
259 259
 		}
260
-        if ($lng != '')
261
-                {
262
-                        if (!is_numeric($lng))
263
-                        {
264
-                                return false;
265
-                        }
266
-                }
267
-
268
-                if ($radius != '')
269
-                {
270
-                        if (!is_numeric($radius))
271
-                        {
272
-                                return false;
273
-                        }
274
-                }
260
+		if ($lng != '')
261
+				{
262
+						if (!is_numeric($lng))
263
+						{
264
+								return false;
265
+						}
266
+				}
267
+
268
+				if ($radius != '')
269
+				{
270
+						if (!is_numeric($radius))
271
+						{
272
+								return false;
273
+						}
274
+				}
275 275
 		$additional_query = '';
276
-        if ($interval != '')
277
-                {
278
-                        if (!is_string($interval))
279
-                        {
280
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
281
-			        return false;
282
-                        } else {
283
-                if ($interval == '1m')
284
-                {
285
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
286
-                } else if ($interval == '15m'){
287
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
288
-                } 
289
-            }
290
-                } else {
291
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
292
-        }
293
-
294
-                $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 
276
+		if ($interval != '')
277
+				{
278
+						if (!is_string($interval))
279
+						{
280
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
281
+					return false;
282
+						} else {
283
+				if ($interval == '1m')
284
+				{
285
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
286
+				} else if ($interval == '15m'){
287
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
288
+				} 
289
+			}
290
+				} else {
291
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
292
+		}
293
+
294
+				$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 
295 295
                    WHERE spotter_live.latitude <> '' 
296 296
                                    AND spotter_live.longitude <> '' 
297 297
                    ".$additional_query."
298 298
                    HAVING distance < :radius  
299 299
                                    ORDER BY distance";
300 300
 
301
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
301
+				$spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
302 302
 
303
-                return $spotter_array;
304
-        }
303
+				return $spotter_array;
304
+		}
305 305
 
306 306
     
307
-        /**
308
-	* Gets all the spotter information based on a particular callsign
309
-	*
310
-	* @return Array the spotter information
311
-	*
312
-	*/
307
+		/**
308
+		 * Gets all the spotter information based on a particular callsign
309
+		 *
310
+		 * @return Array the spotter information
311
+		 *
312
+		 */
313 313
 	public function getLastLiveSpotterDataByIdent($ident)
314 314
 	{
315 315
 		$Spotter = new Spotter($this->db);
316 316
 		date_default_timezone_set('UTC');
317 317
 
318 318
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
319
-                $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';
319
+				$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';
320 320
 
321 321
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident));
322 322
 
323 323
 		return $spotter_array;
324 324
 	}
325 325
 
326
-        /**
327
-	* Gets all the spotter information based on a particular callsign
328
-	*
329
-	* @return Array the spotter information
330
-	*
331
-	*/
326
+		/**
327
+		 * Gets all the spotter information based on a particular callsign
328
+		 *
329
+		 * @return Array the spotter information
330
+		 *
331
+		 */
332 332
 	public function getDateLiveSpotterDataByIdent($ident,$date)
333 333
 	{
334 334
 		$Spotter = new Spotter($this->db);
335 335
 		date_default_timezone_set('UTC');
336 336
 
337 337
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
338
-                $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';
338
+				$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';
339 339
 
340
-                $date = date('c',$date);
340
+				$date = date('c',$date);
341 341
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
342 342
 
343 343
 		return $spotter_array;
344 344
 	}
345 345
 
346
-        /**
347
-	* Gets last spotter information based on a particular callsign
348
-	*
349
-	* @return Array the spotter information
350
-	*
351
-	*/
346
+		/**
347
+		 * Gets last spotter information based on a particular callsign
348
+		 *
349
+		 * @return Array the spotter information
350
+		 *
351
+		 */
352 352
 	public function getLastLiveSpotterDataById($id)
353 353
 	{
354 354
 		$Spotter = new Spotter($this->db);
355 355
 		date_default_timezone_set('UTC');
356 356
 
357 357
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
358
-                $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';
358
+				$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';
359 359
 
360 360
 		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id));
361 361
 
362 362
 		return $spotter_array;
363 363
 	}
364 364
 
365
-        /**
366
-	* Gets last spotter information based on a particular callsign
367
-	*
368
-	* @return Array the spotter information
369
-	*
370
-	*/
365
+		/**
366
+		 * Gets last spotter information based on a particular callsign
367
+		 *
368
+		 * @return Array the spotter information
369
+		 *
370
+		 */
371 371
 	public function getDateLiveSpotterDataById($id,$date)
372 372
 	{
373 373
 		$Spotter = new Spotter($this->db);
374 374
 		date_default_timezone_set('UTC');
375 375
 
376 376
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
377
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.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';
378
-                $date = date('c',$date);
377
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.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';
378
+				$date = date('c',$date);
379 379
 		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date));
380 380
 
381 381
 		return $spotter_array;
382 382
 	}
383 383
 
384
-        /**
385
-	* Gets altitude information based on a particular callsign
386
-	*
387
-	* @return Array the spotter information
388
-	*
389
-	*/
384
+		/**
385
+		 * Gets altitude information based on a particular callsign
386
+		 *
387
+		 * @return Array the spotter information
388
+		 *
389
+		 */
390 390
 	public function getAltitudeLiveSpotterDataByIdent($ident)
391 391
 	{
392 392
 
393 393
 		date_default_timezone_set('UTC');
394 394
 
395 395
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
396
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
396
+				$query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
397 397
 
398
-    		try {
398
+			try {
399 399
 			
400 400
 			$sth = $this->db->prepare($query);
401 401
 			$sth->execute(array(':ident' => $ident));
@@ -408,12 +408,12 @@  discard block
 block discarded – undo
408 408
 		return $spotter_array;
409 409
 	}
410 410
 
411
-        /**
412
-	* Gets all the spotter information based on a particular id
413
-	*
414
-	* @return Array the spotter information
415
-	*
416
-	*/
411
+		/**
412
+		 * Gets all the spotter information based on a particular id
413
+		 *
414
+		 * @return Array the spotter information
415
+		 *
416
+		 */
417 417
 	public function getAllLiveSpotterDataById($id,$liveinterval = false)
418 418
 	{
419 419
 		global $globalDBdriver, $globalLiveInterval;
@@ -441,18 +441,18 @@  discard block
 block discarded – undo
441 441
 		return $spotter_array;
442 442
 	}
443 443
 
444
-        /**
445
-	* Gets all the spotter information based on a particular ident
446
-	*
447
-	* @return Array the spotter information
448
-	*
449
-	*/
444
+		/**
445
+		 * Gets all the spotter information based on a particular ident
446
+		 *
447
+		 * @return Array the spotter information
448
+		 *
449
+		 */
450 450
 	public function getAllLiveSpotterDataByIdent($ident)
451 451
 	{
452 452
 		date_default_timezone_set('UTC');
453 453
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
454 454
 		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
455
-    		try {
455
+			try {
456 456
 			
457 457
 			$sth = $this->db->prepare($query);
458 458
 			$sth->execute(array(':ident' => $ident));
@@ -466,23 +466,23 @@  discard block
 block discarded – undo
466 466
 
467 467
 
468 468
 	/**
469
-	* Deletes all info in the table
470
-	*
471
-	* @return String success or false
472
-	*
473
-	*/
469
+	 * Deletes all info in the table
470
+	 *
471
+	 * @return String success or false
472
+	 *
473
+	 */
474 474
 	public function deleteLiveSpotterData()
475 475
 	{
476 476
 		global $globalDBdriver;
477 477
 		if ($globalDBdriver == 'mysql') {
478 478
 			//$query  = "DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= spotter_live.date";
479 479
 			$query  = 'DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= spotter_live.date';
480
-            		//$query  = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)";
480
+					//$query  = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)";
481 481
 		} else {
482 482
 			$query  = "DELETE FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date";
483 483
 		}
484 484
         
485
-    		try {
485
+			try {
486 486
 			
487 487
 			$sth = $this->db->prepare($query);
488 488
 			$sth->execute();
@@ -494,18 +494,18 @@  discard block
 block discarded – undo
494 494
 	}
495 495
 
496 496
 	/**
497
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
498
-	*
499
-	* @return String success or false
500
-	*
501
-	*/
497
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
498
+	 *
499
+	 * @return String success or false
500
+	 *
501
+	 */
502 502
 	public function deleteLiveSpotterDataNotUpdated()
503 503
 	{
504 504
 		global $globalDBdriver, $globalDebug;
505 505
 		if ($globalDBdriver == 'mysql') {
506 506
 			//$query = 'SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < spotter_live.date) LIMIT 800 OFFSET 0';
507
-    			$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
508
-    			try {
507
+				$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
508
+				try {
509 509
 				
510 510
 				$sth = $this->db->prepare($query);
511 511
 				$sth->execute();
@@ -513,8 +513,8 @@  discard block
 block discarded – undo
513 513
 				return "error";
514 514
 			}
515 515
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
516
-                        $i = 0;
517
-                        $j =0;
516
+						$i = 0;
517
+						$j =0;
518 518
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
519 519
 			foreach($all as $row)
520 520
 			{
@@ -522,20 +522,20 @@  discard block
 block discarded – undo
522 522
 				$j++;
523 523
 				if ($j == 30) {
524 524
 					if ($globalDebug) echo ".";
525
-				    	try {
525
+						try {
526 526
 						
527 527
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
528 528
 						$sth->execute();
529 529
 					} catch(PDOException $e) {
530 530
 						return "error";
531 531
 					}
532
-                                	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
533
-                                	$j = 0;
532
+									$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
533
+									$j = 0;
534 534
 				}
535 535
 				$query_delete .= "'".$row['flightaware_id']."',";
536 536
 			}
537 537
 			if ($i > 0) {
538
-    				try {
538
+					try {
539 539
 					
540 540
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
541 541
 					$sth->execute();
@@ -546,9 +546,9 @@  discard block
 block discarded – undo
546 546
 			return "success";
547 547
 		} elseif ($globalDBdriver == 'pgsql') {
548 548
 			//$query = "SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < spotter_live.date) LIMIT 800 OFFSET 0";
549
-    			//$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
550
-    			$query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
551
-    			try {
549
+				//$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
550
+				$query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
551
+				try {
552 552
 				
553 553
 				$sth = $this->db->prepare($query);
554 554
 				$sth->execute();
@@ -592,17 +592,17 @@  discard block
 block discarded – undo
592 592
 	}
593 593
 
594 594
 	/**
595
-	* Deletes all info in the table for an ident
596
-	*
597
-	* @return String success or false
598
-	*
599
-	*/
595
+	 * Deletes all info in the table for an ident
596
+	 *
597
+	 * @return String success or false
598
+	 *
599
+	 */
600 600
 	public function deleteLiveSpotterDataByIdent($ident)
601 601
 	{
602 602
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
603 603
 		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
604 604
         
605
-    		try {
605
+			try {
606 606
 			
607 607
 			$sth = $this->db->prepare($query);
608 608
 			$sth->execute(array(':ident' => $ident));
@@ -614,17 +614,17 @@  discard block
 block discarded – undo
614 614
 	}
615 615
 
616 616
 	/**
617
-	* Deletes all info in the table for an id
618
-	*
619
-	* @return String success or false
620
-	*
621
-	*/
617
+	 * Deletes all info in the table for an id
618
+	 *
619
+	 * @return String success or false
620
+	 *
621
+	 */
622 622
 	public function deleteLiveSpotterDataById($id)
623 623
 	{
624 624
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
625 625
 		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
626 626
         
627
-    		try {
627
+			try {
628 628
 			
629 629
 			$sth = $this->db->prepare($query);
630 630
 			$sth->execute(array(':id' => $id));
@@ -637,11 +637,11 @@  discard block
 block discarded – undo
637 637
 
638 638
 
639 639
 	/**
640
-	* Gets the aircraft ident within the last hour
641
-	*
642
-	* @return String the ident
643
-	*
644
-	*/
640
+	 * Gets the aircraft ident within the last hour
641
+	 *
642
+	 * @return String the ident
643
+	 *
644
+	 */
645 645
 	public function getIdentFromLastHour($ident)
646 646
 	{
647 647
 		global $globalDBdriver, $globalTimezone;
@@ -667,14 +667,14 @@  discard block
 block discarded – undo
667 667
 			$ident_result = $row['ident'];
668 668
 		}
669 669
 		return $ident_result;
670
-        }
670
+		}
671 671
 
672 672
 	/**
673
-	* Check recent aircraft
674
-	*
675
-	* @return String the ident
676
-	*
677
-	*/
673
+	 * Check recent aircraft
674
+	 *
675
+	 * @return String the ident
676
+	 *
677
+	 */
678 678
 	public function checkIdentRecent($ident)
679 679
 	{
680 680
 		global $globalDBdriver, $globalTimezone;
@@ -700,14 +700,14 @@  discard block
 block discarded – undo
700 700
 			$ident_result = $row['flightaware_id'];
701 701
 		}
702 702
 		return $ident_result;
703
-        }
703
+		}
704 704
 
705 705
 	/**
706
-	* Check recent aircraft by id
707
-	*
708
-	* @return String the ident
709
-	*
710
-	*/
706
+	 * Check recent aircraft by id
707
+	 *
708
+	 * @return String the ident
709
+	 *
710
+	 */
711 711
 	public function checkIdRecent($id)
712 712
 	{
713 713
 		global $globalDBdriver, $globalTimezone;
@@ -733,14 +733,14 @@  discard block
 block discarded – undo
733 733
 			$ident_result = $row['flightaware_id'];
734 734
 		}
735 735
 		return $ident_result;
736
-        }
736
+		}
737 737
 
738 738
 	/**
739
-	* Check recent aircraft by ModeS
740
-	*
741
-	* @return String the ModeS
742
-	*
743
-	*/
739
+	 * Check recent aircraft by ModeS
740
+	 *
741
+	 * @return String the ModeS
742
+	 *
743
+	 */
744 744
 	public function checkModeSRecent($modes)
745 745
 	{
746 746
 		global $globalDBdriver, $globalTimezone;
@@ -767,19 +767,19 @@  discard block
 block discarded – undo
767 767
 			$ident_result = $row['flightaware_id'];
768 768
 		}
769 769
 		return $ident_result;
770
-        }
770
+		}
771 771
 
772 772
 	/**
773
-	* Adds a new spotter data
774
-	*
775
-	* @param String $flightaware_id the ID from flightaware
776
-	* @param String $ident the flight ident
777
-	* @param String $aircraft_icao the aircraft type
778
-	* @param String $departure_airport_icao the departure airport
779
-	* @param String $arrival_airport_icao the arrival airport
780
-	* @return String success or false
781
-	*
782
-	*/
773
+	 * Adds a new spotter data
774
+	 *
775
+	 * @param String $flightaware_id the ID from flightaware
776
+	 * @param String $ident the flight ident
777
+	 * @param String $aircraft_icao the aircraft type
778
+	 * @param String $departure_airport_icao the departure airport
779
+	 * @param String $arrival_airport_icao the arrival airport
780
+	 * @return String success or false
781
+	 *
782
+	 */
783 783
 	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 = '')
784 784
 	{
785 785
 		global $globalURL, $globalArchive, $globalDebug;
@@ -915,10 +915,10 @@  discard block
 block discarded – undo
915 915
 		$arrival_airport_country = '';
916 916
 		
917 917
             	
918
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
919
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
920
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
921
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
918
+				if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
919
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
920
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
921
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
922 922
             	
923 923
 		$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) 
924 924
 		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)';
@@ -929,13 +929,13 @@  discard block
 block discarded – undo
929 929
 			
930 930
 			$sth = $this->db->prepare($query);
931 931
 			$sth->execute($query_values);
932
-                } catch(PDOException $e) {
933
-                	return "error : ".$e->getMessage();
934
-                }
932
+				} catch(PDOException $e) {
933
+					return "error : ".$e->getMessage();
934
+				}
935 935
 		if (isset($globalArchive) && $globalArchive && $putinarchive && !$noarchive) {
936
-		    if ($globalDebug) echo '(Add to SBS archive : ';
937
-		    $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);
938
-		    if ($globalDebug) echo $result.')';
936
+			if ($globalDebug) echo '(Add to SBS archive : ';
937
+			$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);
938
+			if ($globalDebug) echo $result.')';
939 939
 		}
940 940
 		return "success";
941 941
 
Please login to merge, or discard this patch.
Braces   +71 added lines, -24 removed lines patch added patch discarded remove patch
@@ -26,7 +26,9 @@  discard block
 block discarded – undo
26 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)) {
30
+			$filter = array_merge($filter,$globalFilter);
31
+		}
30 32
 		$filter_query_join = '';
31 33
 		$filter_query_where = '';
32 34
 		foreach($filters as $flt) {
@@ -71,8 +73,11 @@  discard block
 block discarded – undo
71 73
 				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
72 74
 			}
73 75
 		}
74
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
75
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
76
+		if ($filter_query_where == '' && $where) {
77
+			$filter_query_where = ' WHERE';
78
+		} elseif ($filter_query_where != '' && $and) {
79
+			$filter_query_where .= ' AND';
80
+		}
76 81
 		$filter_query = $filter_query_join.$filter_query_where;
77 82
 		return $filter_query;
78 83
 	}
@@ -108,7 +113,9 @@  discard block
 block discarded – undo
108 113
 			$orderby_query = ' '.$search_orderby_array[$sort]['sql'];
109 114
 		}
110 115
 
111
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
116
+		if (!isset($globalLiveInterval)) {
117
+			$globalLiveInterval = '200';
118
+		}
112 119
 		if ($globalDBdriver == 'mysql') {
113 120
 			//$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
114 121
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query.$orderby_query;
@@ -133,7 +140,9 @@  discard block
 block discarded – undo
133 140
 
134 141
 		$filter_query = $this->getFilter($filter,true,true);
135 142
 
136
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
143
+		if (!isset($globalLiveInterval)) {
144
+			$globalLiveInterval = '200';
145
+		}
137 146
 		if ($globalDBdriver == 'mysql') {
138 147
 //			$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate$orderby_query";
139 148
 //			$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';
@@ -180,7 +189,9 @@  discard block
 block discarded – undo
180 189
 
181 190
 		$filter_query = $this->getFilter($filter,true,true);
182 191
 
183
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
192
+		if (!isset($globalLiveInterval)) {
193
+			$globalLiveInterval = '200';
194
+		}
184 195
 		if ($globalDBdriver == 'mysql') {
185 196
 
186 197
 			$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 
@@ -220,7 +231,9 @@  discard block
 block discarded – undo
220 231
 		global $globalDBdriver, $globalLiveInterval;
221 232
 		$filter_query = $this->getFilter($filter,true,true);
222 233
 
223
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
234
+		if (!isset($globalLiveInterval)) {
235
+			$globalLiveInterval = '200';
236
+		}
224 237
 		if ($globalDBdriver == 'mysql') {
225 238
 			//$query  = 'SELECT COUNT(*) as nb FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query;
226 239
 			$query = 'SELECT COUNT(DISTINCT spotter_live.flightaware_id) as nb FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
@@ -250,7 +263,9 @@  discard block
 block discarded – undo
250 263
 	{
251 264
 		global $globalDBdriver, $globalLiveInterval;
252 265
 		$Spotter = new Spotter($this->db);
253
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
266
+		if (!isset($globalLiveInterval)) {
267
+			$globalLiveInterval = '200';
268
+		}
254 269
 		$filter_query = $this->getFilter($filter);
255 270
 
256 271
 		if (is_array($coord)) {
@@ -258,7 +273,9 @@  discard block
 block discarded – undo
258 273
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
259 274
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
260 275
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
261
-		} else return array();
276
+		} else {
277
+			return array();
278
+		}
262 279
 		if ($globalDBdriver == 'mysql') {
263 280
 			//$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.")";
264 281
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query;
@@ -449,11 +466,15 @@  discard block
 block discarded – undo
449 466
 		//$query  = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date';
450 467
 		if ($globalDBdriver == 'mysql') {
451 468
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
452
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
469
+			if ($liveinterval) {
470
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
471
+			}
453 472
 			$query .= ' ORDER BY date';
454 473
 		} else {
455 474
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
456
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
475
+			if ($liveinterval) {
476
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
477
+			}
457 478
 			$query .= ' ORDER BY date';
458 479
 		}
459 480
 
@@ -548,7 +569,9 @@  discard block
 block discarded – undo
548 569
 				$i++;
549 570
 				$j++;
550 571
 				if ($j == 30) {
551
-					if ($globalDebug) echo ".";
572
+					if ($globalDebug) {
573
+						echo ".";
574
+					}
552 575
 				    	try {
553 576
 						
554 577
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -856,7 +879,9 @@  discard block
 block discarded – undo
856 879
 			{
857 880
 				return false;
858 881
 			}
859
-		} else return '';
882
+		} else {
883
+			return '';
884
+		}
860 885
 
861 886
 		if ($longitude != '')
862 887
 		{
@@ -864,7 +889,9 @@  discard block
 block discarded – undo
864 889
 			{
865 890
 				return false;
866 891
 			}
867
-		} else return '';
892
+		} else {
893
+			return '';
894
+		}
868 895
 
869 896
 		if ($waypoints != '')
870 897
 		{
@@ -880,7 +907,9 @@  discard block
 block discarded – undo
880 907
 			{
881 908
 				return false;
882 909
 			}
883
-		} else $altitude = 0;
910
+		} else {
911
+			$altitude = 0;
912
+		}
884 913
 
885 914
 		if ($heading != '')
886 915
 		{
@@ -888,7 +917,9 @@  discard block
 block discarded – undo
888 917
 			{
889 918
 				return false;
890 919
 			}
891
-		} else $heading = 0;
920
+		} else {
921
+			$heading = 0;
922
+		}
892 923
 
893 924
 		if ($groundspeed != '')
894 925
 		{
@@ -896,9 +927,13 @@  discard block
 block discarded – undo
896 927
 			{
897 928
 				return false;
898 929
 			}
899
-		} else $groundspeed = 0;
930
+		} else {
931
+			$groundspeed = 0;
932
+		}
900 933
 		date_default_timezone_set('UTC');
901
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
934
+		if ($date == '') {
935
+			$date = date("Y-m-d H:i:s", time());
936
+		}
902 937
 
903 938
         
904 939
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -942,10 +977,18 @@  discard block
 block discarded – undo
942 977
 		$arrival_airport_country = '';
943 978
 		
944 979
             	
945
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
946
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
947
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
948
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
980
+            	if ($squawk == '' || $Common->isInteger($squawk) === false ) {
981
+            		$squawk = NULL;
982
+            	}
983
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) {
984
+            		$verticalrate = NULL;
985
+            	}
986
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
987
+            		$groundspeed = 0;
988
+            	}
989
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
990
+            		$heading = 0;
991
+            	}
949 992
             	
950 993
 		$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) 
951 994
 		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)';
@@ -960,9 +1003,13 @@  discard block
 block discarded – undo
960 1003
                 	return "error : ".$e->getMessage();
961 1004
                 }
962 1005
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
963
-		    if ($globalDebug) echo '(Add to SBS archive : ';
1006
+		    if ($globalDebug) {
1007
+		    	echo '(Add to SBS archive : ';
1008
+		    }
964 1009
 		    $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);
965
-		    if ($globalDebug) echo $result.')';
1010
+		    if ($globalDebug) {
1011
+		    	echo $result.')';
1012
+		    }
966 1013
 		}
967 1014
 		return "success";
968 1015
 
Please login to merge, or discard this 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.Spotter.php 4 patches
Doc Comments   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	/**
16 16
 	* Get SQL query part for filter used
17 17
 	* @param Array $filter the filter
18
-	* @return Array the SQL part
18
+	* @return string the SQL part
19 19
 	*/
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter;
@@ -8612,6 +8612,7 @@  discard block
 block discarded – undo
8612 8612
 	/**
8613 8613
 	* Counts all hours
8614 8614
 	*
8615
+	* @param string $orderby
8615 8616
 	* @return Array the hour list
8616 8617
 	*
8617 8618
 	*/
@@ -8677,6 +8678,7 @@  discard block
 block discarded – undo
8677 8678
 	/**
8678 8679
 	* Counts all hours
8679 8680
 	*
8681
+	* @param string $orderby
8680 8682
 	* @return Array the hour list
8681 8683
 	*
8682 8684
 	*/
@@ -9501,7 +9503,7 @@  discard block
 block discarded – undo
9501 9503
 	/**
9502 9504
 	* Parses the direction degrees to working
9503 9505
 	*
9504
-	* @param Float $direction the direction in degrees
9506
+	* @param integer $direction the direction in degrees
9505 9507
 	* @return Array the direction information
9506 9508
 	*
9507 9509
 	*/
Please login to merge, or discard this patch.
Indentation   +1270 added lines, -1270 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 	}
14 14
 
15 15
 	/**
16
-	* Get SQL query part for filter used
17
-	* @param Array $filter the filter
18
-	* @return Array the SQL part
19
-	*/
16
+	 * Get SQL query part for filter used
17
+	 * @param Array $filter the filter
18
+	 * @return Array the SQL part
19
+	 */
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
22 22
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName],$filter);
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
 	}
56 56
 
57 57
 	/**
58
-	* Executes the SQL statements to get the spotter information
59
-	*
60
-	* @param String $query the SQL query
61
-	* @param Array $params parameter of the query
62
-	* @param String $limitQuery the limit query
63
-	* @return Array the spotter information
64
-	*
65
-	*/
58
+	 * Executes the SQL statements to get the spotter information
59
+	 *
60
+	 * @param String $query the SQL query
61
+	 * @param Array $params parameter of the query
62
+	 * @param String $limitQuery the limit query
63
+	 * @return Array the spotter information
64
+	 *
65
+	 */
66 66
 	public function getDataFromDB($query, $params = array(), $limitQuery = '')
67 67
 	{
68 68
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
@@ -226,11 +226,11 @@  discard block
 block discarded – undo
226 226
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
227 227
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
228 228
 					} else $temp_array['aircraft_shadow'] = 'default.png';
229
-                                } else {
230
-                            		$temp_array['aircraft_shadow'] = 'default.png';
229
+								} else {
230
+									$temp_array['aircraft_shadow'] = 'default.png';
231 231
 					$temp_array['aircraft_name'] = 'N/A';
232 232
 					$temp_array['aircraft_manufacturer'] = 'N/A';
233
-                            	}
233
+								}
234 234
 			}
235 235
 			$fromsource = NULL;
236 236
 			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
@@ -413,11 +413,11 @@  discard block
 block discarded – undo
413 413
 	
414 414
 	
415 415
 	/**
416
-	* Gets all the spotter information
417
-	*
418
-	* @return Array the spotter information
419
-	*
420
-	*/
416
+	 * Gets all the spotter information
417
+	 *
418
+	 * @return Array the spotter information
419
+	 *
420
+	 */
421 421
 	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
422 422
 	{
423 423
 		global $globalTimezone, $globalDBdriver;
@@ -764,11 +764,11 @@  discard block
 block discarded – undo
764 764
 	
765 765
 	
766 766
 	/**
767
-	* Gets all the spotter information based on the latest data entry
768
-	*
769
-	* @return Array the spotter information
770
-	*
771
-	*/
767
+	 * Gets all the spotter information based on the latest data entry
768
+	 *
769
+	 * @return Array the spotter information
770
+	 *
771
+	 */
772 772
 	public function getLatestSpotterData($limit = '', $sort = '', $filter = array())
773 773
 	{
774 774
 		global $global_query;
@@ -807,12 +807,12 @@  discard block
 block discarded – undo
807 807
 	}
808 808
     
809 809
     
810
-    /**
811
-	* Gets all the spotter information based on a user's latitude and longitude
812
-	*
813
-	* @return Array the spotter information
814
-	*
815
-	*/
810
+	/**
811
+	 * Gets all the spotter information based on a user's latitude and longitude
812
+	 *
813
+	 * @return Array the spotter information
814
+	 *
815
+	 */
816 816
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
817 817
 	{
818 818
 		date_default_timezone_set('UTC');
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
 				return false;
841 841
 			}
842 842
 		}
843
-    		$additional_query = '';
843
+			$additional_query = '';
844 844
 		if ($interval != "")
845 845
 		{
846 846
 			if (!is_string($interval))
@@ -880,12 +880,12 @@  discard block
 block discarded – undo
880 880
 	}
881 881
     
882 882
     
883
-    /**
884
-	* Gets all the spotter information sorted by the newest aircraft type
885
-	*
886
-	* @return Array the spotter information
887
-	*
888
-	*/
883
+	/**
884
+	 * Gets all the spotter information sorted by the newest aircraft type
885
+	 *
886
+	 * @return Array the spotter information
887
+	 *
888
+	 */
889 889
 	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
890 890
 	{
891 891
 		global $global_query;
@@ -926,11 +926,11 @@  discard block
 block discarded – undo
926 926
     
927 927
     
928 928
 	/**
929
-	* Gets all the spotter information sorted by the newest aircraft registration
930
-	*
931
-	* @return Array the spotter information
932
-	*
933
-	*/
929
+	 * Gets all the spotter information sorted by the newest aircraft registration
930
+	 *
931
+	 * @return Array the spotter information
932
+	 *
933
+	 */
934 934
 	public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array())
935 935
 	{
936 936
 		global $global_query;
@@ -970,11 +970,11 @@  discard block
 block discarded – undo
970 970
 
971 971
 
972 972
 	/**
973
-	* Gets all the spotter information sorted by the newest airline
974
-	*
975
-	* @return Array the spotter information
976
-	*
977
-	*/
973
+	 * Gets all the spotter information sorted by the newest airline
974
+	 *
975
+	 * @return Array the spotter information
976
+	 *
977
+	 */
978 978
 	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
979 979
 	{
980 980
 		global $global_query;
@@ -1013,12 +1013,12 @@  discard block
 block discarded – undo
1013 1013
 	}
1014 1014
     
1015 1015
     
1016
-    /**
1017
-	* Gets all the spotter information sorted by the newest departure airport
1018
-	*
1019
-	* @return Array the spotter information
1020
-	*
1021
-	*/
1016
+	/**
1017
+	 * Gets all the spotter information sorted by the newest departure airport
1018
+	 *
1019
+	 * @return Array the spotter information
1020
+	 *
1021
+	 */
1022 1022
 	public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array())
1023 1023
 	{
1024 1024
 		global $global_query;
@@ -1060,11 +1060,11 @@  discard block
 block discarded – undo
1060 1060
 
1061 1061
 
1062 1062
 	/**
1063
-	* Gets all the spotter information sorted by the newest arrival airport
1064
-	*
1065
-	* @return Array the spotter information
1066
-	*
1067
-	*/
1063
+	 * Gets all the spotter information sorted by the newest arrival airport
1064
+	 *
1065
+	 * @return Array the spotter information
1066
+	 *
1067
+	 */
1068 1068
 	public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array())
1069 1069
 	{
1070 1070
 		global $global_query;
@@ -1103,11 +1103,11 @@  discard block
 block discarded – undo
1103 1103
 	
1104 1104
 
1105 1105
 	/**
1106
-	* Gets all the spotter information based on the spotter id
1107
-	*
1108
-	* @return Array the spotter information
1109
-	*
1110
-	*/
1106
+	 * Gets all the spotter information based on the spotter id
1107
+	 *
1108
+	 * @return Array the spotter information
1109
+	 *
1110
+	 */
1111 1111
 	public function getSpotterDataByID($id = '')
1112 1112
 	{
1113 1113
 		global $global_query;
@@ -1129,11 +1129,11 @@  discard block
 block discarded – undo
1129 1129
 	
1130 1130
 	
1131 1131
 	/**
1132
-	* Gets all the spotter information based on the callsign
1133
-	*
1134
-	* @return Array the spotter information
1135
-	*
1136
-	*/
1132
+	 * Gets all the spotter information based on the callsign
1133
+	 *
1134
+	 * @return Array the spotter information
1135
+	 *
1136
+	 */
1137 1137
 	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
1138 1138
 	{
1139 1139
 		global $global_query;
@@ -1186,11 +1186,11 @@  discard block
 block discarded – undo
1186 1186
 	
1187 1187
 	
1188 1188
 	/**
1189
-	* Gets all the spotter information based on the aircraft type
1190
-	*
1191
-	* @return Array the spotter information
1192
-	*
1193
-	*/
1189
+	 * Gets all the spotter information based on the aircraft type
1190
+	 *
1191
+	 * @return Array the spotter information
1192
+	 *
1193
+	 */
1194 1194
 	public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array())
1195 1195
 	{
1196 1196
 		global $global_query;
@@ -1244,11 +1244,11 @@  discard block
 block discarded – undo
1244 1244
 	
1245 1245
 	
1246 1246
 	/**
1247
-	* Gets all the spotter information based on the aircraft registration
1248
-	*
1249
-	* @return Array the spotter information
1250
-	*
1251
-	*/
1247
+	 * Gets all the spotter information based on the aircraft registration
1248
+	 *
1249
+	 * @return Array the spotter information
1250
+	 *
1251
+	 */
1252 1252
 	public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array())
1253 1253
 	{
1254 1254
 		global $global_query;
@@ -1305,11 +1305,11 @@  discard block
 block discarded – undo
1305 1305
 	
1306 1306
 	
1307 1307
 	/**
1308
-	* Gets all the spotter information based on the airline
1309
-	*
1310
-	* @return Array the spotter information
1311
-	*
1312
-	*/
1308
+	 * Gets all the spotter information based on the airline
1309
+	 *
1310
+	 * @return Array the spotter information
1311
+	 *
1312
+	 */
1313 1313
 	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1314 1314
 	{
1315 1315
 		global $global_query;
@@ -1362,11 +1362,11 @@  discard block
 block discarded – undo
1362 1362
 	
1363 1363
 	
1364 1364
 	/**
1365
-	* Gets all the spotter information based on the airport
1366
-	*
1367
-	* @return Array the spotter information
1368
-	*
1369
-	*/
1365
+	 * Gets all the spotter information based on the airport
1366
+	 *
1367
+	 * @return Array the spotter information
1368
+	 *
1369
+	 */
1370 1370
 	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1371 1371
 	{
1372 1372
 		global $global_query;
@@ -1420,11 +1420,11 @@  discard block
 block discarded – undo
1420 1420
 
1421 1421
 
1422 1422
 	/**
1423
-	* Gets all the spotter information based on the date
1424
-	*
1425
-	* @return Array the spotter information
1426
-	*
1427
-	*/
1423
+	 * Gets all the spotter information based on the date
1424
+	 *
1425
+	 * @return Array the spotter information
1426
+	 *
1427
+	 */
1428 1428
 	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1429 1429
 	{
1430 1430
 		global $global_query, $globalTimezone, $globalDBdriver;
@@ -1485,11 +1485,11 @@  discard block
 block discarded – undo
1485 1485
 
1486 1486
 
1487 1487
 	/**
1488
-	* Gets all the spotter information based on the country name
1489
-	*
1490
-	* @return Array the spotter information
1491
-	*
1492
-	*/
1488
+	 * Gets all the spotter information based on the country name
1489
+	 *
1490
+	 * @return Array the spotter information
1491
+	 *
1492
+	 */
1493 1493
 	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1494 1494
 	{
1495 1495
 		global $global_query;
@@ -1543,11 +1543,11 @@  discard block
 block discarded – undo
1543 1543
 	
1544 1544
 	
1545 1545
 	/**
1546
-	* Gets all the spotter information based on the manufacturer name
1547
-	*
1548
-	* @return Array the spotter information
1549
-	*
1550
-	*/
1546
+	 * Gets all the spotter information based on the manufacturer name
1547
+	 *
1548
+	 * @return Array the spotter information
1549
+	 *
1550
+	 */
1551 1551
 	public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array())
1552 1552
 	{
1553 1553
 		global $global_query;
@@ -1603,13 +1603,13 @@  discard block
 block discarded – undo
1603 1603
   
1604 1604
   
1605 1605
 	/**
1606
-	* Gets a list of all aircraft that take a route
1607
-	*
1608
-	* @param String $departure_airport_icao ICAO code of departure airport
1609
-	* @param String $arrival_airport_icao ICAO code of arrival airport
1610
-	* @return Array the spotter information
1611
-	*
1612
-	*/
1606
+	 * Gets a list of all aircraft that take a route
1607
+	 *
1608
+	 * @param String $departure_airport_icao ICAO code of departure airport
1609
+	 * @param String $arrival_airport_icao ICAO code of arrival airport
1610
+	 * @return Array the spotter information
1611
+	 *
1612
+	 */
1613 1613
 	public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array())
1614 1614
 	{
1615 1615
 		global $global_query;
@@ -1676,11 +1676,11 @@  discard block
 block discarded – undo
1676 1676
 	
1677 1677
 	
1678 1678
 	/**
1679
-	* Gets all the spotter information based on the special column in the table
1680
-	*
1681
-	* @return Array the spotter information
1682
-	*
1683
-	*/
1679
+	 * Gets all the spotter information based on the special column in the table
1680
+	 *
1681
+	 * @return Array the spotter information
1682
+	 *
1683
+	 */
1684 1684
 	public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array())
1685 1685
 	{
1686 1686
 		global $global_query;
@@ -1719,11 +1719,11 @@  discard block
 block discarded – undo
1719 1719
 	}
1720 1720
 
1721 1721
 	/**
1722
-	* Gets all the highlight based on a aircraft registration
1723
-	*
1724
-	* @return String the highlight text
1725
-	*
1726
-	*/
1722
+	 * Gets all the highlight based on a aircraft registration
1723
+	 *
1724
+	 * @return String the highlight text
1725
+	 *
1726
+	 */
1727 1727
 	public function getHighlightByRegistration($registration,$filter = array())
1728 1728
 	{
1729 1729
 		global $global_query;
@@ -1745,13 +1745,13 @@  discard block
 block discarded – undo
1745 1745
 
1746 1746
 	
1747 1747
 	/**
1748
-	* Gets the squawk usage from squawk code
1749
-	*
1750
-	* @param String $squawk squawk code
1751
-	* @param String $country country
1752
-	* @return String usage
1753
-	*
1754
-	*/
1748
+	 * Gets the squawk usage from squawk code
1749
+	 *
1750
+	 * @param String $squawk squawk code
1751
+	 * @param String $country country
1752
+	 * @return String usage
1753
+	 *
1754
+	 */
1755 1755
 	public function getSquawkUsage($squawk = '',$country = 'FR')
1756 1756
 	{
1757 1757
 		
@@ -1772,12 +1772,12 @@  discard block
 block discarded – undo
1772 1772
 	}
1773 1773
 
1774 1774
 	/**
1775
-	* Gets the airport icao from the iata
1776
-	*
1777
-	* @param String $airport_iata the iata code of the airport
1778
-	* @return String airport iata
1779
-	*
1780
-	*/
1775
+	 * Gets the airport icao from the iata
1776
+	 *
1777
+	 * @param String $airport_iata the iata code of the airport
1778
+	 * @return String airport iata
1779
+	 *
1780
+	 */
1781 1781
 	public function getAirportIcao($airport_iata = '')
1782 1782
 	{
1783 1783
 		
@@ -1797,14 +1797,14 @@  discard block
 block discarded – undo
1797 1797
 	}
1798 1798
 
1799 1799
 	/**
1800
-	* Gets the airport distance
1801
-	*
1802
-	* @param String $airport_icao the icao code of the airport
1803
-	* @param Float $latitude the latitude
1804
-	* @param Float $longitude the longitude
1805
-	* @return Float distance to the airport
1806
-	*
1807
-	*/
1800
+	 * Gets the airport distance
1801
+	 *
1802
+	 * @param String $airport_icao the icao code of the airport
1803
+	 * @param Float $latitude the latitude
1804
+	 * @param Float $longitude the longitude
1805
+	 * @return Float distance to the airport
1806
+	 *
1807
+	 */
1808 1808
 	public function getAirportDistance($airport_icao,$latitude,$longitude)
1809 1809
 	{
1810 1810
 		
@@ -1825,12 +1825,12 @@  discard block
 block discarded – undo
1825 1825
 	}
1826 1826
 	
1827 1827
 	/**
1828
-	* Gets the airport info based on the icao
1829
-	*
1830
-	* @param String $airport the icao code of the airport
1831
-	* @return Array airport information
1832
-	*
1833
-	*/
1828
+	 * Gets the airport info based on the icao
1829
+	 *
1830
+	 * @param String $airport the icao code of the airport
1831
+	 * @return Array airport information
1832
+	 *
1833
+	 */
1834 1834
 	public function getAllAirportInfo($airport = '')
1835 1835
 	{
1836 1836
 		
@@ -1876,12 +1876,12 @@  discard block
 block discarded – undo
1876 1876
 	}
1877 1877
 	
1878 1878
 	/**
1879
-	* Gets the airport info based on the country
1880
-	*
1881
-	* @param Array $countries Airports countries
1882
-	* @return Array airport information
1883
-	*
1884
-	*/
1879
+	 * Gets the airport info based on the country
1880
+	 *
1881
+	 * @param Array $countries Airports countries
1882
+	 * @return Array airport information
1883
+	 *
1884
+	 */
1885 1885
 	public function getAllAirportInfobyCountry($countries)
1886 1886
 	{
1887 1887
 		$lst_countries = '';
@@ -1919,12 +1919,12 @@  discard block
 block discarded – undo
1919 1919
 	}
1920 1920
 	
1921 1921
 	/**
1922
-	* Gets airports info based on the coord
1923
-	*
1924
-	* @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1925
-	* @return Array airport information
1926
-	*
1927
-	*/
1922
+	 * Gets airports info based on the coord
1923
+	 *
1924
+	 * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1925
+	 * @return Array airport information
1926
+	 *
1927
+	 */
1928 1928
 	public function getAllAirportInfobyCoord($coord)
1929 1929
 	{
1930 1930
 		global $globalDBdriver;
@@ -1955,12 +1955,12 @@  discard block
 block discarded – undo
1955 1955
 	}
1956 1956
 
1957 1957
 	/**
1958
-	* Gets waypoints info based on the coord
1959
-	*
1960
-	* @param Array $coord waypoints coord
1961
-	* @return Array airport information
1962
-	*
1963
-	*/
1958
+	 * Gets waypoints info based on the coord
1959
+	 *
1960
+	 * @param Array $coord waypoints coord
1961
+	 * @return Array airport information
1962
+	 *
1963
+	 */
1964 1964
 	public function getAllWaypointsInfobyCoord($coord)
1965 1965
 	{
1966 1966
 		if (is_array($coord)) {
@@ -1994,12 +1994,12 @@  discard block
 block discarded – undo
1994 1994
 	
1995 1995
 	
1996 1996
 	/**
1997
-	* Gets the airline info based on the icao code or iata code
1998
-	*
1999
-	* @param String $airline_icao the iata code of the airport
2000
-	* @return Array airport information
2001
-	*
2002
-	*/
1997
+	 * Gets the airline info based on the icao code or iata code
1998
+	 *
1999
+	 * @param String $airline_icao the iata code of the airport
2000
+	 * @return Array airport information
2001
+	 *
2002
+	 */
2003 2003
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2004 2004
 	{
2005 2005
 		global $globalUseRealAirlines;
@@ -2030,7 +2030,7 @@  discard block
 block discarded – undo
2030 2030
 			} else {
2031 2031
 				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2032 2032
 			}
2033
-                        /*
2033
+						/*
2034 2034
 			$airline_array = array();
2035 2035
 			$temp_array = array();
2036 2036
 		
@@ -2062,12 +2062,12 @@  discard block
 block discarded – undo
2062 2062
 	
2063 2063
 	
2064 2064
 	/**
2065
-	* Gets the aircraft info based on the aircraft type
2066
-	*
2067
-	* @param String $aircraft_type the aircraft type
2068
-	* @return Array aircraft information
2069
-	*
2070
-	*/
2065
+	 * Gets the aircraft info based on the aircraft type
2066
+	 *
2067
+	 * @param String $aircraft_type the aircraft type
2068
+	 * @return Array aircraft information
2069
+	 *
2070
+	 */
2071 2071
 	public function getAllAircraftInfo($aircraft_type)
2072 2072
 	{
2073 2073
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2099,12 +2099,12 @@  discard block
 block discarded – undo
2099 2099
 	}
2100 2100
 
2101 2101
 	/**
2102
-	* Gets the aircraft icao based on the aircraft name/type
2103
-	*
2104
-	* @param String $aircraft_type the aircraft type
2105
-	* @return String aircraft information
2106
-	*
2107
-	*/
2102
+	 * Gets the aircraft icao based on the aircraft name/type
2103
+	 *
2104
+	 * @param String $aircraft_type the aircraft type
2105
+	 * @return String aircraft information
2106
+	 *
2107
+	 */
2108 2108
 	public function getAircraftIcao($aircraft_type)
2109 2109
 	{
2110 2110
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2129,12 +2129,12 @@  discard block
 block discarded – undo
2129 2129
 	}
2130 2130
 	
2131 2131
 	/**
2132
-	* Gets the aircraft info based on the aircraft ident
2133
-	*
2134
-	* @param String $aircraft_modes the aircraft ident (hex)
2135
-	* @return String aircraft type
2136
-	*
2137
-	*/
2132
+	 * Gets the aircraft info based on the aircraft ident
2133
+	 *
2134
+	 * @param String $aircraft_modes the aircraft ident (hex)
2135
+	 * @return String aircraft type
2136
+	 *
2137
+	 */
2138 2138
 	public function getAllAircraftType($aircraft_modes)
2139 2139
 	{
2140 2140
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -2152,12 +2152,12 @@  discard block
 block discarded – undo
2152 2152
 	}
2153 2153
 
2154 2154
 	/**
2155
-	* Gets correct aircraft operator corde
2156
-	*
2157
-	* @param String $operator the aircraft operator code (callsign)
2158
-	* @return String aircraft operator code
2159
-	*
2160
-	*/
2155
+	 * Gets correct aircraft operator corde
2156
+	 *
2157
+	 * @param String $operator the aircraft operator code (callsign)
2158
+	 * @return String aircraft operator code
2159
+	 *
2160
+	 */
2161 2161
 	public function getOperator($operator)
2162 2162
 	{
2163 2163
 		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
@@ -2174,16 +2174,16 @@  discard block
 block discarded – undo
2174 2174
 	}
2175 2175
 
2176 2176
 	/**
2177
-	* Gets the aircraft route based on the aircraft callsign
2178
-	*
2179
-	* @param String $callsign the aircraft callsign
2180
-	* @return Array aircraft type
2181
-	*
2182
-	*/
2177
+	 * Gets the aircraft route based on the aircraft callsign
2178
+	 *
2179
+	 * @param String $callsign the aircraft callsign
2180
+	 * @return Array aircraft type
2181
+	 *
2182
+	 */
2183 2183
 	public function getRouteInfo($callsign)
2184 2184
 	{
2185 2185
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2186
-                if ($callsign == '') return array();
2186
+				if ($callsign == '') return array();
2187 2187
 		$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";
2188 2188
 		
2189 2189
 		$sth = $this->db->prepare($query);
@@ -2197,12 +2197,12 @@  discard block
 block discarded – undo
2197 2197
 	}
2198 2198
 	
2199 2199
 	/**
2200
-	* Gets the aircraft info based on the aircraft registration
2201
-	*
2202
-	* @param String $registration the aircraft registration
2203
-	* @return Array aircraft information
2204
-	*
2205
-	*/
2200
+	 * Gets the aircraft info based on the aircraft registration
2201
+	 *
2202
+	 * @param String $registration the aircraft registration
2203
+	 * @return Array aircraft information
2204
+	 *
2205
+	 */
2206 2206
 	public function getAircraftInfoByRegistration($registration)
2207 2207
 	{
2208 2208
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2229,12 +2229,12 @@  discard block
 block discarded – undo
2229 2229
 	}
2230 2230
 	
2231 2231
 	/**
2232
-	* Gets the aircraft owner & base based on the aircraft registration
2233
-	*
2234
-	* @param String $registration the aircraft registration
2235
-	* @return Array aircraft information
2236
-	*
2237
-	*/
2232
+	 * Gets the aircraft owner & base based on the aircraft registration
2233
+	 *
2234
+	 * @param String $registration the aircraft registration
2235
+	 * @return Array aircraft information
2236
+	 *
2237
+	 */
2238 2238
 	public function getAircraftOwnerByRegistration($registration)
2239 2239
 	{
2240 2240
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2251,11 +2251,11 @@  discard block
 block discarded – undo
2251 2251
 	
2252 2252
   
2253 2253
   /**
2254
-	* Gets all flights (but with only little info)
2255
-	*
2256
-	* @return Array basic flight information
2257
-	*
2258
-	*/
2254
+   * Gets all flights (but with only little info)
2255
+   *
2256
+   * @return Array basic flight information
2257
+   *
2258
+   */
2259 2259
 	public function getAllFlightsforSitemap()
2260 2260
 	{
2261 2261
 		//$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 ";
@@ -2263,7 +2263,7 @@  discard block
 block discarded – undo
2263 2263
 		
2264 2264
 		$sth = $this->db->prepare($query);
2265 2265
 		$sth->execute();
2266
-                  /*
2266
+				  /*
2267 2267
 		$flight_array = array();
2268 2268
 		$temp_array = array();
2269 2269
 		
@@ -2285,11 +2285,11 @@  discard block
 block discarded – undo
2285 2285
 	}
2286 2286
   
2287 2287
 	/**
2288
-	* Gets a list of all aircraft manufacturers
2289
-	*
2290
-	* @return Array list of aircraft types
2291
-	*
2292
-	*/
2288
+	 * Gets a list of all aircraft manufacturers
2289
+	 *
2290
+	 * @return Array list of aircraft types
2291
+	 *
2292
+	 */
2293 2293
 	public function getAllManufacturers()
2294 2294
 	{
2295 2295
 		/*
@@ -2318,11 +2318,11 @@  discard block
 block discarded – undo
2318 2318
   
2319 2319
   
2320 2320
   /**
2321
-	* Gets a list of all aircraft types
2322
-	*
2323
-	* @return Array list of aircraft types
2324
-	*
2325
-	*/
2321
+   * Gets a list of all aircraft types
2322
+   *
2323
+   * @return Array list of aircraft types
2324
+   *
2325
+   */
2326 2326
 	public function getAllAircraftTypes($filters = array())
2327 2327
 	{
2328 2328
 		/*
@@ -2355,11 +2355,11 @@  discard block
 block discarded – undo
2355 2355
 	
2356 2356
 	
2357 2357
 	/**
2358
-	* Gets a list of all aircraft registrations
2359
-	*
2360
-	* @return Array list of aircraft registrations
2361
-	*
2362
-	*/
2358
+	 * Gets a list of all aircraft registrations
2359
+	 *
2360
+	 * @return Array list of aircraft registrations
2361
+	 *
2362
+	 */
2363 2363
 	public function getAllAircraftRegistrations($filters = array())
2364 2364
 	{
2365 2365
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2384,12 +2384,12 @@  discard block
 block discarded – undo
2384 2384
 	}
2385 2385
 
2386 2386
 	/**
2387
-	* Gets all source name
2388
-	*
2389
-	* @param String type format of source
2390
-	* @return Array list of source name
2391
-	*
2392
-	*/
2387
+	 * Gets all source name
2388
+	 *
2389
+	 * @param String type format of source
2390
+	 * @return Array list of source name
2391
+	 *
2392
+	 */
2393 2393
 	public function getAllSourceName($type = '',$filters = array())
2394 2394
 	{
2395 2395
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2420,11 +2420,11 @@  discard block
 block discarded – undo
2420 2420
 
2421 2421
 
2422 2422
 	/**
2423
-	* Gets a list of all airline names
2424
-	*
2425
-	* @return Array list of airline names
2426
-	*
2427
-	*/
2423
+	 * Gets a list of all airline names
2424
+	 *
2425
+	 * @return Array list of airline names
2426
+	 *
2427
+	 */
2428 2428
 	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2429 2429
 	{
2430 2430
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2474,11 +2474,11 @@  discard block
 block discarded – undo
2474 2474
 	
2475 2475
 	
2476 2476
 	/**
2477
-	* Gets a list of all airline countries
2478
-	*
2479
-	* @return Array list of airline countries
2480
-	*
2481
-	*/
2477
+	 * Gets a list of all airline countries
2478
+	 *
2479
+	 * @return Array list of airline countries
2480
+	 *
2481
+	 */
2482 2482
 	public function getAllAirlineCountries($filters = array())
2483 2483
 	{
2484 2484
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2506,11 +2506,11 @@  discard block
 block discarded – undo
2506 2506
 	
2507 2507
 	
2508 2508
 	/**
2509
-	* Gets a list of all departure & arrival names
2510
-	*
2511
-	* @return Array list of airport names
2512
-	*
2513
-	*/
2509
+	 * Gets a list of all departure & arrival names
2510
+	 *
2511
+	 * @return Array list of airport names
2512
+	 *
2513
+	 */
2514 2514
 	public function getAllAirportNames($filters = array())
2515 2515
 	{
2516 2516
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2559,11 +2559,11 @@  discard block
 block discarded – undo
2559 2559
 	
2560 2560
 	
2561 2561
 	/**
2562
-	* Gets a list of all departure & arrival airport countries
2563
-	*
2564
-	* @return Array list of airport countries
2565
-	*
2566
-	*/
2562
+	 * Gets a list of all departure & arrival airport countries
2563
+	 *
2564
+	 * @return Array list of airport countries
2565
+	 *
2566
+	 */
2567 2567
 	public function getAllAirportCountries($filters = array())
2568 2568
 	{
2569 2569
 		$airport_array = array();
@@ -2611,11 +2611,11 @@  discard block
 block discarded – undo
2611 2611
 	
2612 2612
 	
2613 2613
 	/**
2614
-	* Gets a list of all countries (airline, departure airport & arrival airport)
2615
-	*
2616
-	* @return Array list of countries
2617
-	*
2618
-	*/
2614
+	 * Gets a list of all countries (airline, departure airport & arrival airport)
2615
+	 *
2616
+	 * @return Array list of countries
2617
+	 *
2618
+	 */
2619 2619
 	public function getAllCountries($filters = array())
2620 2620
 	{
2621 2621
 		$Connection= new Connection($this->db);
@@ -2692,11 +2692,11 @@  discard block
 block discarded – undo
2692 2692
 	
2693 2693
 	
2694 2694
 	/**
2695
-	* Gets a list of all idents/callsigns
2696
-	*
2697
-	* @return Array list of ident/callsign names
2698
-	*
2699
-	*/
2695
+	 * Gets a list of all idents/callsigns
2696
+	 *
2697
+	 * @return Array list of ident/callsign names
2698
+	 *
2699
+	 */
2700 2700
 	public function getAllIdents($filters = array())
2701 2701
 	{
2702 2702
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2720,9 +2720,9 @@  discard block
 block discarded – undo
2720 2720
 	}
2721 2721
 
2722 2722
 	/**
2723
-	* Get a list of flights from airport since 7 days
2724
-	* @return Array number, icao, name and city of airports
2725
-	*/
2723
+	 * Get a list of flights from airport since 7 days
2724
+	 * @return Array number, icao, name and city of airports
2725
+	 */
2726 2726
 
2727 2727
 	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
2728 2728
 		global $globalTimezone, $globalDBdriver;
@@ -2753,9 +2753,9 @@  discard block
 block discarded – undo
2753 2753
 	}
2754 2754
 
2755 2755
 	/**
2756
-	* Get a list of flights from airport since 7 days
2757
-	* @return Array number, icao, name and city of airports
2758
-	*/
2756
+	 * Get a list of flights from airport since 7 days
2757
+	 * @return Array number, icao, name and city of airports
2758
+	 */
2759 2759
 
2760 2760
 	public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') {
2761 2761
 		global $globalTimezone, $globalDBdriver;
@@ -2785,9 +2785,9 @@  discard block
 block discarded – undo
2785 2785
 	}
2786 2786
 
2787 2787
 	/**
2788
-	* Get a list of flights from detected airport since 7 days
2789
-	* @return Array number, icao, name and city of airports
2790
-	*/
2788
+	 * Get a list of flights from detected airport since 7 days
2789
+	 * @return Array number, icao, name and city of airports
2790
+	 */
2791 2791
 
2792 2792
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
2793 2793
 		global $globalTimezone, $globalDBdriver;
@@ -2825,9 +2825,9 @@  discard block
 block discarded – undo
2825 2825
 	}
2826 2826
 
2827 2827
 	/**
2828
-	* Get a list of flights from detected airport since 7 days
2829
-	* @return Array number, icao, name and city of airports
2830
-	*/
2828
+	 * Get a list of flights from detected airport since 7 days
2829
+	 * @return Array number, icao, name and city of airports
2830
+	 */
2831 2831
 
2832 2832
 	public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') {
2833 2833
 		global $globalTimezone, $globalDBdriver;
@@ -2869,9 +2869,9 @@  discard block
 block discarded – undo
2869 2869
 
2870 2870
 
2871 2871
 	/**
2872
-	* Get a list of flights to airport since 7 days
2873
-	* @return Array number, icao, name and city of airports
2874
-	*/
2872
+	 * Get a list of flights to airport since 7 days
2873
+	 * @return Array number, icao, name and city of airports
2874
+	 */
2875 2875
 
2876 2876
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
2877 2877
 		global $globalTimezone, $globalDBdriver;
@@ -2904,9 +2904,9 @@  discard block
 block discarded – undo
2904 2904
 
2905 2905
 
2906 2906
 	/**
2907
-	* Get a list of flights detected to airport since 7 days
2908
-	* @return Array number, icao, name and city of airports
2909
-	*/
2907
+	 * Get a list of flights detected to airport since 7 days
2908
+	 * @return Array number, icao, name and city of airports
2909
+	 */
2910 2910
 
2911 2911
 	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
2912 2912
 		global $globalTimezone, $globalDBdriver;
@@ -2947,9 +2947,9 @@  discard block
 block discarded – undo
2947 2947
 
2948 2948
 
2949 2949
 	/**
2950
-	* Get a list of flights to airport since 7 days
2951
-	* @return Array number, icao, name and city of airports
2952
-	*/
2950
+	 * Get a list of flights to airport since 7 days
2951
+	 * @return Array number, icao, name and city of airports
2952
+	 */
2953 2953
 
2954 2954
 	public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') {
2955 2955
 		global $globalTimezone, $globalDBdriver;
@@ -2981,9 +2981,9 @@  discard block
 block discarded – undo
2981 2981
 
2982 2982
 
2983 2983
 	/**
2984
-	* Get a list of flights detected to airport since 7 days
2985
-	* @return Array number, icao, name and city of airports
2986
-	*/
2984
+	 * Get a list of flights detected to airport since 7 days
2985
+	 * @return Array number, icao, name and city of airports
2986
+	 */
2987 2987
 
2988 2988
 	public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') {
2989 2989
 		global $globalTimezone, $globalDBdriver;
@@ -3027,11 +3027,11 @@  discard block
 block discarded – undo
3027 3027
 
3028 3028
 
3029 3029
 	/**
3030
-	* Gets a list of all dates
3031
-	*
3032
-	* @return Array list of date names
3033
-	*
3034
-	*/
3030
+	 * Gets a list of all dates
3031
+	 *
3032
+	 * @return Array list of date names
3033
+	 *
3034
+	 */
3035 3035
 	public function getAllDates()
3036 3036
 	{
3037 3037
 		global $globalTimezone, $globalDBdriver;
@@ -3072,11 +3072,11 @@  discard block
 block discarded – undo
3072 3072
 	
3073 3073
 	
3074 3074
 	/**
3075
-	* Gets all route combinations
3076
-	*
3077
-	* @return Array the route list
3078
-	*
3079
-	*/
3075
+	 * Gets all route combinations
3076
+	 *
3077
+	 * @return Array the route list
3078
+	 *
3079
+	 */
3080 3080
 	public function getAllRoutes()
3081 3081
 	{
3082 3082
 		$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 
@@ -3102,13 +3102,13 @@  discard block
 block discarded – undo
3102 3102
 	}
3103 3103
 
3104 3104
 	/**
3105
-	* Update ident spotter data
3106
-	*
3107
-	* @param String $flightaware_id the ID from flightaware
3108
-	* @param String $ident the flight ident
3109
-	* @return String success or false
3110
-	*
3111
-	*/	
3105
+	 * Update ident spotter data
3106
+	 *
3107
+	 * @param String $flightaware_id the ID from flightaware
3108
+	 * @param String $ident the flight ident
3109
+	 * @return String success or false
3110
+	 *
3111
+	 */	
3112 3112
 	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3113 3113
 	{
3114 3114
 		if (!is_numeric(substr($ident, 0, 3)))
@@ -3129,14 +3129,14 @@  discard block
 block discarded – undo
3129 3129
 		} else {
3130 3130
 			$airline_array = $this->getAllAirlineInfo("NA");
3131 3131
 		}
3132
-                $airline_name = $airline_array[0]['name'];
3133
-                $airline_icao = $airline_array[0]['icao'];
3134
-                $airline_country = $airline_array[0]['country'];
3135
-                $airline_type = $airline_array[0]['type'];
3132
+				$airline_name = $airline_array[0]['name'];
3133
+				$airline_icao = $airline_array[0]['icao'];
3134
+				$airline_country = $airline_array[0]['country'];
3135
+				$airline_type = $airline_array[0]['type'];
3136 3136
 
3137 3137
 
3138 3138
 		$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';
3139
-                $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);
3139
+				$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);
3140 3140
 
3141 3141
 		try {
3142 3142
 			$sth = $this->db->prepare($query);
@@ -3149,19 +3149,19 @@  discard block
 block discarded – undo
3149 3149
 
3150 3150
 	}
3151 3151
 	/**
3152
-	* Update latest spotter data
3153
-	*
3154
-	* @param String $flightaware_id the ID from flightaware
3155
-	* @param String $ident the flight ident
3156
-	* @param String $arrival_airport_icao the arrival airport
3157
-	* @return String success or false
3158
-	*
3159
-	*/	
3152
+	 * Update latest spotter data
3153
+	 *
3154
+	 * @param String $flightaware_id the ID from flightaware
3155
+	 * @param String $ident the flight ident
3156
+	 * @param String $arrival_airport_icao the arrival airport
3157
+	 * @return String success or false
3158
+	 *
3159
+	 */	
3160 3160
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3161 3161
 	{
3162 3162
 		if ($groundspeed == '') $groundspeed = NULL;
3163 3163
 		$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';
3164
-                $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);
3164
+				$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);
3165 3165
 
3166 3166
 		try {
3167 3167
 			$sth = $this->db->prepare($query);
@@ -3175,32 +3175,32 @@  discard block
 block discarded – undo
3175 3175
 	}
3176 3176
 
3177 3177
 	/**
3178
-	* Adds a new spotter data
3179
-	*
3180
-	* @param String $flightaware_id the ID from flightaware
3181
-	* @param String $ident the flight ident
3182
-	* @param String $aircraft_icao the aircraft type
3183
-	* @param String $departure_airport_icao the departure airport
3184
-	* @param String $arrival_airport_icao the arrival airport
3185
-	* @param String $latitude latitude of flight
3186
-	* @param String $longitude latitude of flight
3187
-	* @param String $waypoints waypoints of flight
3188
-	* @param String $altitude altitude of flight
3189
-	* @param String $heading heading of flight
3190
-	* @param String $groundspeed speed of flight
3191
-	* @param String $date date of flight
3192
-	* @param String $departure_airport_time departure time of flight
3193
-	* @param String $arrival_airport_time arrival time of flight
3194
-	* @param String $squawk squawk code of flight
3195
-	* @param String $route_stop route stop of flight
3196
-	* @param String $highlight highlight or not
3197
-	* @param String $ModeS ModesS code of flight
3198
-	* @param String $registration registration code of flight
3199
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
3200
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
3201
-	* @param String $verticalrate vertival rate of flight
3202
-	* @return String success or false
3203
-	*/
3178
+	 * Adds a new spotter data
3179
+	 *
3180
+	 * @param String $flightaware_id the ID from flightaware
3181
+	 * @param String $ident the flight ident
3182
+	 * @param String $aircraft_icao the aircraft type
3183
+	 * @param String $departure_airport_icao the departure airport
3184
+	 * @param String $arrival_airport_icao the arrival airport
3185
+	 * @param String $latitude latitude of flight
3186
+	 * @param String $longitude latitude of flight
3187
+	 * @param String $waypoints waypoints of flight
3188
+	 * @param String $altitude altitude of flight
3189
+	 * @param String $heading heading of flight
3190
+	 * @param String $groundspeed speed of flight
3191
+	 * @param String $date date of flight
3192
+	 * @param String $departure_airport_time departure time of flight
3193
+	 * @param String $arrival_airport_time arrival time of flight
3194
+	 * @param String $squawk squawk code of flight
3195
+	 * @param String $route_stop route stop of flight
3196
+	 * @param String $highlight highlight or not
3197
+	 * @param String $ModeS ModesS code of flight
3198
+	 * @param String $registration registration code of flight
3199
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
3200
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
3201
+	 * @param String $verticalrate vertival rate of flight
3202
+	 * @return String success or false
3203
+	 */
3204 3204
 	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 = '')
3205 3205
 	{
3206 3206
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
@@ -3414,8 +3414,8 @@  discard block
 block discarded – undo
3414 3414
     
3415 3415
 		if ($globalIVAO && $aircraft_icao != '')
3416 3416
 		{
3417
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3418
-            		else $airline_icao = '';
3417
+					if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3418
+					else $airline_icao = '';
3419 3419
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3420 3420
 			if (!isset($image_array[0]['registration']))
3421 3421
 			{
@@ -3446,52 +3446,52 @@  discard block
 block discarded – undo
3446 3446
 	
3447 3447
 		if (count($airline_array) == 0) 
3448 3448
 		{
3449
-                        $airline_array = $this->getAllAirlineInfo('NA');
3450
-                }
3451
-                if (count($aircraft_array) == 0) 
3452
-                {
3453
-                        $aircraft_array = $this->getAllAircraftInfo('NA');
3454
-                }
3455
-                if (count($departure_airport_array) == 0) 
3456
-                {
3457
-                        $departure_airport_array = $this->getAllAirportInfo('NA');
3458
-                }
3459
-                if (count($arrival_airport_array) == 0) 
3460
-                {
3461
-                        $arrival_airport_array = $this->getAllAirportInfo('NA');
3462
-                }
3463
-                if ($registration == '') $registration = 'NA';
3464
-                if ($latitude == '' && $longitude == '') {
3465
-            		$latitude = 0;
3466
-            		$longitude = 0;
3467
-            	}
3468
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3469
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3470
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3471
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3472
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3473
-                $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) 
3449
+						$airline_array = $this->getAllAirlineInfo('NA');
3450
+				}
3451
+				if (count($aircraft_array) == 0) 
3452
+				{
3453
+						$aircraft_array = $this->getAllAircraftInfo('NA');
3454
+				}
3455
+				if (count($departure_airport_array) == 0) 
3456
+				{
3457
+						$departure_airport_array = $this->getAllAirportInfo('NA');
3458
+				}
3459
+				if (count($arrival_airport_array) == 0) 
3460
+				{
3461
+						$arrival_airport_array = $this->getAllAirportInfo('NA');
3462
+				}
3463
+				if ($registration == '') $registration = 'NA';
3464
+				if ($latitude == '' && $longitude == '') {
3465
+					$latitude = 0;
3466
+					$longitude = 0;
3467
+				}
3468
+				if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3469
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3470
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3471
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3472
+				if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3473
+				$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) 
3474 3474
                 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)";
3475 3475
 
3476
-                $airline_name = $airline_array[0]['name'];
3477
-                $airline_icao = $airline_array[0]['icao'];
3478
-                $airline_country = $airline_array[0]['country'];
3479
-                $airline_type = $airline_array[0]['type'];
3476
+				$airline_name = $airline_array[0]['name'];
3477
+				$airline_icao = $airline_array[0]['icao'];
3478
+				$airline_country = $airline_array[0]['country'];
3479
+				$airline_type = $airline_array[0]['type'];
3480 3480
 		if ($airline_type == '') {
3481 3481
 			$timeelapsed = microtime(true);
3482 3482
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3483 3483
 			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3484 3484
 		}
3485 3485
 		if ($airline_type == null) $airline_type = '';
3486
-                $aircraft_type = $aircraft_array[0]['type'];
3487
-                $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3488
-                $departure_airport_name = $departure_airport_array[0]['name'];
3489
-                $departure_airport_city = $departure_airport_array[0]['city'];
3490
-                $departure_airport_country = $departure_airport_array[0]['country'];
3491
-                $arrival_airport_name = $arrival_airport_array[0]['name'];
3492
-                $arrival_airport_city = $arrival_airport_array[0]['city'];
3493
-                $arrival_airport_country = $arrival_airport_array[0]['country'];
3494
-                $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);
3486
+				$aircraft_type = $aircraft_array[0]['type'];
3487
+				$aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3488
+				$departure_airport_name = $departure_airport_array[0]['name'];
3489
+				$departure_airport_city = $departure_airport_array[0]['city'];
3490
+				$departure_airport_country = $departure_airport_array[0]['country'];
3491
+				$arrival_airport_name = $arrival_airport_array[0]['name'];
3492
+				$arrival_airport_city = $arrival_airport_array[0]['city'];
3493
+				$arrival_airport_country = $arrival_airport_array[0]['country'];
3494
+				$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);
3495 3495
 
3496 3496
 		try {
3497 3497
 		        
@@ -3499,7 +3499,7 @@  discard block
 block discarded – undo
3499 3499
 			$sth->execute($query_values);
3500 3500
 			$this->db = null;
3501 3501
 		} catch (PDOException $e) {
3502
-		    return "error : ".$e->getMessage();
3502
+			return "error : ".$e->getMessage();
3503 3503
 		}
3504 3504
 		
3505 3505
 		return "success";
@@ -3508,11 +3508,11 @@  discard block
 block discarded – undo
3508 3508
 	
3509 3509
   
3510 3510
 	/**
3511
-	* Gets the aircraft ident within the last hour
3512
-	*
3513
-	* @return String the ident
3514
-	*
3515
-	*/
3511
+	 * Gets the aircraft ident within the last hour
3512
+	 *
3513
+	 * @return String the ident
3514
+	 *
3515
+	 */
3516 3516
 	public function getIdentFromLastHour($ident)
3517 3517
 	{
3518 3518
 		global $globalDBdriver, $globalTimezone;
@@ -3528,11 +3528,11 @@  discard block
 block discarded – undo
3528 3528
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3529 3529
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
3530 3530
 			$query_data = array(':ident' => $ident);
3531
-    		}
3531
+			}
3532 3532
 		
3533 3533
 		$sth = $this->db->prepare($query);
3534 3534
 		$sth->execute($query_data);
3535
-    		$ident_result='';
3535
+			$ident_result='';
3536 3536
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3537 3537
 		{
3538 3538
 			$ident_result = $row['ident'];
@@ -3543,11 +3543,11 @@  discard block
 block discarded – undo
3543 3543
 	
3544 3544
 	
3545 3545
 	/**
3546
-	* Gets the aircraft data from the last 20 seconds
3547
-	*
3548
-	* @return Array the spotter data
3549
-	*
3550
-	*/
3546
+	 * Gets the aircraft data from the last 20 seconds
3547
+	 *
3548
+	 * @return Array the spotter data
3549
+	 *
3550
+	 */
3551 3551
 	public function getRealTimeData($q = '')
3552 3552
 	{
3553 3553
 		global $globalDBdriver;
@@ -3591,11 +3591,11 @@  discard block
 block discarded – undo
3591 3591
 	
3592 3592
 	
3593 3593
 	 /**
3594
-	* Gets all airlines that have flown over
3595
-	*
3596
-	* @return Array the airline list
3597
-	*
3598
-	*/
3594
+	  * Gets all airlines that have flown over
3595
+	  *
3596
+	  * @return Array the airline list
3597
+	  *
3598
+	  */
3599 3599
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3600 3600
 	{
3601 3601
 		global $globalDBdriver;
@@ -3609,7 +3609,7 @@  discard block
 block discarded – undo
3609 3609
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3610 3610
 			}
3611 3611
 		}
3612
-                if ($sincedate != '') {
3612
+				if ($sincedate != '') {
3613 3613
 			if ($globalDBdriver == 'mysql') {
3614 3614
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3615 3615
 			} else {
@@ -3636,26 +3636,26 @@  discard block
 block discarded – undo
3636 3636
 	}
3637 3637
 
3638 3638
 	 /**
3639
-	* Gets all pilots that have flown over
3640
-	*
3641
-	* @return Array the pilots list
3642
-	*
3643
-	*/
3639
+	  * Gets all pilots that have flown over
3640
+	  *
3641
+	  * @return Array the pilots list
3642
+	  *
3643
+	  */
3644 3644
 	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3645 3645
 	{
3646 3646
 		global $globalDBdriver;
3647 3647
 		$filter_query = $this->getFilter($filters,true,true);
3648 3648
 		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3649 3649
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3650
-                if ($olderthanmonths > 0) {
3651
-            		if ($globalDBdriver == 'mysql') {
3650
+				if ($olderthanmonths > 0) {
3651
+					if ($globalDBdriver == 'mysql') {
3652 3652
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3653 3653
 			} else {
3654 3654
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3655 3655
 			}
3656 3656
 		}
3657
-                if ($sincedate != '') {
3658
-            		if ($globalDBdriver == 'mysql') {
3657
+				if ($sincedate != '') {
3658
+					if ($globalDBdriver == 'mysql') {
3659 3659
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3660 3660
 			} else {
3661 3661
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3682,25 +3682,25 @@  discard block
 block discarded – undo
3682 3682
 	}
3683 3683
 	
3684 3684
 		 /**
3685
-	* Gets all pilots that have flown over
3686
-	*
3687
-	* @return Array the pilots list
3688
-	*
3689
-	*/
3685
+		  * Gets all pilots that have flown over
3686
+		  *
3687
+		  * @return Array the pilots list
3688
+		  *
3689
+		  */
3690 3690
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3691 3691
 	{
3692 3692
 		global $globalDBdriver;
3693 3693
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3694 3694
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
3695
-                if ($olderthanmonths > 0) {
3696
-            		if ($globalDBdriver == 'mysql') {
3695
+				if ($olderthanmonths > 0) {
3696
+					if ($globalDBdriver == 'mysql') {
3697 3697
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3698 3698
 			} else {
3699 3699
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3700 3700
 			}
3701 3701
 		}
3702
-                if ($sincedate != '') {
3703
-            		if ($globalDBdriver == 'mysql') {
3702
+				if ($sincedate != '') {
3703
+					if ($globalDBdriver == 'mysql') {
3704 3704
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3705 3705
 			} else {
3706 3706
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3728,26 +3728,26 @@  discard block
 block discarded – undo
3728 3728
 	}
3729 3729
 	
3730 3730
 	 /**
3731
-	* Gets all owner that have flown over
3732
-	*
3733
-	* @return Array the pilots list
3734
-	*
3735
-	*/
3731
+	  * Gets all owner that have flown over
3732
+	  *
3733
+	  * @return Array the pilots list
3734
+	  *
3735
+	  */
3736 3736
 	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3737 3737
 	{
3738 3738
 		global $globalDBdriver;
3739 3739
 		$filter_query = $this->getFilter($filters,true,true);
3740 3740
 		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3741 3741
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3742
-                if ($olderthanmonths > 0) {
3743
-            		if ($globalDBdriver == 'mysql') {
3742
+				if ($olderthanmonths > 0) {
3743
+					if ($globalDBdriver == 'mysql') {
3744 3744
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3745 3745
 			} else {
3746 3746
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3747 3747
 			}
3748 3748
 		}
3749
-                if ($sincedate != '') {
3750
-            		if ($globalDBdriver == 'mysql') {
3749
+				if ($sincedate != '') {
3750
+					if ($globalDBdriver == 'mysql') {
3751 3751
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3752 3752
 			} else {
3753 3753
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3773,26 +3773,26 @@  discard block
 block discarded – undo
3773 3773
 	}
3774 3774
 	
3775 3775
 	 /**
3776
-	* Gets all owner that have flown over
3777
-	*
3778
-	* @return Array the pilots list
3779
-	*
3780
-	*/
3776
+	  * Gets all owner that have flown over
3777
+	  *
3778
+	  * @return Array the pilots list
3779
+	  *
3780
+	  */
3781 3781
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3782 3782
 	{
3783 3783
 		global $globalDBdriver;
3784 3784
 		$filter_query = $this->getFilter($filters,true,true);
3785 3785
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3786 3786
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3787
-                if ($olderthanmonths > 0) {
3788
-            		if ($globalDBdriver == 'mysql') {
3787
+				if ($olderthanmonths > 0) {
3788
+					if ($globalDBdriver == 'mysql') {
3789 3789
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3790 3790
 			} else {
3791 3791
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3792 3792
 			}
3793 3793
 		}
3794
-                if ($sincedate != '') {
3795
-            		if ($globalDBdriver == 'mysql') {
3794
+				if ($sincedate != '') {
3795
+					if ($globalDBdriver == 'mysql') {
3796 3796
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3797 3797
 			} else {
3798 3798
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3819,11 +3819,11 @@  discard block
 block discarded – undo
3819 3819
 	}
3820 3820
 
3821 3821
 	/**
3822
-	* Gets all airlines that have flown over by aircraft
3823
-	*
3824
-	* @return Array the airline list
3825
-	*
3826
-	*/
3822
+	 * Gets all airlines that have flown over by aircraft
3823
+	 *
3824
+	 * @return Array the airline list
3825
+	 *
3826
+	 */
3827 3827
 	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
3828 3828
 	{
3829 3829
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3855,11 +3855,11 @@  discard block
 block discarded – undo
3855 3855
 
3856 3856
 
3857 3857
 	/**
3858
-	* Gets all airline countries that have flown over by aircraft
3859
-	*
3860
-	* @return Array the airline country list
3861
-	*
3862
-	*/
3858
+	 * Gets all airline countries that have flown over by aircraft
3859
+	 *
3860
+	 * @return Array the airline country list
3861
+	 *
3862
+	 */
3863 3863
 	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
3864 3864
 	{
3865 3865
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3891,11 +3891,11 @@  discard block
 block discarded – undo
3891 3891
 	
3892 3892
 	
3893 3893
 	/**
3894
-	* Gets all airlines that have flown over by airport
3895
-	*
3896
-	* @return Array the airline list
3897
-	*
3898
-	*/
3894
+	 * Gets all airlines that have flown over by airport
3895
+	 *
3896
+	 * @return Array the airline list
3897
+	 *
3898
+	 */
3899 3899
 	public function countAllAirlinesByAirport($airport_icao,$filters = array())
3900 3900
 	{
3901 3901
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -3926,11 +3926,11 @@  discard block
 block discarded – undo
3926 3926
 
3927 3927
 
3928 3928
 	/**
3929
-	* Gets all airline countries that have flown over by airport icao
3930
-	*
3931
-	* @return Array the airline country list
3932
-	*
3933
-	*/
3929
+	 * Gets all airline countries that have flown over by airport icao
3930
+	 *
3931
+	 * @return Array the airline country list
3932
+	 *
3933
+	 */
3934 3934
 	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
3935 3935
 	{
3936 3936
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -3960,11 +3960,11 @@  discard block
 block discarded – undo
3960 3960
 
3961 3961
 
3962 3962
 	/**
3963
-	* Gets all airlines that have flown over by aircraft manufacturer
3964
-	*
3965
-	* @return Array the airline list
3966
-	*
3967
-	*/
3963
+	 * Gets all airlines that have flown over by aircraft manufacturer
3964
+	 *
3965
+	 * @return Array the airline list
3966
+	 *
3967
+	 */
3968 3968
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
3969 3969
 	{
3970 3970
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -3995,11 +3995,11 @@  discard block
 block discarded – undo
3995 3995
 
3996 3996
 
3997 3997
 	/**
3998
-	* Gets all airline countries that have flown over by aircraft manufacturer
3999
-	*
4000
-	* @return Array the airline country list
4001
-	*
4002
-	*/
3998
+	 * Gets all airline countries that have flown over by aircraft manufacturer
3999
+	 *
4000
+	 * @return Array the airline country list
4001
+	 *
4002
+	 */
4003 4003
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4004 4004
 	{
4005 4005
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4028,11 +4028,11 @@  discard block
 block discarded – undo
4028 4028
 
4029 4029
 
4030 4030
 	/**
4031
-	* Gets all airlines that have flown over by date
4032
-	*
4033
-	* @return Array the airline list
4034
-	*
4035
-	*/
4031
+	 * Gets all airlines that have flown over by date
4032
+	 *
4033
+	 * @return Array the airline list
4034
+	 *
4035
+	 */
4036 4036
 	public function countAllAirlinesByDate($date,$filters = array())
4037 4037
 	{
4038 4038
 		global $globalTimezone, $globalDBdriver;
@@ -4076,11 +4076,11 @@  discard block
 block discarded – undo
4076 4076
 	
4077 4077
 	
4078 4078
 	/**
4079
-	* Gets all airline countries that have flown over by date
4080
-	*
4081
-	* @return Array the airline country list
4082
-	*
4083
-	*/
4079
+	 * Gets all airline countries that have flown over by date
4080
+	 *
4081
+	 * @return Array the airline country list
4082
+	 *
4083
+	 */
4084 4084
 	public function countAllAirlineCountriesByDate($date,$filters = array())
4085 4085
 	{
4086 4086
 		global $globalTimezone, $globalDBdriver;
@@ -4123,11 +4123,11 @@  discard block
 block discarded – undo
4123 4123
 
4124 4124
 
4125 4125
 	/**
4126
-	* Gets all airlines that have flown over by ident/callsign
4127
-	*
4128
-	* @return Array the airline list
4129
-	*
4130
-	*/
4126
+	 * Gets all airlines that have flown over by ident/callsign
4127
+	 *
4128
+	 * @return Array the airline list
4129
+	 *
4130
+	 */
4131 4131
 	public function countAllAirlinesByIdent($ident,$filters = array())
4132 4132
 	{
4133 4133
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4157,11 +4157,11 @@  discard block
 block discarded – undo
4157 4157
 	}
4158 4158
 
4159 4159
 	/**
4160
-	* Gets all airlines that have flown over by route
4161
-	*
4162
-	* @return Array the airline list
4163
-	*
4164
-	*/
4160
+	 * Gets all airlines that have flown over by route
4161
+	 *
4162
+	 * @return Array the airline list
4163
+	 *
4164
+	 */
4165 4165
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4166 4166
 	{
4167 4167
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4193,11 +4193,11 @@  discard block
 block discarded – undo
4193 4193
 	}
4194 4194
 
4195 4195
 	/**
4196
-	* Gets all airline countries that have flown over by route
4197
-	*
4198
-	* @return Array the airline country list
4199
-	*
4200
-	*/
4196
+	 * Gets all airline countries that have flown over by route
4197
+	 *
4198
+	 * @return Array the airline country list
4199
+	 *
4200
+	 */
4201 4201
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4202 4202
 	{
4203 4203
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4229,11 +4229,11 @@  discard block
 block discarded – undo
4229 4229
 
4230 4230
 
4231 4231
 	/**
4232
-	* Gets all airlines that have flown over by country
4233
-	*
4234
-	* @return Array the airline list
4235
-	*
4236
-	*/
4232
+	 * Gets all airlines that have flown over by country
4233
+	 *
4234
+	 * @return Array the airline list
4235
+	 *
4236
+	 */
4237 4237
 	public function countAllAirlinesByCountry($country,$filters = array())
4238 4238
 	{
4239 4239
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4263,11 +4263,11 @@  discard block
 block discarded – undo
4263 4263
 
4264 4264
 
4265 4265
 	/**
4266
-	* Gets all airline countries that have flown over by country
4267
-	*
4268
-	* @return Array the airline country list
4269
-	*
4270
-	*/
4266
+	 * Gets all airline countries that have flown over by country
4267
+	 *
4268
+	 * @return Array the airline country list
4269
+	 *
4270
+	 */
4271 4271
 	public function countAllAirlineCountriesByCountry($country,$filters = array())
4272 4272
 	{
4273 4273
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4296,11 +4296,11 @@  discard block
 block discarded – undo
4296 4296
 
4297 4297
 
4298 4298
 	/**
4299
-	* Gets all airlines countries
4300
-	*
4301
-	* @return Array the airline country list
4302
-	*
4303
-	*/
4299
+	 * Gets all airlines countries
4300
+	 *
4301
+	 * @return Array the airline country list
4302
+	 *
4303
+	 */
4304 4304
 	public function countAllAirlineCountries($limit = true, $filters = array())
4305 4305
 	{
4306 4306
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4326,11 +4326,11 @@  discard block
 block discarded – undo
4326 4326
 	}
4327 4327
 
4328 4328
 	/**
4329
-	* Gets all number of flight over countries
4330
-	*
4331
-	* @return Array the airline country list
4332
-	*
4333
-	*/
4329
+	 * Gets all number of flight over countries
4330
+	 *
4331
+	 * @return Array the airline country list
4332
+	 *
4333
+	 */
4334 4334
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
4335 4335
 	{
4336 4336
 		global $globalDBdriver;
@@ -4345,15 +4345,15 @@  discard block
 block discarded – undo
4345 4345
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
4346 4346
 					FROM countries c, spotter_live s
4347 4347
 					WHERE c.iso2 = s.over_country ";
4348
-                if ($olderthanmonths > 0) {
4348
+				if ($olderthanmonths > 0) {
4349 4349
 			if ($globalDBdriver == 'mysql') {
4350 4350
 				$query .= 'AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
4351 4351
 			} else {
4352 4352
 				$query .= "AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4353 4353
 			}
4354 4354
 		}
4355
-                if ($sincedate != '') {
4356
-            		if ($globalDBdriver == 'mysql') {
4355
+				if ($sincedate != '') {
4356
+					if ($globalDBdriver == 'mysql') {
4357 4357
 				$query .= "AND spotter_live.date > '".$sincedate."' ";
4358 4358
 			} else {
4359 4359
 				$query .= "AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4383,11 +4383,11 @@  discard block
 block discarded – undo
4383 4383
 	
4384 4384
 	
4385 4385
 	/**
4386
-	* Gets all aircraft types that have flown over
4387
-	*
4388
-	* @return Array the aircraft list
4389
-	*
4390
-	*/
4386
+	 * Gets all aircraft types that have flown over
4387
+	 *
4388
+	 * @return Array the aircraft list
4389
+	 *
4390
+	 */
4391 4391
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4392 4392
 	{
4393 4393
 		global $globalDBdriver;
@@ -4430,11 +4430,11 @@  discard block
 block discarded – undo
4430 4430
 	}
4431 4431
 
4432 4432
 	/**
4433
-	* Gets all aircraft types that have flown over by airline
4434
-	*
4435
-	* @return Array the aircraft list
4436
-	*
4437
-	*/
4433
+	 * Gets all aircraft types that have flown over by airline
4434
+	 *
4435
+	 * @return Array the aircraft list
4436
+	 *
4437
+	 */
4438 4438
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4439 4439
 	{
4440 4440
 		global $globalDBdriver;
@@ -4478,11 +4478,11 @@  discard block
 block discarded – undo
4478 4478
 
4479 4479
 
4480 4480
 	/**
4481
-	* Gets all aircraft registration that have flown over by aircaft icao
4482
-	*
4483
-	* @return Array the aircraft list
4484
-	*
4485
-	*/
4481
+	 * Gets all aircraft registration that have flown over by aircaft icao
4482
+	 *
4483
+	 * @return Array the aircraft list
4484
+	 *
4485
+	 */
4486 4486
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
4487 4487
 	{
4488 4488
 		$Image = new Image($this->db);
@@ -4521,11 +4521,11 @@  discard block
 block discarded – undo
4521 4521
 
4522 4522
 
4523 4523
 	/**
4524
-	* Gets all aircraft types that have flown over by airline icao
4525
-	*
4526
-	* @return Array the aircraft list
4527
-	*
4528
-	*/
4524
+	 * Gets all aircraft types that have flown over by airline icao
4525
+	 *
4526
+	 * @return Array the aircraft list
4527
+	 *
4528
+	 */
4529 4529
 	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
4530 4530
 	{
4531 4531
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4554,11 +4554,11 @@  discard block
 block discarded – undo
4554 4554
 
4555 4555
 
4556 4556
 	/**
4557
-	* Gets all aircraft registration that have flown over by airline icao
4558
-	*
4559
-	* @return Array the aircraft list
4560
-	*
4561
-	*/
4557
+	 * Gets all aircraft registration that have flown over by airline icao
4558
+	 *
4559
+	 * @return Array the aircraft list
4560
+	 *
4561
+	 */
4562 4562
 	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
4563 4563
 	{
4564 4564
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4596,11 +4596,11 @@  discard block
 block discarded – undo
4596 4596
 
4597 4597
 
4598 4598
 	/**
4599
-	* Gets all aircraft manufacturer that have flown over by airline icao
4600
-	*
4601
-	* @return Array the aircraft list
4602
-	*
4603
-	*/
4599
+	 * Gets all aircraft manufacturer that have flown over by airline icao
4600
+	 *
4601
+	 * @return Array the aircraft list
4602
+	 *
4603
+	 */
4604 4604
 	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
4605 4605
 	{
4606 4606
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4628,11 +4628,11 @@  discard block
 block discarded – undo
4628 4628
 
4629 4629
 
4630 4630
 	/**
4631
-	* Gets all aircraft types that have flown over by airline icao
4632
-	*
4633
-	* @return Array the aircraft list
4634
-	*
4635
-	*/
4631
+	 * Gets all aircraft types that have flown over by airline icao
4632
+	 *
4633
+	 * @return Array the aircraft list
4634
+	 *
4635
+	 */
4636 4636
 	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
4637 4637
 	{
4638 4638
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4661,11 +4661,11 @@  discard block
 block discarded – undo
4661 4661
 
4662 4662
 
4663 4663
 	/**
4664
-	* Gets all aircraft registration that have flown over by airport icao
4665
-	*
4666
-	* @return Array the aircraft list
4667
-	*
4668
-	*/
4664
+	 * Gets all aircraft registration that have flown over by airport icao
4665
+	 *
4666
+	 * @return Array the aircraft list
4667
+	 *
4668
+	 */
4669 4669
 	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
4670 4670
 	{
4671 4671
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4702,11 +4702,11 @@  discard block
 block discarded – undo
4702 4702
 	
4703 4703
 	
4704 4704
 	/**
4705
-	* Gets all aircraft manufacturer that have flown over by airport icao
4706
-	*
4707
-	* @return Array the aircraft list
4708
-	*
4709
-	*/
4705
+	 * Gets all aircraft manufacturer that have flown over by airport icao
4706
+	 *
4707
+	 * @return Array the aircraft list
4708
+	 *
4709
+	 */
4710 4710
 	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
4711 4711
 	{
4712 4712
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4732,11 +4732,11 @@  discard block
 block discarded – undo
4732 4732
 	}
4733 4733
 
4734 4734
 	/**
4735
-	* Gets all aircraft types that have flown over by aircraft manufacturer
4736
-	*
4737
-	* @return Array the aircraft list
4738
-	*
4739
-	*/
4735
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
4736
+	 *
4737
+	 * @return Array the aircraft list
4738
+	 *
4739
+	 */
4740 4740
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
4741 4741
 	{
4742 4742
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4763,11 +4763,11 @@  discard block
 block discarded – undo
4763 4763
 
4764 4764
 
4765 4765
 	/**
4766
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
4767
-	*
4768
-	* @return Array the aircraft list
4769
-	*
4770
-	*/
4766
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
4767
+	 *
4768
+	 * @return Array the aircraft list
4769
+	 *
4770
+	 */
4771 4771
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
4772 4772
 	{
4773 4773
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4803,11 +4803,11 @@  discard block
 block discarded – undo
4803 4803
 	}
4804 4804
 
4805 4805
 	/**
4806
-	* Gets all aircraft types that have flown over by date
4807
-	*
4808
-	* @return Array the aircraft list
4809
-	*
4810
-	*/
4806
+	 * Gets all aircraft types that have flown over by date
4807
+	 *
4808
+	 * @return Array the aircraft list
4809
+	 *
4810
+	 */
4811 4811
 	public function countAllAircraftTypesByDate($date,$filters = array())
4812 4812
 	{
4813 4813
 		global $globalTimezone, $globalDBdriver;
@@ -4849,11 +4849,11 @@  discard block
 block discarded – undo
4849 4849
 
4850 4850
 
4851 4851
 	/**
4852
-	* Gets all aircraft registration that have flown over by date
4853
-	*
4854
-	* @return Array the aircraft list
4855
-	*
4856
-	*/
4852
+	 * Gets all aircraft registration that have flown over by date
4853
+	 *
4854
+	 * @return Array the aircraft list
4855
+	 *
4856
+	 */
4857 4857
 	public function countAllAircraftRegistrationByDate($date,$filters = array())
4858 4858
 	{
4859 4859
 		global $globalTimezone, $globalDBdriver;
@@ -4904,11 +4904,11 @@  discard block
 block discarded – undo
4904 4904
 
4905 4905
 
4906 4906
 	/**
4907
-	* Gets all aircraft manufacturer that have flown over by date
4908
-	*
4909
-	* @return Array the aircraft manufacturer list
4910
-	*
4911
-	*/
4907
+	 * Gets all aircraft manufacturer that have flown over by date
4908
+	 *
4909
+	 * @return Array the aircraft manufacturer list
4910
+	 *
4911
+	 */
4912 4912
 	public function countAllAircraftManufacturerByDate($date,$filters = array())
4913 4913
 	{
4914 4914
 		global $globalTimezone, $globalDBdriver;
@@ -4950,11 +4950,11 @@  discard block
 block discarded – undo
4950 4950
 
4951 4951
 
4952 4952
 	/**
4953
-	* Gets all aircraft types that have flown over by ident/callsign
4954
-	*
4955
-	* @return Array the aircraft list
4956
-	*
4957
-	*/
4953
+	 * Gets all aircraft types that have flown over by ident/callsign
4954
+	 *
4955
+	 * @return Array the aircraft list
4956
+	 *
4957
+	 */
4958 4958
 	public function countAllAircraftTypesByIdent($ident,$filters = array())
4959 4959
 	{
4960 4960
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4983,11 +4983,11 @@  discard block
 block discarded – undo
4983 4983
 
4984 4984
 
4985 4985
 	/**
4986
-	* Gets all aircraft registration that have flown over by ident/callsign
4987
-	*
4988
-	* @return Array the aircraft list
4989
-	*
4990
-	*/
4986
+	 * Gets all aircraft registration that have flown over by ident/callsign
4987
+	 *
4988
+	 * @return Array the aircraft list
4989
+	 *
4990
+	 */
4991 4991
 	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
4992 4992
 	{
4993 4993
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5027,11 +5027,11 @@  discard block
 block discarded – undo
5027 5027
 
5028 5028
 
5029 5029
 	/**
5030
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
5031
-	*
5032
-	* @return Array the aircraft manufacturer list
5033
-	*
5034
-	*/
5030
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
5031
+	 *
5032
+	 * @return Array the aircraft manufacturer list
5033
+	 *
5034
+	 */
5035 5035
 	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5036 5036
 	{
5037 5037
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5057,11 +5057,11 @@  discard block
 block discarded – undo
5057 5057
 
5058 5058
 
5059 5059
 	/**
5060
-	* Gets all aircraft types that have flown over by route
5061
-	*
5062
-	* @return Array the aircraft list
5063
-	*
5064
-	*/
5060
+	 * Gets all aircraft types that have flown over by route
5061
+	 *
5062
+	 * @return Array the aircraft list
5063
+	 *
5064
+	 */
5065 5065
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5066 5066
 	{
5067 5067
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5090,11 +5090,11 @@  discard block
 block discarded – undo
5090 5090
 	}
5091 5091
 
5092 5092
 	/**
5093
-	* Gets all aircraft registration that have flown over by route
5094
-	*
5095
-	* @return Array the aircraft list
5096
-	*
5097
-	*/
5093
+	 * Gets all aircraft registration that have flown over by route
5094
+	 *
5095
+	 * @return Array the aircraft list
5096
+	 *
5097
+	 */
5098 5098
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5099 5099
 	{
5100 5100
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5136,11 +5136,11 @@  discard block
 block discarded – undo
5136 5136
 	
5137 5137
 	
5138 5138
 	/**
5139
-	* Gets all aircraft manufacturer that have flown over by route
5140
-	*
5141
-	* @return Array the aircraft manufacturer list
5142
-	*
5143
-	*/
5139
+	 * Gets all aircraft manufacturer that have flown over by route
5140
+	 *
5141
+	 * @return Array the aircraft manufacturer list
5142
+	 *
5143
+	 */
5144 5144
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5145 5145
 	{
5146 5146
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5174,11 +5174,11 @@  discard block
 block discarded – undo
5174 5174
 	
5175 5175
 	
5176 5176
 	/**
5177
-	* Gets all aircraft types that have flown over by country
5178
-	*
5179
-	* @return Array the aircraft list
5180
-	*
5181
-	*/
5177
+	 * Gets all aircraft types that have flown over by country
5178
+	 *
5179
+	 * @return Array the aircraft list
5180
+	 *
5181
+	 */
5182 5182
 	public function countAllAircraftTypesByCountry($country,$filters = array())
5183 5183
 	{
5184 5184
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5209,11 +5209,11 @@  discard block
 block discarded – undo
5209 5209
 
5210 5210
 
5211 5211
 	/**
5212
-	* Gets all aircraft registration that have flown over by country
5213
-	*
5214
-	* @return Array the aircraft list
5215
-	*
5216
-	*/
5212
+	 * Gets all aircraft registration that have flown over by country
5213
+	 *
5214
+	 * @return Array the aircraft list
5215
+	 *
5216
+	 */
5217 5217
 	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5218 5218
 	{
5219 5219
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5253,11 +5253,11 @@  discard block
 block discarded – undo
5253 5253
 	
5254 5254
 	
5255 5255
 	/**
5256
-	* Gets all aircraft manufacturer that have flown over by country
5257
-	*
5258
-	* @return Array the aircraft manufacturer list
5259
-	*
5260
-	*/
5256
+	 * Gets all aircraft manufacturer that have flown over by country
5257
+	 *
5258
+	 * @return Array the aircraft manufacturer list
5259
+	 *
5260
+	 */
5261 5261
 	public function countAllAircraftManufacturerByCountry($country,$filters = array())
5262 5262
 	{
5263 5263
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5288,17 +5288,17 @@  discard block
 block discarded – undo
5288 5288
 	
5289 5289
 	
5290 5290
 	/**
5291
-	* Gets all aircraft manufacturers that have flown over
5292
-	*
5293
-	* @return Array the aircraft list
5294
-	*
5295
-	*/
5291
+	 * Gets all aircraft manufacturers that have flown over
5292
+	 *
5293
+	 * @return Array the aircraft list
5294
+	 *
5295
+	 */
5296 5296
 	public function countAllAircraftManufacturers($filters = array())
5297 5297
 	{
5298 5298
 		$filter_query = $this->getFilter($filters,true,true);
5299 5299
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5300 5300
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5301
-                $query .= " GROUP BY spotter_output.aircraft_manufacturer
5301
+				$query .= " GROUP BY spotter_output.aircraft_manufacturer
5302 5302
 					ORDER BY aircraft_manufacturer_count DESC
5303 5303
 					LIMIT 10";
5304 5304
       
@@ -5323,11 +5323,11 @@  discard block
 block discarded – undo
5323 5323
 	
5324 5324
 	
5325 5325
 	/**
5326
-	* Gets all aircraft registrations that have flown over
5327
-	*
5328
-	* @return Array the aircraft list
5329
-	*
5330
-	*/
5326
+	 * Gets all aircraft registrations that have flown over
5327
+	 *
5328
+	 * @return Array the aircraft list
5329
+	 *
5330
+	 */
5331 5331
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5332 5332
 	{
5333 5333
 		global $globalDBdriver;
@@ -5335,15 +5335,15 @@  discard block
 block discarded – undo
5335 5335
 		$filter_query = $this->getFilter($filters,true,true);
5336 5336
 		$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    
5337 5337
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5338
-                if ($olderthanmonths > 0) {
5339
-            		if ($globalDBdriver == 'mysql') {
5338
+				if ($olderthanmonths > 0) {
5339
+					if ($globalDBdriver == 'mysql') {
5340 5340
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5341 5341
 			} else {
5342 5342
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5343 5343
 			}
5344 5344
 		}
5345
-                if ($sincedate != '') {
5346
-            		if ($globalDBdriver == 'mysql') {
5345
+				if ($sincedate != '') {
5346
+					if ($globalDBdriver == 'mysql') {
5347 5347
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5348 5348
 			} else {
5349 5349
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5352,7 +5352,7 @@  discard block
 block discarded – undo
5352 5352
 
5353 5353
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5354 5354
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5355
-                $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5355
+				$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5356 5356
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5357 5357
 		
5358 5358
 		$sth = $this->db->prepare($query);
@@ -5383,11 +5383,11 @@  discard block
 block discarded – undo
5383 5383
 
5384 5384
 
5385 5385
 	/**
5386
-	* Gets all aircraft registrations that have flown over
5387
-	*
5388
-	* @return Array the aircraft list
5389
-	*
5390
-	*/
5386
+	 * Gets all aircraft registrations that have flown over
5387
+	 *
5388
+	 * @return Array the aircraft list
5389
+	 *
5390
+	 */
5391 5391
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5392 5392
 	{
5393 5393
 		global $globalDBdriver;
@@ -5395,15 +5395,15 @@  discard block
 block discarded – undo
5395 5395
 		$Image = new Image($this->db);
5396 5396
 		$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    
5397 5397
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5398
-                if ($olderthanmonths > 0) {
5399
-            		if ($globalDBdriver == 'mysql') {
5398
+				if ($olderthanmonths > 0) {
5399
+					if ($globalDBdriver == 'mysql') {
5400 5400
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5401 5401
 			} else {
5402 5402
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5403 5403
 			}
5404 5404
 		}
5405
-                if ($sincedate != '') {
5406
-            		if ($globalDBdriver == 'mysql') {
5405
+				if ($sincedate != '') {
5406
+					if ($globalDBdriver == 'mysql') {
5407 5407
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5408 5408
 			} else {
5409 5409
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5412,7 +5412,7 @@  discard block
 block discarded – undo
5412 5412
 
5413 5413
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5414 5414
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5415
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5415
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5416 5416
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5417 5417
 		
5418 5418
 		$sth = $this->db->prepare($query);
@@ -5444,35 +5444,35 @@  discard block
 block discarded – undo
5444 5444
 	
5445 5445
 	
5446 5446
 	/**
5447
-	* Gets all departure airports of the airplanes that have flown over
5448
-	*
5449
-	* @return Array the airport list
5450
-	*
5451
-	*/
5447
+	 * Gets all departure airports of the airplanes that have flown over
5448
+	 *
5449
+	 * @return Array the airport list
5450
+	 *
5451
+	 */
5452 5452
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5453 5453
 	{
5454 5454
 		global $globalDBdriver;
5455 5455
 		$filter_query = $this->getFilter($filters,true,true);
5456 5456
 		$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 
5457 5457
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA'";
5458
-                if ($olderthanmonths > 0) {
5459
-            		if ($globalDBdriver == 'mysql') {
5458
+				if ($olderthanmonths > 0) {
5459
+					if ($globalDBdriver == 'mysql') {
5460 5460
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5461 5461
 			} else {
5462 5462
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5463 5463
 			}
5464
-                }
5465
-                if ($sincedate != '') {
5466
-            		if ($globalDBdriver == 'mysql') {
5464
+				}
5465
+				if ($sincedate != '') {
5466
+					if ($globalDBdriver == 'mysql') {
5467 5467
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5468 5468
 			} else {
5469 5469
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5470 5470
 			}
5471 5471
 		}
5472 5472
 
5473
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5474
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5475
-                $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5473
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5474
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5475
+				$query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5476 5476
 				ORDER BY airport_departure_icao_count DESC";
5477 5477
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5478 5478
       
@@ -5496,35 +5496,35 @@  discard block
 block discarded – undo
5496 5496
 	}
5497 5497
 
5498 5498
 	/**
5499
-	* Gets all departure airports of the airplanes that have flown over
5500
-	*
5501
-	* @return Array the airport list
5502
-	*
5503
-	*/
5499
+	 * Gets all departure airports of the airplanes that have flown over
5500
+	 *
5501
+	 * @return Array the airport list
5502
+	 *
5503
+	 */
5504 5504
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5505 5505
 	{
5506 5506
 		global $globalDBdriver;
5507 5507
 		$filter_query = $this->getFilter($filters,true,true);
5508 5508
 		$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 
5509 5509
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' ";
5510
-                if ($olderthanmonths > 0) {
5511
-            		if ($globalDBdriver == 'mysql') {
5510
+				if ($olderthanmonths > 0) {
5511
+					if ($globalDBdriver == 'mysql') {
5512 5512
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5513 5513
 			} else {
5514 5514
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5515 5515
 			}
5516
-                }
5517
-                if ($sincedate != '') {
5518
-            		if ($globalDBdriver == 'mysql') {
5516
+				}
5517
+				if ($sincedate != '') {
5518
+					if ($globalDBdriver == 'mysql') {
5519 5519
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5520 5520
 			} else {
5521 5521
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5522 5522
 			}
5523 5523
 		}
5524 5524
 
5525
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5526
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5527
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5525
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5526
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5527
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5528 5528
 				ORDER BY airport_departure_icao_count DESC";
5529 5529
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5530 5530
       
@@ -5549,37 +5549,37 @@  discard block
 block discarded – undo
5549 5549
 	}
5550 5550
 
5551 5551
 	/**
5552
-	* Gets all detected departure airports of the airplanes that have flown over
5553
-	*
5554
-	* @return Array the airport list
5555
-	*
5556
-	*/
5552
+	 * Gets all detected departure airports of the airplanes that have flown over
5553
+	 *
5554
+	 * @return Array the airport list
5555
+	 *
5556
+	 */
5557 5557
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5558 5558
 	{
5559 5559
 		global $globalDBdriver;
5560 5560
 		$filter_query = $this->getFilter($filters,true,true);
5561 5561
 		$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
5562 5562
 				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";
5563
-                if ($olderthanmonths > 0) {
5564
-            		if ($globalDBdriver == 'mysql') {
5563
+				if ($olderthanmonths > 0) {
5564
+					if ($globalDBdriver == 'mysql') {
5565 5565
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5566 5566
 			} else {
5567 5567
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5568 5568
 			}
5569
-                }
5570
-                if ($sincedate != '') {
5571
-            		if ($globalDBdriver == 'mysql') {
5569
+				}
5570
+				if ($sincedate != '') {
5571
+					if ($globalDBdriver == 'mysql') {
5572 5572
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5573 5573
 			} else {
5574 5574
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5575 5575
 			}
5576 5576
 		}
5577
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5578
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5579
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5577
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5578
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5579
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5580 5580
 				ORDER BY airport_departure_icao_count DESC";
5581 5581
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5582
-    		//echo $query;
5582
+			//echo $query;
5583 5583
 		$sth = $this->db->prepare($query);
5584 5584
 		$sth->execute();
5585 5585
       
@@ -5600,35 +5600,35 @@  discard block
 block discarded – undo
5600 5600
 	}
5601 5601
 	
5602 5602
 	/**
5603
-	* Gets all detected departure airports of the airplanes that have flown over
5604
-	*
5605
-	* @return Array the airport list
5606
-	*
5607
-	*/
5603
+	 * Gets all detected departure airports of the airplanes that have flown over
5604
+	 *
5605
+	 * @return Array the airport list
5606
+	 *
5607
+	 */
5608 5608
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5609 5609
 	{
5610 5610
 		global $globalDBdriver;
5611 5611
 		$filter_query = $this->getFilter($filters,true,true);
5612 5612
 		$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
5613 5613
 				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 ";
5614
-                if ($olderthanmonths > 0) {
5615
-            		if ($globalDBdriver == 'mysql') {
5614
+				if ($olderthanmonths > 0) {
5615
+					if ($globalDBdriver == 'mysql') {
5616 5616
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5617 5617
 			} else {
5618 5618
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5619 5619
 			}
5620
-                }
5621
-                if ($sincedate != '') {
5622
-            		if ($globalDBdriver == 'mysql') {
5620
+				}
5621
+				if ($sincedate != '') {
5622
+					if ($globalDBdriver == 'mysql') {
5623 5623
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5624 5624
 			} else {
5625 5625
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
5626 5626
 			}
5627 5627
 		}
5628 5628
 
5629
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5630
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5631
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5629
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5630
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5631
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5632 5632
 				ORDER BY airport_departure_icao_count DESC";
5633 5633
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5634 5634
       
@@ -5653,11 +5653,11 @@  discard block
 block discarded – undo
5653 5653
 	}	
5654 5654
 	
5655 5655
 	/**
5656
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
5657
-	*
5658
-	* @return Array the airport list
5659
-	*
5660
-	*/
5656
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
5657
+	 *
5658
+	 * @return Array the airport list
5659
+	 *
5660
+	 */
5661 5661
 	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
5662 5662
 	{
5663 5663
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5691,11 +5691,11 @@  discard block
 block discarded – undo
5691 5691
 	
5692 5692
 	
5693 5693
 	/**
5694
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5695
-	*
5696
-	* @return Array the airport list
5697
-	*
5698
-	*/
5694
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5695
+	 *
5696
+	 * @return Array the airport list
5697
+	 *
5698
+	 */
5699 5699
 	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
5700 5700
 	{
5701 5701
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5726,11 +5726,11 @@  discard block
 block discarded – undo
5726 5726
 	
5727 5727
 	
5728 5728
 	/**
5729
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5730
-	*
5731
-	* @return Array the airport list
5732
-	*
5733
-	*/
5729
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5730
+	 *
5731
+	 * @return Array the airport list
5732
+	 *
5733
+	 */
5734 5734
 	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
5735 5735
 	{
5736 5736
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5763,11 +5763,11 @@  discard block
 block discarded – undo
5763 5763
 	
5764 5764
 	
5765 5765
 	/**
5766
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5767
-	*
5768
-	* @return Array the airport list
5769
-	*
5770
-	*/
5766
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5767
+	 *
5768
+	 * @return Array the airport list
5769
+	 *
5770
+	 */
5771 5771
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
5772 5772
 	{
5773 5773
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5797,11 +5797,11 @@  discard block
 block discarded – undo
5797 5797
 	
5798 5798
 	
5799 5799
 	/**
5800
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5801
-	*
5802
-	* @return Array the airport list
5803
-	*
5804
-	*/
5800
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5801
+	 *
5802
+	 * @return Array the airport list
5803
+	 *
5804
+	 */
5805 5805
 	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
5806 5806
 	{
5807 5807
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5834,11 +5834,11 @@  discard block
 block discarded – undo
5834 5834
 	
5835 5835
 	
5836 5836
 	/**
5837
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
5838
-	*
5839
-	* @return Array the airport list
5840
-	*
5841
-	*/
5837
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
5838
+	 *
5839
+	 * @return Array the airport list
5840
+	 *
5841
+	 */
5842 5842
 	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
5843 5843
 	{
5844 5844
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5868,11 +5868,11 @@  discard block
 block discarded – undo
5868 5868
 	
5869 5869
 	
5870 5870
 	/**
5871
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
5872
-	*
5873
-	* @return Array the airport list
5874
-	*
5875
-	*/
5871
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
5872
+	 *
5873
+	 * @return Array the airport list
5874
+	 *
5875
+	 */
5876 5876
 	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
5877 5877
 	{
5878 5878
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5905,11 +5905,11 @@  discard block
 block discarded – undo
5905 5905
 	
5906 5906
 	
5907 5907
 	/**
5908
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
5909
-	*
5910
-	* @return Array the airport list
5911
-	*
5912
-	*/
5908
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
5909
+	 *
5910
+	 * @return Array the airport list
5911
+	 *
5912
+	 */
5913 5913
 	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
5914 5914
 	{
5915 5915
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5940,11 +5940,11 @@  discard block
 block discarded – undo
5940 5940
 	
5941 5941
 	
5942 5942
 	/**
5943
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
5944
-	*
5945
-	* @return Array the airport list
5946
-	*
5947
-	*/
5943
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
5944
+	 *
5945
+	 * @return Array the airport list
5946
+	 *
5947
+	 */
5948 5948
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
5949 5949
 	{
5950 5950
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5977,11 +5977,11 @@  discard block
 block discarded – undo
5977 5977
 	
5978 5978
 	
5979 5979
 	/**
5980
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
5981
-	*
5982
-	* @return Array the airport list
5983
-	*
5984
-	*/
5980
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
5981
+	 *
5982
+	 * @return Array the airport list
5983
+	 *
5984
+	 */
5985 5985
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
5986 5986
 	{
5987 5987
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6011,11 +6011,11 @@  discard block
 block discarded – undo
6011 6011
 	
6012 6012
 	
6013 6013
 	/**
6014
-	* Gets all departure airports of the airplanes that have flown over based on a date
6015
-	*
6016
-	* @return Array the airport list
6017
-	*
6018
-	*/
6014
+	 * Gets all departure airports of the airplanes that have flown over based on a date
6015
+	 *
6016
+	 * @return Array the airport list
6017
+	 *
6018
+	 */
6019 6019
 	public function countAllDepartureAirportsByDate($date,$filters = array())
6020 6020
 	{
6021 6021
 		global $globalTimezone, $globalDBdriver;
@@ -6061,11 +6061,11 @@  discard block
 block discarded – undo
6061 6061
 	
6062 6062
 	
6063 6063
 	/**
6064
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
6065
-	*
6066
-	* @return Array the airport list
6067
-	*
6068
-	*/
6064
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
6065
+	 *
6066
+	 * @return Array the airport list
6067
+	 *
6068
+	 */
6069 6069
 	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6070 6070
 	{
6071 6071
 		global $globalTimezone, $globalDBdriver;
@@ -6108,11 +6108,11 @@  discard block
 block discarded – undo
6108 6108
 	
6109 6109
 	
6110 6110
 	/**
6111
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6112
-	*
6113
-	* @return Array the airport list
6114
-	*
6115
-	*/
6111
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6112
+	 *
6113
+	 * @return Array the airport list
6114
+	 *
6115
+	 */
6116 6116
 	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6117 6117
 	{
6118 6118
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6146,11 +6146,11 @@  discard block
 block discarded – undo
6146 6146
 	
6147 6147
 	
6148 6148
 	/**
6149
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6150
-	*
6151
-	* @return Array the airport list
6152
-	*
6153
-	*/
6149
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6150
+	 *
6151
+	 * @return Array the airport list
6152
+	 *
6153
+	 */
6154 6154
 	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
6155 6155
 	{
6156 6156
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6181,11 +6181,11 @@  discard block
 block discarded – undo
6181 6181
 	
6182 6182
 	
6183 6183
 	/**
6184
-	* Gets all departure airports of the airplanes that have flown over based on a country
6185
-	*
6186
-	* @return Array the airport list
6187
-	*
6188
-	*/
6184
+	 * Gets all departure airports of the airplanes that have flown over based on a country
6185
+	 *
6186
+	 * @return Array the airport list
6187
+	 *
6188
+	 */
6189 6189
 	public function countAllDepartureAirportsByCountry($country,$filters = array())
6190 6190
 	{
6191 6191
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6219,11 +6219,11 @@  discard block
 block discarded – undo
6219 6219
 
6220 6220
 
6221 6221
 	/**
6222
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6223
-	*
6224
-	* @return Array the airport list
6225
-	*
6226
-	*/
6222
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6223
+	 *
6224
+	 * @return Array the airport list
6225
+	 *
6226
+	 */
6227 6227
 	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
6228 6228
 	{
6229 6229
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6253,40 +6253,40 @@  discard block
 block discarded – undo
6253 6253
 	
6254 6254
 
6255 6255
 	/**
6256
-	* Gets all arrival airports of the airplanes that have flown over
6257
-	*
6258
-	* @return Array the airport list
6259
-	*
6260
-	*/
6256
+	 * Gets all arrival airports of the airplanes that have flown over
6257
+	 *
6258
+	 * @return Array the airport list
6259
+	 *
6260
+	 */
6261 6261
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6262 6262
 	{
6263 6263
 		global $globalDBdriver;
6264 6264
 		$filter_query = $this->getFilter($filters,true,true);
6265 6265
 		$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 
6266 6266
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
6267
-                if ($olderthanmonths > 0) {
6268
-            		if ($globalDBdriver == 'mysql') {
6267
+				if ($olderthanmonths > 0) {
6268
+					if ($globalDBdriver == 'mysql') {
6269 6269
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6270 6270
 			} else {
6271 6271
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6272 6272
 			}
6273
-                if ($sincedate != '') {
6274
-            		if ($globalDBdriver == 'mysql') {
6273
+				if ($sincedate != '') {
6274
+					if ($globalDBdriver == 'mysql') {
6275 6275
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6276 6276
 			} else {
6277 6277
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6278 6278
 			}
6279 6279
 		}
6280
-            		if ($globalDBdriver == 'mysql') {
6280
+					if ($globalDBdriver == 'mysql') {
6281 6281
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6282 6282
 			} else {
6283 6283
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6284 6284
 			}
6285 6285
 		}
6286 6286
 
6287
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6288
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6289
-                $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6287
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6288
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6289
+				$query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6290 6290
 					ORDER BY airport_arrival_icao_count DESC";
6291 6291
 		if ($limit) $query .= " LIMIT 10";
6292 6292
       
@@ -6315,40 +6315,40 @@  discard block
 block discarded – undo
6315 6315
 	}
6316 6316
 
6317 6317
 	/**
6318
-	* Gets all arrival airports of the airplanes that have flown over
6319
-	*
6320
-	* @return Array the airport list
6321
-	*
6322
-	*/
6318
+	 * Gets all arrival airports of the airplanes that have flown over
6319
+	 *
6320
+	 * @return Array the airport list
6321
+	 *
6322
+	 */
6323 6323
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6324 6324
 	{
6325 6325
 		global $globalDBdriver;
6326 6326
 		$filter_query = $this->getFilter($filters,true,true);
6327 6327
 		$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 
6328 6328
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' ";
6329
-                if ($olderthanmonths > 0) {
6330
-            		if ($globalDBdriver == 'mysql') {
6329
+				if ($olderthanmonths > 0) {
6330
+					if ($globalDBdriver == 'mysql') {
6331 6331
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6332 6332
 			} else {
6333 6333
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6334 6334
 			}
6335
-                if ($sincedate != '') {
6336
-            		if ($globalDBdriver == 'mysql') {
6335
+				if ($sincedate != '') {
6336
+					if ($globalDBdriver == 'mysql') {
6337 6337
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6338 6338
 			} else {
6339 6339
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6340 6340
 			}
6341 6341
 		}
6342
-            		if ($globalDBdriver == 'mysql') {
6342
+					if ($globalDBdriver == 'mysql') {
6343 6343
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6344 6344
 			} else {
6345 6345
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6346 6346
 			}
6347 6347
 		}
6348 6348
 
6349
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6350
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6351
-                $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6349
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6350
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6351
+				$query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6352 6352
 					ORDER BY airport_arrival_icao_count DESC";
6353 6353
 		if ($limit) $query .= " LIMIT 10";
6354 6354
       
@@ -6379,39 +6379,39 @@  discard block
 block discarded – undo
6379 6379
 
6380 6380
 
6381 6381
 	/**
6382
-	* Gets all detected arrival airports of the airplanes that have flown over
6383
-	*
6384
-	* @return Array the airport list
6385
-	*
6386
-	*/
6382
+	 * Gets all detected arrival airports of the airplanes that have flown over
6383
+	 *
6384
+	 * @return Array the airport list
6385
+	 *
6386
+	 */
6387 6387
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6388 6388
 	{
6389 6389
 		global $globalDBdriver;
6390 6390
 		$filter_query = $this->getFilter($filters,true,true);
6391 6391
 		$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 
6392 6392
 			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";
6393
-                if ($olderthanmonths > 0) {
6394
-            		if ($globalDBdriver == 'mysql') {
6393
+				if ($olderthanmonths > 0) {
6394
+					if ($globalDBdriver == 'mysql') {
6395 6395
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6396 6396
 			} else {
6397 6397
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6398 6398
 			}
6399
-                if ($sincedate != '') {
6400
-            		if ($globalDBdriver == 'mysql') {
6399
+				if ($sincedate != '') {
6400
+					if ($globalDBdriver == 'mysql') {
6401 6401
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6402 6402
 			} else {
6403 6403
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6404 6404
 			}
6405 6405
 		}
6406
-            		if ($globalDBdriver == 'mysql') {
6406
+					if ($globalDBdriver == 'mysql') {
6407 6407
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6408 6408
 			} else {
6409 6409
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6410 6410
 			}
6411 6411
 		}
6412
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6413
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6414
-                $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6412
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6413
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6414
+				$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6415 6415
 					ORDER BY airport_arrival_icao_count DESC";
6416 6416
 		if ($limit) $query .= " LIMIT 10";
6417 6417
       
@@ -6440,40 +6440,40 @@  discard block
 block discarded – undo
6440 6440
 	}
6441 6441
 	
6442 6442
 	/**
6443
-	* Gets all detected arrival airports of the airplanes that have flown over
6444
-	*
6445
-	* @return Array the airport list
6446
-	*
6447
-	*/
6443
+	 * Gets all detected arrival airports of the airplanes that have flown over
6444
+	 *
6445
+	 * @return Array the airport list
6446
+	 *
6447
+	 */
6448 6448
 	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6449 6449
 	{
6450 6450
 		global $globalDBdriver;
6451 6451
 		$filter_query = $this->getFilter($filters,true,true);
6452 6452
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.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 
6453 6453
 			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 ";
6454
-                if ($olderthanmonths > 0) {
6455
-            		if ($globalDBdriver == 'mysql') {
6454
+				if ($olderthanmonths > 0) {
6455
+					if ($globalDBdriver == 'mysql') {
6456 6456
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6457 6457
 			} else {
6458 6458
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6459 6459
 			}
6460
-                if ($sincedate != '') {
6461
-            		if ($globalDBdriver == 'mysql') {
6460
+				if ($sincedate != '') {
6461
+					if ($globalDBdriver == 'mysql') {
6462 6462
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6463 6463
 			} else {
6464 6464
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6465 6465
 			}
6466 6466
 		}
6467
-            		if ($globalDBdriver == 'mysql') {
6467
+					if ($globalDBdriver == 'mysql') {
6468 6468
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6469 6469
 			} else {
6470 6470
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6471 6471
 			}
6472 6472
 		}
6473 6473
 
6474
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6475
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6476
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6474
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6475
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6476
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6477 6477
 					ORDER BY airport_arrival_icao_count DESC";
6478 6478
 		if ($limit) $query .= " LIMIT 10";
6479 6479
       
@@ -6503,11 +6503,11 @@  discard block
 block discarded – undo
6503 6503
 	}	
6504 6504
 	
6505 6505
 	/**
6506
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
6507
-	*
6508
-	* @return Array the airport list
6509
-	*
6510
-	*/
6506
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
6507
+	 *
6508
+	 * @return Array the airport list
6509
+	 *
6510
+	 */
6511 6511
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
6512 6512
 	{
6513 6513
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6539,11 +6539,11 @@  discard block
 block discarded – undo
6539 6539
 	
6540 6540
 	
6541 6541
 	/**
6542
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6543
-	*
6544
-	* @return Array the airport list
6545
-	*
6546
-	*/
6542
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6543
+	 *
6544
+	 * @return Array the airport list
6545
+	 *
6546
+	 */
6547 6547
 	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
6548 6548
 	{
6549 6549
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6574,11 +6574,11 @@  discard block
 block discarded – undo
6574 6574
 	
6575 6575
 	
6576 6576
 	/**
6577
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6578
-	*
6579
-	* @return Array the airport list
6580
-	*
6581
-	*/
6577
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6578
+	 *
6579
+	 * @return Array the airport list
6580
+	 *
6581
+	 */
6582 6582
 	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
6583 6583
 	{
6584 6584
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6612,11 +6612,11 @@  discard block
 block discarded – undo
6612 6612
 	
6613 6613
 	
6614 6614
 	/**
6615
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6616
-	*
6617
-	* @return Array the airport list
6618
-	*
6619
-	*/
6615
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6616
+	 *
6617
+	 * @return Array the airport list
6618
+	 *
6619
+	 */
6620 6620
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
6621 6621
 	{
6622 6622
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6646,11 +6646,11 @@  discard block
 block discarded – undo
6646 6646
 	
6647 6647
 	
6648 6648
 	/**
6649
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6650
-	*
6651
-	* @return Array the airport list
6652
-	*
6653
-	*/
6649
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6650
+	 *
6651
+	 * @return Array the airport list
6652
+	 *
6653
+	 */
6654 6654
 	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
6655 6655
 	{
6656 6656
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6684,11 +6684,11 @@  discard block
 block discarded – undo
6684 6684
 	
6685 6685
 	
6686 6686
 	/**
6687
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6688
-	*
6689
-	* @return Array the airport list
6690
-	*
6691
-	*/
6687
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6688
+	 *
6689
+	 * @return Array the airport list
6690
+	 *
6691
+	 */
6692 6692
 	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
6693 6693
 	{
6694 6694
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6719,11 +6719,11 @@  discard block
 block discarded – undo
6719 6719
 	
6720 6720
 	
6721 6721
 	/**
6722
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
6723
-	*
6724
-	* @return Array the airport list
6725
-	*
6726
-	*/
6722
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
6723
+	 *
6724
+	 * @return Array the airport list
6725
+	 *
6726
+	 */
6727 6727
 	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
6728 6728
 	{
6729 6729
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6756,11 +6756,11 @@  discard block
 block discarded – undo
6756 6756
 	
6757 6757
 	
6758 6758
 	/**
6759
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6760
-	*
6761
-	* @return Array the airport list
6762
-	*
6763
-	*/
6759
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6760
+	 *
6761
+	 * @return Array the airport list
6762
+	 *
6763
+	 */
6764 6764
 	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
6765 6765
 	{
6766 6766
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6790,11 +6790,11 @@  discard block
 block discarded – undo
6790 6790
 	
6791 6791
 	
6792 6792
 	/**
6793
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6794
-	*
6795
-	* @return Array the airport list
6796
-	*
6797
-	*/
6793
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6794
+	 *
6795
+	 * @return Array the airport list
6796
+	 *
6797
+	 */
6798 6798
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6799 6799
 	{
6800 6800
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6828,11 +6828,11 @@  discard block
 block discarded – undo
6828 6828
 	
6829 6829
 	
6830 6830
 	/**
6831
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
6832
-	*
6833
-	* @return Array the airport list
6834
-	*
6835
-	*/
6831
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
6832
+	 *
6833
+	 * @return Array the airport list
6834
+	 *
6835
+	 */
6836 6836
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6837 6837
 	{
6838 6838
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6863,11 +6863,11 @@  discard block
 block discarded – undo
6863 6863
 	
6864 6864
 	
6865 6865
 	/**
6866
-	* Gets all arrival airports of the airplanes that have flown over based on a date
6867
-	*
6868
-	* @return Array the airport list
6869
-	*
6870
-	*/
6866
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
6867
+	 *
6868
+	 * @return Array the airport list
6869
+	 *
6870
+	 */
6871 6871
 	public function countAllArrivalAirportsByDate($date,$filters = array())
6872 6872
 	{
6873 6873
 		global $globalTimezone, $globalDBdriver;
@@ -6913,11 +6913,11 @@  discard block
 block discarded – undo
6913 6913
 	
6914 6914
 	
6915 6915
 	/**
6916
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
6917
-	*
6918
-	* @return Array the airport list
6919
-	*
6920
-	*/
6916
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
6917
+	 *
6918
+	 * @return Array the airport list
6919
+	 *
6920
+	 */
6921 6921
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
6922 6922
 	{
6923 6923
 		global $globalTimezone, $globalDBdriver;
@@ -6960,11 +6960,11 @@  discard block
 block discarded – undo
6960 6960
 	
6961 6961
 	
6962 6962
 	/**
6963
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
6964
-	*
6965
-	* @return Array the airport list
6966
-	*
6967
-	*/
6963
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
6964
+	 *
6965
+	 * @return Array the airport list
6966
+	 *
6967
+	 */
6968 6968
 	public function countAllArrivalAirportsByIdent($ident,$filters = array())
6969 6969
 	{
6970 6970
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6997,11 +6997,11 @@  discard block
 block discarded – undo
6997 6997
 	
6998 6998
 	
6999 6999
 	/**
7000
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7001
-	*
7002
-	* @return Array the airport list
7003
-	*
7004
-	*/
7000
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7001
+	 *
7002
+	 * @return Array the airport list
7003
+	 *
7004
+	 */
7005 7005
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
7006 7006
 	{
7007 7007
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7032,11 +7032,11 @@  discard block
 block discarded – undo
7032 7032
 	
7033 7033
 	
7034 7034
 	/**
7035
-	* Gets all arrival airports of the airplanes that have flown over based on a country
7036
-	*
7037
-	* @return Array the airport list
7038
-	*
7039
-	*/
7035
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
7036
+	 *
7037
+	 * @return Array the airport list
7038
+	 *
7039
+	 */
7040 7040
 	public function countAllArrivalAirportsByCountry($country,$filters = array())
7041 7041
 	{
7042 7042
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7069,11 +7069,11 @@  discard block
 block discarded – undo
7069 7069
 	
7070 7070
 	
7071 7071
 	/**
7072
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
7073
-	*
7074
-	* @return Array the airport list
7075
-	*
7076
-	*/
7072
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
7073
+	 *
7074
+	 * @return Array the airport list
7075
+	 *
7076
+	 */
7077 7077
 	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
7078 7078
 	{
7079 7079
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7104,11 +7104,11 @@  discard block
 block discarded – undo
7104 7104
 
7105 7105
 
7106 7106
 	/**
7107
-	* Counts all airport departure countries
7108
-	*
7109
-	* @return Array the airport departure list
7110
-	*
7111
-	*/
7107
+	 * Counts all airport departure countries
7108
+	 *
7109
+	 * @return Array the airport departure list
7110
+	 *
7111
+	 */
7112 7112
 	public function countAllDepartureCountries($filters = array())
7113 7113
 	{
7114 7114
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7138,11 +7138,11 @@  discard block
 block discarded – undo
7138 7138
 	
7139 7139
 	
7140 7140
 	/**
7141
-	* Counts all airport arrival countries
7142
-	*
7143
-	* @return Array the airport arrival list
7144
-	*
7145
-	*/
7141
+	 * Counts all airport arrival countries
7142
+	 *
7143
+	 * @return Array the airport arrival list
7144
+	 *
7145
+	 */
7146 7146
 	public function countAllArrivalCountries($limit = true,$filters = array())
7147 7147
 	{
7148 7148
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7175,11 +7175,11 @@  discard block
 block discarded – undo
7175 7175
 
7176 7176
 
7177 7177
 	/**
7178
-	* Gets all route combinations
7179
-	*
7180
-	* @return Array the route list
7181
-	*
7182
-	*/
7178
+	 * Gets all route combinations
7179
+	 *
7180
+	 * @return Array the route list
7181
+	 *
7182
+	 */
7183 7183
 	public function countAllRoutes($filters = array())
7184 7184
 	{
7185 7185
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7218,11 +7218,11 @@  discard block
 block discarded – undo
7218 7218
 	
7219 7219
 	
7220 7220
 	/**
7221
-	* Gets all route combinations based on an aircraft
7222
-	*
7223
-	* @return Array the route list
7224
-	*
7225
-	*/
7221
+	 * Gets all route combinations based on an aircraft
7222
+	 *
7223
+	 * @return Array the route list
7224
+	 *
7225
+	 */
7226 7226
 	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
7227 7227
 	{
7228 7228
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7258,11 +7258,11 @@  discard block
 block discarded – undo
7258 7258
 	
7259 7259
 	
7260 7260
 	/**
7261
-	* Gets all route combinations based on an aircraft registration
7262
-	*
7263
-	* @return Array the route list
7264
-	*
7265
-	*/
7261
+	 * Gets all route combinations based on an aircraft registration
7262
+	 *
7263
+	 * @return Array the route list
7264
+	 *
7265
+	 */
7266 7266
 	public function countAllRoutesByRegistration($registration, $filters = array())
7267 7267
 	{
7268 7268
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7300,11 +7300,11 @@  discard block
 block discarded – undo
7300 7300
 	
7301 7301
 	
7302 7302
 	/**
7303
-	* Gets all route combinations based on an airline
7304
-	*
7305
-	* @return Array the route list
7306
-	*
7307
-	*/
7303
+	 * Gets all route combinations based on an airline
7304
+	 *
7305
+	 * @return Array the route list
7306
+	 *
7307
+	 */
7308 7308
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
7309 7309
 	{
7310 7310
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7342,11 +7342,11 @@  discard block
 block discarded – undo
7342 7342
 	
7343 7343
 	
7344 7344
 	/**
7345
-	* Gets all route combinations based on an airport
7346
-	*
7347
-	* @return Array the route list
7348
-	*
7349
-	*/
7345
+	 * Gets all route combinations based on an airport
7346
+	 *
7347
+	 * @return Array the route list
7348
+	 *
7349
+	 */
7350 7350
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
7351 7351
 	{
7352 7352
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7383,11 +7383,11 @@  discard block
 block discarded – undo
7383 7383
 	
7384 7384
 	
7385 7385
 	/**
7386
-	* Gets all route combinations based on an country
7387
-	*
7388
-	* @return Array the route list
7389
-	*
7390
-	*/
7386
+	 * Gets all route combinations based on an country
7387
+	 *
7388
+	 * @return Array the route list
7389
+	 *
7390
+	 */
7391 7391
 	public function countAllRoutesByCountry($country, $filters = array())
7392 7392
 	{
7393 7393
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7423,11 +7423,11 @@  discard block
 block discarded – undo
7423 7423
 
7424 7424
 
7425 7425
 	/**
7426
-	* Gets all route combinations based on an date
7427
-	*
7428
-	* @return Array the route list
7429
-	*
7430
-	*/
7426
+	 * Gets all route combinations based on an date
7427
+	 *
7428
+	 * @return Array the route list
7429
+	 *
7430
+	 */
7431 7431
 	public function countAllRoutesByDate($date, $filters = array())
7432 7432
 	{
7433 7433
 		global $globalTimezone, $globalDBdriver;
@@ -7477,11 +7477,11 @@  discard block
 block discarded – undo
7477 7477
 	
7478 7478
 	
7479 7479
 	/**
7480
-	* Gets all route combinations based on an ident/callsign
7481
-	*
7482
-	* @return Array the route list
7483
-	*
7484
-	*/
7480
+	 * Gets all route combinations based on an ident/callsign
7481
+	 *
7482
+	 * @return Array the route list
7483
+	 *
7484
+	 */
7485 7485
 	public function countAllRoutesByIdent($ident, $filters = array())
7486 7486
 	{
7487 7487
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7518,11 +7518,11 @@  discard block
 block discarded – undo
7518 7518
 	
7519 7519
 	
7520 7520
 	/**
7521
-	* Gets all route combinations based on an manufacturer
7522
-	*
7523
-	* @return Array the route list
7524
-	*
7525
-	*/
7521
+	 * Gets all route combinations based on an manufacturer
7522
+	 *
7523
+	 * @return Array the route list
7524
+	 *
7525
+	 */
7526 7526
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
7527 7527
 	{
7528 7528
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7560,11 +7560,11 @@  discard block
 block discarded – undo
7560 7560
 	
7561 7561
 	
7562 7562
 	/**
7563
-	* Gets all route combinations with waypoints
7564
-	*
7565
-	* @return Array the route list
7566
-	*
7567
-	*/
7563
+	 * Gets all route combinations with waypoints
7564
+	 *
7565
+	 * @return Array the route list
7566
+	 *
7567
+	 */
7568 7568
 	public function countAllRoutesWithWaypoints($filters = array())
7569 7569
 	{
7570 7570
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7601,11 +7601,11 @@  discard block
 block discarded – undo
7601 7601
 	}
7602 7602
 	
7603 7603
 	/**
7604
-	* Gets all callsigns that have flown over
7605
-	*
7606
-	* @return Array the callsign list
7607
-	*
7608
-	*/
7604
+	 * Gets all callsigns that have flown over
7605
+	 *
7606
+	 * @return Array the callsign list
7607
+	 *
7608
+	 */
7609 7609
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
7610 7610
 	{
7611 7611
 		global $globalDBdriver;
@@ -7643,11 +7643,11 @@  discard block
 block discarded – undo
7643 7643
 	}
7644 7644
 
7645 7645
 	/**
7646
-	* Gets all callsigns that have flown over
7647
-	*
7648
-	* @return Array the callsign list
7649
-	*
7650
-	*/
7646
+	 * Gets all callsigns that have flown over
7647
+	 *
7648
+	 * @return Array the callsign list
7649
+	 *
7650
+	 */
7651 7651
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7652 7652
 	{
7653 7653
 		global $globalDBdriver;
@@ -7688,11 +7688,11 @@  discard block
 block discarded – undo
7688 7688
 
7689 7689
 
7690 7690
 	/**
7691
-	* Counts all dates
7692
-	*
7693
-	* @return Array the date list
7694
-	*
7695
-	*/
7691
+	 * Counts all dates
7692
+	 *
7693
+	 * @return Array the date list
7694
+	 *
7695
+	 */
7696 7696
 	public function countAllDates($filters = array())
7697 7697
 	{
7698 7698
 		global $globalTimezone, $globalDBdriver;
@@ -7737,11 +7737,11 @@  discard block
 block discarded – undo
7737 7737
 	}
7738 7738
 	
7739 7739
 	/**
7740
-	* Counts all dates
7741
-	*
7742
-	* @return Array the date list
7743
-	*
7744
-	*/
7740
+	 * Counts all dates
7741
+	 *
7742
+	 * @return Array the date list
7743
+	 *
7744
+	 */
7745 7745
 	public function countAllDatesByAirlines($filters = array())
7746 7746
 	{
7747 7747
 		global $globalTimezone, $globalDBdriver;
@@ -7786,11 +7786,11 @@  discard block
 block discarded – undo
7786 7786
 	}	
7787 7787
 	
7788 7788
 	/**
7789
-	* Counts all dates during the last 7 days
7790
-	*
7791
-	* @return Array the date list
7792
-	*
7793
-	*/
7789
+	 * Counts all dates during the last 7 days
7790
+	 *
7791
+	 * @return Array the date list
7792
+	 *
7793
+	 */
7794 7794
 	public function countAllDatesLast7Days($filters = array())
7795 7795
 	{
7796 7796
 		global $globalTimezone, $globalDBdriver;
@@ -7812,7 +7812,7 @@  discard block
 block discarded – undo
7812 7812
 			$query .= " GROUP BY date_name 
7813 7813
 								ORDER BY date_name ASC";
7814 7814
 			$query_data = array(':offset' => $offset);
7815
-    		}
7815
+			}
7816 7816
 		
7817 7817
 		$sth = $this->db->prepare($query);
7818 7818
 		$sth->execute($query_data);
@@ -7832,11 +7832,11 @@  discard block
 block discarded – undo
7832 7832
 	}
7833 7833
 
7834 7834
 	/**
7835
-	* Counts all dates during the last month
7836
-	*
7837
-	* @return Array the date list
7838
-	*
7839
-	*/
7835
+	 * Counts all dates during the last month
7836
+	 *
7837
+	 * @return Array the date list
7838
+	 *
7839
+	 */
7840 7840
 	public function countAllDatesLastMonth($filters = array())
7841 7841
 	{
7842 7842
 		global $globalTimezone, $globalDBdriver;
@@ -7858,7 +7858,7 @@  discard block
 block discarded – undo
7858 7858
 			$query .= " GROUP BY date_name 
7859 7859
 								ORDER BY date_name ASC";
7860 7860
 			$query_data = array(':offset' => $offset);
7861
-    		}
7861
+			}
7862 7862
 		
7863 7863
 		$sth = $this->db->prepare($query);
7864 7864
 		$sth->execute($query_data);
@@ -7879,11 +7879,11 @@  discard block
 block discarded – undo
7879 7879
 
7880 7880
 
7881 7881
 	/**
7882
-	* Counts all dates during the last month
7883
-	*
7884
-	* @return Array the date list
7885
-	*
7886
-	*/
7882
+	 * Counts all dates during the last month
7883
+	 *
7884
+	 * @return Array the date list
7885
+	 *
7886
+	 */
7887 7887
 	public function countAllDatesLastMonthByAirlines($filters = array())
7888 7888
 	{
7889 7889
 		global $globalTimezone, $globalDBdriver;
@@ -7906,7 +7906,7 @@  discard block
 block discarded – undo
7906 7906
 								GROUP BY spotter_output.airline_icao, date_name 
7907 7907
 								ORDER BY date_name ASC";
7908 7908
 			$query_data = array(':offset' => $offset);
7909
-    		}
7909
+			}
7910 7910
 		
7911 7911
 		$sth = $this->db->prepare($query);
7912 7912
 		$sth->execute($query_data);
@@ -7928,11 +7928,11 @@  discard block
 block discarded – undo
7928 7928
 	
7929 7929
 
7930 7930
 	/**
7931
-	* Counts all month
7932
-	*
7933
-	* @return Array the month list
7934
-	*
7935
-	*/
7931
+	 * Counts all month
7932
+	 *
7933
+	 * @return Array the month list
7934
+	 *
7935
+	 */
7936 7936
 	public function countAllMonths($filters = array())
7937 7937
 	{
7938 7938
 		global $globalTimezone, $globalDBdriver;
@@ -7974,11 +7974,11 @@  discard block
 block discarded – undo
7974 7974
 	}
7975 7975
 
7976 7976
 	/**
7977
-	* Counts all month
7978
-	*
7979
-	* @return Array the month list
7980
-	*
7981
-	*/
7977
+	 * Counts all month
7978
+	 *
7979
+	 * @return Array the month list
7980
+	 *
7981
+	 */
7982 7982
 	public function countAllMonthsByAirlines($filters = array())
7983 7983
 	{
7984 7984
 		global $globalTimezone, $globalDBdriver;
@@ -8023,11 +8023,11 @@  discard block
 block discarded – undo
8023 8023
 	}
8024 8024
 
8025 8025
 	/**
8026
-	* Counts all military month
8027
-	*
8028
-	* @return Array the month list
8029
-	*
8030
-	*/
8026
+	 * Counts all military month
8027
+	 *
8028
+	 * @return Array the month list
8029
+	 *
8030
+	 */
8031 8031
 	public function countAllMilitaryMonths($filters = array())
8032 8032
 	{
8033 8033
 		global $globalTimezone, $globalDBdriver;
@@ -8068,11 +8068,11 @@  discard block
 block discarded – undo
8068 8068
 	}
8069 8069
 	
8070 8070
 	/**
8071
-	* Counts all month owners
8072
-	*
8073
-	* @return Array the month list
8074
-	*
8075
-	*/
8071
+	 * Counts all month owners
8072
+	 *
8073
+	 * @return Array the month list
8074
+	 *
8075
+	 */
8076 8076
 	public function countAllMonthsOwners($filters = array())
8077 8077
 	{
8078 8078
 		global $globalTimezone, $globalDBdriver;
@@ -8114,11 +8114,11 @@  discard block
 block discarded – undo
8114 8114
 	}
8115 8115
 	
8116 8116
 	/**
8117
-	* Counts all month owners
8118
-	*
8119
-	* @return Array the month list
8120
-	*
8121
-	*/
8117
+	 * Counts all month owners
8118
+	 *
8119
+	 * @return Array the month list
8120
+	 *
8121
+	 */
8122 8122
 	public function countAllMonthsOwnersByAirlines($filters = array())
8123 8123
 	{
8124 8124
 		global $globalTimezone, $globalDBdriver;
@@ -8161,11 +8161,11 @@  discard block
 block discarded – undo
8161 8161
 	}
8162 8162
 
8163 8163
 	/**
8164
-	* Counts all month pilot
8165
-	*
8166
-	* @return Array the month list
8167
-	*
8168
-	*/
8164
+	 * Counts all month pilot
8165
+	 *
8166
+	 * @return Array the month list
8167
+	 *
8168
+	 */
8169 8169
 	public function countAllMonthsPilots($filters = array())
8170 8170
 	{
8171 8171
 		global $globalTimezone, $globalDBdriver;
@@ -8207,11 +8207,11 @@  discard block
 block discarded – undo
8207 8207
 	}
8208 8208
 	
8209 8209
 	/**
8210
-	* Counts all month pilot
8211
-	*
8212
-	* @return Array the month list
8213
-	*
8214
-	*/
8210
+	 * Counts all month pilot
8211
+	 *
8212
+	 * @return Array the month list
8213
+	 *
8214
+	 */
8215 8215
 	public function countAllMonthsPilotsByAirlines($filters = array())
8216 8216
 	{
8217 8217
 		global $globalTimezone, $globalDBdriver;
@@ -8254,11 +8254,11 @@  discard block
 block discarded – undo
8254 8254
 	}
8255 8255
 
8256 8256
 	/**
8257
-	* Counts all month airline
8258
-	*
8259
-	* @return Array the month list
8260
-	*
8261
-	*/
8257
+	 * Counts all month airline
8258
+	 *
8259
+	 * @return Array the month list
8260
+	 *
8261
+	 */
8262 8262
 	public function countAllMonthsAirlines($filters = array())
8263 8263
 	{
8264 8264
 		global $globalTimezone, $globalDBdriver;
@@ -8300,11 +8300,11 @@  discard block
 block discarded – undo
8300 8300
 	}
8301 8301
 	
8302 8302
 	/**
8303
-	* Counts all month aircraft
8304
-	*
8305
-	* @return Array the month list
8306
-	*
8307
-	*/
8303
+	 * Counts all month aircraft
8304
+	 *
8305
+	 * @return Array the month list
8306
+	 *
8307
+	 */
8308 8308
 	public function countAllMonthsAircrafts($filters = array())
8309 8309
 	{
8310 8310
 		global $globalTimezone, $globalDBdriver;
@@ -8347,11 +8347,11 @@  discard block
 block discarded – undo
8347 8347
 	
8348 8348
 
8349 8349
 	/**
8350
-	* Counts all month aircraft
8351
-	*
8352
-	* @return Array the month list
8353
-	*
8354
-	*/
8350
+	 * Counts all month aircraft
8351
+	 *
8352
+	 * @return Array the month list
8353
+	 *
8354
+	 */
8355 8355
 	public function countAllMonthsAircraftsByAirlines($filters = array())
8356 8356
 	{
8357 8357
 		global $globalTimezone, $globalDBdriver;
@@ -8394,11 +8394,11 @@  discard block
 block discarded – undo
8394 8394
 	}
8395 8395
 
8396 8396
 	/**
8397
-	* Counts all month real arrival
8398
-	*
8399
-	* @return Array the month list
8400
-	*
8401
-	*/
8397
+	 * Counts all month real arrival
8398
+	 *
8399
+	 * @return Array the month list
8400
+	 *
8401
+	 */
8402 8402
 	public function countAllMonthsRealArrivals($filters = array())
8403 8403
 	{
8404 8404
 		global $globalTimezone, $globalDBdriver;
@@ -8441,11 +8441,11 @@  discard block
 block discarded – undo
8441 8441
 	
8442 8442
 
8443 8443
 	/**
8444
-	* Counts all month real arrival
8445
-	*
8446
-	* @return Array the month list
8447
-	*
8448
-	*/
8444
+	 * Counts all month real arrival
8445
+	 *
8446
+	 * @return Array the month list
8447
+	 *
8448
+	 */
8449 8449
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
8450 8450
 	{
8451 8451
 		global $globalTimezone, $globalDBdriver;
@@ -8489,11 +8489,11 @@  discard block
 block discarded – undo
8489 8489
 	
8490 8490
 
8491 8491
 	/**
8492
-	* Counts all dates during the last year
8493
-	*
8494
-	* @return Array the date list
8495
-	*
8496
-	*/
8492
+	 * Counts all dates during the last year
8493
+	 *
8494
+	 * @return Array the date list
8495
+	 *
8496
+	 */
8497 8497
 	public function countAllMonthsLastYear($filters)
8498 8498
 	{
8499 8499
 		global $globalTimezone, $globalDBdriver;
@@ -8515,7 +8515,7 @@  discard block
 block discarded – undo
8515 8515
 			$query .= " GROUP BY year_name, month_name
8516 8516
 								ORDER BY year_name, month_name ASC";
8517 8517
 			$query_data = array(':offset' => $offset);
8518
-    		}
8518
+			}
8519 8519
 		
8520 8520
 		$sth = $this->db->prepare($query);
8521 8521
 		$sth->execute($query_data);
@@ -8538,11 +8538,11 @@  discard block
 block discarded – undo
8538 8538
 	
8539 8539
 	
8540 8540
 	/**
8541
-	* Counts all hours
8542
-	*
8543
-	* @return Array the hour list
8544
-	*
8545
-	*/
8541
+	 * Counts all hours
8542
+	 *
8543
+	 * @return Array the hour list
8544
+	 *
8545
+	 */
8546 8546
 	public function countAllHours($orderby,$filters = array())
8547 8547
 	{
8548 8548
 		global $globalTimezone, $globalDBdriver;
@@ -8603,11 +8603,11 @@  discard block
 block discarded – undo
8603 8603
 	}
8604 8604
 	
8605 8605
 	/**
8606
-	* Counts all hours
8607
-	*
8608
-	* @return Array the hour list
8609
-	*
8610
-	*/
8606
+	 * Counts all hours
8607
+	 *
8608
+	 * @return Array the hour list
8609
+	 *
8610
+	 */
8611 8611
 	public function countAllHoursByAirlines($orderby, $filters = array())
8612 8612
 	{
8613 8613
 		global $globalTimezone, $globalDBdriver;
@@ -8670,11 +8670,11 @@  discard block
 block discarded – undo
8670 8670
 
8671 8671
 
8672 8672
 	/**
8673
-	* Counts all hours by airline
8674
-	*
8675
-	* @return Array the hour list
8676
-	*
8677
-	*/
8673
+	 * Counts all hours by airline
8674
+	 *
8675
+	 * @return Array the hour list
8676
+	 *
8677
+	 */
8678 8678
 	public function countAllHoursByAirline($airline_icao, $filters = array())
8679 8679
 	{
8680 8680
 		global $globalTimezone, $globalDBdriver;
@@ -8720,11 +8720,11 @@  discard block
 block discarded – undo
8720 8720
 	
8721 8721
 	
8722 8722
 	/**
8723
-	* Counts all hours by aircraft
8724
-	*
8725
-	* @return Array the hour list
8726
-	*
8727
-	*/
8723
+	 * Counts all hours by aircraft
8724
+	 *
8725
+	 * @return Array the hour list
8726
+	 *
8727
+	 */
8728 8728
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
8729 8729
 	{
8730 8730
 		global $globalTimezone, $globalDBdriver;
@@ -8767,11 +8767,11 @@  discard block
 block discarded – undo
8767 8767
 	
8768 8768
 	
8769 8769
 	/**
8770
-	* Counts all hours by aircraft registration
8771
-	*
8772
-	* @return Array the hour list
8773
-	*
8774
-	*/
8770
+	 * Counts all hours by aircraft registration
8771
+	 *
8772
+	 * @return Array the hour list
8773
+	 *
8774
+	 */
8775 8775
 	public function countAllHoursByRegistration($registration, $filters = array())
8776 8776
 	{
8777 8777
 		global $globalTimezone, $globalDBdriver;
@@ -8814,11 +8814,11 @@  discard block
 block discarded – undo
8814 8814
 	
8815 8815
 	
8816 8816
 	/**
8817
-	* Counts all hours by airport
8818
-	*
8819
-	* @return Array the hour list
8820
-	*
8821
-	*/
8817
+	 * Counts all hours by airport
8818
+	 *
8819
+	 * @return Array the hour list
8820
+	 *
8821
+	 */
8822 8822
 	public function countAllHoursByAirport($airport_icao, $filters = array())
8823 8823
 	{
8824 8824
 		global $globalTimezone, $globalDBdriver;
@@ -8862,11 +8862,11 @@  discard block
 block discarded – undo
8862 8862
 	
8863 8863
 	
8864 8864
 	/**
8865
-	* Counts all hours by manufacturer
8866
-	*
8867
-	* @return Array the hour list
8868
-	*
8869
-	*/
8865
+	 * Counts all hours by manufacturer
8866
+	 *
8867
+	 * @return Array the hour list
8868
+	 *
8869
+	 */
8870 8870
 	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
8871 8871
 	{
8872 8872
 		global $globalTimezone, $globalDBdriver;
@@ -8910,11 +8910,11 @@  discard block
 block discarded – undo
8910 8910
 	
8911 8911
 	
8912 8912
 	/**
8913
-	* Counts all hours by date
8914
-	*
8915
-	* @return Array the hour list
8916
-	*
8917
-	*/
8913
+	 * Counts all hours by date
8914
+	 *
8915
+	 * @return Array the hour list
8916
+	 *
8917
+	 */
8918 8918
 	public function countAllHoursByDate($date, $filters = array())
8919 8919
 	{
8920 8920
 		global $globalTimezone, $globalDBdriver;
@@ -8958,11 +8958,11 @@  discard block
 block discarded – undo
8958 8958
 	
8959 8959
 	
8960 8960
 	/**
8961
-	* Counts all hours by a ident/callsign
8962
-	*
8963
-	* @return Array the hour list
8964
-	*
8965
-	*/
8961
+	 * Counts all hours by a ident/callsign
8962
+	 *
8963
+	 * @return Array the hour list
8964
+	 *
8965
+	 */
8966 8966
 	public function countAllHoursByIdent($ident, $filters = array())
8967 8967
 	{
8968 8968
 		global $globalTimezone, $globalDBdriver;
@@ -9007,11 +9007,11 @@  discard block
 block discarded – undo
9007 9007
 	
9008 9008
 	
9009 9009
 	/**
9010
-	* Counts all hours by route
9011
-	*
9012
-	* @return Array the hour list
9013
-	*
9014
-	*/
9010
+	 * Counts all hours by route
9011
+	 *
9012
+	 * @return Array the hour list
9013
+	 *
9014
+	 */
9015 9015
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
9016 9016
 	{
9017 9017
 		global $globalTimezone, $globalDBdriver;
@@ -9055,11 +9055,11 @@  discard block
 block discarded – undo
9055 9055
 	
9056 9056
 	
9057 9057
 	/**
9058
-	* Counts all hours by country
9059
-	*
9060
-	* @return Array the hour list
9061
-	*
9062
-	*/
9058
+	 * Counts all hours by country
9059
+	 *
9060
+	 * @return Array the hour list
9061
+	 *
9062
+	 */
9063 9063
 	public function countAllHoursByCountry($country, $filters = array())
9064 9064
 	{
9065 9065
 		global $globalTimezone, $globalDBdriver;
@@ -9104,11 +9104,11 @@  discard block
 block discarded – undo
9104 9104
 
9105 9105
 
9106 9106
 	/**
9107
-	* Counts all aircraft that have flown over
9108
-	*
9109
-	* @return Integer the number of aircrafts
9110
-	*
9111
-	*/
9107
+	 * Counts all aircraft that have flown over
9108
+	 *
9109
+	 * @return Integer the number of aircrafts
9110
+	 *
9111
+	 */
9112 9112
 	public function countOverallAircrafts($filters = array())
9113 9113
 	{
9114 9114
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9120,11 +9120,11 @@  discard block
 block discarded – undo
9120 9120
 	}
9121 9121
 
9122 9122
 	/**
9123
-	* Counts all flight that really arrival
9124
-	*
9125
-	* @return Integer the number of aircrafts
9126
-	*
9127
-	*/
9123
+	 * Counts all flight that really arrival
9124
+	 *
9125
+	 * @return Integer the number of aircrafts
9126
+	 *
9127
+	 */
9128 9128
 	public function countOverallArrival($filters = array())
9129 9129
 	{
9130 9130
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9137,11 +9137,11 @@  discard block
 block discarded – undo
9137 9137
 	}
9138 9138
 
9139 9139
 	/**
9140
-	* Counts all pilots that have flown over
9141
-	*
9142
-	* @return Integer the number of pilots
9143
-	*
9144
-	*/
9140
+	 * Counts all pilots that have flown over
9141
+	 *
9142
+	 * @return Integer the number of pilots
9143
+	 *
9144
+	 */
9145 9145
 	public function countOverallPilots($filters = array())
9146 9146
 	{
9147 9147
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9153,11 +9153,11 @@  discard block
 block discarded – undo
9153 9153
 	}
9154 9154
 
9155 9155
 	/**
9156
-	* Counts all owners that have flown over
9157
-	*
9158
-	* @return Integer the number of owners
9159
-	*
9160
-	*/
9156
+	 * Counts all owners that have flown over
9157
+	 *
9158
+	 * @return Integer the number of owners
9159
+	 *
9160
+	 */
9161 9161
 	public function countOverallOwners($filters = array())
9162 9162
 	{
9163 9163
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9170,11 +9170,11 @@  discard block
 block discarded – undo
9170 9170
 	
9171 9171
 	
9172 9172
 	/**
9173
-	* Counts all flights that have flown over
9174
-	*
9175
-	* @return Integer the number of flights
9176
-	*
9177
-	*/
9173
+	 * Counts all flights that have flown over
9174
+	 *
9175
+	 * @return Integer the number of flights
9176
+	 *
9177
+	 */
9178 9178
 	public function countOverallFlights($filters = array())
9179 9179
 	{
9180 9180
 		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
@@ -9187,11 +9187,11 @@  discard block
 block discarded – undo
9187 9187
 	}
9188 9188
 	
9189 9189
 	/**
9190
-	* Counts all military flights that have flown over
9191
-	*
9192
-	* @return Integer the number of flights
9193
-	*
9194
-	*/
9190
+	 * Counts all military flights that have flown over
9191
+	 *
9192
+	 * @return Integer the number of flights
9193
+	 *
9194
+	 */
9195 9195
 	public function countOverallMilitaryFlights($filters = array())
9196 9196
 	{
9197 9197
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9206,11 +9206,11 @@  discard block
 block discarded – undo
9206 9206
 	
9207 9207
 	
9208 9208
 	/**
9209
-	* Counts all airlines that have flown over
9210
-	*
9211
-	* @return Integer the number of airlines
9212
-	*
9213
-	*/
9209
+	 * Counts all airlines that have flown over
9210
+	 *
9211
+	 * @return Integer the number of airlines
9212
+	 *
9213
+	 */
9214 9214
 	public function countOverallAirlines($filters = array())
9215 9215
 	{
9216 9216
 		$query  = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
@@ -9224,11 +9224,11 @@  discard block
 block discarded – undo
9224 9224
 
9225 9225
   
9226 9226
 	/**
9227
-	* Counts all hours of today
9228
-	*
9229
-	* @return Array the hour list
9230
-	*
9231
-	*/
9227
+	 * Counts all hours of today
9228
+	 *
9229
+	 * @return Array the hour list
9230
+	 *
9231
+	 */
9232 9232
 	public function countAllHoursFromToday($filters = array())
9233 9233
 	{
9234 9234
 		global $globalTimezone, $globalDBdriver;
@@ -9268,11 +9268,11 @@  discard block
 block discarded – undo
9268 9268
 	}
9269 9269
     
9270 9270
 	/**
9271
-	* Gets all the spotter information based on calculated upcoming flights
9272
-	*
9273
-	* @return Array the spotter information
9274
-	*
9275
-	*/
9271
+	 * Gets all the spotter information based on calculated upcoming flights
9272
+	 *
9273
+	 * @return Array the spotter information
9274
+	 *
9275
+	 */
9276 9276
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
9277 9277
 	{
9278 9278
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -9347,12 +9347,12 @@  discard block
 block discarded – undo
9347 9347
 	}
9348 9348
     
9349 9349
     
9350
-     /**
9351
-	* Gets the Barrie Spotter ID based on the FlightAware ID
9352
-	*
9353
-	* @return Integer the Barrie Spotter ID
9350
+	 /**
9351
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
9352
+	  *
9353
+	  * @return Integer the Barrie Spotter ID
9354 9354
 q	*
9355
-	*/
9355
+	  */
9356 9356
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
9357 9357
 	{
9358 9358
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -9373,13 +9373,13 @@  discard block
 block discarded – undo
9373 9373
   
9374 9374
  
9375 9375
 	/**
9376
-	* Parses a date string
9377
-	*
9378
-	* @param String $dateString the date string
9379
-	* @param String $timezone the timezone of a user
9380
-	* @return Array the time information
9381
-	*
9382
-	*/
9376
+	 * Parses a date string
9377
+	 *
9378
+	 * @param String $dateString the date string
9379
+	 * @param String $timezone the timezone of a user
9380
+	 * @return Array the time information
9381
+	 *
9382
+	 */
9383 9383
 	public function parseDateString($dateString, $timezone = '')
9384 9384
 	{
9385 9385
 		$time_array = array();
@@ -9415,12 +9415,12 @@  discard block
 block discarded – undo
9415 9415
 	
9416 9416
 	
9417 9417
 	/**
9418
-	* Parses the direction degrees to working
9419
-	*
9420
-	* @param Float $direction the direction in degrees
9421
-	* @return Array the direction information
9422
-	*
9423
-	*/
9418
+	 * Parses the direction degrees to working
9419
+	 *
9420
+	 * @param Float $direction the direction in degrees
9421
+	 * @return Array the direction information
9422
+	 *
9423
+	 */
9424 9424
 	public function parseDirection($direction = 0)
9425 9425
 	{
9426 9426
 		if ($direction == '') $direction = 0;
@@ -9499,12 +9499,12 @@  discard block
 block discarded – undo
9499 9499
 	
9500 9500
 	
9501 9501
 	/**
9502
-	* Gets the aircraft registration
9503
-	*
9504
-	* @param String $flightaware_id the flight aware id
9505
-	* @return String the aircraft registration
9506
-	*
9507
-	*/
9502
+	 * Gets the aircraft registration
9503
+	 *
9504
+	 * @param String $flightaware_id the flight aware id
9505
+	 * @return String the aircraft registration
9506
+	 *
9507
+	 */
9508 9508
 	
9509 9509
 	public function getAircraftRegistration($flightaware_id)
9510 9510
 	{
@@ -9533,12 +9533,12 @@  discard block
 block discarded – undo
9533 9533
 
9534 9534
 
9535 9535
 	/**
9536
-	* Gets the aircraft registration from ModeS
9537
-	*
9538
-	* @param String $aircraft_modes the flight ModeS in hex
9539
-	* @return String the aircraft registration
9540
-	*
9541
-	*/
9536
+	 * Gets the aircraft registration from ModeS
9537
+	 *
9538
+	 * @param String $aircraft_modes the flight ModeS in hex
9539
+	 * @return String the aircraft registration
9540
+	 *
9541
+	 */
9542 9542
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
9543 9543
 	{
9544 9544
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9551,19 +9551,19 @@  discard block
 block discarded – undo
9551 9551
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9552 9552
 		$sth->closeCursor();
9553 9553
 		if (count($row) > 0) {
9554
-		    //return $row['Registration'];
9555
-		    return $row['registration'];
9554
+			//return $row['Registration'];
9555
+			return $row['registration'];
9556 9556
 		} else return '';
9557 9557
 	
9558 9558
 	}
9559 9559
 
9560 9560
 	/**
9561
-	* Gets the aircraft type from ModeS
9562
-	*
9563
-	* @param String $aircraft_modes the flight ModeS in hex
9564
-	* @return String the aircraft type
9565
-	*
9566
-	*/
9561
+	 * Gets the aircraft type from ModeS
9562
+	 *
9563
+	 * @param String $aircraft_modes the flight ModeS in hex
9564
+	 * @return String the aircraft type
9565
+	 *
9566
+	 */
9567 9567
 	public function getAircraftTypeBymodeS($aircraft_modes)
9568 9568
 	{
9569 9569
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9576,19 +9576,19 @@  discard block
 block discarded – undo
9576 9576
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9577 9577
 		$sth->closeCursor();
9578 9578
 		if (count($row) > 0) {
9579
-		    if ($row['type_flight'] == null) return '';
9580
-		    else return $row['type_flight'];
9579
+			if ($row['type_flight'] == null) return '';
9580
+			else return $row['type_flight'];
9581 9581
 		} else return '';
9582 9582
 	
9583 9583
 	}
9584 9584
 
9585 9585
 	/**
9586
-	* Gets Countrie from latitude/longitude
9587
-	*
9588
-	* @param Float $latitude latitute of the flight
9589
-	* @param Float $longitude longitute of the flight
9590
-	* @return String the countrie
9591
-	*/
9586
+	 * Gets Countrie from latitude/longitude
9587
+	 *
9588
+	 * @param Float $latitude latitute of the flight
9589
+	 * @param Float $longitude longitute of the flight
9590
+	 * @return String the countrie
9591
+	 */
9592 9592
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
9593 9593
 	{
9594 9594
 		global $globalDBdriver, $globalDebug;
@@ -9625,12 +9625,12 @@  discard block
 block discarded – undo
9625 9625
 	}
9626 9626
 
9627 9627
 	/**
9628
-	* converts the registration code using the country prefix
9629
-	*
9630
-	* @param String $registration the aircraft registration
9631
-	* @return String the aircraft registration
9632
-	*
9633
-	*/
9628
+	 * converts the registration code using the country prefix
9629
+	 *
9630
+	 * @param String $registration the aircraft registration
9631
+	 * @return String the aircraft registration
9632
+	 *
9633
+	 */
9634 9634
 	public function convertAircraftRegistration($registration)
9635 9635
 	{
9636 9636
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9682,12 +9682,12 @@  discard block
 block discarded – undo
9682 9682
 	}
9683 9683
 
9684 9684
 	/**
9685
-	* Country from the registration code
9686
-	*
9687
-	* @param String $registration the aircraft registration
9688
-	* @return String the country
9689
-	*
9690
-	*/
9685
+	 * Country from the registration code
9686
+	 *
9687
+	 * @param String $registration the aircraft registration
9688
+	 * @return String the country
9689
+	 *
9690
+	 */
9691 9691
 	public function countryFromAircraftRegistration($registration)
9692 9692
 	{
9693 9693
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9706,8 +9706,8 @@  discard block
 block discarded – undo
9706 9706
 				$country = $row['country'];
9707 9707
 			}
9708 9708
 		} else {
9709
-    			$registration_1 = substr($registration, 0, 1);
9710
-		        $registration_2 = substr($registration, 0, 2);
9709
+				$registration_1 = substr($registration, 0, 1);
9710
+				$registration_2 = substr($registration, 0, 2);
9711 9711
 
9712 9712
 			$country = '';
9713 9713
 			//first get the prefix based on two characters
@@ -9743,11 +9743,11 @@  discard block
 block discarded – undo
9743 9743
 	}
9744 9744
 	
9745 9745
 	/**
9746
-	* Set a new highlight value for a flight
9747
-	*
9748
-	* @param String $flightaware_id flightaware_id from spotter_output table
9749
-	* @param String $highlight New highlight value
9750
-	*/
9746
+	 * Set a new highlight value for a flight
9747
+	 *
9748
+	 * @param String $flightaware_id flightaware_id from spotter_output table
9749
+	 * @param String $highlight New highlight value
9750
+	 */
9751 9751
 	public function setHighlightFlight($flightaware_id,$highlight) {
9752 9752
 		
9753 9753
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -9756,12 +9756,12 @@  discard block
 block discarded – undo
9756 9756
 	}
9757 9757
 	
9758 9758
 	/**
9759
-	* Gets the short url from bit.ly
9760
-	*
9761
-	* @param String $url the full url
9762
-	* @return String the bit.ly url
9763
-	*
9764
-	*/
9759
+	 * Gets the short url from bit.ly
9760
+	 *
9761
+	 * @param String $url the full url
9762
+	 * @return String the bit.ly url
9763
+	 *
9764
+	 */
9765 9765
 	public function getBitlyURL($url)
9766 9766
 	{
9767 9767
 		global $globalBitlyAccessToken;
@@ -10050,11 +10050,11 @@  discard block
 block discarded – undo
10050 10050
 			$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 
10051 10051
 	                      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)) 
10052 10052
 	                      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;";
10053
-                } else {
10053
+				} else {
10054 10054
 			$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 
10055 10055
 	                      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)) 
10056 10056
 	                      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;";
10057
-    		}
10057
+			}
10058 10058
 		$sth = $this->db->prepare($query);
10059 10059
 		$sth->execute();
10060 10060
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
Braces   +664 added lines, -230 removed lines patch added patch discarded remove patch
@@ -27,7 +27,9 @@  discard block
 block discarded – undo
27 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)) {
31
+			$filter = array_merge($filter,$globalFilter);
32
+		}
31 33
 		$filter_query_join = '';
32 34
 		$filter_query_where = '';
33 35
 		foreach($filters as $flt) {
@@ -72,8 +74,11 @@  discard block
 block discarded – undo
72 74
 				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
73 75
 			}
74 76
 		}
75
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
76
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
77
+		if ($filter_query_where == '' && $where) {
78
+			$filter_query_where = ' WHERE';
79
+		} elseif ($filter_query_where != '' && $and) {
80
+			$filter_query_where .= ' AND';
81
+		}
77 82
 		$filter_query = $filter_query_join.$filter_query_where;
78 83
 		return $filter_query;
79 84
 	}
@@ -93,10 +98,18 @@  discard block
 block discarded – undo
93 98
 		$Image = new Image($this->db);
94 99
 		$Schedule = new Schedule($this->db);
95 100
 		$ACARS = new ACARS($this->db);
96
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
97
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
98
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
99
-		if (!isset($globalVAM)) $globalVAM = FALSE;
101
+		if (!isset($globalIVAO)) {
102
+			$globalIVAO = FALSE;
103
+		}
104
+		if (!isset($globalVATSIM)) {
105
+			$globalVATSIM = FALSE;
106
+		}
107
+		if (!isset($globalphpVMS)) {
108
+			$globalphpVMS = FALSE;
109
+		}
110
+		if (!isset($globalVAM)) {
111
+			$globalVAM = FALSE;
112
+		}
100 113
 		date_default_timezone_set('UTC');
101 114
 		
102 115
 		if (!is_string($query))
@@ -143,21 +156,35 @@  discard block
 block discarded – undo
143 156
 			} else {
144 157
 				$temp_array['spotter_id'] = '';
145 158
 			}
146
-			if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id'];
147
-			if (isset($row['modes'])) $temp_array['modes'] = $row['modes'];
159
+			if (isset($row['flightaware_id'])) {
160
+				$temp_array['flightaware_id'] = $row['flightaware_id'];
161
+			}
162
+			if (isset($row['modes'])) {
163
+				$temp_array['modes'] = $row['modes'];
164
+			}
148 165
 			$temp_array['ident'] = $row['ident'];
149 166
 			if (isset($row['registration']) && $row['registration'] != '') {
150 167
 				$temp_array['registration'] = $row['registration'];
151 168
 			} elseif (isset($temp_array['modes'])) {
152 169
 				$temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']);
153
-			} else $temp_array['registration'] = '';
154
-			if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao'];
170
+			} else {
171
+				$temp_array['registration'] = '';
172
+			}
173
+			if (isset($row['aircraft_icao'])) {
174
+				$temp_array['aircraft_type'] = $row['aircraft_icao'];
175
+			}
155 176
 			
156 177
 			$temp_array['departure_airport'] = $row['departure_airport_icao'];
157 178
 			$temp_array['arrival_airport'] = $row['arrival_airport_icao'];
158
-			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
159
-			if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude'];
160
-			if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude'];
179
+			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) {
180
+				$temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
181
+			}
182
+			if (isset($row['latitude'])) {
183
+				$temp_array['latitude'] = $row['latitude'];
184
+			}
185
+			if (isset($row['longitude'])) {
186
+				$temp_array['longitude'] = $row['longitude'];
187
+			}
161 188
 			/*
162 189
 			if (Connection->tableExists('countries')) {
163 190
 				$country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']);
@@ -167,8 +194,12 @@  discard block
 block discarded – undo
167 194
 				}
168 195
 			}
169 196
 			*/
170
-			if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints'];
171
-			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
197
+			if (isset($row['waypoints'])) {
198
+				$temp_array['waypoints'] = $row['waypoints'];
199
+			}
200
+			if (isset($row['format_source'])) {
201
+				$temp_array['format_source'] = $row['format_source'];
202
+			}
172 203
 			if (isset($row['route_stop'])) {
173 204
 				$temp_array['route_stop'] = $row['route_stop'];
174 205
 				if ($row['route_stop'] != '') {
@@ -187,13 +218,19 @@  discard block
 block discarded – undo
187 218
 					}
188 219
 				}
189 220
 			}
190
-			if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude'];
221
+			if (isset($row['altitude'])) {
222
+				$temp_array['altitude'] = $row['altitude'];
223
+			}
191 224
 			if (isset($row['heading'])) {
192 225
 				$temp_array['heading'] = $row['heading'];
193 226
 				$heading_direction = $this->parseDirection($row['heading']);
194
-				if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
227
+				if (isset($heading_direction[0]['direction_fullname'])) {
228
+					$temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
229
+				}
230
+			}
231
+			if (isset($row['ground_speed'])) {
232
+				$temp_array['ground_speed'] = $row['ground_speed'];
195 233
 			}
196
-			if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed'];
197 234
 			$temp_array['image'] = "";
198 235
 			$temp_array['image_thumbnail'] = "";
199 236
 			$temp_array['image_source'] = "";
@@ -201,7 +238,9 @@  discard block
 block discarded – undo
201 238
  
202 239
 			if (isset($row['highlight'])) {
203 240
 				$temp_array['highlight'] = $row['highlight'];
204
-			} else $temp_array['highlight'] = '';
241
+			} else {
242
+				$temp_array['highlight'] = '';
243
+			}
205 244
 			
206 245
 			if (isset($row['date'])) {
207 246
 				$dateArray = $this->parseDateString($row['date']);
@@ -249,7 +288,9 @@  discard block
 block discarded – undo
249 288
 				
250 289
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
251 290
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
252
-					} else $temp_array['aircraft_shadow'] = 'default.png';
291
+					} else {
292
+						$temp_array['aircraft_shadow'] = 'default.png';
293
+					}
253 294
                                 } else {
254 295
                             		$temp_array['aircraft_shadow'] = 'default.png';
255 296
 					$temp_array['aircraft_name'] = 'N/A';
@@ -257,11 +298,17 @@  discard block
 block discarded – undo
257 298
                             	}
258 299
 			}
259 300
 			$fromsource = NULL;
260
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
261
-			elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
262
-			elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
263
-			elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
264
-			elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
301
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
302
+				$fromsource = $globalAirlinesSource;
303
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
304
+				$fromsource = 'vatsim';
305
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
306
+				$fromsource = 'ivao';
307
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
308
+				$fromsource = 'vatsim';
309
+			} elseif (isset($globalIVAO) && $globalIVAO) {
310
+				$fromsource = 'ivao';
311
+			}
265 312
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
266 313
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
267 314
 					if (is_numeric(substr($row['ident'], 2, 1))) {
@@ -284,12 +331,18 @@  discard block
 block discarded – undo
284 331
 				}
285 332
 			} else {
286 333
 				$temp_array['airline_icao'] = $row['airline_icao'];
287
-				if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata'];
288
-				else $temp_array['airline_iata'] = 'N/A';
334
+				if (isset($row['airline_iata'])) {
335
+					$temp_array['airline_iata'] = $row['airline_iata'];
336
+				} else {
337
+					$temp_array['airline_iata'] = 'N/A';
338
+				}
289 339
 				$temp_array['airline_name'] = $row['airline_name'];
290 340
 				$temp_array['airline_country'] = $row['airline_country'];
291
-				if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign'];
292
-				else $temp_array['airline_callsign'] = 'N/A';
341
+				if (isset($row['airline_callsign'])) {
342
+					$temp_array['airline_callsign'] = $row['airline_callsign'];
343
+				} else {
344
+					$temp_array['airline_callsign'] = 'N/A';
345
+				}
293 346
 				$temp_array['airline_type'] = $row['airline_type'];
294 347
 				if ($temp_array['airline_icao'] != '' && $temp_array['airline_iata'] == 'N/A') {
295 348
 					$airline_array = $this->getAllAirlineInfo($temp_array['airline_icao']);
@@ -316,7 +369,9 @@  discard block
 block discarded – undo
316 369
 			}
317 370
 			if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) {
318 371
 				$owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']);
319
-				if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
372
+				if ($owner_info['owner'] != '') {
373
+					$temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
374
+				}
320 375
 				$temp_array['aircraft_base'] = $owner_info['base'];
321 376
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
322 377
 			}
@@ -324,9 +379,14 @@  discard block
 block discarded – undo
324 379
 			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
325 380
 			{
326 381
 				if ($globalIVAO) {
327
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
328
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
329
-				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
382
+					if (isset($temp_array['airline_icao'])) {
383
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
384
+					} else {
385
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
386
+					}
387
+				} else {
388
+					$image_array = $Image->getSpotterImage($temp_array['registration']);
389
+				}
330 390
 				if (count($image_array) > 0) {
331 391
 					$temp_array['image'] = $image_array[0]['image'];
332 392
 					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -377,7 +437,9 @@  discard block
 block discarded – undo
377 437
 			//if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') {
378 438
 			if ($row['departure_airport_icao'] != '') {
379 439
 				$departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']);
380
-				if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA');
440
+				if (!isset($departure_airport_array[0]['name'])) {
441
+					$departure_airport_array = $this->getAllAirportInfo('NA');
442
+				}
381 443
 			/*
382 444
 			} elseif ($row['departure_airport_name'] != '') {
383 445
 				$temp_array['departure_airport_name'] = $row['departure_airport_name'];
@@ -385,7 +447,9 @@  discard block
 block discarded – undo
385 447
 				$temp_array['departure_airport_country'] = $row['departure_airport_country'];
386 448
 				$temp_array['departure_airport_icao'] = $row['departure_airport_icao'];
387 449
 			*/
388
-			} else $departure_airport_array = $this->getAllAirportInfo('NA');
450
+			} else {
451
+				$departure_airport_array = $this->getAllAirportInfo('NA');
452
+			}
389 453
 			if (isset($departure_airport_array[0]['name'])) {
390 454
 				$temp_array['departure_airport_name'] = $departure_airport_array[0]['name'];
391 455
 				$temp_array['departure_airport_city'] = $departure_airport_array[0]['city'];
@@ -405,8 +469,12 @@  discard block
 block discarded – undo
405 469
 			
406 470
 			if ($row['arrival_airport_icao'] != '') {
407 471
 				$arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']);
408
-				if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA');
409
-			} else $arrival_airport_array = $this->getAllAirportInfo('NA');
472
+				if (count($arrival_airport_array) == 0) {
473
+					$arrival_airport_array = $this->getAllAirportInfo('NA');
474
+				}
475
+			} else {
476
+				$arrival_airport_array = $this->getAllAirportInfo('NA');
477
+			}
410 478
 			if (isset($arrival_airport_array[0]['name'])) {
411 479
 				$temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name'];
412 480
 				$temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city'];
@@ -422,27 +490,45 @@  discard block
 block discarded – undo
422 490
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
423 491
 			}
424 492
 			*/
425
-			if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id'];
426
-			if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name'];
427
-			if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name'];
428
-			if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country'];
429
-			if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance'];
493
+			if (isset($row['pilot_id']) && $row['pilot_id'] != '') {
494
+				$temp_array['pilot_id'] = $row['pilot_id'];
495
+			}
496
+			if (isset($row['pilot_name']) && $row['pilot_name'] != '') {
497
+				$temp_array['pilot_name'] = $row['pilot_name'];
498
+			}
499
+			if (isset($row['source_name']) && $row['source_name'] != '') {
500
+				$temp_array['source_name'] = $row['source_name'];
501
+			}
502
+			if (isset($row['over_country']) && $row['over_country'] != '') {
503
+				$temp_array['over_country'] = $row['over_country'];
504
+			}
505
+			if (isset($row['distance']) && $row['distance'] != '') {
506
+				$temp_array['distance'] = $row['distance'];
507
+			}
430 508
 			if (isset($row['squawk'])) {
431 509
 				$temp_array['squawk'] = $row['squawk'];
432 510
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
433 511
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
434
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
512
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
513
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
514
+					}
435 515
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
436 516
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
437
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
438
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
517
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
518
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
519
+					}
520
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) {
521
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
522
+				}
439 523
 			}
440 524
     			
441 525
 			$temp_array['query_number_rows'] = $num_rows;
442 526
 			
443 527
 			$spotter_array[] = $temp_array;
444 528
 		}
445
-		if ($num_rows == 0) return array();
529
+		if ($num_rows == 0) {
530
+			return array();
531
+		}
446 532
 		$spotter_array[0]['query_number_rows'] = $num_rows;
447 533
 		return $spotter_array;
448 534
 	}	
@@ -475,7 +561,9 @@  discard block
 block discarded – undo
475 561
 				foreach ($q_array as $q_item){
476 562
 					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
477 563
 					$additional_query .= " AND (";
478
-					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
564
+					if (is_int($q_item)) {
565
+						$additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
566
+					}
479 567
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
480 568
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
481 569
 					$additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR ";
@@ -496,7 +584,9 @@  discard block
 block discarded – undo
496 584
 					$additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR ";
497 585
 					$additional_query .= "(spotter_output.ident like '%".$q_item."%') OR ";
498 586
 					$translate = $Translation->ident2icao($q_item);
499
-					if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
587
+					if ($translate != $q_item) {
588
+						$additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
589
+					}
500 590
 					$additional_query .= "(spotter_output.highlight like '%".$q_item."%')";
501 591
 					$additional_query .= ")";
502 592
 				}
@@ -723,7 +813,9 @@  discard block
 block discarded – undo
723 813
 				date_default_timezone_set($globalTimezone);
724 814
 				$datetime = new DateTime();
725 815
 				$offset = $datetime->format('P');
726
-			} else $offset = '+00:00';
816
+			} else {
817
+				$offset = '+00:00';
818
+			}
727 819
 
728 820
 			if ($date_array[1] != "")
729 821
 			{
@@ -755,8 +847,12 @@  discard block
 block discarded – undo
755 847
 			{
756 848
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
757 849
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
758
-			} else $limit_query = "";
759
-		} else $limit_query = "";
850
+			} else {
851
+				$limit_query = "";
852
+			}
853
+		} else {
854
+			$limit_query = "";
855
+		}
760 856
 
761 857
 
762 858
 		if ($sort != "")
@@ -824,8 +920,12 @@  discard block
 block discarded – undo
824 920
 			{
825 921
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
826 922
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
827
-			} else $limit_query = "";
828
-		} else $limit_query = "";
923
+			} else {
924
+				$limit_query = "";
925
+			}
926
+		} else {
927
+			$limit_query = "";
928
+		}
829 929
 		
830 930
 		if ($sort != "")
831 931
 		{
@@ -1149,7 +1249,9 @@  discard block
 block discarded – undo
1149 1249
 		global $global_query;
1150 1250
 		
1151 1251
 		date_default_timezone_set('UTC');
1152
-		if ($id == '') return array();
1252
+		if ($id == '') {
1253
+			return array();
1254
+		}
1153 1255
 		$additional_query = "spotter_output.spotter_id = :id";
1154 1256
 		$query_values = array(':id' => $id);
1155 1257
 
@@ -1776,7 +1878,9 @@  discard block
 block discarded – undo
1776 1878
 		{
1777 1879
 			$highlight = $row['highlight'];
1778 1880
 		}
1779
-		if (isset($highlight)) return $highlight;
1881
+		if (isset($highlight)) {
1882
+			return $highlight;
1883
+		}
1780 1884
 	}
1781 1885
 
1782 1886
 	
@@ -1804,7 +1908,9 @@  discard block
 block discarded – undo
1804 1908
 		$sth->closeCursor();
1805 1909
 		if (count($row) > 0) {
1806 1910
 			return $row['usage'];
1807
-		} else return '';
1911
+		} else {
1912
+			return '';
1913
+		}
1808 1914
 	}
1809 1915
 
1810 1916
 	/**
@@ -1829,7 +1935,9 @@  discard block
 block discarded – undo
1829 1935
 		$sth->closeCursor();
1830 1936
 		if (count($row) > 0) {
1831 1937
 			return $row['icao'];
1832
-		} else return '';
1938
+		} else {
1939
+			return '';
1940
+		}
1833 1941
 	}
1834 1942
 
1835 1943
 	/**
@@ -1857,7 +1965,9 @@  discard block
 block discarded – undo
1857 1965
 			$airport_longitude = $row['longitude'];
1858 1966
 			$Common = new Common();
1859 1967
 			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
1860
-		} else return '';
1968
+		} else {
1969
+			return '';
1970
+		}
1861 1971
 	}
1862 1972
 	
1863 1973
 	/**
@@ -1969,7 +2079,9 @@  discard block
 block discarded – undo
1969 2079
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1970 2080
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1971 2081
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1972
-		} else return array();
2082
+		} else {
2083
+			return array();
2084
+		}
1973 2085
 		if ($globalDBdriver == 'mysql') {
1974 2086
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
1975 2087
 		} else {
@@ -2004,7 +2116,9 @@  discard block
 block discarded – undo
2004 2116
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2005 2117
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2006 2118
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2007
-		} else return array();
2119
+		} else {
2120
+			return array();
2121
+		}
2008 2122
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2009 2123
 		$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.")";
2010 2124
 		//$query  = "SELECT waypoints.* FROM waypoints";
@@ -2039,7 +2153,9 @@  discard block
 block discarded – undo
2039 2153
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2040 2154
 	{
2041 2155
 		global $globalUseRealAirlines;
2042
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2156
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2157
+			$fromsource = NULL;
2158
+		}
2043 2159
 		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2044 2160
 		if ($airline_icao == 'NA') {
2045 2161
 			$airline_array = array();
@@ -2089,7 +2205,9 @@  discard block
 block discarded – undo
2089 2205
 				$sth->execute(array(':fromsource' => $fromsource));
2090 2206
 				$row = $sth->fetch(PDO::FETCH_ASSOC);
2091 2207
 				$sth->closeCursor();
2092
-				if ($row['nb'] == 0) $result = $this->getAllAirlineInfo($airline_icao);
2208
+				if ($row['nb'] == 0) {
2209
+					$result = $this->getAllAirlineInfo($airline_icao);
2210
+				}
2093 2211
 			}
2094 2212
 			return $result;
2095 2213
 		}
@@ -2153,15 +2271,20 @@  discard block
 block discarded – undo
2153 2271
 				'A320-211' => 'A320',
2154 2272
 				'747-8i' => 'B748',
2155 2273
 				'A380' => 'A388');
2156
-		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2274
+		if (isset($all_aircraft[$aircraft_type])) {
2275
+			return $all_aircraft[$aircraft_type];
2276
+		}
2157 2277
 
2158 2278
 		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2159 2279
 		$aircraft_type = strtoupper($aircraft_type);
2160 2280
 		$sth = $this->db->prepare($query);
2161 2281
 		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2162 2282
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2163
-		if (isset($result[0]['icao'])) return $result[0]['icao'];
2164
-		else return '';
2283
+		if (isset($result[0]['icao'])) {
2284
+			return $result[0]['icao'];
2285
+		} else {
2286
+			return '';
2287
+		}
2165 2288
 	}
2166 2289
 	
2167 2290
 	/**
@@ -2184,7 +2307,9 @@  discard block
 block discarded – undo
2184 2307
 		$sth->closeCursor();
2185 2308
 		if (isset($row['icaotypecode'])) {
2186 2309
 			return $row['icaotypecode'];
2187
-		} else return '';
2310
+		} else {
2311
+			return '';
2312
+		}
2188 2313
 	}
2189 2314
 
2190 2315
 	/**
@@ -2206,7 +2331,9 @@  discard block
 block discarded – undo
2206 2331
 		$sth->closeCursor();
2207 2332
 		if (isset($row['operator_correct'])) {
2208 2333
 			return $row['operator_correct'];
2209
-		} else return $operator;
2334
+		} else {
2335
+			return $operator;
2336
+		}
2210 2337
 	}
2211 2338
 
2212 2339
 	/**
@@ -2219,7 +2346,9 @@  discard block
 block discarded – undo
2219 2346
 	public function getRouteInfo($callsign)
2220 2347
 	{
2221 2348
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2222
-                if ($callsign == '') return array();
2349
+                if ($callsign == '') {
2350
+                	return array();
2351
+                }
2223 2352
 		$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";
2224 2353
 		
2225 2354
 		$sth = $this->db->prepare($query);
@@ -2229,7 +2358,9 @@  discard block
 block discarded – undo
2229 2358
 		$sth->closeCursor();
2230 2359
 		if (count($row) > 0) {
2231 2360
 			return $row;
2232
-		} else return array();
2361
+		} else {
2362
+			return array();
2363
+		}
2233 2364
 	}
2234 2365
 	
2235 2366
 	/**
@@ -2282,7 +2413,9 @@  discard block
 block discarded – undo
2282 2413
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
2283 2414
 			$sth->closeCursor();
2284 2415
 			return $result;
2285
-		} else return array();
2416
+		} else {
2417
+			return array();
2418
+		}
2286 2419
 	}
2287 2420
 	
2288 2421
   
@@ -2439,8 +2572,11 @@  discard block
 block discarded – undo
2439 2572
 		$query .= " ORDER BY spotter_output.source_name ASC";
2440 2573
 
2441 2574
 		$sth = $this->db->prepare($query);
2442
-		if (!empty($query_values)) $sth->execute($query_values);
2443
-		else $sth->execute();
2575
+		if (!empty($query_values)) {
2576
+			$sth->execute($query_values);
2577
+		} else {
2578
+			$sth->execute();
2579
+		}
2444 2580
 
2445 2581
 		$source_array = array();
2446 2582
 		$temp_array = array();
@@ -2473,9 +2609,13 @@  discard block
 block discarded – undo
2473 2609
 								WHERE spotter_output.airline_icao <> '' 
2474 2610
 								ORDER BY spotter_output.airline_name ASC";
2475 2611
 			*/
2476
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2477
-			elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2478
-			elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2612
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2613
+				$forsource = $globalAirlinesSource;
2614
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
2615
+				$forsource = 'vatsim';
2616
+			} elseif (isset($globalIVAO) && $globalIVAO) {
2617
+				$forsource = 'ivao';
2618
+			}
2479 2619
 			if ($forsource === NULL) {
2480 2620
 				$query = "SELECT DISTINCT icao AS airline_icao, name AS airline_name, type AS airline_type FROM airlines WHERE forsource IS NULL ORDER BY name ASC";
2481 2621
 				$query_data = array();
@@ -2767,7 +2907,9 @@  discard block
 block discarded – undo
2767 2907
 			date_default_timezone_set($globalTimezone);
2768 2908
 			$datetime = new DateTime();
2769 2909
 			$offset = $datetime->format('P');
2770
-		} else $offset = '+00:00';
2910
+		} else {
2911
+			$offset = '+00:00';
2912
+		}
2771 2913
 		if ($airport_icao == '') {
2772 2914
 			if ($globalDBdriver == 'mysql') {
2773 2915
 				$query = "SELECT COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' GROUP BY departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -2799,7 +2941,9 @@  discard block
 block discarded – undo
2799 2941
 			date_default_timezone_set($globalTimezone);
2800 2942
 			$datetime = new DateTime();
2801 2943
 			$offset = $datetime->format('P');
2802
-		} else $offset = '+00:00';
2944
+		} else {
2945
+			$offset = '+00:00';
2946
+		}
2803 2947
 		if ($airport_icao == '') {
2804 2948
 			if ($globalDBdriver == 'mysql') {
2805 2949
 				$query = "SELECT spotter_output.airline_icao, COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -2832,7 +2976,9 @@  discard block
 block discarded – undo
2832 2976
 			date_default_timezone_set($globalTimezone);
2833 2977
 			$datetime = new DateTime();
2834 2978
 			$offset = $datetime->format('P');
2835
-		} else $offset = '+00:00';
2979
+		} else {
2980
+			$offset = '+00:00';
2981
+		}
2836 2982
 		if ($airport_icao == '') {
2837 2983
 			if ($globalDBdriver == 'mysql') {
2838 2984
 				$query = "SELECT COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -2871,7 +3017,9 @@  discard block
 block discarded – undo
2871 3017
 			date_default_timezone_set($globalTimezone);
2872 3018
 			$datetime = new DateTime();
2873 3019
 			$offset = $datetime->format('P');
2874
-		} else $offset = '+00:00';
3020
+		} else {
3021
+			$offset = '+00:00';
3022
+		}
2875 3023
 		if ($airport_icao == '') {
2876 3024
 			if ($globalDBdriver == 'mysql') {
2877 3025
 				$query = "SELECT spotter_output.airline_icao, COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -2916,7 +3064,9 @@  discard block
 block discarded – undo
2916 3064
 			date_default_timezone_set($globalTimezone);
2917 3065
 			$datetime = new DateTime();
2918 3066
 			$offset = $datetime->format('P');
2919
-		} else $offset = '+00:00';
3067
+		} else {
3068
+			$offset = '+00:00';
3069
+		}
2920 3070
 		if ($airport_icao == '') {
2921 3071
 			if ($globalDBdriver == 'mysql') {
2922 3072
 				$query = "SELECT COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' GROUP BY arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -2951,7 +3101,9 @@  discard block
 block discarded – undo
2951 3101
 			date_default_timezone_set($globalTimezone);
2952 3102
 			$datetime = new DateTime();
2953 3103
 			$offset = $datetime->format('P');
2954
-		} else $offset = '+00:00';
3104
+		} else {
3105
+			$offset = '+00:00';
3106
+		}
2955 3107
 		if ($airport_icao == '') {
2956 3108
 			if ($globalDBdriver == 'mysql') {
2957 3109
 				$query = "SELECT COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -2993,7 +3145,9 @@  discard block
 block discarded – undo
2993 3145
 			date_default_timezone_set($globalTimezone);
2994 3146
 			$datetime = new DateTime();
2995 3147
 			$offset = $datetime->format('P');
2996
-		} else $offset = '+00:00';
3148
+		} else {
3149
+			$offset = '+00:00';
3150
+		}
2997 3151
 		if ($airport_icao == '') {
2998 3152
 			if ($globalDBdriver == 'mysql') {
2999 3153
 				$query = "SELECT spotter_output.airline_icao, COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -3027,7 +3181,9 @@  discard block
 block discarded – undo
3027 3181
 			date_default_timezone_set($globalTimezone);
3028 3182
 			$datetime = new DateTime();
3029 3183
 			$offset = $datetime->format('P');
3030
-		} else $offset = '+00:00';
3184
+		} else {
3185
+			$offset = '+00:00';
3186
+		}
3031 3187
 		if ($airport_icao == '') {
3032 3188
 			if ($globalDBdriver == 'mysql') {
3033 3189
 				$query = "SELECT spotter_output.airline_icao, COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -3075,7 +3231,9 @@  discard block
 block discarded – undo
3075 3231
 			date_default_timezone_set($globalTimezone);
3076 3232
 			$datetime = new DateTime();
3077 3233
 			$offset = $datetime->format('P');
3078
-		} else $offset = '+00:00';
3234
+		} else {
3235
+			$offset = '+00:00';
3236
+		}
3079 3237
 
3080 3238
 		if ($globalDBdriver == 'mysql') {
3081 3239
 			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
@@ -3195,7 +3353,9 @@  discard block
 block discarded – undo
3195 3353
 	*/	
3196 3354
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3197 3355
 	{
3198
-		if ($groundspeed == '') $groundspeed = NULL;
3356
+		if ($groundspeed == '') {
3357
+			$groundspeed = NULL;
3358
+		}
3199 3359
 		$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';
3200 3360
                 $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);
3201 3361
 
@@ -3245,10 +3405,18 @@  discard block
 block discarded – undo
3245 3405
 		$Image = new Image($this->db);
3246 3406
 		$Common = new Common();
3247 3407
 		
3248
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
3249
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
3250
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
3251
-		if (!isset($globalVAM)) $globalVAM = FALSE;
3408
+		if (!isset($globalIVAO)) {
3409
+			$globalIVAO = FALSE;
3410
+		}
3411
+		if (!isset($globalVATSIM)) {
3412
+			$globalVATSIM = FALSE;
3413
+		}
3414
+		if (!isset($globalphpVMS)) {
3415
+			$globalphpVMS = FALSE;
3416
+		}
3417
+		if (!isset($globalVAM)) {
3418
+			$globalVAM = FALSE;
3419
+		}
3252 3420
 		date_default_timezone_set('UTC');
3253 3421
 		
3254 3422
 		//getting the registration
@@ -3261,23 +3429,33 @@  discard block
 block discarded – undo
3261 3429
 				if ($ModeS != '') {
3262 3430
 					$timeelapsed = microtime(true);
3263 3431
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3264
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3432
+					if ($globalDebugTimeElapsed) {
3433
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3434
+					}
3265 3435
 				} else {
3266 3436
 					$myhex = explode('-',$flightaware_id);
3267 3437
 					if (count($myhex) > 0) {
3268 3438
 						$timeelapsed = microtime(true);
3269 3439
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3270
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3440
+						if ($globalDebugTimeElapsed) {
3441
+							echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3442
+						}
3271 3443
 					}
3272 3444
 				}
3273 3445
 			}
3274 3446
 		}
3275 3447
 		$fromsource = NULL;
3276
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
3277
-		elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim';
3278
-		elseif ($format_source == 'whazzup') $fromsource = 'ivao';
3279
-		elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
3280
-		elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
3448
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
3449
+			$fromsource = $globalAirlinesSource;
3450
+		} elseif ($format_source == 'vatsimtxt') {
3451
+			$fromsource = 'vatsim';
3452
+		} elseif ($format_source == 'whazzup') {
3453
+			$fromsource = 'ivao';
3454
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
3455
+			$fromsource = 'vatsim';
3456
+		} elseif (isset($globalIVAO) && $globalIVAO) {
3457
+			$fromsource = 'ivao';
3458
+		}
3281 3459
 		//getting the airline information
3282 3460
 		if ($ident != "")
3283 3461
 		{
@@ -3301,15 +3479,21 @@  discard block
 block discarded – undo
3301 3479
 					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3302 3480
 						$airline_array = $this->getAllAirlineInfo("NA");
3303 3481
 					}
3304
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3482
+					if ($globalDebugTimeElapsed) {
3483
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3484
+					}
3305 3485
 
3306 3486
 				} else {
3307 3487
 					$timeelapsed = microtime(true);
3308 3488
 					$airline_array = $this->getAllAirlineInfo("NA");
3309
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3489
+					if ($globalDebugTimeElapsed) {
3490
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3491
+					}
3310 3492
 				}
3311 3493
 			}
3312
-		} else $airline_array = array();
3494
+		} else {
3495
+			$airline_array = array();
3496
+		}
3313 3497
 		
3314 3498
 		//getting the aircraft information
3315 3499
 		$aircraft_array = array();
@@ -3323,27 +3507,37 @@  discard block
 block discarded – undo
3323 3507
 				{
3324 3508
 					$timeelapsed = microtime(true);
3325 3509
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3326
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3510
+					if ($globalDebugTimeElapsed) {
3511
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3512
+					}
3327 3513
 				} else {
3328 3514
 					$timeelapsed = microtime(true);
3329 3515
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3330
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3516
+					if ($globalDebugTimeElapsed) {
3517
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3518
+					}
3331 3519
 				}
3332 3520
 			}
3333 3521
 		} else {
3334 3522
 			if ($ModeS != '') {
3335 3523
 				$timeelapsed = microtime(true);
3336 3524
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3337
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3525
+				if ($globalDebugTimeElapsed) {
3526
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3527
+				}
3338 3528
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3339 3529
 				{
3340 3530
 					$timeelapsed = microtime(true);
3341 3531
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3342
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3532
+					if ($globalDebugTimeElapsed) {
3533
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3534
+					}
3343 3535
 				} else {
3344 3536
 					$timeelapsed = microtime(true);
3345 3537
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3346
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3538
+					if ($globalDebugTimeElapsed) {
3539
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3540
+					}
3347 3541
 				}
3348 3542
 			}
3349 3543
 		}
@@ -3358,7 +3552,9 @@  discard block
 block discarded – undo
3358 3552
 			} else {
3359 3553
 				$timeelapsed = microtime(true);
3360 3554
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3361
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3555
+				if ($globalDebugTimeElapsed) {
3556
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3557
+				}
3362 3558
 			}
3363 3559
 		}
3364 3560
 		
@@ -3372,7 +3568,9 @@  discard block
 block discarded – undo
3372 3568
 			} else {
3373 3569
 				$timeelapsed = microtime(true);
3374 3570
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3375
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3571
+				if ($globalDebugTimeElapsed) {
3572
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3573
+				}
3376 3574
 			}
3377 3575
 		}
3378 3576
 
@@ -3407,7 +3605,9 @@  discard block
 block discarded – undo
3407 3605
 			{
3408 3606
 				return false;
3409 3607
 			}
3410
-		} else $altitude = 0;
3608
+		} else {
3609
+			$altitude = 0;
3610
+		}
3411 3611
 		
3412 3612
 		if ($heading != "")
3413 3613
 		{
@@ -3436,7 +3636,9 @@  discard block
 block discarded – undo
3436 3636
 		{
3437 3637
 			$timeelapsed = microtime(true);
3438 3638
 			$image_array = $Image->getSpotterImage($registration);
3439
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3639
+			if ($globalDebugTimeElapsed) {
3640
+				echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3641
+			}
3440 3642
 			if (!isset($image_array[0]['registration']))
3441 3643
 			{
3442 3644
 				//echo "Add image !!!! \n";
@@ -3444,14 +3646,21 @@  discard block
 block discarded – undo
3444 3646
 			}
3445 3647
 			$timeelapsed = microtime(true);
3446 3648
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3447
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3448
-			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3649
+			if ($globalDebugTimeElapsed) {
3650
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3651
+			}
3652
+			if ($owner_info['owner'] != '') {
3653
+				$aircraft_owner = ucwords(strtolower($owner_info['owner']));
3654
+			}
3449 3655
 		}
3450 3656
     
3451 3657
 		if ($globalIVAO && $aircraft_icao != '')
3452 3658
 		{
3453
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3454
-            		else $airline_icao = '';
3659
+            		if (isset($airline_array[0]['icao'])) {
3660
+            			$airline_icao = $airline_array[0]['icao'];
3661
+            		} else {
3662
+            			$airline_icao = '';
3663
+            		}
3455 3664
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3456 3665
 			if (!isset($image_array[0]['registration']))
3457 3666
 			{
@@ -3496,16 +3705,28 @@  discard block
 block discarded – undo
3496 3705
                 {
3497 3706
                         $arrival_airport_array = $this->getAllAirportInfo('NA');
3498 3707
                 }
3499
-                if ($registration == '') $registration = 'NA';
3708
+                if ($registration == '') {
3709
+                	$registration = 'NA';
3710
+                }
3500 3711
                 if ($latitude == '' && $longitude == '') {
3501 3712
             		$latitude = 0;
3502 3713
             		$longitude = 0;
3503 3714
             	}
3504
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3505
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3506
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3507
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3508
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3715
+                if ($squawk == '' || $Common->isInteger($squawk) === false) {
3716
+                	$squawk = NULL;
3717
+                }
3718
+                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) {
3719
+                	$verticalrate = NULL;
3720
+                }
3721
+                if ($heading == '' || $Common->isInteger($heading) === false) {
3722
+                	$heading = 0;
3723
+                }
3724
+                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) {
3725
+                	$groundspeed = 0;
3726
+                }
3727
+                if (!isset($aircraft_owner)) {
3728
+                	$aircraft_owner = NULL;
3729
+                }
3509 3730
                 $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) 
3510 3731
                 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)";
3511 3732
 
@@ -3516,9 +3737,13 @@  discard block
 block discarded – undo
3516 3737
 		if ($airline_type == '') {
3517 3738
 			$timeelapsed = microtime(true);
3518 3739
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3519
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3740
+			if ($globalDebugTimeElapsed) {
3741
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3742
+			}
3743
+		}
3744
+		if ($airline_type == null) {
3745
+			$airline_type = '';
3520 3746
 		}
3521
-		if ($airline_type == null) $airline_type = '';
3522 3747
                 $aircraft_type = $aircraft_array[0]['type'];
3523 3748
                 $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3524 3749
                 $departure_airport_name = $departure_airport_array[0]['name'];
@@ -3653,7 +3878,9 @@  discard block
 block discarded – undo
3653 3878
 			}
3654 3879
 		}
3655 3880
 		$query .= "GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
3656
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3881
+		if ($limit) {
3882
+			$query .= " LIMIT 10 OFFSET 0";
3883
+		}
3657 3884
 		
3658 3885
 		$sth = $this->db->prepare($query);
3659 3886
 		$sth->execute();
@@ -3698,7 +3925,9 @@  discard block
 block discarded – undo
3698 3925
 			}
3699 3926
 		}
3700 3927
 		$query .= "GROUP BY spotter_output.pilot_id,spotter_output.pilot_name ORDER BY pilot_count DESC";
3701
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3928
+		if ($limit) {
3929
+			$query .= " LIMIT 10 OFFSET 0";
3930
+		}
3702 3931
       
3703 3932
 		
3704 3933
 		$sth = $this->db->prepare($query);
@@ -3743,7 +3972,9 @@  discard block
 block discarded – undo
3743 3972
 			}
3744 3973
 		}
3745 3974
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name ORDER BY pilot_count DESC";
3746
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3975
+		if ($limit) {
3976
+			$query .= " LIMIT 10 OFFSET 0";
3977
+		}
3747 3978
       
3748 3979
 		
3749 3980
 		$sth = $this->db->prepare($query);
@@ -3790,7 +4021,9 @@  discard block
 block discarded – undo
3790 4021
 			}
3791 4022
 		}
3792 4023
 		$query .= "GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
3793
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4024
+		if ($limit) {
4025
+			$query .= " LIMIT 10 OFFSET 0";
4026
+		}
3794 4027
       
3795 4028
 		
3796 4029
 		$sth = $this->db->prepare($query);
@@ -3835,7 +4068,9 @@  discard block
 block discarded – undo
3835 4068
 			}
3836 4069
 		}
3837 4070
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC";
3838
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4071
+		if ($limit) {
4072
+			$query .= " LIMIT 10 OFFSET 0";
4073
+		}
3839 4074
       
3840 4075
 		
3841 4076
 		$sth = $this->db->prepare($query);
@@ -4078,7 +4313,9 @@  discard block
 block discarded – undo
4078 4313
 			date_default_timezone_set($globalTimezone);
4079 4314
 			$datetime = new DateTime($date);
4080 4315
 			$offset = $datetime->format('P');
4081
-		} else $offset = '+00:00';
4316
+		} else {
4317
+			$offset = '+00:00';
4318
+		}
4082 4319
 
4083 4320
 		if ($globalDBdriver == 'mysql') {
4084 4321
 			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
@@ -4126,7 +4363,9 @@  discard block
 block discarded – undo
4126 4363
 			date_default_timezone_set($globalTimezone);
4127 4364
 			$datetime = new DateTime($date);
4128 4365
 			$offset = $datetime->format('P');
4129
-		} else $offset = '+00:00';
4366
+		} else {
4367
+			$offset = '+00:00';
4368
+		}
4130 4369
 		
4131 4370
 		if ($globalDBdriver == 'mysql') {
4132 4371
 			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
@@ -4344,7 +4583,9 @@  discard block
 block discarded – undo
4344 4583
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' 
4345 4584
 					GROUP BY spotter_output.airline_country
4346 4585
 					ORDER BY airline_country_count DESC";
4347
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4586
+		if ($limit) {
4587
+			$query .= " LIMIT 10 OFFSET 0";
4588
+		}
4348 4589
       
4349 4590
 		$sth = $this->db->prepare($query);
4350 4591
 		$sth->execute();
@@ -4372,7 +4613,9 @@  discard block
 block discarded – undo
4372 4613
 		global $globalDBdriver;
4373 4614
 		//$filter_query = $this->getFilter($filters,true,true);
4374 4615
 		$Connection= new Connection($this->db);
4375
-		if (!$Connection->tableExists('countries')) return array();
4616
+		if (!$Connection->tableExists('countries')) {
4617
+			return array();
4618
+		}
4376 4619
 		/*
4377 4620
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
4378 4621
 					FROM countries c, spotter_output s
@@ -4397,7 +4640,9 @@  discard block
 block discarded – undo
4397 4640
 		}
4398 4641
 
4399 4642
 		$query .= "GROUP BY c.name ORDER BY nb DESC";
4400
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4643
+		if ($limit) {
4644
+			$query .= " LIMIT 10 OFFSET 0";
4645
+		}
4401 4646
       
4402 4647
 		
4403 4648
 		$sth = $this->db->prepare($query);
@@ -4447,7 +4692,9 @@  discard block
 block discarded – undo
4447 4692
 		}
4448 4693
 
4449 4694
 		$query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
4450
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4695
+		if ($limit) {
4696
+			$query .= " LIMIT 10 OFFSET 0";
4697
+		}
4451 4698
  
4452 4699
 		$sth = $this->db->prepare($query);
4453 4700
 		$sth->execute();
@@ -4493,7 +4740,9 @@  discard block
 block discarded – undo
4493 4740
 		}
4494 4741
 
4495 4742
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
4496
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4743
+		if ($limit) {
4744
+			$query .= " LIMIT 10 OFFSET 0";
4745
+		}
4497 4746
  
4498 4747
 		$sth = $this->db->prepare($query);
4499 4748
 		$sth->execute();
@@ -4546,7 +4795,9 @@  discard block
 block discarded – undo
4546 4795
 			if($row['registration'] != "")
4547 4796
 			{
4548 4797
 				$image_array = $Image->getSpotterImage($row['registration']);
4549
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4798
+				if (isset($image_array[0]['image_thumbnail'])) {
4799
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4800
+				}
4550 4801
 			}
4551 4802
 			$temp_array['registration_count'] = $row['registration_count'];
4552 4803
 
@@ -4621,7 +4872,9 @@  discard block
 block discarded – undo
4621 4872
 			if($row['registration'] != "")
4622 4873
 			{
4623 4874
 				$image_array = $Image->getSpotterImage($row['registration']);
4624
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4875
+				if (isset($image_array[0]['image_thumbnail'])) {
4876
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4877
+				}
4625 4878
 			}
4626 4879
 			$temp_array['registration_count'] = $row['registration_count'];
4627 4880
 
@@ -4728,7 +4981,9 @@  discard block
 block discarded – undo
4728 4981
 			if($row['registration'] != "")
4729 4982
 			{
4730 4983
 				$image_array = $Image->getSpotterImage($row['registration']);
4731
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4984
+				if (isset($image_array[0]['image_thumbnail'])) {
4985
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4986
+				}
4732 4987
 			}
4733 4988
 			$temp_array['registration_count'] = $row['registration_count'];
4734 4989
 			$aircraft_array[] = $temp_array;
@@ -4853,7 +5108,9 @@  discard block
 block discarded – undo
4853 5108
 			date_default_timezone_set($globalTimezone);
4854 5109
 			$datetime = new DateTime($date);
4855 5110
 			$offset = $datetime->format('P');
4856
-		} else $offset = '+00:00';
5111
+		} else {
5112
+			$offset = '+00:00';
5113
+		}
4857 5114
 
4858 5115
 		if ($globalDBdriver == 'mysql') {
4859 5116
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
@@ -4900,7 +5157,9 @@  discard block
 block discarded – undo
4900 5157
 			date_default_timezone_set($globalTimezone);
4901 5158
 			$datetime = new DateTime($date);
4902 5159
 			$offset = $datetime->format('P');
4903
-		} else $offset = '+00:00';
5160
+		} else {
5161
+			$offset = '+00:00';
5162
+		}
4904 5163
 
4905 5164
 		if ($globalDBdriver == 'mysql') {
4906 5165
 			$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 
@@ -4929,7 +5188,9 @@  discard block
 block discarded – undo
4929 5188
 			if($row['registration'] != "")
4930 5189
 			{
4931 5190
 				$image_array = $Image->getSpotterImage($row['registration']);
4932
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5191
+				if (isset($image_array[0]['image_thumbnail'])) {
5192
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5193
+				}
4933 5194
 			}
4934 5195
 			$temp_array['registration_count'] = $row['registration_count'];
4935 5196
  
@@ -4954,7 +5215,9 @@  discard block
 block discarded – undo
4954 5215
 			date_default_timezone_set($globalTimezone);
4955 5216
 			$datetime = new DateTime($date);
4956 5217
 			$offset = $datetime->format('P');
4957
-		} else $offset = '+00:00';
5218
+		} else {
5219
+			$offset = '+00:00';
5220
+		}
4958 5221
 
4959 5222
 		if ($globalDBdriver == 'mysql') {
4960 5223
 			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
@@ -5052,8 +5315,11 @@  discard block
 block discarded – undo
5052 5315
 			if($row['registration'] != "")
5053 5316
 			{
5054 5317
 				$image_array = $Image->getSpotterImage($row['registration']);
5055
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5056
-				else $temp_array['image_thumbnail'] = '';
5318
+				if (isset($image_array[0]['image_thumbnail'])) {
5319
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5320
+				} else {
5321
+					$temp_array['image_thumbnail'] = '';
5322
+				}
5057 5323
 			}
5058 5324
 			$temp_array['registration_count'] = $row['registration_count'];
5059 5325
 			$aircraft_array[] = $temp_array;
@@ -5160,7 +5426,9 @@  discard block
 block discarded – undo
5160 5426
 			if($row['registration'] != "")
5161 5427
 			{
5162 5428
 				$image_array = $Image->getSpotterImage($row['registration']);
5163
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5429
+				if (isset($image_array[0]['image_thumbnail'])) {
5430
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5431
+				}
5164 5432
 			}
5165 5433
 			$temp_array['registration_count'] = $row['registration_count'];
5166 5434
           
@@ -5277,7 +5545,9 @@  discard block
 block discarded – undo
5277 5545
 			if($row['registration'] != "")
5278 5546
 			{
5279 5547
 				$image_array = $Image->getSpotterImage($row['registration']);
5280
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5548
+				if (isset($image_array[0]['image_thumbnail'])) {
5549
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5550
+				}
5281 5551
 			}
5282 5552
 			$temp_array['registration_count'] = $row['registration_count'];
5283 5553
           
@@ -5389,7 +5659,9 @@  discard block
 block discarded – undo
5389 5659
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5390 5660
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5391 5661
                 $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5392
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5662
+		if ($limit) {
5663
+			$query .= " LIMIT 10 OFFSET 0";
5664
+		}
5393 5665
 		
5394 5666
 		$sth = $this->db->prepare($query);
5395 5667
 		$sth->execute();
@@ -5408,7 +5680,9 @@  discard block
 block discarded – undo
5408 5680
 			if($row['registration'] != "")
5409 5681
 			{
5410 5682
 				$image_array = $Image->getSpotterImage($row['registration']);
5411
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5683
+				if (isset($image_array[0]['image_thumbnail'])) {
5684
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5685
+				}
5412 5686
 			}
5413 5687
           
5414 5688
 			$aircraft_array[] = $temp_array;
@@ -5449,7 +5723,9 @@  discard block
 block discarded – undo
5449 5723
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5450 5724
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5451 5725
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5452
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5726
+		if ($limit) {
5727
+			$query .= " LIMIT 10 OFFSET 0";
5728
+		}
5453 5729
 		
5454 5730
 		$sth = $this->db->prepare($query);
5455 5731
 		$sth->execute();
@@ -5469,7 +5745,9 @@  discard block
 block discarded – undo
5469 5745
 			if($row['registration'] != "")
5470 5746
 			{
5471 5747
 				$image_array = $Image->getSpotterImage($row['registration']);
5472
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5748
+				if (isset($image_array[0]['image_thumbnail'])) {
5749
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5750
+				}
5473 5751
 			}
5474 5752
           
5475 5753
 			$aircraft_array[] = $temp_array;
@@ -5510,7 +5788,9 @@  discard block
 block discarded – undo
5510 5788
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5511 5789
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5512 5790
 				ORDER BY airport_departure_icao_count DESC";
5513
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5791
+		if ($limit) {
5792
+			$query .= " LIMIT 10 OFFSET 0";
5793
+		}
5514 5794
       
5515 5795
 		$sth = $this->db->prepare($query);
5516 5796
 		$sth->execute();
@@ -5562,7 +5842,9 @@  discard block
 block discarded – undo
5562 5842
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5563 5843
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5564 5844
 				ORDER BY airport_departure_icao_count DESC";
5565
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5845
+		if ($limit) {
5846
+			$query .= " LIMIT 10 OFFSET 0";
5847
+		}
5566 5848
       
5567 5849
 		$sth = $this->db->prepare($query);
5568 5850
 		$sth->execute();
@@ -5614,7 +5896,9 @@  discard block
 block discarded – undo
5614 5896
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5615 5897
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5616 5898
 				ORDER BY airport_departure_icao_count DESC";
5617
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5899
+		if ($limit) {
5900
+			$query .= " LIMIT 10 OFFSET 0";
5901
+		}
5618 5902
     		//echo $query;
5619 5903
 		$sth = $this->db->prepare($query);
5620 5904
 		$sth->execute();
@@ -5666,7 +5950,9 @@  discard block
 block discarded – undo
5666 5950
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5667 5951
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5668 5952
 				ORDER BY airport_departure_icao_count DESC";
5669
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5953
+		if ($limit) {
5954
+			$query .= " LIMIT 10 OFFSET 0";
5955
+		}
5670 5956
       
5671 5957
 		$sth = $this->db->prepare($query);
5672 5958
 		$sth->execute();
@@ -6061,7 +6347,9 @@  discard block
 block discarded – undo
6061 6347
 			date_default_timezone_set($globalTimezone);
6062 6348
 			$datetime = new DateTime($date);
6063 6349
 			$offset = $datetime->format('P');
6064
-		} else $offset = '+00:00';
6350
+		} else {
6351
+			$offset = '+00:00';
6352
+		}
6065 6353
 
6066 6354
 		if ($globalDBdriver == 'mysql') {
6067 6355
 			$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 
@@ -6111,7 +6399,9 @@  discard block
 block discarded – undo
6111 6399
 			date_default_timezone_set($globalTimezone);
6112 6400
 			$datetime = new DateTime($date);
6113 6401
 			$offset = $datetime->format('P');
6114
-		} else $offset = '+00:00';
6402
+		} else {
6403
+			$offset = '+00:00';
6404
+		}
6115 6405
 
6116 6406
 		if ($globalDBdriver == 'mysql') {
6117 6407
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
@@ -6324,7 +6614,9 @@  discard block
 block discarded – undo
6324 6614
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6325 6615
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6326 6616
 					ORDER BY airport_arrival_icao_count DESC";
6327
-		if ($limit) $query .= " LIMIT 10";
6617
+		if ($limit) {
6618
+			$query .= " LIMIT 10";
6619
+		}
6328 6620
       
6329 6621
 		
6330 6622
 		$sth = $this->db->prepare($query);
@@ -6344,7 +6636,9 @@  discard block
 block discarded – undo
6344 6636
 			if ($icaoaskey) {
6345 6637
 				$icao = $row['arrival_airport_icao'];
6346 6638
 				$airport_array[$icao] = $temp_array;
6347
-			} else $airport_array[] = $temp_array;
6639
+			} else {
6640
+				$airport_array[] = $temp_array;
6641
+			}
6348 6642
 		}
6349 6643
 
6350 6644
 		return $airport_array;
@@ -6386,7 +6680,9 @@  discard block
 block discarded – undo
6386 6680
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6387 6681
                 $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6388 6682
 					ORDER BY airport_arrival_icao_count DESC";
6389
-		if ($limit) $query .= " LIMIT 10";
6683
+		if ($limit) {
6684
+			$query .= " LIMIT 10";
6685
+		}
6390 6686
       
6391 6687
 		
6392 6688
 		$sth = $this->db->prepare($query);
@@ -6407,7 +6703,9 @@  discard block
 block discarded – undo
6407 6703
 			if ($icaoaskey) {
6408 6704
 				$icao = $row['arrival_airport_icao'];
6409 6705
 				$airport_array[$icao] = $temp_array;
6410
-			} else $airport_array[] = $temp_array;
6706
+			} else {
6707
+				$airport_array[] = $temp_array;
6708
+			}
6411 6709
 		}
6412 6710
 
6413 6711
 		return $airport_array;
@@ -6449,7 +6747,9 @@  discard block
 block discarded – undo
6449 6747
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6450 6748
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6451 6749
 					ORDER BY airport_arrival_icao_count DESC";
6452
-		if ($limit) $query .= " LIMIT 10";
6750
+		if ($limit) {
6751
+			$query .= " LIMIT 10";
6752
+		}
6453 6753
       
6454 6754
 		
6455 6755
 		$sth = $this->db->prepare($query);
@@ -6469,7 +6769,9 @@  discard block
 block discarded – undo
6469 6769
 			if ($icaoaskey) {
6470 6770
 				$icao = $row['arrival_airport_icao'];
6471 6771
 				$airport_array[$icao] = $temp_array;
6472
-			} else $airport_array[] = $temp_array;
6772
+			} else {
6773
+				$airport_array[] = $temp_array;
6774
+			}
6473 6775
 		}
6474 6776
 
6475 6777
 		return $airport_array;
@@ -6511,7 +6813,9 @@  discard block
 block discarded – undo
6511 6813
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6512 6814
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6513 6815
 					ORDER BY airport_arrival_icao_count DESC";
6514
-		if ($limit) $query .= " LIMIT 10";
6816
+		if ($limit) {
6817
+			$query .= " LIMIT 10";
6818
+		}
6515 6819
       
6516 6820
 		
6517 6821
 		$sth = $this->db->prepare($query);
@@ -6532,7 +6836,9 @@  discard block
 block discarded – undo
6532 6836
 			if ($icaoaskey) {
6533 6837
 				$icao = $row['arrival_airport_icao'];
6534 6838
 				$airport_array[$icao] = $temp_array;
6535
-			} else $airport_array[] = $temp_array;
6839
+			} else {
6840
+				$airport_array[] = $temp_array;
6841
+			}
6536 6842
 		}
6537 6843
 
6538 6844
 		return $airport_array;
@@ -6913,7 +7219,9 @@  discard block
 block discarded – undo
6913 7219
 			date_default_timezone_set($globalTimezone);
6914 7220
 			$datetime = new DateTime($date);
6915 7221
 			$offset = $datetime->format('P');
6916
-		} else $offset = '+00:00';
7222
+		} else {
7223
+			$offset = '+00:00';
7224
+		}
6917 7225
 
6918 7226
 		if ($globalDBdriver == 'mysql') {
6919 7227
 			$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 
@@ -6963,7 +7271,9 @@  discard block
 block discarded – undo
6963 7271
 			date_default_timezone_set($globalTimezone);
6964 7272
 			$datetime = new DateTime($date);
6965 7273
 			$offset = $datetime->format('P');
6966
-		} else $offset = '+00:00';
7274
+		} else {
7275
+			$offset = '+00:00';
7276
+		}
6967 7277
 
6968 7278
 		if ($globalDBdriver == 'mysql') {
6969 7279
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
@@ -7186,7 +7496,9 @@  discard block
 block discarded – undo
7186 7496
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
7187 7497
 		$query .= " GROUP BY spotter_output.arrival_airport_country
7188 7498
 					ORDER BY airport_arrival_country_count DESC";
7189
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7499
+		if ($limit) {
7500
+			$query .= " LIMIT 10 OFFSET 0";
7501
+		}
7190 7502
       
7191 7503
 		
7192 7504
 		$sth = $this->db->prepare($query);
@@ -7473,7 +7785,9 @@  discard block
 block discarded – undo
7473 7785
 			date_default_timezone_set($globalTimezone);
7474 7786
 			$datetime = new DateTime($date);
7475 7787
 			$offset = $datetime->format('P');
7476
-		} else $offset = '+00:00';
7788
+		} else {
7789
+			$offset = '+00:00';
7790
+		}
7477 7791
 		
7478 7792
 		if ($globalDBdriver == 'mysql') {
7479 7793
 			$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
@@ -7649,15 +7963,23 @@  discard block
 block discarded – undo
7649 7963
 		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7650 7964
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
7651 7965
 		 if ($olderthanmonths > 0) {
7652
-			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
7653
-			else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7966
+			if ($globalDBdriver == 'mysql') {
7967
+				$query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
7968
+			} else {
7969
+				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7970
+			}
7654 7971
 		}
7655 7972
 		if ($sincedate != '') {
7656
-			if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'";
7657
-			else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7973
+			if ($globalDBdriver == 'mysql') {
7974
+				$query .= " AND spotter_output.date > '".$sincedate."'";
7975
+			} else {
7976
+				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7977
+			}
7658 7978
 		}
7659 7979
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
7660
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7980
+		if ($limit) {
7981
+			$query .= " LIMIT 10 OFFSET 0";
7982
+		}
7661 7983
       		
7662 7984
 		$sth = $this->db->prepare($query);
7663 7985
 		$sth->execute();
@@ -7691,15 +8013,23 @@  discard block
 block discarded – undo
7691 8013
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7692 8014
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
7693 8015
 		 if ($olderthanmonths > 0) {
7694
-			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7695
-			else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
8016
+			if ($globalDBdriver == 'mysql') {
8017
+				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
8018
+			} else {
8019
+				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
8020
+			}
7696 8021
 		}
7697 8022
 		if ($sincedate != '') {
7698
-			if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' ";
7699
-			else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
8023
+			if ($globalDBdriver == 'mysql') {
8024
+				$query .= "AND spotter_output.date > '".$sincedate."' ";
8025
+			} else {
8026
+				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
8027
+			}
7700 8028
 		}
7701 8029
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
7702
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
8030
+		if ($limit) {
8031
+			$query .= " LIMIT 10 OFFSET 0";
8032
+		}
7703 8033
       		
7704 8034
 		$sth = $this->db->prepare($query);
7705 8035
 		$sth->execute();
@@ -7736,7 +8066,9 @@  discard block
 block discarded – undo
7736 8066
 			date_default_timezone_set($globalTimezone);
7737 8067
 			$datetime = new DateTime();
7738 8068
 			$offset = $datetime->format('P');
7739
-		} else $offset = '+00:00';
8069
+		} else {
8070
+			$offset = '+00:00';
8071
+		}
7740 8072
 
7741 8073
 		if ($globalDBdriver == 'mysql') {
7742 8074
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7785,7 +8117,9 @@  discard block
 block discarded – undo
7785 8117
 			date_default_timezone_set($globalTimezone);
7786 8118
 			$datetime = new DateTime();
7787 8119
 			$offset = $datetime->format('P');
7788
-		} else $offset = '+00:00';
8120
+		} else {
8121
+			$offset = '+00:00';
8122
+		}
7789 8123
 		$filter_query = $this->getFilter($filters,true,true);
7790 8124
 		if ($globalDBdriver == 'mysql') {
7791 8125
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7834,7 +8168,9 @@  discard block
 block discarded – undo
7834 8168
 			date_default_timezone_set($globalTimezone);
7835 8169
 			$datetime = new DateTime();
7836 8170
 			$offset = $datetime->format('P');
7837
-		} else $offset = '+00:00';
8171
+		} else {
8172
+			$offset = '+00:00';
8173
+		}
7838 8174
 		$filter_query = $this->getFilter($filters,true,true);
7839 8175
 		if ($globalDBdriver == 'mysql') {
7840 8176
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7880,7 +8216,9 @@  discard block
 block discarded – undo
7880 8216
 			date_default_timezone_set($globalTimezone);
7881 8217
 			$datetime = new DateTime();
7882 8218
 			$offset = $datetime->format('P');
7883
-		} else $offset = '+00:00';
8219
+		} else {
8220
+			$offset = '+00:00';
8221
+		}
7884 8222
 		$filter_query = $this->getFilter($filters,true,true);
7885 8223
 		if ($globalDBdriver == 'mysql') {
7886 8224
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7928,7 +8266,9 @@  discard block
 block discarded – undo
7928 8266
 			date_default_timezone_set($globalTimezone);
7929 8267
 			$datetime = new DateTime();
7930 8268
 			$offset = $datetime->format('P');
7931
-		} else $offset = '+00:00';
8269
+		} else {
8270
+			$offset = '+00:00';
8271
+		}
7932 8272
 		
7933 8273
 		if ($globalDBdriver == 'mysql') {
7934 8274
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7976,7 +8316,9 @@  discard block
 block discarded – undo
7976 8316
 			date_default_timezone_set($globalTimezone);
7977 8317
 			$datetime = new DateTime();
7978 8318
 			$offset = $datetime->format('P');
7979
-		} else $offset = '+00:00';
8319
+		} else {
8320
+			$offset = '+00:00';
8321
+		}
7980 8322
 
7981 8323
 		if ($globalDBdriver == 'mysql') {
7982 8324
 			$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
@@ -8023,7 +8365,9 @@  discard block
 block discarded – undo
8023 8365
 			date_default_timezone_set($globalTimezone);
8024 8366
 			$datetime = new DateTime();
8025 8367
 			$offset = $datetime->format('P');
8026
-		} else $offset = '+00:00';
8368
+		} else {
8369
+			$offset = '+00:00';
8370
+		}
8027 8371
 
8028 8372
 		if ($globalDBdriver == 'mysql') {
8029 8373
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -8071,7 +8415,9 @@  discard block
 block discarded – undo
8071 8415
 			date_default_timezone_set($globalTimezone);
8072 8416
 			$datetime = new DateTime();
8073 8417
 			$offset = $datetime->format('P');
8074
-		} else $offset = '+00:00';
8418
+		} else {
8419
+			$offset = '+00:00';
8420
+		}
8075 8421
 		$filter_query = $this->getFilter($filters,true,true);
8076 8422
 		if ($globalDBdriver == 'mysql') {
8077 8423
 			$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
@@ -8116,7 +8462,9 @@  discard block
 block discarded – undo
8116 8462
 			date_default_timezone_set($globalTimezone);
8117 8463
 			$datetime = new DateTime();
8118 8464
 			$offset = $datetime->format('P');
8119
-		} else $offset = '+00:00';
8465
+		} else {
8466
+			$offset = '+00:00';
8467
+		}
8120 8468
 		$filter_query = $this->getFilter($filters,true,true);
8121 8469
 
8122 8470
 		if ($globalDBdriver == 'mysql') {
@@ -8163,7 +8511,9 @@  discard block
 block discarded – undo
8163 8511
 			date_default_timezone_set($globalTimezone);
8164 8512
 			$datetime = new DateTime();
8165 8513
 			$offset = $datetime->format('P');
8166
-		} else $offset = '+00:00';
8514
+		} else {
8515
+			$offset = '+00:00';
8516
+		}
8167 8517
 
8168 8518
 		if ($globalDBdriver == 'mysql') {
8169 8519
 			$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
@@ -8209,7 +8559,9 @@  discard block
 block discarded – undo
8209 8559
 			date_default_timezone_set($globalTimezone);
8210 8560
 			$datetime = new DateTime();
8211 8561
 			$offset = $datetime->format('P');
8212
-		} else $offset = '+00:00';
8562
+		} else {
8563
+			$offset = '+00:00';
8564
+		}
8213 8565
 		$filter_query = $this->getFilter($filters,true,true);
8214 8566
 
8215 8567
 		if ($globalDBdriver == 'mysql') {
@@ -8256,7 +8608,9 @@  discard block
 block discarded – undo
8256 8608
 			date_default_timezone_set($globalTimezone);
8257 8609
 			$datetime = new DateTime();
8258 8610
 			$offset = $datetime->format('P');
8259
-		} else $offset = '+00:00';
8611
+		} else {
8612
+			$offset = '+00:00';
8613
+		}
8260 8614
 
8261 8615
 		if ($globalDBdriver == 'mysql') {
8262 8616
 			$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
@@ -8303,7 +8657,9 @@  discard block
 block discarded – undo
8303 8657
 			date_default_timezone_set($globalTimezone);
8304 8658
 			$datetime = new DateTime();
8305 8659
 			$offset = $datetime->format('P');
8306
-		} else $offset = '+00:00';
8660
+		} else {
8661
+			$offset = '+00:00';
8662
+		}
8307 8663
 
8308 8664
 		if ($globalDBdriver == 'mysql') {
8309 8665
 			$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
@@ -8348,7 +8704,9 @@  discard block
 block discarded – undo
8348 8704
 			date_default_timezone_set($globalTimezone);
8349 8705
 			$datetime = new DateTime();
8350 8706
 			$offset = $datetime->format('P');
8351
-		} else $offset = '+00:00';
8707
+		} else {
8708
+			$offset = '+00:00';
8709
+		}
8352 8710
 		$filter_query = $this->getFilter($filters,true,true);
8353 8711
 
8354 8712
 		if ($globalDBdriver == 'mysql') {
@@ -8396,7 +8754,9 @@  discard block
 block discarded – undo
8396 8754
 			date_default_timezone_set($globalTimezone);
8397 8755
 			$datetime = new DateTime();
8398 8756
 			$offset = $datetime->format('P');
8399
-		} else $offset = '+00:00';
8757
+		} else {
8758
+			$offset = '+00:00';
8759
+		}
8400 8760
 
8401 8761
 		if ($globalDBdriver == 'mysql') {
8402 8762
 			$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
@@ -8442,7 +8802,9 @@  discard block
 block discarded – undo
8442 8802
 			date_default_timezone_set($globalTimezone);
8443 8803
 			$datetime = new DateTime();
8444 8804
 			$offset = $datetime->format('P');
8445
-		} else $offset = '+00:00';
8805
+		} else {
8806
+			$offset = '+00:00';
8807
+		}
8446 8808
 		$filter_query = $this->getFilter($filters,true,true);
8447 8809
 
8448 8810
 		if ($globalDBdriver == 'mysql') {
@@ -8490,7 +8852,9 @@  discard block
 block discarded – undo
8490 8852
 			date_default_timezone_set($globalTimezone);
8491 8853
 			$datetime = new DateTime();
8492 8854
 			$offset = $datetime->format('P');
8493
-		} else $offset = '+00:00';
8855
+		} else {
8856
+			$offset = '+00:00';
8857
+		}
8494 8858
 
8495 8859
 		if ($globalDBdriver == 'mysql') {
8496 8860
 			$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
@@ -8537,7 +8901,9 @@  discard block
 block discarded – undo
8537 8901
 			date_default_timezone_set($globalTimezone);
8538 8902
 			$datetime = new DateTime();
8539 8903
 			$offset = $datetime->format('P');
8540
-		} else $offset = '+00:00';
8904
+		} else {
8905
+			$offset = '+00:00';
8906
+		}
8541 8907
 		$filter_query = $this->getFilter($filters,true,true);
8542 8908
 		if ($globalDBdriver == 'mysql') {
8543 8909
 			$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
@@ -8586,7 +8952,9 @@  discard block
 block discarded – undo
8586 8952
 			date_default_timezone_set($globalTimezone);
8587 8953
 			$datetime = new DateTime();
8588 8954
 			$offset = $datetime->format('P');
8589
-		} else $offset = '+00:00';
8955
+		} else {
8956
+			$offset = '+00:00';
8957
+		}
8590 8958
 
8591 8959
 		$orderby_sql = '';
8592 8960
 		if ($orderby == "hour")
@@ -8652,7 +9020,9 @@  discard block
 block discarded – undo
8652 9020
 			date_default_timezone_set($globalTimezone);
8653 9021
 			$datetime = new DateTime();
8654 9022
 			$offset = $datetime->format('P');
8655
-		} else $offset = '+00:00';
9023
+		} else {
9024
+			$offset = '+00:00';
9025
+		}
8656 9026
 
8657 9027
 		$orderby_sql = '';
8658 9028
 		if ($orderby == "hour")
@@ -8719,7 +9089,9 @@  discard block
 block discarded – undo
8719 9089
 			date_default_timezone_set($globalTimezone);
8720 9090
 			$datetime = new DateTime();
8721 9091
 			$offset = $datetime->format('P');
8722
-		} else $offset = '+00:00';
9092
+		} else {
9093
+			$offset = '+00:00';
9094
+		}
8723 9095
 
8724 9096
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8725 9097
 
@@ -8770,7 +9142,9 @@  discard block
 block discarded – undo
8770 9142
 			date_default_timezone_set($globalTimezone);
8771 9143
 			$datetime = new DateTime();
8772 9144
 			$offset = $datetime->format('P');
8773
-		} else $offset = '+00:00';
9145
+		} else {
9146
+			$offset = '+00:00';
9147
+		}
8774 9148
 
8775 9149
 		if ($globalDBdriver == 'mysql') {
8776 9150
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8817,7 +9191,9 @@  discard block
 block discarded – undo
8817 9191
 			date_default_timezone_set($globalTimezone);
8818 9192
 			$datetime = new DateTime();
8819 9193
 			$offset = $datetime->format('P');
8820
-		} else $offset = '+00:00';
9194
+		} else {
9195
+			$offset = '+00:00';
9196
+		}
8821 9197
 
8822 9198
 		if ($globalDBdriver == 'mysql') {
8823 9199
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8864,7 +9240,9 @@  discard block
 block discarded – undo
8864 9240
 			date_default_timezone_set($globalTimezone);
8865 9241
 			$datetime = new DateTime();
8866 9242
 			$offset = $datetime->format('P');
8867
-		} else $offset = '+00:00';
9243
+		} else {
9244
+			$offset = '+00:00';
9245
+		}
8868 9246
 
8869 9247
 		if ($globalDBdriver == 'mysql') {
8870 9248
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8912,7 +9290,9 @@  discard block
 block discarded – undo
8912 9290
 			date_default_timezone_set($globalTimezone);
8913 9291
 			$datetime = new DateTime();
8914 9292
 			$offset = $datetime->format('P');
8915
-		} else $offset = '+00:00';
9293
+		} else {
9294
+			$offset = '+00:00';
9295
+		}
8916 9296
 
8917 9297
 		if ($globalDBdriver == 'mysql') {
8918 9298
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8960,7 +9340,9 @@  discard block
 block discarded – undo
8960 9340
 			date_default_timezone_set($globalTimezone);
8961 9341
 			$datetime = new DateTime($date);
8962 9342
 			$offset = $datetime->format('P');
8963
-		} else $offset = '+00:00';
9343
+		} else {
9344
+			$offset = '+00:00';
9345
+		}
8964 9346
 
8965 9347
 		if ($globalDBdriver == 'mysql') {
8966 9348
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9008,7 +9390,9 @@  discard block
 block discarded – undo
9008 9390
 			date_default_timezone_set($globalTimezone);
9009 9391
 			$datetime = new DateTime();
9010 9392
 			$offset = $datetime->format('P');
9011
-		} else $offset = '+00:00';
9393
+		} else {
9394
+			$offset = '+00:00';
9395
+		}
9012 9396
 
9013 9397
 		if ($globalDBdriver == 'mysql') {
9014 9398
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9058,7 +9442,9 @@  discard block
 block discarded – undo
9058 9442
 			date_default_timezone_set($globalTimezone);
9059 9443
 			$datetime = new DateTime();
9060 9444
 			$offset = $datetime->format('P');
9061
-		} else $offset = '+00:00';
9445
+		} else {
9446
+			$offset = '+00:00';
9447
+		}
9062 9448
 
9063 9449
 		if ($globalDBdriver == 'mysql') {
9064 9450
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9105,7 +9491,9 @@  discard block
 block discarded – undo
9105 9491
 			date_default_timezone_set($globalTimezone);
9106 9492
 			$datetime = new DateTime();
9107 9493
 			$offset = $datetime->format('P');
9108
-		} else $offset = '+00:00';
9494
+		} else {
9495
+			$offset = '+00:00';
9496
+		}
9109 9497
 
9110 9498
 		if ($globalDBdriver == 'mysql') {
9111 9499
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9273,7 +9661,9 @@  discard block
 block discarded – undo
9273 9661
 			date_default_timezone_set($globalTimezone);
9274 9662
 			$datetime = new DateTime();
9275 9663
 			$offset = $datetime->format('P');
9276
-		} else $offset = '+00:00';
9664
+		} else {
9665
+			$offset = '+00:00';
9666
+		}
9277 9667
 
9278 9668
 		if ($globalDBdriver == 'mysql') {
9279 9669
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9459,7 +9849,9 @@  discard block
 block discarded – undo
9459 9849
 	*/
9460 9850
 	public function parseDirection($direction = 0)
9461 9851
 	{
9462
-		if ($direction == '') $direction = 0;
9852
+		if ($direction == '') {
9853
+			$direction = 0;
9854
+		}
9463 9855
 		$direction_array = array();
9464 9856
 		$temp_array = array();
9465 9857
 
@@ -9560,7 +9952,9 @@  discard block
 block discarded – undo
9560 9952
 		if (isset($result->AirlineFlightInfoResult))
9561 9953
 		{
9562 9954
 			$registration = $result->AirlineFlightInfoResult->tailnumber;
9563
-		} else return '';
9955
+		} else {
9956
+			return '';
9957
+		}
9564 9958
 		
9565 9959
 		$registration = $this->convertAircraftRegistration($registration);
9566 9960
 		
@@ -9589,7 +9983,9 @@  discard block
 block discarded – undo
9589 9983
 		if (count($row) > 0) {
9590 9984
 		    //return $row['Registration'];
9591 9985
 		    return $row['registration'];
9592
-		} else return '';
9986
+		} else {
9987
+			return '';
9988
+		}
9593 9989
 	
9594 9990
 	}
9595 9991
 
@@ -9612,9 +10008,14 @@  discard block
 block discarded – undo
9612 10008
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9613 10009
 		$sth->closeCursor();
9614 10010
 		if (count($row) > 0) {
9615
-		    if ($row['type_flight'] == null) return '';
9616
-		    else return $row['type_flight'];
9617
-		} else return '';
10011
+		    if ($row['type_flight'] == null) {
10012
+		    	return '';
10013
+		    } else {
10014
+		    	return $row['type_flight'];
10015
+		    }
10016
+		} else {
10017
+			return '';
10018
+		}
9618 10019
 	
9619 10020
 	}
9620 10021
 
@@ -9632,7 +10033,9 @@  discard block
 block discarded – undo
9632 10033
 		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9633 10034
 	
9634 10035
 		$Connection = new Connection($this->db);
9635
-		if (!$Connection->tableExists('countries')) return '';
10036
+		if (!$Connection->tableExists('countries')) {
10037
+			return '';
10038
+		}
9636 10039
 	
9637 10040
 		try {
9638 10041
 			/*
@@ -9652,9 +10055,13 @@  discard block
 block discarded – undo
9652 10055
 			$sth->closeCursor();
9653 10056
 			if (count($row) > 0) {
9654 10057
 				return $row;
9655
-			} else return '';
10058
+			} else {
10059
+				return '';
10060
+			}
9656 10061
 		} catch (PDOException $e) {
9657
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
10062
+			if (isset($globalDebug) && $globalDebug) {
10063
+				echo 'Error : '.$e->getMessage()."\n";
10064
+			}
9658 10065
 			return '';
9659 10066
 		}
9660 10067
 	
@@ -9802,7 +10209,9 @@  discard block
 block discarded – undo
9802 10209
 	{
9803 10210
 		global $globalBitlyAccessToken;
9804 10211
 		
9805
-		if ($globalBitlyAccessToken == '') return $url;
10212
+		if ($globalBitlyAccessToken == '') {
10213
+			return $url;
10214
+		}
9806 10215
         
9807 10216
 		$google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url;
9808 10217
 		
@@ -9951,7 +10360,9 @@  discard block
 block discarded – undo
9951 10360
 		
9952 10361
 
9953 10362
 		// routes
9954
-		if ($globalDebug) print "Routes...\n";
10363
+		if ($globalDebug) {
10364
+			print "Routes...\n";
10365
+		}
9955 10366
 		if ($globalDBdriver == 'mysql') {
9956 10367
 			$query = "SELECT spotter_output.spotter_id, routes.FromAirport_ICAO, routes.ToAirport_ICAO FROM spotter_output, routes WHERE spotter_output.ident = routes.CallSign AND ( spotter_output.departure_airport_icao != routes.FromAirport_ICAO OR spotter_output.arrival_airport_icao != routes.ToAirport_ICAO) AND routes.FromAirport_ICAO != '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)";
9957 10368
 		} else {
@@ -9970,7 +10381,9 @@  discard block
 block discarded – undo
9970 10381
 			}
9971 10382
 		}
9972 10383
 		
9973
-		if ($globalDebug) print "Airlines...\n";
10384
+		if ($globalDebug) {
10385
+			print "Airlines...\n";
10386
+		}
9974 10387
 		//airlines
9975 10388
 		if ($globalDBdriver == 'mysql') {
9976 10389
 			$query  = "SELECT spotter_output.spotter_id, spotter_output.ident FROM spotter_output WHERE (spotter_output.airline_name = '' OR spotter_output.airline_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)";
@@ -9984,10 +10397,15 @@  discard block
 block discarded – undo
9984 10397
 			if (is_numeric(substr($row['ident'], -1, 1)))
9985 10398
 			{
9986 10399
 				$fromsource = NULL;
9987
-				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
9988
-				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
9989
-				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
9990
-				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
10400
+				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
10401
+					$fromsource = 'vatsim';
10402
+				} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
10403
+					$fromsource = 'ivao';
10404
+				} elseif (isset($globalVATSIM) && $globalVATSIM) {
10405
+					$fromsource = 'vatsim';
10406
+				} elseif (isset($globalIVAO) && $globalIVAO) {
10407
+					$fromsource = 'ivao';
10408
+				}
9991 10409
 				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
9992 10410
 				if (isset($airline_array[0]['name'])) {
9993 10411
 					$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";
@@ -9997,13 +10415,17 @@  discard block
 block discarded – undo
9997 10415
 			}
9998 10416
 		}
9999 10417
 
10000
-		if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n";
10418
+		if ($globalDebug) {
10419
+			print "Remove Duplicate in aircraft_modes...\n";
10420
+		}
10001 10421
 		//duplicate modes
10002 10422
 		$query = "DELETE aircraft_modes FROM aircraft_modes LEFT OUTER JOIN (SELECT max(`AircraftID`) as `AircraftID`,`ModeS` FROM `aircraft_modes` group by ModeS) as KeepRows ON aircraft_modes.AircraftID = KeepRows.AircraftID WHERE KeepRows.AircraftID IS NULL";
10003 10423
 		$sth = $this->db->prepare($query);
10004 10424
 		$sth->execute();
10005 10425
 		
10006
-		if ($globalDebug) print "Aircraft...\n";
10426
+		if ($globalDebug) {
10427
+			print "Aircraft...\n";
10428
+		}
10007 10429
 		//aircraft
10008 10430
 		if ($globalDBdriver == 'mysql') {
10009 10431
 			$query  = "SELECT spotter_output.spotter_id, spotter_output.aircraft_icao, spotter_output.registration FROM spotter_output WHERE (spotter_output.aircraft_name = '' OR spotter_output.aircraft_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -10046,26 +10468,38 @@  discard block
 block discarded – undo
10046 10468
 				 if (isset($closestAirports[0])) {
10047 10469
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
10048 10470
 						$airport_icao = $closestAirports[0]['icao'];
10049
-						if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10471
+						if ($globalDebug) {
10472
+							echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10473
+						}
10050 10474
 					} elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') {
10051 10475
 						foreach ($closestAirports as $airport) {
10052 10476
 							if ($row['arrival_airport_icao'] == $airport['icao']) {
10053 10477
 								$airport_icao = $airport['icao'];
10054
-								if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10478
+								if ($globalDebug) {
10479
+									echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10480
+								}
10055 10481
 								break;
10056 10482
 							}
10057 10483
 						}
10058 10484
 					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
10059 10485
 						$airport_icao = $closestAirports[0]['icao'];
10060
-						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";
10486
+						if ($globalDebug) {
10487
+							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";
10488
+						}
10061 10489
 					} else {
10062
-						if ($globalDebug) echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10490
+						if ($globalDebug) {
10491
+							echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10492
+						}
10063 10493
 					}
10064 10494
 				} else {
10065
-					if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
10495
+					if ($globalDebug) {
10496
+						echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
10497
+					}
10066 10498
 				}
10067 10499
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
10068
-					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
10500
+					if ($globalDebug) {
10501
+						echo "Updating airport to ".$airport_icao."...\n";
10502
+					}
10069 10503
 					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10070 10504
 					$sthu = $this->db->prepare($update_query);
10071 10505
 					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
Please login to merge, or discard this 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.
statistics-sub-menu.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 					} else {
14 14
 						print '<option value="">All</option>';
15 15
 					}
16
-					foreach($airlines as $airline) {
16
+					foreach ($airlines as $airline) {
17 17
 						if (isset($airline_icao) && $airline_icao == $airline['airline_icao']) {
18 18
 							print '<option value="'.$airline['airline_icao'].'" selected>'.$airline['airline_name'].'</option>';
19 19
 						} else {
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 <div class="sub-menu sub-menu-container">
29 29
 	<ul class="nav">
30 30
 		<li class="dropdown">
31
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#" >
31
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#" >
32 32
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
33 33
 		    </a>
34 34
 		    <ul class="dropdown-menu">
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 		    </ul>
40 40
 		</li>
41 41
 		<li class="dropdown">
42
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
42
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign") { print 'active'; } ?>" data-toggle="dropdown" href="#">
43 43
 		      <?php echo _("Airline"); ?> <span class="caret"></span>
44 44
 		    </a>
45 45
 		    <ul class="dropdown-menu" role="menu">
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 		    </ul>
50 50
 		</li>
51 51
 		<li class="dropdown">
52
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
52
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country") { print 'active'; } ?>" data-toggle="dropdown" href="#">
53 53
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
54 54
 		    </a>
55 55
 		    <ul class="dropdown-menu" role="menu">
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 		    </ul>
61 61
 		</li>
62 62
 		<li class="dropdown">
63
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
63
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint") { print 'active'; } ?>" data-toggle="dropdown" href="#">
64 64
 		      <?php echo _("Route"); ?> <span class="caret"></span>
65 65
 		    </a>
66 66
 		    <ul class="dropdown-menu" role="menu">
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 		    </ul>
70 70
 		</li>
71 71
 		<li class="dropdown">
72
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
72
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#">
73 73
 		      <?php echo _("Date &amp; Time"); ?> <span class="caret"></span>
74 74
 		    </a>
75 75
 		    <ul class="dropdown-menu" role="menu">
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,9 @@
 block discarded – undo
7 7
 				<?php
8 8
 					require_once('require/class.Stats.php');
9 9
 					$Stats = new Stats();
10
-					if (!isset($filter_name)) $filter_name = '';
10
+					if (!isset($filter_name)) {
11
+						$filter_name = '';
12
+					}
11 13
 					$airlines = $Stats->getAllAirlineNames($filter_name);
12 14
 					if (isset($airline_icao) && ($airline_icao == '' || $airline_icao == 'all')) {
13 15
 						print '<option value="all" selected>All</option>';
Please login to merge, or discard this patch.
notam-data.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 <button type="button" class="close">&times;</button>
8 8
 <?php
9 9
 
10
-$notamref = filter_input(INPUT_GET,'notam',FILTER_SANITIZE_STRING);
10
+$notamref = filter_input(INPUT_GET, 'notam', FILTER_SANITIZE_STRING);
11 11
 $notamref = urldecode($notamref);
12 12
 $NOTAM = new NOTAM();
13 13
 $notam = $NOTAM->getNOTAMbyRef($notamref);
Please login to merge, or discard this patch.
require/class.NOTAM.php 4 patches
Indentation   +942 added lines, -942 removed lines patch added patch discarded remove patch
@@ -7,964 +7,964 @@
 block discarded – undo
7 7
 class NOTAM {
8 8
 	public $db;
9 9
 	private $abbr = array(
10
-	                    'A/A' => 'Air-to-air',
11
-	                    'A/G' => 'Air-to-ground',
12
-	                    'AAL' => 'Above Aerodrome Level',
13
-	                    'ABM' => 'Abeam',
14
-	                    'ABN' => 'Aerodrome Beacon',
15
-	                    'ABT' => 'About',
16
-	                    'ABV' => 'Above',
17
-	                    'ACC' => 'Area Control',
18
-	                    'ACFT' => 'Aircraft',
19
-	                    'ACK' => 'Acknowledge',
20
-	                    'ACL' => 'Altimeter Check Location',
21
-	                    'ACN' => 'Aircraft Classification Number',
22
-	                    'ACPT' => 'Accepted',
23
-	                    'ACT' => 'Active',
24
-	                    'AD' => 'Aerodrome',
25
-	                    'ADA' => 'Advisory Area',
26
-	                    'ADC' => 'Aerodrome Chart',
27
-	                    'ADDN' => 'Additional',
28
-	                    'ADIZ' => 'Air defense identification zone',
29
-	                    'ADJ' => 'Adjacent',
30
-	                    'ADR' => 'Advisory Route',
31
-	                    'ADS' => 'Automatic Dependent Surveillance',
32
-	                    'ADVS' => 'Advisory Service',
33
-	                    'ADZ' => 'Advised',
34
-	                    'AFIL' => 'Flight Plan Filed In The Air',
35
-	                    'AFIS' => 'Airport flight information service',
36
-	                    'AFM' => 'Affirm',
37
-	                    'AFT' => 'After',
38
-	                    'AGA' => 'Aerodromes, Air Routes and Ground Aids',
39
-	                    'AGN' => 'Again',
40
-	                    'AIS' => 'Aeronautical information service',
41
-	                    'ALERFA' => 'Alert Phase',
42
-	                    'ALRS' => 'Alerting Service',
43
-	                    'ALS' => 'Approach Lighting System',
44
-	                    'ALT' => 'Altitude',
45
-	                    'ALTN' => 'Alternate',
46
-	                    'AMA' => 'Area Minimum Altitude',
47
-	                    'ANC' => 'Aeronautical Chart',
48
-	                    'ANCS' => 'Aeronautical Navigation Chart',
49
-	                    'ANS' => 'Answer',
50
-	                    'AOC' => 'Aerodrome Obstacle Chart',
51
-	                    'AP' => 'Airport',
52
-	                    'APCH' => 'Approach',
53
-	                    'APDC' => 'Aircraft Parking/docking Chart',
54
-	                    'APN' => 'Apron',
55
-	                    'APNS' => 'Aprons',
56
-	                    'APP' => 'Approach Control',
57
-	                    'APR' => 'April',
58
-	                    'APRX' => 'Approximately',
59
-	                    'APSG' => 'After Passing',
60
-	                    'APV' => 'Approved',
61
-	                    'ARC' => 'Area Chart',
62
-	                    'ARNG' => 'Arrange',
63
-	                    'ARO' => 'Air Traffic Services Reporting Office',
64
-	                    'ARP' => 'Aerodrome Reference Point',
65
-	                    'ARR' => 'Arriving',
66
-	                    'ARST' => 'Arresting',
67
-	                    'ASC' => 'Ascend To',
68
-	                    'ASDA' => 'Accelerate-Stop Distance Available',
69
-	                    'ASPEEDG' => 'Airspeed Gain',
70
-	                    'ASPEEDL' => 'Airspeed Loss',
71
-	                    'ASPH' => 'Asphalt',
72
-	                    'ATA' => 'Actual Time of Arrival',
73
-	                    'ATD' => 'Actual Time of Departure',
74
-	                    'ATFM' => 'Air Traffic Flow Management',
75
-	                    'ATIS' => 'Automatic terminal information service',
76
-	                    'ATM' => 'Air Traffic Management',
77
-	                    'ATP' => 'At',
78
-	                    'ATTN' => 'Attention',
79
-	                    'ATZ' => 'Aerodrome Traffic Zone',
80
-	                    'AUG' => 'August',
81
-	                    'AUTH' => 'Authorization',
82
-	                    'AUW' => 'All Up Weight',
83
-	                    'AUX' => 'Auxiliary',
84
-	                    'AVBL' => 'Available',
85
-	                    'AVG' => 'Average',
86
-	                    'AVGAS' => 'Aviation Gasoline',
87
-	                    'AWTA' => 'Advise At What Time Able',
88
-	                    'AWY' => 'Airway',
89
-	                    'AWYS' => 'Airways',
90
-	                    'AZM' => 'Azimuth',
91
-	                    'BA' => 'Braking Action',
92
-	                    'BCN' => 'Beacon',
93
-	                    'BCST' => 'Broadcast',
94
-	                    'BDRY' => 'Boundary',
95
-	                    'BFR' => 'Before',
96
-	                    'BLDG' => 'Building',
97
-	                    'BLO' => 'Below Clouds',
98
-	                    'BLW' => 'Below',
99
-	                    'BRF' => 'Short',
100
-	                    'BRG' => 'Bearing',
101
-	                    'BRKG' => 'Breaking',
102
-	                    'BTL' => 'Between Layers',
103
-	                    'BTN' => 'Between',
104
-	                    'CD' => 'Candela',
105
-	                    'CDN' => 'Coordination',
106
-	                    'CF' => 'Change Frequency To',
107
-	                    'CFM' => 'Confirm',
108
-	                    'CGL' => 'Circling Guidance Light(s)',
109
-	                    'CH' => 'Channel',
110
-	                    'CHG' => 'Changed',
111
-	                    'CIT' => 'Near or Over Large Towns',
112
-	                    'CIV' => 'Civil',
113
-	                    'CK' => 'Check',
114
-	                    'CL' => 'Centre Line',
115
-	                    'CLBR' => 'Calibration',
116
-	                    'CLD' => 'Cloud',
117
-	                    'CLG' => 'Calling',
118
-	                    'CLIMB-OUT' => 'Climb-out Area',
119
-	                    'CLR' => 'Clearance',
120
-	                    'CLRD' => 'Cleared',
121
-	                    'CLSD' => 'Closed',
122
-	                    'CMB' => 'Climb',
123
-	                    'CMPL' => 'Complete',
124
-	                    'CNL' => 'Cancel',
125
-	                    'CNS' => 'Communications, Navigation And Surveillance',
126
-	                    'COM' => 'Communications',
127
-	                    'CONC' => 'Concrete',
128
-	                    'COND' => 'Condition',
129
-	                    'CONS' => 'Continuous',
130
-	                    'CONST' => 'Construction',
131
-	                    'CONT' => 'Continued',
132
-	                    'COOR' => 'Coordination',
133
-	                    'COORD' => 'Coordinates',
134
-	                    'COP' => 'Change-over Point',
135
-	                    'COR' => 'Correction',
136
-	                    'COT' => 'At The Coast',
137
-	                    'COV' => 'Covered',
138
-	                    'CPDLC' => 'Controller-pilot Data Link Communications',
139
-	                    'CPL' => 'Current Flight Plan',
140
-	                    'CRC' => 'Cyclic Redundancy Check',
141
-	                    'CRZ' => 'Cruise',
142
-	                    'CTA' => 'Control area',
143
-	                    'CTAM' => 'Climb To And Maintain',
144
-	                    'CTC' => 'Contact',
145
-	                    'CTL' => 'Control',
146
-	                    'CTN' => 'Caution',
147
-	                    'CTR' => 'Control Zone',
148
-	                    'CVR' => 'Cockpit Voice Recorder',
149
-	                    'CW' => 'Continuous Wave',
150
-	                    'CWY' => 'Clearway',
151
-	                    'DA' => 'Decision Altitude',
152
-	                    'DCKG' => 'Docking',
153
-	                    'DCP' => 'Datum Crossing Point',
154
-	                    'DCPC' => 'Direct Controller-pilot Communications',
155
-	                    'DCT' => 'Direct',
156
-	                    'DEC' => 'December',
157
-	                    'DEG' => 'Degrees',
158
-	                    'DEP' => 'Departing',
159
-	                    'DES' => 'Descend',
160
-	                    'DEST' => 'Destination',
161
-	                    'DETRESFA' => 'Distress Phase',
162
-	                    'DEV' => 'Deviating',
163
-	                    'DFDR' => 'Digital Flight Data Recorder',
164
-	                    'DFTI' => 'Distance From Touchdown Indicator',
165
-	                    'DH' => 'Decision Height',
166
-	                    'DIP' => 'Diffuse',
167
-	                    'DIST' => 'Distance',
168
-	                    'DIV' => 'Divert',
169
-	                    'DLA' => 'Delay',
170
-	                    'DLY' => 'Daily',
171
-	                    'DME' => 'Distance measuring equipment',
172
-	                    'DNG' => 'Dangerous',
173
-	                    'DOM' => 'Domestic',
174
-	                    'DPT' => 'Depth',
175
-	                    'DR' => 'Dead Reckoning',
176
-	                    'DRG' => 'During',
177
-	                    'DTAM' => 'Descend To And Maintain',
178
-	                    'DTG' => 'Date-time Group',
179
-	                    'DTHR' => 'Displaced Runway Threshold',
180
-	                    'DTRT' => 'Deteriorating',
181
-	                    'DTW' => 'Dual Tandem Wheels',
182
-	                    'DUPE' => 'This Is A Duplicate Message',
183
-	                    'DUR' => 'Duration',
184
-	                    'DVOR' => 'Doppler VOR',
185
-	                    'DW' => 'Dual Wheels',
186
-	                    'EAT' => 'Expected Approach Time',
187
-	                    'EB' => 'Eastbound',
188
-	                    'EDA' => 'Elevation Differential Area',
189
-	                    'EET' => 'Estimated Elapsed Time',
190
-	                    'EFC' => 'Expect Further Clearance',
191
-	                    'ELBA' => 'Emergency Location Beacon',
192
-	                    'ELEV' => 'Elevation',
193
-	                    'ELR' => 'Extra Long Range',
194
-	                    'EM' => 'Emission',
195
-	                    'EMERG' => 'Emergency',
196
-	                    'END' => 'Stop-end',
197
-	                    'ENE' => 'East-north-east',
198
-	                    'ENG' => 'Engine',
199
-	                    'ENR' => 'En-route',
200
-	                    'ENRC' => 'En-route Chart',
201
-	                    'EOBT' => 'Estimated Off-block Time',
202
-	                    'EQPT' => 'Equipment',
203
-	                    'ER' => 'Here',
204
-	                    'ESE' => 'East-south-east',
205
-	                    'EST' => 'Estimate',
206
-	                    'ETA' => 'Estimated Time Of Arrival',
207
-	                    'ETD' => 'Estimated Time Of Departure',
208
-	                    'ETO' => 'Estimated Time Over Significant Point',
209
-	                    'EV' => 'Every',
210
-	                    'EXC' => 'Except',
211
-	                    'EXER' => 'Exercise',
212
-	                    'EXP' => 'Expect',
213
-	                    'EXTD' => 'Extend',
214
-	                    'FAC' => 'Facilities',
215
-	                    'FAF' => 'Final Approach Fix',
216
-	                    'FAL' => 'Facilitation of International Airtransport',
217
-	                    'FAP' => 'Final Approach Point',
218
-	                    'FATO' => 'Final Approach And Take-off Area',
219
-	                    'FAX' => 'Fax',
220
-	                    'FBL' => 'Light',
221
-	                    'FCST' => 'Forecast',
222
-	                    'FCT' => 'Friction Coefficient',
223
-	                    'FDPS' => 'Flight Data Processing System',
224
-	                    'FEB' => 'February',
225
-	                    'FIR' => 'Flight information region',
226
-	                    'FIS' => 'Flight information service',
227
-	                    'FLD' => 'Field',
228
-	                    'FLG' => 'Flashing',
229
-	                    'FLR' => 'Flares',
230
-	                    'FLT' => 'Flight',
231
-	                    'FLTS' => 'Flights',
232
-	                    'FLTCK' => 'Flight Check',
233
-	                    'FLUC' => 'Fluctuating',
234
-	                    'FLW' => 'Follow(s)',
235
-	                    'FLY' => 'Fly',
236
-	                    'FM' => 'From',
237
-	                    'FMS' => 'Flight Management System',
238
-	                    'FMU' => 'Flow Management Unit',
239
-	                    'FNA' => 'Final Approach',
240
-	                    'FPAP' => 'Flight Path Alignment Point',
241
-	                    'FPL' => 'Flight Plan',
242
-	                    'FPLS' => 'Flight Plans',
243
-	                    'FPM' => 'Feet Per Minute',
244
-	                    'FPR' => 'Flight Plan Route',
245
-	                    'FR' => 'Fuel Remaining',
246
-	                    'FREQ' => 'Frequency',
247
-	                    'FRI' => 'Friday',
248
-	                    'FRMG' => 'Missile, gun or rocket firing',
249
-	                    'FRNG' => 'Firing',
250
-	                    'FRONT' => 'Front',
251
-	                    'FRQ' => 'Frequent',
252
-	                    'FSL' => 'Full Stop Landing',
253
-	                    'FSS' => 'Flight Service Station',
254
-	                    'FST' => 'First',
255
-	                    'FTP' => 'Fictitious Threshold Point',
256
-	                    'G/A' => 'Ground-to-air',
257
-	                    'G/A/G' => 'Ground-to-air and Air-to-ground',
258
-	                    'GARP' => 'GBAS Azimuth Reference Point',
259
-	                    'GBAS' => 'Ground-based Augmentation System',
260
-	                    'GCAJ' => 'Ground Controlled Approach',
261
-	                    'GCA' => 'Ground Controlled Approach System',
262
-	                    'GEN' => 'General',
263
-	                    'GEO' => 'Geographic or True',
264
-	                    'GES' => 'Ground Earth Station',
265
-	                    'GLD' => 'Glider',
266
-	                    'GMC' => 'Ground Movement Chart',
267
-	                    'GND' => 'Ground',
268
-	                    'GNDCK' => 'Ground Check',
269
-	                    'GP' => 'Glide Path',
270
-	                    'GRASS' => 'Grass landing area',
271
-	                    'GRVL' => 'Gravel',
272
-	                    'GUND' => 'Geoid Undulation',
273
-	                    'H24' => '24 Hours',
274
-	                    'HAPI' => 'Helicopter Approach Path Indicator',
275
-	                    'HBN' => 'Hazard Beacon',
276
-	                    'HDG' => 'Heading',
277
-	                    'HEL' => 'Helicopter',
278
-	                    'HGT' => 'Height',
279
-	                    'HJ' => 'Sunrise to Sunset',
280
-	                    'HLDG' => 'Holding',
281
-	                    'HN' => 'Sunset to Sunrise',
282
-	                    'HO' => 'Service Available To Meet Operational Requirements',
283
-	                    'HOL' => 'Holiday',
284
-	                    'HOSP' => 'Hospital Aircraft',
285
-	                    'HOT' => 'Height',
286
-	                    'HPA' => 'Hectopascal',
287
-	                    'HR' => 'Hours',
288
-	                    'HRS' => 'Hours',
289
-	                    'HS' => 'Service Available During Hours Of Scheduled Operations',
290
-	                    'HURCN' => 'Hurricane',
291
-	                    'HVY' => 'Heavy',
292
-	                    'HX' => 'No Specific Working Hours',
293
-	                    'HYR' => 'Higher',
294
-	                    'IAC' => 'Instrument Approach Chart',
295
-	                    'IAF' => 'Initial Approach Fix',
296
-	                    'IAO' => 'In And Out Of Clouds',
297
-	                    'IAP' => 'Instrument Approach Procedure',
298
-	                    'IAR' => 'Intersection Of Air Routes',
299
-	                    'IBN' => 'Identification Beacon',
300
-	                    'ID' => 'Identifier',
301
-	                    'IDENT' => 'Identification',
302
-	                    'IFF' => 'Identification Friend/Foe',
303
-	                    'IGA' => 'International General Aviation',
304
-	                    'IM' => 'Inner Marker',
305
-	                    'IMPR' => 'Improving',
306
-	                    'IMT' => 'Immediately',
307
-	                    'INA' => 'Initial Approach',
308
-	                    'INBD' => 'Inbound',
309
-	                    'INCERFA' => 'Uncertainty Phase',
310
-	                    'INFO' => 'Information',
311
-	                    'INOP' => 'Inoperative',
312
-	                    'INP' => 'If Not Possible',
313
-	                    'INPR' => 'In Progress',
314
-	                    'INSTL' => 'Installation',
315
-	                    'INSTR' => 'Instrument',
316
-	                    'INT' => 'Intersection',
317
-	                    'INTS' => 'Intersections',
318
-	                    'INTL' => 'International',
319
-	                    'INTRG' => 'Interrogator',
320
-	                    'INTRP' => 'Interruption',
321
-	                    'INTSF' => 'Intensifying',
322
-	                    'INTST' => 'Intensity',
323
-	                    'ISA' => 'International Standard Atmosphere',
324
-	                    'JAN' => 'January',
325
-	                    'JTST' => 'Jet stream',
326
-	                    'JUL' => 'July',
327
-	                    'JUN' => 'June',
328
-	                    'KMH' => 'Kilometres Per Hour',
329
-	                    'KPA' => 'Kilopascal',
330
-	                    'KT' => 'Knots',
331
-	                    'KW' => 'Kilowatts',
332
-	                    'LAN' => 'Inland',
333
-	                    'LAT' => 'Latitude',
334
-	                    'LDA' => 'Landing Distance Available',
335
-	                    'LDAH' => 'Landing Distance Available, Helicopter',
336
-	                    'LDG' => 'Landing',
337
-	                    'LDI' => 'Landing Direction Indicator',
338
-	                    'LEN' => 'Length',
339
-	                    'LGT' => 'Lighting',
340
-	                    'LGTD' => 'Lighted',
341
-	                    'LIH' => 'Light Intensity High',
342
-	                    'LIL' => 'Light Intensity Low',
343
-	                    'LIM' => 'Light Intensity Medium',
344
-	                    'LLZ' => 'Localizer',
345
-	                    'LM' => 'Locator, Middle',
346
-	                    'LMT' => 'Local Mean Time',
347
-	                    'LNG' => 'Long',
348
-	                    'LO' => 'Locator, Outer',
349
-	                    'LOG' => 'Located',
350
-	                    'LONG' => 'Longitude',
351
-	                    'LRG' => 'Long Range',
352
-	                    'LTD' => 'Limited',
353
-	                    'LTP' => 'Landing Threshold Point',
354
-	                    'LVE' => 'Leaving',
355
-	                    'LVL' => 'Level',
356
-	                    'LYR' => 'Layer',
357
-	                    'MAA' => 'Maximum Authorized Altitude',
358
-	                    'MAG' => 'Magnetic',
359
-	                    'MAINT' => 'Maintenance',
360
-	                    'MAP' => 'Aeronautical Maps and Charts',
361
-	                    'MAPT' => 'Missed Approach Point',
362
-	                    'MAR' => 'March',
363
-	                    'MAX' => 'Maximum',
364
-	                    'MAY' => 'May',
365
-	                    'MBST' => 'Microburst',
366
-	                    'MCA' => 'Minimum Crossing Altitude',
367
-	                    'MCW' => 'Modulated Continuous Wave',
368
-	                    'MDA' => 'Minimum Descent Altitude',
369
-	                    'MDH' => 'Minimum Descent Height',
370
-	                    'MEA' => 'Minimum En-route Altitude',
371
-	                    'MEHT' => 'Minimum Eye Height Over Threshold',
372
-	                    'MET' => 'Meteorological',
373
-	                    'MID' => 'Mid-point',
374
-	                    'MIL' => 'Military',
375
-	                    'MIN' => 'Minutes',
376
-	                    'MKR' => 'Marker Radio Beacon',
377
-	                    'MLS' => 'Microwave Landing System',
378
-	                    'MM' => 'Middle Marker',
379
-	                    'MNM' => 'Minimum',
380
-	                    'MNPS' => 'Minimum Navigation Performance Specifications',
381
-	                    'MNT' => 'Monitor',
382
-	                    'MNTN' => 'Maintain',
383
-	                    'MOA' => 'Military Operating Area',
384
-	                    'MOC' => 'Minimum Obstacle Clearance',
385
-	                    'MOD' => 'Moderate',
386
-	                    'MON' => 'Monday',
387
-	                    'MOPS' => 'Minimum Operational Performance Standards',
388
-	                    'MOV' => 'Movement',
389
-	                    'MRA' => 'Minimum Reception Altitude',
390
-	                    'MRG' => 'Medium Range',
391
-	                    'MRP' => 'ATS/MET Reporting Point',
392
-	                    'MS' => 'Minus',
393
-	                    'MSA' => 'Minimum Sector Altitude',
394
-	                    'MSAW' => 'Minimum Safe Altitude Warning',
395
-	                    'MSG' => 'Message',
396
-	                    'MSSR' => 'Monopulse Secondary Surveillance Radar',
397
-	                    'MT' => 'Mountain',
398
-	                    'MTU' => 'Metric Units',
399
-	                    'MTW' => 'Mountain Waves',
400
-	                    'NASC' => 'National AIS System Centre',
401
-	                    'NAT' => 'North Atlantic',
402
-	                    'NAV' => 'Navigation',
403
-	                    'NB' => 'Northbound',
404
-	                    'NBFR' => 'Not Before',
405
-	                    'NE' => 'North-east',
406
-	                    'NEB' => 'North-eastbound',
407
-	                    'NEG' => 'Negative',
408
-	                    'NGT' => 'Night',
409
-	                    'NIL' => 'None',
410
-	                    'NML' => 'Normal',
411
-	                    'NNE' => 'North-north-east',
412
-	                    'NNW' => 'North-north-west',
413
-	                    'NOF' => 'International NOTAM Office',
414
-	                    'NOV' => 'November',
415
-	                    'NOZ' => 'Normal Operating Zone',
416
-	                    'NR' => 'Number',
417
-	                    'NRH' => 'No Reply Heard',
418
-	                    'NTL' => 'National',
419
-	                    'NTZ' => 'No Transgression Zone',
420
-	                    'NW' => 'North-west',
421
-	                    'NWB' => 'North-westbound',
422
-	                    'NXT' => 'Next',
423
-	                    'O/R' => 'On Request',
424
-	                    'OAC' => 'Oceanic Area Control Centre',
425
-	                    'OAS' => 'Obstacle Assessment Surface',
426
-	                    'OBS' => 'Observe',
427
-	                    'OBST' => 'Obstacle',
428
-	                    'OBSTS' => 'Obstacles',
429
-	                    'OCA' => 'Oceanic Control Area',
430
-	                    'OCH' => 'Obstacle Clearance Height',
431
-	                    'OCL' => 'Obstacle Clearance Limit',
432
-	                    'OCS' => 'Obstacle Clearance Surface',
433
-	                    'OCT' => 'October',
434
-	                    'OFZ' => 'Obstacle Free Zone',
435
-	                    'OGN' => 'Originate',
436
-	                    'OHD' => 'Overhead',
437
-	                    'OM' => 'Outer Marker',
438
-	                    'OPC' => 'Control Indicated Is Operational Control',
439
-	                    'OPMET' => 'Operational Meteorological',
440
-	                    'OPN' => 'Open',
441
-	                    'OPR' => 'Operate',
442
-	                    'OPS' => 'Operations',
443
-	                    'ORD' => 'Order',
444
-	                    'OSV' => 'Ocean Station Vessel',
445
-	                    'OTLK' => 'Outlook',
446
-	                    'OTP' => 'On Top',
447
-	                    'OTS' => 'Organized Track System',
448
-	                    'OUBD' => 'Outbound',
449
-	                    'PA' => 'Precision Approach',
450
-	                    'PALS' => 'Precision Approach Lighting System',
451
-	                    'PANS' => 'Procedures for Air Navigation Services',
452
-	                    'PAR' => 'Precision Approach Radar',
453
-	                    'PARL' => 'Parallel',
454
-	                    'PATC' => 'Precision Approach Terrain Chart',
455
-	                    'PAX' => 'Passenger(s)',
456
-	                    'PCD' => 'Proceed',
457
-	                    'PCL' => 'Pilot-controlled Lighting',
458
-	                    'PCN' => 'Pavement Classification Number',
459
-	                    'PDC' => 'Pre-departure Clearance',
460
-	                    'PDG' => 'Procedure Design Gradient',
461
-	                    'PER' => 'Performance',
462
-	                    'PERM' => 'Permanent',
463
-	                    'PIB' => 'Pre-flight Information Bulletin',
464
-	                    'PJE' => 'Parachute Jumping Exercise',
465
-	                    'PLA' => 'Practice Low Approach',
466
-	                    'PLN' => 'Flight Plan',
467
-	                    'PLVL' => 'Present Level',
468
-	                    'PN' => 'Prior Notice Required',
469
-	                    'PNR' => 'Point Of No Return',
470
-	                    'POB' => 'Persons On Board',
471
-	                    'POSS' => 'Possible',
472
-	                    'PPI' => 'Plan Position Indicator',
473
-	                    'PPR' => 'Prior Permission Required',
474
-	                    'PPSN' => 'Present Position',
475
-	                    'PRI' => 'Primary',
476
-	                    'PRKG' => 'Parking',
477
-	                    'PROB' => 'Probability',
478
-	                    'PROC' => 'Procedure',
479
-	                    'PROV' => 'Provisional',
480
-	                    'PS' => 'Plus',
481
-	                    'PSG' => 'Passing',
482
-	                    'PSN' => 'Position',
483
-	                    'PSNS' => 'Positions',
484
-	                    'PSR' => 'Primary Surveillance Radar',
485
-	                    'PSYS' => 'Pressure System(s)',
486
-	                    'PTN' => 'Procedure Turn',
487
-	                    'PTS' => 'Polar Track Structure',
488
-	                    'PWR' => 'Power',
489
-	                    'QUAD' => 'Quadrant',
490
-	                    'RAC' => 'Rules of The Air and Air Traffic Services',
491
-	                    'RAG' => 'Runway Arresting Gear',
492
-	                    'RAI' => 'Runway Alignment Indicator',
493
-	                    'RASC' => 'Regional AIS System Centre',
494
-	                    'RASS' => 'Remote Altimeter Setting Source',
495
-	                    'RB' => 'Rescue Boat',
496
-	                    'RCA' => 'Reach Cruising Altitude',
497
-	                    'RCC' => 'Rescue Coordination Centre',
498
-	                    'RCF' => 'Radiocommunication Failure',
499
-	                    'RCH' => 'Reaching',
500
-	                    'RCL' => 'Runway Centre Line',
501
-	                    'RCLL' => 'Runway Centre Line Light(s)',
502
-	                    'RCLR' => 'Recleared',
503
-	                    'RDH' => 'Reference Datum Height',
504
-	                    'RDL' => 'Radial',
505
-	                    'RDO' => 'Radio',
506
-	                    'RE' => 'Recent',
507
-	                    'REC' => 'Receiver',
508
-	                    'REDL' => 'Runway Edge Light(s)',
509
-	                    'REF' => 'Refer To',
510
-	                    'REG' => 'Registration',
511
-	                    'RENL' => 'Runway End Light(s)',
512
-	                    'REP' => 'Report',
513
-	                    'REQ' => 'Requested',
514
-	                    'RERTE' => 'Re-route',
515
-	                    'RESA' => 'Runway End Safety Area',
516
-	                    'RG' => 'Range (lights)',
517
-	                    'RHC' => 'Right-hand Circuit',
518
-	                    'RIF' => 'Reclearance In Flight',
519
-	                    'RITE' => 'Right',
520
-	                    'RL' => 'Report Leaving',
521
-	                    'RLA' => 'Relay To',
522
-	                    'RLCE' => 'Request Level Change En Route',
523
-	                    'RLLS' => 'Runway Lead-in Lighting System',
524
-	                    'RLNA' => 'Request Level Not Available',
525
-	                    'RMAC' => 'Radar Minimum Altitude Chart',
526
-	                    'RMK' => 'Remark',
527
-	                    'RNG' => 'Radio Range',
528
-	                    'RNP' => 'Required Navigation Performance',
529
-	                    'ROC' => 'Rate Of Climb',
530
-	                    'ROD' => 'Rate Of Descent',
531
-	                    'ROFOR' => 'Route Forecast',
532
-	                    'RON' => 'Receiving Only',
533
-	                    'RPI' => 'Radar Position Indicator',
534
-	                    'RPL' => 'Repetitive Flight Plan',
535
-	                    'RPLC' => 'Replaced',
536
-	                    'RPS' => 'Radar Position Symbol',
537
-	                    'RQMNTS' => 'Requirements',
538
-	                    'RQP' => 'Request Flight Plan',
539
-	                    'RQS' => 'Request Supplementary Flight Plan',
540
-	                    'RR' => 'Report Reaching',
541
-	                    'RSC' => 'Rescue Sub-centre',
542
-	                    'RSCD' => 'Runway Surface Condition',
543
-	                    'RSP' => 'Responder Beacon',
544
-	                    'RSR' => 'En-route Surveillance Radar',
545
-	                    'RTE' => 'Route',
546
-	                    'RTES' => 'Routes',
547
-	                    'RTF' => 'Radiotelephone',
548
-	                    'RTG' => 'Radiotelegraph',
549
-	                    'RTHL' => 'Runway Threshold Light(s)',
550
-	                    'RTN' => 'Return',
551
-	                    'RTODAH' => 'Rejected Take-off Distance Available, Helicopter',
552
-	                    'RTS' => 'Return To Service',
553
-	                    'RTT' => 'Radioteletypewriter',
554
-	                    'RTZL' => 'Runway Touchdown Zone Light(s)',
555
-	                    'RUT' => 'Standard Regional Route Transmitting Frequencies',
556
-	                    'RV' => 'Rescue Vessel',
557
-	                    'RVSM' => 'Reduced Vertical Separation Minimum',
558
-	                    'RWY' => 'Runway',
559
-	                    'RWYS' => 'Runways',
560
-	                    'SALS' => 'Simple Approach Lighting System',
561
-	                    'SAN' => 'Sanitary',
562
-	                    'SAP' => 'As Soon As Possible',
563
-	                    'SAR' => 'Search and Rescue',
564
-	                    'SARPS' => 'Standards and Recommended Practices',
565
-	                    'SAT' => 'Saturday',
566
-	                    'SATCOM' => 'Satellite Communication',
567
-	                    'SB' => 'Southbound',
568
-	                    'SBAS' => 'Satellite-based Augmentation System',
569
-	                    'SDBY' => 'Stand by',
570
-	                    'SE' => 'South-east',
571
-	                    'SEA' => 'Sea',
572
-	                    'SEB' => 'South-eastbound',
573
-	                    'SEC' => 'Seconds',
574
-	                    'SECN' => 'Section',
575
-	                    'SECT' => 'Sector',
576
-	                    'SELCAL' => 'Selective calling system',
577
-	                    'SEP' => 'September',
578
-	                    'SER' => 'Service',
579
-	                    'SEV' => 'Severe',
580
-	                    'SFC' => 'Surface',
581
-	                    'SGL' => 'Signal',
582
-	                    'SID' => 'Standard Instrument Departure',
583
-	                    'SIF' => 'Selective Identification Feature',
584
-	                    'SIG' => 'Significant',
585
-	                    'SIMUL' => 'Simultaneous',
586
-	                    'SKED' => 'Schedule',
587
-	                    'SLP' => 'Speed Limiting Point',
588
-	                    'SLW' => 'Slow',
589
-	                    'SMC' => 'Surface Movement Control',
590
-	                    'SMR' => 'Surface Movement Radar',
591
-	                    'SPL' => 'Supplementary Flight Plan',
592
-	                    'SPOC' => 'SAR Point Of Contact',
593
-	                    'SPOT' => 'Spot Wind',
594
-	                    'SR' => 'Sunrise',
595
-	                    'SRA' => 'Surveillance Radar Approach',
596
-	                    'SRE' => 'Surveillance Radar Element Of Precision Approach Radar System',
597
-	                    'SRG' => 'Short Range',
598
-	                    'SRR' => 'Search and Rescue Region',
599
-	                    'SRY' => 'Secondary',
600
-	                    'SS' => 'Sunset',
601
-	                    'SSE' => 'South-south-east',
602
-	                    'SSR' => 'Secondary Surveillance Radar',
603
-	                    'SST' => 'Supersonic Transport',
604
-	                    'SSW' => 'South-south-west',
605
-	                    'STA' => 'Straight-in Approach',
606
-	                    'STAR' => 'Standard Instrument Arrival',
607
-	                    'STD' => 'Standard',
608
-	                    'STN' => 'Station',
609
-	                    'STNR' => 'Stationary',
610
-	                    'STOL' => 'Short Take-off and Landing',
611
-	                    'STS' => 'Status',
612
-	                    'STWL' => 'Stopway Light(s)',
613
-	                    'SUBJ' => 'Subject To',
614
-	                    'SUN' => 'Sunday',
615
-	                    'SUP' => 'Supplement',
616
-	                    'SUPPS' => 'Regional Supplementary Procedures Service Message',
617
-	                    'SVCBL' => 'Serviceable',
618
-	                    'SW' => 'South-west',
619
-	                    'SWB' => 'South-westbound',
620
-	                    'SWY' => 'Stopway',
621
-	                    'TA' => 'Transition Altitude',
622
-	                    'TAA' => 'Terminal Arrival Altitude',
623
-	                    'TAF' => 'Aerodrome Forecast',
624
-	                    'TAIL' => 'Tail Wind',
625
-	                    'TAR' => 'Terminal Area Surveillance Radar',
626
-	                    'TAX' => 'Taxi',
627
-	                    'TCAC' => 'Tropical Cyclone Advisory Centre',
628
-	                    'TDO' => 'Tornado',
629
-	                    'TDZ' => 'Touchdown Zone',
630
-	                    'TECR' => 'Technical Reason',
631
-	                    'TEMPO' => 'Temporarily',
632
-	                    'TFC' => 'Traffic',
633
-	                    'TGL' => 'Touch-and-go',
634
-	                    'TGS' => 'Taxiing Guidance System',
635
-	                    'THR' => 'Threshold',
636
-	                    'THRU' => 'Through',
637
-	                    'THU' => 'Thursday',
638
-	                    'TIBA' => 'Traffic Information Broadcast By Aircraft',
639
-	                    'TIL' => 'Until',
640
-	                    'TIP' => 'Until Past',
641
-	                    'TKOF' => 'Take-off',
642
-	                    'TL' => 'Till',
643
-	                    'TLOF' => 'Touchdown And Lift-off Area',
644
-	                    'TMA' => 'Terminal Control Area',
645
-	                    'TNA' => 'Turn Altitude',
646
-	                    'TNH' => 'Turn Height',
647
-	                    'TOC' => 'Top of Climb',
648
-	                    'TODA' => 'Take-off Distance Available',
649
-	                    'TODAH' => 'Take-off Distance Available, Helicopter',
650
-	                    'TORA' => 'Take-off Run Available',
651
-	                    'TP' => 'Turning Point',
652
-	                    'TR' => 'Track',
653
-	                    'TRA' => 'Temporary Reserved Airspace',
654
-	                    'TRANS' => 'Transmitter',
655
-	                    'TRL' => 'Transition Level',
656
-	                    'TUE' => 'Tuesday',
657
-	                    'TURB' => 'Turbulence',
658
-	                    'TVOR' => 'Terminal VOR',
659
-	                    'TWR' => 'Tower',
660
-	                    'TWY' => 'Taxiway',
661
-	                    'TWYL' => 'Taxiway-link',
662
-	                    'TXT' => 'Text',
663
-	                    'TYP' => 'Type of Aircraft',
664
-	                    'U/S' => 'Unserviceable',
665
-	                    'UAB' => 'Until Advised By',
666
-	                    'UAC' => 'Upper Area Control Centre',
667
-	                    'UAR' => 'Upper Air Route',
668
-	                    'UDA' => 'Upper advisory area',
669
-	                    'UFN' => 'Until Further Notice',
670
-	                    'UHDT' => 'Unable Higher Due Traffic',
671
-	                    'UIC' => 'Upper Information Centre',
672
-	                    'UIR' => 'Upper Flight Information Region',
673
-	                    'ULR' => 'Ultra Long Range',
674
-	                    'UNA' => 'Unable',
675
-	                    'UNAP' => 'Unable To Approve',
676
-	                    'UNL' => 'Unlimited',
677
-	                    'UNREL' => 'Unreliable',
678
-	                    'UTA' => 'Upper Control Area',
679
-	                    'VAAC' => 'Volcanic Ash Advisory Centre',
680
-	                    'VAC' => 'Visual Approach Chart',
681
-	                    'VAL' => 'In Valleys',
682
-	                    'VAN' => 'Runway Control Van',
683
-	                    'VAR' => 'Visual-aural Radio Range',
684
-	                    'VC' => 'Vicinity',
685
-	                    'VCY' => 'Vicinity',
686
-	                    'VER' => 'Vertical',
687
-	                    'VIS' => 'Visibility',
688
-	                    'VLR' => 'Very Long Range',
689
-	                    'VPA' => 'Vertical Path Angle',
690
-	                    'VRB' => 'Variable',
691
-	                    'VSA' => 'By Visual Reference To The Ground',
692
-	                    'VSP' => 'Vertical Speed',
693
-	                    'VTOL' => 'Vertical Take-off And Landing',
694
-	                    'WAC' => 'World Aeronautical Chart',
695
-	                    'WAFC' => 'World Area Forecast Centre',
696
-	                    'WB' => 'Westbound',
697
-	                    'WBAR' => 'Wing Bar Lights',
698
-	                    'WDI' => 'Wind Direction Indicator',
699
-	                    'WDSPR' => 'Widespread',
700
-	                    'WED' => 'Wednesday',
701
-	                    'WEF' => 'Effective From',
702
-	                    'WI' => 'Within',
703
-	                    'WID' => 'Width',
704
-	                    'WIE' => 'Effective Immediately',
705
-	                    'WILCO' => 'Will Comply',
706
-	                    'WIND' => 'Wind',
707
-	                    'WINTEM' => 'Forecast Upper Wind And Temperature For Aviation',
708
-	                    'WIP' => 'Work In Progress',
709
-	                    'WKN' => 'Weaken',
710
-	                    'WNW' => 'West-north-west',
711
-	                    'WO' => 'Without',
712
-	                    'WPT' => 'Way-point',
713
-	                    'WRNG' => 'Warning',
714
-	                    'WSW' => 'West-south-west',
715
-	                    'WT' => 'Weight',
716
-	                    'WWW' => 'Worldwide Web',
717
-	                    'WX' => 'Weather',
718
-	                    'XBAR' => 'Crossbar',
719
-	                    'XNG' => 'Crossing',
720
-	                    'XS' => 'Atmospherics',
721
-	                    'YCZ' => 'Yellow Caution Zone',
722
-	                    'YR' => 'Your');
10
+						'A/A' => 'Air-to-air',
11
+						'A/G' => 'Air-to-ground',
12
+						'AAL' => 'Above Aerodrome Level',
13
+						'ABM' => 'Abeam',
14
+						'ABN' => 'Aerodrome Beacon',
15
+						'ABT' => 'About',
16
+						'ABV' => 'Above',
17
+						'ACC' => 'Area Control',
18
+						'ACFT' => 'Aircraft',
19
+						'ACK' => 'Acknowledge',
20
+						'ACL' => 'Altimeter Check Location',
21
+						'ACN' => 'Aircraft Classification Number',
22
+						'ACPT' => 'Accepted',
23
+						'ACT' => 'Active',
24
+						'AD' => 'Aerodrome',
25
+						'ADA' => 'Advisory Area',
26
+						'ADC' => 'Aerodrome Chart',
27
+						'ADDN' => 'Additional',
28
+						'ADIZ' => 'Air defense identification zone',
29
+						'ADJ' => 'Adjacent',
30
+						'ADR' => 'Advisory Route',
31
+						'ADS' => 'Automatic Dependent Surveillance',
32
+						'ADVS' => 'Advisory Service',
33
+						'ADZ' => 'Advised',
34
+						'AFIL' => 'Flight Plan Filed In The Air',
35
+						'AFIS' => 'Airport flight information service',
36
+						'AFM' => 'Affirm',
37
+						'AFT' => 'After',
38
+						'AGA' => 'Aerodromes, Air Routes and Ground Aids',
39
+						'AGN' => 'Again',
40
+						'AIS' => 'Aeronautical information service',
41
+						'ALERFA' => 'Alert Phase',
42
+						'ALRS' => 'Alerting Service',
43
+						'ALS' => 'Approach Lighting System',
44
+						'ALT' => 'Altitude',
45
+						'ALTN' => 'Alternate',
46
+						'AMA' => 'Area Minimum Altitude',
47
+						'ANC' => 'Aeronautical Chart',
48
+						'ANCS' => 'Aeronautical Navigation Chart',
49
+						'ANS' => 'Answer',
50
+						'AOC' => 'Aerodrome Obstacle Chart',
51
+						'AP' => 'Airport',
52
+						'APCH' => 'Approach',
53
+						'APDC' => 'Aircraft Parking/docking Chart',
54
+						'APN' => 'Apron',
55
+						'APNS' => 'Aprons',
56
+						'APP' => 'Approach Control',
57
+						'APR' => 'April',
58
+						'APRX' => 'Approximately',
59
+						'APSG' => 'After Passing',
60
+						'APV' => 'Approved',
61
+						'ARC' => 'Area Chart',
62
+						'ARNG' => 'Arrange',
63
+						'ARO' => 'Air Traffic Services Reporting Office',
64
+						'ARP' => 'Aerodrome Reference Point',
65
+						'ARR' => 'Arriving',
66
+						'ARST' => 'Arresting',
67
+						'ASC' => 'Ascend To',
68
+						'ASDA' => 'Accelerate-Stop Distance Available',
69
+						'ASPEEDG' => 'Airspeed Gain',
70
+						'ASPEEDL' => 'Airspeed Loss',
71
+						'ASPH' => 'Asphalt',
72
+						'ATA' => 'Actual Time of Arrival',
73
+						'ATD' => 'Actual Time of Departure',
74
+						'ATFM' => 'Air Traffic Flow Management',
75
+						'ATIS' => 'Automatic terminal information service',
76
+						'ATM' => 'Air Traffic Management',
77
+						'ATP' => 'At',
78
+						'ATTN' => 'Attention',
79
+						'ATZ' => 'Aerodrome Traffic Zone',
80
+						'AUG' => 'August',
81
+						'AUTH' => 'Authorization',
82
+						'AUW' => 'All Up Weight',
83
+						'AUX' => 'Auxiliary',
84
+						'AVBL' => 'Available',
85
+						'AVG' => 'Average',
86
+						'AVGAS' => 'Aviation Gasoline',
87
+						'AWTA' => 'Advise At What Time Able',
88
+						'AWY' => 'Airway',
89
+						'AWYS' => 'Airways',
90
+						'AZM' => 'Azimuth',
91
+						'BA' => 'Braking Action',
92
+						'BCN' => 'Beacon',
93
+						'BCST' => 'Broadcast',
94
+						'BDRY' => 'Boundary',
95
+						'BFR' => 'Before',
96
+						'BLDG' => 'Building',
97
+						'BLO' => 'Below Clouds',
98
+						'BLW' => 'Below',
99
+						'BRF' => 'Short',
100
+						'BRG' => 'Bearing',
101
+						'BRKG' => 'Breaking',
102
+						'BTL' => 'Between Layers',
103
+						'BTN' => 'Between',
104
+						'CD' => 'Candela',
105
+						'CDN' => 'Coordination',
106
+						'CF' => 'Change Frequency To',
107
+						'CFM' => 'Confirm',
108
+						'CGL' => 'Circling Guidance Light(s)',
109
+						'CH' => 'Channel',
110
+						'CHG' => 'Changed',
111
+						'CIT' => 'Near or Over Large Towns',
112
+						'CIV' => 'Civil',
113
+						'CK' => 'Check',
114
+						'CL' => 'Centre Line',
115
+						'CLBR' => 'Calibration',
116
+						'CLD' => 'Cloud',
117
+						'CLG' => 'Calling',
118
+						'CLIMB-OUT' => 'Climb-out Area',
119
+						'CLR' => 'Clearance',
120
+						'CLRD' => 'Cleared',
121
+						'CLSD' => 'Closed',
122
+						'CMB' => 'Climb',
123
+						'CMPL' => 'Complete',
124
+						'CNL' => 'Cancel',
125
+						'CNS' => 'Communications, Navigation And Surveillance',
126
+						'COM' => 'Communications',
127
+						'CONC' => 'Concrete',
128
+						'COND' => 'Condition',
129
+						'CONS' => 'Continuous',
130
+						'CONST' => 'Construction',
131
+						'CONT' => 'Continued',
132
+						'COOR' => 'Coordination',
133
+						'COORD' => 'Coordinates',
134
+						'COP' => 'Change-over Point',
135
+						'COR' => 'Correction',
136
+						'COT' => 'At The Coast',
137
+						'COV' => 'Covered',
138
+						'CPDLC' => 'Controller-pilot Data Link Communications',
139
+						'CPL' => 'Current Flight Plan',
140
+						'CRC' => 'Cyclic Redundancy Check',
141
+						'CRZ' => 'Cruise',
142
+						'CTA' => 'Control area',
143
+						'CTAM' => 'Climb To And Maintain',
144
+						'CTC' => 'Contact',
145
+						'CTL' => 'Control',
146
+						'CTN' => 'Caution',
147
+						'CTR' => 'Control Zone',
148
+						'CVR' => 'Cockpit Voice Recorder',
149
+						'CW' => 'Continuous Wave',
150
+						'CWY' => 'Clearway',
151
+						'DA' => 'Decision Altitude',
152
+						'DCKG' => 'Docking',
153
+						'DCP' => 'Datum Crossing Point',
154
+						'DCPC' => 'Direct Controller-pilot Communications',
155
+						'DCT' => 'Direct',
156
+						'DEC' => 'December',
157
+						'DEG' => 'Degrees',
158
+						'DEP' => 'Departing',
159
+						'DES' => 'Descend',
160
+						'DEST' => 'Destination',
161
+						'DETRESFA' => 'Distress Phase',
162
+						'DEV' => 'Deviating',
163
+						'DFDR' => 'Digital Flight Data Recorder',
164
+						'DFTI' => 'Distance From Touchdown Indicator',
165
+						'DH' => 'Decision Height',
166
+						'DIP' => 'Diffuse',
167
+						'DIST' => 'Distance',
168
+						'DIV' => 'Divert',
169
+						'DLA' => 'Delay',
170
+						'DLY' => 'Daily',
171
+						'DME' => 'Distance measuring equipment',
172
+						'DNG' => 'Dangerous',
173
+						'DOM' => 'Domestic',
174
+						'DPT' => 'Depth',
175
+						'DR' => 'Dead Reckoning',
176
+						'DRG' => 'During',
177
+						'DTAM' => 'Descend To And Maintain',
178
+						'DTG' => 'Date-time Group',
179
+						'DTHR' => 'Displaced Runway Threshold',
180
+						'DTRT' => 'Deteriorating',
181
+						'DTW' => 'Dual Tandem Wheels',
182
+						'DUPE' => 'This Is A Duplicate Message',
183
+						'DUR' => 'Duration',
184
+						'DVOR' => 'Doppler VOR',
185
+						'DW' => 'Dual Wheels',
186
+						'EAT' => 'Expected Approach Time',
187
+						'EB' => 'Eastbound',
188
+						'EDA' => 'Elevation Differential Area',
189
+						'EET' => 'Estimated Elapsed Time',
190
+						'EFC' => 'Expect Further Clearance',
191
+						'ELBA' => 'Emergency Location Beacon',
192
+						'ELEV' => 'Elevation',
193
+						'ELR' => 'Extra Long Range',
194
+						'EM' => 'Emission',
195
+						'EMERG' => 'Emergency',
196
+						'END' => 'Stop-end',
197
+						'ENE' => 'East-north-east',
198
+						'ENG' => 'Engine',
199
+						'ENR' => 'En-route',
200
+						'ENRC' => 'En-route Chart',
201
+						'EOBT' => 'Estimated Off-block Time',
202
+						'EQPT' => 'Equipment',
203
+						'ER' => 'Here',
204
+						'ESE' => 'East-south-east',
205
+						'EST' => 'Estimate',
206
+						'ETA' => 'Estimated Time Of Arrival',
207
+						'ETD' => 'Estimated Time Of Departure',
208
+						'ETO' => 'Estimated Time Over Significant Point',
209
+						'EV' => 'Every',
210
+						'EXC' => 'Except',
211
+						'EXER' => 'Exercise',
212
+						'EXP' => 'Expect',
213
+						'EXTD' => 'Extend',
214
+						'FAC' => 'Facilities',
215
+						'FAF' => 'Final Approach Fix',
216
+						'FAL' => 'Facilitation of International Airtransport',
217
+						'FAP' => 'Final Approach Point',
218
+						'FATO' => 'Final Approach And Take-off Area',
219
+						'FAX' => 'Fax',
220
+						'FBL' => 'Light',
221
+						'FCST' => 'Forecast',
222
+						'FCT' => 'Friction Coefficient',
223
+						'FDPS' => 'Flight Data Processing System',
224
+						'FEB' => 'February',
225
+						'FIR' => 'Flight information region',
226
+						'FIS' => 'Flight information service',
227
+						'FLD' => 'Field',
228
+						'FLG' => 'Flashing',
229
+						'FLR' => 'Flares',
230
+						'FLT' => 'Flight',
231
+						'FLTS' => 'Flights',
232
+						'FLTCK' => 'Flight Check',
233
+						'FLUC' => 'Fluctuating',
234
+						'FLW' => 'Follow(s)',
235
+						'FLY' => 'Fly',
236
+						'FM' => 'From',
237
+						'FMS' => 'Flight Management System',
238
+						'FMU' => 'Flow Management Unit',
239
+						'FNA' => 'Final Approach',
240
+						'FPAP' => 'Flight Path Alignment Point',
241
+						'FPL' => 'Flight Plan',
242
+						'FPLS' => 'Flight Plans',
243
+						'FPM' => 'Feet Per Minute',
244
+						'FPR' => 'Flight Plan Route',
245
+						'FR' => 'Fuel Remaining',
246
+						'FREQ' => 'Frequency',
247
+						'FRI' => 'Friday',
248
+						'FRMG' => 'Missile, gun or rocket firing',
249
+						'FRNG' => 'Firing',
250
+						'FRONT' => 'Front',
251
+						'FRQ' => 'Frequent',
252
+						'FSL' => 'Full Stop Landing',
253
+						'FSS' => 'Flight Service Station',
254
+						'FST' => 'First',
255
+						'FTP' => 'Fictitious Threshold Point',
256
+						'G/A' => 'Ground-to-air',
257
+						'G/A/G' => 'Ground-to-air and Air-to-ground',
258
+						'GARP' => 'GBAS Azimuth Reference Point',
259
+						'GBAS' => 'Ground-based Augmentation System',
260
+						'GCAJ' => 'Ground Controlled Approach',
261
+						'GCA' => 'Ground Controlled Approach System',
262
+						'GEN' => 'General',
263
+						'GEO' => 'Geographic or True',
264
+						'GES' => 'Ground Earth Station',
265
+						'GLD' => 'Glider',
266
+						'GMC' => 'Ground Movement Chart',
267
+						'GND' => 'Ground',
268
+						'GNDCK' => 'Ground Check',
269
+						'GP' => 'Glide Path',
270
+						'GRASS' => 'Grass landing area',
271
+						'GRVL' => 'Gravel',
272
+						'GUND' => 'Geoid Undulation',
273
+						'H24' => '24 Hours',
274
+						'HAPI' => 'Helicopter Approach Path Indicator',
275
+						'HBN' => 'Hazard Beacon',
276
+						'HDG' => 'Heading',
277
+						'HEL' => 'Helicopter',
278
+						'HGT' => 'Height',
279
+						'HJ' => 'Sunrise to Sunset',
280
+						'HLDG' => 'Holding',
281
+						'HN' => 'Sunset to Sunrise',
282
+						'HO' => 'Service Available To Meet Operational Requirements',
283
+						'HOL' => 'Holiday',
284
+						'HOSP' => 'Hospital Aircraft',
285
+						'HOT' => 'Height',
286
+						'HPA' => 'Hectopascal',
287
+						'HR' => 'Hours',
288
+						'HRS' => 'Hours',
289
+						'HS' => 'Service Available During Hours Of Scheduled Operations',
290
+						'HURCN' => 'Hurricane',
291
+						'HVY' => 'Heavy',
292
+						'HX' => 'No Specific Working Hours',
293
+						'HYR' => 'Higher',
294
+						'IAC' => 'Instrument Approach Chart',
295
+						'IAF' => 'Initial Approach Fix',
296
+						'IAO' => 'In And Out Of Clouds',
297
+						'IAP' => 'Instrument Approach Procedure',
298
+						'IAR' => 'Intersection Of Air Routes',
299
+						'IBN' => 'Identification Beacon',
300
+						'ID' => 'Identifier',
301
+						'IDENT' => 'Identification',
302
+						'IFF' => 'Identification Friend/Foe',
303
+						'IGA' => 'International General Aviation',
304
+						'IM' => 'Inner Marker',
305
+						'IMPR' => 'Improving',
306
+						'IMT' => 'Immediately',
307
+						'INA' => 'Initial Approach',
308
+						'INBD' => 'Inbound',
309
+						'INCERFA' => 'Uncertainty Phase',
310
+						'INFO' => 'Information',
311
+						'INOP' => 'Inoperative',
312
+						'INP' => 'If Not Possible',
313
+						'INPR' => 'In Progress',
314
+						'INSTL' => 'Installation',
315
+						'INSTR' => 'Instrument',
316
+						'INT' => 'Intersection',
317
+						'INTS' => 'Intersections',
318
+						'INTL' => 'International',
319
+						'INTRG' => 'Interrogator',
320
+						'INTRP' => 'Interruption',
321
+						'INTSF' => 'Intensifying',
322
+						'INTST' => 'Intensity',
323
+						'ISA' => 'International Standard Atmosphere',
324
+						'JAN' => 'January',
325
+						'JTST' => 'Jet stream',
326
+						'JUL' => 'July',
327
+						'JUN' => 'June',
328
+						'KMH' => 'Kilometres Per Hour',
329
+						'KPA' => 'Kilopascal',
330
+						'KT' => 'Knots',
331
+						'KW' => 'Kilowatts',
332
+						'LAN' => 'Inland',
333
+						'LAT' => 'Latitude',
334
+						'LDA' => 'Landing Distance Available',
335
+						'LDAH' => 'Landing Distance Available, Helicopter',
336
+						'LDG' => 'Landing',
337
+						'LDI' => 'Landing Direction Indicator',
338
+						'LEN' => 'Length',
339
+						'LGT' => 'Lighting',
340
+						'LGTD' => 'Lighted',
341
+						'LIH' => 'Light Intensity High',
342
+						'LIL' => 'Light Intensity Low',
343
+						'LIM' => 'Light Intensity Medium',
344
+						'LLZ' => 'Localizer',
345
+						'LM' => 'Locator, Middle',
346
+						'LMT' => 'Local Mean Time',
347
+						'LNG' => 'Long',
348
+						'LO' => 'Locator, Outer',
349
+						'LOG' => 'Located',
350
+						'LONG' => 'Longitude',
351
+						'LRG' => 'Long Range',
352
+						'LTD' => 'Limited',
353
+						'LTP' => 'Landing Threshold Point',
354
+						'LVE' => 'Leaving',
355
+						'LVL' => 'Level',
356
+						'LYR' => 'Layer',
357
+						'MAA' => 'Maximum Authorized Altitude',
358
+						'MAG' => 'Magnetic',
359
+						'MAINT' => 'Maintenance',
360
+						'MAP' => 'Aeronautical Maps and Charts',
361
+						'MAPT' => 'Missed Approach Point',
362
+						'MAR' => 'March',
363
+						'MAX' => 'Maximum',
364
+						'MAY' => 'May',
365
+						'MBST' => 'Microburst',
366
+						'MCA' => 'Minimum Crossing Altitude',
367
+						'MCW' => 'Modulated Continuous Wave',
368
+						'MDA' => 'Minimum Descent Altitude',
369
+						'MDH' => 'Minimum Descent Height',
370
+						'MEA' => 'Minimum En-route Altitude',
371
+						'MEHT' => 'Minimum Eye Height Over Threshold',
372
+						'MET' => 'Meteorological',
373
+						'MID' => 'Mid-point',
374
+						'MIL' => 'Military',
375
+						'MIN' => 'Minutes',
376
+						'MKR' => 'Marker Radio Beacon',
377
+						'MLS' => 'Microwave Landing System',
378
+						'MM' => 'Middle Marker',
379
+						'MNM' => 'Minimum',
380
+						'MNPS' => 'Minimum Navigation Performance Specifications',
381
+						'MNT' => 'Monitor',
382
+						'MNTN' => 'Maintain',
383
+						'MOA' => 'Military Operating Area',
384
+						'MOC' => 'Minimum Obstacle Clearance',
385
+						'MOD' => 'Moderate',
386
+						'MON' => 'Monday',
387
+						'MOPS' => 'Minimum Operational Performance Standards',
388
+						'MOV' => 'Movement',
389
+						'MRA' => 'Minimum Reception Altitude',
390
+						'MRG' => 'Medium Range',
391
+						'MRP' => 'ATS/MET Reporting Point',
392
+						'MS' => 'Minus',
393
+						'MSA' => 'Minimum Sector Altitude',
394
+						'MSAW' => 'Minimum Safe Altitude Warning',
395
+						'MSG' => 'Message',
396
+						'MSSR' => 'Monopulse Secondary Surveillance Radar',
397
+						'MT' => 'Mountain',
398
+						'MTU' => 'Metric Units',
399
+						'MTW' => 'Mountain Waves',
400
+						'NASC' => 'National AIS System Centre',
401
+						'NAT' => 'North Atlantic',
402
+						'NAV' => 'Navigation',
403
+						'NB' => 'Northbound',
404
+						'NBFR' => 'Not Before',
405
+						'NE' => 'North-east',
406
+						'NEB' => 'North-eastbound',
407
+						'NEG' => 'Negative',
408
+						'NGT' => 'Night',
409
+						'NIL' => 'None',
410
+						'NML' => 'Normal',
411
+						'NNE' => 'North-north-east',
412
+						'NNW' => 'North-north-west',
413
+						'NOF' => 'International NOTAM Office',
414
+						'NOV' => 'November',
415
+						'NOZ' => 'Normal Operating Zone',
416
+						'NR' => 'Number',
417
+						'NRH' => 'No Reply Heard',
418
+						'NTL' => 'National',
419
+						'NTZ' => 'No Transgression Zone',
420
+						'NW' => 'North-west',
421
+						'NWB' => 'North-westbound',
422
+						'NXT' => 'Next',
423
+						'O/R' => 'On Request',
424
+						'OAC' => 'Oceanic Area Control Centre',
425
+						'OAS' => 'Obstacle Assessment Surface',
426
+						'OBS' => 'Observe',
427
+						'OBST' => 'Obstacle',
428
+						'OBSTS' => 'Obstacles',
429
+						'OCA' => 'Oceanic Control Area',
430
+						'OCH' => 'Obstacle Clearance Height',
431
+						'OCL' => 'Obstacle Clearance Limit',
432
+						'OCS' => 'Obstacle Clearance Surface',
433
+						'OCT' => 'October',
434
+						'OFZ' => 'Obstacle Free Zone',
435
+						'OGN' => 'Originate',
436
+						'OHD' => 'Overhead',
437
+						'OM' => 'Outer Marker',
438
+						'OPC' => 'Control Indicated Is Operational Control',
439
+						'OPMET' => 'Operational Meteorological',
440
+						'OPN' => 'Open',
441
+						'OPR' => 'Operate',
442
+						'OPS' => 'Operations',
443
+						'ORD' => 'Order',
444
+						'OSV' => 'Ocean Station Vessel',
445
+						'OTLK' => 'Outlook',
446
+						'OTP' => 'On Top',
447
+						'OTS' => 'Organized Track System',
448
+						'OUBD' => 'Outbound',
449
+						'PA' => 'Precision Approach',
450
+						'PALS' => 'Precision Approach Lighting System',
451
+						'PANS' => 'Procedures for Air Navigation Services',
452
+						'PAR' => 'Precision Approach Radar',
453
+						'PARL' => 'Parallel',
454
+						'PATC' => 'Precision Approach Terrain Chart',
455
+						'PAX' => 'Passenger(s)',
456
+						'PCD' => 'Proceed',
457
+						'PCL' => 'Pilot-controlled Lighting',
458
+						'PCN' => 'Pavement Classification Number',
459
+						'PDC' => 'Pre-departure Clearance',
460
+						'PDG' => 'Procedure Design Gradient',
461
+						'PER' => 'Performance',
462
+						'PERM' => 'Permanent',
463
+						'PIB' => 'Pre-flight Information Bulletin',
464
+						'PJE' => 'Parachute Jumping Exercise',
465
+						'PLA' => 'Practice Low Approach',
466
+						'PLN' => 'Flight Plan',
467
+						'PLVL' => 'Present Level',
468
+						'PN' => 'Prior Notice Required',
469
+						'PNR' => 'Point Of No Return',
470
+						'POB' => 'Persons On Board',
471
+						'POSS' => 'Possible',
472
+						'PPI' => 'Plan Position Indicator',
473
+						'PPR' => 'Prior Permission Required',
474
+						'PPSN' => 'Present Position',
475
+						'PRI' => 'Primary',
476
+						'PRKG' => 'Parking',
477
+						'PROB' => 'Probability',
478
+						'PROC' => 'Procedure',
479
+						'PROV' => 'Provisional',
480
+						'PS' => 'Plus',
481
+						'PSG' => 'Passing',
482
+						'PSN' => 'Position',
483
+						'PSNS' => 'Positions',
484
+						'PSR' => 'Primary Surveillance Radar',
485
+						'PSYS' => 'Pressure System(s)',
486
+						'PTN' => 'Procedure Turn',
487
+						'PTS' => 'Polar Track Structure',
488
+						'PWR' => 'Power',
489
+						'QUAD' => 'Quadrant',
490
+						'RAC' => 'Rules of The Air and Air Traffic Services',
491
+						'RAG' => 'Runway Arresting Gear',
492
+						'RAI' => 'Runway Alignment Indicator',
493
+						'RASC' => 'Regional AIS System Centre',
494
+						'RASS' => 'Remote Altimeter Setting Source',
495
+						'RB' => 'Rescue Boat',
496
+						'RCA' => 'Reach Cruising Altitude',
497
+						'RCC' => 'Rescue Coordination Centre',
498
+						'RCF' => 'Radiocommunication Failure',
499
+						'RCH' => 'Reaching',
500
+						'RCL' => 'Runway Centre Line',
501
+						'RCLL' => 'Runway Centre Line Light(s)',
502
+						'RCLR' => 'Recleared',
503
+						'RDH' => 'Reference Datum Height',
504
+						'RDL' => 'Radial',
505
+						'RDO' => 'Radio',
506
+						'RE' => 'Recent',
507
+						'REC' => 'Receiver',
508
+						'REDL' => 'Runway Edge Light(s)',
509
+						'REF' => 'Refer To',
510
+						'REG' => 'Registration',
511
+						'RENL' => 'Runway End Light(s)',
512
+						'REP' => 'Report',
513
+						'REQ' => 'Requested',
514
+						'RERTE' => 'Re-route',
515
+						'RESA' => 'Runway End Safety Area',
516
+						'RG' => 'Range (lights)',
517
+						'RHC' => 'Right-hand Circuit',
518
+						'RIF' => 'Reclearance In Flight',
519
+						'RITE' => 'Right',
520
+						'RL' => 'Report Leaving',
521
+						'RLA' => 'Relay To',
522
+						'RLCE' => 'Request Level Change En Route',
523
+						'RLLS' => 'Runway Lead-in Lighting System',
524
+						'RLNA' => 'Request Level Not Available',
525
+						'RMAC' => 'Radar Minimum Altitude Chart',
526
+						'RMK' => 'Remark',
527
+						'RNG' => 'Radio Range',
528
+						'RNP' => 'Required Navigation Performance',
529
+						'ROC' => 'Rate Of Climb',
530
+						'ROD' => 'Rate Of Descent',
531
+						'ROFOR' => 'Route Forecast',
532
+						'RON' => 'Receiving Only',
533
+						'RPI' => 'Radar Position Indicator',
534
+						'RPL' => 'Repetitive Flight Plan',
535
+						'RPLC' => 'Replaced',
536
+						'RPS' => 'Radar Position Symbol',
537
+						'RQMNTS' => 'Requirements',
538
+						'RQP' => 'Request Flight Plan',
539
+						'RQS' => 'Request Supplementary Flight Plan',
540
+						'RR' => 'Report Reaching',
541
+						'RSC' => 'Rescue Sub-centre',
542
+						'RSCD' => 'Runway Surface Condition',
543
+						'RSP' => 'Responder Beacon',
544
+						'RSR' => 'En-route Surveillance Radar',
545
+						'RTE' => 'Route',
546
+						'RTES' => 'Routes',
547
+						'RTF' => 'Radiotelephone',
548
+						'RTG' => 'Radiotelegraph',
549
+						'RTHL' => 'Runway Threshold Light(s)',
550
+						'RTN' => 'Return',
551
+						'RTODAH' => 'Rejected Take-off Distance Available, Helicopter',
552
+						'RTS' => 'Return To Service',
553
+						'RTT' => 'Radioteletypewriter',
554
+						'RTZL' => 'Runway Touchdown Zone Light(s)',
555
+						'RUT' => 'Standard Regional Route Transmitting Frequencies',
556
+						'RV' => 'Rescue Vessel',
557
+						'RVSM' => 'Reduced Vertical Separation Minimum',
558
+						'RWY' => 'Runway',
559
+						'RWYS' => 'Runways',
560
+						'SALS' => 'Simple Approach Lighting System',
561
+						'SAN' => 'Sanitary',
562
+						'SAP' => 'As Soon As Possible',
563
+						'SAR' => 'Search and Rescue',
564
+						'SARPS' => 'Standards and Recommended Practices',
565
+						'SAT' => 'Saturday',
566
+						'SATCOM' => 'Satellite Communication',
567
+						'SB' => 'Southbound',
568
+						'SBAS' => 'Satellite-based Augmentation System',
569
+						'SDBY' => 'Stand by',
570
+						'SE' => 'South-east',
571
+						'SEA' => 'Sea',
572
+						'SEB' => 'South-eastbound',
573
+						'SEC' => 'Seconds',
574
+						'SECN' => 'Section',
575
+						'SECT' => 'Sector',
576
+						'SELCAL' => 'Selective calling system',
577
+						'SEP' => 'September',
578
+						'SER' => 'Service',
579
+						'SEV' => 'Severe',
580
+						'SFC' => 'Surface',
581
+						'SGL' => 'Signal',
582
+						'SID' => 'Standard Instrument Departure',
583
+						'SIF' => 'Selective Identification Feature',
584
+						'SIG' => 'Significant',
585
+						'SIMUL' => 'Simultaneous',
586
+						'SKED' => 'Schedule',
587
+						'SLP' => 'Speed Limiting Point',
588
+						'SLW' => 'Slow',
589
+						'SMC' => 'Surface Movement Control',
590
+						'SMR' => 'Surface Movement Radar',
591
+						'SPL' => 'Supplementary Flight Plan',
592
+						'SPOC' => 'SAR Point Of Contact',
593
+						'SPOT' => 'Spot Wind',
594
+						'SR' => 'Sunrise',
595
+						'SRA' => 'Surveillance Radar Approach',
596
+						'SRE' => 'Surveillance Radar Element Of Precision Approach Radar System',
597
+						'SRG' => 'Short Range',
598
+						'SRR' => 'Search and Rescue Region',
599
+						'SRY' => 'Secondary',
600
+						'SS' => 'Sunset',
601
+						'SSE' => 'South-south-east',
602
+						'SSR' => 'Secondary Surveillance Radar',
603
+						'SST' => 'Supersonic Transport',
604
+						'SSW' => 'South-south-west',
605
+						'STA' => 'Straight-in Approach',
606
+						'STAR' => 'Standard Instrument Arrival',
607
+						'STD' => 'Standard',
608
+						'STN' => 'Station',
609
+						'STNR' => 'Stationary',
610
+						'STOL' => 'Short Take-off and Landing',
611
+						'STS' => 'Status',
612
+						'STWL' => 'Stopway Light(s)',
613
+						'SUBJ' => 'Subject To',
614
+						'SUN' => 'Sunday',
615
+						'SUP' => 'Supplement',
616
+						'SUPPS' => 'Regional Supplementary Procedures Service Message',
617
+						'SVCBL' => 'Serviceable',
618
+						'SW' => 'South-west',
619
+						'SWB' => 'South-westbound',
620
+						'SWY' => 'Stopway',
621
+						'TA' => 'Transition Altitude',
622
+						'TAA' => 'Terminal Arrival Altitude',
623
+						'TAF' => 'Aerodrome Forecast',
624
+						'TAIL' => 'Tail Wind',
625
+						'TAR' => 'Terminal Area Surveillance Radar',
626
+						'TAX' => 'Taxi',
627
+						'TCAC' => 'Tropical Cyclone Advisory Centre',
628
+						'TDO' => 'Tornado',
629
+						'TDZ' => 'Touchdown Zone',
630
+						'TECR' => 'Technical Reason',
631
+						'TEMPO' => 'Temporarily',
632
+						'TFC' => 'Traffic',
633
+						'TGL' => 'Touch-and-go',
634
+						'TGS' => 'Taxiing Guidance System',
635
+						'THR' => 'Threshold',
636
+						'THRU' => 'Through',
637
+						'THU' => 'Thursday',
638
+						'TIBA' => 'Traffic Information Broadcast By Aircraft',
639
+						'TIL' => 'Until',
640
+						'TIP' => 'Until Past',
641
+						'TKOF' => 'Take-off',
642
+						'TL' => 'Till',
643
+						'TLOF' => 'Touchdown And Lift-off Area',
644
+						'TMA' => 'Terminal Control Area',
645
+						'TNA' => 'Turn Altitude',
646
+						'TNH' => 'Turn Height',
647
+						'TOC' => 'Top of Climb',
648
+						'TODA' => 'Take-off Distance Available',
649
+						'TODAH' => 'Take-off Distance Available, Helicopter',
650
+						'TORA' => 'Take-off Run Available',
651
+						'TP' => 'Turning Point',
652
+						'TR' => 'Track',
653
+						'TRA' => 'Temporary Reserved Airspace',
654
+						'TRANS' => 'Transmitter',
655
+						'TRL' => 'Transition Level',
656
+						'TUE' => 'Tuesday',
657
+						'TURB' => 'Turbulence',
658
+						'TVOR' => 'Terminal VOR',
659
+						'TWR' => 'Tower',
660
+						'TWY' => 'Taxiway',
661
+						'TWYL' => 'Taxiway-link',
662
+						'TXT' => 'Text',
663
+						'TYP' => 'Type of Aircraft',
664
+						'U/S' => 'Unserviceable',
665
+						'UAB' => 'Until Advised By',
666
+						'UAC' => 'Upper Area Control Centre',
667
+						'UAR' => 'Upper Air Route',
668
+						'UDA' => 'Upper advisory area',
669
+						'UFN' => 'Until Further Notice',
670
+						'UHDT' => 'Unable Higher Due Traffic',
671
+						'UIC' => 'Upper Information Centre',
672
+						'UIR' => 'Upper Flight Information Region',
673
+						'ULR' => 'Ultra Long Range',
674
+						'UNA' => 'Unable',
675
+						'UNAP' => 'Unable To Approve',
676
+						'UNL' => 'Unlimited',
677
+						'UNREL' => 'Unreliable',
678
+						'UTA' => 'Upper Control Area',
679
+						'VAAC' => 'Volcanic Ash Advisory Centre',
680
+						'VAC' => 'Visual Approach Chart',
681
+						'VAL' => 'In Valleys',
682
+						'VAN' => 'Runway Control Van',
683
+						'VAR' => 'Visual-aural Radio Range',
684
+						'VC' => 'Vicinity',
685
+						'VCY' => 'Vicinity',
686
+						'VER' => 'Vertical',
687
+						'VIS' => 'Visibility',
688
+						'VLR' => 'Very Long Range',
689
+						'VPA' => 'Vertical Path Angle',
690
+						'VRB' => 'Variable',
691
+						'VSA' => 'By Visual Reference To The Ground',
692
+						'VSP' => 'Vertical Speed',
693
+						'VTOL' => 'Vertical Take-off And Landing',
694
+						'WAC' => 'World Aeronautical Chart',
695
+						'WAFC' => 'World Area Forecast Centre',
696
+						'WB' => 'Westbound',
697
+						'WBAR' => 'Wing Bar Lights',
698
+						'WDI' => 'Wind Direction Indicator',
699
+						'WDSPR' => 'Widespread',
700
+						'WED' => 'Wednesday',
701
+						'WEF' => 'Effective From',
702
+						'WI' => 'Within',
703
+						'WID' => 'Width',
704
+						'WIE' => 'Effective Immediately',
705
+						'WILCO' => 'Will Comply',
706
+						'WIND' => 'Wind',
707
+						'WINTEM' => 'Forecast Upper Wind And Temperature For Aviation',
708
+						'WIP' => 'Work In Progress',
709
+						'WKN' => 'Weaken',
710
+						'WNW' => 'West-north-west',
711
+						'WO' => 'Without',
712
+						'WPT' => 'Way-point',
713
+						'WRNG' => 'Warning',
714
+						'WSW' => 'West-south-west',
715
+						'WT' => 'Weight',
716
+						'WWW' => 'Worldwide Web',
717
+						'WX' => 'Weather',
718
+						'XBAR' => 'Crossbar',
719
+						'XNG' => 'Crossing',
720
+						'XS' => 'Atmospherics',
721
+						'YCZ' => 'Yellow Caution Zone',
722
+						'YR' => 'Your');
723 723
 	public $code_airspace = array(
724
-			    'AA' => 'Minimum altitude',
725
-			    'AC' => 'Class B, C, D, or E Surface Area',
726
-			    'AD' => 'Air defense identification zone',
727
-			    'AE' => 'Control area',
728
-			    'AF' => 'Flight information region',
729
-			    'AH' => 'Upper control area',
730
-			    'AL' => 'Minimum usable flight level',
731
-			    'AN' => 'Area navigation route',
732
-			    'AO' => 'Oceanic control area',
733
-			    'AP' => 'Reporting point',
734
-			    'AR' => 'ATS route',
735
-			    'AT' => 'Class B Airspace',
736
-			    'AU' => 'Upper flight information region',
737
-			    'AV' => 'Upper advisory area',
738
-			    'AX' => 'Intersection',
739
-			    'AZ' => 'Aerodrome traffic zone');
724
+				'AA' => 'Minimum altitude',
725
+				'AC' => 'Class B, C, D, or E Surface Area',
726
+				'AD' => 'Air defense identification zone',
727
+				'AE' => 'Control area',
728
+				'AF' => 'Flight information region',
729
+				'AH' => 'Upper control area',
730
+				'AL' => 'Minimum usable flight level',
731
+				'AN' => 'Area navigation route',
732
+				'AO' => 'Oceanic control area',
733
+				'AP' => 'Reporting point',
734
+				'AR' => 'ATS route',
735
+				'AT' => 'Class B Airspace',
736
+				'AU' => 'Upper flight information region',
737
+				'AV' => 'Upper advisory area',
738
+				'AX' => 'Intersection',
739
+				'AZ' => 'Aerodrome traffic zone');
740 740
 	public $code_comradar = array(
741
-			    'CA' => 'Air/ground',
742
-			    'CE' => 'En route surveillance radar',
743
-			    'CG' => 'Ground controlled approach system',
744
-			    'CL' => 'Selective calling system',
745
-			    'CM' => 'Surface movement radar',
746
-			    'CP' => 'Precision approach radar',
747
-			    'CR' => 'Surveillance radar element of precision approach radar system',
748
-			    'CS' => 'Secondary surveillance radar',
749
-			    'CT' => 'Terminal area surveillance radar');
741
+				'CA' => 'Air/ground',
742
+				'CE' => 'En route surveillance radar',
743
+				'CG' => 'Ground controlled approach system',
744
+				'CL' => 'Selective calling system',
745
+				'CM' => 'Surface movement radar',
746
+				'CP' => 'Precision approach radar',
747
+				'CR' => 'Surveillance radar element of precision approach radar system',
748
+				'CS' => 'Secondary surveillance radar',
749
+				'CT' => 'Terminal area surveillance radar');
750 750
 	public $code_facilities = array(
751
-			    'FA' => 'airport',
752
-			    'FB' => 'Braking action measurement equipment',
753
-			    'FC' => 'Ceiling measurement equipment',
754
-			    'FD' => 'Docking system',
755
-			    'FF' => 'Fire fighting and rescue',
756
-			    'FG' => 'Ground movement control',
757
-			    'FH' => 'Helicopter alighting area/platform',
758
-			    'FL' => 'Landing direction indicator',
759
-			    'FM' => 'Meteorological service',
760
-			    'FO' => 'Fog dispersal system',
761
-			    'FP' => 'Heliport',
762
-			    'FS' => 'Snow removal equipment',
763
-			    'FT' => 'Transmissometer',
764
-			    'FU' => 'Fuel availability',
765
-			    'FW' => 'Wind direction indicator',
766
-			    'FZ' => 'Customs');
751
+				'FA' => 'airport',
752
+				'FB' => 'Braking action measurement equipment',
753
+				'FC' => 'Ceiling measurement equipment',
754
+				'FD' => 'Docking system',
755
+				'FF' => 'Fire fighting and rescue',
756
+				'FG' => 'Ground movement control',
757
+				'FH' => 'Helicopter alighting area/platform',
758
+				'FL' => 'Landing direction indicator',
759
+				'FM' => 'Meteorological service',
760
+				'FO' => 'Fog dispersal system',
761
+				'FP' => 'Heliport',
762
+				'FS' => 'Snow removal equipment',
763
+				'FT' => 'Transmissometer',
764
+				'FU' => 'Fuel availability',
765
+				'FW' => 'Wind direction indicator',
766
+				'FZ' => 'Customs');
767 767
 	public $code_instrumentlanding = array(
768
-			    'ID' => 'DME associated with ILS',
769
-			    'IG' => 'Glide path',
770
-			    'II' => 'Inner marker',
771
-			    'IL' => 'Localizer',
772
-			    'IM' => 'Middle marker',
773
-			    'IO' => 'Outer marker',
774
-			    'IS' => 'ILS Category I',
775
-			    'IT' => 'ILS Category II',
776
-			    'IU' => 'ILS Category III',
777
-			    'IW' => 'Microwave landing system',
778
-			    'IX' => 'Locator, outer',
779
-			    'IY' => 'Locator, middle');
768
+				'ID' => 'DME associated with ILS',
769
+				'IG' => 'Glide path',
770
+				'II' => 'Inner marker',
771
+				'IL' => 'Localizer',
772
+				'IM' => 'Middle marker',
773
+				'IO' => 'Outer marker',
774
+				'IS' => 'ILS Category I',
775
+				'IT' => 'ILS Category II',
776
+				'IU' => 'ILS Category III',
777
+				'IW' => 'Microwave landing system',
778
+				'IX' => 'Locator, outer',
779
+				'IY' => 'Locator, middle');
780 780
 	public $code_lightingfacilities = array(
781
-			    'LA' => 'Approach lighting system',
782
-			    'LB' => 'Airport beacon',
783
-			    'LC' => 'Runway center line lights',
784
-			    'LD' => 'Landing direction indicator lights',
785
-			    'LE' => 'Runway edge lights',
786
-			    'LF' => 'Sequenced flashing lights',
787
-			    'LH' => 'High intensity runway lights',
788
-			    'LI' => 'Runway end identifier lights',
789
-			    'LK' => 'Category II components of approach lighting system',
790
-			    'LL' => 'Low intensity runway lights',
791
-			    'LM' => 'Medium intensity runway lights',
792
-			    'LP' => 'Precision approach path indicator',
793
-			    'LR' => 'All landing area lighting facilities',
794
-			    'LS' => 'Stopway lights',
795
-			    'LT' => 'Threshold lights',
796
-			    'LV' => 'Visual approach slope indicator system',
797
-			    'LW' => 'Heliport lighting',
798
-			    'LX' => 'Taxiway center line lights',
799
-			    'LY' => 'Taxiway edge lights',
800
-			    'LZ' => 'Runway touchdown zone lights');
781
+				'LA' => 'Approach lighting system',
782
+				'LB' => 'Airport beacon',
783
+				'LC' => 'Runway center line lights',
784
+				'LD' => 'Landing direction indicator lights',
785
+				'LE' => 'Runway edge lights',
786
+				'LF' => 'Sequenced flashing lights',
787
+				'LH' => 'High intensity runway lights',
788
+				'LI' => 'Runway end identifier lights',
789
+				'LK' => 'Category II components of approach lighting system',
790
+				'LL' => 'Low intensity runway lights',
791
+				'LM' => 'Medium intensity runway lights',
792
+				'LP' => 'Precision approach path indicator',
793
+				'LR' => 'All landing area lighting facilities',
794
+				'LS' => 'Stopway lights',
795
+				'LT' => 'Threshold lights',
796
+				'LV' => 'Visual approach slope indicator system',
797
+				'LW' => 'Heliport lighting',
798
+				'LX' => 'Taxiway center line lights',
799
+				'LY' => 'Taxiway edge lights',
800
+				'LZ' => 'Runway touchdown zone lights');
801 801
 	public $code_movementareas = array(
802
-			    'MA' => 'Movement area',
803
-			    'MB' => 'Bearing strength',
804
-			    'MC' => 'Clearway',
805
-			    'MD' => 'Declared distances',
806
-			    'MG' => 'Taxiing guidance system',
807
-			    'MH' => 'Runway arresting gear',
808
-			    'MK' => 'Parking area',
809
-			    'MM' => 'Daylight markings',
810
-			    'MN' => 'Apron',
811
-			    'MP' => 'Aircraft stands',
812
-			    'MR' => 'Runway',
813
-			    'MS' => 'Stopway',
814
-			    'MT' => 'Threshold',
815
-			    'MU' => 'Runway turning bay',
816
-			    'MW' => 'Strip',
817
-			    'MX' => 'Taxiway');
802
+				'MA' => 'Movement area',
803
+				'MB' => 'Bearing strength',
804
+				'MC' => 'Clearway',
805
+				'MD' => 'Declared distances',
806
+				'MG' => 'Taxiing guidance system',
807
+				'MH' => 'Runway arresting gear',
808
+				'MK' => 'Parking area',
809
+				'MM' => 'Daylight markings',
810
+				'MN' => 'Apron',
811
+				'MP' => 'Aircraft stands',
812
+				'MR' => 'Runway',
813
+				'MS' => 'Stopway',
814
+				'MT' => 'Threshold',
815
+				'MU' => 'Runway turning bay',
816
+				'MW' => 'Strip',
817
+				'MX' => 'Taxiway');
818 818
 	public $code_terminalfacilities = array(
819
-			    'NA' => 'All radio navigation facilities',
820
-			    'NB' => 'Non directional beacon',
821
-			    'NC' => 'DECCA',
822
-			    'ND' => 'Distance measuring equipment',
823
-			    'NF' => 'Fan marker',
824
-			    'NL' => 'Locator',
825
-			    'NM' => 'VOR/DME',
826
-			    'NN' => 'TACAN',
827
-			    'NO' => 'OMEGA',
828
-			    'NT' => 'VORTAC',
829
-			    'NV' => 'VOR',
830
-			    'NX' => 'Direction finding station');
819
+				'NA' => 'All radio navigation facilities',
820
+				'NB' => 'Non directional beacon',
821
+				'NC' => 'DECCA',
822
+				'ND' => 'Distance measuring equipment',
823
+				'NF' => 'Fan marker',
824
+				'NL' => 'Locator',
825
+				'NM' => 'VOR/DME',
826
+				'NN' => 'TACAN',
827
+				'NO' => 'OMEGA',
828
+				'NT' => 'VORTAC',
829
+				'NV' => 'VOR',
830
+				'NX' => 'Direction finding station');
831 831
 	public $code_information = array(
832
-			    'OA' => 'Aeronautical information service',
833
-			    'OB' => 'Obstacle',
834
-			    'OE' => 'Aircraft entry requirements',
835
-			    'OL' => 'Obstacle lights on',
836
-			    'OR' => 'Rescue coordination centre');
832
+				'OA' => 'Aeronautical information service',
833
+				'OB' => 'Obstacle',
834
+				'OE' => 'Aircraft entry requirements',
835
+				'OL' => 'Obstacle lights on',
836
+				'OR' => 'Rescue coordination centre');
837 837
 	public $code_airtraffic = array(
838
-			    'PA' => 'Standard instrument arrival',
839
-			    'PD' => 'Standard instrument departure',
840
-			    'PF' => 'Flow control procedure',
841
-			    'PH' => 'Holding procedure',
842
-			    'PI' => 'Instrument approach procedure',
843
-			    'PL' => 'Obstacle clearance limit',
844
-			    'PM' => 'Aerodrome operating minima',
845
-			    'PO' => 'Obstacle clearance altitude',
846
-			    'PP' => 'Obstacle clearance height',
847
-			    'PR' => 'Radio failure procedure',
848
-			    'PT' => 'Transition altitude',
849
-			    'PU' => 'Missed approach procedure',
850
-			    'PX' => 'Minimum holding altitude',
851
-			    'PZ' => 'ADIZ procedure');
838
+				'PA' => 'Standard instrument arrival',
839
+				'PD' => 'Standard instrument departure',
840
+				'PF' => 'Flow control procedure',
841
+				'PH' => 'Holding procedure',
842
+				'PI' => 'Instrument approach procedure',
843
+				'PL' => 'Obstacle clearance limit',
844
+				'PM' => 'Aerodrome operating minima',
845
+				'PO' => 'Obstacle clearance altitude',
846
+				'PP' => 'Obstacle clearance height',
847
+				'PR' => 'Radio failure procedure',
848
+				'PT' => 'Transition altitude',
849
+				'PU' => 'Missed approach procedure',
850
+				'PX' => 'Minimum holding altitude',
851
+				'PZ' => 'ADIZ procedure');
852 852
 	public $code_navigationw = array(
853
-			    'RA' => 'Airspace reservation',
854
-			    'RD' => 'Danger area',
855
-			    'RO' => 'Overflying of',
856
-			    'RP' => 'Prohibited area',
857
-			    'RR' => 'Restricted area',
858
-			    'RT' => 'Temporary restricted area');
853
+				'RA' => 'Airspace reservation',
854
+				'RD' => 'Danger area',
855
+				'RO' => 'Overflying of',
856
+				'RP' => 'Prohibited area',
857
+				'RR' => 'Restricted area',
858
+				'RT' => 'Temporary restricted area');
859 859
 	public $code_volmet = array(
860
-			    'SA' => 'Automatic terminal information service',
861
-			    'SB' => 'ATS reporting office',
862
-			    'SC' => 'Area control center',
863
-			    'SE' => 'Flight information service',
864
-			    'SF' => 'Airport flight information service',
865
-			    'SL' => 'Flow control centre',
866
-			    'SO' => 'Oceanic area control centre',
867
-			    'SP' => 'Approach control service',
868
-			    'SS' => 'Flight service station',
869
-			    'ST' => 'Airport control tower',
870
-			    'SU' => 'Upper area control centre',
871
-			    'SV' => 'VOLMET broadcast',
872
-			    'SY' => 'Upper advisory service');
860
+				'SA' => 'Automatic terminal information service',
861
+				'SB' => 'ATS reporting office',
862
+				'SC' => 'Area control center',
863
+				'SE' => 'Flight information service',
864
+				'SF' => 'Airport flight information service',
865
+				'SL' => 'Flow control centre',
866
+				'SO' => 'Oceanic area control centre',
867
+				'SP' => 'Approach control service',
868
+				'SS' => 'Flight service station',
869
+				'ST' => 'Airport control tower',
870
+				'SU' => 'Upper area control centre',
871
+				'SV' => 'VOLMET broadcast',
872
+				'SY' => 'Upper advisory service');
873 873
 	public $code_warnings = array(
874
-			    'WA' => 'Air display',
875
-			    'WB' => 'Aerobatics',
876
-			    'WC' => 'Captive balloon or kite',
877
-			    'WD' => 'Demolition of explosives',
878
-			    'WE' => 'Exercises',
879
-			    'WF' => 'Air refueling',
880
-			    'WG' => 'Glider flying',
881
-			    'WJ' => 'Banner/target towing',
882
-			    'WL' => 'Ascent of free balloon',
883
-			    'WM' => 'Missile, gun or rocket firing',
884
-			    'WP' => 'Parachute jumping exercise',
885
-			    'WS' => 'Burning or blowing gas',
886
-			    'WT' => 'Mass movement of aircraft',
887
-			    'WV' => 'Formation flight',
888
-			    'WZ' => 'model flying');
874
+				'WA' => 'Air display',
875
+				'WB' => 'Aerobatics',
876
+				'WC' => 'Captive balloon or kite',
877
+				'WD' => 'Demolition of explosives',
878
+				'WE' => 'Exercises',
879
+				'WF' => 'Air refueling',
880
+				'WG' => 'Glider flying',
881
+				'WJ' => 'Banner/target towing',
882
+				'WL' => 'Ascent of free balloon',
883
+				'WM' => 'Missile, gun or rocket firing',
884
+				'WP' => 'Parachute jumping exercise',
885
+				'WS' => 'Burning or blowing gas',
886
+				'WT' => 'Mass movement of aircraft',
887
+				'WV' => 'Formation flight',
888
+				'WZ' => 'model flying');
889 889
 	public $code_sp_availabity = array(
890
-			    'AC' => 'Withdrawn for maintenance',
891
-			    'AD' => 'Available for daylight operation',
892
-			    'AF' => 'Flight checked and found reliable',
893
-			    'AG' => 'Operating but ground checked only, awaiting flight check',
894
-			    'AH' => 'Hours of service are now',
895
-			    'AK' => 'Resumed normal operations',
896
-			    'AM' => 'Military operations only',
897
-			    'AN' => 'Available for night operation',
898
-			    'AO' => 'Operational',
899
-			    'AP' => 'Available, prior permission required',
900
-			    'AR' => 'Available on request',
901
-			    'AS' => 'Unserviceable',
902
-			    'AU' => 'Not available',
903
-			    'AW' => 'Completely withdrawn',
904
-			    'AX' => 'Previously promulgated shutdown has been cancelled');
890
+				'AC' => 'Withdrawn for maintenance',
891
+				'AD' => 'Available for daylight operation',
892
+				'AF' => 'Flight checked and found reliable',
893
+				'AG' => 'Operating but ground checked only, awaiting flight check',
894
+				'AH' => 'Hours of service are now',
895
+				'AK' => 'Resumed normal operations',
896
+				'AM' => 'Military operations only',
897
+				'AN' => 'Available for night operation',
898
+				'AO' => 'Operational',
899
+				'AP' => 'Available, prior permission required',
900
+				'AR' => 'Available on request',
901
+				'AS' => 'Unserviceable',
902
+				'AU' => 'Not available',
903
+				'AW' => 'Completely withdrawn',
904
+				'AX' => 'Previously promulgated shutdown has been cancelled');
905 905
 	public $code_sp_changes = array(
906
-			    'CA' => 'Activated',
907
-			    'CC' => 'Completed',
908
-			    'CD' => 'Deactivated',
909
-			    'CE' => 'Erected',
910
-			    'CF' => 'Operating frequency(ies) changed to',
911
-			    'CG' => 'Downgraded to',
912
-			    'CH' => 'Changed',
913
-			    'CI' => 'dentification or radio call sign changed to',
914
-			    'CL' => 'Realigned',
915
-			    'CM' => 'Displaced',
916
-			    'CO' => 'Operating',
917
-			    'CP' => 'Operating on reduced power',
918
-			    'CR' => 'Temporarily replaced by',
919
-			    'CS' => 'Installed',
920
-			    'CT' => 'On test, do not use');
906
+				'CA' => 'Activated',
907
+				'CC' => 'Completed',
908
+				'CD' => 'Deactivated',
909
+				'CE' => 'Erected',
910
+				'CF' => 'Operating frequency(ies) changed to',
911
+				'CG' => 'Downgraded to',
912
+				'CH' => 'Changed',
913
+				'CI' => 'dentification or radio call sign changed to',
914
+				'CL' => 'Realigned',
915
+				'CM' => 'Displaced',
916
+				'CO' => 'Operating',
917
+				'CP' => 'Operating on reduced power',
918
+				'CR' => 'Temporarily replaced by',
919
+				'CS' => 'Installed',
920
+				'CT' => 'On test, do not use');
921 921
 	public $code_sp_hazardous = array(
922
-			    'HA' => 'Braking action is',
923
-			    'HB' => 'Braking coefficient is',
924
-			    'HC' => 'Covered by compacted snow to depth of x Ft',
925
-			    'HD' => 'Covered by dry snow to a depth of x Ft',
926
-			    'HE' => 'Covered by water to a depth of x Ft',
927
-			    'HF' => 'Totally free of snow and ice',
928
-			    'HG' => 'Grass cutting in progress',
929
-			    'HH' => 'Hazard due to',
930
-			    'HI' => 'Covered by ice',
931
-			    'HJ' => 'Launch planned',
932
-			    'HK' => 'Migration in progress',
933
-			    'HL' => 'Snow clearance completed',
934
-			    'HM' => 'Marked by',
935
-			    'HN' => 'Covered by wet snow or slush to a depth of x Ft',
936
-			    'HO' => 'Obscured by snow',
937
-			    'HP' => 'Snow clearance in progress',
938
-			    'HQ' => 'Operation cancelled',
939
-			    'HR' => 'Standing water',
940
-			    'HS' => 'Sanding in progress',
941
-			    'HT' => 'Approach according to signal area only',
942
-			    'HU' => 'Launch in progress',
943
-			    'HV' => 'Work completed',
944
-			    'HW' => 'Work in progress',
945
-			    'HX' => 'Concentration of birds',
946
-			    'HY' => 'Snow banks exist',
947
-			    'HZ' => 'Covered by frozen ruts and ridges');
922
+				'HA' => 'Braking action is',
923
+				'HB' => 'Braking coefficient is',
924
+				'HC' => 'Covered by compacted snow to depth of x Ft',
925
+				'HD' => 'Covered by dry snow to a depth of x Ft',
926
+				'HE' => 'Covered by water to a depth of x Ft',
927
+				'HF' => 'Totally free of snow and ice',
928
+				'HG' => 'Grass cutting in progress',
929
+				'HH' => 'Hazard due to',
930
+				'HI' => 'Covered by ice',
931
+				'HJ' => 'Launch planned',
932
+				'HK' => 'Migration in progress',
933
+				'HL' => 'Snow clearance completed',
934
+				'HM' => 'Marked by',
935
+				'HN' => 'Covered by wet snow or slush to a depth of x Ft',
936
+				'HO' => 'Obscured by snow',
937
+				'HP' => 'Snow clearance in progress',
938
+				'HQ' => 'Operation cancelled',
939
+				'HR' => 'Standing water',
940
+				'HS' => 'Sanding in progress',
941
+				'HT' => 'Approach according to signal area only',
942
+				'HU' => 'Launch in progress',
943
+				'HV' => 'Work completed',
944
+				'HW' => 'Work in progress',
945
+				'HX' => 'Concentration of birds',
946
+				'HY' => 'Snow banks exist',
947
+				'HZ' => 'Covered by frozen ruts and ridges');
948 948
 	public $code_sp_limitations = array(
949
-			    'LA' => 'Operating on Auxiliary Power Supply',
950
-			    'LB' => 'Reserved for aircraft based therein',
951
-			    'LC' => 'Closed',
952
-			    'LD' => 'Unsafe',
953
-			    'LE' => 'Operated without auxiliary power supply',
954
-			    'LF' => 'Interference from',
955
-			    'LG' => 'Operating without identification',
956
-			    'LH' => 'Unserviceable for aircraft heavier than',
957
-			    'LI' => 'Close to IFR operations',
958
-			    'LK' => 'Operating as a fixed light',
959
-			    'LL' => 'Usable for lenght of... and width of...',
960
-			    'LN' => 'Close to all night operations',
961
-			    'LP' => 'Prohibited to',
962
-			    'LR' => 'Aircraft restricted to runways and taxiways',
963
-			    'LS' => 'Subject to interruption',
964
-			    'LT' => 'Limited to',
965
-			    'LV' => 'Close to VFR operations',
966
-			    'LW' => 'Will take place',
967
-			    'LX' => 'Operating but caution advised to'); 
949
+				'LA' => 'Operating on Auxiliary Power Supply',
950
+				'LB' => 'Reserved for aircraft based therein',
951
+				'LC' => 'Closed',
952
+				'LD' => 'Unsafe',
953
+				'LE' => 'Operated without auxiliary power supply',
954
+				'LF' => 'Interference from',
955
+				'LG' => 'Operating without identification',
956
+				'LH' => 'Unserviceable for aircraft heavier than',
957
+				'LI' => 'Close to IFR operations',
958
+				'LK' => 'Operating as a fixed light',
959
+				'LL' => 'Usable for lenght of... and width of...',
960
+				'LN' => 'Close to all night operations',
961
+				'LP' => 'Prohibited to',
962
+				'LR' => 'Aircraft restricted to runways and taxiways',
963
+				'LS' => 'Subject to interruption',
964
+				'LT' => 'Limited to',
965
+				'LV' => 'Close to VFR operations',
966
+				'LW' => 'Will take place',
967
+				'LX' => 'Operating but caution advised to'); 
968 968
 
969 969
 	public function __construct($dbc = null) {
970 970
 		$Connection = new Connection($dbc);
Please login to merge, or discard this patch.
Doc Comments   +14 added lines patch added patch discarded remove patch
@@ -1098,6 +1098,10 @@  discard block
 block discarded – undo
1098 1098
 		else return array();
1099 1099
 	}
1100 1100
 
1101
+	/**
1102
+	 * @param string $type
1103
+	 * @param string $rules
1104
+	 */
1101 1105
 	public function addNOTAM($ref,$title,$type,$fir,$code,$rules,$scope,$lower_limit,$upper_limit,$center_latitude,$center_longitude,$radius,$date_begin,$date_end,$permanent,$text,$full_notam) {
1102 1106
 		$query = "INSERT INTO notam (ref,title,notam_type,fir,code,rules,scope,lower_limit,upper_limit,center_latitude,center_longitude,radius,date_begin,date_end,permanent,notam_text,full_notam) VALUES (:ref,:title,:type,:fir,:code,:rules,:scope,:lower_limit,:upper_limit,:center_latitude,:center_longitude,:radius,:date_begin,:date_end,:permanent,:text,:full_notam)";
1103 1107
 		$query_values = array(':ref' => $ref,':title' => $title,':type' => $type,':fir' => $fir,':code' => $code,':rules' => $rules,':scope' => $scope,':lower_limit' => $lower_limit,':upper_limit' => $upper_limit,':center_latitude' => $center_latitude,':center_longitude' => $center_longitude,':radius' => $radius,':date_begin' => $date_begin,':date_end' => $date_end,':permanent' => $permanent,':text' => $text,':full_notam' => $full_notam);
@@ -1179,6 +1183,10 @@  discard block
 block discarded – undo
1179 1183
 			}
1180 1184
 		}
1181 1185
 	}
1186
+
1187
+	/**
1188
+	 * @param string $filename
1189
+	 */
1182 1190
 	public function updateNOTAMfromTextFile($filename) {
1183 1191
 		$alldata = $this->parseNOTAMtextFile($filename);
1184 1192
 		if (count($alldata) > 0) {
@@ -1223,6 +1231,9 @@  discard block
 block discarded – undo
1223 1231
 		}
1224 1232
 	}
1225 1233
 
1234
+	/**
1235
+	 * @param string $icao
1236
+	 */
1226 1237
 	public function downloadNOTAM($icao) {
1227 1238
 		date_default_timezone_set("UTC");
1228 1239
 		$Common = new Common();
@@ -1359,6 +1370,9 @@  discard block
 block discarded – undo
1359 1370
 		return $result;
1360 1371
 	}
1361 1372
 	
1373
+	/**
1374
+	 * @param string $code
1375
+	 */
1362 1376
 	public function parse_code($code) {
1363 1377
 		$code = str_split($code);
1364 1378
 		$code_fp = $code[1].$code[2];
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -982,19 +982,19 @@  discard block
 block discarded – undo
982 982
 		try {
983 983
 			$sth = $this->db->prepare($query);
984 984
 			$sth->execute($query_values);
985
-		} catch(PDOException $e) {
985
+		} catch (PDOException $e) {
986 986
 			echo "error : ".$e->getMessage();
987 987
 		}
988 988
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
989 989
 		return $all;
990 990
 	}
991 991
 	public function getAllNOTAMtext() {
992
-		$query  = 'SELECT full_notam FROM notam';
992
+		$query = 'SELECT full_notam FROM notam';
993 993
 		$query_values = array();
994 994
 		try {
995 995
 			$sth = $this->db->prepare($query);
996 996
 			$sth->execute($query_values);
997
-		} catch(PDOException $e) {
997
+		} catch (PDOException $e) {
998 998
 			echo "error : ".$e->getMessage();
999 999
 		}
1000 1000
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1003,13 +1003,13 @@  discard block
 block discarded – undo
1003 1003
 	public function createNOTAMtextFile($filename) {
1004 1004
 		$allnotam_result = $this->getAllNOTAMtext();
1005 1005
 		$notamtext = '';
1006
-		foreach($allnotam_result as $notam) {
1006
+		foreach ($allnotam_result as $notam) {
1007 1007
 			$notamtext .= '%%'."\n";
1008 1008
 			$notamtext .= $notam['full_notam'];
1009 1009
 			$notamtext .= "\n".'%%'."\n";
1010 1010
 		}
1011 1011
 		//$allnotam = implode('\n%%%%\n',$allnotam_result);
1012
-		file_put_contents($filename,$notamtext);
1012
+		file_put_contents($filename, $notamtext);
1013 1013
 	}
1014 1014
 	public function parseNOTAMtextFile($filename) {
1015 1015
 		$data = file_get_contents($filename);
@@ -1030,7 +1030,7 @@  discard block
 block discarded – undo
1030 1030
 		try {
1031 1031
 			$sth = $this->db->prepare($query);
1032 1032
 			$sth->execute($query_values);
1033
-		} catch(PDOException $e) {
1033
+		} catch (PDOException $e) {
1034 1034
 			echo "error : ".$e->getMessage();
1035 1035
 		}
1036 1036
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1039,10 +1039,10 @@  discard block
 block discarded – undo
1039 1039
 	public function getAllNOTAMbyCoord($coord) {
1040 1040
 		global $globalDBdriver;
1041 1041
 		if (is_array($coord)) {
1042
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1043
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1044
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1045
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1042
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1043
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1044
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1045
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1046 1046
 		} else return array();
1047 1047
 		if ($globalDBdriver == 'mysql') {
1048 1048
 			$query  = 'SELECT * FROM notam WHERE center_latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND center_longitude BETWEEN '.$minlong.' AND '.$maxlong.' AND radius > 0 AND date_end > UTC_TIMESTAMP() AND date_begin < UTC_TIMESTAMP()';
@@ -1054,19 +1054,19 @@  discard block
 block discarded – undo
1054 1054
 		try {
1055 1055
 			$sth = $this->db->prepare($query);
1056 1056
 			$sth->execute($query_values);
1057
-		} catch(PDOException $e) {
1057
+		} catch (PDOException $e) {
1058 1058
 			echo "error : ".$e->getMessage();
1059 1059
 		}
1060 1060
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1061 1061
 		return $all;
1062 1062
 	}
1063
-	public function getAllNOTAMbyCoordScope($coord,$scope) {
1063
+	public function getAllNOTAMbyCoordScope($coord, $scope) {
1064 1064
 		global $globalDBdriver;
1065 1065
 		if (is_array($coord)) {
1066
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1067
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1068
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1069
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1066
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1067
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1068
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1069
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1070 1070
 		} else return array();
1071 1071
 		if ($globalDBdriver == 'mysql') {
1072 1072
 			$query  = 'SELECT * FROM notam WHERE center_latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND center_longitude BETWEEN '.$minlong.' AND '.$maxlong.' AND radius > 0 AND date_end > UTC_TIMESTAMP() AND date_begin < UTC_TIMESTAMP() AND scope = :scope';
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
 		try {
1079 1079
 			$sth = $this->db->prepare($query);
1080 1080
 			$sth->execute($query_values);
1081
-		} catch(PDOException $e) {
1081
+		} catch (PDOException $e) {
1082 1082
 			echo "error : ".$e->getMessage();
1083 1083
 		}
1084 1084
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
 		try {
1091 1091
 			$sth = $this->db->prepare($query);
1092 1092
 			$sth->execute($query_values);
1093
-		} catch(PDOException $e) {
1093
+		} catch (PDOException $e) {
1094 1094
 			return "error : ".$e->getMessage();
1095 1095
 		}
1096 1096
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1098,13 +1098,13 @@  discard block
 block discarded – undo
1098 1098
 		else return array();
1099 1099
 	}
1100 1100
 
1101
-	public function addNOTAM($ref,$title,$type,$fir,$code,$rules,$scope,$lower_limit,$upper_limit,$center_latitude,$center_longitude,$radius,$date_begin,$date_end,$permanent,$text,$full_notam) {
1101
+	public function addNOTAM($ref, $title, $type, $fir, $code, $rules, $scope, $lower_limit, $upper_limit, $center_latitude, $center_longitude, $radius, $date_begin, $date_end, $permanent, $text, $full_notam) {
1102 1102
 		$query = "INSERT INTO notam (ref,title,notam_type,fir,code,rules,scope,lower_limit,upper_limit,center_latitude,center_longitude,radius,date_begin,date_end,permanent,notam_text,full_notam) VALUES (:ref,:title,:type,:fir,:code,:rules,:scope,:lower_limit,:upper_limit,:center_latitude,:center_longitude,:radius,:date_begin,:date_end,:permanent,:text,:full_notam)";
1103
-		$query_values = array(':ref' => $ref,':title' => $title,':type' => $type,':fir' => $fir,':code' => $code,':rules' => $rules,':scope' => $scope,':lower_limit' => $lower_limit,':upper_limit' => $upper_limit,':center_latitude' => $center_latitude,':center_longitude' => $center_longitude,':radius' => $radius,':date_begin' => $date_begin,':date_end' => $date_end,':permanent' => $permanent,':text' => $text,':full_notam' => $full_notam);
1103
+		$query_values = array(':ref' => $ref, ':title' => $title, ':type' => $type, ':fir' => $fir, ':code' => $code, ':rules' => $rules, ':scope' => $scope, ':lower_limit' => $lower_limit, ':upper_limit' => $upper_limit, ':center_latitude' => $center_latitude, ':center_longitude' => $center_longitude, ':radius' => $radius, ':date_begin' => $date_begin, ':date_end' => $date_end, ':permanent' => $permanent, ':text' => $text, ':full_notam' => $full_notam);
1104 1104
 		try {
1105 1105
 			$sth = $this->db->prepare($query);
1106 1106
 			$sth->execute($query_values);
1107
-		} catch(PDOException $e) {
1107
+		} catch (PDOException $e) {
1108 1108
 			return "error : ".$e->getMessage();
1109 1109
 		}
1110 1110
 	}
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
 		try {
1116 1116
 			$sth = $this->db->prepare($query);
1117 1117
 			$sth->execute($query_values);
1118
-		} catch(PDOException $e) {
1118
+		} catch (PDOException $e) {
1119 1119
 			return "error : ".$e->getMessage();
1120 1120
 		}
1121 1121
 	}
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
 		try {
1131 1131
 			$sth = $this->db->prepare($query);
1132 1132
 			$sth->execute($query_values);
1133
-		} catch(PDOException $e) {
1133
+		} catch (PDOException $e) {
1134 1134
 			return "error : ".$e->getMessage();
1135 1135
 		}
1136 1136
 	}
@@ -1140,7 +1140,7 @@  discard block
 block discarded – undo
1140 1140
 		try {
1141 1141
 			$sth = $this->db->prepare($query);
1142 1142
 			$sth->execute($query_values);
1143
-		} catch(PDOException $e) {
1143
+		} catch (PDOException $e) {
1144 1144
 			return "error : ".$e->getMessage();
1145 1145
 		}
1146 1146
 	}
@@ -1149,7 +1149,7 @@  discard block
 block discarded – undo
1149 1149
 		try {
1150 1150
 			$sth = $this->db->prepare($query);
1151 1151
 			$sth->execute();
1152
-		} catch(PDOException $e) {
1152
+		} catch (PDOException $e) {
1153 1153
 			return "error : ".$e->getMessage();
1154 1154
 		}
1155 1155
 	}
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
 		try {
1159 1159
 			$sth = $this->db->prepare($query);
1160 1160
 			$sth->execute();
1161
-		} catch(PDOException $e) {
1161
+		} catch (PDOException $e) {
1162 1162
 			return "error : ".$e->getMessage();
1163 1163
 		}
1164 1164
 	}
@@ -1166,14 +1166,14 @@  discard block
 block discarded – undo
1166 1166
 	public function updateNOTAM() {
1167 1167
 		global $globalNOTAMAirports;
1168 1168
 		if (isset($globalNOTAMAirports) && is_array($globalNOTAMAirports) && count($globalNOTAMAirports) > 0) {
1169
-			foreach (array_chunk($globalNOTAMAirports,10) as $airport) {
1170
-				$airport_icao = implode(',',$airport);
1169
+			foreach (array_chunk($globalNOTAMAirports, 10) as $airport) {
1170
+				$airport_icao = implode(',', $airport);
1171 1171
 				$alldata = $this->downloadNOTAM($airport_icao);
1172 1172
 				if (count($alldata) > 0) {
1173 1173
 					foreach ($alldata as $initial_data) {
1174 1174
 						$data = $this->parse($initial_data);
1175 1175
 						$notamref = $this->getNOTAMbyRef($data['ref']);
1176
-						if (count($notamref) == 0) $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1176
+						if (count($notamref) == 0) $this->addNOTAM($data['ref'], $data['title'], '', $data['fir'], $data['code'], '', $data['scope'], $data['lower_limit'], $data['upper_limit'], $data['latitude'], $data['longitude'], $data['radius'], $data['date_begin'], $data['date_end'], $data['permanent'], $data['text'], $data['full_notam']);
1177 1177
 					}
1178 1178
 				}
1179 1179
 			}
@@ -1186,7 +1186,7 @@  discard block
 block discarded – undo
1186 1186
 			foreach ($alldata as $initial_data) {
1187 1187
 				$data = $this->parse($initial_data);
1188 1188
 				$notamref = $this->getNOTAMbyRef($data['ref']);
1189
-				if (!isset($notamref['notam_id'])) $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1189
+				if (!isset($notamref['notam_id'])) $this->addNOTAM($data['ref'], $data['title'], '', $data['fir'], $data['code'], '', $data['scope'], $data['lower_limit'], $data['upper_limit'], $data['latitude'], $data['longitude'], $data['radius'], $data['date_begin'], $data['date_end'], $data['permanent'], $data['text'], $data['full_notam']);
1190 1190
 			}
1191 1191
 		}
1192 1192
 	}
@@ -1195,12 +1195,12 @@  discard block
 block discarded – undo
1195 1195
 		global $globalTransaction;
1196 1196
 		$Spotter = new Spotter();
1197 1197
 		$allairports = $Spotter->getAllAirportInfo();
1198
-		foreach (array_chunk($allairports,20) as $airport) {
1198
+		foreach (array_chunk($allairports, 20) as $airport) {
1199 1199
 			$airports_icao = array();
1200
-			foreach($airport as $icao) {
1200
+			foreach ($airport as $icao) {
1201 1201
 				if (isset($icao['icao'])) $airports_icao[] = $icao['icao'];
1202 1202
 			}
1203
-			$airport_icao = implode(',',$airports_icao);
1203
+			$airport_icao = implode(',', $airports_icao);
1204 1204
 			$alldata = $this->downloadNOTAM($airport_icao);
1205 1205
 			if ($globalTransaction) $this->db->beginTransaction();
1206 1206
 			if (count($alldata) > 0) {
@@ -1213,7 +1213,7 @@  discard block
 block discarded – undo
1213 1213
 						if (count($notamref) == 0) {
1214 1214
 							if (isset($data['ref_replaced'])) $this->deleteNOTAMbyRef($data['ref_replaced']);
1215 1215
 							if (isset($data['ref_cancelled'])) $this->deleteNOTAMbyRef($data['ref_cancelled']);
1216
-							elseif (isset($data['latitude']) && isset($data['scope']) && isset($data['text']) && isset($data['permanent'])) echo $this->addNOTAM($data['ref'],'','',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1216
+							elseif (isset($data['latitude']) && isset($data['scope']) && isset($data['text']) && isset($data['permanent'])) echo $this->addNOTAM($data['ref'], '', '', $data['fir'], $data['code'], '', $data['scope'], $data['lower_limit'], $data['upper_limit'], $data['latitude'], $data['longitude'], $data['radius'], $data['date_begin'], $data['date_end'], $data['permanent'], $data['text'], $data['full_notam']);
1217 1217
 						}
1218 1218
 					}
1219 1219
 				}
@@ -1227,7 +1227,7 @@  discard block
 block discarded – undo
1227 1227
 		date_default_timezone_set("UTC");
1228 1228
 		$Common = new Common();
1229 1229
 		//$url = str_replace('{icao}',$icao,'https://pilotweb.nas.faa.gov/PilotWeb/notamRetrievalByICAOAction.do?method=displayByICAOs&reportType=RAW&formatType=DOMESTIC&retrieveLocId={icao}&actionType=notamRetrievalByICAOs');
1230
-		$url = str_replace('{icao}',$icao,'https://pilotweb.nas.faa.gov/PilotWeb/notamRetrievalByICAOAction.do?method=displayByICAOs&reportType=RAW&formatType=ICAO&retrieveLocId={icao}&actionType=notamRetrievalByICAOs');
1230
+		$url = str_replace('{icao}', $icao, 'https://pilotweb.nas.faa.gov/PilotWeb/notamRetrievalByICAOAction.do?method=displayByICAOs&reportType=RAW&formatType=ICAO&retrieveLocId={icao}&actionType=notamRetrievalByICAOs');
1231 1231
 		$data = $Common->getData($url);
1232 1232
 		preg_match_all("/<pre>(.+?)<\/pre>/is", $data, $matches);
1233 1233
 		//print_r($matches);
@@ -1239,14 +1239,14 @@  discard block
 block discarded – undo
1239 1239
 		$Common = new Common();
1240 1240
 		$result = array();
1241 1241
 		$result['full_notam'] = $data;
1242
-		$data = str_ireplace(array("\r","\n",'\r','\n'),' ',$data);
1243
-		$data = preg_split('#(?=([A-Z]\)\s))#',$data);
1242
+		$data = str_ireplace(array("\r", "\n", '\r', '\n'), ' ', $data);
1243
+		$data = preg_split('#(?=([A-Z]\)\s))#', $data);
1244 1244
 		//print_r($data);
1245 1245
 		foreach ($data as $line) {
1246 1246
 			$line = trim($line);
1247
-			if (preg_match('#Q\) (.*)#',$line,$matches)) {
1248
-				$line = str_replace(' ','',$line);
1249
-				if (preg_match('#Q\)([A-Z]{4})\/([A-Z]{5})\/(IV|I|V)\/([A-Z]{1,3})\/([A-Z]{1,2})\/([0-9]{3})\/([0-9]{3})\/([0-9]{4})(N|S)([0-9]{5})(E|W)([0-9]{3})#',$line,$matches)) {
1247
+			if (preg_match('#Q\) (.*)#', $line, $matches)) {
1248
+				$line = str_replace(' ', '', $line);
1249
+				if (preg_match('#Q\)([A-Z]{4})\/([A-Z]{5})\/(IV|I|V)\/([A-Z]{1,3})\/([A-Z]{1,2})\/([0-9]{3})\/([0-9]{3})\/([0-9]{4})(N|S)([0-9]{5})(E|W)([0-9]{3})#', $line, $matches)) {
1250 1250
 				//if (preg_match('#Q\)([A-Z]{4})\/([A-Z]{5})\/(IV|I|V)\/([A-Z]{1,3})\/([A-Z]{1,2})\/([0-9]{3})\/([0-9]{3})\/([0-9]{4})(N|S)([0-9]{5})(E|W)([0-9]{3})#',$line,$matches)) {
1251 1251
 					//print_r($matches);
1252 1252
 					$result['fir'] = $matches[1];
@@ -1292,30 +1292,30 @@  discard block
 block discarded – undo
1292 1292
 					elseif ($matches[5] == 'AW') $result['scope'] = 'Airport/Navigation warning';
1293 1293
 					$result['lower_limit'] = $matches[6];
1294 1294
 					$result['upper_limit'] = $matches[7];
1295
-					$latitude = $Common->convertDec($matches[8],'latitude');
1295
+					$latitude = $Common->convertDec($matches[8], 'latitude');
1296 1296
 					if ($matches[9] == 'S') $latitude = -$latitude;
1297
-					$longitude = $Common->convertDec($matches[10],'longitude');
1297
+					$longitude = $Common->convertDec($matches[10], 'longitude');
1298 1298
 					if ($matches[11] == 'W') $longitude = -$longitude;
1299 1299
 					$result['latitude'] = $latitude;
1300 1300
 					$result['longitude'] = $longitude;
1301 1301
 					$result['radius'] = intval($matches[12]);
1302 1302
 				} else echo 'ERROR : '.$line."\n";
1303 1303
 			}
1304
-			elseif (preg_match('#A\) (.*)#',$line,$matches)) {
1304
+			elseif (preg_match('#A\) (.*)#', $line, $matches)) {
1305 1305
 				$result['icao'] = $matches[1];
1306 1306
 			}
1307
-			elseif (preg_match('#B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#',$line,$matches)) {
1307
+			elseif (preg_match('#B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#', $line, $matches)) {
1308 1308
 				if ($matches[1] > 50) $year = '19'.$matches[1];
1309 1309
 				else $year = '20'.$matches[1];
1310 1310
 				$result['date_begin'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
1311 1311
 			}
1312
-			elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#',$line,$matches)) {
1312
+			elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#', $line, $matches)) {
1313 1313
 				if ($matches[1] > 50) $year = '19'.$matches[1];
1314 1314
 				else $year = '20'.$matches[1];
1315 1315
 				$result['date_end'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
1316 1316
 				$result['permanent'] = 0;
1317 1317
 			}
1318
-			elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#',$line,$matches)) {
1318
+			elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#', $line, $matches)) {
1319 1319
 				if ($matches[1] > 50) $year = '19'.$matches[1];
1320 1320
 				else $year = '20'.$matches[1];
1321 1321
 				$result['date_end'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
@@ -1324,26 +1324,26 @@  discard block
 block discarded – undo
1324 1324
 				if ($matches[6] == 'PERM') $result['permanent'] = 1;
1325 1325
 				else $result['permanent'] = 0;
1326 1326
 			}
1327
-			elseif (preg_match('#C\) (EST|PERM)$#',$line,$matches)) {
1327
+			elseif (preg_match('#C\) (EST|PERM)$#', $line, $matches)) {
1328 1328
 				$result['date_end'] = '2030/12/20 12:00';
1329 1329
 				if ($matches[1] == 'EST') $result['estimated'] = 1;
1330 1330
 				else $result['estimated'] = 0;
1331 1331
 				if ($matches[1] == 'PERM') $result['permanent'] = 1;
1332 1332
 				else $result['permanent'] = 0;
1333 1333
 			}
1334
-			elseif (preg_match('#E\) (.*)#',$line,$matches)) {
1334
+			elseif (preg_match('#E\) (.*)#', $line, $matches)) {
1335 1335
 				$rtext = array();
1336
-				$text = explode(' ',$matches[1]);
1336
+				$text = explode(' ', $matches[1]);
1337 1337
 				foreach ($text as $word) {
1338 1338
 					if (isset($this->abbr[$word])) $rtext[] = strtoupper($this->abbr[$word]);
1339
-					elseif (ctype_digit(strval(substr($word,3))) && isset($this->abbr[substr($word,0,3)])) $rtext[] = strtoupper($this->abbr[substr($word,0,3)]).' '.substr($word,3);
1339
+					elseif (ctype_digit(strval(substr($word, 3))) && isset($this->abbr[substr($word, 0, 3)])) $rtext[] = strtoupper($this->abbr[substr($word, 0, 3)]).' '.substr($word, 3);
1340 1340
 					else $rtext[] = $word;
1341 1341
 				}
1342
-				$result['text'] = implode(' ',$rtext);
1342
+				$result['text'] = implode(' ', $rtext);
1343 1343
 			//} elseif (preg_match('#F\) (.*)#',$line,$matches)) {
1344 1344
 			//} elseif (preg_match('#G\) (.*)#',$line,$matches)) {
1345
-			} elseif (preg_match('#(NOTAMN|NOTAMR|NOTAMC)#',$line,$matches)) {
1346
-				$text = explode(' ',$line);
1345
+			} elseif (preg_match('#(NOTAMN|NOTAMR|NOTAMC)#', $line, $matches)) {
1346
+				$text = explode(' ', $line);
1347 1347
 				$result['ref'] = $text[0];
1348 1348
 				if ($matches[1] == 'NOTAMN') $result['type'] = 'new';
1349 1349
 				if ($matches[1] == 'NOTAMC') {
Please login to merge, or discard this patch.
Braces   +208 added lines, -88 removed lines patch added patch discarded remove patch
@@ -1015,8 +1015,11 @@  discard block
 block discarded – undo
1015 1015
 		$data = file_get_contents($filename);
1016 1016
 		preg_match_all("/%%(.+?)%%/is", $data, $matches);
1017 1017
 		//print_r($matches);
1018
-		if (isset($matches[1])) return $matches[1];
1019
-		else return array();
1018
+		if (isset($matches[1])) {
1019
+			return $matches[1];
1020
+		} else {
1021
+			return array();
1022
+		}
1020 1023
 	}
1021 1024
 	public function getAllNOTAMbyScope($scope) {
1022 1025
 		global $globalDBdriver;
@@ -1043,7 +1046,9 @@  discard block
 block discarded – undo
1043 1046
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1044 1047
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1045 1048
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1046
-		} else return array();
1049
+		} else {
1050
+			return array();
1051
+		}
1047 1052
 		if ($globalDBdriver == 'mysql') {
1048 1053
 			$query  = 'SELECT * FROM notam WHERE center_latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND center_longitude BETWEEN '.$minlong.' AND '.$maxlong.' AND radius > 0 AND date_end > UTC_TIMESTAMP() AND date_begin < UTC_TIMESTAMP()';
1049 1054
 		} else {
@@ -1067,7 +1072,9 @@  discard block
 block discarded – undo
1067 1072
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1068 1073
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1069 1074
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1070
-		} else return array();
1075
+		} else {
1076
+			return array();
1077
+		}
1071 1078
 		if ($globalDBdriver == 'mysql') {
1072 1079
 			$query  = 'SELECT * FROM notam WHERE center_latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND center_longitude BETWEEN '.$minlong.' AND '.$maxlong.' AND radius > 0 AND date_end > UTC_TIMESTAMP() AND date_begin < UTC_TIMESTAMP() AND scope = :scope';
1073 1080
 		} else {
@@ -1094,8 +1101,11 @@  discard block
 block discarded – undo
1094 1101
 			return "error : ".$e->getMessage();
1095 1102
 		}
1096 1103
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1097
-		if (isset($all[0])) return $all[0];
1098
-		else return array();
1104
+		if (isset($all[0])) {
1105
+			return $all[0];
1106
+		} else {
1107
+			return array();
1108
+		}
1099 1109
 	}
1100 1110
 
1101 1111
 	public function addNOTAM($ref,$title,$type,$fir,$code,$rules,$scope,$lower_limit,$upper_limit,$center_latitude,$center_longitude,$radius,$date_begin,$date_end,$permanent,$text,$full_notam) {
@@ -1173,7 +1183,9 @@  discard block
 block discarded – undo
1173 1183
 					foreach ($alldata as $initial_data) {
1174 1184
 						$data = $this->parse($initial_data);
1175 1185
 						$notamref = $this->getNOTAMbyRef($data['ref']);
1176
-						if (count($notamref) == 0) $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1186
+						if (count($notamref) == 0) {
1187
+							$this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1188
+						}
1177 1189
 					}
1178 1190
 				}
1179 1191
 			}
@@ -1186,7 +1198,9 @@  discard block
 block discarded – undo
1186 1198
 			foreach ($alldata as $initial_data) {
1187 1199
 				$data = $this->parse($initial_data);
1188 1200
 				$notamref = $this->getNOTAMbyRef($data['ref']);
1189
-				if (!isset($notamref['notam_id'])) $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1201
+				if (!isset($notamref['notam_id'])) {
1202
+					$this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1203
+				}
1190 1204
 			}
1191 1205
 		}
1192 1206
 	}
@@ -1198,11 +1212,15 @@  discard block
 block discarded – undo
1198 1212
 		foreach (array_chunk($allairports,20) as $airport) {
1199 1213
 			$airports_icao = array();
1200 1214
 			foreach($airport as $icao) {
1201
-				if (isset($icao['icao'])) $airports_icao[] = $icao['icao'];
1215
+				if (isset($icao['icao'])) {
1216
+					$airports_icao[] = $icao['icao'];
1217
+				}
1202 1218
 			}
1203 1219
 			$airport_icao = implode(',',$airports_icao);
1204 1220
 			$alldata = $this->downloadNOTAM($airport_icao);
1205
-			if ($globalTransaction) $this->db->beginTransaction();
1221
+			if ($globalTransaction) {
1222
+				$this->db->beginTransaction();
1223
+			}
1206 1224
 			if (count($alldata) > 0) {
1207 1225
 				foreach ($alldata as $initial_data) {
1208 1226
 					//print_r($initial_data);
@@ -1211,14 +1229,23 @@  discard block
 block discarded – undo
1211 1229
 					if (isset($data['ref'])) {
1212 1230
 						$notamref = $this->getNOTAMbyRef($data['ref']);
1213 1231
 						if (count($notamref) == 0) {
1214
-							if (isset($data['ref_replaced'])) $this->deleteNOTAMbyRef($data['ref_replaced']);
1215
-							if (isset($data['ref_cancelled'])) $this->deleteNOTAMbyRef($data['ref_cancelled']);
1216
-							elseif (isset($data['latitude']) && isset($data['scope']) && isset($data['text']) && isset($data['permanent'])) echo $this->addNOTAM($data['ref'],'','',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1232
+							if (isset($data['ref_replaced'])) {
1233
+								$this->deleteNOTAMbyRef($data['ref_replaced']);
1234
+							}
1235
+							if (isset($data['ref_cancelled'])) {
1236
+								$this->deleteNOTAMbyRef($data['ref_cancelled']);
1237
+							} elseif (isset($data['latitude']) && isset($data['scope']) && isset($data['text']) && isset($data['permanent'])) {
1238
+								echo $this->addNOTAM($data['ref'],'','',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1239
+							}
1217 1240
 						}
1218 1241
 					}
1219 1242
 				}
1220
-			} else echo 'Error on download. Nothing matches for '.$airport_icao."\n";
1221
-			if ($globalTransaction) $this->db->commit();
1243
+			} else {
1244
+				echo 'Error on download. Nothing matches for '.$airport_icao."\n";
1245
+			}
1246
+			if ($globalTransaction) {
1247
+				$this->db->commit();
1248
+			}
1222 1249
 			sleep(5);
1223 1250
 		}
1224 1251
 	}
@@ -1231,8 +1258,11 @@  discard block
 block discarded – undo
1231 1258
 		$data = $Common->getData($url);
1232 1259
 		preg_match_all("/<pre>(.+?)<\/pre>/is", $data, $matches);
1233 1260
 		//print_r($matches);
1234
-		if (isset($matches[1])) return $matches[1];
1235
-		else return array();
1261
+		if (isset($matches[1])) {
1262
+			return $matches[1];
1263
+		} else {
1264
+			return array();
1265
+		}
1236 1266
 	}
1237 1267
 
1238 1268
 	public function parse($data) {
@@ -1255,89 +1285,145 @@  discard block
 block discarded – undo
1255 1285
 					$rules = str_split($matches[3]);
1256 1286
 					foreach ($rules as $rule) {
1257 1287
 						if ($rule == 'I') {
1258
-							if (isset($result['rules'])) $result['rules'] = $result['rules'].'/IFR';
1259
-							else $result['rules'] = 'IFR';
1288
+							if (isset($result['rules'])) {
1289
+								$result['rules'] = $result['rules'].'/IFR';
1290
+							} else {
1291
+								$result['rules'] = 'IFR';
1292
+							}
1260 1293
 						} elseif ($rule == 'V') {
1261
-							if (isset($result['rules'])) $result['rules'] = $result['rules'].'/VFR';
1262
-							else $result['rules'] = 'VFR';
1294
+							if (isset($result['rules'])) {
1295
+								$result['rules'] = $result['rules'].'/VFR';
1296
+							} else {
1297
+								$result['rules'] = 'VFR';
1298
+							}
1263 1299
 						} elseif ($rule == 'K') {
1264
-							if (isset($result['rules'])) $result['rules'] = $result['rules'].'/Checklist';
1265
-							else $result['rules'] = 'Checklist';
1300
+							if (isset($result['rules'])) {
1301
+								$result['rules'] = $result['rules'].'/Checklist';
1302
+							} else {
1303
+								$result['rules'] = 'Checklist';
1304
+							}
1266 1305
 						}
1267 1306
 					}
1268 1307
 					$attentions = str_split($matches[4]);
1269 1308
 					foreach ($attentions as $attention) {
1270 1309
 						if ($attention == 'N') {
1271
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Immediate attention';
1272
-							else $result['rules'] = 'Immediate attention';
1310
+							if (isset($result['attention'])) {
1311
+								$result['attention'] = $result['attention'].' / Immediate attention';
1312
+							} else {
1313
+								$result['rules'] = 'Immediate attention';
1314
+							}
1273 1315
 						} elseif ($attention == 'B') {
1274
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Operational significance';
1275
-							else $result['rules'] = 'Operational significance';
1316
+							if (isset($result['attention'])) {
1317
+								$result['attention'] = $result['attention'].' / Operational significance';
1318
+							} else {
1319
+								$result['rules'] = 'Operational significance';
1320
+							}
1276 1321
 						} elseif ($attention == 'O') {
1277
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Flight operations';
1278
-							else $result['rules'] = 'Flight operations';
1322
+							if (isset($result['attention'])) {
1323
+								$result['attention'] = $result['attention'].' / Flight operations';
1324
+							} else {
1325
+								$result['rules'] = 'Flight operations';
1326
+							}
1279 1327
 						} elseif ($attention == 'M') {
1280
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Misc';
1281
-							else $result['rules'] = 'Misc';
1328
+							if (isset($result['attention'])) {
1329
+								$result['attention'] = $result['attention'].' / Misc';
1330
+							} else {
1331
+								$result['rules'] = 'Misc';
1332
+							}
1282 1333
 						} elseif ($attention == 'K') {
1283
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Checklist';
1284
-							else $result['rules'] = 'Checklist';
1334
+							if (isset($result['attention'])) {
1335
+								$result['attention'] = $result['attention'].' / Checklist';
1336
+							} else {
1337
+								$result['rules'] = 'Checklist';
1338
+							}
1285 1339
 						}
1286 1340
 					}
1287
-					if ($matches[5] == 'A') $result['scope'] = 'Airport warning';
1288
-					elseif ($matches[5] == 'E') $result['scope'] = 'Enroute warning';
1289
-					elseif ($matches[5] == 'W') $result['scope'] = 'Navigation warning';
1290
-					elseif ($matches[5] == 'K') $result['scope'] = 'Checklist';
1291
-					elseif ($matches[5] == 'AE') $result['scope'] = 'Airport/Enroute warning';
1292
-					elseif ($matches[5] == 'AW') $result['scope'] = 'Airport/Navigation warning';
1341
+					if ($matches[5] == 'A') {
1342
+						$result['scope'] = 'Airport warning';
1343
+					} elseif ($matches[5] == 'E') {
1344
+						$result['scope'] = 'Enroute warning';
1345
+					} elseif ($matches[5] == 'W') {
1346
+						$result['scope'] = 'Navigation warning';
1347
+					} elseif ($matches[5] == 'K') {
1348
+						$result['scope'] = 'Checklist';
1349
+					} elseif ($matches[5] == 'AE') {
1350
+						$result['scope'] = 'Airport/Enroute warning';
1351
+					} elseif ($matches[5] == 'AW') {
1352
+						$result['scope'] = 'Airport/Navigation warning';
1353
+					}
1293 1354
 					$result['lower_limit'] = $matches[6];
1294 1355
 					$result['upper_limit'] = $matches[7];
1295 1356
 					$latitude = $Common->convertDec($matches[8],'latitude');
1296
-					if ($matches[9] == 'S') $latitude = -$latitude;
1357
+					if ($matches[9] == 'S') {
1358
+						$latitude = -$latitude;
1359
+					}
1297 1360
 					$longitude = $Common->convertDec($matches[10],'longitude');
1298
-					if ($matches[11] == 'W') $longitude = -$longitude;
1361
+					if ($matches[11] == 'W') {
1362
+						$longitude = -$longitude;
1363
+					}
1299 1364
 					$result['latitude'] = $latitude;
1300 1365
 					$result['longitude'] = $longitude;
1301 1366
 					$result['radius'] = intval($matches[12]);
1302
-				} else echo 'ERROR : '.$line."\n";
1303
-			}
1304
-			elseif (preg_match('#A\) (.*)#',$line,$matches)) {
1367
+				} else {
1368
+					echo 'ERROR : '.$line."\n";
1369
+				}
1370
+			} elseif (preg_match('#A\) (.*)#',$line,$matches)) {
1305 1371
 				$result['icao'] = $matches[1];
1306
-			}
1307
-			elseif (preg_match('#B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#',$line,$matches)) {
1308
-				if ($matches[1] > 50) $year = '19'.$matches[1];
1309
-				else $year = '20'.$matches[1];
1372
+			} elseif (preg_match('#B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#',$line,$matches)) {
1373
+				if ($matches[1] > 50) {
1374
+					$year = '19'.$matches[1];
1375
+				} else {
1376
+					$year = '20'.$matches[1];
1377
+				}
1310 1378
 				$result['date_begin'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
1311
-			}
1312
-			elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#',$line,$matches)) {
1313
-				if ($matches[1] > 50) $year = '19'.$matches[1];
1314
-				else $year = '20'.$matches[1];
1379
+			} elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#',$line,$matches)) {
1380
+				if ($matches[1] > 50) {
1381
+					$year = '19'.$matches[1];
1382
+				} else {
1383
+					$year = '20'.$matches[1];
1384
+				}
1315 1385
 				$result['date_end'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
1316 1386
 				$result['permanent'] = 0;
1317
-			}
1318
-			elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#',$line,$matches)) {
1319
-				if ($matches[1] > 50) $year = '19'.$matches[1];
1320
-				else $year = '20'.$matches[1];
1387
+			} elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#',$line,$matches)) {
1388
+				if ($matches[1] > 50) {
1389
+					$year = '19'.$matches[1];
1390
+				} else {
1391
+					$year = '20'.$matches[1];
1392
+				}
1321 1393
 				$result['date_end'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
1322
-				if ($matches[6] == 'EST') $result['estimated'] = 1;
1323
-				else $result['estimated'] = 0;
1324
-				if ($matches[6] == 'PERM') $result['permanent'] = 1;
1325
-				else $result['permanent'] = 0;
1326
-			}
1327
-			elseif (preg_match('#C\) (EST|PERM)$#',$line,$matches)) {
1394
+				if ($matches[6] == 'EST') {
1395
+					$result['estimated'] = 1;
1396
+				} else {
1397
+					$result['estimated'] = 0;
1398
+				}
1399
+				if ($matches[6] == 'PERM') {
1400
+					$result['permanent'] = 1;
1401
+				} else {
1402
+					$result['permanent'] = 0;
1403
+				}
1404
+			} elseif (preg_match('#C\) (EST|PERM)$#',$line,$matches)) {
1328 1405
 				$result['date_end'] = '2030/12/20 12:00';
1329
-				if ($matches[1] == 'EST') $result['estimated'] = 1;
1330
-				else $result['estimated'] = 0;
1331
-				if ($matches[1] == 'PERM') $result['permanent'] = 1;
1332
-				else $result['permanent'] = 0;
1333
-			}
1334
-			elseif (preg_match('#E\) (.*)#',$line,$matches)) {
1406
+				if ($matches[1] == 'EST') {
1407
+					$result['estimated'] = 1;
1408
+				} else {
1409
+					$result['estimated'] = 0;
1410
+				}
1411
+				if ($matches[1] == 'PERM') {
1412
+					$result['permanent'] = 1;
1413
+				} else {
1414
+					$result['permanent'] = 0;
1415
+				}
1416
+			} elseif (preg_match('#E\) (.*)#',$line,$matches)) {
1335 1417
 				$rtext = array();
1336 1418
 				$text = explode(' ',$matches[1]);
1337 1419
 				foreach ($text as $word) {
1338
-					if (isset($this->abbr[$word])) $rtext[] = strtoupper($this->abbr[$word]);
1339
-					elseif (ctype_digit(strval(substr($word,3))) && isset($this->abbr[substr($word,0,3)])) $rtext[] = strtoupper($this->abbr[substr($word,0,3)]).' '.substr($word,3);
1340
-					else $rtext[] = $word;
1420
+					if (isset($this->abbr[$word])) {
1421
+						$rtext[] = strtoupper($this->abbr[$word]);
1422
+					} elseif (ctype_digit(strval(substr($word,3))) && isset($this->abbr[substr($word,0,3)])) {
1423
+						$rtext[] = strtoupper($this->abbr[substr($word,0,3)]).' '.substr($word,3);
1424
+					} else {
1425
+						$rtext[] = $word;
1426
+					}
1341 1427
 				}
1342 1428
 				$result['text'] = implode(' ',$rtext);
1343 1429
 			//} elseif (preg_match('#F\) (.*)#',$line,$matches)) {
@@ -1345,7 +1431,9 @@  discard block
 block discarded – undo
1345 1431
 			} elseif (preg_match('#(NOTAMN|NOTAMR|NOTAMC)#',$line,$matches)) {
1346 1432
 				$text = explode(' ',$line);
1347 1433
 				$result['ref'] = $text[0];
1348
-				if ($matches[1] == 'NOTAMN') $result['type'] = 'new';
1434
+				if ($matches[1] == 'NOTAMN') {
1435
+					$result['type'] = 'new';
1436
+				}
1349 1437
 				if ($matches[1] == 'NOTAMC') {
1350 1438
 					$result['type'] = 'cancel';
1351 1439
 					$result['ref_cancelled'] = $text[2];
@@ -1367,69 +1455,101 @@  discard block
 block discarded – undo
1367 1455
 		switch ($code[1]) {
1368 1456
 			case 'A':
1369 1457
 				$result = 'Airspace organization ';
1370
-				if (isset($this->code_airspace[$code_fp])) $result .= $this->code_airspace[$code_fp];
1458
+				if (isset($this->code_airspace[$code_fp])) {
1459
+					$result .= $this->code_airspace[$code_fp];
1460
+				}
1371 1461
 				break;
1372 1462
 			case 'C':
1373 1463
 				$result = 'Communications and radar facilities ';
1374
-				if (isset($this->code_comradar[$code_fp])) $result .= $this->code_comradar[$code_fp];
1464
+				if (isset($this->code_comradar[$code_fp])) {
1465
+					$result .= $this->code_comradar[$code_fp];
1466
+				}
1375 1467
 				break;
1376 1468
 			case 'F':
1377 1469
 				$result = 'Facilities and services ';
1378
-				if (isset($this->code_facilities[$code_fp])) $result .= $this->code_facilities[$code_fp];
1470
+				if (isset($this->code_facilities[$code_fp])) {
1471
+					$result .= $this->code_facilities[$code_fp];
1472
+				}
1379 1473
 				break;
1380 1474
 			case 'I':
1381 1475
 				$result = 'Instrument and Microwave Landing System ';
1382
-				if (isset($this->code_instrumentlanding[$code_fp])) $result .= $this->code_instrumentlanding[$code_fp];
1476
+				if (isset($this->code_instrumentlanding[$code_fp])) {
1477
+					$result .= $this->code_instrumentlanding[$code_fp];
1478
+				}
1383 1479
 				break;
1384 1480
 			case 'L':
1385 1481
 				$result = 'Lighting facilities ';
1386
-				if (isset($this->code_lightingfacilities[$code_fp])) $result .= $this->code_lightingfacilities[$code_fp];
1482
+				if (isset($this->code_lightingfacilities[$code_fp])) {
1483
+					$result .= $this->code_lightingfacilities[$code_fp];
1484
+				}
1387 1485
 				break;
1388 1486
 			case 'M':
1389 1487
 				$result = 'Movement and landing areas ';
1390
-				if (isset($this->code_movementareas[$code_fp])) $result .= $this->code_movementareas[$code_fp];
1488
+				if (isset($this->code_movementareas[$code_fp])) {
1489
+					$result .= $this->code_movementareas[$code_fp];
1490
+				}
1391 1491
 				break;
1392 1492
 			case 'N':
1393 1493
 				$result = 'Terminal and En Route Navigation Facilities ';
1394
-				if (isset($this->code_terminalfacilities[$code_fp])) $result .= $this->code_terminalfacilities[$code_fp];
1494
+				if (isset($this->code_terminalfacilities[$code_fp])) {
1495
+					$result .= $this->code_terminalfacilities[$code_fp];
1496
+				}
1395 1497
 				break;
1396 1498
 			case 'O':
1397 1499
 				$result = 'Other information ';
1398
-				if (isset($this->code_information[$code_fp])) $result .= $this->code_information[$code_fp];
1500
+				if (isset($this->code_information[$code_fp])) {
1501
+					$result .= $this->code_information[$code_fp];
1502
+				}
1399 1503
 				break;
1400 1504
 			case 'P':
1401 1505
 				$result = 'Air Traffic procedures ';
1402
-				if (isset($this->code_airtraffic[$code_fp])) $result .= $this->code_airtraffic[$code_fp];
1506
+				if (isset($this->code_airtraffic[$code_fp])) {
1507
+					$result .= $this->code_airtraffic[$code_fp];
1508
+				}
1403 1509
 				break;
1404 1510
 			case 'R':
1405 1511
 				$result = 'Navigation Warnings: Airspace Restrictions ';
1406
-				if (isset($this->code_navigationw[$code_fp])) $result .= $this->code_navigationw[$code_fp];
1512
+				if (isset($this->code_navigationw[$code_fp])) {
1513
+					$result .= $this->code_navigationw[$code_fp];
1514
+				}
1407 1515
 				break;
1408 1516
 			case 'S':
1409 1517
 				$result = 'Air Traffic and VOLMET Services ';
1410
-				if (isset($this->code_volmet[$code_fp])) $result .= $this->code_volmet[$code_fp];
1518
+				if (isset($this->code_volmet[$code_fp])) {
1519
+					$result .= $this->code_volmet[$code_fp];
1520
+				}
1411 1521
 				break;
1412 1522
 			case 'W':
1413 1523
 				$result = 'Navigation Warnings: Warnings ';
1414
-				if (isset($this->code_warnings[$code_fp])) $result .= $this->code_warnings[$code_fp];
1524
+				if (isset($this->code_warnings[$code_fp])) {
1525
+					$result .= $this->code_warnings[$code_fp];
1526
+				}
1415 1527
 				break;
1416 1528
 		}
1417 1529
 		switch ($code[3]) {
1418 1530
 			case 'A':
1419 1531
 				// Availability
1420
-				if (isset($this->code_sp_availabity[$code_sp])) $result .= ' '.$this->code_sp_availabity[$code_sp];
1532
+				if (isset($this->code_sp_availabity[$code_sp])) {
1533
+					$result .= ' '.$this->code_sp_availabity[$code_sp];
1534
+				}
1421 1535
 				break;
1422 1536
 			case 'C':
1423 1537
 				// Changes
1424
-				if (isset($this->code_sp_changes[$code_sp])) $result .= ' '.$this->code_sp_changes[$code_sp];
1538
+				if (isset($this->code_sp_changes[$code_sp])) {
1539
+					$result .= ' '.$this->code_sp_changes[$code_sp];
1540
+				}
1425 1541
 				break;
1426 1542
 			case 'H':
1427 1543
 				// Hazardous conditions
1428
-				if (isset($this->code_sp_hazardous[$code_sp])) $result .= ' '.$this->code_sp_hazardous[$code_sp];
1544
+				if (isset($this->code_sp_hazardous[$code_sp])) {
1545
+					$result .= ' '.$this->code_sp_hazardous[$code_sp];
1546
+				}
1429 1547
 				break;
1430 1548
 			case 'L':
1431 1549
 				// Limitations
1432
-				if (isset($this->code_sp_limitations[$code_sp])) $result .= ' '.$this->code_sp_limitations[$code_sp];
1550
+				if (isset($this->code_sp_limitations[$code_sp])) {
1551
+					$result .= ' '.$this->code_sp_limitations[$code_sp];
1552
+				}
1433 1553
 				break;
1434 1554
 			case 'X':
1435 1555
 				// Other Information
Please login to merge, or discard this patch.
waypoints-geojson.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 		date_default_timezone_set('UTC');
27 27
 		//waypoint plotting
28 28
 		$output .= '{"type": "Feature",';
29
-		    $output .= '"properties": {';
29
+			$output .= '"properties": {';
30 30
 			$output .= '"segment_name": "'.$spotter_item['segment_name'].'",';
31 31
 			$output .= '"base": "'.$spotter_item['base'].'",';
32 32
 			$output .= '"top": "'.$spotter_item['top'].'",';
@@ -49,15 +49,15 @@  discard block
 block discarded – undo
49 49
 				$output .= '"stroke": "#f0f0f0",';
50 50
 				$output .= '"stroke-width": 2';
51 51
 //			}
52
-		    $output .= '},';
53
-		    $output .= '"geometry": {';
52
+			$output .= '},';
53
+			$output .= '"geometry": {';
54 54
 			$output .= '"type": "LineString",';
55 55
 			$output .= '"coordinates": [';
56
-			    //$output .= '['.$spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].'], ['.$spotter_item['longitude_end'].', '.$spotter_item['latitude_end'].'], ['.$spotter_item['longitude_end_seg2'].', '.$spotter_item['latitude_end_seg2'].']';
57
-			    $output .= '['.$spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].','.round($spotter_item['base']*100*0.3048).'], ['.$spotter_item['longitude_end'].', '.$spotter_item['latitude_end'].','.round($spotter_item['base']*100*0.3048).']';
56
+				//$output .= '['.$spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].'], ['.$spotter_item['longitude_end'].', '.$spotter_item['latitude_end'].'], ['.$spotter_item['longitude_end_seg2'].', '.$spotter_item['latitude_end_seg2'].']';
57
+				$output .= '['.$spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].','.round($spotter_item['base']*100*0.3048).'], ['.$spotter_item['longitude_end'].', '.$spotter_item['latitude_end'].','.round($spotter_item['base']*100*0.3048).']';
58 58
 			//    $output .= '['.$spotter_item['latitude_begin'].', '.$spotter_item['longitude_begin'].'], ['.$spotter_item['latitude_end'].', '.$spotter_item['longitude_end'].']';
59 59
 			$output .= ']';
60
-		    $output .= '}';
60
+			$output .= '}';
61 61
 /*		    $output .= '"geometry": {';
62 62
 			$output .= '"type": "Point",';
63 63
 			$output .= '"coordinates": [';
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 		$output .= '},';
69 69
 		//waypoint plotting
70 70
 		$output .= '{"type": "Feature",';
71
-		    $output .= '"properties": {';
71
+			$output .= '"properties": {';
72 72
 			$output .= '"ident": "'.$spotter_item['name_begin'].'",';
73 73
 			$output .= '"high": "'.$spotter_item['high'].'",';
74 74
 			$output .= '"alt": "'.$spotter_item['base'].'",';
@@ -98,17 +98,17 @@  discard block
 block discarded – undo
98 98
 				$output .= '"marker-size": "small",';
99 99
 				$output .= '"marker-color": "#0000ff"';
100 100
 			}
101
-		    $output .= '},';
102
-		    $output .= '"geometry": {';
101
+			$output .= '},';
102
+			$output .= '"geometry": {';
103 103
 			$output .= '"type": "Point",';
104 104
 			$output .= '"coordinates": [';
105
-			    $output .= $spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].', '.round($spotter_item['base']*100*0.3048);;
105
+				$output .= $spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].', '.round($spotter_item['base']*100*0.3048);;
106 106
 			$output .= ']';
107
-		    $output .= '}';
107
+			$output .= '}';
108 108
 
109 109
 		$output .= '},';
110 110
 		$output .= '{"type": "Feature",';
111
-		    $output .= '"properties": {';
111
+			$output .= '"properties": {';
112 112
 			$output .= '"ident": "'.$spotter_item['name_end'].'",';
113 113
 			$output .= '"high": "'.$spotter_item['high'].'",';
114 114
 			$output .= '"alt": "'.$spotter_item['top'].'",';
@@ -145,13 +145,13 @@  discard block
 block discarded – undo
145 145
 				$output .= '"marker-size": "small",';
146 146
 				$output .= '"marker-color": "#0000ff"';
147 147
 			}
148
-		    $output .= '},';
149
-		    $output .= '"geometry": {';
148
+			$output .= '},';
149
+			$output .= '"geometry": {';
150 150
 			$output .= '"type": "Point",';
151 151
 			$output .= '"coordinates": [';
152
-			    $output .= $spotter_item['longitude_end'].', '.$spotter_item['latitude_end'].', '.round($spotter_item['base']*100*0.3048);
152
+				$output .= $spotter_item['longitude_end'].', '.$spotter_item['latitude_end'].', '.round($spotter_item['base']*100*0.3048);
153 153
 			$output .= ']';
154
-		    $output .= '}';
154
+			$output .= '}';
155 155
 
156 156
 		$output .= '},';
157 157
 	}
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 
11 11
 if (isset($_GET['coord'])) 
12 12
 {
13
-	$coords = explode(',',$_GET['coord']);
13
+	$coords = explode(',', $_GET['coord']);
14 14
 	$spotter_array = $Spotter->getAllWaypointsInfobyCoord($coords);
15 15
 } else {
16 16
 	die;
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 if (!empty($spotter_array))
22 22
 {	  
23 23
 //	print_r($spotter_array);
24
-	foreach($spotter_array as $spotter_item)
24
+	foreach ($spotter_array as $spotter_item)
25 25
 	{
26 26
 		date_default_timezone_set('UTC');
27 27
 		//waypoint plotting
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 		    $output .= '"geometry": {';
103 103
 			$output .= '"type": "Point",';
104 104
 			$output .= '"coordinates": [';
105
-			    $output .= $spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].', '.round($spotter_item['base']*100*0.3048);;
105
+			    $output .= $spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].', '.round($spotter_item['base']*100*0.3048); ;
106 106
 			$output .= ']';
107 107
 		    $output .= '}';
108 108
 
Please login to merge, or discard this patch.
airspace-data.php 2 patches
Spacing   +3 added lines, -3 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
-$airspaceid = filter_input(INPUT_GET,'airspace',FILTER_SANITIZE_NUMBER_INT);
10
+$airspaceid = filter_input(INPUT_GET, 'airspace', FILTER_SANITIZE_NUMBER_INT);
11 11
 //$notamref = urldecode($notamref);
12 12
 if ($globalDBdriver == 'mysql') {
13 13
 	$query = "SELECT * FROM airspace WHERE ogr_fid = :id";
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 try {
19 19
 	$sth = $Connection->db->prepare($query);
20 20
 	$sth->execute(array(':id' => $airspaceid));
21
-} catch(PDOException $e) {
21
+} catch (PDOException $e) {
22 22
 	echo "error";
23 23
 }
24
-$result=$sth->fetchAll(PDO::FETCH_ASSOC);
24
+$result = $sth->fetchAll(PDO::FETCH_ASSOC);
25 25
 $airspace = $result[0];
26 26
 date_default_timezone_set('UTC');
27 27
 print '<div class="top">';
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,7 +25,9 @@  discard block
 block discarded – undo
25 25
 $airspace = $result[0];
26 26
 date_default_timezone_set('UTC');
27 27
 print '<div class="top">';
28
-if (isset($airspace['name'])) $airspace['title'] = $airspace['name']; 
28
+if (isset($airspace['name'])) {
29
+	$airspace['title'] = $airspace['name'];
30
+}
29 31
 print '<div class="right"><div class="callsign-details"><div class="callsign">'.$airspace['title'].'</a></div>';
30 32
 print '</div>';
31 33
 print '<div class="details">';
@@ -44,13 +46,17 @@  discard block
 block discarded – undo
44 46
 	print '</div>';
45 47
 }
46 48
 
47
-if (isset($airspace['ceiling'])) $airspace['tops'] = $airspace['ceiling'];
49
+if (isset($airspace['ceiling'])) {
50
+	$airspace['tops'] = $airspace['ceiling'];
51
+}
48 52
 print '<div>';
49 53
 print '<span>'._("Tops").'</span>';
50 54
 print $airspace['tops'];
51 55
 print '</div>';
52 56
 
53
-if (isset($airspace['floor'])) $airspace['base'] = $airspace['floor'];
57
+if (isset($airspace['floor'])) {
58
+	$airspace['base'] = $airspace['floor'];
59
+}
54 60
 print '<div>';
55 61
 print '<span>'._("Base").'</span>';
56 62
 print $airspace['base'];
Please login to merge, or discard this patch.
scripts/update_db.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
10 10
 	exec("ps ux", $output, $result);
11 11
 	$j = 0;
12
-	foreach ($output as $line) if(strpos($line, "update_db.php") && !strpos($line, "sh ")) $j++;
12
+	foreach ($output as $line) if (strpos($line, "update_db.php") && !strpos($line, "sh ")) $j++;
13 13
 	if ($j > 1) {
14 14
 		echo "Script is already runnning...";
15 15
 		die();
Please login to merge, or discard this patch.
Braces   +20 added lines, -8 removed lines patch added patch discarded remove patch
@@ -9,7 +9,9 @@  discard block
 block discarded – undo
9 9
 if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
10 10
 	exec("ps ux", $output, $result);
11 11
 	$j = 0;
12
-	foreach ($output as $line) if(strpos($line, "update_db.php") && !strpos($line, "sh ")) $j++;
12
+	foreach ($output as $line) {
13
+		if(strpos($line, "update_db.php") && !strpos($line, "sh ")) $j++;
14
+	}
13 15
 	if ($j > 1) {
14 16
 		echo "Script is already runnning...";
15 17
 		die();
@@ -29,15 +31,19 @@  discard block
 block discarded – undo
29 31
 			$update_db->update_notam();
30 32
 		}
31 33
 		$update_db->insert_last_notam_update();
32
-	} elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) echo "NOTAM are only updated once a day.\n";
34
+	} elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) {
35
+		echo "NOTAM are only updated once a day.\n";
36
+	}
33 37
 	if ($update_db->check_last_update() && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
34 38
 		$update_db->update_all();
35 39
 	//	require_once(dirname(__FILE__).'/../require/class.Spotter.php');
36 40
 	//	$Spotter = new Spotter();
37 41
 	//	$Spotter->updateFieldsFromOtherTables();
38 42
 		$update_db->insert_last_update();
39
-	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM)) echo "DB are populated with external data only every 15 days ! Files are not updated more often.\n";
40
-}
43
+	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM)) {
44
+		echo "DB are populated with external data only every 15 days ! Files are not updated more often.\n";
45
+	}
46
+	}
41 47
 if (isset($globalWaypoints) && $globalWaypoints && $update_db->check_last_airspace_update()) {
42 48
 	echo "Check if new airspace version exist...";
43 49
 	echo $update_db->update_airspace_fam();
@@ -52,22 +58,28 @@  discard block
 block discarded – undo
52 58
 	if ($METAR->check_last_update()) {
53 59
 		$METAR->addMETARCycle();
54 60
 		$METAR->insert_last_update();
55
-	} else echo "METAR are only updated every 30 minutes.\n";
56
-}
61
+	} else {
62
+		echo "METAR are only updated every 30 minutes.\n";
63
+	}
64
+	}
57 65
 
58 66
 
59 67
 if (isset($globalOwner) && $globalOwner && $update_db->check_last_owner_update() && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
60 68
 	echo "Updating private aircraft's owners...\n";
61 69
 	$update_db->update_owner();
62 70
 	$update_db->insert_last_owner_update();
63
-} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Owner are only updated every 15 days.\n";
71
+} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
72
+	echo "Owner are only updated every 15 days.\n";
73
+}
64 74
 
65 75
 if (isset($globalSchedules) && $globalSchedules && $update_db->check_last_schedules_update() && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
66 76
 	echo "Updating schedules...";
67 77
 	//$update_db->update_oneworld();
68 78
 	$update_db->update_skyteam();
69 79
 	$update_db->insert_last_schedules_update();
70
-} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Schedules are only updated every 15 days.\n";
80
+} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
81
+	echo "Schedules are only updated every 15 days.\n";
82
+}
71 83
 
72 84
 if (isset($globalArchiveMonths) && $globalArchiveMonths > 0) {
73 85
 	echo "Updating statistics and archive old data...";
Please login to merge, or discard this patch.