Completed
Push — master ( 3afeea...5bdcfd )
by Yannick
06:37
created
require/class.Spotter.php 2 patches
Indentation   +1454 added lines, -1454 removed lines patch added patch discarded remove patch
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 	}
56 56
 
57 57
 	/**
58
-	* Get SQL query part for filter used
59
-	* @param Array $filter the filter
60
-	* @return Array the SQL part
61
-	*/
58
+	 * Get SQL query part for filter used
59
+	 * @param Array $filter the filter
60
+	 * @return Array the SQL part
61
+	 */
62 62
 	public function getFilter($filter = array(),$where = false,$and = false) {
63 63
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
64 64
 		$filters = array();
@@ -166,14 +166,14 @@  discard block
 block discarded – undo
166 166
 	}
167 167
 
168 168
 	/**
169
-	* Executes the SQL statements to get the spotter information
170
-	*
171
-	* @param String $query the SQL query
172
-	* @param Array $params parameter of the query
173
-	* @param String $limitQuery the limit query
174
-	* @return Array the spotter information
175
-	*
176
-	*/
169
+	 * Executes the SQL statements to get the spotter information
170
+	 *
171
+	 * @param String $query the SQL query
172
+	 * @param Array $params parameter of the query
173
+	 * @param String $limitQuery the limit query
174
+	 * @return Array the spotter information
175
+	 *
176
+	 */
177 177
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
178 178
 	{
179 179
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
@@ -342,11 +342,11 @@  discard block
 block discarded – undo
342 342
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
343 343
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
344 344
 					} else $temp_array['aircraft_shadow'] = 'default.png';
345
-                                } else {
346
-                            		$temp_array['aircraft_shadow'] = 'default.png';
345
+								} else {
346
+									$temp_array['aircraft_shadow'] = 'default.png';
347 347
 					$temp_array['aircraft_name'] = 'N/A';
348 348
 					$temp_array['aircraft_manufacturer'] = 'N/A';
349
-                            	}
349
+								}
350 350
 			}
351 351
 			$fromsource = NULL;
352 352
 			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
@@ -543,11 +543,11 @@  discard block
 block discarded – undo
543 543
 	
544 544
 	
545 545
 	/**
546
-	* Gets all the spotter information
547
-	*
548
-	* @return Array the spotter information
549
-	*
550
-	*/
546
+	 * Gets all the spotter information
547
+	 *
548
+	 * @return Array the spotter information
549
+	 *
550
+	 */
551 551
 	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())
552 552
 	{
553 553
 		global $globalTimezone, $globalDBdriver;
@@ -894,11 +894,11 @@  discard block
 block discarded – undo
894 894
 	
895 895
 	
896 896
 	/**
897
-	* Gets all the spotter information based on the latest data entry
898
-	*
899
-	* @return Array the spotter information
900
-	*
901
-	*/
897
+	 * Gets all the spotter information based on the latest data entry
898
+	 *
899
+	 * @return Array the spotter information
900
+	 *
901
+	 */
902 902
 	public function getLatestSpotterData($limit = '', $sort = '', $filter = array())
903 903
 	{
904 904
 		global $global_query;
@@ -937,12 +937,12 @@  discard block
 block discarded – undo
937 937
 	}
938 938
     
939 939
     
940
-    /**
941
-	* Gets all the spotter information based on a user's latitude and longitude
942
-	*
943
-	* @return Array the spotter information
944
-	*
945
-	*/
940
+	/**
941
+	 * Gets all the spotter information based on a user's latitude and longitude
942
+	 *
943
+	 * @return Array the spotter information
944
+	 *
945
+	 */
946 946
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
947 947
 	{
948 948
 		date_default_timezone_set('UTC');
@@ -970,7 +970,7 @@  discard block
 block discarded – undo
970 970
 				return false;
971 971
 			}
972 972
 		}
973
-    		$additional_query = '';
973
+			$additional_query = '';
974 974
 		if ($interval != "")
975 975
 		{
976 976
 			if (!is_string($interval))
@@ -1010,12 +1010,12 @@  discard block
 block discarded – undo
1010 1010
 	}
1011 1011
     
1012 1012
     
1013
-    /**
1014
-	* Gets all the spotter information sorted by the newest aircraft type
1015
-	*
1016
-	* @return Array the spotter information
1017
-	*
1018
-	*/
1013
+	/**
1014
+	 * Gets all the spotter information sorted by the newest aircraft type
1015
+	 *
1016
+	 * @return Array the spotter information
1017
+	 *
1018
+	 */
1019 1019
 	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
1020 1020
 	{
1021 1021
 		global $global_query;
@@ -1056,11 +1056,11 @@  discard block
 block discarded – undo
1056 1056
     
1057 1057
     
1058 1058
 	/**
1059
-	* Gets all the spotter information sorted by the newest aircraft registration
1060
-	*
1061
-	* @return Array the spotter information
1062
-	*
1063
-	*/
1059
+	 * Gets all the spotter information sorted by the newest aircraft registration
1060
+	 *
1061
+	 * @return Array the spotter information
1062
+	 *
1063
+	 */
1064 1064
 	public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array())
1065 1065
 	{
1066 1066
 		global $global_query;
@@ -1100,11 +1100,11 @@  discard block
 block discarded – undo
1100 1100
 
1101 1101
 
1102 1102
 	/**
1103
-	* Gets all the spotter information sorted by the newest airline
1104
-	*
1105
-	* @return Array the spotter information
1106
-	*
1107
-	*/
1103
+	 * Gets all the spotter information sorted by the newest airline
1104
+	 *
1105
+	 * @return Array the spotter information
1106
+	 *
1107
+	 */
1108 1108
 	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1109 1109
 	{
1110 1110
 		global $global_query;
@@ -1143,12 +1143,12 @@  discard block
 block discarded – undo
1143 1143
 	}
1144 1144
     
1145 1145
     
1146
-    /**
1147
-	* Gets all the spotter information sorted by the newest departure airport
1148
-	*
1149
-	* @return Array the spotter information
1150
-	*
1151
-	*/
1146
+	/**
1147
+	 * Gets all the spotter information sorted by the newest departure airport
1148
+	 *
1149
+	 * @return Array the spotter information
1150
+	 *
1151
+	 */
1152 1152
 	public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array())
1153 1153
 	{
1154 1154
 		global $global_query;
@@ -1190,11 +1190,11 @@  discard block
 block discarded – undo
1190 1190
 
1191 1191
 
1192 1192
 	/**
1193
-	* Gets all the spotter information sorted by the newest arrival airport
1194
-	*
1195
-	* @return Array the spotter information
1196
-	*
1197
-	*/
1193
+	 * Gets all the spotter information sorted by the newest arrival airport
1194
+	 *
1195
+	 * @return Array the spotter information
1196
+	 *
1197
+	 */
1198 1198
 	public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array())
1199 1199
 	{
1200 1200
 		global $global_query;
@@ -1233,11 +1233,11 @@  discard block
 block discarded – undo
1233 1233
 	
1234 1234
 
1235 1235
 	/**
1236
-	* Gets all the spotter information based on the spotter id
1237
-	*
1238
-	* @return Array the spotter information
1239
-	*
1240
-	*/
1236
+	 * Gets all the spotter information based on the spotter id
1237
+	 *
1238
+	 * @return Array the spotter information
1239
+	 *
1240
+	 */
1241 1241
 	public function getSpotterDataByID($id = '')
1242 1242
 	{
1243 1243
 		global $global_query;
@@ -1259,11 +1259,11 @@  discard block
 block discarded – undo
1259 1259
 	
1260 1260
 	
1261 1261
 	/**
1262
-	* Gets all the spotter information based on the callsign
1263
-	*
1264
-	* @return Array the spotter information
1265
-	*
1266
-	*/
1262
+	 * Gets all the spotter information based on the callsign
1263
+	 *
1264
+	 * @return Array the spotter information
1265
+	 *
1266
+	 */
1267 1267
 	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '', $filter = array())
1268 1268
 	{
1269 1269
 		global $global_query;
@@ -1315,11 +1315,11 @@  discard block
 block discarded – undo
1315 1315
 	}
1316 1316
 	
1317 1317
 	/**
1318
-	* Gets all the spotter information based on the owner
1319
-	*
1320
-	* @return Array the spotter information
1321
-	*
1322
-	*/
1318
+	 * Gets all the spotter information based on the owner
1319
+	 *
1320
+	 * @return Array the spotter information
1321
+	 *
1322
+	 */
1323 1323
 	public function getSpotterDataByOwner($owner = '', $limit = '', $sort = '', $filter = array())
1324 1324
 	{
1325 1325
 		global $global_query;
@@ -1372,11 +1372,11 @@  discard block
 block discarded – undo
1372 1372
 	}
1373 1373
 	
1374 1374
 	/**
1375
-	* Gets all the spotter information based on the pilot
1376
-	*
1377
-	* @return Array the spotter information
1378
-	*
1379
-	*/
1375
+	 * Gets all the spotter information based on the pilot
1376
+	 *
1377
+	 * @return Array the spotter information
1378
+	 *
1379
+	 */
1380 1380
 	public function getSpotterDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array())
1381 1381
 	{
1382 1382
 		global $global_query;
@@ -1425,11 +1425,11 @@  discard block
 block discarded – undo
1425 1425
 	
1426 1426
 	
1427 1427
 	/**
1428
-	* Gets all the spotter information based on the aircraft type
1429
-	*
1430
-	* @return Array the spotter information
1431
-	*
1432
-	*/
1428
+	 * Gets all the spotter information based on the aircraft type
1429
+	 *
1430
+	 * @return Array the spotter information
1431
+	 *
1432
+	 */
1433 1433
 	public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array())
1434 1434
 	{
1435 1435
 		global $global_query;
@@ -1483,11 +1483,11 @@  discard block
 block discarded – undo
1483 1483
 	
1484 1484
 	
1485 1485
 	/**
1486
-	* Gets all the spotter information based on the aircraft registration
1487
-	*
1488
-	* @return Array the spotter information
1489
-	*
1490
-	*/
1486
+	 * Gets all the spotter information based on the aircraft registration
1487
+	 *
1488
+	 * @return Array the spotter information
1489
+	 *
1490
+	 */
1491 1491
 	public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array())
1492 1492
 	{
1493 1493
 		global $global_query;
@@ -1544,11 +1544,11 @@  discard block
 block discarded – undo
1544 1544
 	
1545 1545
 	
1546 1546
 	/**
1547
-	* Gets all the spotter information based on the airline
1548
-	*
1549
-	* @return Array the spotter information
1550
-	*
1551
-	*/
1547
+	 * Gets all the spotter information based on the airline
1548
+	 *
1549
+	 * @return Array the spotter information
1550
+	 *
1551
+	 */
1552 1552
 	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1553 1553
 	{
1554 1554
 		global $global_query;
@@ -1601,11 +1601,11 @@  discard block
 block discarded – undo
1601 1601
 	
1602 1602
 	
1603 1603
 	/**
1604
-	* Gets all the spotter information based on the airport
1605
-	*
1606
-	* @return Array the spotter information
1607
-	*
1608
-	*/
1604
+	 * Gets all the spotter information based on the airport
1605
+	 *
1606
+	 * @return Array the spotter information
1607
+	 *
1608
+	 */
1609 1609
 	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1610 1610
 	{
1611 1611
 		global $global_query;
@@ -1659,11 +1659,11 @@  discard block
 block discarded – undo
1659 1659
 
1660 1660
 
1661 1661
 	/**
1662
-	* Gets all the spotter information based on the date
1663
-	*
1664
-	* @return Array the spotter information
1665
-	*
1666
-	*/
1662
+	 * Gets all the spotter information based on the date
1663
+	 *
1664
+	 * @return Array the spotter information
1665
+	 *
1666
+	 */
1667 1667
 	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1668 1668
 	{
1669 1669
 		global $global_query, $globalTimezone, $globalDBdriver;
@@ -1727,11 +1727,11 @@  discard block
 block discarded – undo
1727 1727
 
1728 1728
 
1729 1729
 	/**
1730
-	* Gets all the spotter information based on the country name
1731
-	*
1732
-	* @return Array the spotter information
1733
-	*
1734
-	*/
1730
+	 * Gets all the spotter information based on the country name
1731
+	 *
1732
+	 * @return Array the spotter information
1733
+	 *
1734
+	 */
1735 1735
 	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1736 1736
 	{
1737 1737
 		global $global_query;
@@ -1785,11 +1785,11 @@  discard block
 block discarded – undo
1785 1785
 	
1786 1786
 	
1787 1787
 	/**
1788
-	* Gets all the spotter information based on the manufacturer name
1789
-	*
1790
-	* @return Array the spotter information
1791
-	*
1792
-	*/
1788
+	 * Gets all the spotter information based on the manufacturer name
1789
+	 *
1790
+	 * @return Array the spotter information
1791
+	 *
1792
+	 */
1793 1793
 	public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array())
1794 1794
 	{
1795 1795
 		global $global_query;
@@ -1845,13 +1845,13 @@  discard block
 block discarded – undo
1845 1845
   
1846 1846
   
1847 1847
 	/**
1848
-	* Gets a list of all aircraft that take a route
1849
-	*
1850
-	* @param String $departure_airport_icao ICAO code of departure airport
1851
-	* @param String $arrival_airport_icao ICAO code of arrival airport
1852
-	* @return Array the spotter information
1853
-	*
1854
-	*/
1848
+	 * Gets a list of all aircraft that take a route
1849
+	 *
1850
+	 * @param String $departure_airport_icao ICAO code of departure airport
1851
+	 * @param String $arrival_airport_icao ICAO code of arrival airport
1852
+	 * @return Array the spotter information
1853
+	 *
1854
+	 */
1855 1855
 	public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array())
1856 1856
 	{
1857 1857
 		global $global_query;
@@ -1920,11 +1920,11 @@  discard block
 block discarded – undo
1920 1920
 	
1921 1921
 	
1922 1922
 	/**
1923
-	* Gets all the spotter information based on the special column in the table
1924
-	*
1925
-	* @return Array the spotter information
1926
-	*
1927
-	*/
1923
+	 * Gets all the spotter information based on the special column in the table
1924
+	 *
1925
+	 * @return Array the spotter information
1926
+	 *
1927
+	 */
1928 1928
 	public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array())
1929 1929
 	{
1930 1930
 		global $global_query;
@@ -1963,11 +1963,11 @@  discard block
 block discarded – undo
1963 1963
 	}
1964 1964
 
1965 1965
 	/**
1966
-	* Gets all the highlight based on a aircraft registration
1967
-	*
1968
-	* @return String the highlight text
1969
-	*
1970
-	*/
1966
+	 * Gets all the highlight based on a aircraft registration
1967
+	 *
1968
+	 * @return String the highlight text
1969
+	 *
1970
+	 */
1971 1971
 	public function getHighlightByRegistration($registration,$filter = array())
1972 1972
 	{
1973 1973
 		global $global_query;
@@ -1989,13 +1989,13 @@  discard block
 block discarded – undo
1989 1989
 
1990 1990
 	
1991 1991
 	/**
1992
-	* Gets the squawk usage from squawk code
1993
-	*
1994
-	* @param String $squawk squawk code
1995
-	* @param String $country country
1996
-	* @return String usage
1997
-	*
1998
-	*/
1992
+	 * Gets the squawk usage from squawk code
1993
+	 *
1994
+	 * @param String $squawk squawk code
1995
+	 * @param String $country country
1996
+	 * @return String usage
1997
+	 *
1998
+	 */
1999 1999
 	public function getSquawkUsage($squawk = '',$country = 'FR')
2000 2000
 	{
2001 2001
 		
@@ -2016,12 +2016,12 @@  discard block
 block discarded – undo
2016 2016
 	}
2017 2017
 
2018 2018
 	/**
2019
-	* Gets the airport icao from the iata
2020
-	*
2021
-	* @param String $airport_iata the iata code of the airport
2022
-	* @return String airport iata
2023
-	*
2024
-	*/
2019
+	 * Gets the airport icao from the iata
2020
+	 *
2021
+	 * @param String $airport_iata the iata code of the airport
2022
+	 * @return String airport iata
2023
+	 *
2024
+	 */
2025 2025
 	public function getAirportIcao($airport_iata = '')
2026 2026
 	{
2027 2027
 		
@@ -2041,14 +2041,14 @@  discard block
 block discarded – undo
2041 2041
 	}
2042 2042
 
2043 2043
 	/**
2044
-	* Gets the airport distance
2045
-	*
2046
-	* @param String $airport_icao the icao code of the airport
2047
-	* @param Float $latitude the latitude
2048
-	* @param Float $longitude the longitude
2049
-	* @return Float distance to the airport
2050
-	*
2051
-	*/
2044
+	 * Gets the airport distance
2045
+	 *
2046
+	 * @param String $airport_icao the icao code of the airport
2047
+	 * @param Float $latitude the latitude
2048
+	 * @param Float $longitude the longitude
2049
+	 * @return Float distance to the airport
2050
+	 *
2051
+	 */
2052 2052
 	public function getAirportDistance($airport_icao,$latitude,$longitude)
2053 2053
 	{
2054 2054
 		
@@ -2069,12 +2069,12 @@  discard block
 block discarded – undo
2069 2069
 	}
2070 2070
 	
2071 2071
 	/**
2072
-	* Gets the airport info based on the icao
2073
-	*
2074
-	* @param String $airport the icao code of the airport
2075
-	* @return Array airport information
2076
-	*
2077
-	*/
2072
+	 * Gets the airport info based on the icao
2073
+	 *
2074
+	 * @param String $airport the icao code of the airport
2075
+	 * @return Array airport information
2076
+	 *
2077
+	 */
2078 2078
 	public function getAllAirportInfo($airport = '')
2079 2079
 	{
2080 2080
 		
@@ -2120,12 +2120,12 @@  discard block
 block discarded – undo
2120 2120
 	}
2121 2121
 	
2122 2122
 	/**
2123
-	* Gets the airport info based on the country
2124
-	*
2125
-	* @param Array $countries Airports countries
2126
-	* @return Array airport information
2127
-	*
2128
-	*/
2123
+	 * Gets the airport info based on the country
2124
+	 *
2125
+	 * @param Array $countries Airports countries
2126
+	 * @return Array airport information
2127
+	 *
2128
+	 */
2129 2129
 	public function getAllAirportInfobyCountry($countries)
2130 2130
 	{
2131 2131
 		$lst_countries = '';
@@ -2163,12 +2163,12 @@  discard block
 block discarded – undo
2163 2163
 	}
2164 2164
 	
2165 2165
 	/**
2166
-	* Gets airports info based on the coord
2167
-	*
2168
-	* @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
2169
-	* @return Array airport information
2170
-	*
2171
-	*/
2166
+	 * Gets airports info based on the coord
2167
+	 *
2168
+	 * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
2169
+	 * @return Array airport information
2170
+	 *
2171
+	 */
2172 2172
 	public function getAllAirportInfobyCoord($coord)
2173 2173
 	{
2174 2174
 		global $globalDBdriver;
@@ -2199,12 +2199,12 @@  discard block
 block discarded – undo
2199 2199
 	}
2200 2200
 
2201 2201
 	/**
2202
-	* Gets waypoints info based on the coord
2203
-	*
2204
-	* @param Array $coord waypoints coord
2205
-	* @return Array airport information
2206
-	*
2207
-	*/
2202
+	 * Gets waypoints info based on the coord
2203
+	 *
2204
+	 * @param Array $coord waypoints coord
2205
+	 * @return Array airport information
2206
+	 *
2207
+	 */
2208 2208
 	public function getAllWaypointsInfobyCoord($coord)
2209 2209
 	{
2210 2210
 		if (is_array($coord)) {
@@ -2238,12 +2238,12 @@  discard block
 block discarded – undo
2238 2238
 	
2239 2239
 	
2240 2240
 	/**
2241
-	* Gets the airline info based on the icao code or iata code
2242
-	*
2243
-	* @param String $airline_icao the iata code of the airport
2244
-	* @return Array airport information
2245
-	*
2246
-	*/
2241
+	 * Gets the airline info based on the icao code or iata code
2242
+	 *
2243
+	 * @param String $airline_icao the iata code of the airport
2244
+	 * @return Array airport information
2245
+	 *
2246
+	 */
2247 2247
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2248 2248
 	{
2249 2249
 		global $globalUseRealAirlines;
@@ -2274,7 +2274,7 @@  discard block
 block discarded – undo
2274 2274
 			} else {
2275 2275
 				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2276 2276
 			}
2277
-                        /*
2277
+						/*
2278 2278
 			$airline_array = array();
2279 2279
 			$temp_array = array();
2280 2280
 		
@@ -2307,12 +2307,12 @@  discard block
 block discarded – undo
2307 2307
 	}
2308 2308
 	
2309 2309
 	/**
2310
-	* Gets the airline info based on the airline name
2311
-	*
2312
-	* @param String $airline_name the name of the airline
2313
-	* @return Array airline information
2314
-	*
2315
-	*/
2310
+	 * Gets the airline info based on the airline name
2311
+	 *
2312
+	 * @param String $airline_name the name of the airline
2313
+	 * @return Array airline information
2314
+	 *
2315
+	 */
2316 2316
 	public function getAllAirlineInfoByName($airline_name, $fromsource = NULL)
2317 2317
 	{
2318 2318
 		global $globalUseRealAirlines;
@@ -2340,12 +2340,12 @@  discard block
 block discarded – undo
2340 2340
 	
2341 2341
 	
2342 2342
 	/**
2343
-	* Gets the aircraft info based on the aircraft type
2344
-	*
2345
-	* @param String $aircraft_type the aircraft type
2346
-	* @return Array aircraft information
2347
-	*
2348
-	*/
2343
+	 * Gets the aircraft info based on the aircraft type
2344
+	 *
2345
+	 * @param String $aircraft_type the aircraft type
2346
+	 * @return Array aircraft information
2347
+	 *
2348
+	 */
2349 2349
 	public function getAllAircraftInfo($aircraft_type)
2350 2350
 	{
2351 2351
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2377,12 +2377,12 @@  discard block
 block discarded – undo
2377 2377
 	}
2378 2378
 
2379 2379
 	/**
2380
-	* Gets the aircraft icao based on the aircraft name/type
2381
-	*
2382
-	* @param String $aircraft_type the aircraft type
2383
-	* @return String aircraft information
2384
-	*
2385
-	*/
2380
+	 * Gets the aircraft icao based on the aircraft name/type
2381
+	 *
2382
+	 * @param String $aircraft_type the aircraft type
2383
+	 * @return String aircraft information
2384
+	 *
2385
+	 */
2386 2386
 	public function getAircraftIcao($aircraft_type)
2387 2387
 	{
2388 2388
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2407,12 +2407,12 @@  discard block
 block discarded – undo
2407 2407
 	}
2408 2408
 	
2409 2409
 	/**
2410
-	* Gets the aircraft info based on the aircraft modes
2411
-	*
2412
-	* @param String $aircraft_modes the aircraft ident (hex)
2413
-	* @return String aircraft type
2414
-	*
2415
-	*/
2410
+	 * Gets the aircraft info based on the aircraft modes
2411
+	 *
2412
+	 * @param String $aircraft_modes the aircraft ident (hex)
2413
+	 * @return String aircraft type
2414
+	 *
2415
+	 */
2416 2416
 	public function getAllAircraftType($aircraft_modes,$source_type = '')
2417 2417
 	{
2418 2418
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -2439,12 +2439,12 @@  discard block
 block discarded – undo
2439 2439
 	}
2440 2440
 
2441 2441
 	/**
2442
-	* Gets the aircraft info based on the aircraft registration
2443
-	*
2444
-	* @param String $registration the aircraft registration
2445
-	* @return String aircraft type
2446
-	*
2447
-	*/
2442
+	 * Gets the aircraft info based on the aircraft registration
2443
+	 *
2444
+	 * @param String $registration the aircraft registration
2445
+	 * @return String aircraft type
2446
+	 *
2447
+	 */
2448 2448
 	public function getAllAircraftTypeByRegistration($registration)
2449 2449
 	{
2450 2450
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2462,12 +2462,12 @@  discard block
 block discarded – undo
2462 2462
 	}
2463 2463
 
2464 2464
 	/**
2465
-	* Gets the spotter_id and flightaware_id based on the aircraft registration
2466
-	*
2467
-	* @param String $registration the aircraft registration
2468
-	* @return Array spotter_id and flightaware_id
2469
-	*
2470
-	*/
2465
+	 * Gets the spotter_id and flightaware_id based on the aircraft registration
2466
+	 *
2467
+	 * @param String $registration the aircraft registration
2468
+	 * @return Array spotter_id and flightaware_id
2469
+	 *
2470
+	 */
2471 2471
 	public function getAllIDByRegistration($registration)
2472 2472
 	{
2473 2473
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2486,12 +2486,12 @@  discard block
 block discarded – undo
2486 2486
 	}
2487 2487
 
2488 2488
 	/**
2489
-	* Gets correct aircraft operator code
2490
-	*
2491
-	* @param String $operator the aircraft operator code (callsign)
2492
-	* @return String aircraft operator code
2493
-	*
2494
-	*/
2489
+	 * Gets correct aircraft operator code
2490
+	 *
2491
+	 * @param String $operator the aircraft operator code (callsign)
2492
+	 * @return String aircraft operator code
2493
+	 *
2494
+	 */
2495 2495
 	public function getOperator($operator)
2496 2496
 	{
2497 2497
 		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
@@ -2508,16 +2508,16 @@  discard block
 block discarded – undo
2508 2508
 	}
2509 2509
 
2510 2510
 	/**
2511
-	* Gets the aircraft route based on the aircraft callsign
2512
-	*
2513
-	* @param String $callsign the aircraft callsign
2514
-	* @return Array aircraft type
2515
-	*
2516
-	*/
2511
+	 * Gets the aircraft route based on the aircraft callsign
2512
+	 *
2513
+	 * @param String $callsign the aircraft callsign
2514
+	 * @return Array aircraft type
2515
+	 *
2516
+	 */
2517 2517
 	public function getRouteInfo($callsign)
2518 2518
 	{
2519 2519
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2520
-                if ($callsign == '') return array();
2520
+				if ($callsign == '') return array();
2521 2521
 		$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";
2522 2522
 		
2523 2523
 		$sth = $this->db->prepare($query);
@@ -2531,12 +2531,12 @@  discard block
 block discarded – undo
2531 2531
 	}
2532 2532
 	
2533 2533
 	/**
2534
-	* Gets the aircraft info based on the aircraft registration
2535
-	*
2536
-	* @param String $registration the aircraft registration
2537
-	* @return Array aircraft information
2538
-	*
2539
-	*/
2534
+	 * Gets the aircraft info based on the aircraft registration
2535
+	 *
2536
+	 * @param String $registration the aircraft registration
2537
+	 * @return Array aircraft information
2538
+	 *
2539
+	 */
2540 2540
 	public function getAircraftInfoByRegistration($registration)
2541 2541
 	{
2542 2542
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2563,12 +2563,12 @@  discard block
 block discarded – undo
2563 2563
 	}
2564 2564
 	
2565 2565
 	/**
2566
-	* Gets the aircraft owner & base based on the aircraft registration
2567
-	*
2568
-	* @param String $registration the aircraft registration
2569
-	* @return Array aircraft information
2570
-	*
2571
-	*/
2566
+	 * Gets the aircraft owner & base based on the aircraft registration
2567
+	 *
2568
+	 * @param String $registration the aircraft registration
2569
+	 * @return Array aircraft information
2570
+	 *
2571
+	 */
2572 2572
 	public function getAircraftOwnerByRegistration($registration)
2573 2573
 	{
2574 2574
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2585,11 +2585,11 @@  discard block
 block discarded – undo
2585 2585
 	
2586 2586
   
2587 2587
   /**
2588
-	* Gets all flights (but with only little info)
2589
-	*
2590
-	* @return Array basic flight information
2591
-	*
2592
-	*/
2588
+   * Gets all flights (but with only little info)
2589
+   *
2590
+   * @return Array basic flight information
2591
+   *
2592
+   */
2593 2593
 	public function getAllFlightsforSitemap()
2594 2594
 	{
2595 2595
 		//$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 ";
@@ -2597,7 +2597,7 @@  discard block
 block discarded – undo
2597 2597
 		
2598 2598
 		$sth = $this->db->prepare($query);
2599 2599
 		$sth->execute();
2600
-                  /*
2600
+				  /*
2601 2601
 		$flight_array = array();
2602 2602
 		$temp_array = array();
2603 2603
 		
@@ -2619,11 +2619,11 @@  discard block
 block discarded – undo
2619 2619
 	}
2620 2620
   
2621 2621
 	/**
2622
-	* Gets a list of all aircraft manufacturers
2623
-	*
2624
-	* @return Array list of aircraft types
2625
-	*
2626
-	*/
2622
+	 * Gets a list of all aircraft manufacturers
2623
+	 *
2624
+	 * @return Array list of aircraft types
2625
+	 *
2626
+	 */
2627 2627
 	public function getAllManufacturers()
2628 2628
 	{
2629 2629
 		/*
@@ -2652,11 +2652,11 @@  discard block
 block discarded – undo
2652 2652
   
2653 2653
   
2654 2654
   /**
2655
-	* Gets a list of all aircraft types
2656
-	*
2657
-	* @return Array list of aircraft types
2658
-	*
2659
-	*/
2655
+   * Gets a list of all aircraft types
2656
+   *
2657
+   * @return Array list of aircraft types
2658
+   *
2659
+   */
2660 2660
 	public function getAllAircraftTypes($filters = array())
2661 2661
 	{
2662 2662
 		/*
@@ -2691,11 +2691,11 @@  discard block
 block discarded – undo
2691 2691
 	
2692 2692
 	
2693 2693
 	/**
2694
-	* Gets a list of all aircraft registrations
2695
-	*
2696
-	* @return Array list of aircraft registrations
2697
-	*
2698
-	*/
2694
+	 * Gets a list of all aircraft registrations
2695
+	 *
2696
+	 * @return Array list of aircraft registrations
2697
+	 *
2698
+	 */
2699 2699
 	public function getAllAircraftRegistrations($filters = array())
2700 2700
 	{
2701 2701
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2720,12 +2720,12 @@  discard block
 block discarded – undo
2720 2720
 	}
2721 2721
 
2722 2722
 	/**
2723
-	* Gets all source name
2724
-	*
2725
-	* @param String type format of source
2726
-	* @return Array list of source name
2727
-	*
2728
-	*/
2723
+	 * Gets all source name
2724
+	 *
2725
+	 * @param String type format of source
2726
+	 * @return Array list of source name
2727
+	 *
2728
+	 */
2729 2729
 	public function getAllSourceName($type = '',$filters = array())
2730 2730
 	{
2731 2731
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2756,11 +2756,11 @@  discard block
 block discarded – undo
2756 2756
 
2757 2757
 
2758 2758
 	/**
2759
-	* Gets a list of all airline names
2760
-	*
2761
-	* @return Array list of airline names
2762
-	*
2763
-	*/
2759
+	 * Gets a list of all airline names
2760
+	 *
2761
+	 * @return Array list of airline names
2762
+	 *
2763
+	 */
2764 2764
 	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2765 2765
 	{
2766 2766
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2809,11 +2809,11 @@  discard block
 block discarded – undo
2809 2809
 	}
2810 2810
 	
2811 2811
 	/**
2812
-	* Gets a list of all alliance names
2813
-	*
2814
-	* @return Array list of alliance names
2815
-	*
2816
-	*/
2812
+	 * Gets a list of all alliance names
2813
+	 *
2814
+	 * @return Array list of alliance names
2815
+	 *
2816
+	 */
2817 2817
 	public function getAllAllianceNames($forsource = NULL,$filters = array())
2818 2818
 	{
2819 2819
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2838,11 +2838,11 @@  discard block
 block discarded – undo
2838 2838
 	}
2839 2839
 	
2840 2840
 	/**
2841
-	* Gets a list of all airline countries
2842
-	*
2843
-	* @return Array list of airline countries
2844
-	*
2845
-	*/
2841
+	 * Gets a list of all airline countries
2842
+	 *
2843
+	 * @return Array list of airline countries
2844
+	 *
2845
+	 */
2846 2846
 	public function getAllAirlineCountries($filters = array())
2847 2847
 	{
2848 2848
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2870,11 +2870,11 @@  discard block
 block discarded – undo
2870 2870
 	
2871 2871
 	
2872 2872
 	/**
2873
-	* Gets a list of all departure & arrival names
2874
-	*
2875
-	* @return Array list of airport names
2876
-	*
2877
-	*/
2873
+	 * Gets a list of all departure & arrival names
2874
+	 *
2875
+	 * @return Array list of airport names
2876
+	 *
2877
+	 */
2878 2878
 	public function getAllAirportNames($filters = array())
2879 2879
 	{
2880 2880
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2922,11 +2922,11 @@  discard block
 block discarded – undo
2922 2922
 	} 
2923 2923
 
2924 2924
 	/**
2925
-	* Gets a list of all owner names
2926
-	*
2927
-	* @return Array list of owner names
2928
-	*
2929
-	*/
2925
+	 * Gets a list of all owner names
2926
+	 *
2927
+	 * @return Array list of owner names
2928
+	 *
2929
+	 */
2930 2930
 	public function getAllOwnerNames($filters = array())
2931 2931
 	{
2932 2932
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2940,11 +2940,11 @@  discard block
 block discarded – undo
2940 2940
 	} 
2941 2941
 
2942 2942
 	/**
2943
-	* Gets a list of all pilot names and pilot ids
2944
-	*
2945
-	* @return Array list of pilot names and pilot ids
2946
-	*
2947
-	*/
2943
+	 * Gets a list of all pilot names and pilot ids
2944
+	 *
2945
+	 * @return Array list of pilot names and pilot ids
2946
+	 *
2947
+	 */
2948 2948
 	public function getAllPilotNames($filters = array())
2949 2949
 	{
2950 2950
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2959,11 +2959,11 @@  discard block
 block discarded – undo
2959 2959
 	
2960 2960
 	
2961 2961
 	/**
2962
-	* Gets a list of all departure & arrival airport countries
2963
-	*
2964
-	* @return Array list of airport countries
2965
-	*
2966
-	*/
2962
+	 * Gets a list of all departure & arrival airport countries
2963
+	 *
2964
+	 * @return Array list of airport countries
2965
+	 *
2966
+	 */
2967 2967
 	public function getAllAirportCountries($filters = array())
2968 2968
 	{
2969 2969
 		$airport_array = array();
@@ -3011,11 +3011,11 @@  discard block
 block discarded – undo
3011 3011
 	
3012 3012
 	
3013 3013
 	/**
3014
-	* Gets a list of all countries (airline, departure airport & arrival airport)
3015
-	*
3016
-	* @return Array list of countries
3017
-	*
3018
-	*/
3014
+	 * Gets a list of all countries (airline, departure airport & arrival airport)
3015
+	 *
3016
+	 * @return Array list of countries
3017
+	 *
3018
+	 */
3019 3019
 	public function getAllCountries($filters = array())
3020 3020
 	{
3021 3021
 		$Connection= new Connection($this->db);
@@ -3092,11 +3092,11 @@  discard block
 block discarded – undo
3092 3092
 	
3093 3093
 	
3094 3094
 	/**
3095
-	* Gets a list of all idents/callsigns
3096
-	*
3097
-	* @return Array list of ident/callsign names
3098
-	*
3099
-	*/
3095
+	 * Gets a list of all idents/callsigns
3096
+	 *
3097
+	 * @return Array list of ident/callsign names
3098
+	 *
3099
+	 */
3100 3100
 	public function getAllIdents($filters = array())
3101 3101
 	{
3102 3102
 		$filter_query = $this->getFilter($filters,true,true);
@@ -3120,9 +3120,9 @@  discard block
 block discarded – undo
3120 3120
 	}
3121 3121
 
3122 3122
 	/**
3123
-	* Get a list of flights from airport since 7 days
3124
-	* @return Array number, icao, name and city of airports
3125
-	*/
3123
+	 * Get a list of flights from airport since 7 days
3124
+	 * @return Array number, icao, name and city of airports
3125
+	 */
3126 3126
 
3127 3127
 	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
3128 3128
 		global $globalTimezone, $globalDBdriver;
@@ -3153,9 +3153,9 @@  discard block
 block discarded – undo
3153 3153
 	}
3154 3154
 
3155 3155
 	/**
3156
-	* Get a list of flights from airport since 7 days
3157
-	* @return Array number, icao, name and city of airports
3158
-	*/
3156
+	 * Get a list of flights from airport since 7 days
3157
+	 * @return Array number, icao, name and city of airports
3158
+	 */
3159 3159
 
3160 3160
 	public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') {
3161 3161
 		global $globalTimezone, $globalDBdriver;
@@ -3185,9 +3185,9 @@  discard block
 block discarded – undo
3185 3185
 	}
3186 3186
 
3187 3187
 	/**
3188
-	* Get a list of flights from detected airport since 7 days
3189
-	* @return Array number, icao, name and city of airports
3190
-	*/
3188
+	 * Get a list of flights from detected airport since 7 days
3189
+	 * @return Array number, icao, name and city of airports
3190
+	 */
3191 3191
 
3192 3192
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
3193 3193
 		global $globalTimezone, $globalDBdriver;
@@ -3225,9 +3225,9 @@  discard block
 block discarded – undo
3225 3225
 	}
3226 3226
 
3227 3227
 	/**
3228
-	* Get a list of flights from detected airport since 7 days
3229
-	* @return Array number, icao, name and city of airports
3230
-	*/
3228
+	 * Get a list of flights from detected airport since 7 days
3229
+	 * @return Array number, icao, name and city of airports
3230
+	 */
3231 3231
 
3232 3232
 	public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') {
3233 3233
 		global $globalTimezone, $globalDBdriver;
@@ -3269,9 +3269,9 @@  discard block
 block discarded – undo
3269 3269
 
3270 3270
 
3271 3271
 	/**
3272
-	* Get a list of flights to airport since 7 days
3273
-	* @return Array number, icao, name and city of airports
3274
-	*/
3272
+	 * Get a list of flights to airport since 7 days
3273
+	 * @return Array number, icao, name and city of airports
3274
+	 */
3275 3275
 
3276 3276
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
3277 3277
 		global $globalTimezone, $globalDBdriver;
@@ -3304,9 +3304,9 @@  discard block
 block discarded – undo
3304 3304
 
3305 3305
 
3306 3306
 	/**
3307
-	* Get a list of flights detected to airport since 7 days
3308
-	* @return Array number, icao, name and city of airports
3309
-	*/
3307
+	 * Get a list of flights detected to airport since 7 days
3308
+	 * @return Array number, icao, name and city of airports
3309
+	 */
3310 3310
 
3311 3311
 	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3312 3312
 		global $globalTimezone, $globalDBdriver;
@@ -3347,9 +3347,9 @@  discard block
 block discarded – undo
3347 3347
 
3348 3348
 
3349 3349
 	/**
3350
-	* Get a list of flights to airport since 7 days
3351
-	* @return Array number, icao, name and city of airports
3352
-	*/
3350
+	 * Get a list of flights to airport since 7 days
3351
+	 * @return Array number, icao, name and city of airports
3352
+	 */
3353 3353
 
3354 3354
 	public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') {
3355 3355
 		global $globalTimezone, $globalDBdriver;
@@ -3381,9 +3381,9 @@  discard block
 block discarded – undo
3381 3381
 
3382 3382
 
3383 3383
 	/**
3384
-	* Get a list of flights detected to airport since 7 days
3385
-	* @return Array number, icao, name and city of airports
3386
-	*/
3384
+	 * Get a list of flights detected to airport since 7 days
3385
+	 * @return Array number, icao, name and city of airports
3386
+	 */
3387 3387
 
3388 3388
 	public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') {
3389 3389
 		global $globalTimezone, $globalDBdriver;
@@ -3427,11 +3427,11 @@  discard block
 block discarded – undo
3427 3427
 
3428 3428
 
3429 3429
 	/**
3430
-	* Gets a list of all dates
3431
-	*
3432
-	* @return Array list of date names
3433
-	*
3434
-	*/
3430
+	 * Gets a list of all dates
3431
+	 *
3432
+	 * @return Array list of date names
3433
+	 *
3434
+	 */
3435 3435
 	public function getAllDates()
3436 3436
 	{
3437 3437
 		global $globalTimezone, $globalDBdriver;
@@ -3472,11 +3472,11 @@  discard block
 block discarded – undo
3472 3472
 	
3473 3473
 	
3474 3474
 	/**
3475
-	* Gets all route combinations
3476
-	*
3477
-	* @return Array the route list
3478
-	*
3479
-	*/
3475
+	 * Gets all route combinations
3476
+	 *
3477
+	 * @return Array the route list
3478
+	 *
3479
+	 */
3480 3480
 	public function getAllRoutes()
3481 3481
 	{
3482 3482
 		$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 
@@ -3502,13 +3502,13 @@  discard block
 block discarded – undo
3502 3502
 	}
3503 3503
 
3504 3504
 	/**
3505
-	* Update ident spotter data
3506
-	*
3507
-	* @param String $flightaware_id the ID from flightaware
3508
-	* @param String $ident the flight ident
3509
-	* @return String success or false
3510
-	*
3511
-	*/	
3505
+	 * Update ident spotter data
3506
+	 *
3507
+	 * @param String $flightaware_id the ID from flightaware
3508
+	 * @param String $ident the flight ident
3509
+	 * @return String success or false
3510
+	 *
3511
+	 */	
3512 3512
 	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3513 3513
 	{
3514 3514
 		if (!is_numeric(substr($ident, 0, 3)))
@@ -3529,14 +3529,14 @@  discard block
 block discarded – undo
3529 3529
 		} else {
3530 3530
 			$airline_array = $this->getAllAirlineInfo("NA");
3531 3531
 		}
3532
-                $airline_name = $airline_array[0]['name'];
3533
-                $airline_icao = $airline_array[0]['icao'];
3534
-                $airline_country = $airline_array[0]['country'];
3535
-                $airline_type = $airline_array[0]['type'];
3532
+				$airline_name = $airline_array[0]['name'];
3533
+				$airline_icao = $airline_array[0]['icao'];
3534
+				$airline_country = $airline_array[0]['country'];
3535
+				$airline_type = $airline_array[0]['type'];
3536 3536
 
3537 3537
 
3538 3538
 		$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';
3539
-                $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);
3539
+				$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);
3540 3540
 
3541 3541
 		try {
3542 3542
 			$sth = $this->db->prepare($query);
@@ -3549,19 +3549,19 @@  discard block
 block discarded – undo
3549 3549
 
3550 3550
 	}
3551 3551
 	/**
3552
-	* Update latest spotter data
3553
-	*
3554
-	* @param String $flightaware_id the ID from flightaware
3555
-	* @param String $ident the flight ident
3556
-	* @param String $arrival_airport_icao the arrival airport
3557
-	* @return String success or false
3558
-	*
3559
-	*/	
3552
+	 * Update latest spotter data
3553
+	 *
3554
+	 * @param String $flightaware_id the ID from flightaware
3555
+	 * @param String $ident the flight ident
3556
+	 * @param String $arrival_airport_icao the arrival airport
3557
+	 * @return String success or false
3558
+	 *
3559
+	 */	
3560 3560
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3561 3561
 	{
3562 3562
 		if ($groundspeed == '') $groundspeed = NULL;
3563 3563
 		$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';
3564
-                $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);
3564
+				$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);
3565 3565
 
3566 3566
 		try {
3567 3567
 			$sth = $this->db->prepare($query);
@@ -3575,32 +3575,32 @@  discard block
 block discarded – undo
3575 3575
 	}
3576 3576
 
3577 3577
 	/**
3578
-	* Adds a new spotter data
3579
-	*
3580
-	* @param String $flightaware_id the ID from flightaware
3581
-	* @param String $ident the flight ident
3582
-	* @param String $aircraft_icao the aircraft type
3583
-	* @param String $departure_airport_icao the departure airport
3584
-	* @param String $arrival_airport_icao the arrival airport
3585
-	* @param String $latitude latitude of flight
3586
-	* @param String $longitude latitude of flight
3587
-	* @param String $waypoints waypoints of flight
3588
-	* @param String $altitude altitude of flight
3589
-	* @param String $heading heading of flight
3590
-	* @param String $groundspeed speed of flight
3591
-	* @param String $date date of flight
3592
-	* @param String $departure_airport_time departure time of flight
3593
-	* @param String $arrival_airport_time arrival time of flight
3594
-	* @param String $squawk squawk code of flight
3595
-	* @param String $route_stop route stop of flight
3596
-	* @param String $highlight highlight or not
3597
-	* @param String $ModeS ModesS code of flight
3598
-	* @param String $registration registration code of flight
3599
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
3600
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
3601
-	* @param String $verticalrate vertival rate of flight
3602
-	* @return String success or false
3603
-	*/
3578
+	 * Adds a new spotter data
3579
+	 *
3580
+	 * @param String $flightaware_id the ID from flightaware
3581
+	 * @param String $ident the flight ident
3582
+	 * @param String $aircraft_icao the aircraft type
3583
+	 * @param String $departure_airport_icao the departure airport
3584
+	 * @param String $arrival_airport_icao the arrival airport
3585
+	 * @param String $latitude latitude of flight
3586
+	 * @param String $longitude latitude of flight
3587
+	 * @param String $waypoints waypoints of flight
3588
+	 * @param String $altitude altitude of flight
3589
+	 * @param String $heading heading of flight
3590
+	 * @param String $groundspeed speed of flight
3591
+	 * @param String $date date of flight
3592
+	 * @param String $departure_airport_time departure time of flight
3593
+	 * @param String $arrival_airport_time arrival time of flight
3594
+	 * @param String $squawk squawk code of flight
3595
+	 * @param String $route_stop route stop of flight
3596
+	 * @param String $highlight highlight or not
3597
+	 * @param String $ModeS ModesS code of flight
3598
+	 * @param String $registration registration code of flight
3599
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
3600
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
3601
+	 * @param String $verticalrate vertival rate of flight
3602
+	 * @return String success or false
3603
+	 */
3604 3604
 	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$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 = '',$source_type = '')
3605 3605
 	{
3606 3606
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
@@ -3815,8 +3815,8 @@  discard block
 block discarded – undo
3815 3815
     
3816 3816
 		if (($globalIVAO || $globalVATSIM || $globalphpVMS || $globalVAM) && $aircraft_icao != '')
3817 3817
 		{
3818
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3819
-            		else $airline_icao = '';
3818
+					if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3819
+					else $airline_icao = '';
3820 3820
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3821 3821
 			if (!isset($image_array[0]['registration']))
3822 3822
 			{
@@ -3847,53 +3847,53 @@  discard block
 block discarded – undo
3847 3847
 	
3848 3848
 		if (count($airline_array) == 0) 
3849 3849
 		{
3850
-                        $airline_array = $this->getAllAirlineInfo('NA');
3851
-                }
3852
-                if (count($aircraft_array) == 0) 
3853
-                {
3854
-                        $aircraft_array = $this->getAllAircraftInfo('NA');
3855
-                }
3856
-                if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3857
-                {
3858
-                        $departure_airport_array = $this->getAllAirportInfo('NA');
3859
-                }
3860
-                if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3861
-                {
3862
-                        $arrival_airport_array = $this->getAllAirportInfo('NA');
3863
-                }
3864
-                if ($registration == '') $registration = 'NA';
3865
-                if ($latitude == '' && $longitude == '') {
3866
-            		$latitude = 0;
3867
-            		$longitude = 0;
3868
-            	}
3869
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3870
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3871
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3872
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3873
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3874
-                $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) 
3850
+						$airline_array = $this->getAllAirlineInfo('NA');
3851
+				}
3852
+				if (count($aircraft_array) == 0) 
3853
+				{
3854
+						$aircraft_array = $this->getAllAircraftInfo('NA');
3855
+				}
3856
+				if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') 
3857
+				{
3858
+						$departure_airport_array = $this->getAllAirportInfo('NA');
3859
+				}
3860
+				if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') 
3861
+				{
3862
+						$arrival_airport_array = $this->getAllAirportInfo('NA');
3863
+				}
3864
+				if ($registration == '') $registration = 'NA';
3865
+				if ($latitude == '' && $longitude == '') {
3866
+					$latitude = 0;
3867
+					$longitude = 0;
3868
+				}
3869
+				if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3870
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3871
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3872
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3873
+				if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3874
+				$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) 
3875 3875
                 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)";
3876 3876
 
3877
-                $airline_name = $airline_array[0]['name'];
3878
-                $airline_icao = $airline_array[0]['icao'];
3879
-                $airline_country = $airline_array[0]['country'];
3880
-                $airline_type = $airline_array[0]['type'];
3877
+				$airline_name = $airline_array[0]['name'];
3878
+				$airline_icao = $airline_array[0]['icao'];
3879
+				$airline_country = $airline_array[0]['country'];
3880
+				$airline_type = $airline_array[0]['type'];
3881 3881
 		if ($airline_type == '') {
3882 3882
 			$timeelapsed = microtime(true);
3883 3883
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3884 3884
 			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3885 3885
 		}
3886 3886
 		if ($airline_type == null) $airline_type = '';
3887
-                $aircraft_type = $aircraft_array[0]['type'];
3888
-                $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3889
-                $departure_airport_name = $departure_airport_array[0]['name'];
3890
-	        $departure_airport_city = $departure_airport_array[0]['city'];
3891
-            	$departure_airport_country = $departure_airport_array[0]['country'];
3887
+				$aircraft_type = $aircraft_array[0]['type'];
3888
+				$aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3889
+				$departure_airport_name = $departure_airport_array[0]['name'];
3890
+			$departure_airport_city = $departure_airport_array[0]['city'];
3891
+				$departure_airport_country = $departure_airport_array[0]['country'];
3892 3892
                 
3893
-                $arrival_airport_name = $arrival_airport_array[0]['name'];
3894
-                $arrival_airport_city = $arrival_airport_array[0]['city'];
3895
-                $arrival_airport_country = $arrival_airport_array[0]['country'];
3896
-                $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);
3893
+				$arrival_airport_name = $arrival_airport_array[0]['name'];
3894
+				$arrival_airport_city = $arrival_airport_array[0]['city'];
3895
+				$arrival_airport_country = $arrival_airport_array[0]['country'];
3896
+				$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);
3897 3897
 
3898 3898
 		try {
3899 3899
 		        
@@ -3901,7 +3901,7 @@  discard block
 block discarded – undo
3901 3901
 			$sth->execute($query_values);
3902 3902
 			$this->db = null;
3903 3903
 		} catch (PDOException $e) {
3904
-		    return "error : ".$e->getMessage();
3904
+			return "error : ".$e->getMessage();
3905 3905
 		}
3906 3906
 		
3907 3907
 		return "success";
@@ -3910,11 +3910,11 @@  discard block
 block discarded – undo
3910 3910
 	
3911 3911
   
3912 3912
 	/**
3913
-	* Gets the aircraft ident within the last hour
3914
-	*
3915
-	* @return String the ident
3916
-	*
3917
-	*/
3913
+	 * Gets the aircraft ident within the last hour
3914
+	 *
3915
+	 * @return String the ident
3916
+	 *
3917
+	 */
3918 3918
 	public function getIdentFromLastHour($ident)
3919 3919
 	{
3920 3920
 		global $globalDBdriver, $globalTimezone;
@@ -3930,11 +3930,11 @@  discard block
 block discarded – undo
3930 3930
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3931 3931
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
3932 3932
 			$query_data = array(':ident' => $ident);
3933
-    		}
3933
+			}
3934 3934
 		
3935 3935
 		$sth = $this->db->prepare($query);
3936 3936
 		$sth->execute($query_data);
3937
-    		$ident_result='';
3937
+			$ident_result='';
3938 3938
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3939 3939
 		{
3940 3940
 			$ident_result = $row['ident'];
@@ -3945,11 +3945,11 @@  discard block
 block discarded – undo
3945 3945
 	
3946 3946
 	
3947 3947
 	/**
3948
-	* Gets the aircraft data from the last 20 seconds
3949
-	*
3950
-	* @return Array the spotter data
3951
-	*
3952
-	*/
3948
+	 * Gets the aircraft data from the last 20 seconds
3949
+	 *
3950
+	 * @return Array the spotter data
3951
+	 *
3952
+	 */
3953 3953
 	public function getRealTimeData($q = '')
3954 3954
 	{
3955 3955
 		global $globalDBdriver;
@@ -3993,11 +3993,11 @@  discard block
 block discarded – undo
3993 3993
 	
3994 3994
 	
3995 3995
 	 /**
3996
-	* Gets all airlines that have flown over
3997
-	*
3998
-	* @return Array the airline list
3999
-	*
4000
-	*/
3996
+	  * Gets all airlines that have flown over
3997
+	  *
3998
+	  * @return Array the airline list
3999
+	  *
4000
+	  */
4001 4001
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(), $year = '', $month = '', $day = '')
4002 4002
 	{
4003 4003
 		global $globalDBdriver;
@@ -4011,7 +4011,7 @@  discard block
 block discarded – undo
4011 4011
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4012 4012
 			}
4013 4013
 		}
4014
-                if ($sincedate != '') {
4014
+				if ($sincedate != '') {
4015 4015
 			if ($globalDBdriver == 'mysql') {
4016 4016
 				$query .= " AND spotter_output.date > '".$sincedate."'";
4017 4017
 			} else {
@@ -4065,26 +4065,26 @@  discard block
 block discarded – undo
4065 4065
 	}
4066 4066
 
4067 4067
 	 /**
4068
-	* Gets all pilots that have flown over
4069
-	*
4070
-	* @return Array the pilots list
4071
-	*
4072
-	*/
4068
+	  * Gets all pilots that have flown over
4069
+	  *
4070
+	  * @return Array the pilots list
4071
+	  *
4072
+	  */
4073 4073
 	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '',$day = '')
4074 4074
 	{
4075 4075
 		global $globalDBdriver;
4076 4076
 		$filter_query = $this->getFilter($filters,true,true);
4077 4077
 		$query  = "SELECT DISTINCT spotter_output.pilot_id, s.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4078 4078
 			FROM spotter_output LEFT JOIN (SELECT DISTINCT pilot_id, pilot_name, max(date) as date FROM spotter_output GROUP BY pilot_id, pilot_name) s ON s.pilot_id = spotter_output.pilot_id".$filter_query." spotter_output.pilot_id <> ''";
4079
-                if ($olderthanmonths > 0) {
4080
-            		if ($globalDBdriver == 'mysql') {
4079
+				if ($olderthanmonths > 0) {
4080
+					if ($globalDBdriver == 'mysql') {
4081 4081
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
4082 4082
 			} else {
4083 4083
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4084 4084
 			}
4085 4085
 		}
4086
-                if ($sincedate != '') {
4087
-            		if ($globalDBdriver == 'mysql') {
4086
+				if ($sincedate != '') {
4087
+					if ($globalDBdriver == 'mysql') {
4088 4088
 				$query .= " AND spotter_output.date > '".$sincedate."'";
4089 4089
 			} else {
4090 4090
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4139,25 +4139,25 @@  discard block
 block discarded – undo
4139 4139
 	}
4140 4140
 	
4141 4141
 	/**
4142
-	* Gets all pilots that have flown over
4143
-	*
4144
-	* @return Array the pilots list
4145
-	*
4146
-	*/
4142
+	 * Gets all pilots that have flown over
4143
+	 *
4144
+	 * @return Array the pilots list
4145
+	 *
4146
+	 */
4147 4147
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
4148 4148
 	{
4149 4149
 		global $globalDBdriver;
4150 4150
 		$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
4151 4151
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
4152
-                if ($olderthanmonths > 0) {
4153
-            		if ($globalDBdriver == 'mysql') {
4152
+				if ($olderthanmonths > 0) {
4153
+					if ($globalDBdriver == 'mysql') {
4154 4154
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
4155 4155
 			} else {
4156 4156
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
4157 4157
 			}
4158 4158
 		}
4159
-                if ($sincedate != '') {
4160
-            		if ($globalDBdriver == 'mysql') {
4159
+				if ($sincedate != '') {
4160
+					if ($globalDBdriver == 'mysql') {
4161 4161
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
4162 4162
 			} else {
4163 4163
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4186,26 +4186,26 @@  discard block
 block discarded – undo
4186 4186
 	}
4187 4187
 	
4188 4188
 	 /**
4189
-	* Gets all owner that have flown over
4190
-	*
4191
-	* @return Array the pilots list
4192
-	*
4193
-	*/
4189
+	  * Gets all owner that have flown over
4190
+	  *
4191
+	  * @return Array the pilots list
4192
+	  *
4193
+	  */
4194 4194
 	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4195 4195
 	{
4196 4196
 		global $globalDBdriver;
4197 4197
 		$filter_query = $this->getFilter($filters,true,true);
4198 4198
 		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4199 4199
 					FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL";
4200
-                if ($olderthanmonths > 0) {
4201
-            		if ($globalDBdriver == 'mysql') {
4200
+				if ($olderthanmonths > 0) {
4201
+					if ($globalDBdriver == 'mysql') {
4202 4202
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
4203 4203
 			} else {
4204 4204
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4205 4205
 			}
4206 4206
 		}
4207
-                if ($sincedate != '') {
4208
-            		if ($globalDBdriver == 'mysql') {
4207
+				if ($sincedate != '') {
4208
+					if ($globalDBdriver == 'mysql') {
4209 4209
 				$query .= " AND spotter_output.date > '".$sincedate."' ";
4210 4210
 			} else {
4211 4211
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4256,26 +4256,26 @@  discard block
 block discarded – undo
4256 4256
 	}
4257 4257
 	
4258 4258
 	 /**
4259
-	* Gets all owner that have flown over
4260
-	*
4261
-	* @return Array the pilots list
4262
-	*
4263
-	*/
4259
+	  * Gets all owner that have flown over
4260
+	  *
4261
+	  * @return Array the pilots list
4262
+	  *
4263
+	  */
4264 4264
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
4265 4265
 	{
4266 4266
 		global $globalDBdriver;
4267 4267
 		$filter_query = $this->getFilter($filters,true,true);
4268 4268
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4269 4269
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
4270
-                if ($olderthanmonths > 0) {
4271
-            		if ($globalDBdriver == 'mysql') {
4270
+				if ($olderthanmonths > 0) {
4271
+					if ($globalDBdriver == 'mysql') {
4272 4272
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
4273 4273
 			} else {
4274 4274
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
4275 4275
 			}
4276 4276
 		}
4277
-                if ($sincedate != '') {
4278
-            		if ($globalDBdriver == 'mysql') {
4277
+				if ($sincedate != '') {
4278
+					if ($globalDBdriver == 'mysql') {
4279 4279
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
4280 4280
 			} else {
4281 4281
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4302,11 +4302,11 @@  discard block
 block discarded – undo
4302 4302
 	}
4303 4303
 
4304 4304
 	/**
4305
-	* Gets all airlines that have flown over by aircraft
4306
-	*
4307
-	* @return Array the airline list
4308
-	*
4309
-	*/
4305
+	 * Gets all airlines that have flown over by aircraft
4306
+	 *
4307
+	 * @return Array the airline list
4308
+	 *
4309
+	 */
4310 4310
 	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
4311 4311
 	{
4312 4312
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -4338,11 +4338,11 @@  discard block
 block discarded – undo
4338 4338
 
4339 4339
 
4340 4340
 	/**
4341
-	* Gets all airline countries that have flown over by aircraft
4342
-	*
4343
-	* @return Array the airline country list
4344
-	*
4345
-	*/
4341
+	 * Gets all airline countries that have flown over by aircraft
4342
+	 *
4343
+	 * @return Array the airline country list
4344
+	 *
4345
+	 */
4346 4346
 	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
4347 4347
 	{
4348 4348
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -4375,11 +4375,11 @@  discard block
 block discarded – undo
4375 4375
 	
4376 4376
 	
4377 4377
 	/**
4378
-	* Gets all airlines that have flown over by airport
4379
-	*
4380
-	* @return Array the airline list
4381
-	*
4382
-	*/
4378
+	 * Gets all airlines that have flown over by airport
4379
+	 *
4380
+	 * @return Array the airline list
4381
+	 *
4382
+	 */
4383 4383
 	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4384 4384
 	{
4385 4385
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4410,11 +4410,11 @@  discard block
 block discarded – undo
4410 4410
 
4411 4411
 
4412 4412
 	/**
4413
-	* Gets all airline countries that have flown over by airport icao
4414
-	*
4415
-	* @return Array the airline country list
4416
-	*
4417
-	*/
4413
+	 * Gets all airline countries that have flown over by airport icao
4414
+	 *
4415
+	 * @return Array the airline country list
4416
+	 *
4417
+	 */
4418 4418
 	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4419 4419
 	{
4420 4420
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4445,11 +4445,11 @@  discard block
 block discarded – undo
4445 4445
 
4446 4446
 
4447 4447
 	/**
4448
-	* Gets all airlines that have flown over by aircraft manufacturer
4449
-	*
4450
-	* @return Array the airline list
4451
-	*
4452
-	*/
4448
+	 * Gets all airlines that have flown over by aircraft manufacturer
4449
+	 *
4450
+	 * @return Array the airline list
4451
+	 *
4452
+	 */
4453 4453
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4454 4454
 	{
4455 4455
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4480,11 +4480,11 @@  discard block
 block discarded – undo
4480 4480
 
4481 4481
 
4482 4482
 	/**
4483
-	* Gets all airline countries that have flown over by aircraft manufacturer
4484
-	*
4485
-	* @return Array the airline country list
4486
-	*
4487
-	*/
4483
+	 * Gets all airline countries that have flown over by aircraft manufacturer
4484
+	 *
4485
+	 * @return Array the airline country list
4486
+	 *
4487
+	 */
4488 4488
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4489 4489
 	{
4490 4490
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4513,11 +4513,11 @@  discard block
 block discarded – undo
4513 4513
 
4514 4514
 
4515 4515
 	/**
4516
-	* Gets all airlines that have flown over by date
4517
-	*
4518
-	* @return Array the airline list
4519
-	*
4520
-	*/
4516
+	 * Gets all airlines that have flown over by date
4517
+	 *
4518
+	 * @return Array the airline list
4519
+	 *
4520
+	 */
4521 4521
 	public function countAllAirlinesByDate($date,$filters = array())
4522 4522
 	{
4523 4523
 		global $globalTimezone, $globalDBdriver;
@@ -4561,11 +4561,11 @@  discard block
 block discarded – undo
4561 4561
 	
4562 4562
 	
4563 4563
 	/**
4564
-	* Gets all airline countries that have flown over by date
4565
-	*
4566
-	* @return Array the airline country list
4567
-	*
4568
-	*/
4564
+	 * Gets all airline countries that have flown over by date
4565
+	 *
4566
+	 * @return Array the airline country list
4567
+	 *
4568
+	 */
4569 4569
 	public function countAllAirlineCountriesByDate($date,$filters = array())
4570 4570
 	{
4571 4571
 		global $globalTimezone, $globalDBdriver;
@@ -4608,11 +4608,11 @@  discard block
 block discarded – undo
4608 4608
 
4609 4609
 
4610 4610
 	/**
4611
-	* Gets all airlines that have flown over by ident/callsign
4612
-	*
4613
-	* @return Array the airline list
4614
-	*
4615
-	*/
4611
+	 * Gets all airlines that have flown over by ident/callsign
4612
+	 *
4613
+	 * @return Array the airline list
4614
+	 *
4615
+	 */
4616 4616
 	public function countAllAirlinesByIdent($ident,$filters = array())
4617 4617
 	{
4618 4618
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4629,11 +4629,11 @@  discard block
 block discarded – undo
4629 4629
 	}
4630 4630
 
4631 4631
 	/**
4632
-	* Gets all airlines by owner
4633
-	*
4634
-	* @return Array the airline list
4635
-	*
4636
-	*/
4632
+	 * Gets all airlines by owner
4633
+	 *
4634
+	 * @return Array the airline list
4635
+	 *
4636
+	 */
4637 4637
 	public function countAllAirlinesByOwner($owner,$filters = array())
4638 4638
 	{
4639 4639
 		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
@@ -4650,11 +4650,11 @@  discard block
 block discarded – undo
4650 4650
 	}
4651 4651
 
4652 4652
 	/**
4653
-	* Gets flight duration by owner
4654
-	*
4655
-	* @return String Duration of all flights
4656
-	*
4657
-	*/
4653
+	 * Gets flight duration by owner
4654
+	 *
4655
+	 * @return String Duration of all flights
4656
+	 *
4657
+	 */
4658 4658
 	public function getFlightDurationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
4659 4659
 	{
4660 4660
 		global $globalDBdriver;
@@ -4701,11 +4701,11 @@  discard block
 block discarded – undo
4701 4701
 	}
4702 4702
 
4703 4703
 	/**
4704
-	* Count flights by owner
4705
-	*
4706
-	* @return String Duration of all flights
4707
-	*
4708
-	*/
4704
+	 * Count flights by owner
4705
+	 *
4706
+	 * @return String Duration of all flights
4707
+	 *
4708
+	 */
4709 4709
 	public function countFlightsByOwner($owner,$filters = array())
4710 4710
 	{
4711 4711
 		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
@@ -4721,11 +4721,11 @@  discard block
 block discarded – undo
4721 4721
 	}
4722 4722
 
4723 4723
 	/**
4724
-	* Count flights by pilot
4725
-	*
4726
-	* @return String Duration of all flights
4727
-	*
4728
-	*/
4724
+	 * Count flights by pilot
4725
+	 *
4726
+	 * @return String Duration of all flights
4727
+	 *
4728
+	 */
4729 4729
 	public function countFlightsByPilot($pilot,$filters = array())
4730 4730
 	{
4731 4731
 		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
@@ -4741,11 +4741,11 @@  discard block
 block discarded – undo
4741 4741
 	}
4742 4742
 
4743 4743
 	/**
4744
-	* Gets flight duration by pilot
4745
-	*
4746
-	* @return String Duration of all flights
4747
-	*
4748
-	*/
4744
+	 * Gets flight duration by pilot
4745
+	 *
4746
+	 * @return String Duration of all flights
4747
+	 *
4748
+	 */
4749 4749
 	public function getFlightDurationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
4750 4750
 	{
4751 4751
 		global $globalDBdriver;
@@ -4791,11 +4791,11 @@  discard block
 block discarded – undo
4791 4791
 	}
4792 4792
 
4793 4793
 	/**
4794
-	* Gets all airlines used by pilot
4795
-	*
4796
-	* @return Array the airline list
4797
-	*
4798
-	*/
4794
+	 * Gets all airlines used by pilot
4795
+	 *
4796
+	 * @return Array the airline list
4797
+	 *
4798
+	 */
4799 4799
 	public function countAllAirlinesByPilot($pilot,$filters = array())
4800 4800
 	{
4801 4801
 		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
@@ -4812,11 +4812,11 @@  discard block
 block discarded – undo
4812 4812
 	}
4813 4813
 
4814 4814
 	/**
4815
-	* Gets all airlines that have flown over by route
4816
-	*
4817
-	* @return Array the airline list
4818
-	*
4819
-	*/
4815
+	 * Gets all airlines that have flown over by route
4816
+	 *
4817
+	 * @return Array the airline list
4818
+	 *
4819
+	 */
4820 4820
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4821 4821
 	{
4822 4822
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4848,11 +4848,11 @@  discard block
 block discarded – undo
4848 4848
 	}
4849 4849
 
4850 4850
 	/**
4851
-	* Gets all airline countries that have flown over by route
4852
-	*
4853
-	* @return Array the airline country list
4854
-	*
4855
-	*/
4851
+	 * Gets all airline countries that have flown over by route
4852
+	 *
4853
+	 * @return Array the airline country list
4854
+	 *
4855
+	 */
4856 4856
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4857 4857
 	{
4858 4858
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4884,11 +4884,11 @@  discard block
 block discarded – undo
4884 4884
 
4885 4885
 
4886 4886
 	/**
4887
-	* Gets all airlines that have flown over by country
4888
-	*
4889
-	* @return Array the airline list
4890
-	*
4891
-	*/
4887
+	 * Gets all airlines that have flown over by country
4888
+	 *
4889
+	 * @return Array the airline list
4890
+	 *
4891
+	 */
4892 4892
 	public function countAllAirlinesByCountry($country,$filters = array())
4893 4893
 	{
4894 4894
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4918,11 +4918,11 @@  discard block
 block discarded – undo
4918 4918
 
4919 4919
 
4920 4920
 	/**
4921
-	* Gets all airline countries that have flown over by country
4922
-	*
4923
-	* @return Array the airline country list
4924
-	*
4925
-	*/
4921
+	 * Gets all airline countries that have flown over by country
4922
+	 *
4923
+	 * @return Array the airline country list
4924
+	 *
4925
+	 */
4926 4926
 	public function countAllAirlineCountriesByCountry($country,$filters = array())
4927 4927
 	{
4928 4928
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4951,11 +4951,11 @@  discard block
 block discarded – undo
4951 4951
 
4952 4952
 
4953 4953
 	/**
4954
-	* Gets all airlines countries
4955
-	*
4956
-	* @return Array the airline country list
4957
-	*
4958
-	*/
4954
+	 * Gets all airlines countries
4955
+	 *
4956
+	 * @return Array the airline country list
4957
+	 *
4958
+	 */
4959 4959
 	public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
4960 4960
 	{
4961 4961
 		global $globalDBdriver;
@@ -5011,11 +5011,11 @@  discard block
 block discarded – undo
5011 5011
 	}
5012 5012
 
5013 5013
 	/**
5014
-	* Gets all number of flight over countries
5015
-	*
5016
-	* @return Array the airline country list
5017
-	*
5018
-	*/
5014
+	 * Gets all number of flight over countries
5015
+	 *
5016
+	 * @return Array the airline country list
5017
+	 *
5018
+	 */
5019 5019
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5020 5020
 	{
5021 5021
 		global $globalDBdriver;
@@ -5037,15 +5037,15 @@  discard block
 block discarded – undo
5037 5037
 		$SpotterLive = new SpotterLive();
5038 5038
 		$filter_query = $SpotterLive->getFilter($filters,true,true);
5039 5039
 		$filter_query .= ' over_country IS NOT NULL';
5040
-                if ($olderthanmonths > 0) {
5040
+				if ($olderthanmonths > 0) {
5041 5041
 			if ($globalDBdriver == 'mysql') {
5042 5042
 				$filter_query .= ' AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5043 5043
 			} else {
5044 5044
 				$filter_query .= " AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5045 5045
 			}
5046 5046
 		}
5047
-                if ($sincedate != '') {
5048
-            		if ($globalDBdriver == 'mysql') {
5047
+				if ($sincedate != '') {
5048
+					if ($globalDBdriver == 'mysql') {
5049 5049
 				$filter_query .= " AND spotter_live.date > '".$sincedate."' ";
5050 5050
 			} else {
5051 5051
 				$filter_query .= " AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5075,11 +5075,11 @@  discard block
 block discarded – undo
5075 5075
 	
5076 5076
 	
5077 5077
 	/**
5078
-	* Gets all aircraft types that have flown over
5079
-	*
5080
-	* @return Array the aircraft list
5081
-	*
5082
-	*/
5078
+	 * Gets all aircraft types that have flown over
5079
+	 *
5080
+	 * @return Array the aircraft list
5081
+	 *
5082
+	 */
5083 5083
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
5084 5084
 	{
5085 5085
 		global $globalDBdriver;
@@ -5149,11 +5149,11 @@  discard block
 block discarded – undo
5149 5149
 	}
5150 5150
 
5151 5151
 	/**
5152
-	* Gets all aircraft types that have flown over by airline
5153
-	*
5154
-	* @return Array the aircraft list
5155
-	*
5156
-	*/
5152
+	 * Gets all aircraft types that have flown over by airline
5153
+	 *
5154
+	 * @return Array the aircraft list
5155
+	 *
5156
+	 */
5157 5157
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '')
5158 5158
 	{
5159 5159
 		global $globalDBdriver;
@@ -5224,11 +5224,11 @@  discard block
 block discarded – undo
5224 5224
 	}
5225 5225
 
5226 5226
 	/**
5227
-	* Gets all aircraft types that have flown over by months
5228
-	*
5229
-	* @return Array the aircraft list
5230
-	*
5231
-	*/
5227
+	 * Gets all aircraft types that have flown over by months
5228
+	 *
5229
+	 * @return Array the aircraft list
5230
+	 *
5231
+	 */
5232 5232
 	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5233 5233
 	{
5234 5234
 		global $globalDBdriver;
@@ -5272,11 +5272,11 @@  discard block
 block discarded – undo
5272 5272
 
5273 5273
 
5274 5274
 	/**
5275
-	* Gets all aircraft registration that have flown over by aircaft icao
5276
-	*
5277
-	* @return Array the aircraft list
5278
-	*
5279
-	*/
5275
+	 * Gets all aircraft registration that have flown over by aircaft icao
5276
+	 *
5277
+	 * @return Array the aircraft list
5278
+	 *
5279
+	 */
5280 5280
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
5281 5281
 	{
5282 5282
 		$Image = new Image($this->db);
@@ -5315,11 +5315,11 @@  discard block
 block discarded – undo
5315 5315
 
5316 5316
 
5317 5317
 	/**
5318
-	* Gets all aircraft types that have flown over by airline icao
5319
-	*
5320
-	* @return Array the aircraft list
5321
-	*
5322
-	*/
5318
+	 * Gets all aircraft types that have flown over by airline icao
5319
+	 *
5320
+	 * @return Array the aircraft list
5321
+	 *
5322
+	 */
5323 5323
 	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
5324 5324
 	{
5325 5325
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5348,11 +5348,11 @@  discard block
 block discarded – undo
5348 5348
 
5349 5349
 
5350 5350
 	/**
5351
-	* Gets all aircraft registration that have flown over by airline icao
5352
-	*
5353
-	* @return Array the aircraft list
5354
-	*
5355
-	*/
5351
+	 * Gets all aircraft registration that have flown over by airline icao
5352
+	 *
5353
+	 * @return Array the aircraft list
5354
+	 *
5355
+	 */
5356 5356
 	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
5357 5357
 	{
5358 5358
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5390,11 +5390,11 @@  discard block
 block discarded – undo
5390 5390
 
5391 5391
 
5392 5392
 	/**
5393
-	* Gets all aircraft manufacturer that have flown over by airline icao
5394
-	*
5395
-	* @return Array the aircraft list
5396
-	*
5397
-	*/
5393
+	 * Gets all aircraft manufacturer that have flown over by airline icao
5394
+	 *
5395
+	 * @return Array the aircraft list
5396
+	 *
5397
+	 */
5398 5398
 	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
5399 5399
 	{
5400 5400
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5422,11 +5422,11 @@  discard block
 block discarded – undo
5422 5422
 
5423 5423
 
5424 5424
 	/**
5425
-	* Gets all aircraft types that have flown over by airline icao
5426
-	*
5427
-	* @return Array the aircraft list
5428
-	*
5429
-	*/
5425
+	 * Gets all aircraft types that have flown over by airline icao
5426
+	 *
5427
+	 * @return Array the aircraft list
5428
+	 *
5429
+	 */
5430 5430
 	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
5431 5431
 	{
5432 5432
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5455,11 +5455,11 @@  discard block
 block discarded – undo
5455 5455
 
5456 5456
 
5457 5457
 	/**
5458
-	* Gets all aircraft registration that have flown over by airport icao
5459
-	*
5460
-	* @return Array the aircraft list
5461
-	*
5462
-	*/
5458
+	 * Gets all aircraft registration that have flown over by airport icao
5459
+	 *
5460
+	 * @return Array the aircraft list
5461
+	 *
5462
+	 */
5463 5463
 	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
5464 5464
 	{
5465 5465
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5496,11 +5496,11 @@  discard block
 block discarded – undo
5496 5496
 	
5497 5497
 	
5498 5498
 	/**
5499
-	* Gets all aircraft manufacturer that have flown over by airport icao
5500
-	*
5501
-	* @return Array the aircraft list
5502
-	*
5503
-	*/
5499
+	 * Gets all aircraft manufacturer that have flown over by airport icao
5500
+	 *
5501
+	 * @return Array the aircraft list
5502
+	 *
5503
+	 */
5504 5504
 	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
5505 5505
 	{
5506 5506
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5526,11 +5526,11 @@  discard block
 block discarded – undo
5526 5526
 	}
5527 5527
 
5528 5528
 	/**
5529
-	* Gets all aircraft types that have flown over by aircraft manufacturer
5530
-	*
5531
-	* @return Array the aircraft list
5532
-	*
5533
-	*/
5529
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
5530
+	 *
5531
+	 * @return Array the aircraft list
5532
+	 *
5533
+	 */
5534 5534
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
5535 5535
 	{
5536 5536
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5557,11 +5557,11 @@  discard block
 block discarded – undo
5557 5557
 
5558 5558
 
5559 5559
 	/**
5560
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
5561
-	*
5562
-	* @return Array the aircraft list
5563
-	*
5564
-	*/
5560
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
5561
+	 *
5562
+	 * @return Array the aircraft list
5563
+	 *
5564
+	 */
5565 5565
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
5566 5566
 	{
5567 5567
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5597,11 +5597,11 @@  discard block
 block discarded – undo
5597 5597
 	}
5598 5598
 
5599 5599
 	/**
5600
-	* Gets all aircraft types that have flown over by date
5601
-	*
5602
-	* @return Array the aircraft list
5603
-	*
5604
-	*/
5600
+	 * Gets all aircraft types that have flown over by date
5601
+	 *
5602
+	 * @return Array the aircraft list
5603
+	 *
5604
+	 */
5605 5605
 	public function countAllAircraftTypesByDate($date,$filters = array())
5606 5606
 	{
5607 5607
 		global $globalTimezone, $globalDBdriver;
@@ -5643,11 +5643,11 @@  discard block
 block discarded – undo
5643 5643
 
5644 5644
 
5645 5645
 	/**
5646
-	* Gets all aircraft registration that have flown over by date
5647
-	*
5648
-	* @return Array the aircraft list
5649
-	*
5650
-	*/
5646
+	 * Gets all aircraft registration that have flown over by date
5647
+	 *
5648
+	 * @return Array the aircraft list
5649
+	 *
5650
+	 */
5651 5651
 	public function countAllAircraftRegistrationByDate($date,$filters = array())
5652 5652
 	{
5653 5653
 		global $globalTimezone, $globalDBdriver;
@@ -5698,11 +5698,11 @@  discard block
 block discarded – undo
5698 5698
 
5699 5699
 
5700 5700
 	/**
5701
-	* Gets all aircraft manufacturer that have flown over by date
5702
-	*
5703
-	* @return Array the aircraft manufacturer list
5704
-	*
5705
-	*/
5701
+	 * Gets all aircraft manufacturer that have flown over by date
5702
+	 *
5703
+	 * @return Array the aircraft manufacturer list
5704
+	 *
5705
+	 */
5706 5706
 	public function countAllAircraftManufacturerByDate($date,$filters = array())
5707 5707
 	{
5708 5708
 		global $globalTimezone, $globalDBdriver;
@@ -5744,11 +5744,11 @@  discard block
 block discarded – undo
5744 5744
 
5745 5745
 
5746 5746
 	/**
5747
-	* Gets all aircraft types that have flown over by ident/callsign
5748
-	*
5749
-	* @return Array the aircraft list
5750
-	*
5751
-	*/
5747
+	 * Gets all aircraft types that have flown over by ident/callsign
5748
+	 *
5749
+	 * @return Array the aircraft list
5750
+	 *
5751
+	 */
5752 5752
 	public function countAllAircraftTypesByIdent($ident,$filters = array())
5753 5753
 	{
5754 5754
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5776,11 +5776,11 @@  discard block
 block discarded – undo
5776 5776
 	}
5777 5777
 
5778 5778
 	/**
5779
-	* Gets all aircraft types that have flown over by pilot
5780
-	*
5781
-	* @return Array the aircraft list
5782
-	*
5783
-	*/
5779
+	 * Gets all aircraft types that have flown over by pilot
5780
+	 *
5781
+	 * @return Array the aircraft list
5782
+	 *
5783
+	 */
5784 5784
 	public function countAllAircraftTypesByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
5785 5785
 	{
5786 5786
 		global $globalDBdriver;
@@ -5826,11 +5826,11 @@  discard block
 block discarded – undo
5826 5826
 	}
5827 5827
 
5828 5828
 	/**
5829
-	* Gets all aircraft types that have flown over by owner
5830
-	*
5831
-	* @return Array the aircraft list
5832
-	*
5833
-	*/
5829
+	 * Gets all aircraft types that have flown over by owner
5830
+	 *
5831
+	 * @return Array the aircraft list
5832
+	 *
5833
+	 */
5834 5834
 	public function countAllAircraftTypesByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
5835 5835
 	{
5836 5836
 		global $globalDBdriver;
@@ -5875,11 +5875,11 @@  discard block
 block discarded – undo
5875 5875
 	}
5876 5876
 
5877 5877
 	/**
5878
-	* Gets all aircraft registration that have flown over by ident/callsign
5879
-	*
5880
-	* @return Array the aircraft list
5881
-	*
5882
-	*/
5878
+	 * Gets all aircraft registration that have flown over by ident/callsign
5879
+	 *
5880
+	 * @return Array the aircraft list
5881
+	 *
5882
+	 */
5883 5883
 	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5884 5884
 	{
5885 5885
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5918,11 +5918,11 @@  discard block
 block discarded – undo
5918 5918
 	}
5919 5919
 
5920 5920
 	/**
5921
-	* Gets all aircraft registration that have flown over by owner
5922
-	*
5923
-	* @return Array the aircraft list
5924
-	*
5925
-	*/
5921
+	 * Gets all aircraft registration that have flown over by owner
5922
+	 *
5923
+	 * @return Array the aircraft list
5924
+	 *
5925
+	 */
5926 5926
 	public function countAllAircraftRegistrationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
5927 5927
 	{
5928 5928
 		global $globalDBdriver;
@@ -5993,11 +5993,11 @@  discard block
 block discarded – undo
5993 5993
 	}
5994 5994
 
5995 5995
 	/**
5996
-	* Gets all aircraft registration that have flown over by pilot
5997
-	*
5998
-	* @return Array the aircraft list
5999
-	*
6000
-	*/
5996
+	 * Gets all aircraft registration that have flown over by pilot
5997
+	 *
5998
+	 * @return Array the aircraft list
5999
+	 *
6000
+	 */
6001 6001
 	public function countAllAircraftRegistrationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
6002 6002
 	{
6003 6003
 		global $globalDBdriver;
@@ -6069,11 +6069,11 @@  discard block
 block discarded – undo
6069 6069
 
6070 6070
 
6071 6071
 	/**
6072
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
6073
-	*
6074
-	* @return Array the aircraft manufacturer list
6075
-	*
6076
-	*/
6072
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
6073
+	 *
6074
+	 * @return Array the aircraft manufacturer list
6075
+	 *
6076
+	 */
6077 6077
 	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
6078 6078
 	{
6079 6079
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6098,11 +6098,11 @@  discard block
 block discarded – undo
6098 6098
 	}
6099 6099
 
6100 6100
 	/**
6101
-	* Gets all aircraft manufacturer that have flown over by owner
6102
-	*
6103
-	* @return Array the aircraft manufacturer list
6104
-	*
6105
-	*/
6101
+	 * Gets all aircraft manufacturer that have flown over by owner
6102
+	 *
6103
+	 * @return Array the aircraft manufacturer list
6104
+	 *
6105
+	 */
6106 6106
 	public function countAllAircraftManufacturerByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
6107 6107
 	{
6108 6108
 		global $globalDBdriver;
@@ -6150,11 +6150,11 @@  discard block
 block discarded – undo
6150 6150
 	}
6151 6151
 
6152 6152
 	/**
6153
-	* Gets all aircraft manufacturer that have flown over by pilot
6154
-	*
6155
-	* @return Array the aircraft manufacturer list
6156
-	*
6157
-	*/
6153
+	 * Gets all aircraft manufacturer that have flown over by pilot
6154
+	 *
6155
+	 * @return Array the aircraft manufacturer list
6156
+	 *
6157
+	 */
6158 6158
 	public function countAllAircraftManufacturerByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
6159 6159
 	{
6160 6160
 		global $globalDBdriver;
@@ -6203,11 +6203,11 @@  discard block
 block discarded – undo
6203 6203
 
6204 6204
 
6205 6205
 	/**
6206
-	* Gets all aircraft types that have flown over by route
6207
-	*
6208
-	* @return Array the aircraft list
6209
-	*
6210
-	*/
6206
+	 * Gets all aircraft types that have flown over by route
6207
+	 *
6208
+	 * @return Array the aircraft list
6209
+	 *
6210
+	 */
6211 6211
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6212 6212
 	{
6213 6213
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6236,11 +6236,11 @@  discard block
 block discarded – undo
6236 6236
 	}
6237 6237
 
6238 6238
 	/**
6239
-	* Gets all aircraft registration that have flown over by route
6240
-	*
6241
-	* @return Array the aircraft list
6242
-	*
6243
-	*/
6239
+	 * Gets all aircraft registration that have flown over by route
6240
+	 *
6241
+	 * @return Array the aircraft list
6242
+	 *
6243
+	 */
6244 6244
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6245 6245
 	{
6246 6246
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6282,11 +6282,11 @@  discard block
 block discarded – undo
6282 6282
 	
6283 6283
 	
6284 6284
 	/**
6285
-	* Gets all aircraft manufacturer that have flown over by route
6286
-	*
6287
-	* @return Array the aircraft manufacturer list
6288
-	*
6289
-	*/
6285
+	 * Gets all aircraft manufacturer that have flown over by route
6286
+	 *
6287
+	 * @return Array the aircraft manufacturer list
6288
+	 *
6289
+	 */
6290 6290
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6291 6291
 	{
6292 6292
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6320,11 +6320,11 @@  discard block
 block discarded – undo
6320 6320
 	
6321 6321
 	
6322 6322
 	/**
6323
-	* Gets all aircraft types that have flown over by country
6324
-	*
6325
-	* @return Array the aircraft list
6326
-	*
6327
-	*/
6323
+	 * Gets all aircraft types that have flown over by country
6324
+	 *
6325
+	 * @return Array the aircraft list
6326
+	 *
6327
+	 */
6328 6328
 	public function countAllAircraftTypesByCountry($country,$filters = array())
6329 6329
 	{
6330 6330
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6355,11 +6355,11 @@  discard block
 block discarded – undo
6355 6355
 
6356 6356
 
6357 6357
 	/**
6358
-	* Gets all aircraft registration that have flown over by country
6359
-	*
6360
-	* @return Array the aircraft list
6361
-	*
6362
-	*/
6358
+	 * Gets all aircraft registration that have flown over by country
6359
+	 *
6360
+	 * @return Array the aircraft list
6361
+	 *
6362
+	 */
6363 6363
 	public function countAllAircraftRegistrationByCountry($country,$filters = array())
6364 6364
 	{
6365 6365
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6399,11 +6399,11 @@  discard block
 block discarded – undo
6399 6399
 	
6400 6400
 	
6401 6401
 	/**
6402
-	* Gets all aircraft manufacturer that have flown over by country
6403
-	*
6404
-	* @return Array the aircraft manufacturer list
6405
-	*
6406
-	*/
6402
+	 * Gets all aircraft manufacturer that have flown over by country
6403
+	 *
6404
+	 * @return Array the aircraft manufacturer list
6405
+	 *
6406
+	 */
6407 6407
 	public function countAllAircraftManufacturerByCountry($country,$filters = array())
6408 6408
 	{
6409 6409
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6434,18 +6434,18 @@  discard block
 block discarded – undo
6434 6434
 	
6435 6435
 	
6436 6436
 	/**
6437
-	* Gets all aircraft manufacturers that have flown over
6438
-	*
6439
-	* @return Array the aircraft list
6440
-	*
6441
-	*/
6437
+	 * Gets all aircraft manufacturers that have flown over
6438
+	 *
6439
+	 * @return Array the aircraft list
6440
+	 *
6441
+	 */
6442 6442
 	public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '')
6443 6443
 	{
6444 6444
 		global $globalDBdriver;
6445 6445
 		$filter_query = $this->getFilter($filters,true,true);
6446 6446
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6447 6447
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
6448
-                $query_values = array();
6448
+				$query_values = array();
6449 6449
 		if ($year != '') {
6450 6450
 			if ($globalDBdriver == 'mysql') {
6451 6451
 				$query .= " AND YEAR(spotter_output.date) = :year";
@@ -6498,11 +6498,11 @@  discard block
 block discarded – undo
6498 6498
 	
6499 6499
 	
6500 6500
 	/**
6501
-	* Gets all aircraft registrations that have flown over
6502
-	*
6503
-	* @return Array the aircraft list
6504
-	*
6505
-	*/
6501
+	 * Gets all aircraft registrations that have flown over
6502
+	 *
6503
+	 * @return Array the aircraft list
6504
+	 *
6505
+	 */
6506 6506
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
6507 6507
 	{
6508 6508
 		global $globalDBdriver;
@@ -6510,15 +6510,15 @@  discard block
 block discarded – undo
6510 6510
 		$filter_query = $this->getFilter($filters,true,true);
6511 6511
 		$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    
6512 6512
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
6513
-                if ($olderthanmonths > 0) {
6514
-            		if ($globalDBdriver == 'mysql') {
6513
+				if ($olderthanmonths > 0) {
6514
+					if ($globalDBdriver == 'mysql') {
6515 6515
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6516 6516
 			} else {
6517 6517
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6518 6518
 			}
6519 6519
 		}
6520
-                if ($sincedate != '') {
6521
-            		if ($globalDBdriver == 'mysql') {
6520
+				if ($sincedate != '') {
6521
+					if ($globalDBdriver == 'mysql') {
6522 6522
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6523 6523
 			} else {
6524 6524
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6583,11 +6583,11 @@  discard block
 block discarded – undo
6583 6583
 
6584 6584
 
6585 6585
 	/**
6586
-	* Gets all aircraft registrations that have flown over
6587
-	*
6588
-	* @return Array the aircraft list
6589
-	*
6590
-	*/
6586
+	 * Gets all aircraft registrations that have flown over
6587
+	 *
6588
+	 * @return Array the aircraft list
6589
+	 *
6590
+	 */
6591 6591
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
6592 6592
 	{
6593 6593
 		global $globalDBdriver;
@@ -6595,15 +6595,15 @@  discard block
 block discarded – undo
6595 6595
 		$Image = new Image($this->db);
6596 6596
 		$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    
6597 6597
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
6598
-                if ($olderthanmonths > 0) {
6599
-            		if ($globalDBdriver == 'mysql') {
6598
+				if ($olderthanmonths > 0) {
6599
+					if ($globalDBdriver == 'mysql') {
6600 6600
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6601 6601
 			} else {
6602 6602
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6603 6603
 			}
6604 6604
 		}
6605
-                if ($sincedate != '') {
6606
-            		if ($globalDBdriver == 'mysql') {
6605
+				if ($sincedate != '') {
6606
+					if ($globalDBdriver == 'mysql') {
6607 6607
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6608 6608
 			} else {
6609 6609
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6612,7 +6612,7 @@  discard block
 block discarded – undo
6612 6612
 
6613 6613
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6614 6614
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6615
-                $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";
6615
+				$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";
6616 6616
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6617 6617
 		
6618 6618
 		$sth = $this->db->prepare($query);
@@ -6644,26 +6644,26 @@  discard block
 block discarded – undo
6644 6644
 	
6645 6645
 	
6646 6646
 	/**
6647
-	* Gets all departure airports of the airplanes that have flown over
6648
-	*
6649
-	* @return Array the airport list
6650
-	*
6651
-	*/
6647
+	 * Gets all departure airports of the airplanes that have flown over
6648
+	 *
6649
+	 * @return Array the airport list
6650
+	 *
6651
+	 */
6652 6652
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6653 6653
 	{
6654 6654
 		global $globalDBdriver;
6655 6655
 		$filter_query = $this->getFilter($filters,true,true);
6656 6656
 		$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, airport.latitude, airport.longitude
6657 6657
 				FROM airport, spotter_output".$filter_query." airport.icao = spotter_output.departure_airport_icao AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
6658
-                if ($olderthanmonths > 0) {
6659
-            		if ($globalDBdriver == 'mysql') {
6658
+				if ($olderthanmonths > 0) {
6659
+					if ($globalDBdriver == 'mysql') {
6660 6660
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6661 6661
 			} else {
6662 6662
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6663 6663
 			}
6664
-                }
6665
-                if ($sincedate != '') {
6666
-            		if ($globalDBdriver == 'mysql') {
6664
+				}
6665
+				if ($sincedate != '') {
6666
+					if ($globalDBdriver == 'mysql') {
6667 6667
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6668 6668
 			} else {
6669 6669
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6697,7 +6697,7 @@  discard block
 block discarded – undo
6697 6697
 				$query_values = array_merge($query_values,array(':day' => $day));
6698 6698
 			}
6699 6699
 		}
6700
-                $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, airport.latitude, airport.longitude
6700
+				$query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, airport.latitude, airport.longitude
6701 6701
 				ORDER BY airport_departure_icao_count DESC";
6702 6702
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6703 6703
 
@@ -6721,35 +6721,35 @@  discard block
 block discarded – undo
6721 6721
 	}
6722 6722
 
6723 6723
 	/**
6724
-	* Gets all departure airports of the airplanes that have flown over
6725
-	*
6726
-	* @return Array the airport list
6727
-	*
6728
-	*/
6724
+	 * Gets all departure airports of the airplanes that have flown over
6725
+	 *
6726
+	 * @return Array the airport list
6727
+	 *
6728
+	 */
6729 6729
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6730 6730
 	{
6731 6731
 		global $globalDBdriver;
6732 6732
 		$filter_query = $this->getFilter($filters,true,true);
6733 6733
 		$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 
6734 6734
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' ";
6735
-                if ($olderthanmonths > 0) {
6736
-            		if ($globalDBdriver == 'mysql') {
6735
+				if ($olderthanmonths > 0) {
6736
+					if ($globalDBdriver == 'mysql') {
6737 6737
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6738 6738
 			} else {
6739 6739
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6740 6740
 			}
6741
-                }
6742
-                if ($sincedate != '') {
6743
-            		if ($globalDBdriver == 'mysql') {
6741
+				}
6742
+				if ($sincedate != '') {
6743
+					if ($globalDBdriver == 'mysql') {
6744 6744
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6745 6745
 			} else {
6746 6746
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6747 6747
 			}
6748 6748
 		}
6749 6749
 
6750
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6751
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6752
-                $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
6750
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6751
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6752
+				$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
6753 6753
 				ORDER BY airport_departure_icao_count DESC";
6754 6754
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6755 6755
       
@@ -6774,26 +6774,26 @@  discard block
 block discarded – undo
6774 6774
 	}
6775 6775
 
6776 6776
 	/**
6777
-	* Gets all detected departure airports of the airplanes that have flown over
6778
-	*
6779
-	* @return Array the airport list
6780
-	*
6781
-	*/
6777
+	 * Gets all detected departure airports of the airplanes that have flown over
6778
+	 *
6779
+	 * @return Array the airport list
6780
+	 *
6781
+	 */
6782 6782
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6783 6783
 	{
6784 6784
 		global $globalDBdriver;
6785 6785
 		$filter_query = $this->getFilter($filters,true,true);
6786 6786
 		$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, airport.latitude as departure_airport_latitude, airport.longitude as departure_airport_longitude
6787 6787
 				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";
6788
-                if ($olderthanmonths > 0) {
6789
-            		if ($globalDBdriver == 'mysql') {
6788
+				if ($olderthanmonths > 0) {
6789
+					if ($globalDBdriver == 'mysql') {
6790 6790
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6791 6791
 			} else {
6792 6792
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6793 6793
 			}
6794
-                }
6795
-                if ($sincedate != '') {
6796
-            		if ($globalDBdriver == 'mysql') {
6794
+				}
6795
+				if ($sincedate != '') {
6796
+					if ($globalDBdriver == 'mysql') {
6797 6797
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6798 6798
 			} else {
6799 6799
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -6827,10 +6827,10 @@  discard block
 block discarded – undo
6827 6827
 				$query_values = array_merge($query_values,array(':day' => $day));
6828 6828
 			}
6829 6829
 		}
6830
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country, airport.latitude, airport.longitude
6830
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country, airport.latitude, airport.longitude
6831 6831
 				ORDER BY airport_departure_icao_count DESC";
6832 6832
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6833
-    		//echo $query;
6833
+			//echo $query;
6834 6834
 		$sth = $this->db->prepare($query);
6835 6835
 		$sth->execute($query_values);
6836 6836
       
@@ -6853,35 +6853,35 @@  discard block
 block discarded – undo
6853 6853
 	}
6854 6854
 	
6855 6855
 	/**
6856
-	* Gets all detected departure airports of the airplanes that have flown over
6857
-	*
6858
-	* @return Array the airport list
6859
-	*
6860
-	*/
6856
+	 * Gets all detected departure airports of the airplanes that have flown over
6857
+	 *
6858
+	 * @return Array the airport list
6859
+	 *
6860
+	 */
6861 6861
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6862 6862
 	{
6863 6863
 		global $globalDBdriver;
6864 6864
 		$filter_query = $this->getFilter($filters,true,true);
6865 6865
 		$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
6866 6866
 				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 ";
6867
-                if ($olderthanmonths > 0) {
6868
-            		if ($globalDBdriver == 'mysql') {
6867
+				if ($olderthanmonths > 0) {
6868
+					if ($globalDBdriver == 'mysql') {
6869 6869
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6870 6870
 			} else {
6871 6871
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6872 6872
 			}
6873
-                }
6874
-                if ($sincedate != '') {
6875
-            		if ($globalDBdriver == 'mysql') {
6873
+				}
6874
+				if ($sincedate != '') {
6875
+					if ($globalDBdriver == 'mysql') {
6876 6876
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6877 6877
 			} else {
6878 6878
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
6879 6879
 			}
6880 6880
 		}
6881 6881
 
6882
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6883
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6884
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6882
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6883
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6884
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
6885 6885
 				ORDER BY airport_departure_icao_count DESC";
6886 6886
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
6887 6887
       
@@ -6906,11 +6906,11 @@  discard block
 block discarded – undo
6906 6906
 	}	
6907 6907
 	
6908 6908
 	/**
6909
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
6910
-	*
6911
-	* @return Array the airport list
6912
-	*
6913
-	*/
6909
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
6910
+	 *
6911
+	 * @return Array the airport list
6912
+	 *
6913
+	 */
6914 6914
 	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
6915 6915
 	{
6916 6916
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6944,11 +6944,11 @@  discard block
 block discarded – undo
6944 6944
 	
6945 6945
 	
6946 6946
 	/**
6947
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
6948
-	*
6949
-	* @return Array the airport list
6950
-	*
6951
-	*/
6947
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
6948
+	 *
6949
+	 * @return Array the airport list
6950
+	 *
6951
+	 */
6952 6952
 	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
6953 6953
 	{
6954 6954
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6977,11 +6977,11 @@  discard block
 block discarded – undo
6977 6977
 	
6978 6978
 	
6979 6979
 	/**
6980
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
6981
-	*
6982
-	* @return Array the airport list
6983
-	*
6984
-	*/
6980
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
6981
+	 *
6982
+	 * @return Array the airport list
6983
+	 *
6984
+	 */
6985 6985
 	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
6986 6986
 	{
6987 6987
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7014,11 +7014,11 @@  discard block
 block discarded – undo
7014 7014
 	
7015 7015
 	
7016 7016
 	/**
7017
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7018
-	*
7019
-	* @return Array the airport list
7020
-	*
7021
-	*/
7017
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7018
+	 *
7019
+	 * @return Array the airport list
7020
+	 *
7021
+	 */
7022 7022
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
7023 7023
 	{
7024 7024
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7048,11 +7048,11 @@  discard block
 block discarded – undo
7048 7048
 	
7049 7049
 	
7050 7050
 	/**
7051
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
7052
-	*
7053
-	* @return Array the airport list
7054
-	*
7055
-	*/
7051
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
7052
+	 *
7053
+	 * @return Array the airport list
7054
+	 *
7055
+	 */
7056 7056
 	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
7057 7057
 	{
7058 7058
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7085,11 +7085,11 @@  discard block
 block discarded – undo
7085 7085
 	
7086 7086
 	
7087 7087
 	/**
7088
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
7089
-	*
7090
-	* @return Array the airport list
7091
-	*
7092
-	*/
7088
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
7089
+	 *
7090
+	 * @return Array the airport list
7091
+	 *
7092
+	 */
7093 7093
 	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
7094 7094
 	{
7095 7095
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7119,11 +7119,11 @@  discard block
 block discarded – undo
7119 7119
 	
7120 7120
 	
7121 7121
 	/**
7122
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
7123
-	*
7124
-	* @return Array the airport list
7125
-	*
7126
-	*/
7122
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
7123
+	 *
7124
+	 * @return Array the airport list
7125
+	 *
7126
+	 */
7127 7127
 	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
7128 7128
 	{
7129 7129
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7156,11 +7156,11 @@  discard block
 block discarded – undo
7156 7156
 	
7157 7157
 	
7158 7158
 	/**
7159
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
7160
-	*
7161
-	* @return Array the airport list
7162
-	*
7163
-	*/
7159
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
7160
+	 *
7161
+	 * @return Array the airport list
7162
+	 *
7163
+	 */
7164 7164
 	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
7165 7165
 	{
7166 7166
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7189,11 +7189,11 @@  discard block
 block discarded – undo
7189 7189
 	
7190 7190
 	
7191 7191
 	/**
7192
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
7193
-	*
7194
-	* @return Array the airport list
7195
-	*
7196
-	*/
7192
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
7193
+	 *
7194
+	 * @return Array the airport list
7195
+	 *
7196
+	 */
7197 7197
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
7198 7198
 	{
7199 7199
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7226,11 +7226,11 @@  discard block
 block discarded – undo
7226 7226
 	
7227 7227
 	
7228 7228
 	/**
7229
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
7230
-	*
7231
-	* @return Array the airport list
7232
-	*
7233
-	*/
7229
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
7230
+	 *
7231
+	 * @return Array the airport list
7232
+	 *
7233
+	 */
7234 7234
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
7235 7235
 	{
7236 7236
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7260,11 +7260,11 @@  discard block
 block discarded – undo
7260 7260
 	
7261 7261
 	
7262 7262
 	/**
7263
-	* Gets all departure airports of the airplanes that have flown over based on a date
7264
-	*
7265
-	* @return Array the airport list
7266
-	*
7267
-	*/
7263
+	 * Gets all departure airports of the airplanes that have flown over based on a date
7264
+	 *
7265
+	 * @return Array the airport list
7266
+	 *
7267
+	 */
7268 7268
 	public function countAllDepartureAirportsByDate($date,$filters = array())
7269 7269
 	{
7270 7270
 		global $globalTimezone, $globalDBdriver;
@@ -7310,11 +7310,11 @@  discard block
 block discarded – undo
7310 7310
 	
7311 7311
 	
7312 7312
 	/**
7313
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
7314
-	*
7315
-	* @return Array the airport list
7316
-	*
7317
-	*/
7313
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
7314
+	 *
7315
+	 * @return Array the airport list
7316
+	 *
7317
+	 */
7318 7318
 	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
7319 7319
 	{
7320 7320
 		global $globalTimezone, $globalDBdriver;
@@ -7357,11 +7357,11 @@  discard block
 block discarded – undo
7357 7357
 	
7358 7358
 	
7359 7359
 	/**
7360
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
7361
-	*
7362
-	* @return Array the airport list
7363
-	*
7364
-	*/
7360
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
7361
+	 *
7362
+	 * @return Array the airport list
7363
+	 *
7364
+	 */
7365 7365
 	public function countAllDepartureAirportsByIdent($ident,$filters = array())
7366 7366
 	{
7367 7367
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7393,11 +7393,11 @@  discard block
 block discarded – undo
7393 7393
 	}
7394 7394
 	
7395 7395
 	/**
7396
-	* Gets all departure airports of the airplanes that have flown over based on a owner
7397
-	*
7398
-	* @return Array the airport list
7399
-	*
7400
-	*/
7396
+	 * Gets all departure airports of the airplanes that have flown over based on a owner
7397
+	 *
7398
+	 * @return Array the airport list
7399
+	 *
7400
+	 */
7401 7401
 	public function countAllDepartureAirportsByOwner($owner,$filters = array())
7402 7402
 	{
7403 7403
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7429,11 +7429,11 @@  discard block
 block discarded – undo
7429 7429
 	}
7430 7430
 	
7431 7431
 	/**
7432
-	* Gets all departure airports of the airplanes that have flown over based on a pilot
7433
-	*
7434
-	* @return Array the airport list
7435
-	*
7436
-	*/
7432
+	 * Gets all departure airports of the airplanes that have flown over based on a pilot
7433
+	 *
7434
+	 * @return Array the airport list
7435
+	 *
7436
+	 */
7437 7437
 	public function countAllDepartureAirportsByPilot($pilot,$filters = array())
7438 7438
 	{
7439 7439
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7466,11 +7466,11 @@  discard block
 block discarded – undo
7466 7466
 	
7467 7467
 	
7468 7468
 	/**
7469
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
7470
-	*
7471
-	* @return Array the airport list
7472
-	*
7473
-	*/
7469
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
7470
+	 *
7471
+	 * @return Array the airport list
7472
+	 *
7473
+	 */
7474 7474
 	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
7475 7475
 	{
7476 7476
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7499,11 +7499,11 @@  discard block
 block discarded – undo
7499 7499
 	}
7500 7500
 	
7501 7501
 	/**
7502
-	* Gets all departure airports by country of the airplanes that have flown over based on owner
7503
-	*
7504
-	* @return Array the airport list
7505
-	*
7506
-	*/
7502
+	 * Gets all departure airports by country of the airplanes that have flown over based on owner
7503
+	 *
7504
+	 * @return Array the airport list
7505
+	 *
7506
+	 */
7507 7507
 	public function countAllDepartureAirportCountriesByOwner($owner,$filters = array())
7508 7508
 	{
7509 7509
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7519,11 +7519,11 @@  discard block
 block discarded – undo
7519 7519
 	}
7520 7520
 	
7521 7521
 	/**
7522
-	* Gets all departure airports by country of the airplanes that have flown over based on pilot
7523
-	*
7524
-	* @return Array the airport list
7525
-	*
7526
-	*/
7522
+	 * Gets all departure airports by country of the airplanes that have flown over based on pilot
7523
+	 *
7524
+	 * @return Array the airport list
7525
+	 *
7526
+	 */
7527 7527
 	public function countAllDepartureAirportCountriesByPilot($pilot,$filters = array())
7528 7528
 	{
7529 7529
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7541,11 +7541,11 @@  discard block
 block discarded – undo
7541 7541
 	
7542 7542
 	
7543 7543
 	/**
7544
-	* Gets all departure airports of the airplanes that have flown over based on a country
7545
-	*
7546
-	* @return Array the airport list
7547
-	*
7548
-	*/
7544
+	 * Gets all departure airports of the airplanes that have flown over based on a country
7545
+	 *
7546
+	 * @return Array the airport list
7547
+	 *
7548
+	 */
7549 7549
 	public function countAllDepartureAirportsByCountry($country,$filters = array())
7550 7550
 	{
7551 7551
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7579,11 +7579,11 @@  discard block
 block discarded – undo
7579 7579
 
7580 7580
 
7581 7581
 	/**
7582
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7583
-	*
7584
-	* @return Array the airport list
7585
-	*
7586
-	*/
7582
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
7583
+	 *
7584
+	 * @return Array the airport list
7585
+	 *
7586
+	 */
7587 7587
 	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
7588 7588
 	{
7589 7589
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7613,31 +7613,31 @@  discard block
 block discarded – undo
7613 7613
 	
7614 7614
 
7615 7615
 	/**
7616
-	* Gets all arrival airports of the airplanes that have flown over
7617
-	*
7618
-	* @param Boolean $limit Limit result to 10 or not
7619
-	* @param Integer $olderthanmonths Only show result older than x months
7620
-	* @param String $sincedate Only show result since x date
7621
-	* @param Boolean $icaoaskey Show result by ICAO
7622
-	* @param Array $filters Filter used here
7623
-	* @return Array the airport list
7624
-	*
7625
-	*/
7616
+	 * Gets all arrival airports of the airplanes that have flown over
7617
+	 *
7618
+	 * @param Boolean $limit Limit result to 10 or not
7619
+	 * @param Integer $olderthanmonths Only show result older than x months
7620
+	 * @param String $sincedate Only show result since x date
7621
+	 * @param Boolean $icaoaskey Show result by ICAO
7622
+	 * @param Array $filters Filter used here
7623
+	 * @return Array the airport list
7624
+	 *
7625
+	 */
7626 7626
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7627 7627
 	{
7628 7628
 		global $globalDBdriver;
7629 7629
 		$filter_query = $this->getFilter($filters,true,true);
7630 7630
 		$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, airport.latitude as arrival_airport_latitude, airport.longitude as arrival_airport_longitude 
7631 7631
 				FROM airport, spotter_output".$filter_query." airport.icao = spotter_output.arrival_airport_icao AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
7632
-                if ($olderthanmonths > 0) {
7633
-            		if ($globalDBdriver == 'mysql') {
7632
+				if ($olderthanmonths > 0) {
7633
+					if ($globalDBdriver == 'mysql') {
7634 7634
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
7635 7635
 			} else {
7636 7636
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7637 7637
 			}
7638 7638
 		}
7639
-                if ($sincedate != '') {
7640
-            		if ($globalDBdriver == 'mysql') {
7639
+				if ($sincedate != '') {
7640
+					if ($globalDBdriver == 'mysql') {
7641 7641
 				$query .= " AND spotter_output.date > '".$sincedate."'";
7642 7642
 			} else {
7643 7643
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -7671,7 +7671,7 @@  discard block
 block discarded – undo
7671 7671
 				$query_values = array_merge($query_values,array(':day' => $day));
7672 7672
 			}
7673 7673
 		}
7674
-                $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, airport.latitude, airport.longitude
7674
+				$query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, airport.latitude, airport.longitude
7675 7675
 					ORDER BY airport_arrival_icao_count DESC";
7676 7676
 		if ($limit) $query .= " LIMIT 10";
7677 7677
       
@@ -7702,35 +7702,35 @@  discard block
 block discarded – undo
7702 7702
 	}
7703 7703
 
7704 7704
 	/**
7705
-	* Gets all arrival airports of the airplanes that have flown over
7706
-	*
7707
-	* @return Array the airport list
7708
-	*
7709
-	*/
7705
+	 * Gets all arrival airports of the airplanes that have flown over
7706
+	 *
7707
+	 * @return Array the airport list
7708
+	 *
7709
+	 */
7710 7710
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
7711 7711
 	{
7712 7712
 		global $globalDBdriver;
7713 7713
 		$filter_query = $this->getFilter($filters,true,true);
7714 7714
 		$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, country.iso3 AS arrival_airport_country_iso3 
7715 7715
 			FROM countries,spotter_output".$filter_query." countries.name = spotter_output.arrival_airport_country AND spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' ";
7716
-                if ($olderthanmonths > 0) {
7717
-            		if ($globalDBdriver == 'mysql') {
7716
+				if ($olderthanmonths > 0) {
7717
+					if ($globalDBdriver == 'mysql') {
7718 7718
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
7719 7719
 			} else {
7720 7720
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7721 7721
 			}
7722 7722
 		}
7723
-                if ($sincedate != '') {
7724
-            		if ($globalDBdriver == 'mysql') {
7723
+				if ($sincedate != '') {
7724
+					if ($globalDBdriver == 'mysql') {
7725 7725
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
7726 7726
 			} else {
7727 7727
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7728 7728
 			}
7729 7729
 		}
7730 7730
 
7731
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7732
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7733
-                $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, countries.iso3
7731
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7732
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7733
+				$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, countries.iso3
7734 7734
 					ORDER BY airport_arrival_icao_count DESC";
7735 7735
 		if ($limit) $query .= " LIMIT 10";
7736 7736
       
@@ -7762,26 +7762,26 @@  discard block
 block discarded – undo
7762 7762
 
7763 7763
 
7764 7764
 	/**
7765
-	* Gets all detected arrival airports of the airplanes that have flown over
7766
-	*
7767
-	* @return Array the airport list
7768
-	*
7769
-	*/
7765
+	 * Gets all detected arrival airports of the airplanes that have flown over
7766
+	 *
7767
+	 * @return Array the airport list
7768
+	 *
7769
+	 */
7770 7770
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7771 7771
 	{
7772 7772
 		global $globalDBdriver;
7773 7773
 		$filter_query = $this->getFilter($filters,true,true);
7774 7774
 		$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, airport.latitude AS arrival_airport_latitude, airport.longitude AS arrival_airport_longitude 
7775 7775
 			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";
7776
-                if ($olderthanmonths > 0) {
7777
-            		if ($globalDBdriver == 'mysql') {
7776
+				if ($olderthanmonths > 0) {
7777
+					if ($globalDBdriver == 'mysql') {
7778 7778
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
7779 7779
 			} else {
7780 7780
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7781 7781
 			}
7782 7782
 		}
7783
-                if ($sincedate != '') {
7784
-            		if ($globalDBdriver == 'mysql') {
7783
+				if ($sincedate != '') {
7784
+					if ($globalDBdriver == 'mysql') {
7785 7785
 				$query .= " AND spotter_output.date > '".$sincedate."'";
7786 7786
 			} else {
7787 7787
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -7843,35 +7843,35 @@  discard block
 block discarded – undo
7843 7843
 	}
7844 7844
 	
7845 7845
 	/**
7846
-	* Gets all detected arrival airports of the airplanes that have flown over
7847
-	*
7848
-	* @return Array the airport list
7849
-	*
7850
-	*/
7846
+	 * Gets all detected arrival airports of the airplanes that have flown over
7847
+	 *
7848
+	 * @return Array the airport list
7849
+	 *
7850
+	 */
7851 7851
 	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
7852 7852
 	{
7853 7853
 		global $globalDBdriver;
7854 7854
 		$filter_query = $this->getFilter($filters,true,true);
7855 7855
 		$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 
7856 7856
 			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 ";
7857
-                if ($olderthanmonths > 0) {
7858
-            		if ($globalDBdriver == 'mysql') {
7857
+				if ($olderthanmonths > 0) {
7858
+					if ($globalDBdriver == 'mysql') {
7859 7859
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
7860 7860
 			} else {
7861 7861
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7862 7862
 			}
7863 7863
 		}
7864
-                if ($sincedate != '') {
7865
-            		if ($globalDBdriver == 'mysql') {
7864
+				if ($sincedate != '') {
7865
+					if ($globalDBdriver == 'mysql') {
7866 7866
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
7867 7867
 			} else {
7868 7868
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7869 7869
 			}
7870 7870
 		}
7871 7871
 
7872
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7873
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7874
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7872
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7873
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
7874
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
7875 7875
 					ORDER BY airport_arrival_icao_count DESC";
7876 7876
 		if ($limit) $query .= " LIMIT 10";
7877 7877
       
@@ -7901,11 +7901,11 @@  discard block
 block discarded – undo
7901 7901
 	}	
7902 7902
 	
7903 7903
 	/**
7904
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
7905
-	*
7906
-	* @return Array the airport list
7907
-	*
7908
-	*/
7904
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
7905
+	 *
7906
+	 * @return Array the airport list
7907
+	 *
7908
+	 */
7909 7909
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
7910 7910
 	{
7911 7911
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7937,11 +7937,11 @@  discard block
 block discarded – undo
7937 7937
 	
7938 7938
 	
7939 7939
 	/**
7940
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
7941
-	*
7942
-	* @return Array the airport list
7943
-	*
7944
-	*/
7940
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
7941
+	 *
7942
+	 * @return Array the airport list
7943
+	 *
7944
+	 */
7945 7945
 	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
7946 7946
 	{
7947 7947
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7971,11 +7971,11 @@  discard block
 block discarded – undo
7971 7971
 	
7972 7972
 	
7973 7973
 	/**
7974
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
7975
-	*
7976
-	* @return Array the airport list
7977
-	*
7978
-	*/
7974
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
7975
+	 *
7976
+	 * @return Array the airport list
7977
+	 *
7978
+	 */
7979 7979
 	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
7980 7980
 	{
7981 7981
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8009,11 +8009,11 @@  discard block
 block discarded – undo
8009 8009
 	
8010 8010
 	
8011 8011
 	/**
8012
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
8013
-	*
8014
-	* @return Array the airport list
8015
-	*
8016
-	*/
8012
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
8013
+	 *
8014
+	 * @return Array the airport list
8015
+	 *
8016
+	 */
8017 8017
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
8018 8018
 	{
8019 8019
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8043,11 +8043,11 @@  discard block
 block discarded – undo
8043 8043
 	
8044 8044
 	
8045 8045
 	/**
8046
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
8047
-	*
8048
-	* @return Array the airport list
8049
-	*
8050
-	*/
8046
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
8047
+	 *
8048
+	 * @return Array the airport list
8049
+	 *
8050
+	 */
8051 8051
 	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
8052 8052
 	{
8053 8053
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8081,11 +8081,11 @@  discard block
 block discarded – undo
8081 8081
 	
8082 8082
 	
8083 8083
 	/**
8084
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
8085
-	*
8086
-	* @return Array the airport list
8087
-	*
8088
-	*/
8084
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
8085
+	 *
8086
+	 * @return Array the airport list
8087
+	 *
8088
+	 */
8089 8089
 	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
8090 8090
 	{
8091 8091
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8116,11 +8116,11 @@  discard block
 block discarded – undo
8116 8116
 	
8117 8117
 	
8118 8118
 	/**
8119
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
8120
-	*
8121
-	* @return Array the airport list
8122
-	*
8123
-	*/
8119
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
8120
+	 *
8121
+	 * @return Array the airport list
8122
+	 *
8123
+	 */
8124 8124
 	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
8125 8125
 	{
8126 8126
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8153,11 +8153,11 @@  discard block
 block discarded – undo
8153 8153
 	
8154 8154
 	
8155 8155
 	/**
8156
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
8157
-	*
8158
-	* @return Array the airport list
8159
-	*
8160
-	*/
8156
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
8157
+	 *
8158
+	 * @return Array the airport list
8159
+	 *
8160
+	 */
8161 8161
 	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
8162 8162
 	{
8163 8163
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8185,11 +8185,11 @@  discard block
 block discarded – undo
8185 8185
 	
8186 8186
 	
8187 8187
 	/**
8188
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
8189
-	*
8190
-	* @return Array the airport list
8191
-	*
8192
-	*/
8188
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
8189
+	 *
8190
+	 * @return Array the airport list
8191
+	 *
8192
+	 */
8193 8193
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
8194 8194
 	{
8195 8195
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8223,11 +8223,11 @@  discard block
 block discarded – undo
8223 8223
 	
8224 8224
 	
8225 8225
 	/**
8226
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
8227
-	*
8228
-	* @return Array the airport list
8229
-	*
8230
-	*/
8226
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
8227
+	 *
8228
+	 * @return Array the airport list
8229
+	 *
8230
+	 */
8231 8231
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
8232 8232
 	{
8233 8233
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8258,11 +8258,11 @@  discard block
 block discarded – undo
8258 8258
 	
8259 8259
 	
8260 8260
 	/**
8261
-	* Gets all arrival airports of the airplanes that have flown over based on a date
8262
-	*
8263
-	* @return Array the airport list
8264
-	*
8265
-	*/
8261
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
8262
+	 *
8263
+	 * @return Array the airport list
8264
+	 *
8265
+	 */
8266 8266
 	public function countAllArrivalAirportsByDate($date,$filters = array())
8267 8267
 	{
8268 8268
 		global $globalTimezone, $globalDBdriver;
@@ -8308,11 +8308,11 @@  discard block
 block discarded – undo
8308 8308
 	
8309 8309
 	
8310 8310
 	/**
8311
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
8312
-	*
8313
-	* @return Array the airport list
8314
-	*
8315
-	*/
8311
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
8312
+	 *
8313
+	 * @return Array the airport list
8314
+	 *
8315
+	 */
8316 8316
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
8317 8317
 	{
8318 8318
 		global $globalTimezone, $globalDBdriver;
@@ -8355,11 +8355,11 @@  discard block
 block discarded – undo
8355 8355
 	
8356 8356
 	
8357 8357
 	/**
8358
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
8359
-	*
8360
-	* @return Array the airport list
8361
-	*
8362
-	*/
8358
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
8359
+	 *
8360
+	 * @return Array the airport list
8361
+	 *
8362
+	 */
8363 8363
 	public function countAllArrivalAirportsByIdent($ident,$filters = array())
8364 8364
 	{
8365 8365
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8391,11 +8391,11 @@  discard block
 block discarded – undo
8391 8391
 	}
8392 8392
 	
8393 8393
 	/**
8394
-	* Gets all arrival airports of the airplanes that have flown over based on a owner
8395
-	*
8396
-	* @return Array the airport list
8397
-	*
8398
-	*/
8394
+	 * Gets all arrival airports of the airplanes that have flown over based on a owner
8395
+	 *
8396
+	 * @return Array the airport list
8397
+	 *
8398
+	 */
8399 8399
 	public function countAllArrivalAirportsByOwner($owner,$filters = array())
8400 8400
 	{
8401 8401
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8426,11 +8426,11 @@  discard block
 block discarded – undo
8426 8426
 	}
8427 8427
 
8428 8428
 	/**
8429
-	* Gets all arrival airports of the airplanes that have flown over based on a pilot
8430
-	*
8431
-	* @return Array the airport list
8432
-	*
8433
-	*/
8429
+	 * Gets all arrival airports of the airplanes that have flown over based on a pilot
8430
+	 *
8431
+	 * @return Array the airport list
8432
+	 *
8433
+	 */
8434 8434
 	public function countAllArrivalAirportsByPilot($pilot,$filters = array())
8435 8435
 	{
8436 8436
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8461,11 +8461,11 @@  discard block
 block discarded – undo
8461 8461
 	}
8462 8462
 	
8463 8463
 	/**
8464
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
8465
-	*
8466
-	* @return Array the airport list
8467
-	*
8468
-	*/
8464
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
8465
+	 *
8466
+	 * @return Array the airport list
8467
+	 *
8468
+	 */
8469 8469
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
8470 8470
 	{
8471 8471
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8494,11 +8494,11 @@  discard block
 block discarded – undo
8494 8494
 	}
8495 8495
 	
8496 8496
 	/**
8497
-	* Gets all arrival airports by country of the airplanes that have flown over based on a owner
8498
-	*
8499
-	* @return Array the airport list
8500
-	*
8501
-	*/
8497
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a owner
8498
+	 *
8499
+	 * @return Array the airport list
8500
+	 *
8501
+	 */
8502 8502
 	public function countAllArrivalAirportCountriesByOwner($owner, $filters = array())
8503 8503
 	{
8504 8504
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8514,11 +8514,11 @@  discard block
 block discarded – undo
8514 8514
 	}
8515 8515
 	
8516 8516
 	/**
8517
-	* Gets all arrival airports by country of the airplanes that have flown over based on a pilot
8518
-	*
8519
-	* @return Array the airport list
8520
-	*
8521
-	*/
8517
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a pilot
8518
+	 *
8519
+	 * @return Array the airport list
8520
+	 *
8521
+	 */
8522 8522
 	public function countAllArrivalAirportCountriesByPilot($pilot, $filters = array())
8523 8523
 	{
8524 8524
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8536,11 +8536,11 @@  discard block
 block discarded – undo
8536 8536
 	
8537 8537
 	
8538 8538
 	/**
8539
-	* Gets all arrival airports of the airplanes that have flown over based on a country
8540
-	*
8541
-	* @return Array the airport list
8542
-	*
8543
-	*/
8539
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
8540
+	 *
8541
+	 * @return Array the airport list
8542
+	 *
8543
+	 */
8544 8544
 	public function countAllArrivalAirportsByCountry($country,$filters = array())
8545 8545
 	{
8546 8546
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8573,11 +8573,11 @@  discard block
 block discarded – undo
8573 8573
 	
8574 8574
 	
8575 8575
 	/**
8576
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
8577
-	*
8578
-	* @return Array the airport list
8579
-	*
8580
-	*/
8576
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
8577
+	 *
8578
+	 * @return Array the airport list
8579
+	 *
8580
+	 */
8581 8581
 	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
8582 8582
 	{
8583 8583
 		global $globalDBdriver;
@@ -8609,11 +8609,11 @@  discard block
 block discarded – undo
8609 8609
 
8610 8610
 
8611 8611
 	/**
8612
-	* Counts all airport departure countries
8613
-	*
8614
-	* @return Array the airport departure list
8615
-	*
8616
-	*/
8612
+	 * Counts all airport departure countries
8613
+	 *
8614
+	 * @return Array the airport departure list
8615
+	 *
8616
+	 */
8617 8617
 	public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '')
8618 8618
 	{
8619 8619
 		global $globalDBdriver;
@@ -8672,11 +8672,11 @@  discard block
 block discarded – undo
8672 8672
 	
8673 8673
 	
8674 8674
 	/**
8675
-	* Counts all airport arrival countries
8676
-	*
8677
-	* @return Array the airport arrival list
8678
-	*
8679
-	*/
8675
+	 * Counts all airport arrival countries
8676
+	 *
8677
+	 * @return Array the airport arrival list
8678
+	 *
8679
+	 */
8680 8680
 	public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '')
8681 8681
 	{
8682 8682
 		global $globalDBdriver;
@@ -8739,11 +8739,11 @@  discard block
 block discarded – undo
8739 8739
 
8740 8740
 
8741 8741
 	/**
8742
-	* Gets all route combinations
8743
-	*
8744
-	* @return Array the route list
8745
-	*
8746
-	*/
8742
+	 * Gets all route combinations
8743
+	 *
8744
+	 * @return Array the route list
8745
+	 *
8746
+	 */
8747 8747
 	public function countAllRoutes($filters = array())
8748 8748
 	{
8749 8749
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8782,11 +8782,11 @@  discard block
 block discarded – undo
8782 8782
 	
8783 8783
 	
8784 8784
 	/**
8785
-	* Gets all route combinations based on an aircraft
8786
-	*
8787
-	* @return Array the route list
8788
-	*
8789
-	*/
8785
+	 * Gets all route combinations based on an aircraft
8786
+	 *
8787
+	 * @return Array the route list
8788
+	 *
8789
+	 */
8790 8790
 	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
8791 8791
 	{
8792 8792
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8822,11 +8822,11 @@  discard block
 block discarded – undo
8822 8822
 	
8823 8823
 	
8824 8824
 	/**
8825
-	* Gets all route combinations based on an aircraft registration
8826
-	*
8827
-	* @return Array the route list
8828
-	*
8829
-	*/
8825
+	 * Gets all route combinations based on an aircraft registration
8826
+	 *
8827
+	 * @return Array the route list
8828
+	 *
8829
+	 */
8830 8830
 	public function countAllRoutesByRegistration($registration, $filters = array())
8831 8831
 	{
8832 8832
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8864,11 +8864,11 @@  discard block
 block discarded – undo
8864 8864
 	
8865 8865
 	
8866 8866
 	/**
8867
-	* Gets all route combinations based on an airline
8868
-	*
8869
-	* @return Array the route list
8870
-	*
8871
-	*/
8867
+	 * Gets all route combinations based on an airline
8868
+	 *
8869
+	 * @return Array the route list
8870
+	 *
8871
+	 */
8872 8872
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
8873 8873
 	{
8874 8874
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8906,11 +8906,11 @@  discard block
 block discarded – undo
8906 8906
 	
8907 8907
 	
8908 8908
 	/**
8909
-	* Gets all route combinations based on an airport
8910
-	*
8911
-	* @return Array the route list
8912
-	*
8913
-	*/
8909
+	 * Gets all route combinations based on an airport
8910
+	 *
8911
+	 * @return Array the route list
8912
+	 *
8913
+	 */
8914 8914
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
8915 8915
 	{
8916 8916
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8947,11 +8947,11 @@  discard block
 block discarded – undo
8947 8947
 	
8948 8948
 	
8949 8949
 	/**
8950
-	* Gets all route combinations based on an country
8951
-	*
8952
-	* @return Array the route list
8953
-	*
8954
-	*/
8950
+	 * Gets all route combinations based on an country
8951
+	 *
8952
+	 * @return Array the route list
8953
+	 *
8954
+	 */
8955 8955
 	public function countAllRoutesByCountry($country, $filters = array())
8956 8956
 	{
8957 8957
 		$filter_query = $this->getFilter($filters,true,true);
@@ -8987,11 +8987,11 @@  discard block
 block discarded – undo
8987 8987
 
8988 8988
 
8989 8989
 	/**
8990
-	* Gets all route combinations based on an date
8991
-	*
8992
-	* @return Array the route list
8993
-	*
8994
-	*/
8990
+	 * Gets all route combinations based on an date
8991
+	 *
8992
+	 * @return Array the route list
8993
+	 *
8994
+	 */
8995 8995
 	public function countAllRoutesByDate($date, $filters = array())
8996 8996
 	{
8997 8997
 		global $globalTimezone, $globalDBdriver;
@@ -9041,11 +9041,11 @@  discard block
 block discarded – undo
9041 9041
 	
9042 9042
 	
9043 9043
 	/**
9044
-	* Gets all route combinations based on an ident/callsign
9045
-	*
9046
-	* @return Array the route list
9047
-	*
9048
-	*/
9044
+	 * Gets all route combinations based on an ident/callsign
9045
+	 *
9046
+	 * @return Array the route list
9047
+	 *
9048
+	 */
9049 9049
 	public function countAllRoutesByIdent($ident, $filters = array())
9050 9050
 	{
9051 9051
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9081,11 +9081,11 @@  discard block
 block discarded – undo
9081 9081
 	}
9082 9082
 	
9083 9083
 	/**
9084
-	* Gets all route combinations based on an owner
9085
-	*
9086
-	* @return Array the route list
9087
-	*
9088
-	*/
9084
+	 * Gets all route combinations based on an owner
9085
+	 *
9086
+	 * @return Array the route list
9087
+	 *
9088
+	 */
9089 9089
 	public function countAllRoutesByOwner($owner,$filters = array())
9090 9090
 	{
9091 9091
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9121,11 +9121,11 @@  discard block
 block discarded – undo
9121 9121
 	}
9122 9122
 	
9123 9123
 	/**
9124
-	* Gets all route combinations based on a pilot
9125
-	*
9126
-	* @return Array the route list
9127
-	*
9128
-	*/
9124
+	 * Gets all route combinations based on a pilot
9125
+	 *
9126
+	 * @return Array the route list
9127
+	 *
9128
+	 */
9129 9129
 	public function countAllRoutesByPilot($pilot,$filters = array())
9130 9130
 	{
9131 9131
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9162,11 +9162,11 @@  discard block
 block discarded – undo
9162 9162
 	
9163 9163
 	
9164 9164
 	/**
9165
-	* Gets all route combinations based on an manufacturer
9166
-	*
9167
-	* @return Array the route list
9168
-	*
9169
-	*/
9165
+	 * Gets all route combinations based on an manufacturer
9166
+	 *
9167
+	 * @return Array the route list
9168
+	 *
9169
+	 */
9170 9170
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
9171 9171
 	{
9172 9172
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9204,11 +9204,11 @@  discard block
 block discarded – undo
9204 9204
 	
9205 9205
 	
9206 9206
 	/**
9207
-	* Gets all route combinations with waypoints
9208
-	*
9209
-	* @return Array the route list
9210
-	*
9211
-	*/
9207
+	 * Gets all route combinations with waypoints
9208
+	 *
9209
+	 * @return Array the route list
9210
+	 *
9211
+	 */
9212 9212
 	public function countAllRoutesWithWaypoints($filters = array())
9213 9213
 	{
9214 9214
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9245,11 +9245,11 @@  discard block
 block discarded – undo
9245 9245
 	}
9246 9246
 	
9247 9247
 	/**
9248
-	* Gets all callsigns that have flown over
9249
-	*
9250
-	* @return Array the callsign list
9251
-	*
9252
-	*/
9248
+	 * Gets all callsigns that have flown over
9249
+	 *
9250
+	 * @return Array the callsign list
9251
+	 *
9252
+	 */
9253 9253
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
9254 9254
 	{
9255 9255
 		global $globalDBdriver;
@@ -9315,11 +9315,11 @@  discard block
 block discarded – undo
9315 9315
 	}
9316 9316
 
9317 9317
 	/**
9318
-	* Gets all callsigns that have flown over
9319
-	*
9320
-	* @return Array the callsign list
9321
-	*
9322
-	*/
9318
+	 * Gets all callsigns that have flown over
9319
+	 *
9320
+	 * @return Array the callsign list
9321
+	 *
9322
+	 */
9323 9323
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
9324 9324
 	{
9325 9325
 		global $globalDBdriver;
@@ -9360,11 +9360,11 @@  discard block
 block discarded – undo
9360 9360
 
9361 9361
 
9362 9362
 	/**
9363
-	* Counts all dates
9364
-	*
9365
-	* @return Array the date list
9366
-	*
9367
-	*/
9363
+	 * Counts all dates
9364
+	 *
9365
+	 * @return Array the date list
9366
+	 *
9367
+	 */
9368 9368
 	public function countAllDates($filters = array())
9369 9369
 	{
9370 9370
 		global $globalTimezone, $globalDBdriver;
@@ -9409,11 +9409,11 @@  discard block
 block discarded – undo
9409 9409
 	}
9410 9410
 	
9411 9411
 	/**
9412
-	* Counts all dates
9413
-	*
9414
-	* @return Array the date list
9415
-	*
9416
-	*/
9412
+	 * Counts all dates
9413
+	 *
9414
+	 * @return Array the date list
9415
+	 *
9416
+	 */
9417 9417
 	public function countAllDatesByAirlines($filters = array())
9418 9418
 	{
9419 9419
 		global $globalTimezone, $globalDBdriver;
@@ -9458,11 +9458,11 @@  discard block
 block discarded – undo
9458 9458
 	}	
9459 9459
 	
9460 9460
 	/**
9461
-	* Counts all dates during the last 7 days
9462
-	*
9463
-	* @return Array the date list
9464
-	*
9465
-	*/
9461
+	 * Counts all dates during the last 7 days
9462
+	 *
9463
+	 * @return Array the date list
9464
+	 *
9465
+	 */
9466 9466
 	public function countAllDatesLast7Days($filters = array())
9467 9467
 	{
9468 9468
 		global $globalTimezone, $globalDBdriver;
@@ -9484,7 +9484,7 @@  discard block
 block discarded – undo
9484 9484
 			$query .= " GROUP BY date_name 
9485 9485
 								ORDER BY date_name ASC";
9486 9486
 			$query_data = array(':offset' => $offset);
9487
-    		}
9487
+			}
9488 9488
 		
9489 9489
 		$sth = $this->db->prepare($query);
9490 9490
 		$sth->execute($query_data);
@@ -9504,11 +9504,11 @@  discard block
 block discarded – undo
9504 9504
 	}
9505 9505
 
9506 9506
 	/**
9507
-	* Counts all dates during the last month
9508
-	*
9509
-	* @return Array the date list
9510
-	*
9511
-	*/
9507
+	 * Counts all dates during the last month
9508
+	 *
9509
+	 * @return Array the date list
9510
+	 *
9511
+	 */
9512 9512
 	public function countAllDatesLastMonth($filters = array())
9513 9513
 	{
9514 9514
 		global $globalTimezone, $globalDBdriver;
@@ -9530,7 +9530,7 @@  discard block
 block discarded – undo
9530 9530
 			$query .= " GROUP BY date_name 
9531 9531
 								ORDER BY date_name ASC";
9532 9532
 			$query_data = array(':offset' => $offset);
9533
-    		}
9533
+			}
9534 9534
 		
9535 9535
 		$sth = $this->db->prepare($query);
9536 9536
 		$sth->execute($query_data);
@@ -9551,11 +9551,11 @@  discard block
 block discarded – undo
9551 9551
 
9552 9552
 
9553 9553
 	/**
9554
-	* Counts all dates during the last month
9555
-	*
9556
-	* @return Array the date list
9557
-	*
9558
-	*/
9554
+	 * Counts all dates during the last month
9555
+	 *
9556
+	 * @return Array the date list
9557
+	 *
9558
+	 */
9559 9559
 	public function countAllDatesLastMonthByAirlines($filters = array())
9560 9560
 	{
9561 9561
 		global $globalTimezone, $globalDBdriver;
@@ -9578,7 +9578,7 @@  discard block
 block discarded – undo
9578 9578
 								GROUP BY spotter_output.airline_icao, date_name 
9579 9579
 								ORDER BY date_name ASC";
9580 9580
 			$query_data = array(':offset' => $offset);
9581
-    		}
9581
+			}
9582 9582
 		
9583 9583
 		$sth = $this->db->prepare($query);
9584 9584
 		$sth->execute($query_data);
@@ -9600,11 +9600,11 @@  discard block
 block discarded – undo
9600 9600
 	
9601 9601
 
9602 9602
 	/**
9603
-	* Counts all month
9604
-	*
9605
-	* @return Array the month list
9606
-	*
9607
-	*/
9603
+	 * Counts all month
9604
+	 *
9605
+	 * @return Array the month list
9606
+	 *
9607
+	 */
9608 9608
 	public function countAllMonths($filters = array())
9609 9609
 	{
9610 9610
 		global $globalTimezone, $globalDBdriver;
@@ -9646,11 +9646,11 @@  discard block
 block discarded – undo
9646 9646
 	}
9647 9647
 
9648 9648
 	/**
9649
-	* Counts all month
9650
-	*
9651
-	* @return Array the month list
9652
-	*
9653
-	*/
9649
+	 * Counts all month
9650
+	 *
9651
+	 * @return Array the month list
9652
+	 *
9653
+	 */
9654 9654
 	public function countAllMonthsByAirlines($filters = array())
9655 9655
 	{
9656 9656
 		global $globalTimezone, $globalDBdriver;
@@ -9695,11 +9695,11 @@  discard block
 block discarded – undo
9695 9695
 	}
9696 9696
 
9697 9697
 	/**
9698
-	* Counts all military month
9699
-	*
9700
-	* @return Array the month list
9701
-	*
9702
-	*/
9698
+	 * Counts all military month
9699
+	 *
9700
+	 * @return Array the month list
9701
+	 *
9702
+	 */
9703 9703
 	public function countAllMilitaryMonths($filters = array())
9704 9704
 	{
9705 9705
 		global $globalTimezone, $globalDBdriver;
@@ -9740,11 +9740,11 @@  discard block
 block discarded – undo
9740 9740
 	}
9741 9741
 	
9742 9742
 	/**
9743
-	* Counts all month owners
9744
-	*
9745
-	* @return Array the month list
9746
-	*
9747
-	*/
9743
+	 * Counts all month owners
9744
+	 *
9745
+	 * @return Array the month list
9746
+	 *
9747
+	 */
9748 9748
 	public function countAllMonthsOwners($filters = array())
9749 9749
 	{
9750 9750
 		global $globalTimezone, $globalDBdriver;
@@ -9786,11 +9786,11 @@  discard block
 block discarded – undo
9786 9786
 	}
9787 9787
 	
9788 9788
 	/**
9789
-	* Counts all month owners
9790
-	*
9791
-	* @return Array the month list
9792
-	*
9793
-	*/
9789
+	 * Counts all month owners
9790
+	 *
9791
+	 * @return Array the month list
9792
+	 *
9793
+	 */
9794 9794
 	public function countAllMonthsOwnersByAirlines($filters = array())
9795 9795
 	{
9796 9796
 		global $globalTimezone, $globalDBdriver;
@@ -9833,11 +9833,11 @@  discard block
 block discarded – undo
9833 9833
 	}
9834 9834
 
9835 9835
 	/**
9836
-	* Counts all month pilot
9837
-	*
9838
-	* @return Array the month list
9839
-	*
9840
-	*/
9836
+	 * Counts all month pilot
9837
+	 *
9838
+	 * @return Array the month list
9839
+	 *
9840
+	 */
9841 9841
 	public function countAllMonthsPilots($filters = array())
9842 9842
 	{
9843 9843
 		global $globalTimezone, $globalDBdriver;
@@ -9879,11 +9879,11 @@  discard block
 block discarded – undo
9879 9879
 	}
9880 9880
 	
9881 9881
 	/**
9882
-	* Counts all month pilot
9883
-	*
9884
-	* @return Array the month list
9885
-	*
9886
-	*/
9882
+	 * Counts all month pilot
9883
+	 *
9884
+	 * @return Array the month list
9885
+	 *
9886
+	 */
9887 9887
 	public function countAllMonthsPilotsByAirlines($filters = array())
9888 9888
 	{
9889 9889
 		global $globalTimezone, $globalDBdriver;
@@ -9926,11 +9926,11 @@  discard block
 block discarded – undo
9926 9926
 	}
9927 9927
 
9928 9928
 	/**
9929
-	* Counts all month airline
9930
-	*
9931
-	* @return Array the month list
9932
-	*
9933
-	*/
9929
+	 * Counts all month airline
9930
+	 *
9931
+	 * @return Array the month list
9932
+	 *
9933
+	 */
9934 9934
 	public function countAllMonthsAirlines($filters = array())
9935 9935
 	{
9936 9936
 		global $globalTimezone, $globalDBdriver;
@@ -9972,11 +9972,11 @@  discard block
 block discarded – undo
9972 9972
 	}
9973 9973
 	
9974 9974
 	/**
9975
-	* Counts all month aircraft
9976
-	*
9977
-	* @return Array the month list
9978
-	*
9979
-	*/
9975
+	 * Counts all month aircraft
9976
+	 *
9977
+	 * @return Array the month list
9978
+	 *
9979
+	 */
9980 9980
 	public function countAllMonthsAircrafts($filters = array())
9981 9981
 	{
9982 9982
 		global $globalTimezone, $globalDBdriver;
@@ -10019,11 +10019,11 @@  discard block
 block discarded – undo
10019 10019
 	
10020 10020
 
10021 10021
 	/**
10022
-	* Counts all month aircraft
10023
-	*
10024
-	* @return Array the month list
10025
-	*
10026
-	*/
10022
+	 * Counts all month aircraft
10023
+	 *
10024
+	 * @return Array the month list
10025
+	 *
10026
+	 */
10027 10027
 	public function countAllMonthsAircraftsByAirlines($filters = array())
10028 10028
 	{
10029 10029
 		global $globalTimezone, $globalDBdriver;
@@ -10066,11 +10066,11 @@  discard block
 block discarded – undo
10066 10066
 	}
10067 10067
 
10068 10068
 	/**
10069
-	* Counts all month real arrival
10070
-	*
10071
-	* @return Array the month list
10072
-	*
10073
-	*/
10069
+	 * Counts all month real arrival
10070
+	 *
10071
+	 * @return Array the month list
10072
+	 *
10073
+	 */
10074 10074
 	public function countAllMonthsRealArrivals($filters = array())
10075 10075
 	{
10076 10076
 		global $globalTimezone, $globalDBdriver;
@@ -10113,11 +10113,11 @@  discard block
 block discarded – undo
10113 10113
 	
10114 10114
 
10115 10115
 	/**
10116
-	* Counts all month real arrival
10117
-	*
10118
-	* @return Array the month list
10119
-	*
10120
-	*/
10116
+	 * Counts all month real arrival
10117
+	 *
10118
+	 * @return Array the month list
10119
+	 *
10120
+	 */
10121 10121
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
10122 10122
 	{
10123 10123
 		global $globalTimezone, $globalDBdriver;
@@ -10161,11 +10161,11 @@  discard block
 block discarded – undo
10161 10161
 	
10162 10162
 
10163 10163
 	/**
10164
-	* Counts all dates during the last year
10165
-	*
10166
-	* @return Array the date list
10167
-	*
10168
-	*/
10164
+	 * Counts all dates during the last year
10165
+	 *
10166
+	 * @return Array the date list
10167
+	 *
10168
+	 */
10169 10169
 	public function countAllMonthsLastYear($filters)
10170 10170
 	{
10171 10171
 		global $globalTimezone, $globalDBdriver;
@@ -10187,7 +10187,7 @@  discard block
 block discarded – undo
10187 10187
 			$query .= " GROUP BY year_name, month_name
10188 10188
 								ORDER BY year_name, month_name ASC";
10189 10189
 			$query_data = array(':offset' => $offset);
10190
-    		}
10190
+			}
10191 10191
 		
10192 10192
 		$sth = $this->db->prepare($query);
10193 10193
 		$sth->execute($query_data);
@@ -10210,11 +10210,11 @@  discard block
 block discarded – undo
10210 10210
 	
10211 10211
 	
10212 10212
 	/**
10213
-	* Counts all hours
10214
-	*
10215
-	* @return Array the hour list
10216
-	*
10217
-	*/
10213
+	 * Counts all hours
10214
+	 *
10215
+	 * @return Array the hour list
10216
+	 *
10217
+	 */
10218 10218
 	public function countAllHours($orderby,$filters = array())
10219 10219
 	{
10220 10220
 		global $globalTimezone, $globalDBdriver;
@@ -10275,11 +10275,11 @@  discard block
 block discarded – undo
10275 10275
 	}
10276 10276
 	
10277 10277
 	/**
10278
-	* Counts all hours
10279
-	*
10280
-	* @return Array the hour list
10281
-	*
10282
-	*/
10278
+	 * Counts all hours
10279
+	 *
10280
+	 * @return Array the hour list
10281
+	 *
10282
+	 */
10283 10283
 	public function countAllHoursByAirlines($orderby, $filters = array())
10284 10284
 	{
10285 10285
 		global $globalTimezone, $globalDBdriver;
@@ -10342,11 +10342,11 @@  discard block
 block discarded – undo
10342 10342
 
10343 10343
 
10344 10344
 	/**
10345
-	* Counts all hours by airline
10346
-	*
10347
-	* @return Array the hour list
10348
-	*
10349
-	*/
10345
+	 * Counts all hours by airline
10346
+	 *
10347
+	 * @return Array the hour list
10348
+	 *
10349
+	 */
10350 10350
 	public function countAllHoursByAirline($airline_icao, $filters = array())
10351 10351
 	{
10352 10352
 		global $globalTimezone, $globalDBdriver;
@@ -10392,11 +10392,11 @@  discard block
 block discarded – undo
10392 10392
 	
10393 10393
 	
10394 10394
 	/**
10395
-	* Counts all hours by aircraft
10396
-	*
10397
-	* @return Array the hour list
10398
-	*
10399
-	*/
10395
+	 * Counts all hours by aircraft
10396
+	 *
10397
+	 * @return Array the hour list
10398
+	 *
10399
+	 */
10400 10400
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
10401 10401
 	{
10402 10402
 		global $globalTimezone, $globalDBdriver;
@@ -10439,11 +10439,11 @@  discard block
 block discarded – undo
10439 10439
 	
10440 10440
 	
10441 10441
 	/**
10442
-	* Counts all hours by aircraft registration
10443
-	*
10444
-	* @return Array the hour list
10445
-	*
10446
-	*/
10442
+	 * Counts all hours by aircraft registration
10443
+	 *
10444
+	 * @return Array the hour list
10445
+	 *
10446
+	 */
10447 10447
 	public function countAllHoursByRegistration($registration, $filters = array())
10448 10448
 	{
10449 10449
 		global $globalTimezone, $globalDBdriver;
@@ -10486,11 +10486,11 @@  discard block
 block discarded – undo
10486 10486
 	
10487 10487
 	
10488 10488
 	/**
10489
-	* Counts all hours by airport
10490
-	*
10491
-	* @return Array the hour list
10492
-	*
10493
-	*/
10489
+	 * Counts all hours by airport
10490
+	 *
10491
+	 * @return Array the hour list
10492
+	 *
10493
+	 */
10494 10494
 	public function countAllHoursByAirport($airport_icao, $filters = array())
10495 10495
 	{
10496 10496
 		global $globalTimezone, $globalDBdriver;
@@ -10534,11 +10534,11 @@  discard block
 block discarded – undo
10534 10534
 	
10535 10535
 	
10536 10536
 	/**
10537
-	* Counts all hours by manufacturer
10538
-	*
10539
-	* @return Array the hour list
10540
-	*
10541
-	*/
10537
+	 * Counts all hours by manufacturer
10538
+	 *
10539
+	 * @return Array the hour list
10540
+	 *
10541
+	 */
10542 10542
 	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
10543 10543
 	{
10544 10544
 		global $globalTimezone, $globalDBdriver;
@@ -10582,11 +10582,11 @@  discard block
 block discarded – undo
10582 10582
 	
10583 10583
 	
10584 10584
 	/**
10585
-	* Counts all hours by date
10586
-	*
10587
-	* @return Array the hour list
10588
-	*
10589
-	*/
10585
+	 * Counts all hours by date
10586
+	 *
10587
+	 * @return Array the hour list
10588
+	 *
10589
+	 */
10590 10590
 	public function countAllHoursByDate($date, $filters = array())
10591 10591
 	{
10592 10592
 		global $globalTimezone, $globalDBdriver;
@@ -10630,11 +10630,11 @@  discard block
 block discarded – undo
10630 10630
 	
10631 10631
 	
10632 10632
 	/**
10633
-	* Counts all hours by a ident/callsign
10634
-	*
10635
-	* @return Array the hour list
10636
-	*
10637
-	*/
10633
+	 * Counts all hours by a ident/callsign
10634
+	 *
10635
+	 * @return Array the hour list
10636
+	 *
10637
+	 */
10638 10638
 	public function countAllHoursByIdent($ident, $filters = array())
10639 10639
 	{
10640 10640
 		global $globalTimezone, $globalDBdriver;
@@ -10677,11 +10677,11 @@  discard block
 block discarded – undo
10677 10677
 	}
10678 10678
 	
10679 10679
 	/**
10680
-	* Counts all hours by a owner
10681
-	*
10682
-	* @return Array the hour list
10683
-	*
10684
-	*/
10680
+	 * Counts all hours by a owner
10681
+	 *
10682
+	 * @return Array the hour list
10683
+	 *
10684
+	 */
10685 10685
 	public function countAllHoursByOwner($owner, $filters = array())
10686 10686
 	{
10687 10687
 		global $globalTimezone, $globalDBdriver;
@@ -10724,11 +10724,11 @@  discard block
 block discarded – undo
10724 10724
 	}
10725 10725
 	
10726 10726
 	/**
10727
-	* Counts all hours by a pilot
10728
-	*
10729
-	* @return Array the hour list
10730
-	*
10731
-	*/
10727
+	 * Counts all hours by a pilot
10728
+	 *
10729
+	 * @return Array the hour list
10730
+	 *
10731
+	 */
10732 10732
 	public function countAllHoursByPilot($pilot, $filters = array())
10733 10733
 	{
10734 10734
 		global $globalTimezone, $globalDBdriver;
@@ -10773,11 +10773,11 @@  discard block
 block discarded – undo
10773 10773
 	
10774 10774
 	
10775 10775
 	/**
10776
-	* Counts all hours by route
10777
-	*
10778
-	* @return Array the hour list
10779
-	*
10780
-	*/
10776
+	 * Counts all hours by route
10777
+	 *
10778
+	 * @return Array the hour list
10779
+	 *
10780
+	 */
10781 10781
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
10782 10782
 	{
10783 10783
 		global $globalTimezone, $globalDBdriver;
@@ -10821,11 +10821,11 @@  discard block
 block discarded – undo
10821 10821
 	
10822 10822
 	
10823 10823
 	/**
10824
-	* Counts all hours by country
10825
-	*
10826
-	* @return Array the hour list
10827
-	*
10828
-	*/
10824
+	 * Counts all hours by country
10825
+	 *
10826
+	 * @return Array the hour list
10827
+	 *
10828
+	 */
10829 10829
 	public function countAllHoursByCountry($country, $filters = array())
10830 10830
 	{
10831 10831
 		global $globalTimezone, $globalDBdriver;
@@ -10870,11 +10870,11 @@  discard block
 block discarded – undo
10870 10870
 
10871 10871
 
10872 10872
 	/**
10873
-	* Counts all aircraft that have flown over
10874
-	*
10875
-	* @return Integer the number of aircrafts
10876
-	*
10877
-	*/
10873
+	 * Counts all aircraft that have flown over
10874
+	 *
10875
+	 * @return Integer the number of aircrafts
10876
+	 *
10877
+	 */
10878 10878
 	public function countOverallAircrafts($filters = array(),$year = '',$month = '')
10879 10879
 	{
10880 10880
 		global $globalDBdriver;
@@ -10907,11 +10907,11 @@  discard block
 block discarded – undo
10907 10907
 	}
10908 10908
 
10909 10909
 	/**
10910
-	* Counts all flight that really arrival
10911
-	*
10912
-	* @return Integer the number of aircrafts
10913
-	*
10914
-	*/
10910
+	 * Counts all flight that really arrival
10911
+	 *
10912
+	 * @return Integer the number of aircrafts
10913
+	 *
10914
+	 */
10915 10915
 	public function countOverallArrival($filters = array(),$year = '',$month = '')
10916 10916
 	{
10917 10917
 		global $globalDBdriver;
@@ -10944,11 +10944,11 @@  discard block
 block discarded – undo
10944 10944
 	}
10945 10945
 
10946 10946
 	/**
10947
-	* Counts all pilots that have flown over
10948
-	*
10949
-	* @return Integer the number of pilots
10950
-	*
10951
-	*/
10947
+	 * Counts all pilots that have flown over
10948
+	 *
10949
+	 * @return Integer the number of pilots
10950
+	 *
10951
+	 */
10952 10952
 	public function countOverallPilots($filters = array(),$year = '',$month = '')
10953 10953
 	{
10954 10954
 		global $globalDBdriver;
@@ -10980,11 +10980,11 @@  discard block
 block discarded – undo
10980 10980
 	}
10981 10981
 
10982 10982
 	/**
10983
-	* Counts all owners that have flown over
10984
-	*
10985
-	* @return Integer the number of owners
10986
-	*
10987
-	*/
10983
+	 * Counts all owners that have flown over
10984
+	 *
10985
+	 * @return Integer the number of owners
10986
+	 *
10987
+	 */
10988 10988
 	public function countOverallOwners($filters = array(),$year = '',$month = '')
10989 10989
 	{
10990 10990
 		global $globalDBdriver;
@@ -11017,11 +11017,11 @@  discard block
 block discarded – undo
11017 11017
 	
11018 11018
 	
11019 11019
 	/**
11020
-	* Counts all flights that have flown over
11021
-	*
11022
-	* @return Integer the number of flights
11023
-	*
11024
-	*/
11020
+	 * Counts all flights that have flown over
11021
+	 *
11022
+	 * @return Integer the number of flights
11023
+	 *
11024
+	 */
11025 11025
 	public function countOverallFlights($filters = array(),$year = '',$month = '')
11026 11026
 	{
11027 11027
 		global $globalDBdriver;
@@ -11055,11 +11055,11 @@  discard block
 block discarded – undo
11055 11055
 	}
11056 11056
 	
11057 11057
 	/**
11058
-	* Counts all military flights that have flown over
11059
-	*
11060
-	* @return Integer the number of flights
11061
-	*
11062
-	*/
11058
+	 * Counts all military flights that have flown over
11059
+	 *
11060
+	 * @return Integer the number of flights
11061
+	 *
11062
+	 */
11063 11063
 	public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '')
11064 11064
 	{
11065 11065
 		global $globalDBdriver;
@@ -11094,11 +11094,11 @@  discard block
 block discarded – undo
11094 11094
 	
11095 11095
 	
11096 11096
 	/**
11097
-	* Counts all airlines that have flown over
11098
-	*
11099
-	* @return Integer the number of airlines
11100
-	*
11101
-	*/
11097
+	 * Counts all airlines that have flown over
11098
+	 *
11099
+	 * @return Integer the number of airlines
11100
+	 *
11101
+	 */
11102 11102
 	public function countOverallAirlines($filters = array(),$year = '',$month = '')
11103 11103
 	{
11104 11104
 		global $globalDBdriver;
@@ -11125,8 +11125,8 @@  discard block
 block discarded – undo
11125 11125
 				$query_values = array_merge($query_values,array(':month' => $month));
11126 11126
 			}
11127 11127
 		}
11128
-                if ($query == '') $queryi .= $this->getFilter($filters);
11129
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11128
+				if ($query == '') $queryi .= $this->getFilter($filters);
11129
+				else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11130 11130
 
11131 11131
 
11132 11132
 		$sth = $this->db->prepare($queryi);
@@ -11136,11 +11136,11 @@  discard block
 block discarded – undo
11136 11136
 
11137 11137
   
11138 11138
 	/**
11139
-	* Counts all hours of today
11140
-	*
11141
-	* @return Array the hour list
11142
-	*
11143
-	*/
11139
+	 * Counts all hours of today
11140
+	 *
11141
+	 * @return Array the hour list
11142
+	 *
11143
+	 */
11144 11144
 	public function countAllHoursFromToday($filters = array())
11145 11145
 	{
11146 11146
 		global $globalTimezone, $globalDBdriver;
@@ -11180,11 +11180,11 @@  discard block
 block discarded – undo
11180 11180
 	}
11181 11181
     
11182 11182
 	/**
11183
-	* Gets all the spotter information based on calculated upcoming flights
11184
-	*
11185
-	* @return Array the spotter information
11186
-	*
11187
-	*/
11183
+	 * Gets all the spotter information based on calculated upcoming flights
11184
+	 *
11185
+	 * @return Array the spotter information
11186
+	 *
11187
+	 */
11188 11188
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
11189 11189
 	{
11190 11190
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -11259,12 +11259,12 @@  discard block
 block discarded – undo
11259 11259
 	}
11260 11260
     
11261 11261
     
11262
-     /**
11263
-	* Gets the Barrie Spotter ID based on the FlightAware ID
11264
-	*
11265
-	* @return Integer the Barrie Spotter ID
11262
+	 /**
11263
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
11264
+	  *
11265
+	  * @return Integer the Barrie Spotter ID
11266 11266
 q	*
11267
-	*/
11267
+	  */
11268 11268
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
11269 11269
 	{
11270 11270
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -11285,13 +11285,13 @@  discard block
 block discarded – undo
11285 11285
   
11286 11286
  
11287 11287
 	/**
11288
-	* Parses a date string
11289
-	*
11290
-	* @param String $dateString the date string
11291
-	* @param String $timezone the timezone of a user
11292
-	* @return Array the time information
11293
-	*
11294
-	*/
11288
+	 * Parses a date string
11289
+	 *
11290
+	 * @param String $dateString the date string
11291
+	 * @param String $timezone the timezone of a user
11292
+	 * @return Array the time information
11293
+	 *
11294
+	 */
11295 11295
 	public function parseDateString($dateString, $timezone = '')
11296 11296
 	{
11297 11297
 		$time_array = array();
@@ -11327,12 +11327,12 @@  discard block
 block discarded – undo
11327 11327
 	
11328 11328
 	
11329 11329
 	/**
11330
-	* Parses the direction degrees to working
11331
-	*
11332
-	* @param Float $direction the direction in degrees
11333
-	* @return Array the direction information
11334
-	*
11335
-	*/
11330
+	 * Parses the direction degrees to working
11331
+	 *
11332
+	 * @param Float $direction the direction in degrees
11333
+	 * @return Array the direction information
11334
+	 *
11335
+	 */
11336 11336
 	public function parseDirection($direction = 0)
11337 11337
 	{
11338 11338
 		if ($direction == '') $direction = 0;
@@ -11411,12 +11411,12 @@  discard block
 block discarded – undo
11411 11411
 	
11412 11412
 	
11413 11413
 	/**
11414
-	* Gets the aircraft registration
11415
-	*
11416
-	* @param String $flightaware_id the flight aware id
11417
-	* @return String the aircraft registration
11418
-	*
11419
-	*/
11414
+	 * Gets the aircraft registration
11415
+	 *
11416
+	 * @param String $flightaware_id the flight aware id
11417
+	 * @return String the aircraft registration
11418
+	 *
11419
+	 */
11420 11420
 	
11421 11421
 	public function getAircraftRegistration($flightaware_id)
11422 11422
 	{
@@ -11445,12 +11445,12 @@  discard block
 block discarded – undo
11445 11445
 
11446 11446
 
11447 11447
 	/**
11448
-	* Gets the aircraft registration from ModeS
11449
-	*
11450
-	* @param String $aircraft_modes the flight ModeS in hex
11451
-	* @return String the aircraft registration
11452
-	*
11453
-	*/
11448
+	 * Gets the aircraft registration from ModeS
11449
+	 *
11450
+	 * @param String $aircraft_modes the flight ModeS in hex
11451
+	 * @return String the aircraft registration
11452
+	 *
11453
+	 */
11454 11454
 	public function getAircraftRegistrationBymodeS($aircraft_modes, $source_type = '')
11455 11455
 	{
11456 11456
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -11466,8 +11466,8 @@  discard block
 block discarded – undo
11466 11466
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
11467 11467
 		$sth->closeCursor();
11468 11468
 		if (count($row) > 0) {
11469
-		    //return $row['Registration'];
11470
-		    return $row['registration'];
11469
+			//return $row['Registration'];
11470
+			return $row['registration'];
11471 11471
 		} elseif ($source_type == 'flarm') {
11472 11472
 			return $this->getAircraftRegistrationBymodeS($aircraft_modes);
11473 11473
 		} else return '';
@@ -11475,12 +11475,12 @@  discard block
 block discarded – undo
11475 11475
 	}
11476 11476
 
11477 11477
 	/**
11478
-	* Gets the aircraft type from ModeS
11479
-	*
11480
-	* @param String $aircraft_modes the flight ModeS in hex
11481
-	* @return String the aircraft type
11482
-	*
11483
-	*/
11478
+	 * Gets the aircraft type from ModeS
11479
+	 *
11480
+	 * @param String $aircraft_modes the flight ModeS in hex
11481
+	 * @return String the aircraft type
11482
+	 *
11483
+	 */
11484 11484
 	public function getAircraftTypeBymodeS($aircraft_modes,$source_type = '')
11485 11485
 	{
11486 11486
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -11506,12 +11506,12 @@  discard block
 block discarded – undo
11506 11506
 	}
11507 11507
 
11508 11508
 	/**
11509
-	* Gets Country from latitude/longitude
11510
-	*
11511
-	* @param Float $latitude latitute of the flight
11512
-	* @param Float $longitude longitute of the flight
11513
-	* @return String the countrie
11514
-	*/
11509
+	 * Gets Country from latitude/longitude
11510
+	 *
11511
+	 * @param Float $latitude latitute of the flight
11512
+	 * @param Float $longitude longitute of the flight
11513
+	 * @return String the countrie
11514
+	 */
11515 11515
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
11516 11516
 	{
11517 11517
 		global $globalDBdriver, $globalDebug;
@@ -11548,11 +11548,11 @@  discard block
 block discarded – undo
11548 11548
 	}
11549 11549
 
11550 11550
 	/**
11551
-	* Gets Country from iso2
11552
-	*
11553
-	* @param String $iso2 ISO2 country code
11554
-	* @return String the countrie
11555
-	*/
11551
+	 * Gets Country from iso2
11552
+	 *
11553
+	 * @param String $iso2 ISO2 country code
11554
+	 * @return String the countrie
11555
+	 */
11556 11556
 	public function getCountryFromISO2($iso2)
11557 11557
 	{
11558 11558
 		global $globalDBdriver, $globalDebug;
@@ -11580,12 +11580,12 @@  discard block
 block discarded – undo
11580 11580
 	}
11581 11581
 
11582 11582
 	/**
11583
-	* converts the registration code using the country prefix
11584
-	*
11585
-	* @param String $registration the aircraft registration
11586
-	* @return String the aircraft registration
11587
-	*
11588
-	*/
11583
+	 * converts the registration code using the country prefix
11584
+	 *
11585
+	 * @param String $registration the aircraft registration
11586
+	 * @return String the aircraft registration
11587
+	 *
11588
+	 */
11589 11589
 	public function convertAircraftRegistration($registration)
11590 11590
 	{
11591 11591
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11637,12 +11637,12 @@  discard block
 block discarded – undo
11637 11637
 	}
11638 11638
 
11639 11639
 	/**
11640
-	* Country from the registration code
11641
-	*
11642
-	* @param String $registration the aircraft registration
11643
-	* @return String the country
11644
-	*
11645
-	*/
11640
+	 * Country from the registration code
11641
+	 *
11642
+	 * @param String $registration the aircraft registration
11643
+	 * @return String the country
11644
+	 *
11645
+	 */
11646 11646
 	public function countryFromAircraftRegistration($registration)
11647 11647
 	{
11648 11648
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11661,8 +11661,8 @@  discard block
 block discarded – undo
11661 11661
 				$country = $row['country'];
11662 11662
 			}
11663 11663
 		} else {
11664
-    			$registration_1 = substr($registration, 0, 1);
11665
-		        $registration_2 = substr($registration, 0, 2);
11664
+				$registration_1 = substr($registration, 0, 1);
11665
+				$registration_2 = substr($registration, 0, 2);
11666 11666
 
11667 11667
 			$country = '';
11668 11668
 			//first get the prefix based on two characters
@@ -11698,12 +11698,12 @@  discard block
 block discarded – undo
11698 11698
 	}
11699 11699
 
11700 11700
 	/**
11701
-	* Registration prefix from the registration code
11702
-	*
11703
-	* @param String $registration the aircraft registration
11704
-	* @return String the registration prefix
11705
-	*
11706
-	*/
11701
+	 * Registration prefix from the registration code
11702
+	 *
11703
+	 * @param String $registration the aircraft registration
11704
+	 * @return String the registration prefix
11705
+	 *
11706
+	 */
11707 11707
 	public function registrationPrefixFromAircraftRegistration($registration)
11708 11708
 	{
11709 11709
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11722,8 +11722,8 @@  discard block
 block discarded – undo
11722 11722
 				//$country = $row['country'];
11723 11723
 			}
11724 11724
 		} else {
11725
-    			$registration_1 = substr($registration, 0, 1);
11726
-		        $registration_2 = substr($registration, 0, 2);
11725
+				$registration_1 = substr($registration, 0, 1);
11726
+				$registration_2 = substr($registration, 0, 2);
11727 11727
 
11728 11728
 			//first get the prefix based on two characters
11729 11729
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
@@ -11759,12 +11759,12 @@  discard block
 block discarded – undo
11759 11759
 
11760 11760
 
11761 11761
 	/**
11762
-	* Country from the registration code
11763
-	*
11764
-	* @param String $registration the aircraft registration
11765
-	* @return String the country
11766
-	*
11767
-	*/
11762
+	 * Country from the registration code
11763
+	 *
11764
+	 * @param String $registration the aircraft registration
11765
+	 * @return String the country
11766
+	 *
11767
+	 */
11768 11768
 	public function countryFromAircraftRegistrationCode($registration)
11769 11769
 	{
11770 11770
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -11781,11 +11781,11 @@  discard block
 block discarded – undo
11781 11781
 	}
11782 11782
 	
11783 11783
 	/**
11784
-	* Set a new highlight value for a flight
11785
-	*
11786
-	* @param String $flightaware_id flightaware_id from spotter_output table
11787
-	* @param String $highlight New highlight value
11788
-	*/
11784
+	 * Set a new highlight value for a flight
11785
+	 *
11786
+	 * @param String $flightaware_id flightaware_id from spotter_output table
11787
+	 * @param String $highlight New highlight value
11788
+	 */
11789 11789
 	public function setHighlightFlight($flightaware_id,$highlight) {
11790 11790
 		
11791 11791
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -11794,12 +11794,12 @@  discard block
 block discarded – undo
11794 11794
 	}
11795 11795
 
11796 11796
 	/**
11797
-	* Set a new highlight value for a flight by Registration
11798
-	*
11799
-	* @param String $registration Registration of the aircraft
11800
-	* @param String $date Date of spotted aircraft
11801
-	* @param String $highlight New highlight value
11802
-	*/
11797
+	 * Set a new highlight value for a flight by Registration
11798
+	 *
11799
+	 * @param String $registration Registration of the aircraft
11800
+	 * @param String $date Date of spotted aircraft
11801
+	 * @param String $highlight New highlight value
11802
+	 */
11803 11803
 	public function setHighlightFlightByRegistration($registration,$highlight, $date = '') {
11804 11804
 		if ($date == '') {
11805 11805
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)";
@@ -11813,12 +11813,12 @@  discard block
 block discarded – undo
11813 11813
 	}
11814 11814
 	
11815 11815
 	/**
11816
-	* Gets the short url from bit.ly
11817
-	*
11818
-	* @param String $url the full url
11819
-	* @return String the bit.ly url
11820
-	*
11821
-	*/
11816
+	 * Gets the short url from bit.ly
11817
+	 *
11818
+	 * @param String $url the full url
11819
+	 * @return String the bit.ly url
11820
+	 *
11821
+	 */
11822 11822
 	public function getBitlyURL($url)
11823 11823
 	{
11824 11824
 		global $globalBitlyAccessToken;
@@ -12107,11 +12107,11 @@  discard block
 block discarded – undo
12107 12107
 			$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 
12108 12108
 	                      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)) 
12109 12109
 	                      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;";
12110
-                } else {
12110
+				} else {
12111 12111
 			$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 
12112 12112
 	                      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)) 
12113 12113
 	                      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;";
12114
-    		}
12114
+			}
12115 12115
 		$sth = $this->db->prepare($query);
12116 12116
 		$sth->execute();
12117 12117
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
Spacing   +1354 added lines, -1354 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 $aircraft_correct_icaotype = array('CL64' => 'CL60',
9 9
 					'F9LX' => 'F900',
10 10
 					'K35T' => 'K35R',
@@ -59,62 +59,62 @@  discard block
 block discarded – undo
59 59
 	* @param Array $filter the filter
60 60
 	* @return Array the SQL part
61 61
 	*/
62
-	public function getFilter($filter = array(),$where = false,$and = false) {
62
+	public function getFilter($filter = array(), $where = false, $and = false) {
63 63
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
64 64
 		$filters = array();
65 65
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
66 66
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
67 67
 				$filters = $globalStatsFilters[$globalFilterName];
68 68
 			} else {
69
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
69
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
70 70
 			}
71 71
 		}
72 72
 		if (isset($filter[0]['source'])) {
73
-			$filters = array_merge($filters,$filter);
73
+			$filters = array_merge($filters, $filter);
74 74
 		}
75
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
75
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
76 76
 		$filter_query_join = '';
77 77
 		$filter_query_where = '';
78
-		foreach($filters as $flt) {
78
+		foreach ($filters as $flt) {
79 79
 			if (isset($flt['airlines']) && !empty($flt['airlines'])) {
80 80
 				if ($flt['airlines'][0] != '') {
81 81
 					if (isset($flt['source'])) {
82
-						$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'])."')) saf ON saf.flightaware_id = spotter_output.flightaware_id";
82
+						$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'])."')) saf ON saf.flightaware_id = spotter_output.flightaware_id";
83 83
 					} else {
84
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saf ON saf.flightaware_id = spotter_output.flightaware_id";
84
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saf ON saf.flightaware_id = spotter_output.flightaware_id";
85 85
 					}
86 86
 				}
87 87
 			}
88 88
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
89 89
 				if (isset($flt['source'])) {
90
-					$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'])."')) spf ON spf.flightaware_id = spotter_output.flightaware_id";
90
+					$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'])."')) spf ON spf.flightaware_id = spotter_output.flightaware_id";
91 91
 				} else {
92
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) spf ON spf.flightaware_id = spotter_output.flightaware_id";
92
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) spf ON spf.flightaware_id = spotter_output.flightaware_id";
93 93
 				}
94 94
 			}
95 95
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
96 96
 				if (isset($flt['source'])) {
97
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spfi ON spfi.flightaware_id = spotter_output.flightaware_id";
97
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spfi ON spfi.flightaware_id = spotter_output.flightaware_id";
98 98
 				} else {
99
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."')) spfi ON spfi.flightaware_id = spotter_output.flightaware_id";
99
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."')) spfi ON spfi.flightaware_id = spotter_output.flightaware_id";
100 100
 				}
101 101
 			}
102 102
 			if (isset($flt['registrations']) && !empty($flt['registrations'])) {
103 103
 				if (isset($flt['source'])) {
104
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_output.flightaware_id";
104
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_output.flightaware_id";
105 105
 				} else {
106
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_output.flightaware_id";
106
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_output.flightaware_id";
107 107
 				}
108 108
 			}
109 109
 			if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents']) && isset($flt['registrations']) && empty($flt['registrations'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) {
110 110
 				if (isset($flt['source'])) {
111
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) sf ON sf.flightaware_id = spotter_output.flightaware_id";
111
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) sf ON sf.flightaware_id = spotter_output.flightaware_id";
112 112
 				}
113 113
 			}
114 114
 		}
115 115
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
116 116
 			if ($filter['airlines'][0] != '') {
117
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) sof ON sof.flightaware_id = spotter_output.flightaware_id";
117
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) sof ON sof.flightaware_id = spotter_output.flightaware_id";
118 118
 			}
119 119
 		}
120 120
 		if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
@@ -124,16 +124,16 @@  discard block
 block discarded – undo
124 124
 			$filter_query_join .= " INNER JOIN (SELECT icao FROM airlines WHERE alliance = '".$filter['alliance']."') sal ON sal.icao = spotter_output.airline_icao ";
125 125
 		}
126 126
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
127
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) spid ON spid.flightaware_id = spotter_output.flightaware_id";
127
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) spid ON spid.flightaware_id = spotter_output.flightaware_id";
128 128
 			}
129 129
 		if (isset($filter['source']) && !empty($filter['source'])) {
130
-			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
130
+			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
131 131
 		}
132 132
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
133 133
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
134 134
 		}
135 135
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
136
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
136
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
137 137
 		}
138 138
 		if (isset($filter['year']) && $filter['year'] != '') {
139 139
 			if ($globalDBdriver == 'mysql') {
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
160 160
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
161 161
 		if ($filter_query_where != '') {
162
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
162
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
163 163
 		}
164 164
 		$filter_query = $filter_query_join.$filter_query_where;
165 165
 		return $filter_query;
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	* @return Array the spotter information
175 175
 	*
176 176
 	*/
177
-	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
177
+	public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false)
178 178
 	{
179 179
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
180 180
 		$Image = new Image($this->db);
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 			$sth = $this->db->prepare($query.$limitQuery);
205 205
 			$sth->execute($params);
206 206
 		} catch (PDOException $e) {
207
-			printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery);
207
+			printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery);
208 208
 			exit();
209 209
 		}
210 210
 		
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 		$spotter_array = array();
215 215
 		
216 216
 
217
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
217
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
218 218
 		{
219 219
 			$num_rows++;
220 220
 			$temp_array = array();
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
259 259
 			if (isset($row['route_stop']) && $row['route_stop'] != '') {
260 260
 				$temp_array['route_stop'] = $row['route_stop'];
261
-				$allroute = explode(' ',$row['route_stop']);
261
+				$allroute = explode(' ', $row['route_stop']);
262 262
 				foreach ($allroute as $route) {
263 263
 					$route_airport_array = $this->getAllAirportInfo($route);
264 264
 					if (isset($route_airport_array[0]['name'])) {
@@ -311,17 +311,17 @@  discard block
 block discarded – undo
311 311
 				{
312 312
 					$temp_array['date'] = "about ".$dateArray['hours']." hours ago";
313 313
 				} else {
314
-					$temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC"));
314
+					$temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC"));
315 315
 				}
316 316
 				$temp_array['date_minutes_past'] = $dateArray['minutes'];
317
-				$temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC"));
318
-				$temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC"));
317
+				$temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC"));
318
+				$temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC"));
319 319
 				$temp_array['date_unix'] = strtotime($row['date']." UTC");
320 320
 				if (isset($row['last_seen']) && $row['last_seen'] != '') {
321 321
 					if (strtotime($row['last_seen']) > strtotime($row['date'])) {
322 322
 						$temp_array['duration'] = strtotime($row['last_seen']) - strtotime($row['date']);
323
-						$temp_array['last_seen_date_iso_8601'] = date("c",strtotime($row['last_seen']." UTC"));
324
-						$temp_array['last_seen_date_rfc_2822'] = date("r",strtotime($row['last_seen']." UTC"));
323
+						$temp_array['last_seen_date_iso_8601'] = date("c", strtotime($row['last_seen']." UTC"));
324
+						$temp_array['last_seen_date_rfc_2822'] = date("r", strtotime($row['last_seen']." UTC"));
325 325
 						$temp_array['last_seen_date_unix'] = strtotime($row['last_seen']." UTC");
326 326
 					}
327 327
 				}
@@ -357,9 +357,9 @@  discard block
 block discarded – undo
357 357
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
358 358
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
359 359
 					if (is_numeric(substr($row['ident'], 2, 1))) {
360
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2),$fromsource);
360
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2), $fromsource);
361 361
 					} elseif (is_numeric(substr($row['ident'], 3, 1))) {
362
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
362
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
363 363
 					} else {
364 364
 						$airline_array = $this->getAllAirlineInfo('NA');
365 365
 					}
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 				}
397 397
 			}
398 398
 			if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') {
399
-				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'],3));
399
+				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'], 3));
400 400
 				//$acars_array = ACARS->getLiveAcarsData('BA40YL');
401 401
 				if (count($acars_array) > 0) {
402 402
 					$temp_array['acars'] = $acars_array;
@@ -413,12 +413,12 @@  discard block
 block discarded – undo
413 413
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
414 414
 			}
415 415
 
416
-			if($temp_array['registration'] != "" || (($globalIVAO || $globalVATSIM || $globalphpVMS || $globalVAM) && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
416
+			if ($temp_array['registration'] != "" || (($globalIVAO || $globalVATSIM || $globalphpVMS || $globalVAM) && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
417 417
 			{
418 418
 				if ($globalIVAO) {
419
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
420
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
421
-				} elseif (isset($temp_array['aircraft_type'])) $image_array = $Image->getSpotterImage($temp_array['registration'],$temp_array['aircraft_type']);
419
+					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('', $temp_array['aircraft_type'], $temp_array['airline_icao']);
420
+					else $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type']);
421
+				} elseif (isset($temp_array['aircraft_type'])) $image_array = $Image->getSpotterImage($temp_array['registration'], $temp_array['aircraft_type']);
422 422
 				else $image_array = $Image->getSpotterImage($temp_array['registration']);
423 423
 				if (count($image_array) > 0) {
424 424
 					$temp_array['image'] = $image_array[0]['image'];
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
443 443
 			}
444 444
 			
445
-			if ((!isset($globalIVAO) || ! $globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
445
+			if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
446 446
 				if ($schedules === true) {
447 447
 					$schedule_array = $Schedule->getSchedule($temp_array['ident']);
448 448
 					//print_r($schedule_array);
@@ -524,12 +524,12 @@  discard block
 block discarded – undo
524 524
 			if (isset($row['squawk'])) {
525 525
 				$temp_array['squawk'] = $row['squawk'];
526 526
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
527
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
528
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
527
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['country_iso2']);
528
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
529 529
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
530
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
531
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
532
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
530
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['over_country']);
531
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
532
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
533 533
 			}
534 534
     			
535 535
 			$temp_array['query_number_rows'] = $num_rows;
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
 	* @return Array the spotter information
549 549
 	*
550 550
 	*/
551
-	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
551
+	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())
552 552
 	{
553 553
 		global $globalTimezone, $globalDBdriver;
554 554
 		require_once(dirname(__FILE__).'/class.Translation.php');
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
 
559 559
 		$query_values = array();
560 560
 		$additional_query = '';
561
-		$filter_query = $this->getFilter($filters,true,true);
561
+		$filter_query = $this->getFilter($filters, true, true);
562 562
 		if ($q != "")
563 563
 		{
564 564
 			if (!is_string($q))
@@ -566,8 +566,8 @@  discard block
 block discarded – undo
566 566
 				return false;
567 567
 			} else {
568 568
 				$q_array = explode(" ", $q);
569
-				foreach ($q_array as $q_item){
570
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
569
+				foreach ($q_array as $q_item) {
570
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
571 571
 					$additional_query .= " AND (";
572 572
 					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
573 573
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
@@ -599,37 +599,37 @@  discard block
 block discarded – undo
599 599
 
600 600
 		if ($registration != "")
601 601
 		{
602
-			$registration = filter_var($registration,FILTER_SANITIZE_STRING);
602
+			$registration = filter_var($registration, FILTER_SANITIZE_STRING);
603 603
 			if (!is_string($registration))
604 604
 			{
605 605
 				return false;
606 606
 			} else {
607 607
 				$additional_query .= " AND spotter_output.registration = :registration";
608
-				$query_values = array_merge($query_values,array(':registration' => $registration));
608
+				$query_values = array_merge($query_values, array(':registration' => $registration));
609 609
 			}
610 610
 		}
611 611
 
612 612
 		if ($aircraft_icao != "")
613 613
 		{
614
-			$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
614
+			$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
615 615
 			if (!is_string($aircraft_icao))
616 616
 			{
617 617
 				return false;
618 618
 			} else {
619 619
 				$additional_query .= " AND spotter_output.aircraft_icao = :aircraft_icao";
620
-				$query_values = array_merge($query_values,array(':aircraft_icao' => $aircraft_icao));
620
+				$query_values = array_merge($query_values, array(':aircraft_icao' => $aircraft_icao));
621 621
 			}
622 622
 		}
623 623
 
624 624
 		if ($aircraft_manufacturer != "")
625 625
 		{
626
-			$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
626
+			$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
627 627
 			if (!is_string($aircraft_manufacturer))
628 628
 			{
629 629
 				return false;
630 630
 			} else {
631 631
 				$additional_query .= " AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer";
632
-				$query_values = array_merge($query_values,array(':aircraft_manufacturer' => $aircraft_manufacturer));
632
+				$query_values = array_merge($query_values, array(':aircraft_manufacturer' => $aircraft_manufacturer));
633 633
 			}
634 634
 		}
635 635
 
@@ -645,25 +645,25 @@  discard block
 block discarded – undo
645 645
 
646 646
 		if ($airline_icao != "")
647 647
 		{
648
-			$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
648
+			$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
649 649
 			if (!is_string($airline_icao))
650 650
 			{
651 651
 				return false;
652 652
 			} else {
653 653
 				$additional_query .= " AND spotter_output.airline_icao = :airline_icao";
654
-				$query_values = array_merge($query_values,array(':airline_icao' => $airline_icao));
654
+				$query_values = array_merge($query_values, array(':airline_icao' => $airline_icao));
655 655
 			}
656 656
 		}
657 657
 
658 658
 		if ($airline_country != "")
659 659
 		{
660
-			$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
660
+			$airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING);
661 661
 			if (!is_string($airline_country))
662 662
 			{
663 663
 				return false;
664 664
 			} else {
665 665
 				$additional_query .= " AND spotter_output.airline_country = :airline_country";
666
-				$query_values = array_merge($query_values,array(':airline_country' => $airline_country));
666
+				$query_values = array_merge($query_values, array(':airline_country' => $airline_country));
667 667
 			}
668 668
 		}
669 669
 
@@ -690,31 +690,31 @@  discard block
 block discarded – undo
690 690
 
691 691
 		if ($airport != "")
692 692
 		{
693
-			$airport = filter_var($airport,FILTER_SANITIZE_STRING);
693
+			$airport = filter_var($airport, FILTER_SANITIZE_STRING);
694 694
 			if (!is_string($airport))
695 695
 			{
696 696
 				return false;
697 697
 			} else {
698 698
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :airport OR spotter_output.arrival_airport_icao = :airport)";
699
-				$query_values = array_merge($query_values,array(':airport' => $airport));
699
+				$query_values = array_merge($query_values, array(':airport' => $airport));
700 700
 			}
701 701
 		}
702 702
 
703 703
 		if ($airport_country != "")
704 704
 		{
705
-			$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
705
+			$airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING);
706 706
 			if (!is_string($airport_country))
707 707
 			{
708 708
 				return false;
709 709
 			} else {
710 710
 				$additional_query .= " AND (spotter_output.departure_airport_country = :airport_country OR spotter_output.arrival_airport_country = :airport_country)";
711
-				$query_values = array_merge($query_values,array(':airport_country' => $airport_country));
711
+				$query_values = array_merge($query_values, array(':airport_country' => $airport_country));
712 712
 			}
713 713
 		}
714 714
     
715 715
 		if ($callsign != "")
716 716
 		{
717
-			$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
717
+			$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
718 718
 			if (!is_string($callsign))
719 719
 			{
720 720
 				return false;
@@ -722,79 +722,79 @@  discard block
 block discarded – undo
722 722
 				$translate = $Translation->ident2icao($callsign);
723 723
 				if ($translate != $callsign) {
724 724
 					$additional_query .= " AND (spotter_output.ident = :callsign OR spotter_output.ident = :translate)";
725
-					$query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate));
725
+					$query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate));
726 726
 				} else {
727 727
 					$additional_query .= " AND spotter_output.ident = :callsign";
728
-					$query_values = array_merge($query_values,array(':callsign' => $callsign));
728
+					$query_values = array_merge($query_values, array(':callsign' => $callsign));
729 729
 				}
730 730
 			}
731 731
 		}
732 732
 
733 733
 		if ($owner != "")
734 734
 		{
735
-			$owner = filter_var($owner,FILTER_SANITIZE_STRING);
735
+			$owner = filter_var($owner, FILTER_SANITIZE_STRING);
736 736
 			if (!is_string($owner))
737 737
 			{
738 738
 				return false;
739 739
 			} else {
740 740
 				$additional_query .= " AND spotter_output.owner_name = :owner";
741
-				$query_values = array_merge($query_values,array(':owner' => $owner));
741
+				$query_values = array_merge($query_values, array(':owner' => $owner));
742 742
 			}
743 743
 		}
744 744
 
745 745
 		if ($pilot_name != "")
746 746
 		{
747
-			$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
747
+			$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
748 748
 			if (!is_string($pilot_name))
749 749
 			{
750 750
 				return false;
751 751
 			} else {
752 752
 				$additional_query .= " AND spotter_output.pilot_name = :pilot_name";
753
-				$query_values = array_merge($query_values,array(':pilot_name' => $pilot_name));
753
+				$query_values = array_merge($query_values, array(':pilot_name' => $pilot_name));
754 754
 			}
755 755
 		}
756 756
 
757 757
 		if ($pilot_id != "")
758 758
 		{
759
-			$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
759
+			$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
760 760
 			if (!is_string($pilot_id))
761 761
 			{
762 762
 				return false;
763 763
 			} else {
764 764
 				$additional_query .= " AND spotter_output.pilot_id = :pilot_id";
765
-				$query_values = array_merge($query_values,array(':pilot_id' => $pilot_id));
765
+				$query_values = array_merge($query_values, array(':pilot_id' => $pilot_id));
766 766
 			}
767 767
 		}
768 768
 
769 769
 		if ($departure_airport_route != "")
770 770
 		{
771
-			$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
771
+			$departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING);
772 772
 			if (!is_string($departure_airport_route))
773 773
 			{
774 774
 				return false;
775 775
 			} else {
776 776
 				$additional_query .= " AND spotter_output.departure_airport_icao = :departure_airport_route";
777
-				$query_values = array_merge($query_values,array(':departure_airport_route' => $departure_airport_route));
777
+				$query_values = array_merge($query_values, array(':departure_airport_route' => $departure_airport_route));
778 778
 			}
779 779
 		}
780 780
 
781 781
 		if ($arrival_airport_route != "")
782 782
 		{
783
-			$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
783
+			$arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING);
784 784
 			if (!is_string($arrival_airport_route))
785 785
 			{
786 786
 				return false;
787 787
 			} else {
788 788
 				$additional_query .= " AND spotter_output.arrival_airport_icao = :arrival_airport_route";
789
-				$query_values = array_merge($query_values,array(':arrival_airport_route' => $arrival_airport_route));
789
+				$query_values = array_merge($query_values, array(':arrival_airport_route' => $arrival_airport_route));
790 790
 			}
791 791
 		}
792 792
 
793 793
 		if ($altitude != "")
794 794
 		{
795 795
 			$altitude_array = explode(",", $altitude);
796
-			$altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
797
-			$altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
796
+			$altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
797
+			$altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
798 798
 
799 799
 			if ($altitude_array[1] != "")
800 800
 			{                
@@ -810,8 +810,8 @@  discard block
 block discarded – undo
810 810
 		if ($date_posted != "")
811 811
 		{
812 812
 			$date_array = explode(",", $date_posted);
813
-			$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
814
-			$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
813
+			$date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
814
+			$date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
815 815
 
816 816
 			if ($globalTimezone != '') {
817 817
 				date_default_timezone_set($globalTimezone);
@@ -842,8 +842,8 @@  discard block
 block discarded – undo
842 842
 		{
843 843
 			$limit_array = explode(",", $limit);
844 844
 			
845
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
846
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
845
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
846
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
847 847
 			
848 848
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
849 849
 			{
@@ -872,23 +872,23 @@  discard block
 block discarded – undo
872 872
 
873 873
 
874 874
 		if ($origLat != "" && $origLon != "" && $dist != "") {
875
-			$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
875
+			$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
876 876
 
877 877
 			if ($globalDBdriver == 'mysql') {
878
-				$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 
878
+				$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 
879 879
 						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)) 
880 880
 						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;
881 881
 			} else {
882
-				$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 
882
+				$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 
883 883
 						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)) 
884 884
 						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;
885 885
 			}
886 886
 		} else {		
887
-			$query  = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' 
887
+			$query = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' 
888 888
 					".$additional_query."
889 889
 					".$orderby_query;
890 890
 		}
891
-		$spotter_array = $this->getDataFromDB($query, $query_values,$limit_query);
891
+		$spotter_array = $this->getDataFromDB($query, $query_values, $limit_query);
892 892
 		return $spotter_array;
893 893
 	}
894 894
 	
@@ -911,8 +911,8 @@  discard block
 block discarded – undo
911 911
 		{
912 912
 			$limit_array = explode(",", $limit);
913 913
 			
914
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
915
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
914
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
915
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
916 916
 			
917 917
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
918 918
 			{
@@ -929,9 +929,9 @@  discard block
 block discarded – undo
929 929
 			$orderby_query = " ORDER BY spotter_output.date DESC";
930 930
 		}
931 931
 
932
-		$query  = $global_query.$filter_query." ".$orderby_query;
932
+		$query = $global_query.$filter_query." ".$orderby_query;
933 933
 
934
-		$spotter_array = $this->getDataFromDB($query, array(),$limit_query,true);
934
+		$spotter_array = $this->getDataFromDB($query, array(), $limit_query, true);
935 935
 
936 936
 		return $spotter_array;
937 937
 	}
@@ -977,34 +977,34 @@  discard block
 block discarded – undo
977 977
 			{
978 978
 				return false;
979 979
 			} else {
980
-				if ($interval == "30m"){
980
+				if ($interval == "30m") {
981 981
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) <= $this_output.date ';
982
-				} else if ($interval == "1h"){
982
+				} else if ($interval == "1h") {
983 983
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) <= $this_output.date ';
984
-				} else if ($interval == "3h"){
984
+				} else if ($interval == "3h") {
985 985
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 3 HOUR) <= $this_output.date ';
986
-				} else if ($interval == "6h"){
986
+				} else if ($interval == "6h") {
987 987
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 6 HOUR) <= $this_output.date ';
988
-				} else if ($interval == "12h"){
988
+				} else if ($interval == "12h") {
989 989
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 HOUR) <= $this_output.date ';
990
-				} else if ($interval == "24h"){
990
+				} else if ($interval == "24h") {
991 991
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 24 HOUR) <= $this_output.date ';
992
-				} else if ($interval == "7d"){
992
+				} else if ($interval == "7d") {
993 993
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) <= $this_output.date ';
994
-				} else if ($interval == "30d"){
994
+				} else if ($interval == "30d") {
995 995
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 DAY) <= $this_output.date ';
996 996
 				} 
997 997
 			}
998 998
 		}
999 999
 
1000
-		$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 
1000
+		$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 
1001 1001
                    WHERE spotter_output.latitude <> '' 
1002 1002
 				   AND spotter_output.longitude <> '' 
1003 1003
                    ".$additional_query."
1004 1004
                    HAVING distance < :radius  
1005 1005
 				   ORDER BY distance";
1006 1006
 
1007
-		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius),$limit_query);
1007
+		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius), $limit_query);
1008 1008
 
1009 1009
 		return $spotter_array;
1010 1010
 	}
@@ -1016,21 +1016,21 @@  discard block
 block discarded – undo
1016 1016
 	* @return Array the spotter information
1017 1017
 	*
1018 1018
 	*/
1019
-	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
1019
+	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '', $filter = array())
1020 1020
 	{
1021 1021
 		global $global_query;
1022 1022
 		
1023 1023
 		date_default_timezone_set('UTC');
1024 1024
 
1025
-		$filter_query = $this->getFilter($filter,true,true);
1025
+		$filter_query = $this->getFilter($filter, true, true);
1026 1026
 
1027 1027
 		$limit_query = '';
1028 1028
 		if ($limit != "")
1029 1029
 		{
1030 1030
 			$limit_array = explode(",", $limit);
1031 1031
 			
1032
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1033
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1032
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1033
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1034 1034
 			
1035 1035
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1036 1036
 			{
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1048 1048
 		}
1049 1049
 
1050
-		$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;
1050
+		$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;
1051 1051
 
1052 1052
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1053 1053
 
@@ -1066,15 +1066,15 @@  discard block
 block discarded – undo
1066 1066
 		global $global_query;
1067 1067
 		
1068 1068
 		date_default_timezone_set('UTC');
1069
-		$filter_query = $this->getFilter($filter,true,true);
1069
+		$filter_query = $this->getFilter($filter, true, true);
1070 1070
 
1071 1071
 		$limit_query = '';
1072 1072
 		if ($limit != "")
1073 1073
 		{
1074 1074
 			$limit_array = explode(",", $limit);
1075 1075
 			
1076
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1077
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1076
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1077
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1078 1078
 			
1079 1079
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1080 1080
 			{
@@ -1091,7 +1091,7 @@  discard block
 block discarded – undo
1091 1091
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1092 1092
 		}
1093 1093
 
1094
-		$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;
1094
+		$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;
1095 1095
 
1096 1096
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1097 1097
 
@@ -1105,20 +1105,20 @@  discard block
 block discarded – undo
1105 1105
 	* @return Array the spotter information
1106 1106
 	*
1107 1107
 	*/
1108
-	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
1108
+	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '', $filter = array())
1109 1109
 	{
1110 1110
 		global $global_query;
1111 1111
 		
1112 1112
 		date_default_timezone_set('UTC');
1113
-		$filter_query = $this->getFilter($filter,true,true);
1113
+		$filter_query = $this->getFilter($filter, true, true);
1114 1114
 		
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.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;
1138
+		$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;
1139 1139
 
1140 1140
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1141 1141
 
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
 		
1156 1156
 		date_default_timezone_set('UTC');
1157 1157
 		
1158
-		$filter_query = $this->getFilter($filter,true,true);
1158
+		$filter_query = $this->getFilter($filter, true, true);
1159 1159
 		
1160 1160
 		$limit_query = '';
1161 1161
 		
@@ -1163,8 +1163,8 @@  discard block
 block discarded – undo
1163 1163
 		{
1164 1164
 			$limit_array = explode(",", $limit);
1165 1165
 			
1166
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1167
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1166
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1167
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1168 1168
 			
1169 1169
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1170 1170
 			{
@@ -1181,7 +1181,7 @@  discard block
 block discarded – undo
1181 1181
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1182 1182
 		}
1183 1183
 
1184
-		$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;
1184
+		$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;
1185 1185
 
1186 1186
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1187 1187
 
@@ -1200,14 +1200,14 @@  discard block
 block discarded – undo
1200 1200
 		global $global_query;
1201 1201
 		
1202 1202
 		date_default_timezone_set('UTC');
1203
-		$filter_query = $this->getFilter($filter,true,true);
1203
+		$filter_query = $this->getFilter($filter, true, true);
1204 1204
 		$limit_query = '';
1205 1205
 		if ($limit != "")
1206 1206
 		{
1207 1207
 			$limit_array = explode(",", $limit);
1208 1208
 			
1209
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1210
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1209
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1210
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1211 1211
 			
1212 1212
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1213 1213
 			{
@@ -1224,7 +1224,7 @@  discard block
 block discarded – undo
1224 1224
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1225 1225
 		}
1226 1226
 
1227
-		$query  = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' 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;
1227
+		$query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' 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;
1228 1228
 
1229 1229
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1230 1230
 
@@ -1248,9 +1248,9 @@  discard block
 block discarded – undo
1248 1248
 		$query_values = array(':id' => $id);
1249 1249
 
1250 1250
 		//$query  = $global_query." WHERE spotter_output.ident <> '' ".$additional_query." ";
1251
-		$query  = $global_query." WHERE ".$additional_query." ";
1251
+		$query = $global_query." WHERE ".$additional_query." ";
1252 1252
 
1253
-		$spotter_array = $this->getDataFromDB($query,$query_values);
1253
+		$spotter_array = $this->getDataFromDB($query, $query_values);
1254 1254
 
1255 1255
 		return $spotter_array;
1256 1256
 	}
@@ -1273,7 +1273,7 @@  discard block
 block discarded – undo
1273 1273
 		$query_values = array();
1274 1274
 		$limit_query = '';
1275 1275
 		$additional_query = '';
1276
-		$filter_query = $this->getFilter($filter,true,true);
1276
+		$filter_query = $this->getFilter($filter, true, true);
1277 1277
 		if ($ident != "")
1278 1278
 		{
1279 1279
 			if (!is_string($ident))
@@ -1289,8 +1289,8 @@  discard block
 block discarded – undo
1289 1289
 		{
1290 1290
 			$limit_array = explode(",", $limit);
1291 1291
 			
1292
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1293
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1292
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1293
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1294 1294
 			
1295 1295
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1296 1296
 			{
@@ -1329,7 +1329,7 @@  discard block
 block discarded – undo
1329 1329
 		$query_values = array();
1330 1330
 		$limit_query = '';
1331 1331
 		$additional_query = '';
1332
-		$filter_query = $this->getFilter($filter,true,true);
1332
+		$filter_query = $this->getFilter($filter, true, true);
1333 1333
 		if ($owner != "")
1334 1334
 		{
1335 1335
 			if (!is_string($owner))
@@ -1345,8 +1345,8 @@  discard block
 block discarded – undo
1345 1345
 		{
1346 1346
 			$limit_array = explode(",", $limit);
1347 1347
 			
1348
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1349
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1348
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1349
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1350 1350
 			
1351 1351
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1352 1352
 			{
@@ -1386,7 +1386,7 @@  discard block
 block discarded – undo
1386 1386
 		$query_values = array();
1387 1387
 		$limit_query = '';
1388 1388
 		$additional_query = '';
1389
-		$filter_query = $this->getFilter($filter,true,true);
1389
+		$filter_query = $this->getFilter($filter, true, true);
1390 1390
 		if ($pilot != "")
1391 1391
 		{
1392 1392
 			$additional_query = " AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot)";
@@ -1397,8 +1397,8 @@  discard block
 block discarded – undo
1397 1397
 		{
1398 1398
 			$limit_array = explode(",", $limit);
1399 1399
 			
1400
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1401
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1400
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1401
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1402 1402
 			
1403 1403
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1404 1404
 			{
@@ -1439,7 +1439,7 @@  discard block
 block discarded – undo
1439 1439
 		$query_values = array();
1440 1440
 		$limit_query = '';
1441 1441
 		$additional_query = '';
1442
-		$filter_query = $this->getFilter($filter,true,true);
1442
+		$filter_query = $this->getFilter($filter, true, true);
1443 1443
 		
1444 1444
 		if ($aircraft_type != "")
1445 1445
 		{
@@ -1456,8 +1456,8 @@  discard block
 block discarded – undo
1456 1456
 		{
1457 1457
 			$limit_array = explode(",", $limit);
1458 1458
 			
1459
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1460
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1459
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1460
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1461 1461
 			
1462 1462
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1463 1463
 			{
@@ -1513,8 +1513,8 @@  discard block
 block discarded – undo
1513 1513
 		{
1514 1514
 			$limit_array = explode(",", $limit);
1515 1515
 			
1516
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1517
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1516
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1517
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1518 1518
 			
1519 1519
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1520 1520
 			{
@@ -1530,7 +1530,7 @@  discard block
 block discarded – undo
1530 1530
 		} else {
1531 1531
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1532 1532
 		}
1533
-		$filter_query = $this->getFilter($filter,true,true);
1533
+		$filter_query = $this->getFilter($filter, true, true);
1534 1534
 
1535 1535
 		//$query = $global_query.$filter_query." spotter_output.ident <> '' ".$additional_query." ".$orderby_query;
1536 1536
 		$query = $global_query.$filter_query." ".$additional_query." ".$orderby_query;
@@ -1549,7 +1549,7 @@  discard block
 block discarded – undo
1549 1549
 	* @return Array the spotter information
1550 1550
 	*
1551 1551
 	*/
1552
-	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1552
+	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '', $filters = array())
1553 1553
 	{
1554 1554
 		global $global_query;
1555 1555
 		
@@ -1558,7 +1558,7 @@  discard block
 block discarded – undo
1558 1558
 		$query_values = array();
1559 1559
 		$limit_query = '';
1560 1560
 		$additional_query = '';
1561
-		$filter_query = $this->getFilter($filters,true,true);
1561
+		$filter_query = $this->getFilter($filters, true, true);
1562 1562
 		
1563 1563
 		if ($airline != "")
1564 1564
 		{
@@ -1575,8 +1575,8 @@  discard block
 block discarded – undo
1575 1575
 		{
1576 1576
 			$limit_array = explode(",", $limit);
1577 1577
 			
1578
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1579
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1578
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1579
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1580 1580
 			
1581 1581
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1582 1582
 			{
@@ -1606,7 +1606,7 @@  discard block
 block discarded – undo
1606 1606
 	* @return Array the spotter information
1607 1607
 	*
1608 1608
 	*/
1609
-	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1609
+	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array())
1610 1610
 	{
1611 1611
 		global $global_query;
1612 1612
 		
@@ -1614,7 +1614,7 @@  discard block
 block discarded – undo
1614 1614
 		$query_values = array();
1615 1615
 		$limit_query = '';
1616 1616
 		$additional_query = '';
1617
-		$filter_query = $this->getFilter($filters,true,true);
1617
+		$filter_query = $this->getFilter($filters, true, true);
1618 1618
 		
1619 1619
 		if ($airport != "")
1620 1620
 		{
@@ -1631,8 +1631,8 @@  discard block
 block discarded – undo
1631 1631
 		{
1632 1632
 			$limit_array = explode(",", $limit);
1633 1633
 			
1634
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1635
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1634
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1635
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1636 1636
 			
1637 1637
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1638 1638
 			{
@@ -1664,7 +1664,7 @@  discard block
 block discarded – undo
1664 1664
 	* @return Array the spotter information
1665 1665
 	*
1666 1666
 	*/
1667
-	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1667
+	public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array())
1668 1668
 	{
1669 1669
 		global $global_query, $globalTimezone, $globalDBdriver;
1670 1670
 		
@@ -1672,7 +1672,7 @@  discard block
 block discarded – undo
1672 1672
 		$limit_query = '';
1673 1673
 		$additional_query = '';
1674 1674
 
1675
-		$filter_query = $this->getFilter($filter,true,true);
1675
+		$filter_query = $this->getFilter($filter, true, true);
1676 1676
 		
1677 1677
 		if ($date != "")
1678 1678
 		{
@@ -1701,8 +1701,8 @@  discard block
 block discarded – undo
1701 1701
 		{
1702 1702
 			$limit_array = explode(",", $limit);
1703 1703
 			
1704
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1705
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1704
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1705
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1706 1706
 			
1707 1707
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1708 1708
 			{
@@ -1732,7 +1732,7 @@  discard block
 block discarded – undo
1732 1732
 	* @return Array the spotter information
1733 1733
 	*
1734 1734
 	*/
1735
-	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1735
+	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '', $filters = array())
1736 1736
 	{
1737 1737
 		global $global_query;
1738 1738
 		
@@ -1741,7 +1741,7 @@  discard block
 block discarded – undo
1741 1741
 		$query_values = array();
1742 1742
 		$limit_query = '';
1743 1743
 		$additional_query = '';
1744
-		$filter_query = $this->getFilter($filters,true,true);
1744
+		$filter_query = $this->getFilter($filters, true, true);
1745 1745
 		if ($country != "")
1746 1746
 		{
1747 1747
 			if (!is_string($country))
@@ -1758,8 +1758,8 @@  discard block
 block discarded – undo
1758 1758
 		{
1759 1759
 			$limit_array = explode(",", $limit);
1760 1760
 			
1761
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1762
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1761
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1762
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1763 1763
 			
1764 1764
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1765 1765
 			{
@@ -1799,7 +1799,7 @@  discard block
 block discarded – undo
1799 1799
 		$query_values = array();
1800 1800
 		$additional_query = '';
1801 1801
 		$limit_query = '';
1802
-		$filter_query = $this->getFilter($filters,true,true);
1802
+		$filter_query = $this->getFilter($filters, true, true);
1803 1803
 		
1804 1804
 		if ($aircraft_manufacturer != "")
1805 1805
 		{
@@ -1816,8 +1816,8 @@  discard block
 block discarded – undo
1816 1816
 		{
1817 1817
 			$limit_array = explode(",", $limit);
1818 1818
 			
1819
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1820
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1819
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1820
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1821 1821
 			
1822 1822
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1823 1823
 			{
@@ -1859,14 +1859,14 @@  discard block
 block discarded – undo
1859 1859
 		$query_values = array();
1860 1860
 		$additional_query = '';
1861 1861
 		$limit_query = '';
1862
-		$filter_query = $this->getFilter($filters,true,true);
1862
+		$filter_query = $this->getFilter($filters, true, true);
1863 1863
 		if ($departure_airport_icao != "")
1864 1864
 		{
1865 1865
 			if (!is_string($departure_airport_icao))
1866 1866
 			{
1867 1867
 				return false;
1868 1868
 			} else {
1869
-				$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1869
+				$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1870 1870
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)";
1871 1871
 				//$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao AND spotter_output.real_departure_airport_icao IS NULL) OR spotter_output.real_departure_airport_icao = :departure_airport_icao";
1872 1872
 				$query_values = array(':departure_airport_icao' => $departure_airport_icao);
@@ -1879,10 +1879,10 @@  discard block
 block discarded – undo
1879 1879
 			{
1880 1880
 				return false;
1881 1881
 			} else {
1882
-				$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1882
+				$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1883 1883
 				$additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)";
1884 1884
 				//$additional_query .= " AND ((spotter_output.arrival_airport_icao = :arrival_airport_icao AND spotter_output.real_arrival_airport_icao IS NULL) OR spotter_output.real_arrival_airport_icao = :arrival_airport_icao)";
1885
-				$query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao));
1885
+				$query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao));
1886 1886
 			}
1887 1887
 		}
1888 1888
 		
@@ -1890,8 +1890,8 @@  discard block
 block discarded – undo
1890 1890
 		{
1891 1891
 			$limit_array = explode(",", $limit);
1892 1892
 			
1893
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1894
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1893
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1894
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1895 1895
 			
1896 1896
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1897 1897
 			{
@@ -1930,15 +1930,15 @@  discard block
 block discarded – undo
1930 1930
 		global $global_query;
1931 1931
 		
1932 1932
 		date_default_timezone_set('UTC');
1933
-		$filter_query = $this->getFilter($filter,true,true);
1933
+		$filter_query = $this->getFilter($filter, true, true);
1934 1934
 		$limit_query = '';
1935 1935
 		
1936 1936
 		if ($limit != "")
1937 1937
 		{
1938 1938
 			$limit_array = explode(",", $limit);
1939 1939
 			
1940
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1941
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1940
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1941
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1942 1942
 			
1943 1943
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1944 1944
 			{
@@ -1955,7 +1955,7 @@  discard block
 block discarded – undo
1955 1955
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1956 1956
 		}
1957 1957
 
1958
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1958
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1959 1959
 
1960 1960
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1961 1961
 
@@ -1968,19 +1968,19 @@  discard block
 block discarded – undo
1968 1968
 	* @return String the highlight text
1969 1969
 	*
1970 1970
 	*/
1971
-	public function getHighlightByRegistration($registration,$filter = array())
1971
+	public function getHighlightByRegistration($registration, $filter = array())
1972 1972
 	{
1973 1973
 		global $global_query;
1974 1974
 		
1975 1975
 		date_default_timezone_set('UTC');
1976
-		$filter_query = $this->getFilter($filter,true,true);
1977
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
1976
+		$filter_query = $this->getFilter($filter, true, true);
1977
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
1978 1978
 		
1979
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1979
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1980 1980
 		$sth = $this->db->prepare($query);
1981 1981
 		$sth->execute(array(':registration' => $registration));
1982 1982
 
1983
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1983
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1984 1984
 		{
1985 1985
 			$highlight = $row['highlight'];
1986 1986
 		}
@@ -1996,14 +1996,14 @@  discard block
 block discarded – undo
1996 1996
 	* @return String usage
1997 1997
 	*
1998 1998
 	*/
1999
-	public function getSquawkUsage($squawk = '',$country = 'FR')
1999
+	public function getSquawkUsage($squawk = '', $country = 'FR')
2000 2000
 	{
2001 2001
 		
2002
-		$squawk = filter_var($squawk,FILTER_SANITIZE_STRING);
2003
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
2002
+		$squawk = filter_var($squawk, FILTER_SANITIZE_STRING);
2003
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
2004 2004
 
2005 2005
 		$query  = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1";
2006
-		$query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country);
2006
+		$query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country);
2007 2007
 		
2008 2008
 		$sth = $this->db->prepare($query);
2009 2009
 		$sth->execute($query_values);
@@ -2025,9 +2025,9 @@  discard block
 block discarded – undo
2025 2025
 	public function getAirportIcao($airport_iata = '')
2026 2026
 	{
2027 2027
 		
2028
-		$airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING);
2028
+		$airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING);
2029 2029
 
2030
-		$query  = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
2030
+		$query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
2031 2031
 		$query_values = array(':airport' => $airport_iata);
2032 2032
 		
2033 2033
 		$sth = $this->db->prepare($query);
@@ -2049,12 +2049,12 @@  discard block
 block discarded – undo
2049 2049
 	* @return Float distance to the airport
2050 2050
 	*
2051 2051
 	*/
2052
-	public function getAirportDistance($airport_icao,$latitude,$longitude)
2052
+	public function getAirportDistance($airport_icao, $latitude, $longitude)
2053 2053
 	{
2054 2054
 		
2055
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
2055
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
2056 2056
 
2057
-		$query  = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
2057
+		$query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
2058 2058
 		$query_values = array(':airport' => $airport_icao);
2059 2059
 		$sth = $this->db->prepare($query);
2060 2060
 		$sth->execute($query_values);
@@ -2064,7 +2064,7 @@  discard block
 block discarded – undo
2064 2064
 			$airport_latitude = $row['latitude'];
2065 2065
 			$airport_longitude = $row['longitude'];
2066 2066
 			$Common = new Common();
2067
-			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
2067
+			return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude);
2068 2068
 		} else return '';
2069 2069
 	}
2070 2070
 	
@@ -2078,11 +2078,11 @@  discard block
 block discarded – undo
2078 2078
 	public function getAllAirportInfo($airport = '')
2079 2079
 	{
2080 2080
 		
2081
-		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
2081
+		$airport = filter_var($airport, FILTER_SANITIZE_STRING);
2082 2082
 
2083 2083
 		$query_values = array();
2084 2084
 		if ($airport == 'NA') {
2085
-			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' => ''));
2085
+			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' => ''));
2086 2086
 		} elseif ($airport == '') {
2087 2087
 			$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";
2088 2088
 		} else {
@@ -2130,14 +2130,14 @@  discard block
 block discarded – undo
2130 2130
 	{
2131 2131
 		$lst_countries = '';
2132 2132
 		foreach ($countries as $country) {
2133
-			$country = filter_var($country,FILTER_SANITIZE_STRING);
2133
+			$country = filter_var($country, FILTER_SANITIZE_STRING);
2134 2134
 			if ($lst_countries == '') {
2135 2135
 				$lst_countries = "'".$country."'";
2136 2136
 			} else {
2137 2137
 				$lst_countries .= ",'".$country."'";
2138 2138
 			}
2139 2139
 		}
2140
-		$query  = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
2140
+		$query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
2141 2141
 		
2142 2142
 		$sth = $this->db->prepare($query);
2143 2143
 		$sth->execute();
@@ -2145,7 +2145,7 @@  discard block
 block discarded – undo
2145 2145
 		$airport_array = array();
2146 2146
 		$temp_array = array();
2147 2147
 		
2148
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2148
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2149 2149
 		{
2150 2150
 			$temp_array['name'] = $row['name'];
2151 2151
 			$temp_array['city'] = $row['city'];
@@ -2173,10 +2173,10 @@  discard block
 block discarded – undo
2173 2173
 	{
2174 2174
 		global $globalDBdriver;
2175 2175
 		if (is_array($coord)) {
2176
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2177
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2178
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2179
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2176
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2177
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2178
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2179
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2180 2180
 		} else return array();
2181 2181
 		if ($globalDBdriver == 'mysql') {
2182 2182
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
@@ -2188,7 +2188,7 @@  discard block
 block discarded – undo
2188 2188
     
2189 2189
 		$airport_array = array();
2190 2190
 		
2191
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2191
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2192 2192
 		{
2193 2193
 			$temp_array = $row;
2194 2194
 
@@ -2208,13 +2208,13 @@  discard block
 block discarded – undo
2208 2208
 	public function getAllWaypointsInfobyCoord($coord)
2209 2209
 	{
2210 2210
 		if (is_array($coord)) {
2211
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2212
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2213
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2214
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
2211
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2212
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2213
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2214
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
2215 2215
 		} else return array();
2216 2216
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
2217
-		$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.")";
2217
+		$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.")";
2218 2218
 		//$query  = "SELECT waypoints.* FROM waypoints";
2219 2219
 		//$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";
2220 2220
 		//$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;
@@ -2226,7 +2226,7 @@  discard block
 block discarded – undo
2226 2226
     
2227 2227
 		$waypoints_array = array();
2228 2228
 		
2229
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2229
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2230 2230
 		{
2231 2231
 			$temp_array = $row;
2232 2232
 
@@ -2248,10 +2248,10 @@  discard block
 block discarded – undo
2248 2248
 	{
2249 2249
 		global $globalUseRealAirlines;
2250 2250
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2251
-		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2251
+		$airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING));
2252 2252
 		if ($airline_icao == 'NA') {
2253 2253
 			$airline_array = array();
2254
-			$airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2254
+			$airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2255 2255
 			return $airline_array;
2256 2256
 		} else {
2257 2257
 			if (strlen($airline_icao) == 2) {
@@ -2272,7 +2272,7 @@  discard block
 block discarded – undo
2272 2272
 			if ($fromsource === NULL) {
2273 2273
 				$sth->execute(array(':airline_icao' => $airline_icao));
2274 2274
 			} else {
2275
-				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2275
+				$sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource));
2276 2276
 			}
2277 2277
                         /*
2278 2278
 			$airline_array = array();
@@ -2317,13 +2317,13 @@  discard block
 block discarded – undo
2317 2317
 	{
2318 2318
 		global $globalUseRealAirlines;
2319 2319
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2320
-		$airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING));
2321
-		$query  = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1";
2320
+		$airline_name = strtolower(filter_var($airline_name, FILTER_SANITIZE_STRING));
2321
+		$query = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1";
2322 2322
 		$sth = $this->db->prepare($query);
2323 2323
 		if ($fromsource === NULL) {
2324 2324
 			$sth->execute(array(':airline_name' => $airline_name));
2325 2325
 		} else {
2326
-			$sth->execute(array(':airline_name' => $airline_name,':fromsource' => $fromsource));
2326
+			$sth->execute(array(':airline_name' => $airline_name, ':fromsource' => $fromsource));
2327 2327
 		}
2328 2328
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2329 2329
 		if (empty($result) && $fromsource !== NULL) {
@@ -2348,12 +2348,12 @@  discard block
 block discarded – undo
2348 2348
 	*/
2349 2349
 	public function getAllAircraftInfo($aircraft_type)
2350 2350
 	{
2351
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2351
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2352 2352
 
2353 2353
 		if ($aircraft_type == 'NA') {
2354
-			return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2354
+			return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2355 2355
 		}
2356
-		$query  = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow, aircraft.official_page, aircraft.aircraft_description, aircraft.engine_type, aircraft.engine_count, aircraft.wake_category FROM aircraft WHERE aircraft.icao = :aircraft_type";
2356
+		$query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow, aircraft.official_page, aircraft.aircraft_description, aircraft.engine_type, aircraft.engine_count, aircraft.wake_category FROM aircraft WHERE aircraft.icao = :aircraft_type";
2357 2357
 		
2358 2358
 		$sth = $this->db->prepare($query);
2359 2359
 		$sth->execute(array(':aircraft_type' => $aircraft_type));
@@ -2385,7 +2385,7 @@  discard block
 block discarded – undo
2385 2385
 	*/
2386 2386
 	public function getAircraftIcao($aircraft_type)
2387 2387
 	{
2388
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2388
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2389 2389
 		$all_aircraft = array('737-300' => 'B733',
2390 2390
 				'777-200' => 'B772',
2391 2391
 				'777-200ER' => 'B772',
@@ -2397,10 +2397,10 @@  discard block
 block discarded – undo
2397 2397
 				'A380' => 'A388');
2398 2398
 		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2399 2399
 
2400
-		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2400
+		$query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2401 2401
 		$aircraft_type = strtoupper($aircraft_type);
2402 2402
 		$sth = $this->db->prepare($query);
2403
-		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2403
+		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,));
2404 2404
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2405 2405
 		if (isset($result[0]['icao'])) return $result[0]['icao'];
2406 2406
 		else return '';
@@ -2413,10 +2413,10 @@  discard block
 block discarded – undo
2413 2413
 	* @return String aircraft type
2414 2414
 	*
2415 2415
 	*/
2416
-	public function getAllAircraftType($aircraft_modes,$source_type = '')
2416
+	public function getAllAircraftType($aircraft_modes, $source_type = '')
2417 2417
 	{
2418
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
2419
-		$source_type = filter_var($source_type,FILTER_SANITIZE_STRING);
2418
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
2419
+		$source_type = filter_var($source_type, FILTER_SANITIZE_STRING);
2420 2420
 
2421 2421
 		if ($source_type == '' || $source_type == 'modes') {
2422 2422
 			$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes AND aircraft_modes.source_type = 'modes' ORDER BY FirstCreated DESC LIMIT 1";
@@ -2447,9 +2447,9 @@  discard block
 block discarded – undo
2447 2447
 	*/
2448 2448
 	public function getAllAircraftTypeByRegistration($registration)
2449 2449
 	{
2450
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2450
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2451 2451
 
2452
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1";
2452
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1";
2453 2453
 		
2454 2454
 		$sth = $this->db->prepare($query);
2455 2455
 		$sth->execute(array(':registration' => $registration));
@@ -2470,9 +2470,9 @@  discard block
 block discarded – undo
2470 2470
 	*/
2471 2471
 	public function getAllIDByRegistration($registration)
2472 2472
 	{
2473
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2473
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2474 2474
 
2475
-		$query  = "SELECT spotter_id,flightaware_id, date FROM spotter_output WHERE spotter_output.registration = :registration";
2475
+		$query = "SELECT spotter_id,flightaware_id, date FROM spotter_output WHERE spotter_output.registration = :registration";
2476 2476
 		
2477 2477
 		$sth = $this->db->prepare($query);
2478 2478
 		$sth->execute(array(':registration' => $registration));
@@ -2480,7 +2480,7 @@  discard block
 block discarded – undo
2480 2480
 		$idarray = array();
2481 2481
 		while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
2482 2482
 			$date = $row['date'];
2483
-			$idarray[$date] = array('flightaware_id' => $row['flightaware_id'],'spotter_id' => $row['spotter_id']);
2483
+			$idarray[$date] = array('flightaware_id' => $row['flightaware_id'], 'spotter_id' => $row['spotter_id']);
2484 2484
 		}
2485 2485
 		return $idarray;
2486 2486
 	}
@@ -2494,8 +2494,8 @@  discard block
 block discarded – undo
2494 2494
 	*/
2495 2495
 	public function getOperator($operator)
2496 2496
 	{
2497
-		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
2498
-		$query  = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2497
+		$operator = filter_var($operator, FILTER_SANITIZE_STRING);
2498
+		$query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2499 2499
 		
2500 2500
 		$sth = $this->db->prepare($query);
2501 2501
 		$sth->execute(array(':operator' => $operator));
@@ -2516,9 +2516,9 @@  discard block
 block discarded – undo
2516 2516
 	*/
2517 2517
 	public function getRouteInfo($callsign)
2518 2518
 	{
2519
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2519
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
2520 2520
                 if ($callsign == '') return array();
2521
-		$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";
2521
+		$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";
2522 2522
 		
2523 2523
 		$sth = $this->db->prepare($query);
2524 2524
 		$sth->execute(array(':callsign' => $callsign));
@@ -2539,9 +2539,9 @@  discard block
 block discarded – undo
2539 2539
 	*/
2540 2540
 	public function getAircraftInfoByRegistration($registration)
2541 2541
 	{
2542
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2542
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2543 2543
 
2544
-		$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";
2544
+		$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";
2545 2545
 		
2546 2546
 		$sth = $this->db->prepare($query);
2547 2547
 		$sth->execute(array(':registration' => $registration));
@@ -2549,7 +2549,7 @@  discard block
 block discarded – undo
2549 2549
 		$aircraft_array = array();
2550 2550
 		$temp_array = array();
2551 2551
 		
2552
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2552
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2553 2553
 		{
2554 2554
 			$temp_array['airline_icao'] = $row['airline_icao'];
2555 2555
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -2571,7 +2571,7 @@  discard block
 block discarded – undo
2571 2571
 	*/
2572 2572
 	public function getAircraftOwnerByRegistration($registration)
2573 2573
 	{
2574
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2574
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2575 2575
 		$Connection = new Connection($this->db);
2576 2576
 		if ($Connection->tableExists('aircraft_owner')) {
2577 2577
 			$query  = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1";
@@ -2593,7 +2593,7 @@  discard block
 block discarded – undo
2593 2593
 	public function getAllFlightsforSitemap()
2594 2594
 	{
2595 2595
 		//$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 ";
2596
-		$query  = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2596
+		$query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2597 2597
 		
2598 2598
 		$sth = $this->db->prepare($query);
2599 2599
 		$sth->execute();
@@ -2640,7 +2640,7 @@  discard block
 block discarded – undo
2640 2640
 		$manufacturer_array = array();
2641 2641
 		$temp_array = array();
2642 2642
 		
2643
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2643
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2644 2644
 		{
2645 2645
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
2646 2646
 
@@ -2677,7 +2677,7 @@  discard block
 block discarded – undo
2677 2677
 		$aircraft_array = array();
2678 2678
 		$temp_array = array();
2679 2679
 		
2680
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2680
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2681 2681
 		{
2682 2682
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
2683 2683
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
@@ -2698,8 +2698,8 @@  discard block
 block discarded – undo
2698 2698
 	*/
2699 2699
 	public function getAllAircraftRegistrations($filters = array())
2700 2700
 	{
2701
-		$filter_query = $this->getFilter($filters,true,true);
2702
-		$query  = "SELECT DISTINCT spotter_output.registration 
2701
+		$filter_query = $this->getFilter($filters, true, true);
2702
+		$query = "SELECT DISTINCT spotter_output.registration 
2703 2703
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' 
2704 2704
 				ORDER BY spotter_output.registration ASC";
2705 2705
 
@@ -2709,7 +2709,7 @@  discard block
 block discarded – undo
2709 2709
 		$aircraft_array = array();
2710 2710
 		$temp_array = array();
2711 2711
 		
2712
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2712
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2713 2713
 		{
2714 2714
 			$temp_array['registration'] = $row['registration'];
2715 2715
 
@@ -2726,11 +2726,11 @@  discard block
 block discarded – undo
2726 2726
 	* @return Array list of source name
2727 2727
 	*
2728 2728
 	*/
2729
-	public function getAllSourceName($type = '',$filters = array())
2729
+	public function getAllSourceName($type = '', $filters = array())
2730 2730
 	{
2731
-		$filter_query = $this->getFilter($filters,true,true);
2731
+		$filter_query = $this->getFilter($filters, true, true);
2732 2732
 		$query_values = array();
2733
-		$query  = "SELECT DISTINCT spotter_output.source_name 
2733
+		$query = "SELECT DISTINCT spotter_output.source_name 
2734 2734
 				FROM spotter_output".$filter_query." spotter_output.source_name <> ''";
2735 2735
 		if ($type != '') {
2736 2736
 			$query_values = array(':type' => $type);
@@ -2745,7 +2745,7 @@  discard block
 block discarded – undo
2745 2745
 		$source_array = array();
2746 2746
 		$temp_array = array();
2747 2747
 		
2748
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2748
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2749 2749
 		{
2750 2750
 			$temp_array['source_name'] = $row['source_name'];
2751 2751
 			$source_array[] = $temp_array;
@@ -2761,11 +2761,11 @@  discard block
 block discarded – undo
2761 2761
 	* @return Array list of airline names
2762 2762
 	*
2763 2763
 	*/
2764
-	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2764
+	public function getAllAirlineNames($airline_type = '', $forsource = NULL, $filters = array())
2765 2765
 	{
2766
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2767
-		$filter_query = $this->getFilter($filters,true,true);
2768
-		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
2766
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2767
+		$filter_query = $this->getFilter($filters, true, true);
2768
+		$airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
2769 2769
 		if ($airline_type == '' || $airline_type == 'all') {
2770 2770
 			/*
2771 2771
 			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
@@ -2784,7 +2784,7 @@  discard block
 block discarded – undo
2784 2784
 				$query_data = array(':forsource' => $forsource);
2785 2785
 			}
2786 2786
 		} else {
2787
-			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2787
+			$query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2788 2788
 					FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
2789 2789
 					AND spotter_output.airline_type = :airline_type 
2790 2790
 					ORDER BY spotter_output.airline_icao ASC";
@@ -2797,7 +2797,7 @@  discard block
 block discarded – undo
2797 2797
 		$airline_array = array();
2798 2798
 		$temp_array = array();
2799 2799
 		
2800
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2800
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2801 2801
 		{
2802 2802
 			$temp_array['airline_icao'] = $row['airline_icao'];
2803 2803
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -2814,10 +2814,10 @@  discard block
 block discarded – undo
2814 2814
 	* @return Array list of alliance names
2815 2815
 	*
2816 2816
 	*/
2817
-	public function getAllAllianceNames($forsource = NULL,$filters = array())
2817
+	public function getAllAllianceNames($forsource = NULL, $filters = array())
2818 2818
 	{
2819
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2820
-		$filter_query = $this->getFilter($filters,true,true);
2819
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2820
+		$filter_query = $this->getFilter($filters, true, true);
2821 2821
 		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2822 2822
 		elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2823 2823
 		elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
@@ -2845,8 +2845,8 @@  discard block
 block discarded – undo
2845 2845
 	*/
2846 2846
 	public function getAllAirlineCountries($filters = array())
2847 2847
 	{
2848
-		$filter_query = $this->getFilter($filters,true,true);
2849
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2848
+		$filter_query = $this->getFilter($filters, true, true);
2849
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2850 2850
 				FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2851 2851
 				ORDER BY spotter_output.airline_country ASC";
2852 2852
 		
@@ -2857,7 +2857,7 @@  discard block
 block discarded – undo
2857 2857
 		$airline_array = array();
2858 2858
 		$temp_array = array();
2859 2859
 		
2860
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2860
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2861 2861
 		{
2862 2862
 			$temp_array['airline_country'] = $row['airline_country'];
2863 2863
 
@@ -2877,9 +2877,9 @@  discard block
 block discarded – undo
2877 2877
 	*/
2878 2878
 	public function getAllAirportNames($filters = array())
2879 2879
 	{
2880
-		$filter_query = $this->getFilter($filters,true,true);
2880
+		$filter_query = $this->getFilter($filters, true, true);
2881 2881
 		$airport_array = array();
2882
-		$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
2882
+		$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
2883 2883
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' 
2884 2884
 				ORDER BY spotter_output.departure_airport_city ASC";
2885 2885
 		
@@ -2888,7 +2888,7 @@  discard block
 block discarded – undo
2888 2888
 		$sth->execute();
2889 2889
 
2890 2890
 		$temp_array = array();
2891
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2891
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2892 2892
 		{
2893 2893
 			$temp_array['airport_icao'] = $row['airport_icao'];
2894 2894
 			$temp_array['airport_name'] = $row['airport_name'];
@@ -2898,14 +2898,14 @@  discard block
 block discarded – undo
2898 2898
 			$airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array;
2899 2899
 		}
2900 2900
 
2901
-		$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
2901
+		$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
2902 2902
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' 
2903 2903
 								ORDER BY spotter_output.arrival_airport_city ASC";
2904 2904
 					
2905 2905
 		$sth = $this->db->prepare($query);
2906 2906
 		$sth->execute();
2907 2907
 
2908
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2908
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2909 2909
 			{
2910 2910
 		//	if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao'])
2911 2911
 		//	{
@@ -2929,8 +2929,8 @@  discard block
 block discarded – undo
2929 2929
 	*/
2930 2930
 	public function getAllOwnerNames($filters = array())
2931 2931
 	{
2932
-		$filter_query = $this->getFilter($filters,true,true);
2933
-		$query  = "SELECT DISTINCT spotter_output.owner_name
2932
+		$filter_query = $this->getFilter($filters, true, true);
2933
+		$query = "SELECT DISTINCT spotter_output.owner_name
2934 2934
 				FROM spotter_output".$filter_query." spotter_output.owner_name <> '' 
2935 2935
 				ORDER BY spotter_output.owner_name ASC";
2936 2936
 		
@@ -2947,8 +2947,8 @@  discard block
 block discarded – undo
2947 2947
 	*/
2948 2948
 	public function getAllPilotNames($filters = array())
2949 2949
 	{
2950
-		$filter_query = $this->getFilter($filters,true,true);
2951
-		$query  = "SELECT DISTINCT spotter_output.pilot_name, spotter_output.pilot_id
2950
+		$filter_query = $this->getFilter($filters, true, true);
2951
+		$query = "SELECT DISTINCT spotter_output.pilot_name, spotter_output.pilot_id
2952 2952
 				FROM spotter_output".$filter_query." spotter_output.pilot_name <> '' 
2953 2953
 				ORDER BY spotter_output.pilot_name ASC";
2954 2954
 		
@@ -2981,21 +2981,21 @@  discard block
 block discarded – undo
2981 2981
    
2982 2982
 		$temp_array = array();
2983 2983
 		
2984
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2984
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2985 2985
 		{
2986 2986
 			$temp_array['airport_country'] = $row['airport_country'];
2987 2987
 
2988 2988
 			$airport_array[$row['airport_country']] = $temp_array;
2989 2989
 		}
2990
-		$filter_query = $this->getFilter($filters,true,true);
2991
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2990
+		$filter_query = $this->getFilter($filters, true, true);
2991
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2992 2992
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2993 2993
 								ORDER BY spotter_output.arrival_airport_country ASC";
2994 2994
 					
2995 2995
 		$sth = $this->db->prepare($query);
2996 2996
 		$sth->execute();
2997 2997
 		
2998
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2998
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2999 2999
 		{
3000 3000
 			if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country'])
3001 3001
 			{
@@ -3018,9 +3018,9 @@  discard block
 block discarded – undo
3018 3018
 	*/
3019 3019
 	public function getAllCountries($filters = array())
3020 3020
 	{
3021
-		$Connection= new Connection($this->db);
3021
+		$Connection = new Connection($this->db);
3022 3022
 		if ($Connection->tableExists('countries')) {
3023
-			$query  = "SELECT countries.name AS airport_country
3023
+			$query = "SELECT countries.name AS airport_country
3024 3024
 				FROM countries
3025 3025
 				ORDER BY countries.name ASC";
3026 3026
 			$sth = $this->db->prepare($query);
@@ -3029,14 +3029,14 @@  discard block
 block discarded – undo
3029 3029
 			$temp_array = array();
3030 3030
 			$country_array = array();
3031 3031
 		
3032
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
3032
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3033 3033
 			{
3034 3034
 				$temp_array['country'] = $row['airport_country'];
3035 3035
 				$country_array[$row['airport_country']] = $temp_array;
3036 3036
 			}
3037 3037
 		} else {
3038
-			$filter_query = $this->getFilter($filters,true,true);
3039
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
3038
+			$filter_query = $this->getFilter($filters, true, true);
3039
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
3040 3040
 								FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' 
3041 3041
 								ORDER BY spotter_output.departure_airport_country ASC";
3042 3042
 
@@ -3045,20 +3045,20 @@  discard block
 block discarded – undo
3045 3045
    
3046 3046
 			$temp_array = array();
3047 3047
 			$country_array = array();
3048
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
3048
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3049 3049
 			{
3050 3050
 				$temp_array['country'] = $row['airport_country'];
3051 3051
 				$country_array[$row['airport_country']] = $temp_array;
3052 3052
 			}
3053 3053
 
3054
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
3054
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
3055 3055
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
3056 3056
 								ORDER BY spotter_output.arrival_airport_country ASC";
3057 3057
 					
3058 3058
 		$sth = $this->db->prepare($query);
3059 3059
 		$sth->execute();
3060 3060
 		
3061
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3061
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3062 3062
 		{
3063 3063
 			if ($country_array[$row['airport_country']]['country'] != $row['airport_country'])
3064 3064
 			{
@@ -3068,14 +3068,14 @@  discard block
 block discarded – undo
3068 3068
 			}
3069 3069
 		}
3070 3070
 		
3071
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
3071
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
3072 3072
 								FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
3073 3073
 								ORDER BY spotter_output.airline_country ASC";
3074 3074
 					
3075 3075
 		$sth = $this->db->prepare($query);
3076 3076
 		$sth->execute();
3077 3077
 		
3078
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3078
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3079 3079
 		{
3080 3080
 			if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country'])
3081 3081
 			{
@@ -3099,8 +3099,8 @@  discard block
 block discarded – undo
3099 3099
 	*/
3100 3100
 	public function getAllIdents($filters = array())
3101 3101
 	{
3102
-		$filter_query = $this->getFilter($filters,true,true);
3103
-		$query  = "SELECT DISTINCT spotter_output.ident
3102
+		$filter_query = $this->getFilter($filters, true, true);
3103
+		$query = "SELECT DISTINCT spotter_output.ident
3104 3104
 								FROM spotter_output".$filter_query." spotter_output.ident <> '' 
3105 3105
 								ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0";
3106 3106
 
@@ -3110,7 +3110,7 @@  discard block
 block discarded – undo
3110 3110
 		$ident_array = array();
3111 3111
 		$temp_array = array();
3112 3112
 		
3113
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3113
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3114 3114
 		{
3115 3115
 			$temp_array['ident'] = $row['ident'];
3116 3116
 			$ident_array[] = $temp_array;
@@ -3124,9 +3124,9 @@  discard block
 block discarded – undo
3124 3124
 	* @return Array number, icao, name and city of airports
3125 3125
 	*/
3126 3126
 
3127
-	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
3127
+	public function getLast7DaysAirportsDeparture($airport_icao = '', $filters = array()) {
3128 3128
 		global $globalTimezone, $globalDBdriver;
3129
-		$filter_query = $this->getFilter($filters,true,true);
3129
+		$filter_query = $this->getFilter($filters, true, true);
3130 3130
 		if ($globalTimezone != '') {
3131 3131
 			date_default_timezone_set($globalTimezone);
3132 3132
 			$datetime = new DateTime();
@@ -3191,7 +3191,7 @@  discard block
 block discarded – undo
3191 3191
 
3192 3192
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
3193 3193
 		global $globalTimezone, $globalDBdriver;
3194
-		$filter_query = $this->getFilter($filters,true,true);
3194
+		$filter_query = $this->getFilter($filters, true, true);
3195 3195
 		if ($globalTimezone != '') {
3196 3196
 			date_default_timezone_set($globalTimezone);
3197 3197
 			$datetime = new DateTime();
@@ -3275,7 +3275,7 @@  discard block
 block discarded – undo
3275 3275
 
3276 3276
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
3277 3277
 		global $globalTimezone, $globalDBdriver;
3278
-		$filter_query = $this->getFilter($filters,true,true);
3278
+		$filter_query = $this->getFilter($filters, true, true);
3279 3279
 		if ($globalTimezone != '') {
3280 3280
 			date_default_timezone_set($globalTimezone);
3281 3281
 			$datetime = new DateTime();
@@ -3308,9 +3308,9 @@  discard block
 block discarded – undo
3308 3308
 	* @return Array number, icao, name and city of airports
3309 3309
 	*/
3310 3310
 
3311
-	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
3311
+	public function getLast7DaysDetectedAirportsArrival($airport_icao = '', $filters = array()) {
3312 3312
 		global $globalTimezone, $globalDBdriver;
3313
-		$filter_query = $this->getFilter($filters,true,true);
3313
+		$filter_query = $this->getFilter($filters, true, true);
3314 3314
 		if ($globalTimezone != '') {
3315 3315
 			date_default_timezone_set($globalTimezone);
3316 3316
 			$datetime = new DateTime();
@@ -3442,12 +3442,12 @@  discard block
 block discarded – undo
3442 3442
 		} else $offset = '+00:00';
3443 3443
 
3444 3444
 		if ($globalDBdriver == 'mysql') {
3445
-			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3445
+			$query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3446 3446
 								FROM spotter_output
3447 3447
 								WHERE spotter_output.date <> '' 
3448 3448
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
3449 3449
 		} else {
3450
-			$query  = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3450
+			$query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3451 3451
 								FROM spotter_output
3452 3452
 								WHERE spotter_output.date <> '' 
3453 3453
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
@@ -3459,7 +3459,7 @@  discard block
 block discarded – undo
3459 3459
 		$date_array = array();
3460 3460
 		$temp_array = array();
3461 3461
 		
3462
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3462
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3463 3463
 		{
3464 3464
 			$temp_array['date'] = $row['date'];
3465 3465
 
@@ -3479,7 +3479,7 @@  discard block
 block discarded – undo
3479 3479
 	*/
3480 3480
 	public function getAllRoutes()
3481 3481
 	{
3482
-		$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 
3482
+		$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 
3483 3483
 				FROM spotter_output
3484 3484
 				WHERE spotter_output.ident <> '' 
3485 3485
 				GROUP BY route
@@ -3490,7 +3490,7 @@  discard block
 block discarded – undo
3490 3490
 
3491 3491
 		$routes_array = array();
3492 3492
 		$temp_array = array();
3493
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3493
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3494 3494
 		{
3495 3495
 			$temp_array['route'] = $row['route'];
3496 3496
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -3509,21 +3509,21 @@  discard block
 block discarded – undo
3509 3509
 	* @return String success or false
3510 3510
 	*
3511 3511
 	*/	
3512
-	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3512
+	public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL)
3513 3513
 	{
3514 3514
 		if (!is_numeric(substr($ident, 0, 3)))
3515 3515
 		{
3516 3516
 			if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3517
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3517
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3518 3518
 			} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3519
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3519
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3520 3520
 			} else {
3521 3521
 				$airline_array = $this->getAllAirlineInfo("NA");
3522 3522
 			}
3523 3523
 			if (count($airline_array) == 0) {
3524 3524
 				$airline_array = $this->getAllAirlineInfo("NA");
3525 3525
 			}
3526
-			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3526
+			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3527 3527
 				$airline_array = $this->getAllAirlineInfo("NA");
3528 3528
 			}
3529 3529
 		} else {
@@ -3536,7 +3536,7 @@  discard block
 block discarded – undo
3536 3536
 
3537 3537
 
3538 3538
 		$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';
3539
-                $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);
3539
+                $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);
3540 3540
 
3541 3541
 		try {
3542 3542
 			$sth = $this->db->prepare($query);
@@ -3557,11 +3557,11 @@  discard block
 block discarded – undo
3557 3557
 	* @return String success or false
3558 3558
 	*
3559 3559
 	*/	
3560
-	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3560
+	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '')
3561 3561
 	{
3562 3562
 		if ($groundspeed == '') $groundspeed = NULL;
3563 3563
 		$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';
3564
-                $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);
3564
+                $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);
3565 3565
 
3566 3566
 		try {
3567 3567
 			$sth = $this->db->prepare($query);
@@ -3601,7 +3601,7 @@  discard block
 block discarded – undo
3601 3601
 	* @param String $verticalrate vertival rate of flight
3602 3602
 	* @return String success or false
3603 3603
 	*/
3604
-	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$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 = '',$source_type = '')
3604
+	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '', $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 = '', $source_type = '')
3605 3605
 	{
3606 3606
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
3607 3607
 		
@@ -3624,14 +3624,14 @@  discard block
 block discarded – undo
3624 3624
 			} else {
3625 3625
 				if ($ModeS != '') {
3626 3626
 					$timeelapsed = microtime(true);
3627
-					$registration = $this->getAircraftRegistrationBymodeS($ModeS,$source_type);
3628
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3627
+					$registration = $this->getAircraftRegistrationBymodeS($ModeS, $source_type);
3628
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3629 3629
 				} else {
3630
-					$myhex = explode('-',$flightaware_id);
3630
+					$myhex = explode('-', $flightaware_id);
3631 3631
 					if (count($myhex) > 0) {
3632 3632
 						$timeelapsed = microtime(true);
3633
-						$registration = $this->getAircraftRegistrationBymodeS($myhex[0],$source_type);
3634
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3633
+						$registration = $this->getAircraftRegistrationBymodeS($myhex[0], $source_type);
3634
+						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3635 3635
 					}
3636 3636
 				}
3637 3637
 			}
@@ -3653,24 +3653,24 @@  discard block
 block discarded – undo
3653 3653
 				{
3654 3654
 					$timeelapsed = microtime(true);
3655 3655
 					if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3656
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3656
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3657 3657
 					} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3658
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3658
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3659 3659
 					} else {
3660 3660
 						$airline_array = $this->getAllAirlineInfo("NA");
3661 3661
 					}
3662 3662
 					if (count($airline_array) == 0) {
3663 3663
 						$airline_array = $this->getAllAirlineInfo("NA");
3664 3664
 					}
3665
-					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3665
+					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3666 3666
 						$airline_array = $this->getAllAirlineInfo("NA");
3667 3667
 					}
3668
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3668
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3669 3669
 
3670 3670
 				} else {
3671 3671
 					$timeelapsed = microtime(true);
3672 3672
 					$airline_array = $this->getAllAirlineInfo("NA");
3673
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3673
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3674 3674
 				}
3675 3675
 			}
3676 3676
 		} else $airline_array = array();
@@ -3687,27 +3687,27 @@  discard block
 block discarded – undo
3687 3687
 				{
3688 3688
 					$timeelapsed = microtime(true);
3689 3689
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3690
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3690
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3691 3691
 				} else {
3692 3692
 					$timeelapsed = microtime(true);
3693 3693
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3694
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3694
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3695 3695
 				}
3696 3696
 			}
3697 3697
 		} else {
3698 3698
 			if ($ModeS != '') {
3699 3699
 				$timeelapsed = microtime(true);
3700
-				$aircraft_icao = $this->getAllAircraftType($ModeS,$source_type);
3701
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3700
+				$aircraft_icao = $this->getAllAircraftType($ModeS, $source_type);
3701
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3702 3702
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3703 3703
 				{
3704 3704
 					$timeelapsed = microtime(true);
3705 3705
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3706
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3706
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3707 3707
 				} else {
3708 3708
 					$timeelapsed = microtime(true);
3709 3709
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3710
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3710
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3711 3711
 				}
3712 3712
 			}
3713 3713
 		}
@@ -3723,7 +3723,7 @@  discard block
 block discarded – undo
3723 3723
 			} else {
3724 3724
 				$timeelapsed = microtime(true);
3725 3725
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3726
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3726
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3727 3727
 			}
3728 3728
 		}
3729 3729
 		
@@ -3738,7 +3738,7 @@  discard block
 block discarded – undo
3738 3738
 			} else {
3739 3739
 				$timeelapsed = microtime(true);
3740 3740
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3741
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3741
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3742 3742
 			}
3743 3743
 		}
3744 3744
 
@@ -3791,7 +3791,7 @@  discard block
 block discarded – undo
3791 3791
 		}
3792 3792
 
3793 3793
     
3794
-		if ($date == "" || strtotime($date) < time()-20*60)
3794
+		if ($date == "" || strtotime($date) < time() - 20*60)
3795 3795
 		{
3796 3796
 			$date = date("Y-m-d H:i:s", time());
3797 3797
 		}
@@ -3801,7 +3801,7 @@  discard block
 block discarded – undo
3801 3801
 		{
3802 3802
 			$timeelapsed = microtime(true);
3803 3803
 			$image_array = $Image->getSpotterImage($registration);
3804
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3804
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3805 3805
 			if (!isset($image_array[0]['registration']))
3806 3806
 			{
3807 3807
 				//echo "Add image !!!! \n";
@@ -3809,7 +3809,7 @@  discard block
 block discarded – undo
3809 3809
 			}
3810 3810
 			$timeelapsed = microtime(true);
3811 3811
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3812
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3812
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3813 3813
 			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3814 3814
 		}
3815 3815
     
@@ -3817,33 +3817,33 @@  discard block
 block discarded – undo
3817 3817
 		{
3818 3818
             		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3819 3819
             		else $airline_icao = '';
3820
-			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3820
+			$image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao);
3821 3821
 			if (!isset($image_array[0]['registration']))
3822 3822
 			{
3823 3823
 				//echo "Add image !!!! \n";
3824
-				$Image->addSpotterImage('',$aircraft_icao,$airline_icao);
3824
+				$Image->addSpotterImage('', $aircraft_icao, $airline_icao);
3825 3825
 			}
3826 3826
 		}
3827 3827
     
3828
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
3829
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
3830
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
3831
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3832
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
3833
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
3834
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3835
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3836
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
3837
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3838
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
3839
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3840
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
3841
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
3842
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
3843
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
3844
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
3845
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
3846
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
3828
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
3829
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
3830
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
3831
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3832
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
3833
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
3834
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3835
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3836
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
3837
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3838
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
3839
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3840
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
3841
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
3842
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
3843
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
3844
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
3845
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
3846
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
3847 3847
 	
3848 3848
 		if (count($airline_array) == 0) 
3849 3849
 		{
@@ -3871,7 +3871,7 @@  discard block
 block discarded – undo
3871 3871
                 if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3872 3872
                 if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3873 3873
                 if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3874
-                $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) 
3874
+                $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) 
3875 3875
                 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)";
3876 3876
 
3877 3877
                 $airline_name = $airline_array[0]['name'];
@@ -3881,7 +3881,7 @@  discard block
 block discarded – undo
3881 3881
 		if ($airline_type == '') {
3882 3882
 			$timeelapsed = microtime(true);
3883 3883
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3884
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3884
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3885 3885
 		}
3886 3886
 		if ($airline_type == null) $airline_type = '';
3887 3887
                 $aircraft_type = $aircraft_array[0]['type'];
@@ -3893,7 +3893,7 @@  discard block
 block discarded – undo
3893 3893
                 $arrival_airport_name = $arrival_airport_array[0]['name'];
3894 3894
                 $arrival_airport_city = $arrival_airport_array[0]['city'];
3895 3895
                 $arrival_airport_country = $arrival_airport_array[0]['country'];
3896
-                $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);
3896
+                $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);
3897 3897
 
3898 3898
 		try {
3899 3899
 		        
@@ -3919,13 +3919,13 @@  discard block
 block discarded – undo
3919 3919
 	{
3920 3920
 		global $globalDBdriver, $globalTimezone;
3921 3921
 		if ($globalDBdriver == 'mysql') {
3922
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3922
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3923 3923
 								WHERE spotter_output.ident = :ident 
3924 3924
 								AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
3925 3925
 								AND spotter_output.date < UTC_TIMESTAMP()";
3926 3926
 			$query_data = array(':ident' => $ident);
3927 3927
 		} else {
3928
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3928
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3929 3929
 								WHERE spotter_output.ident = :ident 
3930 3930
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3931 3931
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
@@ -3934,8 +3934,8 @@  discard block
 block discarded – undo
3934 3934
 		
3935 3935
 		$sth = $this->db->prepare($query);
3936 3936
 		$sth->execute($query_data);
3937
-    		$ident_result='';
3938
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3937
+    		$ident_result = '';
3938
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3939 3939
 		{
3940 3940
 			$ident_result = $row['ident'];
3941 3941
 		}
@@ -3961,8 +3961,8 @@  discard block
 block discarded – undo
3961 3961
 				return false;
3962 3962
 			} else {
3963 3963
 				$q_array = explode(" ", $q);
3964
-				foreach ($q_array as $q_item){
3965
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
3964
+				foreach ($q_array as $q_item) {
3965
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
3966 3966
 					$additional_query .= " AND (";
3967 3967
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
3968 3968
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
@@ -3977,11 +3977,11 @@  discard block
 block discarded – undo
3977 3977
 			}
3978 3978
 		}
3979 3979
 		if ($globalDBdriver == 'mysql') {
3980
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3980
+			$query = "SELECT spotter_output.* FROM spotter_output 
3981 3981
 				WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
3982 3982
 				AND spotter_output.date < UTC_TIMESTAMP()";
3983 3983
 		} else {
3984
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3984
+			$query = "SELECT spotter_output.* FROM spotter_output 
3985 3985
 				WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
3986 3986
 				AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
3987 3987
 		}
@@ -3998,11 +3998,11 @@  discard block
 block discarded – undo
3998 3998
 	* @return Array the airline list
3999 3999
 	*
4000 4000
 	*/
4001
-	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(), $year = '', $month = '', $day = '')
4001
+	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4002 4002
 	{
4003 4003
 		global $globalDBdriver;
4004
-		$filter_query = $this->getFilter($filters,true,true);
4005
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4004
+		$filter_query = $this->getFilter($filters, true, true);
4005
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4006 4006
 		 			FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA'";
4007 4007
 		if ($olderthanmonths > 0) {
4008 4008
 			if ($globalDBdriver == 'mysql') {
@@ -4022,28 +4022,28 @@  discard block
 block discarded – undo
4022 4022
 		if ($year != '') {
4023 4023
 			if ($globalDBdriver == 'mysql') {
4024 4024
 				$query .= " AND YEAR(spotter_output.date) = :year";
4025
-				$query_values = array_merge($query_values,array(':year' => $year));
4025
+				$query_values = array_merge($query_values, array(':year' => $year));
4026 4026
 			} else {
4027 4027
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4028
-				$query_values = array_merge($query_values,array(':year' => $year));
4028
+				$query_values = array_merge($query_values, array(':year' => $year));
4029 4029
 			}
4030 4030
 		}
4031 4031
 		if ($month != '') {
4032 4032
 			if ($globalDBdriver == 'mysql') {
4033 4033
 				$query .= " AND MONTH(spotter_output.date) = :month";
4034
-				$query_values = array_merge($query_values,array(':month' => $month));
4034
+				$query_values = array_merge($query_values, array(':month' => $month));
4035 4035
 			} else {
4036 4036
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4037
-				$query_values = array_merge($query_values,array(':month' => $month));
4037
+				$query_values = array_merge($query_values, array(':month' => $month));
4038 4038
 			}
4039 4039
 		}
4040 4040
 		if ($day != '') {
4041 4041
 			if ($globalDBdriver == 'mysql') {
4042 4042
 				$query .= " AND DAY(spotter_output.date) = :day";
4043
-				$query_values = array_merge($query_values,array(':day' => $day));
4043
+				$query_values = array_merge($query_values, array(':day' => $day));
4044 4044
 			} else {
4045 4045
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4046
-				$query_values = array_merge($query_values,array(':day' => $day));
4046
+				$query_values = array_merge($query_values, array(':day' => $day));
4047 4047
 			}
4048 4048
 		}
4049 4049
 		$query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
@@ -4053,7 +4053,7 @@  discard block
 block discarded – undo
4053 4053
 		$sth->execute($query_values);
4054 4054
 		$airline_array = array();
4055 4055
 		$temp_array = array();
4056
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4056
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4057 4057
 		{
4058 4058
 			$temp_array['airline_name'] = $row['airline_name'];
4059 4059
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4070,11 +4070,11 @@  discard block
 block discarded – undo
4070 4070
 	* @return Array the pilots list
4071 4071
 	*
4072 4072
 	*/
4073
-	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '',$day = '')
4073
+	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4074 4074
 	{
4075 4075
 		global $globalDBdriver;
4076
-		$filter_query = $this->getFilter($filters,true,true);
4077
-		$query  = "SELECT DISTINCT spotter_output.pilot_id, s.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4076
+		$filter_query = $this->getFilter($filters, true, true);
4077
+		$query = "SELECT DISTINCT spotter_output.pilot_id, s.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source
4078 4078
 			FROM spotter_output LEFT JOIN (SELECT DISTINCT pilot_id, pilot_name, max(date) as date FROM spotter_output GROUP BY pilot_id, pilot_name) s ON s.pilot_id = spotter_output.pilot_id".$filter_query." spotter_output.pilot_id <> ''";
4079 4079
                 if ($olderthanmonths > 0) {
4080 4080
             		if ($globalDBdriver == 'mysql') {
@@ -4094,28 +4094,28 @@  discard block
 block discarded – undo
4094 4094
 		if ($year != '') {
4095 4095
 			if ($globalDBdriver == 'mysql') {
4096 4096
 				$query .= " AND YEAR(spotter_output.date) = :year";
4097
-				$query_values = array_merge($query_values,array(':year' => $year));
4097
+				$query_values = array_merge($query_values, array(':year' => $year));
4098 4098
 			} else {
4099 4099
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4100
-				$query_values = array_merge($query_values,array(':year' => $year));
4100
+				$query_values = array_merge($query_values, array(':year' => $year));
4101 4101
 			}
4102 4102
 		}
4103 4103
 		if ($month != '') {
4104 4104
 			if ($globalDBdriver == 'mysql') {
4105 4105
 				$query .= " AND MONTH(spotter_output.date) = :month";
4106
-				$query_values = array_merge($query_values,array(':month' => $month));
4106
+				$query_values = array_merge($query_values, array(':month' => $month));
4107 4107
 			} else {
4108 4108
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4109
-				$query_values = array_merge($query_values,array(':month' => $month));
4109
+				$query_values = array_merge($query_values, array(':month' => $month));
4110 4110
 			}
4111 4111
 		}
4112 4112
 		if ($day != '') {
4113 4113
 			if ($globalDBdriver == 'mysql') {
4114 4114
 				$query .= " AND DAY(spotter_output.date) = :day";
4115
-				$query_values = array_merge($query_values,array(':day' => $day));
4115
+				$query_values = array_merge($query_values, array(':day' => $day));
4116 4116
 			} else {
4117 4117
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4118
-				$query_values = array_merge($query_values,array(':day' => $day));
4118
+				$query_values = array_merge($query_values, array(':day' => $day));
4119 4119
 			}
4120 4120
 		}
4121 4121
 		
@@ -4127,7 +4127,7 @@  discard block
 block discarded – undo
4127 4127
 		$sth->execute($query_values);
4128 4128
 		$airline_array = array();
4129 4129
 		$temp_array = array();
4130
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4130
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4131 4131
 		{
4132 4132
 			$temp_array['pilot_name'] = $row['pilot_name'];
4133 4133
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -4147,7 +4147,7 @@  discard block
 block discarded – undo
4147 4147
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
4148 4148
 	{
4149 4149
 		global $globalDBdriver;
4150
-		$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
4150
+		$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
4151 4151
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
4152 4152
                 if ($olderthanmonths > 0) {
4153 4153
             		if ($globalDBdriver == 'mysql') {
@@ -4173,7 +4173,7 @@  discard block
 block discarded – undo
4173 4173
 		$airline_array = array();
4174 4174
 		$temp_array = array();
4175 4175
         
4176
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4176
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4177 4177
 		{
4178 4178
 			$temp_array['pilot_name'] = $row['pilot_name'];
4179 4179
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -4191,11 +4191,11 @@  discard block
 block discarded – undo
4191 4191
 	* @return Array the pilots list
4192 4192
 	*
4193 4193
 	*/
4194
-	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
4194
+	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
4195 4195
 	{
4196 4196
 		global $globalDBdriver;
4197
-		$filter_query = $this->getFilter($filters,true,true);
4198
-		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4197
+		$filter_query = $this->getFilter($filters, true, true);
4198
+		$query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4199 4199
 					FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL";
4200 4200
                 if ($olderthanmonths > 0) {
4201 4201
             		if ($globalDBdriver == 'mysql') {
@@ -4215,28 +4215,28 @@  discard block
 block discarded – undo
4215 4215
 		if ($year != '') {
4216 4216
 			if ($globalDBdriver == 'mysql') {
4217 4217
 				$query .= " AND YEAR(spotter_output.date) = :year";
4218
-				$query_values = array_merge($query_values,array(':year' => $year));
4218
+				$query_values = array_merge($query_values, array(':year' => $year));
4219 4219
 			} else {
4220 4220
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4221
-				$query_values = array_merge($query_values,array(':year' => $year));
4221
+				$query_values = array_merge($query_values, array(':year' => $year));
4222 4222
 			}
4223 4223
 		}
4224 4224
 		if ($month != '') {
4225 4225
 			if ($globalDBdriver == 'mysql') {
4226 4226
 				$query .= " AND MONTH(spotter_output.date) = :month";
4227
-				$query_values = array_merge($query_values,array(':month' => $month));
4227
+				$query_values = array_merge($query_values, array(':month' => $month));
4228 4228
 			} else {
4229 4229
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4230
-				$query_values = array_merge($query_values,array(':month' => $month));
4230
+				$query_values = array_merge($query_values, array(':month' => $month));
4231 4231
 			}
4232 4232
 		}
4233 4233
 		if ($day != '') {
4234 4234
 			if ($globalDBdriver == 'mysql') {
4235 4235
 				$query .= " AND DAY(spotter_output.date) = :day";
4236
-				$query_values = array_merge($query_values,array(':day' => $day));
4236
+				$query_values = array_merge($query_values, array(':day' => $day));
4237 4237
 			} else {
4238 4238
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4239
-				$query_values = array_merge($query_values,array(':day' => $day));
4239
+				$query_values = array_merge($query_values, array(':day' => $day));
4240 4240
 			}
4241 4241
 		}
4242 4242
 		$query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
@@ -4246,7 +4246,7 @@  discard block
 block discarded – undo
4246 4246
 		$sth->execute($query_values);
4247 4247
 		$airline_array = array();
4248 4248
 		$temp_array = array();
4249
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4249
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4250 4250
 		{
4251 4251
 			$temp_array['owner_name'] = $row['owner_name'];
4252 4252
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -4261,11 +4261,11 @@  discard block
 block discarded – undo
4261 4261
 	* @return Array the pilots list
4262 4262
 	*
4263 4263
 	*/
4264
-	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
4264
+	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4265 4265
 	{
4266 4266
 		global $globalDBdriver;
4267
-		$filter_query = $this->getFilter($filters,true,true);
4268
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4267
+		$filter_query = $this->getFilter($filters, true, true);
4268
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
4269 4269
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
4270 4270
                 if ($olderthanmonths > 0) {
4271 4271
             		if ($globalDBdriver == 'mysql') {
@@ -4291,7 +4291,7 @@  discard block
 block discarded – undo
4291 4291
 		$airline_array = array();
4292 4292
 		$temp_array = array();
4293 4293
         
4294
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4294
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4295 4295
 		{
4296 4296
 			$temp_array['owner_name'] = $row['owner_name'];
4297 4297
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -4307,11 +4307,11 @@  discard block
 block discarded – undo
4307 4307
 	* @return Array the airline list
4308 4308
 	*
4309 4309
 	*/
4310
-	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
4310
+	public function countAllAirlinesByAircraft($aircraft_icao, $filters = array())
4311 4311
 	{
4312
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4313
-		$filter_query = $this->getFilter($filters,true,true);
4314
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4312
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4313
+		$filter_query = $this->getFilter($filters, true, true);
4314
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4315 4315
 		 	    FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
4316 4316
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4317 4317
 			    ORDER BY airline_count DESC";
@@ -4323,7 +4323,7 @@  discard block
 block discarded – undo
4323 4323
 		$airline_array = array();
4324 4324
 		$temp_array = array();
4325 4325
         
4326
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4326
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4327 4327
 		{
4328 4328
 			$temp_array['airline_name'] = $row['airline_name'];
4329 4329
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4343,11 +4343,11 @@  discard block
 block discarded – undo
4343 4343
 	* @return Array the airline country list
4344 4344
 	*
4345 4345
 	*/
4346
-	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
4346
+	public function countAllAirlineCountriesByAircraft($aircraft_icao, $filters = array())
4347 4347
 	{
4348
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
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, countries.iso3 AS airline_country_iso3 
4348
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
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, countries.iso3 AS airline_country_iso3 
4351 4351
 			FROM spotter_output, countries ".$filter_query." countries.name = spotter_output.airline_country AND spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
4352 4352
 			GROUP BY spotter_output.airline_country, countries.iso3
4353 4353
 			ORDER BY airline_country_count DESC
@@ -4360,7 +4360,7 @@  discard block
 block discarded – undo
4360 4360
 		$airline_country_array = array();
4361 4361
 		$temp_array = array();
4362 4362
         
4363
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4363
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4364 4364
 		{
4365 4365
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4366 4366
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4380,11 +4380,11 @@  discard block
 block discarded – undo
4380 4380
 	* @return Array the airline list
4381 4381
 	*
4382 4382
 	*/
4383
-	public function countAllAirlinesByAirport($airport_icao,$filters = array())
4383
+	public function countAllAirlinesByAirport($airport_icao, $filters = array())
4384 4384
 	{
4385
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4386
-		$filter_query = $this->getFilter($filters,true,true);
4387
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4385
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4386
+		$filter_query = $this->getFilter($filters, true, true);
4387
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4388 4388
 		    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 ) 
4389 4389
                     GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country
4390 4390
 		    ORDER BY airline_count DESC";
@@ -4396,7 +4396,7 @@  discard block
 block discarded – undo
4396 4396
 		$airline_array = array();
4397 4397
 		$temp_array = array();
4398 4398
         
4399
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4399
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4400 4400
 		{
4401 4401
 			$temp_array['airline_name'] = $row['airline_name'];
4402 4402
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4415,11 +4415,11 @@  discard block
 block discarded – undo
4415 4415
 	* @return Array the airline country list
4416 4416
 	*
4417 4417
 	*/
4418
-	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
4418
+	public function countAllAirlineCountriesByAirport($airport_icao, $filters = array())
4419 4419
 	{
4420
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4421
-		$filter_query = $this->getFilter($filters,true,true);
4422
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count, countries.iso3 AS airline_country_iso3 
4420
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4421
+		$filter_query = $this->getFilter($filters, true, true);
4422
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count, countries.iso3 AS airline_country_iso3 
4423 4423
 			FROM countries, spotter_output".$filter_query." countries.name = spotter_output.airline_country AND spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao )
4424 4424
 			GROUP BY spotter_output.airline_country, countries.iso3
4425 4425
 			ORDER BY airline_country_count DESC
@@ -4432,7 +4432,7 @@  discard block
 block discarded – undo
4432 4432
 		$airline_country_array = array();
4433 4433
 		$temp_array = array();
4434 4434
         
4435
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4435
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4436 4436
 		{
4437 4437
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4438 4438
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4450,11 +4450,11 @@  discard block
 block discarded – undo
4450 4450
 	* @return Array the airline list
4451 4451
 	*
4452 4452
 	*/
4453
-	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
4453
+	public function countAllAirlinesByManufacturer($aircraft_manufacturer, $filters = array())
4454 4454
 	{
4455
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4456
-		$filter_query = $this->getFilter($filters,true,true);
4457
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4455
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4456
+		$filter_query = $this->getFilter($filters, true, true);
4457
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4458 4458
 		 			FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4459 4459
 					GROUP BY spotter_output.airline_name
4460 4460
 					ORDER BY airline_count DESC";
@@ -4465,7 +4465,7 @@  discard block
 block discarded – undo
4465 4465
 		$airline_array = array();
4466 4466
 		$temp_array = array();
4467 4467
         
4468
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4468
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4469 4469
 		{
4470 4470
 			$temp_array['airline_name'] = $row['airline_name'];
4471 4471
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4485,11 +4485,11 @@  discard block
 block discarded – undo
4485 4485
 	* @return Array the airline country list
4486 4486
 	*
4487 4487
 	*/
4488
-	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4488
+	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer, $filters = array())
4489 4489
 	{
4490
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4491
-		$filter_query = $this->getFilter($filters,true,true);
4492
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4490
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4491
+		$filter_query = $this->getFilter($filters, true, true);
4492
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4493 4493
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4494 4494
 					GROUP BY spotter_output.airline_country
4495 4495
 					ORDER BY airline_country_count DESC
@@ -4502,7 +4502,7 @@  discard block
 block discarded – undo
4502 4502
 		$airline_country_array = array();
4503 4503
 		$temp_array = array();
4504 4504
         
4505
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4505
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4506 4506
 		{
4507 4507
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4508 4508
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4518,11 +4518,11 @@  discard block
 block discarded – undo
4518 4518
 	* @return Array the airline list
4519 4519
 	*
4520 4520
 	*/
4521
-	public function countAllAirlinesByDate($date,$filters = array())
4521
+	public function countAllAirlinesByDate($date, $filters = array())
4522 4522
 	{
4523 4523
 		global $globalTimezone, $globalDBdriver;
4524
-		$filter_query = $this->getFilter($filters,true,true);
4525
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4524
+		$filter_query = $this->getFilter($filters, true, true);
4525
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4526 4526
 		if ($globalTimezone != '') {
4527 4527
 			date_default_timezone_set($globalTimezone);
4528 4528
 			$datetime = new DateTime($date);
@@ -4530,12 +4530,12 @@  discard block
 block discarded – undo
4530 4530
 		} else $offset = '+00:00';
4531 4531
 
4532 4532
 		if ($globalDBdriver == 'mysql') {
4533
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4533
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4534 4534
 		 			FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4535 4535
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country 
4536 4536
 					ORDER BY airline_count DESC";
4537 4537
 		} else {
4538
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4538
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4539 4539
 		 			FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4540 4540
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country
4541 4541
 					ORDER BY airline_count DESC";
@@ -4546,7 +4546,7 @@  discard block
 block discarded – undo
4546 4546
 
4547 4547
 		$airline_array = array();
4548 4548
 		$temp_array = array();
4549
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4549
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4550 4550
 		{
4551 4551
 			$temp_array['airline_name'] = $row['airline_name'];
4552 4552
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4566,11 +4566,11 @@  discard block
 block discarded – undo
4566 4566
 	* @return Array the airline country list
4567 4567
 	*
4568 4568
 	*/
4569
-	public function countAllAirlineCountriesByDate($date,$filters = array())
4569
+	public function countAllAirlineCountriesByDate($date, $filters = array())
4570 4570
 	{
4571 4571
 		global $globalTimezone, $globalDBdriver;
4572
-		$filter_query = $this->getFilter($filters,true,true);
4573
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4572
+		$filter_query = $this->getFilter($filters, true, true);
4573
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4574 4574
 		if ($globalTimezone != '') {
4575 4575
 			date_default_timezone_set($globalTimezone);
4576 4576
 			$datetime = new DateTime($date);
@@ -4578,13 +4578,13 @@  discard block
 block discarded – undo
4578 4578
 		} else $offset = '+00:00';
4579 4579
 		
4580 4580
 		if ($globalDBdriver == 'mysql') {
4581
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4581
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4582 4582
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4583 4583
 					GROUP BY spotter_output.airline_country
4584 4584
 					ORDER BY airline_country_count DESC
4585 4585
 					LIMIT 10 OFFSET 0";
4586 4586
 		} else {
4587
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4587
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4588 4588
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4589 4589
 					GROUP BY spotter_output.airline_country
4590 4590
 					ORDER BY airline_country_count DESC
@@ -4596,7 +4596,7 @@  discard block
 block discarded – undo
4596 4596
  
4597 4597
 		$airline_country_array = array();
4598 4598
 		$temp_array = array();
4599
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4599
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4600 4600
 		{
4601 4601
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4602 4602
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4613,11 +4613,11 @@  discard block
 block discarded – undo
4613 4613
 	* @return Array the airline list
4614 4614
 	*
4615 4615
 	*/
4616
-	public function countAllAirlinesByIdent($ident,$filters = array())
4616
+	public function countAllAirlinesByIdent($ident, $filters = array())
4617 4617
 	{
4618
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4619
-		$filter_query = $this->getFilter($filters,true,true);
4620
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4618
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4619
+		$filter_query = $this->getFilter($filters, true, true);
4620
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4621 4621
 		 		FROM spotter_output".$filter_query." spotter_output.ident = :ident  
4622 4622
 				GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country
4623 4623
 				ORDER BY airline_count DESC";
@@ -4634,11 +4634,11 @@  discard block
 block discarded – undo
4634 4634
 	* @return Array the airline list
4635 4635
 	*
4636 4636
 	*/
4637
-	public function countAllAirlinesByOwner($owner,$filters = array())
4637
+	public function countAllAirlinesByOwner($owner, $filters = array())
4638 4638
 	{
4639
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
4640
-		$filter_query = $this->getFilter($filters,true,true);
4641
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4639
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
4640
+		$filter_query = $this->getFilter($filters, true, true);
4641
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4642 4642
 		 		FROM spotter_output".$filter_query." spotter_output.owner_name = :owner  
4643 4643
 				GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country
4644 4644
 				ORDER BY airline_count DESC";
@@ -4655,47 +4655,47 @@  discard block
 block discarded – undo
4655 4655
 	* @return String Duration of all flights
4656 4656
 	*
4657 4657
 	*/
4658
-	public function getFlightDurationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
4658
+	public function getFlightDurationByOwner($owner, $filters = array(), $year = '', $month = '', $day = '')
4659 4659
 	{
4660 4660
 		global $globalDBdriver;
4661
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
4662
-		$filter_query = $this->getFilter($filters,true,true);
4663
-		$query  = "SELECT SUM(last_seen - date) AS duration 
4661
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
4662
+		$filter_query = $this->getFilter($filters, true, true);
4663
+		$query = "SELECT SUM(last_seen - date) AS duration 
4664 4664
 				FROM spotter_output".$filter_query." spotter_output.owner_name = :owner 
4665 4665
 				AND last_seen > date";
4666 4666
 		$query_values = array();
4667 4667
 		if ($year != '') {
4668 4668
 			if ($globalDBdriver == 'mysql') {
4669 4669
 				$query .= " AND YEAR(spotter_output.date) = :year";
4670
-				$query_values = array_merge($query_values,array(':year' => $year));
4670
+				$query_values = array_merge($query_values, array(':year' => $year));
4671 4671
 			} else {
4672 4672
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4673
-				$query_values = array_merge($query_values,array(':year' => $year));
4673
+				$query_values = array_merge($query_values, array(':year' => $year));
4674 4674
 			}
4675 4675
 		}
4676 4676
 		if ($month != '') {
4677 4677
 			if ($globalDBdriver == 'mysql') {
4678 4678
 				$query .= " AND MONTH(spotter_output.date) = :month";
4679
-				$query_values = array_merge($query_values,array(':month' => $month));
4679
+				$query_values = array_merge($query_values, array(':month' => $month));
4680 4680
 			} else {
4681 4681
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4682
-				$query_values = array_merge($query_values,array(':month' => $month));
4682
+				$query_values = array_merge($query_values, array(':month' => $month));
4683 4683
 			}
4684 4684
 		}
4685 4685
 		if ($day != '') {
4686 4686
 			if ($globalDBdriver == 'mysql') {
4687 4687
 				$query .= " AND DAY(spotter_output.date) = :day";
4688
-				$query_values = array_merge($query_values,array(':day' => $day));
4688
+				$query_values = array_merge($query_values, array(':day' => $day));
4689 4689
 			} else {
4690 4690
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4691
-				$query_values = array_merge($query_values,array(':day' => $day));
4691
+				$query_values = array_merge($query_values, array(':day' => $day));
4692 4692
 			}
4693 4693
 		}
4694
-		$query_values = array_merge($query_values,array(':owner' => $owner));
4694
+		$query_values = array_merge($query_values, array(':owner' => $owner));
4695 4695
 		$sth = $this->db->prepare($query);
4696 4696
 		$sth->execute($query_values);
4697 4697
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
4698
-		if (is_numeric($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']);
4698
+		if (is_numeric($result[0]['duration'])) return gmdate('H:i:s', $result[0]['duration']);
4699 4699
 		elseif ($result[0]['duration'] == '') return 0;
4700 4700
 		else return $result[0]['duration'];
4701 4701
 	}
@@ -4706,14 +4706,14 @@  discard block
 block discarded – undo
4706 4706
 	* @return String Duration of all flights
4707 4707
 	*
4708 4708
 	*/
4709
-	public function countFlightsByOwner($owner,$filters = array())
4709
+	public function countFlightsByOwner($owner, $filters = array())
4710 4710
 	{
4711
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
4712
-		$filter_query = $this->getFilter($filters,true,true);
4713
-		$query  = "SELECT COUNT(*) AS nb 
4711
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
4712
+		$filter_query = $this->getFilter($filters, true, true);
4713
+		$query = "SELECT COUNT(*) AS nb 
4714 4714
 				FROM spotter_output".$filter_query." spotter_output.owner_name = :owner";
4715 4715
 		$query_values = array();
4716
-		$query_values = array_merge($query_values,array(':owner' => $owner));
4716
+		$query_values = array_merge($query_values, array(':owner' => $owner));
4717 4717
 		$sth = $this->db->prepare($query);
4718 4718
 		$sth->execute($query_values);
4719 4719
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -4726,14 +4726,14 @@  discard block
 block discarded – undo
4726 4726
 	* @return String Duration of all flights
4727 4727
 	*
4728 4728
 	*/
4729
-	public function countFlightsByPilot($pilot,$filters = array())
4729
+	public function countFlightsByPilot($pilot, $filters = array())
4730 4730
 	{
4731
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
4732
-		$filter_query = $this->getFilter($filters,true,true);
4733
-		$query  = "SELECT COUNT(*) AS nb 
4731
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
4732
+		$filter_query = $this->getFilter($filters, true, true);
4733
+		$query = "SELECT COUNT(*) AS nb 
4734 4734
 				FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilod_id = :pilot)";
4735 4735
 		$query_values = array();
4736
-		$query_values = array_merge($query_values,array(':pilot' => $pilot));
4736
+		$query_values = array_merge($query_values, array(':pilot' => $pilot));
4737 4737
 		$sth = $this->db->prepare($query);
4738 4738
 		$sth->execute($query_values);
4739 4739
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -4746,47 +4746,47 @@  discard block
 block discarded – undo
4746 4746
 	* @return String Duration of all flights
4747 4747
 	*
4748 4748
 	*/
4749
-	public function getFlightDurationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
4749
+	public function getFlightDurationByPilot($pilot, $filters = array(), $year = '', $month = '', $day = '')
4750 4750
 	{
4751 4751
 		global $globalDBdriver;
4752
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
4753
-		$filter_query = $this->getFilter($filters,true,true);
4754
-		$query  = "SELECT SUM(last_seen - date) AS duration 
4752
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
4753
+		$filter_query = $this->getFilter($filters, true, true);
4754
+		$query = "SELECT SUM(last_seen - date) AS duration 
4755 4755
 		 		FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
4756 4756
 		 		AND last_seen > date";
4757 4757
 		$query_values = array();
4758 4758
 		if ($year != '') {
4759 4759
 			if ($globalDBdriver == 'mysql') {
4760 4760
 				$query .= " AND YEAR(spotter_output.date) = :year";
4761
-				$query_values = array_merge($query_values,array(':year' => $year));
4761
+				$query_values = array_merge($query_values, array(':year' => $year));
4762 4762
 			} else {
4763 4763
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4764
-				$query_values = array_merge($query_values,array(':year' => $year));
4764
+				$query_values = array_merge($query_values, array(':year' => $year));
4765 4765
 			}
4766 4766
 		}
4767 4767
 		if ($month != '') {
4768 4768
 			if ($globalDBdriver == 'mysql') {
4769 4769
 				$query .= " AND MONTH(spotter_output.date) = :month";
4770
-				$query_values = array_merge($query_values,array(':month' => $month));
4770
+				$query_values = array_merge($query_values, array(':month' => $month));
4771 4771
 			} else {
4772 4772
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4773
-				$query_values = array_merge($query_values,array(':month' => $month));
4773
+				$query_values = array_merge($query_values, array(':month' => $month));
4774 4774
 			}
4775 4775
 		}
4776 4776
 		if ($day != '') {
4777 4777
 			if ($globalDBdriver == 'mysql') {
4778 4778
 				$query .= " AND DAY(spotter_output.date) = :day";
4779
-				$query_values = array_merge($query_values,array(':day' => $day));
4779
+				$query_values = array_merge($query_values, array(':day' => $day));
4780 4780
 			} else {
4781 4781
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4782
-				$query_values = array_merge($query_values,array(':day' => $day));
4782
+				$query_values = array_merge($query_values, array(':day' => $day));
4783 4783
 			}
4784 4784
 		}
4785
-		$query_values = array_merge($query_values,array(':pilot' => $pilot));
4785
+		$query_values = array_merge($query_values, array(':pilot' => $pilot));
4786 4786
 		$sth = $this->db->prepare($query);
4787 4787
 		$sth->execute($query_values);
4788 4788
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
4789
-		if (is_int($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']);
4789
+		if (is_int($result[0]['duration'])) return gmdate('H:i:s', $result[0]['duration']);
4790 4790
 		else return $result[0]['duration'];
4791 4791
 	}
4792 4792
 
@@ -4796,11 +4796,11 @@  discard block
 block discarded – undo
4796 4796
 	* @return Array the airline list
4797 4797
 	*
4798 4798
 	*/
4799
-	public function countAllAirlinesByPilot($pilot,$filters = array())
4799
+	public function countAllAirlinesByPilot($pilot, $filters = array())
4800 4800
 	{
4801
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
4802
-		$filter_query = $this->getFilter($filters,true,true);
4803
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4801
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
4802
+		$filter_query = $this->getFilter($filters, true, true);
4803
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4804 4804
 		 		FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
4805 4805
 				GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country
4806 4806
 				ORDER BY airline_count DESC";
@@ -4817,25 +4817,25 @@  discard block
 block discarded – undo
4817 4817
 	* @return Array the airline list
4818 4818
 	*
4819 4819
 	*/
4820
-	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4820
+	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4821 4821
 	{
4822
-		$filter_query = $this->getFilter($filters,true,true);
4823
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4824
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4822
+		$filter_query = $this->getFilter($filters, true, true);
4823
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4824
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4825 4825
 
4826
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4826
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4827 4827
 		 			FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4828 4828
 					GROUP BY spotter_output.airline_name
4829 4829
 					ORDER BY airline_count DESC";
4830 4830
       
4831 4831
 		
4832 4832
 		$sth = $this->db->prepare($query);
4833
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4833
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4834 4834
       
4835 4835
 		$airline_array = array();
4836 4836
 		$temp_array = array();
4837 4837
         
4838
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4838
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4839 4839
 		{
4840 4840
 			$temp_array['airline_name'] = $row['airline_name'];
4841 4841
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4853,13 +4853,13 @@  discard block
 block discarded – undo
4853 4853
 	* @return Array the airline country list
4854 4854
 	*
4855 4855
 	*/
4856
-	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4856
+	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4857 4857
 	{
4858
-		$filter_query = $this->getFilter($filters,true,true);
4859
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4860
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4858
+		$filter_query = $this->getFilter($filters, true, true);
4859
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4860
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4861 4861
       
4862
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4862
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4863 4863
 		 		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) 
4864 4864
 				GROUP BY spotter_output.airline_country
4865 4865
 				ORDER BY airline_country_count DESC
@@ -4867,11 +4867,11 @@  discard block
 block discarded – undo
4867 4867
       
4868 4868
 		
4869 4869
 		$sth = $this->db->prepare($query);
4870
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4870
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4871 4871
       
4872 4872
 		$airline_country_array = array();
4873 4873
 		$temp_array = array();
4874
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4874
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4875 4875
 		{
4876 4876
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4877 4877
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4889,11 +4889,11 @@  discard block
 block discarded – undo
4889 4889
 	* @return Array the airline list
4890 4890
 	*
4891 4891
 	*/
4892
-	public function countAllAirlinesByCountry($country,$filters = array())
4892
+	public function countAllAirlinesByCountry($country, $filters = array())
4893 4893
 	{
4894
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4895
-		$filter_query = $this->getFilter($filters,true,true);
4896
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4894
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4895
+		$filter_query = $this->getFilter($filters, true, true);
4896
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4897 4897
 		 	    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
4898 4898
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4899 4899
 			    ORDER BY airline_count DESC";
@@ -4904,7 +4904,7 @@  discard block
 block discarded – undo
4904 4904
 
4905 4905
 		$airline_array = array();
4906 4906
 		$temp_array = array();
4907
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4907
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4908 4908
 		{
4909 4909
 			$temp_array['airline_name'] = $row['airline_name'];
4910 4910
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4923,11 +4923,11 @@  discard block
 block discarded – undo
4923 4923
 	* @return Array the airline country list
4924 4924
 	*
4925 4925
 	*/
4926
-	public function countAllAirlineCountriesByCountry($country,$filters = array())
4926
+	public function countAllAirlineCountriesByCountry($country, $filters = array())
4927 4927
 	{
4928
-		$filter_query = $this->getFilter($filters,true,true);
4929
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4930
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4928
+		$filter_query = $this->getFilter($filters, true, true);
4929
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4930
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4931 4931
 		 		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 
4932 4932
 				GROUP BY spotter_output.airline_country
4933 4933
 				ORDER BY airline_country_count DESC
@@ -4939,7 +4939,7 @@  discard block
 block discarded – undo
4939 4939
 
4940 4940
 		$airline_country_array = array();
4941 4941
 		$temp_array = array();
4942
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4942
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4943 4943
 		{
4944 4944
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4945 4945
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4959,35 +4959,35 @@  discard block
 block discarded – undo
4959 4959
 	public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
4960 4960
 	{
4961 4961
 		global $globalDBdriver;
4962
-		$filter_query = $this->getFilter($filters,true,true);
4963
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count, countries.iso3 AS airline_country_iso3
4962
+		$filter_query = $this->getFilter($filters, true, true);
4963
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count, countries.iso3 AS airline_country_iso3
4964 4964
 		 			FROM countries, spotter_output".$filter_query." countries.name = spotter_output.airline_country AND spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA'";
4965 4965
 		$query_values = array();
4966 4966
 		if ($year != '') {
4967 4967
 			if ($globalDBdriver == 'mysql') {
4968 4968
 				$query .= " AND YEAR(spotter_output.date) = :year";
4969
-				$query_values = array_merge($query_values,array(':year' => $year));
4969
+				$query_values = array_merge($query_values, array(':year' => $year));
4970 4970
 			} else {
4971 4971
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
4972
-				$query_values = array_merge($query_values,array(':year' => $year));
4972
+				$query_values = array_merge($query_values, array(':year' => $year));
4973 4973
 			}
4974 4974
 		}
4975 4975
 		if ($month != '') {
4976 4976
 			if ($globalDBdriver == 'mysql') {
4977 4977
 				$query .= " AND MONTH(spotter_output.date) = :month";
4978
-				$query_values = array_merge($query_values,array(':month' => $month));
4978
+				$query_values = array_merge($query_values, array(':month' => $month));
4979 4979
 			} else {
4980 4980
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
4981
-				$query_values = array_merge($query_values,array(':month' => $month));
4981
+				$query_values = array_merge($query_values, array(':month' => $month));
4982 4982
 			}
4983 4983
 		}
4984 4984
 		if ($day != '') {
4985 4985
 			if ($globalDBdriver == 'mysql') {
4986 4986
 				$query .= " AND DAY(spotter_output.date) = :day";
4987
-				$query_values = array_merge($query_values,array(':day' => $day));
4987
+				$query_values = array_merge($query_values, array(':day' => $day));
4988 4988
 			} else {
4989 4989
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
4990
-				$query_values = array_merge($query_values,array(':day' => $day));
4990
+				$query_values = array_merge($query_values, array(':day' => $day));
4991 4991
 			}
4992 4992
 		}
4993 4993
 		$query .= " GROUP BY spotter_output.airline_country, countries.iso3
@@ -4999,7 +4999,7 @@  discard block
 block discarded – undo
4999 4999
 
5000 5000
 		$airline_array = array();
5001 5001
 		$temp_array = array();
5002
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5002
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5003 5003
 		{
5004 5004
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
5005 5005
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -5016,11 +5016,11 @@  discard block
 block discarded – undo
5016 5016
 	* @return Array the airline country list
5017 5017
 	*
5018 5018
 	*/
5019
-	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5019
+	public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5020 5020
 	{
5021 5021
 		global $globalDBdriver;
5022 5022
 		//$filter_query = $this->getFilter($filters,true,true);
5023
-		$Connection= new Connection($this->db);
5023
+		$Connection = new Connection($this->db);
5024 5024
 		if (!$Connection->tableExists('countries')) return array();
5025 5025
 		/*
5026 5026
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -5035,7 +5035,7 @@  discard block
 block discarded – undo
5035 5035
 */
5036 5036
 		require_once('class.SpotterLive.php');
5037 5037
 		$SpotterLive = new SpotterLive();
5038
-		$filter_query = $SpotterLive->getFilter($filters,true,true);
5038
+		$filter_query = $SpotterLive->getFilter($filters, true, true);
5039 5039
 		$filter_query .= ' over_country IS NOT NULL';
5040 5040
                 if ($olderthanmonths > 0) {
5041 5041
 			if ($globalDBdriver == 'mysql') {
@@ -5062,7 +5062,7 @@  discard block
 block discarded – undo
5062 5062
 		$flight_array = array();
5063 5063
 		$temp_array = array();
5064 5064
         
5065
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5065
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5066 5066
 		{
5067 5067
 			$temp_array['flight_count'] = $row['nb'];
5068 5068
 			$temp_array['flight_country'] = $row['name'];
@@ -5080,11 +5080,11 @@  discard block
 block discarded – undo
5080 5080
 	* @return Array the aircraft list
5081 5081
 	*
5082 5082
 	*/
5083
-	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
5083
+	public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
5084 5084
 	{
5085 5085
 		global $globalDBdriver;
5086
-		$filter_query = $this->getFilter($filters,true,true);
5087
-		$query  = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5086
+		$filter_query = $this->getFilter($filters, true, true);
5087
+		$query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5088 5088
 		    FROM spotter_output ".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> ''";
5089 5089
 		if ($olderthanmonths > 0) {
5090 5090
 			if ($globalDBdriver == 'mysql') {
@@ -5104,28 +5104,28 @@  discard block
 block discarded – undo
5104 5104
 		if ($year != '') {
5105 5105
 			if ($globalDBdriver == 'mysql') {
5106 5106
 				$query .= " AND YEAR(spotter_output.date) = :year";
5107
-				$query_values = array_merge($query_values,array(':year' => $year));
5107
+				$query_values = array_merge($query_values, array(':year' => $year));
5108 5108
 			} else {
5109 5109
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5110
-				$query_values = array_merge($query_values,array(':year' => $year));
5110
+				$query_values = array_merge($query_values, array(':year' => $year));
5111 5111
 			}
5112 5112
 		}
5113 5113
 		if ($month != '') {
5114 5114
 			if ($globalDBdriver == 'mysql') {
5115 5115
 				$query .= " AND MONTH(spotter_output.date) = :month";
5116
-				$query_values = array_merge($query_values,array(':month' => $month));
5116
+				$query_values = array_merge($query_values, array(':month' => $month));
5117 5117
 			} else {
5118 5118
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5119
-				$query_values = array_merge($query_values,array(':month' => $month));
5119
+				$query_values = array_merge($query_values, array(':month' => $month));
5120 5120
 			}
5121 5121
 		}
5122 5122
 		if ($day != '') {
5123 5123
 			if ($globalDBdriver == 'mysql') {
5124 5124
 				$query .= " AND DAY(spotter_output.date) = :day";
5125
-				$query_values = array_merge($query_values,array(':day' => $day));
5125
+				$query_values = array_merge($query_values, array(':day' => $day));
5126 5126
 			} else {
5127 5127
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5128
-				$query_values = array_merge($query_values,array(':day' => $day));
5128
+				$query_values = array_merge($query_values, array(':day' => $day));
5129 5129
 			}
5130 5130
 		}
5131 5131
 
@@ -5137,7 +5137,7 @@  discard block
 block discarded – undo
5137 5137
 
5138 5138
 		$aircraft_array = array();
5139 5139
 		$temp_array = array();
5140
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5140
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5141 5141
 		{
5142 5142
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5143 5143
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5154,11 +5154,11 @@  discard block
 block discarded – undo
5154 5154
 	* @return Array the aircraft list
5155 5155
 	*
5156 5156
 	*/
5157
-	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '')
5157
+	public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
5158 5158
 	{
5159 5159
 		global $globalDBdriver;
5160
-		$filter_query = $this->getFilter($filters,true,true);
5161
-		$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 
5160
+		$filter_query = $this->getFilter($filters, true, true);
5161
+		$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 
5162 5162
 		    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'";
5163 5163
 		if ($olderthanmonths > 0) {
5164 5164
 			if ($globalDBdriver == 'mysql') {
@@ -5178,28 +5178,28 @@  discard block
 block discarded – undo
5178 5178
 		if ($year != '') {
5179 5179
 			if ($globalDBdriver == 'mysql') {
5180 5180
 				$query .= " AND YEAR(spotter_output.date) = :year";
5181
-				$query_values = array_merge($query_values,array(':year' => $year));
5181
+				$query_values = array_merge($query_values, array(':year' => $year));
5182 5182
 			} else {
5183 5183
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5184
-				$query_values = array_merge($query_values,array(':year' => $year));
5184
+				$query_values = array_merge($query_values, array(':year' => $year));
5185 5185
 			}
5186 5186
 		}
5187 5187
 		if ($month != '') {
5188 5188
 			if ($globalDBdriver == 'mysql') {
5189 5189
 				$query .= " AND MONTH(spotter_output.date) = :month";
5190
-				$query_values = array_merge($query_values,array(':month' => $month));
5190
+				$query_values = array_merge($query_values, array(':month' => $month));
5191 5191
 			} else {
5192 5192
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5193
-				$query_values = array_merge($query_values,array(':month' => $month));
5193
+				$query_values = array_merge($query_values, array(':month' => $month));
5194 5194
 			}
5195 5195
 		}
5196 5196
 		if ($day != '') {
5197 5197
 			if ($globalDBdriver == 'mysql') {
5198 5198
 				$query .= " AND DAY(spotter_output.date) = :day";
5199
-				$query_values = array_merge($query_values,array(':day' => $day));
5199
+				$query_values = array_merge($query_values, array(':day' => $day));
5200 5200
 			} else {
5201 5201
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5202
-				$query_values = array_merge($query_values,array(':day' => $day));
5202
+				$query_values = array_merge($query_values, array(':day' => $day));
5203 5203
 			}
5204 5204
 		}
5205 5205
 
@@ -5211,7 +5211,7 @@  discard block
 block discarded – undo
5211 5211
 
5212 5212
 		$aircraft_array = array();
5213 5213
 		$temp_array = array();
5214
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5214
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5215 5215
 		{
5216 5216
 			$temp_array['airline_icao'] = $row['airline_icao'];
5217 5217
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -5229,11 +5229,11 @@  discard block
 block discarded – undo
5229 5229
 	* @return Array the aircraft list
5230 5230
 	*
5231 5231
 	*/
5232
-	public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5232
+	public function countAllAircraftTypesByMonths($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5233 5233
 	{
5234 5234
 		global $globalDBdriver;
5235
-		$filter_query = $this->getFilter($filters,true,true);
5236
-		$query  = "SELECT EXTRACT(month from spotter_output.date) as month, EXTRACT(year from spotter_output.date) as year,spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5235
+		$filter_query = $this->getFilter($filters, true, true);
5236
+		$query = "SELECT EXTRACT(month from spotter_output.date) as month, EXTRACT(year from spotter_output.date) as year,spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5237 5237
 		    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' ";
5238 5238
 		if ($olderthanmonths > 0) {
5239 5239
 			if ($globalDBdriver == 'mysql') {
@@ -5258,7 +5258,7 @@  discard block
 block discarded – undo
5258 5258
 
5259 5259
 		$aircraft_array = array();
5260 5260
 		$temp_array = array();
5261
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5261
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5262 5262
 		{
5263 5263
 			//$temp_array['airline_icao'] = $row['airline_icao'];
5264 5264
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -5277,13 +5277,13 @@  discard block
 block discarded – undo
5277 5277
 	* @return Array the aircraft list
5278 5278
 	*
5279 5279
 	*/
5280
-	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
5280
+	public function countAllAircraftRegistrationByAircraft($aircraft_icao, $filters = array())
5281 5281
 	{
5282 5282
 		$Image = new Image($this->db);
5283
-		$filter_query = $this->getFilter($filters,true,true);
5284
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5283
+		$filter_query = $this->getFilter($filters, true, true);
5284
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5285 5285
 
5286
-		$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  
5286
+		$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  
5287 5287
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao  
5288 5288
 				GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
5289 5289
 				ORDER BY registration_count DESC";
@@ -5294,14 +5294,14 @@  discard block
 block discarded – undo
5294 5294
 		$aircraft_array = array();
5295 5295
 		$temp_array = array();
5296 5296
         
5297
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5297
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5298 5298
 		{
5299 5299
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5300 5300
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5301 5301
 			$temp_array['registration'] = $row['registration'];
5302 5302
 			$temp_array['airline_name'] = $row['airline_name'];
5303 5303
 			$temp_array['image_thumbnail'] = "";
5304
-			if($row['registration'] != "")
5304
+			if ($row['registration'] != "")
5305 5305
 			{
5306 5306
 				$image_array = $Image->getSpotterImage($row['registration']);
5307 5307
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5320,11 +5320,11 @@  discard block
 block discarded – undo
5320 5320
 	* @return Array the aircraft list
5321 5321
 	*
5322 5322
 	*/
5323
-	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
5323
+	public function countAllAircraftTypesByAirline($airline_icao, $filters = array())
5324 5324
 	{
5325
-		$filter_query = $this->getFilter($filters,true,true);
5326
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5327
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5325
+		$filter_query = $this->getFilter($filters, true, true);
5326
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5327
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5328 5328
 			    FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao 
5329 5329
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5330 5330
 			    ORDER BY aircraft_icao_count DESC";
@@ -5335,7 +5335,7 @@  discard block
 block discarded – undo
5335 5335
 		$aircraft_array = array();
5336 5336
 		$temp_array = array();
5337 5337
 
5338
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5338
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5339 5339
 		{
5340 5340
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5341 5341
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5353,13 +5353,13 @@  discard block
 block discarded – undo
5353 5353
 	* @return Array the aircraft list
5354 5354
 	*
5355 5355
 	*/
5356
-	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
5356
+	public function countAllAircraftRegistrationByAirline($airline_icao, $filters = array())
5357 5357
 	{
5358
-		$filter_query = $this->getFilter($filters,true,true);
5358
+		$filter_query = $this->getFilter($filters, true, true);
5359 5359
 		$Image = new Image($this->db);
5360
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5360
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5361 5361
 
5362
-		$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 
5362
+		$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 
5363 5363
 			    FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao 
5364 5364
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
5365 5365
 			    ORDER BY registration_count DESC";
@@ -5369,14 +5369,14 @@  discard block
 block discarded – undo
5369 5369
 
5370 5370
 		$aircraft_array = array();
5371 5371
 		$temp_array = array();
5372
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5372
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5373 5373
 		{
5374 5374
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5375 5375
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5376 5376
 			$temp_array['registration'] = $row['registration'];
5377 5377
 			$temp_array['airline_name'] = $row['airline_name'];
5378 5378
 			$temp_array['image_thumbnail'] = "";
5379
-			if($row['registration'] != "")
5379
+			if ($row['registration'] != "")
5380 5380
 			{
5381 5381
 				$image_array = $Image->getSpotterImage($row['registration']);
5382 5382
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5395,11 +5395,11 @@  discard block
 block discarded – undo
5395 5395
 	* @return Array the aircraft list
5396 5396
 	*
5397 5397
 	*/
5398
-	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
5398
+	public function countAllAircraftManufacturerByAirline($airline_icao, $filters = array())
5399 5399
 	{
5400
-		$filter_query = $this->getFilter($filters,true,true);
5401
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5402
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5400
+		$filter_query = $this->getFilter($filters, true, true);
5401
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5402
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5403 5403
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao 
5404 5404
 				GROUP BY spotter_output.aircraft_manufacturer 
5405 5405
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -5410,7 +5410,7 @@  discard block
 block discarded – undo
5410 5410
 		$aircraft_array = array();
5411 5411
 		$temp_array = array();
5412 5412
 
5413
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5413
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5414 5414
 		{
5415 5415
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5416 5416
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5427,12 +5427,12 @@  discard block
 block discarded – undo
5427 5427
 	* @return Array the aircraft list
5428 5428
 	*
5429 5429
 	*/
5430
-	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
5430
+	public function countAllAircraftTypesByAirport($airport_icao, $filters = array())
5431 5431
 	{
5432
-		$filter_query = $this->getFilter($filters,true,true);
5433
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5432
+		$filter_query = $this->getFilter($filters, true, true);
5433
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5434 5434
 
5435
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5435
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5436 5436
 				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) 
5437 5437
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5438 5438
 				ORDER BY aircraft_icao_count DESC";
@@ -5442,7 +5442,7 @@  discard block
 block discarded – undo
5442 5442
 
5443 5443
 		$aircraft_array = array();
5444 5444
 		$temp_array = array();
5445
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5445
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5446 5446
 		{
5447 5447
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5448 5448
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5460,13 +5460,13 @@  discard block
 block discarded – undo
5460 5460
 	* @return Array the aircraft list
5461 5461
 	*
5462 5462
 	*/
5463
-	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
5463
+	public function countAllAircraftRegistrationByAirport($airport_icao, $filters = array())
5464 5464
 	{
5465
-		$filter_query = $this->getFilter($filters,true,true);
5465
+		$filter_query = $this->getFilter($filters, true, true);
5466 5466
 		$Image = new Image($this->db);
5467
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5467
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5468 5468
 
5469
-		$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  
5469
+		$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  
5470 5470
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)   
5471 5471
                     GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5472 5472
 		    ORDER BY registration_count DESC";
@@ -5476,14 +5476,14 @@  discard block
 block discarded – undo
5476 5476
 
5477 5477
 		$aircraft_array = array();
5478 5478
 		$temp_array = array();
5479
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5479
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5480 5480
 		{
5481 5481
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5482 5482
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5483 5483
 			$temp_array['registration'] = $row['registration'];
5484 5484
 			$temp_array['airline_name'] = $row['airline_name'];
5485 5485
 			$temp_array['image_thumbnail'] = "";
5486
-			if($row['registration'] != "")
5486
+			if ($row['registration'] != "")
5487 5487
 			{
5488 5488
 				$image_array = $Image->getSpotterImage($row['registration']);
5489 5489
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5501,11 +5501,11 @@  discard block
 block discarded – undo
5501 5501
 	* @return Array the aircraft list
5502 5502
 	*
5503 5503
 	*/
5504
-	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
5504
+	public function countAllAircraftManufacturerByAirport($airport_icao, $filters = array())
5505 5505
 	{
5506
-		$filter_query = $this->getFilter($filters,true,true);
5507
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5508
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5506
+		$filter_query = $this->getFilter($filters, true, true);
5507
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5508
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5509 5509
                     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)  
5510 5510
                     GROUP BY spotter_output.aircraft_manufacturer 
5511 5511
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5516,7 +5516,7 @@  discard block
 block discarded – undo
5516 5516
 
5517 5517
 		$aircraft_array = array();
5518 5518
 		$temp_array = array();
5519
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5519
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5520 5520
 		{
5521 5521
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5522 5522
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5531,12 +5531,12 @@  discard block
 block discarded – undo
5531 5531
 	* @return Array the aircraft list
5532 5532
 	*
5533 5533
 	*/
5534
-	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
5534
+	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer, $filters = array())
5535 5535
 	{
5536
-		$filter_query = $this->getFilter($filters,true,true);
5537
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5536
+		$filter_query = $this->getFilter($filters, true, true);
5537
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5538 5538
 
5539
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5539
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5540 5540
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
5541 5541
                     GROUP BY spotter_output.aircraft_name 
5542 5542
 					ORDER BY aircraft_icao_count DESC";
@@ -5545,7 +5545,7 @@  discard block
 block discarded – undo
5545 5545
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
5546 5546
 		$aircraft_array = array();
5547 5547
 		$temp_array = array();
5548
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5548
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5549 5549
 		{
5550 5550
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5551 5551
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5564,11 +5564,11 @@  discard block
 block discarded – undo
5564 5564
 	*/
5565 5565
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
5566 5566
 	{
5567
-		$filter_query = $this->getFilter($filters,true,true);
5567
+		$filter_query = $this->getFilter($filters, true, true);
5568 5568
 		$Image = new Image($this->db);
5569
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5569
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5570 5570
 
5571
-		$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   
5571
+		$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   
5572 5572
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
5573 5573
                     GROUP BY spotter_output.registration 
5574 5574
 					ORDER BY registration_count DESC";
@@ -5578,14 +5578,14 @@  discard block
 block discarded – undo
5578 5578
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
5579 5579
 		$aircraft_array = array();
5580 5580
 		$temp_array = array();
5581
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5581
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5582 5582
 		{
5583 5583
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5584 5584
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5585 5585
 			$temp_array['registration'] = $row['registration'];
5586 5586
 			$temp_array['airline_name'] = $row['airline_name'];
5587 5587
 			$temp_array['image_thumbnail'] = "";
5588
-			if($row['registration'] != "")
5588
+			if ($row['registration'] != "")
5589 5589
 			{
5590 5590
 				$image_array = $Image->getSpotterImage($row['registration']);
5591 5591
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5602,11 +5602,11 @@  discard block
 block discarded – undo
5602 5602
 	* @return Array the aircraft list
5603 5603
 	*
5604 5604
 	*/
5605
-	public function countAllAircraftTypesByDate($date,$filters = array())
5605
+	public function countAllAircraftTypesByDate($date, $filters = array())
5606 5606
 	{
5607 5607
 		global $globalTimezone, $globalDBdriver;
5608
-		$filter_query = $this->getFilter($filters,true,true);
5609
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5608
+		$filter_query = $this->getFilter($filters, true, true);
5609
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5610 5610
 		if ($globalTimezone != '') {
5611 5611
 			date_default_timezone_set($globalTimezone);
5612 5612
 			$datetime = new DateTime($date);
@@ -5614,12 +5614,12 @@  discard block
 block discarded – undo
5614 5614
 		} else $offset = '+00:00';
5615 5615
 
5616 5616
 		if ($globalDBdriver == 'mysql') {
5617
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5617
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5618 5618
 					FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
5619 5619
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5620 5620
 					ORDER BY aircraft_icao_count DESC";
5621 5621
 		} else {
5622
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5622
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5623 5623
 					FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
5624 5624
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5625 5625
 					ORDER BY aircraft_icao_count DESC";
@@ -5630,7 +5630,7 @@  discard block
 block discarded – undo
5630 5630
 
5631 5631
 		$aircraft_array = array();
5632 5632
 		$temp_array = array();
5633
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5633
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5634 5634
 		{
5635 5635
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5636 5636
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5648,12 +5648,12 @@  discard block
 block discarded – undo
5648 5648
 	* @return Array the aircraft list
5649 5649
 	*
5650 5650
 	*/
5651
-	public function countAllAircraftRegistrationByDate($date,$filters = array())
5651
+	public function countAllAircraftRegistrationByDate($date, $filters = array())
5652 5652
 	{
5653 5653
 		global $globalTimezone, $globalDBdriver;
5654
-		$filter_query = $this->getFilter($filters,true,true);
5654
+		$filter_query = $this->getFilter($filters, true, true);
5655 5655
 		$Image = new Image($this->db);
5656
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5656
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5657 5657
 		if ($globalTimezone != '') {
5658 5658
 			date_default_timezone_set($globalTimezone);
5659 5659
 			$datetime = new DateTime($date);
@@ -5661,12 +5661,12 @@  discard block
 block discarded – undo
5661 5661
 		} else $offset = '+00:00';
5662 5662
 
5663 5663
 		if ($globalDBdriver == 'mysql') {
5664
-			$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 
5664
+			$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 
5665 5665
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
5666 5666
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5667 5667
 					ORDER BY registration_count DESC";
5668 5668
 		} else {
5669
-			$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    
5669
+			$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    
5670 5670
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5671 5671
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5672 5672
 					ORDER BY registration_count DESC";
@@ -5677,14 +5677,14 @@  discard block
 block discarded – undo
5677 5677
 
5678 5678
 		$aircraft_array = array();
5679 5679
 		$temp_array = array();
5680
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5680
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5681 5681
 		{
5682 5682
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5683 5683
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5684 5684
 			$temp_array['registration'] = $row['registration'];
5685 5685
 			$temp_array['airline_name'] = $row['airline_name'];
5686 5686
 			$temp_array['image_thumbnail'] = "";
5687
-			if($row['registration'] != "")
5687
+			if ($row['registration'] != "")
5688 5688
 			{
5689 5689
 				$image_array = $Image->getSpotterImage($row['registration']);
5690 5690
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5703,11 +5703,11 @@  discard block
 block discarded – undo
5703 5703
 	* @return Array the aircraft manufacturer list
5704 5704
 	*
5705 5705
 	*/
5706
-	public function countAllAircraftManufacturerByDate($date,$filters = array())
5706
+	public function countAllAircraftManufacturerByDate($date, $filters = array())
5707 5707
 	{
5708 5708
 		global $globalTimezone, $globalDBdriver;
5709
-		$filter_query = $this->getFilter($filters,true,true);
5710
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
5709
+		$filter_query = $this->getFilter($filters, true, true);
5710
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
5711 5711
 		if ($globalTimezone != '') {
5712 5712
 			date_default_timezone_set($globalTimezone);
5713 5713
 			$datetime = new DateTime($date);
@@ -5715,12 +5715,12 @@  discard block
 block discarded – undo
5715 5715
 		} else $offset = '+00:00';
5716 5716
 
5717 5717
 		if ($globalDBdriver == 'mysql') {
5718
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5718
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5719 5719
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
5720 5720
 				GROUP BY spotter_output.aircraft_manufacturer 
5721 5721
 				ORDER BY aircraft_manufacturer_count DESC";
5722 5722
 		} else {
5723
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5723
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5724 5724
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
5725 5725
 				GROUP BY spotter_output.aircraft_manufacturer 
5726 5726
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -5732,7 +5732,7 @@  discard block
 block discarded – undo
5732 5732
 		$aircraft_array = array();
5733 5733
 		$temp_array = array();
5734 5734
 
5735
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5735
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5736 5736
 		{
5737 5737
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5738 5738
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5749,11 +5749,11 @@  discard block
 block discarded – undo
5749 5749
 	* @return Array the aircraft list
5750 5750
 	*
5751 5751
 	*/
5752
-	public function countAllAircraftTypesByIdent($ident,$filters = array())
5752
+	public function countAllAircraftTypesByIdent($ident, $filters = array())
5753 5753
 	{
5754
-		$filter_query = $this->getFilter($filters,true,true);
5755
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5756
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5754
+		$filter_query = $this->getFilter($filters, true, true);
5755
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5756
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5757 5757
 				FROM spotter_output".$filter_query." spotter_output.ident = :ident 
5758 5758
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
5759 5759
 				ORDER BY aircraft_icao_count DESC";
@@ -5764,7 +5764,7 @@  discard block
 block discarded – undo
5764 5764
 		$aircraft_array = array();
5765 5765
 		$temp_array = array();
5766 5766
 
5767
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5767
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5768 5768
 		{
5769 5769
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5770 5770
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5781,45 +5781,45 @@  discard block
 block discarded – undo
5781 5781
 	* @return Array the aircraft list
5782 5782
 	*
5783 5783
 	*/
5784
-	public function countAllAircraftTypesByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
5784
+	public function countAllAircraftTypesByPilot($pilot, $filters = array(), $year = '', $month = '', $day = '')
5785 5785
 	{
5786 5786
 		global $globalDBdriver;
5787
-		$filter_query = $this->getFilter($filters,true,true);
5788
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
5789
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5787
+		$filter_query = $this->getFilter($filters, true, true);
5788
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
5789
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5790 5790
 				FROM spotter_output".$filter_query." (spotter_output.pilot_id = :pilot OR spotter_output.pilot_name = :pilot)";
5791 5791
 		$query_values = array();
5792 5792
 		if ($year != '') {
5793 5793
 			if ($globalDBdriver == 'mysql') {
5794 5794
 				$query .= " AND YEAR(spotter_output.date) = :year";
5795
-				$query_values = array_merge($query_values,array(':year' => $year));
5795
+				$query_values = array_merge($query_values, array(':year' => $year));
5796 5796
 			} else {
5797 5797
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5798
-				$query_values = array_merge($query_values,array(':year' => $year));
5798
+				$query_values = array_merge($query_values, array(':year' => $year));
5799 5799
 			}
5800 5800
 		}
5801 5801
 		if ($month != '') {
5802 5802
 			if ($globalDBdriver == 'mysql') {
5803 5803
 				$query .= " AND MONTH(spotter_output.date) = :month";
5804
-				$query_values = array_merge($query_values,array(':month' => $month));
5804
+				$query_values = array_merge($query_values, array(':month' => $month));
5805 5805
 			} else {
5806 5806
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5807
-				$query_values = array_merge($query_values,array(':month' => $month));
5807
+				$query_values = array_merge($query_values, array(':month' => $month));
5808 5808
 			}
5809 5809
 		}
5810 5810
 		if ($day != '') {
5811 5811
 			if ($globalDBdriver == 'mysql') {
5812 5812
 				$query .= " AND DAY(spotter_output.date) = :day";
5813
-				$query_values = array_merge($query_values,array(':day' => $day));
5813
+				$query_values = array_merge($query_values, array(':day' => $day));
5814 5814
 			} else {
5815 5815
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5816
-				$query_values = array_merge($query_values,array(':day' => $day));
5816
+				$query_values = array_merge($query_values, array(':day' => $day));
5817 5817
 			}
5818 5818
 		}
5819 5819
 
5820 5820
 		$query .= " GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
5821 5821
 				ORDER BY aircraft_icao_count DESC";
5822
-		$query_values = array_merge($query_values,array(':pilot' => $pilot));
5822
+		$query_values = array_merge($query_values, array(':pilot' => $pilot));
5823 5823
 		$sth = $this->db->prepare($query);
5824 5824
 		$sth->execute($query_values);
5825 5825
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -5831,44 +5831,44 @@  discard block
 block discarded – undo
5831 5831
 	* @return Array the aircraft list
5832 5832
 	*
5833 5833
 	*/
5834
-	public function countAllAircraftTypesByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
5834
+	public function countAllAircraftTypesByOwner($owner, $filters = array(), $year = '', $month = '', $day = '')
5835 5835
 	{
5836 5836
 		global $globalDBdriver;
5837
-		$filter_query = $this->getFilter($filters,true,true);
5838
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
5839
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5837
+		$filter_query = $this->getFilter($filters, true, true);
5838
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
5839
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
5840 5840
 				FROM spotter_output".$filter_query." spotter_output.owner_name = :owner";
5841 5841
 		$query_values = array();
5842 5842
 		if ($year != '') {
5843 5843
 			if ($globalDBdriver == 'mysql') {
5844 5844
 				$query .= " AND YEAR(spotter_output.date) = :year";
5845
-				$query_values = array_merge($query_values,array(':year' => $year));
5845
+				$query_values = array_merge($query_values, array(':year' => $year));
5846 5846
 			} else {
5847 5847
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5848
-				$query_values = array_merge($query_values,array(':year' => $year));
5848
+				$query_values = array_merge($query_values, array(':year' => $year));
5849 5849
 			}
5850 5850
 		}
5851 5851
 		if ($month != '') {
5852 5852
 			if ($globalDBdriver == 'mysql') {
5853 5853
 				$query .= " AND MONTH(spotter_output.date) = :month";
5854
-				$query_values = array_merge($query_values,array(':month' => $month));
5854
+				$query_values = array_merge($query_values, array(':month' => $month));
5855 5855
 			} else {
5856 5856
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5857
-				$query_values = array_merge($query_values,array(':month' => $month));
5857
+				$query_values = array_merge($query_values, array(':month' => $month));
5858 5858
 			}
5859 5859
 		}
5860 5860
 		if ($day != '') {
5861 5861
 			if ($globalDBdriver == 'mysql') {
5862 5862
 				$query .= " AND DAY(spotter_output.date) = :day";
5863
-				$query_values = array_merge($query_values,array(':day' => $day));
5863
+				$query_values = array_merge($query_values, array(':day' => $day));
5864 5864
 			} else {
5865 5865
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5866
-				$query_values = array_merge($query_values,array(':day' => $day));
5866
+				$query_values = array_merge($query_values, array(':day' => $day));
5867 5867
 			}
5868 5868
 		}
5869 5869
 		$query .= " GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.aircraft_icao
5870 5870
 				ORDER BY aircraft_icao_count DESC";
5871
-		$query_values = array_merge($query_values,array(':owner' => $owner));
5871
+		$query_values = array_merge($query_values, array(':owner' => $owner));
5872 5872
 		$sth = $this->db->prepare($query);
5873 5873
 		$sth->execute($query_values);
5874 5874
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -5880,13 +5880,13 @@  discard block
 block discarded – undo
5880 5880
 	* @return Array the aircraft list
5881 5881
 	*
5882 5882
 	*/
5883
-	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
5883
+	public function countAllAircraftRegistrationByIdent($ident, $filters = array())
5884 5884
 	{
5885
-		$filter_query = $this->getFilter($filters,true,true);
5885
+		$filter_query = $this->getFilter($filters, true, true);
5886 5886
 		$Image = new Image($this->db);
5887
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5887
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5888 5888
 
5889
-		$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  
5889
+		$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  
5890 5890
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.ident = :ident   
5891 5891
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
5892 5892
 		    ORDER BY registration_count DESC";
@@ -5898,14 +5898,14 @@  discard block
 block discarded – undo
5898 5898
 		$aircraft_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['aircraft_icao'] = $row['aircraft_icao'];
5904 5904
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5905 5905
 			$temp_array['registration'] = $row['registration'];
5906 5906
 			$temp_array['airline_name'] = $row['airline_name'];
5907 5907
 			$temp_array['image_thumbnail'] = "";
5908
-			if($row['registration'] != "")
5908
+			if ($row['registration'] != "")
5909 5909
 			{
5910 5910
 				$image_array = $Image->getSpotterImage($row['registration']);
5911 5911
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5923,44 +5923,44 @@  discard block
 block discarded – undo
5923 5923
 	* @return Array the aircraft list
5924 5924
 	*
5925 5925
 	*/
5926
-	public function countAllAircraftRegistrationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
5926
+	public function countAllAircraftRegistrationByOwner($owner, $filters = array(), $year = '', $month = '', $day = '')
5927 5927
 	{
5928 5928
 		global $globalDBdriver;
5929
-		$filter_query = $this->getFilter($filters,true,true);
5929
+		$filter_query = $this->getFilter($filters, true, true);
5930 5930
 		$Image = new Image($this->db);
5931
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
5931
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
5932 5932
 
5933
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name  
5933
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name  
5934 5934
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.owner_name = :owner";
5935 5935
 		$query_values = array();
5936 5936
 		if ($year != '') {
5937 5937
 			if ($globalDBdriver == 'mysql') {
5938 5938
 				$query .= " AND YEAR(spotter_output.date) = :year";
5939
-				$query_values = array_merge($query_values,array(':year' => $year));
5939
+				$query_values = array_merge($query_values, array(':year' => $year));
5940 5940
 			} else {
5941 5941
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
5942
-				$query_values = array_merge($query_values,array(':year' => $year));
5942
+				$query_values = array_merge($query_values, array(':year' => $year));
5943 5943
 			}
5944 5944
 		}
5945 5945
 		if ($month != '') {
5946 5946
 			if ($globalDBdriver == 'mysql') {
5947 5947
 				$query .= " AND MONTH(spotter_output.date) = :month";
5948
-				$query_values = array_merge($query_values,array(':month' => $month));
5948
+				$query_values = array_merge($query_values, array(':month' => $month));
5949 5949
 			} else {
5950 5950
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
5951
-				$query_values = array_merge($query_values,array(':month' => $month));
5951
+				$query_values = array_merge($query_values, array(':month' => $month));
5952 5952
 			}
5953 5953
 		}
5954 5954
 		if ($day != '') {
5955 5955
 			if ($globalDBdriver == 'mysql') {
5956 5956
 				$query .= " AND DAY(spotter_output.date) = :day";
5957
-				$query_values = array_merge($query_values,array(':day' => $day));
5957
+				$query_values = array_merge($query_values, array(':day' => $day));
5958 5958
 			} else {
5959 5959
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
5960
-				$query_values = array_merge($query_values,array(':day' => $day));
5960
+				$query_values = array_merge($query_values, array(':day' => $day));
5961 5961
 			}
5962 5962
 		}
5963
-		$query_values = array_merge($query_values,array(':owner' => $owner));
5963
+		$query_values = array_merge($query_values, array(':owner' => $owner));
5964 5964
 
5965 5965
 		$query .= " GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_name
5966 5966
 		    ORDER BY registration_count DESC";
@@ -5972,7 +5972,7 @@  discard block
 block discarded – undo
5972 5972
 		$aircraft_array = array();
5973 5973
 		$temp_array = array();
5974 5974
         
5975
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5975
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5976 5976
 		{
5977 5977
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5978 5978
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5980,7 +5980,7 @@  discard block
 block discarded – undo
5980 5980
 			$temp_array['registration'] = $row['registration'];
5981 5981
 			$temp_array['airline_name'] = $row['airline_name'];
5982 5982
 			$temp_array['image_thumbnail'] = "";
5983
-			if($row['registration'] != "")
5983
+			if ($row['registration'] != "")
5984 5984
 			{
5985 5985
 				$image_array = $Image->getSpotterImage($row['registration']);
5986 5986
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5998,44 +5998,44 @@  discard block
 block discarded – undo
5998 5998
 	* @return Array the aircraft list
5999 5999
 	*
6000 6000
 	*/
6001
-	public function countAllAircraftRegistrationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
6001
+	public function countAllAircraftRegistrationByPilot($pilot, $filters = array(), $year = '', $month = '', $day = '')
6002 6002
 	{
6003 6003
 		global $globalDBdriver;
6004
-		$filter_query = $this->getFilter($filters,true,true);
6004
+		$filter_query = $this->getFilter($filters, true, true);
6005 6005
 		$Image = new Image($this->db);
6006
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
6006
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
6007 6007
 
6008
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name  
6008
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name  
6009 6009
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot)";
6010 6010
 		$query_values = array();
6011 6011
 		if ($year != '') {
6012 6012
 			if ($globalDBdriver == 'mysql') {
6013 6013
 				$query .= " AND YEAR(spotter_output.date) = :year";
6014
-				$query_values = array_merge($query_values,array(':year' => $year));
6014
+				$query_values = array_merge($query_values, array(':year' => $year));
6015 6015
 			} else {
6016 6016
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6017
-				$query_values = array_merge($query_values,array(':year' => $year));
6017
+				$query_values = array_merge($query_values, array(':year' => $year));
6018 6018
 			}
6019 6019
 		}
6020 6020
 		if ($month != '') {
6021 6021
 			if ($globalDBdriver == 'mysql') {
6022 6022
 				$query .= " AND MONTH(spotter_output.date) = :month";
6023
-				$query_values = array_merge($query_values,array(':month' => $month));
6023
+				$query_values = array_merge($query_values, array(':month' => $month));
6024 6024
 			} else {
6025 6025
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6026
-				$query_values = array_merge($query_values,array(':month' => $month));
6026
+				$query_values = array_merge($query_values, array(':month' => $month));
6027 6027
 			}
6028 6028
 		}
6029 6029
 		if ($day != '') {
6030 6030
 			if ($globalDBdriver == 'mysql') {
6031 6031
 				$query .= " AND DAY(spotter_output.date) = :day";
6032
-				$query_values = array_merge($query_values,array(':day' => $day));
6032
+				$query_values = array_merge($query_values, array(':day' => $day));
6033 6033
 			} else {
6034 6034
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6035
-				$query_values = array_merge($query_values,array(':day' => $day));
6035
+				$query_values = array_merge($query_values, array(':day' => $day));
6036 6036
 			}
6037 6037
 		}
6038
-		$query_values = array_merge($query_values,array(':pilot' => $pilot));
6038
+		$query_values = array_merge($query_values, array(':pilot' => $pilot));
6039 6039
 
6040 6040
 		$query .= " GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_name
6041 6041
 		    ORDER BY registration_count DESC";
@@ -6047,7 +6047,7 @@  discard block
 block discarded – undo
6047 6047
 		$aircraft_array = array();
6048 6048
 		$temp_array = array();
6049 6049
         
6050
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6050
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6051 6051
 		{
6052 6052
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6053 6053
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -6055,7 +6055,7 @@  discard block
 block discarded – undo
6055 6055
 			$temp_array['registration'] = $row['registration'];
6056 6056
 			$temp_array['airline_name'] = $row['airline_name'];
6057 6057
 			$temp_array['image_thumbnail'] = "";
6058
-			if($row['registration'] != "")
6058
+			if ($row['registration'] != "")
6059 6059
 			{
6060 6060
 				$image_array = $Image->getSpotterImage($row['registration']);
6061 6061
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6074,11 +6074,11 @@  discard block
 block discarded – undo
6074 6074
 	* @return Array the aircraft manufacturer list
6075 6075
 	*
6076 6076
 	*/
6077
-	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
6077
+	public function countAllAircraftManufacturerByIdent($ident, $filters = array())
6078 6078
 	{
6079
-		$filter_query = $this->getFilter($filters,true,true);
6080
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6081
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6079
+		$filter_query = $this->getFilter($filters, true, true);
6080
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6081
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6082 6082
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident  
6083 6083
                     GROUP BY spotter_output.aircraft_manufacturer 
6084 6084
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -6088,7 +6088,7 @@  discard block
 block discarded – undo
6088 6088
 		$sth->execute(array(':ident' => $ident));
6089 6089
 		$aircraft_array = array();
6090 6090
 		$temp_array = array();
6091
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6091
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6092 6092
 		{
6093 6093
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
6094 6094
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -6103,42 +6103,42 @@  discard block
 block discarded – undo
6103 6103
 	* @return Array the aircraft manufacturer list
6104 6104
 	*
6105 6105
 	*/
6106
-	public function countAllAircraftManufacturerByOwner($owner,$filters = array(),$year = '',$month = '',$day = '')
6106
+	public function countAllAircraftManufacturerByOwner($owner, $filters = array(), $year = '', $month = '', $day = '')
6107 6107
 	{
6108 6108
 		global $globalDBdriver;
6109
-		$filter_query = $this->getFilter($filters,true,true);
6110
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
6111
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6109
+		$filter_query = $this->getFilter($filters, true, true);
6110
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
6111
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6112 6112
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.owner_name = :owner";
6113 6113
 		$query_values = array();
6114 6114
 		if ($year != '') {
6115 6115
 			if ($globalDBdriver == 'mysql') {
6116 6116
 				$query .= " AND YEAR(spotter_output.date) = :year";
6117
-				$query_values = array_merge($query_values,array(':year' => $year));
6117
+				$query_values = array_merge($query_values, array(':year' => $year));
6118 6118
 			} else {
6119 6119
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6120
-				$query_values = array_merge($query_values,array(':year' => $year));
6120
+				$query_values = array_merge($query_values, array(':year' => $year));
6121 6121
 			}
6122 6122
 		}
6123 6123
 		if ($month != '') {
6124 6124
 			if ($globalDBdriver == 'mysql') {
6125 6125
 				$query .= " AND MONTH(spotter_output.date) = :month";
6126
-				$query_values = array_merge($query_values,array(':month' => $month));
6126
+				$query_values = array_merge($query_values, array(':month' => $month));
6127 6127
 			} else {
6128 6128
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6129
-				$query_values = array_merge($query_values,array(':month' => $month));
6129
+				$query_values = array_merge($query_values, array(':month' => $month));
6130 6130
 			}
6131 6131
 		}
6132 6132
 		if ($day != '') {
6133 6133
 			if ($globalDBdriver == 'mysql') {
6134 6134
 				$query .= " AND DAY(spotter_output.date) = :day";
6135
-				$query_values = array_merge($query_values,array(':day' => $day));
6135
+				$query_values = array_merge($query_values, array(':day' => $day));
6136 6136
 			} else {
6137 6137
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6138
-				$query_values = array_merge($query_values,array(':day' => $day));
6138
+				$query_values = array_merge($query_values, array(':day' => $day));
6139 6139
 			}
6140 6140
 		}
6141
-		$query_values = array_merge($query_values,array(':owner' => $owner));
6141
+		$query_values = array_merge($query_values, array(':owner' => $owner));
6142 6142
 
6143 6143
 		$query .= " GROUP BY spotter_output.aircraft_manufacturer 
6144 6144
 		    ORDER BY aircraft_manufacturer_count DESC";
@@ -6155,42 +6155,42 @@  discard block
 block discarded – undo
6155 6155
 	* @return Array the aircraft manufacturer list
6156 6156
 	*
6157 6157
 	*/
6158
-	public function countAllAircraftManufacturerByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '')
6158
+	public function countAllAircraftManufacturerByPilot($pilot, $filters = array(), $year = '', $month = '', $day = '')
6159 6159
 	{
6160 6160
 		global $globalDBdriver;
6161
-		$filter_query = $this->getFilter($filters,true,true);
6162
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
6163
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6161
+		$filter_query = $this->getFilter($filters, true, true);
6162
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
6163
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6164 6164
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot)";
6165 6165
 		$query_values = array();
6166 6166
 		if ($year != '') {
6167 6167
 			if ($globalDBdriver == 'mysql') {
6168 6168
 				$query .= " AND YEAR(spotter_output.date) = :year";
6169
-				$query_values = array_merge($query_values,array(':year' => $year));
6169
+				$query_values = array_merge($query_values, array(':year' => $year));
6170 6170
 			} else {
6171 6171
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6172
-				$query_values = array_merge($query_values,array(':year' => $year));
6172
+				$query_values = array_merge($query_values, array(':year' => $year));
6173 6173
 			}
6174 6174
 		}
6175 6175
 		if ($month != '') {
6176 6176
 			if ($globalDBdriver == 'mysql') {
6177 6177
 				$query .= " AND MONTH(spotter_output.date) = :month";
6178
-				$query_values = array_merge($query_values,array(':month' => $month));
6178
+				$query_values = array_merge($query_values, array(':month' => $month));
6179 6179
 			} else {
6180 6180
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6181
-				$query_values = array_merge($query_values,array(':month' => $month));
6181
+				$query_values = array_merge($query_values, array(':month' => $month));
6182 6182
 			}
6183 6183
 		}
6184 6184
 		if ($day != '') {
6185 6185
 			if ($globalDBdriver == 'mysql') {
6186 6186
 				$query .= " AND DAY(spotter_output.date) = :day";
6187
-				$query_values = array_merge($query_values,array(':day' => $day));
6187
+				$query_values = array_merge($query_values, array(':day' => $day));
6188 6188
 			} else {
6189 6189
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6190
-				$query_values = array_merge($query_values,array(':day' => $day));
6190
+				$query_values = array_merge($query_values, array(':day' => $day));
6191 6191
 			}
6192 6192
 		}
6193
-		$query_values = array_merge($query_values,array(':pilot' => $pilot));
6193
+		$query_values = array_merge($query_values, array(':pilot' => $pilot));
6194 6194
 
6195 6195
 		$query .= " GROUP BY spotter_output.aircraft_manufacturer 
6196 6196
 		    ORDER BY aircraft_manufacturer_count DESC";
@@ -6208,24 +6208,24 @@  discard block
 block discarded – undo
6208 6208
 	* @return Array the aircraft list
6209 6209
 	*
6210 6210
 	*/
6211
-	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6211
+	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
6212 6212
 	{
6213
-		$filter_query = $this->getFilter($filters,true,true);
6214
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
6215
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
6213
+		$filter_query = $this->getFilter($filters, true, true);
6214
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
6215
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
6216 6216
 		
6217 6217
 
6218
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
6218
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
6219 6219
                     FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
6220 6220
                     GROUP BY spotter_output.aircraft_name 
6221 6221
 					ORDER BY aircraft_icao_count DESC";
6222 6222
  
6223 6223
 		
6224 6224
 		$sth = $this->db->prepare($query);
6225
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
6225
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
6226 6226
 		$aircraft_array = array();
6227 6227
 		$temp_array = array();
6228
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6228
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6229 6229
 		{
6230 6230
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6231 6231
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -6241,33 +6241,33 @@  discard block
 block discarded – undo
6241 6241
 	* @return Array the aircraft list
6242 6242
 	*
6243 6243
 	*/
6244
-	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6244
+	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
6245 6245
 	{
6246
-		$filter_query = $this->getFilter($filters,true,true);
6246
+		$filter_query = $this->getFilter($filters, true, true);
6247 6247
 		$Image = new Image($this->db);
6248
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
6249
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
6248
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
6249
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
6250 6250
 
6251
-		$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   
6251
+		$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   
6252 6252
                     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)   
6253 6253
                     GROUP BY spotter_output.registration 
6254 6254
 					ORDER BY registration_count DESC";
6255 6255
 
6256 6256
 		
6257 6257
 		$sth = $this->db->prepare($query);
6258
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
6258
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
6259 6259
       
6260 6260
 		$aircraft_array = array();
6261 6261
 		$temp_array = array();
6262 6262
         
6263
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6263
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6264 6264
 		{
6265 6265
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6266 6266
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6267 6267
 			$temp_array['registration'] = $row['registration'];
6268 6268
 			$temp_array['airline_name'] = $row['airline_name'];
6269 6269
 			$temp_array['image_thumbnail'] = "";
6270
-			if($row['registration'] != "")
6270
+			if ($row['registration'] != "")
6271 6271
 			{
6272 6272
 				$image_array = $Image->getSpotterImage($row['registration']);
6273 6273
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6287,25 +6287,25 @@  discard block
 block discarded – undo
6287 6287
 	* @return Array the aircraft manufacturer list
6288 6288
 	*
6289 6289
 	*/
6290
-	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
6290
+	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
6291 6291
 	{
6292
-		$filter_query = $this->getFilter($filters,true,true);
6293
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
6294
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
6292
+		$filter_query = $this->getFilter($filters, true, true);
6293
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
6294
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
6295 6295
 
6296
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6296
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6297 6297
                     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) 
6298 6298
                     GROUP BY spotter_output.aircraft_manufacturer 
6299 6299
 					ORDER BY aircraft_manufacturer_count DESC";
6300 6300
 
6301 6301
 		
6302 6302
 		$sth = $this->db->prepare($query);
6303
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
6303
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
6304 6304
       
6305 6305
 		$aircraft_array = array();
6306 6306
 		$temp_array = array();
6307 6307
         
6308
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6308
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6309 6309
 		{
6310 6310
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
6311 6311
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -6325,11 +6325,11 @@  discard block
 block discarded – undo
6325 6325
 	* @return Array the aircraft list
6326 6326
 	*
6327 6327
 	*/
6328
-	public function countAllAircraftTypesByCountry($country,$filters = array())
6328
+	public function countAllAircraftTypesByCountry($country, $filters = array())
6329 6329
 	{
6330
-		$filter_query = $this->getFilter($filters,true,true);
6331
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6332
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
6330
+		$filter_query = $this->getFilter($filters, true, true);
6331
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6332
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
6333 6333
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
6334 6334
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
6335 6335
 			    ORDER BY aircraft_icao_count DESC";
@@ -6341,7 +6341,7 @@  discard block
 block discarded – undo
6341 6341
 		$aircraft_array = array();
6342 6342
 		$temp_array = array();
6343 6343
         
6344
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6344
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6345 6345
 		{
6346 6346
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6347 6347
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -6360,12 +6360,12 @@  discard block
 block discarded – undo
6360 6360
 	* @return Array the aircraft list
6361 6361
 	*
6362 6362
 	*/
6363
-	public function countAllAircraftRegistrationByCountry($country,$filters = array())
6363
+	public function countAllAircraftRegistrationByCountry($country, $filters = array())
6364 6364
 	{
6365
-		$filter_query = $this->getFilter($filters,true,true);
6365
+		$filter_query = $this->getFilter($filters, true, true);
6366 6366
 		$Image = new Image($this->db);
6367
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6368
-		$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 
6367
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6368
+		$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 
6369 6369
 			    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)    
6370 6370
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
6371 6371
 			    ORDER BY registration_count DESC";
@@ -6377,14 +6377,14 @@  discard block
 block discarded – undo
6377 6377
 		$aircraft_array = array();
6378 6378
 		$temp_array = array();
6379 6379
         
6380
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6380
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6381 6381
 		{
6382 6382
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
6383 6383
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6384 6384
 			$temp_array['registration'] = $row['registration'];
6385 6385
 			$temp_array['airline_name'] = $row['airline_name'];
6386 6386
 			$temp_array['image_thumbnail'] = "";
6387
-			if($row['registration'] != "")
6387
+			if ($row['registration'] != "")
6388 6388
 			{
6389 6389
 				$image_array = $Image->getSpotterImage($row['registration']);
6390 6390
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6404,11 +6404,11 @@  discard block
 block discarded – undo
6404 6404
 	* @return Array the aircraft manufacturer list
6405 6405
 	*
6406 6406
 	*/
6407
-	public function countAllAircraftManufacturerByCountry($country,$filters = array())
6407
+	public function countAllAircraftManufacturerByCountry($country, $filters = array())
6408 6408
 	{
6409
-		$filter_query = $this->getFilter($filters,true,true);
6410
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6411
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6409
+		$filter_query = $this->getFilter($filters, true, true);
6410
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6411
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6412 6412
                     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) 
6413 6413
                     GROUP BY spotter_output.aircraft_manufacturer 
6414 6414
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -6420,7 +6420,7 @@  discard block
 block discarded – undo
6420 6420
 		$aircraft_array = array();
6421 6421
 		$temp_array = array();
6422 6422
         
6423
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6423
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6424 6424
 		{
6425 6425
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
6426 6426
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -6439,38 +6439,38 @@  discard block
 block discarded – undo
6439 6439
 	* @return Array the aircraft list
6440 6440
 	*
6441 6441
 	*/
6442
-	public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '')
6442
+	public function countAllAircraftManufacturers($filters = array(), $year = '', $month = '', $day = '')
6443 6443
 	{
6444 6444
 		global $globalDBdriver;
6445
-		$filter_query = $this->getFilter($filters,true,true);
6446
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6445
+		$filter_query = $this->getFilter($filters, true, true);
6446
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
6447 6447
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
6448 6448
                 $query_values = array();
6449 6449
 		if ($year != '') {
6450 6450
 			if ($globalDBdriver == 'mysql') {
6451 6451
 				$query .= " AND YEAR(spotter_output.date) = :year";
6452
-				$query_values = array_merge($query_values,array(':year' => $year));
6452
+				$query_values = array_merge($query_values, array(':year' => $year));
6453 6453
 			} else {
6454 6454
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6455
-				$query_values = array_merge($query_values,array(':year' => $year));
6455
+				$query_values = array_merge($query_values, array(':year' => $year));
6456 6456
 			}
6457 6457
 		}
6458 6458
 		if ($month != '') {
6459 6459
 			if ($globalDBdriver == 'mysql') {
6460 6460
 				$query .= " AND MONTH(spotter_output.date) = :month";
6461
-				$query_values = array_merge($query_values,array(':month' => $month));
6461
+				$query_values = array_merge($query_values, array(':month' => $month));
6462 6462
 			} else {
6463 6463
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6464
-				$query_values = array_merge($query_values,array(':month' => $month));
6464
+				$query_values = array_merge($query_values, array(':month' => $month));
6465 6465
 			}
6466 6466
 		}
6467 6467
 		if ($day != '') {
6468 6468
 			if ($globalDBdriver == 'mysql') {
6469 6469
 				$query .= " AND DAY(spotter_output.date) = :day";
6470
-				$query_values = array_merge($query_values,array(':day' => $day));
6470
+				$query_values = array_merge($query_values, array(':day' => $day));
6471 6471
 			} else {
6472 6472
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6473
-				$query_values = array_merge($query_values,array(':day' => $day));
6473
+				$query_values = array_merge($query_values, array(':day' => $day));
6474 6474
 			}
6475 6475
 		}
6476 6476
 		$query .= " GROUP BY spotter_output.aircraft_manufacturer
@@ -6484,7 +6484,7 @@  discard block
 block discarded – undo
6484 6484
 		$manufacturer_array = array();
6485 6485
 		$temp_array = array();
6486 6486
         
6487
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6487
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6488 6488
 		{
6489 6489
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
6490 6490
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -6503,12 +6503,12 @@  discard block
 block discarded – undo
6503 6503
 	* @return Array the aircraft list
6504 6504
 	*
6505 6505
 	*/
6506
-	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
6506
+	public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
6507 6507
 	{
6508 6508
 		global $globalDBdriver;
6509 6509
 		$Image = new Image($this->db);
6510
-		$filter_query = $this->getFilter($filters,true,true);
6511
-		$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    
6510
+		$filter_query = $this->getFilter($filters, true, true);
6511
+		$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    
6512 6512
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
6513 6513
                 if ($olderthanmonths > 0) {
6514 6514
             		if ($globalDBdriver == 'mysql') {
@@ -6528,28 +6528,28 @@  discard block
 block discarded – undo
6528 6528
 		if ($year != '') {
6529 6529
 			if ($globalDBdriver == 'mysql') {
6530 6530
 				$query .= " AND YEAR(spotter_output.date) = :year";
6531
-				$query_values = array_merge($query_values,array(':year' => $year));
6531
+				$query_values = array_merge($query_values, array(':year' => $year));
6532 6532
 			} else {
6533 6533
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6534
-				$query_values = array_merge($query_values,array(':year' => $year));
6534
+				$query_values = array_merge($query_values, array(':year' => $year));
6535 6535
 			}
6536 6536
 		}
6537 6537
 		if ($month != '') {
6538 6538
 			if ($globalDBdriver == 'mysql') {
6539 6539
 				$query .= " AND MONTH(spotter_output.date) = :month";
6540
-				$query_values = array_merge($query_values,array(':month' => $month));
6540
+				$query_values = array_merge($query_values, array(':month' => $month));
6541 6541
 			} else {
6542 6542
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6543
-				$query_values = array_merge($query_values,array(':month' => $month));
6543
+				$query_values = array_merge($query_values, array(':month' => $month));
6544 6544
 			}
6545 6545
 		}
6546 6546
 		if ($day != '') {
6547 6547
 			if ($globalDBdriver == 'mysql') {
6548 6548
 				$query .= " AND DAY(spotter_output.date) = :day";
6549
-				$query_values = array_merge($query_values,array(':day' => $day));
6549
+				$query_values = array_merge($query_values, array(':day' => $day));
6550 6550
 			} else {
6551 6551
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6552
-				$query_values = array_merge($query_values,array(':day' => $day));
6552
+				$query_values = array_merge($query_values, array(':day' => $day));
6553 6553
 			}
6554 6554
 		}
6555 6555
 		$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
@@ -6561,7 +6561,7 @@  discard block
 block discarded – undo
6561 6561
 		$aircraft_array = array();
6562 6562
 		$temp_array = array();
6563 6563
         
6564
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6564
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6565 6565
 		{
6566 6566
 			$temp_array['registration'] = $row['registration'];
6567 6567
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -6569,7 +6569,7 @@  discard block
 block discarded – undo
6569 6569
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6570 6570
 			$temp_array['airline_name'] = $row['airline_name'];
6571 6571
 			$temp_array['image_thumbnail'] = "";
6572
-			if($row['registration'] != "")
6572
+			if ($row['registration'] != "")
6573 6573
 			{
6574 6574
 				$image_array = $Image->getSpotterImage($row['registration']);
6575 6575
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6588,12 +6588,12 @@  discard block
 block discarded – undo
6588 6588
 	* @return Array the aircraft list
6589 6589
 	*
6590 6590
 	*/
6591
-	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
6591
+	public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
6592 6592
 	{
6593 6593
 		global $globalDBdriver;
6594
-		$filter_query = $this->getFilter($filters,true,true);
6594
+		$filter_query = $this->getFilter($filters, true, true);
6595 6595
 		$Image = new Image($this->db);
6596
-		$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    
6596
+		$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    
6597 6597
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
6598 6598
                 if ($olderthanmonths > 0) {
6599 6599
             		if ($globalDBdriver == 'mysql') {
@@ -6621,7 +6621,7 @@  discard block
 block discarded – undo
6621 6621
 		$aircraft_array = array();
6622 6622
 		$temp_array = array();
6623 6623
         
6624
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6624
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6625 6625
 		{
6626 6626
 			$temp_array['registration'] = $row['registration'];
6627 6627
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -6630,7 +6630,7 @@  discard block
 block discarded – undo
6630 6630
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
6631 6631
 			$temp_array['airline_name'] = $row['airline_name'];
6632 6632
 			$temp_array['image_thumbnail'] = "";
6633
-			if($row['registration'] != "")
6633
+			if ($row['registration'] != "")
6634 6634
 			{
6635 6635
 				$image_array = $Image->getSpotterImage($row['registration']);
6636 6636
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -6649,11 +6649,11 @@  discard block
 block discarded – undo
6649 6649
 	* @return Array the airport list
6650 6650
 	*
6651 6651
 	*/
6652
-	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6652
+	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
6653 6653
 	{
6654 6654
 		global $globalDBdriver;
6655
-		$filter_query = $this->getFilter($filters,true,true);
6656
-		$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, airport.latitude, airport.longitude
6655
+		$filter_query = $this->getFilter($filters, true, true);
6656
+		$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, airport.latitude, airport.longitude
6657 6657
 				FROM airport, spotter_output".$filter_query." airport.icao = spotter_output.departure_airport_icao AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
6658 6658
                 if ($olderthanmonths > 0) {
6659 6659
             		if ($globalDBdriver == 'mysql') {
@@ -6673,28 +6673,28 @@  discard block
 block discarded – undo
6673 6673
 		if ($year != '') {
6674 6674
 			if ($globalDBdriver == 'mysql') {
6675 6675
 				$query .= " AND YEAR(spotter_output.date) = :year";
6676
-				$query_values = array_merge($query_values,array(':year' => $year));
6676
+				$query_values = array_merge($query_values, array(':year' => $year));
6677 6677
 			} else {
6678 6678
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6679
-				$query_values = array_merge($query_values,array(':year' => $year));
6679
+				$query_values = array_merge($query_values, array(':year' => $year));
6680 6680
 			}
6681 6681
 		}
6682 6682
 		if ($month != '') {
6683 6683
 			if ($globalDBdriver == 'mysql') {
6684 6684
 				$query .= " AND MONTH(spotter_output.date) = :month";
6685
-				$query_values = array_merge($query_values,array(':month' => $month));
6685
+				$query_values = array_merge($query_values, array(':month' => $month));
6686 6686
 			} else {
6687 6687
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6688
-				$query_values = array_merge($query_values,array(':month' => $month));
6688
+				$query_values = array_merge($query_values, array(':month' => $month));
6689 6689
 			}
6690 6690
 		}
6691 6691
 		if ($day != '') {
6692 6692
 			if ($globalDBdriver == 'mysql') {
6693 6693
 				$query .= " AND DAY(spotter_output.date) = :day";
6694
-				$query_values = array_merge($query_values,array(':day' => $day));
6694
+				$query_values = array_merge($query_values, array(':day' => $day));
6695 6695
 			} else {
6696 6696
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6697
-				$query_values = array_merge($query_values,array(':day' => $day));
6697
+				$query_values = array_merge($query_values, array(':day' => $day));
6698 6698
 			}
6699 6699
 		}
6700 6700
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, airport.latitude, airport.longitude
@@ -6706,7 +6706,7 @@  discard block
 block discarded – undo
6706 6706
 
6707 6707
 		$airport_array = array();
6708 6708
 		$temp_array = array();
6709
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6709
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6710 6710
 		{
6711 6711
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6712 6712
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6726,11 +6726,11 @@  discard block
 block discarded – undo
6726 6726
 	* @return Array the airport list
6727 6727
 	*
6728 6728
 	*/
6729
-	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6729
+	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
6730 6730
 	{
6731 6731
 		global $globalDBdriver;
6732
-		$filter_query = $this->getFilter($filters,true,true);
6733
-		$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 
6732
+		$filter_query = $this->getFilter($filters, true, true);
6733
+		$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 
6734 6734
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' ";
6735 6735
                 if ($olderthanmonths > 0) {
6736 6736
             		if ($globalDBdriver == 'mysql') {
@@ -6759,7 +6759,7 @@  discard block
 block discarded – undo
6759 6759
 		$airport_array = array();
6760 6760
 		$temp_array = array();
6761 6761
         
6762
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6762
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6763 6763
 		{
6764 6764
 			$temp_array['airline_icao'] = $row['airline_icao'];
6765 6765
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -6779,11 +6779,11 @@  discard block
 block discarded – undo
6779 6779
 	* @return Array the airport list
6780 6780
 	*
6781 6781
 	*/
6782
-	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
6782
+	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
6783 6783
 	{
6784 6784
 		global $globalDBdriver;
6785
-		$filter_query = $this->getFilter($filters,true,true);
6786
-		$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, airport.latitude as departure_airport_latitude, airport.longitude as departure_airport_longitude
6785
+		$filter_query = $this->getFilter($filters, true, true);
6786
+		$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, airport.latitude as departure_airport_latitude, airport.longitude as departure_airport_longitude
6787 6787
 				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";
6788 6788
                 if ($olderthanmonths > 0) {
6789 6789
             		if ($globalDBdriver == 'mysql') {
@@ -6803,28 +6803,28 @@  discard block
 block discarded – undo
6803 6803
 		if ($year != '') {
6804 6804
 			if ($globalDBdriver == 'mysql') {
6805 6805
 				$query .= " AND YEAR(spotter_output.date) = :year";
6806
-				$query_values = array_merge($query_values,array(':year' => $year));
6806
+				$query_values = array_merge($query_values, array(':year' => $year));
6807 6807
 			} else {
6808 6808
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
6809
-				$query_values = array_merge($query_values,array(':year' => $year));
6809
+				$query_values = array_merge($query_values, array(':year' => $year));
6810 6810
 			}
6811 6811
 		}
6812 6812
 		if ($month != '') {
6813 6813
 			if ($globalDBdriver == 'mysql') {
6814 6814
 				$query .= " AND MONTH(spotter_output.date) = :month";
6815
-				$query_values = array_merge($query_values,array(':month' => $month));
6815
+				$query_values = array_merge($query_values, array(':month' => $month));
6816 6816
 			} else {
6817 6817
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
6818
-				$query_values = array_merge($query_values,array(':month' => $month));
6818
+				$query_values = array_merge($query_values, array(':month' => $month));
6819 6819
 			}
6820 6820
 		}
6821 6821
 		if ($day != '') {
6822 6822
 			if ($globalDBdriver == 'mysql') {
6823 6823
 				$query .= " AND DAY(spotter_output.date) = :day";
6824
-				$query_values = array_merge($query_values,array(':day' => $day));
6824
+				$query_values = array_merge($query_values, array(':day' => $day));
6825 6825
 			} else {
6826 6826
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
6827
-				$query_values = array_merge($query_values,array(':day' => $day));
6827
+				$query_values = array_merge($query_values, array(':day' => $day));
6828 6828
 			}
6829 6829
 		}
6830 6830
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country, airport.latitude, airport.longitude
@@ -6837,7 +6837,7 @@  discard block
 block discarded – undo
6837 6837
 		$airport_array = array();
6838 6838
 		$temp_array = array();
6839 6839
         
6840
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6840
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6841 6841
 		{
6842 6842
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6843 6843
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6858,11 +6858,11 @@  discard block
 block discarded – undo
6858 6858
 	* @return Array the airport list
6859 6859
 	*
6860 6860
 	*/
6861
-	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
6861
+	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
6862 6862
 	{
6863 6863
 		global $globalDBdriver;
6864
-		$filter_query = $this->getFilter($filters,true,true);
6865
-		$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
6864
+		$filter_query = $this->getFilter($filters, true, true);
6865
+		$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
6866 6866
 				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 ";
6867 6867
                 if ($olderthanmonths > 0) {
6868 6868
             		if ($globalDBdriver == 'mysql') {
@@ -6891,7 +6891,7 @@  discard block
 block discarded – undo
6891 6891
 		$airport_array = array();
6892 6892
 		$temp_array = array();
6893 6893
         
6894
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6894
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6895 6895
 		{
6896 6896
 			$temp_array['airline_icao'] = $row['airline_icao'];
6897 6897
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -6911,11 +6911,11 @@  discard block
 block discarded – undo
6911 6911
 	* @return Array the airport list
6912 6912
 	*
6913 6913
 	*/
6914
-	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
6914
+	public function countAllDepartureAirportsByAirline($airline_icao, $filters = array())
6915 6915
 	{
6916
-		$filter_query = $this->getFilter($filters,true,true);
6917
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6918
-		$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 
6916
+		$filter_query = $this->getFilter($filters, true, true);
6917
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6918
+		$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 
6919 6919
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao AND spotter_output.departure_airport_icao <> '' 
6920 6920
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6921 6921
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6927,7 +6927,7 @@  discard block
 block discarded – undo
6927 6927
 		$airport_array = array();
6928 6928
 		$temp_array = array();
6929 6929
         
6930
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6930
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6931 6931
 		{
6932 6932
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6933 6933
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6949,11 +6949,11 @@  discard block
 block discarded – undo
6949 6949
 	* @return Array the airport list
6950 6950
 	*
6951 6951
 	*/
6952
-	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
6952
+	public function countAllDepartureAirportCountriesByAirline($airline_icao, $filters = array())
6953 6953
 	{
6954
-		$filter_query = $this->getFilter($filters,true,true);
6955
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6956
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count, countries.iso3 AS departure_airport_country_iso3 
6954
+		$filter_query = $this->getFilter($filters, true, true);
6955
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6956
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count, countries.iso3 AS departure_airport_country_iso3 
6957 6957
 			FROM countries,spotter_output".$filter_query." countries.name = spotter_output.departure_airport_country AND spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
6958 6958
 			GROUP BY spotter_output.departure_airport_country, countries.iso3
6959 6959
 			ORDER BY airport_departure_country_count DESC";
@@ -6964,7 +6964,7 @@  discard block
 block discarded – undo
6964 6964
 		$airport_array = array();
6965 6965
 		$temp_array = array();
6966 6966
         
6967
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6967
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6968 6968
 		{
6969 6969
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6970 6970
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6982,11 +6982,11 @@  discard block
 block discarded – undo
6982 6982
 	* @return Array the airport list
6983 6983
 	*
6984 6984
 	*/
6985
-	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
6985
+	public function countAllDepartureAirportsByAircraft($aircraft_icao, $filters = array())
6986 6986
 	{
6987
-		$filter_query = $this->getFilter($filters,true,true);
6988
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6989
-		$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 
6987
+		$filter_query = $this->getFilter($filters, true, true);
6988
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6989
+		$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 
6990 6990
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao AND spotter_output.departure_airport_icao <> '' 
6991 6991
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6992 6992
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6998,7 +6998,7 @@  discard block
 block discarded – undo
6998 6998
 		$airport_array = array();
6999 6999
 		$temp_array = array();
7000 7000
         
7001
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7001
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7002 7002
 		{
7003 7003
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7004 7004
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7019,11 +7019,11 @@  discard block
 block discarded – undo
7019 7019
 	* @return Array the airport list
7020 7020
 	*
7021 7021
 	*/
7022
-	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
7022
+	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao, $filters = array())
7023 7023
 	{
7024
-		$filter_query = $this->getFilter($filters,true,true);
7025
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7026
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count, countries.iso3 AS departure_airport_country_iso3 
7024
+		$filter_query = $this->getFilter($filters, true, true);
7025
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7026
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count, countries.iso3 AS departure_airport_country_iso3 
7027 7027
 			FROM countries, spotter_output".$filter_query." countries.name = spotter_output.departure_airport_country AND spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
7028 7028
 			GROUP BY spotter_output.departure_airport_country, countries.iso3
7029 7029
 			ORDER BY airport_departure_country_count DESC";
@@ -7035,7 +7035,7 @@  discard block
 block discarded – undo
7035 7035
 		$airport_array = array();
7036 7036
 		$temp_array = array();
7037 7037
         
7038
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7038
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7039 7039
 		{
7040 7040
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7041 7041
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7053,11 +7053,11 @@  discard block
 block discarded – undo
7053 7053
 	* @return Array the airport list
7054 7054
 	*
7055 7055
 	*/
7056
-	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
7056
+	public function countAllDepartureAirportsByRegistration($registration, $filters = array())
7057 7057
 	{
7058
-		$filter_query = $this->getFilter($filters,true,true);
7059
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
7060
-		$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 
7058
+		$filter_query = $this->getFilter($filters, true, true);
7059
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7060
+		$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 
7061 7061
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.registration = :registration AND spotter_output.departure_airport_icao <> '' 
7062 7062
                     GROUP BY spotter_output.departure_airport_icao
7063 7063
 					ORDER BY airport_departure_icao_count DESC";
@@ -7069,7 +7069,7 @@  discard block
 block discarded – undo
7069 7069
 		$airport_array = array();
7070 7070
 		$temp_array = array();
7071 7071
         
7072
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7072
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7073 7073
 		{
7074 7074
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7075 7075
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7090,11 +7090,11 @@  discard block
 block discarded – undo
7090 7090
 	* @return Array the airport list
7091 7091
 	*
7092 7092
 	*/
7093
-	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
7093
+	public function countAllDepartureAirportCountriesByRegistration($registration, $filters = array())
7094 7094
 	{
7095
-		$filter_query = $this->getFilter($filters,true,true);
7096
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
7097
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7095
+		$filter_query = $this->getFilter($filters, true, true);
7096
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7097
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7098 7098
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration 
7099 7099
                     GROUP BY spotter_output.departure_airport_country
7100 7100
 					ORDER BY airport_departure_country_count DESC";
@@ -7106,7 +7106,7 @@  discard block
 block discarded – undo
7106 7106
 		$airport_array = array();
7107 7107
 		$temp_array = array();
7108 7108
         
7109
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7109
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7110 7110
 		{
7111 7111
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7112 7112
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7124,11 +7124,11 @@  discard block
 block discarded – undo
7124 7124
 	* @return Array the airport list
7125 7125
 	*
7126 7126
 	*/
7127
-	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
7127
+	public function countAllDepartureAirportsByAirport($airport_icao, $filters = array())
7128 7128
 	{
7129
-		$filter_query = $this->getFilter($filters,true,true);
7130
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7131
-		$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 
7129
+		$filter_query = $this->getFilter($filters, true, true);
7130
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7131
+		$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 
7132 7132
 			    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 AND spotter_output.departure_airport_icao <> '' 
7133 7133
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7134 7134
 			    ORDER BY airport_departure_icao_count DESC";
@@ -7140,7 +7140,7 @@  discard block
 block discarded – undo
7140 7140
 		$airport_array = array();
7141 7141
 		$temp_array = array();
7142 7142
         
7143
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7143
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7144 7144
 		{
7145 7145
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7146 7146
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7161,11 +7161,11 @@  discard block
 block discarded – undo
7161 7161
 	* @return Array the airport list
7162 7162
 	*
7163 7163
 	*/
7164
-	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
7164
+	public function countAllDepartureAirportCountriesByAirport($airport_icao, $filters = array())
7165 7165
 	{
7166
-		$filter_query = $this->getFilter($filters,true,true);
7167
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7168
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count, countries.iso3 AS departure_airport_country_iso3 
7166
+		$filter_query = $this->getFilter($filters, true, true);
7167
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7168
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count, countries.iso3 AS departure_airport_country_iso3 
7169 7169
 			FROM countries,spotter_output".$filter_query." countries.name = spotter_output.departure_airport_country AND spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao 
7170 7170
 			GROUP BY spotter_output.departure_airport_country, countries.iso3
7171 7171
 			ORDER BY airport_departure_country_count DESC";
@@ -7176,7 +7176,7 @@  discard block
 block discarded – undo
7176 7176
 		$airport_array = array();
7177 7177
 		$temp_array = array();
7178 7178
         
7179
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7179
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7180 7180
 		{
7181 7181
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7182 7182
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7194,11 +7194,11 @@  discard block
 block discarded – undo
7194 7194
 	* @return Array the airport list
7195 7195
 	*
7196 7196
 	*/
7197
-	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
7197
+	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer, $filters = array())
7198 7198
 	{
7199
-		$filter_query = $this->getFilter($filters,true,true);
7200
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7201
-		$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 
7199
+		$filter_query = $this->getFilter($filters, true, true);
7200
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7201
+		$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 
7202 7202
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer AND spotter_output.departure_airport_icao <> '' 
7203 7203
                     GROUP BY spotter_output.departure_airport_icao
7204 7204
 					ORDER BY airport_departure_icao_count DESC";
@@ -7210,7 +7210,7 @@  discard block
 block discarded – undo
7210 7210
 		$airport_array = array();
7211 7211
 		$temp_array = array();
7212 7212
         
7213
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7213
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7214 7214
 		{
7215 7215
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7216 7216
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7231,11 +7231,11 @@  discard block
 block discarded – undo
7231 7231
 	* @return Array the airport list
7232 7232
 	*
7233 7233
 	*/
7234
-	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
7234
+	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
7235 7235
 	{
7236
-		$filter_query = $this->getFilter($filters,true,true);
7237
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7238
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7236
+		$filter_query = $this->getFilter($filters, true, true);
7237
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7238
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7239 7239
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
7240 7240
                     GROUP BY spotter_output.departure_airport_country
7241 7241
 					ORDER BY airport_departure_country_count DESC";
@@ -7247,7 +7247,7 @@  discard block
 block discarded – undo
7247 7247
 		$airport_array = array();
7248 7248
 		$temp_array = array();
7249 7249
         
7250
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7250
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7251 7251
 		{
7252 7252
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7253 7253
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7265,11 +7265,11 @@  discard block
 block discarded – undo
7265 7265
 	* @return Array the airport list
7266 7266
 	*
7267 7267
 	*/
7268
-	public function countAllDepartureAirportsByDate($date,$filters = array())
7268
+	public function countAllDepartureAirportsByDate($date, $filters = array())
7269 7269
 	{
7270 7270
 		global $globalTimezone, $globalDBdriver;
7271
-		$filter_query = $this->getFilter($filters,true,true);
7272
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7271
+		$filter_query = $this->getFilter($filters, true, true);
7272
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7273 7273
 		if ($globalTimezone != '') {
7274 7274
 			date_default_timezone_set($globalTimezone);
7275 7275
 			$datetime = new DateTime($date);
@@ -7277,12 +7277,12 @@  discard block
 block discarded – undo
7277 7277
 		} else $offset = '+00:00';
7278 7278
 
7279 7279
 		if ($globalDBdriver == 'mysql') {
7280
-			$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 
7280
+			$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 
7281 7281
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
7282 7282
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7283 7283
 					ORDER BY airport_departure_icao_count DESC";
7284 7284
 		} else {
7285
-			$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 
7285
+			$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 
7286 7286
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
7287 7287
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7288 7288
 					ORDER BY airport_departure_icao_count DESC";
@@ -7294,7 +7294,7 @@  discard block
 block discarded – undo
7294 7294
 		$airport_array = array();
7295 7295
 		$temp_array = array();
7296 7296
         
7297
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7297
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7298 7298
 		{
7299 7299
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7300 7300
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7315,11 +7315,11 @@  discard block
 block discarded – undo
7315 7315
 	* @return Array the airport list
7316 7316
 	*
7317 7317
 	*/
7318
-	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
7318
+	public function countAllDepartureAirportCountriesByDate($date, $filters = array())
7319 7319
 	{
7320 7320
 		global $globalTimezone, $globalDBdriver;
7321
-		$filter_query = $this->getFilter($filters,true,true);
7322
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7321
+		$filter_query = $this->getFilter($filters, true, true);
7322
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7323 7323
 		if ($globalTimezone != '') {
7324 7324
 			date_default_timezone_set($globalTimezone);
7325 7325
 			$datetime = new DateTime($date);
@@ -7327,12 +7327,12 @@  discard block
 block discarded – undo
7327 7327
 		} else $offset = '+00:00';
7328 7328
 
7329 7329
 		if ($globalDBdriver == 'mysql') {
7330
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7330
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7331 7331
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
7332 7332
 					GROUP BY spotter_output.departure_airport_country
7333 7333
 					ORDER BY airport_departure_country_count DESC";
7334 7334
 		} else {
7335
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7335
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7336 7336
 					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 
7337 7337
 					GROUP BY spotter_output.departure_airport_country
7338 7338
 					ORDER BY airport_departure_country_count DESC";
@@ -7344,7 +7344,7 @@  discard block
 block discarded – undo
7344 7344
 		$airport_array = array();
7345 7345
 		$temp_array = array();
7346 7346
         
7347
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7347
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7348 7348
 		{
7349 7349
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7350 7350
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7362,11 +7362,11 @@  discard block
 block discarded – undo
7362 7362
 	* @return Array the airport list
7363 7363
 	*
7364 7364
 	*/
7365
-	public function countAllDepartureAirportsByIdent($ident,$filters = array())
7365
+	public function countAllDepartureAirportsByIdent($ident, $filters = array())
7366 7366
 	{
7367
-		$filter_query = $this->getFilter($filters,true,true);
7368
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7369
-		$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 
7367
+		$filter_query = $this->getFilter($filters, true, true);
7368
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7369
+		$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 
7370 7370
 		    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND spotter_output.ident = :ident 
7371 7371
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7372 7372
 		    ORDER BY airport_departure_icao_count DESC";
@@ -7378,7 +7378,7 @@  discard block
 block discarded – undo
7378 7378
 		$airport_array = array();
7379 7379
 		$temp_array = array();
7380 7380
         
7381
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7381
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7382 7382
 		{
7383 7383
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7384 7384
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7398,11 +7398,11 @@  discard block
 block discarded – undo
7398 7398
 	* @return Array the airport list
7399 7399
 	*
7400 7400
 	*/
7401
-	public function countAllDepartureAirportsByOwner($owner,$filters = array())
7401
+	public function countAllDepartureAirportsByOwner($owner, $filters = array())
7402 7402
 	{
7403
-		$filter_query = $this->getFilter($filters,true,true);
7404
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
7405
-		$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 
7403
+		$filter_query = $this->getFilter($filters, true, true);
7404
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
7405
+		$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 
7406 7406
 		    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND spotter_output.owner_name = :owner 
7407 7407
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7408 7408
 		    ORDER BY airport_departure_icao_count DESC";
@@ -7414,7 +7414,7 @@  discard block
 block discarded – undo
7414 7414
 		$airport_array = array();
7415 7415
 		$temp_array = array();
7416 7416
         
7417
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7417
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7418 7418
 		{
7419 7419
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7420 7420
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7434,11 +7434,11 @@  discard block
 block discarded – undo
7434 7434
 	* @return Array the airport list
7435 7435
 	*
7436 7436
 	*/
7437
-	public function countAllDepartureAirportsByPilot($pilot,$filters = array())
7437
+	public function countAllDepartureAirportsByPilot($pilot, $filters = array())
7438 7438
 	{
7439
-		$filter_query = $this->getFilter($filters,true,true);
7440
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
7441
-		$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 
7439
+		$filter_query = $this->getFilter($filters, true, true);
7440
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
7441
+		$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 
7442 7442
 		    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
7443 7443
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7444 7444
 		    ORDER BY airport_departure_icao_count DESC";
@@ -7449,7 +7449,7 @@  discard block
 block discarded – undo
7449 7449
 		$airport_array = array();
7450 7450
 		$temp_array = array();
7451 7451
         
7452
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7452
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7453 7453
 		{
7454 7454
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7455 7455
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7471,11 +7471,11 @@  discard block
 block discarded – undo
7471 7471
 	* @return Array the airport list
7472 7472
 	*
7473 7473
 	*/
7474
-	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
7474
+	public function countAllDepartureAirportCountriesByIdent($ident, $filters = array())
7475 7475
 	{
7476
-		$filter_query = $this->getFilter($filters,true,true);
7477
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7478
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7476
+		$filter_query = $this->getFilter($filters, true, true);
7477
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7478
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7479 7479
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident 
7480 7480
                     GROUP BY spotter_output.departure_airport_country
7481 7481
 					ORDER BY airport_departure_country_count DESC";
@@ -7487,7 +7487,7 @@  discard block
 block discarded – undo
7487 7487
 		$airport_array = array();
7488 7488
 		$temp_array = array();
7489 7489
         
7490
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7490
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7491 7491
 		{
7492 7492
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7493 7493
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7504,11 +7504,11 @@  discard block
 block discarded – undo
7504 7504
 	* @return Array the airport list
7505 7505
 	*
7506 7506
 	*/
7507
-	public function countAllDepartureAirportCountriesByOwner($owner,$filters = array())
7507
+	public function countAllDepartureAirportCountriesByOwner($owner, $filters = array())
7508 7508
 	{
7509
-		$filter_query = $this->getFilter($filters,true,true);
7510
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
7511
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7509
+		$filter_query = $this->getFilter($filters, true, true);
7510
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
7511
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7512 7512
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.owner_name = :owner 
7513 7513
 			GROUP BY spotter_output.departure_airport_country
7514 7514
 			ORDER BY airport_departure_country_count DESC";
@@ -7524,11 +7524,11 @@  discard block
 block discarded – undo
7524 7524
 	* @return Array the airport list
7525 7525
 	*
7526 7526
 	*/
7527
-	public function countAllDepartureAirportCountriesByPilot($pilot,$filters = array())
7527
+	public function countAllDepartureAirportCountriesByPilot($pilot, $filters = array())
7528 7528
 	{
7529
-		$filter_query = $this->getFilter($filters,true,true);
7530
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
7531
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7529
+		$filter_query = $this->getFilter($filters, true, true);
7530
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
7531
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7532 7532
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
7533 7533
 			GROUP BY spotter_output.departure_airport_country
7534 7534
 			ORDER BY airport_departure_country_count DESC";
@@ -7546,12 +7546,12 @@  discard block
 block discarded – undo
7546 7546
 	* @return Array the airport list
7547 7547
 	*
7548 7548
 	*/
7549
-	public function countAllDepartureAirportsByCountry($country,$filters = array())
7549
+	public function countAllDepartureAirportsByCountry($country, $filters = array())
7550 7550
 	{
7551
-		$filter_query = $this->getFilter($filters,true,true);
7552
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7551
+		$filter_query = $this->getFilter($filters, true, true);
7552
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7553 7553
 
7554
-		$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 
7554
+		$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 
7555 7555
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
7556 7556
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
7557 7557
 			    ORDER BY airport_departure_icao_count DESC";
@@ -7563,7 +7563,7 @@  discard block
 block discarded – undo
7563 7563
 		$airport_array = array();
7564 7564
 		$temp_array = array();
7565 7565
         
7566
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7566
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7567 7567
 		{
7568 7568
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
7569 7569
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -7584,11 +7584,11 @@  discard block
 block discarded – undo
7584 7584
 	* @return Array the airport list
7585 7585
 	*
7586 7586
 	*/
7587
-	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
7587
+	public function countAllDepartureAirportCountriesByCountry($country, $filters = array())
7588 7588
 	{
7589
-		$filter_query = $this->getFilter($filters,true,true);
7590
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7591
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7589
+		$filter_query = $this->getFilter($filters, true, true);
7590
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7591
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7592 7592
 			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 
7593 7593
                     GROUP BY spotter_output.departure_airport_country
7594 7594
 					ORDER BY airport_departure_country_count DESC";
@@ -7600,7 +7600,7 @@  discard block
 block discarded – undo
7600 7600
 		$airport_array = array();
7601 7601
 		$temp_array = array();
7602 7602
         
7603
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7603
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7604 7604
 		{
7605 7605
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
7606 7606
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -7623,11 +7623,11 @@  discard block
 block discarded – undo
7623 7623
 	* @return Array the airport list
7624 7624
 	*
7625 7625
 	*/
7626
-	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7626
+	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array(), $year = '', $month = '', $day = '')
7627 7627
 	{
7628 7628
 		global $globalDBdriver;
7629
-		$filter_query = $this->getFilter($filters,true,true);
7630
-		$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, airport.latitude as arrival_airport_latitude, airport.longitude as arrival_airport_longitude 
7629
+		$filter_query = $this->getFilter($filters, true, true);
7630
+		$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, airport.latitude as arrival_airport_latitude, airport.longitude as arrival_airport_longitude 
7631 7631
 				FROM airport, spotter_output".$filter_query." airport.icao = spotter_output.arrival_airport_icao AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
7632 7632
                 if ($olderthanmonths > 0) {
7633 7633
             		if ($globalDBdriver == 'mysql') {
@@ -7647,28 +7647,28 @@  discard block
 block discarded – undo
7647 7647
 		if ($year != '') {
7648 7648
 			if ($globalDBdriver == 'mysql') {
7649 7649
 				$query .= " AND YEAR(spotter_output.date) = :year";
7650
-				$query_values = array_merge($query_values,array(':year' => $year));
7650
+				$query_values = array_merge($query_values, array(':year' => $year));
7651 7651
 			} else {
7652 7652
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
7653
-				$query_values = array_merge($query_values,array(':year' => $year));
7653
+				$query_values = array_merge($query_values, array(':year' => $year));
7654 7654
 			}
7655 7655
 		}
7656 7656
 		if ($month != '') {
7657 7657
 			if ($globalDBdriver == 'mysql') {
7658 7658
 				$query .= " AND MONTH(spotter_output.date) = :month";
7659
-				$query_values = array_merge($query_values,array(':month' => $month));
7659
+				$query_values = array_merge($query_values, array(':month' => $month));
7660 7660
 			} else {
7661 7661
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
7662
-				$query_values = array_merge($query_values,array(':month' => $month));
7662
+				$query_values = array_merge($query_values, array(':month' => $month));
7663 7663
 			}
7664 7664
 		}
7665 7665
 		if ($day != '') {
7666 7666
 			if ($globalDBdriver == 'mysql') {
7667 7667
 				$query .= " AND DAY(spotter_output.date) = :day";
7668
-				$query_values = array_merge($query_values,array(':day' => $day));
7668
+				$query_values = array_merge($query_values, array(':day' => $day));
7669 7669
 			} else {
7670 7670
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
7671
-				$query_values = array_merge($query_values,array(':day' => $day));
7671
+				$query_values = array_merge($query_values, array(':day' => $day));
7672 7672
 			}
7673 7673
 		}
7674 7674
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, airport.latitude, airport.longitude
@@ -7682,7 +7682,7 @@  discard block
 block discarded – undo
7682 7682
 		$airport_array = array();
7683 7683
 		$temp_array = array();
7684 7684
         
7685
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7685
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7686 7686
 		{
7687 7687
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7688 7688
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7707,11 +7707,11 @@  discard block
 block discarded – undo
7707 7707
 	* @return Array the airport list
7708 7708
 	*
7709 7709
 	*/
7710
-	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
7710
+	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
7711 7711
 	{
7712 7712
 		global $globalDBdriver;
7713
-		$filter_query = $this->getFilter($filters,true,true);
7714
-		$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, country.iso3 AS arrival_airport_country_iso3 
7713
+		$filter_query = $this->getFilter($filters, true, true);
7714
+		$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, country.iso3 AS arrival_airport_country_iso3 
7715 7715
 			FROM countries,spotter_output".$filter_query." countries.name = spotter_output.arrival_airport_country AND spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' ";
7716 7716
                 if ($olderthanmonths > 0) {
7717 7717
             		if ($globalDBdriver == 'mysql') {
@@ -7741,7 +7741,7 @@  discard block
 block discarded – undo
7741 7741
 		$airport_array = array();
7742 7742
 		$temp_array = array();
7743 7743
         
7744
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7744
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7745 7745
 		{
7746 7746
 			$temp_array['airline_icao'] = $row['airline_icao'];
7747 7747
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
@@ -7767,11 +7767,11 @@  discard block
 block discarded – undo
7767 7767
 	* @return Array the airport list
7768 7768
 	*
7769 7769
 	*/
7770
-	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '')
7770
+	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array(), $year = '', $month = '', $day = '')
7771 7771
 	{
7772 7772
 		global $globalDBdriver;
7773
-		$filter_query = $this->getFilter($filters,true,true);
7774
-		$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, airport.latitude AS arrival_airport_latitude, airport.longitude AS arrival_airport_longitude 
7773
+		$filter_query = $this->getFilter($filters, true, true);
7774
+		$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, airport.latitude AS arrival_airport_latitude, airport.longitude AS arrival_airport_longitude 
7775 7775
 			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";
7776 7776
                 if ($olderthanmonths > 0) {
7777 7777
             		if ($globalDBdriver == 'mysql') {
@@ -7791,28 +7791,28 @@  discard block
 block discarded – undo
7791 7791
 		if ($year != '') {
7792 7792
 			if ($globalDBdriver == 'mysql') {
7793 7793
 				$query .= " AND YEAR(spotter_output.date) = :year";
7794
-				$query_values = array_merge($query_values,array(':year' => $year));
7794
+				$query_values = array_merge($query_values, array(':year' => $year));
7795 7795
 			} else {
7796 7796
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
7797
-				$query_values = array_merge($query_values,array(':year' => $year));
7797
+				$query_values = array_merge($query_values, array(':year' => $year));
7798 7798
 			}
7799 7799
 		}
7800 7800
 		if ($month != '') {
7801 7801
 			if ($globalDBdriver == 'mysql') {
7802 7802
 				$query .= " AND MONTH(spotter_output.date) = :month";
7803
-				$query_values = array_merge($query_values,array(':month' => $month));
7803
+				$query_values = array_merge($query_values, array(':month' => $month));
7804 7804
 			} else {
7805 7805
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
7806
-				$query_values = array_merge($query_values,array(':month' => $month));
7806
+				$query_values = array_merge($query_values, array(':month' => $month));
7807 7807
 			}
7808 7808
 		}
7809 7809
 		if ($day != '') {
7810 7810
 			if ($globalDBdriver == 'mysql') {
7811 7811
 				$query .= " AND DAY(spotter_output.date) = :day";
7812
-				$query_values = array_merge($query_values,array(':day' => $day));
7812
+				$query_values = array_merge($query_values, array(':day' => $day));
7813 7813
 			} else {
7814 7814
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
7815
-				$query_values = array_merge($query_values,array(':day' => $day));
7815
+				$query_values = array_merge($query_values, array(':day' => $day));
7816 7816
 			}
7817 7817
 		}
7818 7818
 		$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country, airport.latitude, airport.longitude
@@ -7825,7 +7825,7 @@  discard block
 block discarded – undo
7825 7825
       
7826 7826
 		$airport_array = array();
7827 7827
 		$temp_array = array();
7828
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7828
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7829 7829
 		{
7830 7830
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7831 7831
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7848,11 +7848,11 @@  discard block
 block discarded – undo
7848 7848
 	* @return Array the airport list
7849 7849
 	*
7850 7850
 	*/
7851
-	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
7851
+	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
7852 7852
 	{
7853 7853
 		global $globalDBdriver;
7854
-		$filter_query = $this->getFilter($filters,true,true);
7855
-		$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 
7854
+		$filter_query = $this->getFilter($filters, true, true);
7855
+		$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 
7856 7856
 			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 ";
7857 7857
                 if ($olderthanmonths > 0) {
7858 7858
             		if ($globalDBdriver == 'mysql') {
@@ -7882,7 +7882,7 @@  discard block
 block discarded – undo
7882 7882
 		$airport_array = array();
7883 7883
 		$temp_array = array();
7884 7884
         
7885
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7885
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7886 7886
 		{
7887 7887
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7888 7888
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7908,9 +7908,9 @@  discard block
 block discarded – undo
7908 7908
 	*/
7909 7909
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
7910 7910
 	{
7911
-		$filter_query = $this->getFilter($filters,true,true);
7912
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7913
-		$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 
7911
+		$filter_query = $this->getFilter($filters, true, true);
7912
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7913
+		$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 
7914 7914
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.airline_icao = :airline_icao 
7915 7915
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7916 7916
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7921,7 +7921,7 @@  discard block
 block discarded – undo
7921 7921
 		$airport_array = array();
7922 7922
 		$temp_array = array();
7923 7923
         
7924
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7924
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7925 7925
 		{
7926 7926
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7927 7927
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7942,12 +7942,12 @@  discard block
 block discarded – undo
7942 7942
 	* @return Array the airport list
7943 7943
 	*
7944 7944
 	*/
7945
-	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
7945
+	public function countAllArrivalAirportCountriesByAirline($airline_icao, $filters = array())
7946 7946
 	{
7947
-		$filter_query = $this->getFilter($filters,true,true);
7948
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7947
+		$filter_query = $this->getFilter($filters, true, true);
7948
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7949 7949
 		
7950
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count, countries.iso3 AS arrival_airport_country_iso3 
7950
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count, countries.iso3 AS arrival_airport_country_iso3 
7951 7951
 			FROM countries, spotter_output".$filter_query." countries.name = spotter_output.arrival_airport_country AND spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
7952 7952
 			GROUP BY spotter_output.arrival_airport_country, countries.iso3
7953 7953
 			ORDER BY airport_arrival_country_count DESC";
@@ -7959,7 +7959,7 @@  discard block
 block discarded – undo
7959 7959
 		$airport_array = array();
7960 7960
 		$temp_array = array();
7961 7961
         
7962
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7962
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7963 7963
 		{
7964 7964
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7965 7965
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7976,11 +7976,11 @@  discard block
 block discarded – undo
7976 7976
 	* @return Array the airport list
7977 7977
 	*
7978 7978
 	*/
7979
-	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
7979
+	public function countAllArrivalAirportsByAircraft($aircraft_icao, $filters = array())
7980 7980
 	{
7981
-		$filter_query = $this->getFilter($filters,true,true);
7982
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7983
-		$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 
7981
+		$filter_query = $this->getFilter($filters, true, true);
7982
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7983
+		$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 
7984 7984
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
7985 7985
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7986 7986
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7992,7 +7992,7 @@  discard block
 block discarded – undo
7992 7992
 		$airport_array = array();
7993 7993
 		$temp_array = array();
7994 7994
         
7995
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7995
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7996 7996
 		{
7997 7997
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7998 7998
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8014,11 +8014,11 @@  discard block
 block discarded – undo
8014 8014
 	* @return Array the airport list
8015 8015
 	*
8016 8016
 	*/
8017
-	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
8017
+	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao, $filters = array())
8018 8018
 	{
8019
-		$filter_query = $this->getFilter($filters,true,true);
8020
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
8021
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 
8019
+		$filter_query = $this->getFilter($filters, true, true);
8020
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
8021
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 
8022 8022
 			    FROM countries, spotter_output".$filter_query." countries.name = spotter_output.arrival_airport_country AND spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
8023 8023
 			    GROUP BY spotter_output.arrival_airport_country, countries.iso3
8024 8024
 			    ORDER BY airport_arrival_country_count DESC";
@@ -8030,7 +8030,7 @@  discard block
 block discarded – undo
8030 8030
 		$airport_array = array();
8031 8031
 		$temp_array = array();
8032 8032
         
8033
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8033
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8034 8034
 		{
8035 8035
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8036 8036
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8048,12 +8048,12 @@  discard block
 block discarded – undo
8048 8048
 	* @return Array the airport list
8049 8049
 	*
8050 8050
 	*/
8051
-	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
8051
+	public function countAllArrivalAirportsByRegistration($registration, $filters = array())
8052 8052
 	{
8053
-		$filter_query = $this->getFilter($filters,true,true);
8054
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
8053
+		$filter_query = $this->getFilter($filters, true, true);
8054
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8055 8055
 
8056
-		$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 
8056
+		$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 
8057 8057
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.registration = :registration 
8058 8058
                     GROUP BY spotter_output.arrival_airport_icao
8059 8059
 					ORDER BY airport_arrival_icao_count DESC";
@@ -8065,7 +8065,7 @@  discard block
 block discarded – undo
8065 8065
 		$airport_array = array();
8066 8066
 		$temp_array = array();
8067 8067
         
8068
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8068
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8069 8069
 		{
8070 8070
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8071 8071
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8086,11 +8086,11 @@  discard block
 block discarded – undo
8086 8086
 	* @return Array the airport list
8087 8087
 	*
8088 8088
 	*/
8089
-	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
8089
+	public function countAllArrivalAirportCountriesByRegistration($registration, $filters = array())
8090 8090
 	{
8091
-		$filter_query = $this->getFilter($filters,true,true);
8092
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
8093
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8091
+		$filter_query = $this->getFilter($filters, true, true);
8092
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8093
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8094 8094
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration 
8095 8095
                     GROUP BY spotter_output.arrival_airport_country
8096 8096
 					ORDER BY airport_arrival_country_count DESC";
@@ -8102,7 +8102,7 @@  discard block
 block discarded – undo
8102 8102
 		$airport_array = array();
8103 8103
 		$temp_array = array();
8104 8104
         
8105
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8105
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8106 8106
 		{
8107 8107
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8108 8108
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8121,11 +8121,11 @@  discard block
 block discarded – undo
8121 8121
 	* @return Array the airport list
8122 8122
 	*
8123 8123
 	*/
8124
-	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
8124
+	public function countAllArrivalAirportsByAirport($airport_icao, $filters = array())
8125 8125
 	{
8126
-		$filter_query = $this->getFilter($filters,true,true);
8127
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8128
-		$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 
8126
+		$filter_query = $this->getFilter($filters, true, true);
8127
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8128
+		$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 
8129 8129
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.departure_airport_icao = :airport_icao 
8130 8130
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8131 8131
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -8137,7 +8137,7 @@  discard block
 block discarded – undo
8137 8137
 		$airport_array = array();
8138 8138
 		$temp_array = array();
8139 8139
         
8140
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8140
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8141 8141
 		{
8142 8142
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8143 8143
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8158,11 +8158,11 @@  discard block
 block discarded – undo
8158 8158
 	* @return Array the airport list
8159 8159
 	*
8160 8160
 	*/
8161
-	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
8161
+	public function countAllArrivalAirportCountriesByAirport($airport_icao, $filters = array())
8162 8162
 	{
8163
-		$filter_query = $this->getFilter($filters,true,true);
8164
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8165
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count, countries.iso3 AS arrival_airport_country_iso3 
8163
+		$filter_query = $this->getFilter($filters, true, true);
8164
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8165
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count, countries.iso3 AS arrival_airport_country_iso3 
8166 8166
 			FROM countries, spotter_output".$filter_query." countries.name = spotter_output.arrival_airport_country AND spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao 
8167 8167
 			GROUP BY spotter_output.arrival_airport_country, countries.iso3
8168 8168
 			ORDER BY airport_arrival_country_count DESC";
@@ -8173,7 +8173,7 @@  discard block
 block discarded – undo
8173 8173
 		$airport_array = array();
8174 8174
 		$temp_array = array();
8175 8175
         
8176
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8176
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8177 8177
 		{
8178 8178
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8179 8179
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8190,11 +8190,11 @@  discard block
 block discarded – undo
8190 8190
 	* @return Array the airport list
8191 8191
 	*
8192 8192
 	*/
8193
-	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
8193
+	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer, $filters = array())
8194 8194
 	{
8195
-		$filter_query = $this->getFilter($filters,true,true);
8196
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
8197
-		$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 
8195
+		$filter_query = $this->getFilter($filters, true, true);
8196
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
8197
+		$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 
8198 8198
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
8199 8199
                     GROUP BY spotter_output.arrival_airport_icao
8200 8200
 					ORDER BY airport_arrival_icao_count DESC";
@@ -8206,7 +8206,7 @@  discard block
 block discarded – undo
8206 8206
 		$airport_array = array();
8207 8207
 		$temp_array = array();
8208 8208
         
8209
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8209
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8210 8210
 		{
8211 8211
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8212 8212
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8228,11 +8228,11 @@  discard block
 block discarded – undo
8228 8228
 	* @return Array the airport list
8229 8229
 	*
8230 8230
 	*/
8231
-	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
8231
+	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
8232 8232
 	{
8233
-		$filter_query = $this->getFilter($filters,true,true);
8234
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
8235
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8233
+		$filter_query = $this->getFilter($filters, true, true);
8234
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
8235
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8236 8236
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
8237 8237
                     GROUP BY spotter_output.arrival_airport_country
8238 8238
 					ORDER BY airport_arrival_country_count DESC";
@@ -8244,7 +8244,7 @@  discard block
 block discarded – undo
8244 8244
 		$airport_array = array();
8245 8245
 		$temp_array = array();
8246 8246
         
8247
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8247
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8248 8248
 		{
8249 8249
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8250 8250
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8263,11 +8263,11 @@  discard block
 block discarded – undo
8263 8263
 	* @return Array the airport list
8264 8264
 	*
8265 8265
 	*/
8266
-	public function countAllArrivalAirportsByDate($date,$filters = array())
8266
+	public function countAllArrivalAirportsByDate($date, $filters = array())
8267 8267
 	{
8268 8268
 		global $globalTimezone, $globalDBdriver;
8269
-		$filter_query = $this->getFilter($filters,true,true);
8270
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
8269
+		$filter_query = $this->getFilter($filters, true, true);
8270
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
8271 8271
 		if ($globalTimezone != '') {
8272 8272
 			date_default_timezone_set($globalTimezone);
8273 8273
 			$datetime = new DateTime($date);
@@ -8275,12 +8275,12 @@  discard block
 block discarded – undo
8275 8275
 		} else $offset = '+00:00';
8276 8276
 
8277 8277
 		if ($globalDBdriver == 'mysql') {
8278
-			$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 
8278
+			$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 
8279 8279
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
8280 8280
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8281 8281
 					ORDER BY airport_arrival_icao_count DESC";
8282 8282
 		} else {
8283
-			$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 
8283
+			$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 
8284 8284
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
8285 8285
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8286 8286
 					ORDER BY airport_arrival_icao_count DESC";
@@ -8292,7 +8292,7 @@  discard block
 block discarded – undo
8292 8292
 		$airport_array = array();
8293 8293
 		$temp_array = array();
8294 8294
         
8295
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8295
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8296 8296
 		{
8297 8297
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8298 8298
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8316,8 +8316,8 @@  discard block
 block discarded – undo
8316 8316
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
8317 8317
 	{
8318 8318
 		global $globalTimezone, $globalDBdriver;
8319
-		$filter_query = $this->getFilter($filters,true,true);
8320
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
8319
+		$filter_query = $this->getFilter($filters, true, true);
8320
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
8321 8321
 		if ($globalTimezone != '') {
8322 8322
 			date_default_timezone_set($globalTimezone);
8323 8323
 			$datetime = new DateTime($date);
@@ -8325,12 +8325,12 @@  discard block
 block discarded – undo
8325 8325
 		} else $offset = '+00:00';
8326 8326
 
8327 8327
 		if ($globalDBdriver == 'mysql') {
8328
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8328
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8329 8329
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
8330 8330
 					GROUP BY spotter_output.arrival_airport_country
8331 8331
 					ORDER BY airport_arrival_country_count DESC";
8332 8332
 		} else {
8333
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8333
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8334 8334
 					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 
8335 8335
 					GROUP BY spotter_output.arrival_airport_country
8336 8336
 					ORDER BY airport_arrival_country_count DESC";
@@ -8342,7 +8342,7 @@  discard block
 block discarded – undo
8342 8342
 		$airport_array = array();
8343 8343
 		$temp_array = array();
8344 8344
         
8345
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8345
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8346 8346
 		{
8347 8347
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8348 8348
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8360,11 +8360,11 @@  discard block
 block discarded – undo
8360 8360
 	* @return Array the airport list
8361 8361
 	*
8362 8362
 	*/
8363
-	public function countAllArrivalAirportsByIdent($ident,$filters = array())
8363
+	public function countAllArrivalAirportsByIdent($ident, $filters = array())
8364 8364
 	{
8365
-		$filter_query = $this->getFilter($filters,true,true);
8366
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
8367
-		$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 
8365
+		$filter_query = $this->getFilter($filters, true, true);
8366
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
8367
+		$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 
8368 8368
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.ident = :ident  
8369 8369
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8370 8370
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -8376,7 +8376,7 @@  discard block
 block discarded – undo
8376 8376
 		$airport_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['airport_arrival_icao'] = $row['arrival_airport_icao'];
8382 8382
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8396,11 +8396,11 @@  discard block
 block discarded – undo
8396 8396
 	* @return Array the airport list
8397 8397
 	*
8398 8398
 	*/
8399
-	public function countAllArrivalAirportsByOwner($owner,$filters = array())
8399
+	public function countAllArrivalAirportsByOwner($owner, $filters = array())
8400 8400
 	{
8401
-		$filter_query = $this->getFilter($filters,true,true);
8402
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
8403
-		$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 
8401
+		$filter_query = $this->getFilter($filters, true, true);
8402
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
8403
+		$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 
8404 8404
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.owner_name = :owner 
8405 8405
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8406 8406
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -8411,7 +8411,7 @@  discard block
 block discarded – undo
8411 8411
 		$airport_array = array();
8412 8412
 		$temp_array = array();
8413 8413
         
8414
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8414
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8415 8415
 		{
8416 8416
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8417 8417
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8431,11 +8431,11 @@  discard block
 block discarded – undo
8431 8431
 	* @return Array the airport list
8432 8432
 	*
8433 8433
 	*/
8434
-	public function countAllArrivalAirportsByPilot($pilot,$filters = array())
8434
+	public function countAllArrivalAirportsByPilot($pilot, $filters = array())
8435 8435
 	{
8436
-		$filter_query = $this->getFilter($filters,true,true);
8437
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
8438
-		$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 
8436
+		$filter_query = $this->getFilter($filters, true, true);
8437
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
8438
+		$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 
8439 8439
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
8440 8440
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
8441 8441
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -8446,7 +8446,7 @@  discard block
 block discarded – undo
8446 8446
 		$airport_array = array();
8447 8447
 		$temp_array = array();
8448 8448
         
8449
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8449
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8450 8450
 		{
8451 8451
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8452 8452
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8468,9 +8468,9 @@  discard block
 block discarded – undo
8468 8468
 	*/
8469 8469
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
8470 8470
 	{
8471
-		$filter_query = $this->getFilter($filters,true,true);
8472
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
8473
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8471
+		$filter_query = $this->getFilter($filters, true, true);
8472
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
8473
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8474 8474
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident 
8475 8475
                     GROUP BY spotter_output.arrival_airport_country
8476 8476
 					ORDER BY airport_arrival_country_count DESC";
@@ -8482,7 +8482,7 @@  discard block
 block discarded – undo
8482 8482
 		$airport_array = array();
8483 8483
 		$temp_array = array();
8484 8484
         
8485
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8485
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8486 8486
 		{
8487 8487
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8488 8488
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8501,9 +8501,9 @@  discard block
 block discarded – undo
8501 8501
 	*/
8502 8502
 	public function countAllArrivalAirportCountriesByOwner($owner, $filters = array())
8503 8503
 	{
8504
-		$filter_query = $this->getFilter($filters,true,true);
8505
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
8506
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8504
+		$filter_query = $this->getFilter($filters, true, true);
8505
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
8506
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8507 8507
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.owner_name = :owner 
8508 8508
                     GROUP BY spotter_output.arrival_airport_country
8509 8509
 		    ORDER BY airport_arrival_country_count DESC";
@@ -8521,9 +8521,9 @@  discard block
 block discarded – undo
8521 8521
 	*/
8522 8522
 	public function countAllArrivalAirportCountriesByPilot($pilot, $filters = array())
8523 8523
 	{
8524
-		$filter_query = $this->getFilter($filters,true,true);
8525
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
8526
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8524
+		$filter_query = $this->getFilter($filters, true, true);
8525
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
8526
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8527 8527
 		    FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
8528 8528
                     GROUP BY spotter_output.arrival_airport_country
8529 8529
 		    ORDER BY airport_arrival_country_count DESC";
@@ -8541,11 +8541,11 @@  discard block
 block discarded – undo
8541 8541
 	* @return Array the airport list
8542 8542
 	*
8543 8543
 	*/
8544
-	public function countAllArrivalAirportsByCountry($country,$filters = array())
8544
+	public function countAllArrivalAirportsByCountry($country, $filters = array())
8545 8545
 	{
8546
-		$filter_query = $this->getFilter($filters,true,true);
8547
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
8548
-		$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 
8546
+		$filter_query = $this->getFilter($filters, true, true);
8547
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
8548
+		$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 
8549 8549
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
8550 8550
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
8551 8551
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -8557,7 +8557,7 @@  discard block
 block discarded – undo
8557 8557
 		$airport_array = array();
8558 8558
 		$temp_array = array();
8559 8559
         
8560
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8560
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8561 8561
 		{
8562 8562
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
8563 8563
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -8578,12 +8578,12 @@  discard block
 block discarded – undo
8578 8578
 	* @return Array the airport list
8579 8579
 	*
8580 8580
 	*/
8581
-	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
8581
+	public function countAllArrivalAirportCountriesByCountry($country, $filters = array())
8582 8582
 	{
8583 8583
 		global $globalDBdriver;
8584
-		$filter_query = $this->getFilter($filters,true,true);
8585
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
8586
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8584
+		$filter_query = $this->getFilter($filters, true, true);
8585
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
8586
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
8587 8587
 			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 
8588 8588
                     GROUP BY spotter_output.arrival_airport_country
8589 8589
 					ORDER BY airport_arrival_country_count DESC";
@@ -8595,7 +8595,7 @@  discard block
 block discarded – undo
8595 8595
 		$airport_array = array();
8596 8596
 		$temp_array = array();
8597 8597
         
8598
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8598
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8599 8599
 		{
8600 8600
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
8601 8601
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -8614,38 +8614,38 @@  discard block
 block discarded – undo
8614 8614
 	* @return Array the airport departure list
8615 8615
 	*
8616 8616
 	*/
8617
-	public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '')
8617
+	public function countAllDepartureCountries($filters = array(), $year = '', $month = '', $day = '')
8618 8618
 	{
8619 8619
 		global $globalDBdriver;
8620
-		$filter_query = $this->getFilter($filters,true,true);
8621
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count, countries.iso3 AS airport_departure_country_iso3 
8620
+		$filter_query = $this->getFilter($filters, true, true);
8621
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count, countries.iso3 AS airport_departure_country_iso3 
8622 8622
 				FROM countries,spotter_output".$filter_query." countries.name = spotter_output.departure_airport_country AND spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''";
8623 8623
 		$query_values = array();
8624 8624
 		if ($year != '') {
8625 8625
 			if ($globalDBdriver == 'mysql') {
8626 8626
 				$query .= " AND YEAR(spotter_output.date) = :year";
8627
-				$query_values = array_merge($query_values,array(':year' => $year));
8627
+				$query_values = array_merge($query_values, array(':year' => $year));
8628 8628
 			} else {
8629 8629
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
8630
-				$query_values = array_merge($query_values,array(':year' => $year));
8630
+				$query_values = array_merge($query_values, array(':year' => $year));
8631 8631
 			}
8632 8632
 		}
8633 8633
 		if ($month != '') {
8634 8634
 			if ($globalDBdriver == 'mysql') {
8635 8635
 				$query .= " AND MONTH(spotter_output.date) = :month";
8636
-				$query_values = array_merge($query_values,array(':month' => $month));
8636
+				$query_values = array_merge($query_values, array(':month' => $month));
8637 8637
 			} else {
8638 8638
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
8639
-				$query_values = array_merge($query_values,array(':month' => $month));
8639
+				$query_values = array_merge($query_values, array(':month' => $month));
8640 8640
 			}
8641 8641
 		}
8642 8642
 		if ($day != '') {
8643 8643
 			if ($globalDBdriver == 'mysql') {
8644 8644
 				$query .= " AND DAY(spotter_output.date) = :day";
8645
-				$query_values = array_merge($query_values,array(':day' => $day));
8645
+				$query_values = array_merge($query_values, array(':day' => $day));
8646 8646
 			} else {
8647 8647
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
8648
-				$query_values = array_merge($query_values,array(':day' => $day));
8648
+				$query_values = array_merge($query_values, array(':day' => $day));
8649 8649
 			}
8650 8650
 		}
8651 8651
 		$query .= " GROUP BY spotter_output.departure_airport_country, countries.iso3
@@ -8659,7 +8659,7 @@  discard block
 block discarded – undo
8659 8659
 		$airport_array = array();
8660 8660
 		$temp_array = array();
8661 8661
         
8662
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8662
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8663 8663
 		{
8664 8664
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
8665 8665
 			$temp_array['airport_departure_country'] = $row['departure_airport_country'];
@@ -8677,38 +8677,38 @@  discard block
 block discarded – undo
8677 8677
 	* @return Array the airport arrival list
8678 8678
 	*
8679 8679
 	*/
8680
-	public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '')
8680
+	public function countAllArrivalCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '')
8681 8681
 	{
8682 8682
 		global $globalDBdriver;
8683
-		$filter_query = $this->getFilter($filters,true,true);
8684
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 
8683
+		$filter_query = $this->getFilter($filters, true, true);
8684
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 
8685 8685
 			FROM countries, spotter_output".$filter_query." countries.name = spotter_output.arrival_airport_country AND spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''";
8686 8686
 		$query_values = array();
8687 8687
 		if ($year != '') {
8688 8688
 			if ($globalDBdriver == 'mysql') {
8689 8689
 				$query .= " AND YEAR(spotter_output.date) = :year";
8690
-				$query_values = array_merge($query_values,array(':year' => $year));
8690
+				$query_values = array_merge($query_values, array(':year' => $year));
8691 8691
 			} else {
8692 8692
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
8693
-				$query_values = array_merge($query_values,array(':year' => $year));
8693
+				$query_values = array_merge($query_values, array(':year' => $year));
8694 8694
 			}
8695 8695
 		}
8696 8696
 		if ($month != '') {
8697 8697
 			if ($globalDBdriver == 'mysql') {
8698 8698
 				$query .= " AND MONTH(spotter_output.date) = :month";
8699
-				$query_values = array_merge($query_values,array(':month' => $month));
8699
+				$query_values = array_merge($query_values, array(':month' => $month));
8700 8700
 			} else {
8701 8701
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
8702
-				$query_values = array_merge($query_values,array(':month' => $month));
8702
+				$query_values = array_merge($query_values, array(':month' => $month));
8703 8703
 			}
8704 8704
 		}
8705 8705
 		if ($day != '') {
8706 8706
 			if ($globalDBdriver == 'mysql') {
8707 8707
 				$query .= " AND DAY(spotter_output.date) = :day";
8708
-				$query_values = array_merge($query_values,array(':day' => $day));
8708
+				$query_values = array_merge($query_values, array(':day' => $day));
8709 8709
 			} else {
8710 8710
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
8711
-				$query_values = array_merge($query_values,array(':day' => $day));
8711
+				$query_values = array_merge($query_values, array(':day' => $day));
8712 8712
 			}
8713 8713
 		}
8714 8714
 		$query .= " GROUP BY spotter_output.arrival_airport_country, countries.iso3
@@ -8722,7 +8722,7 @@  discard block
 block discarded – undo
8722 8722
 		$airport_array = array();
8723 8723
 		$temp_array = array();
8724 8724
         
8725
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8725
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8726 8726
 		{
8727 8727
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
8728 8728
 			$temp_array['airport_arrival_country'] = $row['arrival_airport_country'];
@@ -8746,8 +8746,8 @@  discard block
 block discarded – undo
8746 8746
 	*/
8747 8747
 	public function countAllRoutes($filters = array())
8748 8748
 	{
8749
-		$filter_query = $this->getFilter($filters,true,true);
8750
-		$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
8749
+		$filter_query = $this->getFilter($filters, true, true);
8750
+		$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
8751 8751
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''
8752 8752
                     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
8753 8753
                     ORDER BY route_count DESC
@@ -8760,7 +8760,7 @@  discard block
 block discarded – undo
8760 8760
 		$routes_array = array();
8761 8761
 		$temp_array = array();
8762 8762
         
8763
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8763
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8764 8764
 		{
8765 8765
 			$temp_array['route_count'] = $row['route_count'];
8766 8766
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8787,11 +8787,11 @@  discard block
 block discarded – undo
8787 8787
 	* @return Array the route list
8788 8788
 	*
8789 8789
 	*/
8790
-	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
8790
+	public function countAllRoutesByAircraft($aircraft_icao, $filters = array())
8791 8791
 	{
8792
-		$filter_query = $this->getFilter($filters,true,true);
8793
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
8794
-		$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
8792
+		$filter_query = $this->getFilter($filters, true, true);
8793
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
8794
+		$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
8795 8795
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
8796 8796
 			    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 
8797 8797
 			    ORDER BY route_count DESC";
@@ -8802,7 +8802,7 @@  discard block
 block discarded – undo
8802 8802
 		$routes_array = array();
8803 8803
 		$temp_array = array();
8804 8804
         
8805
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8805
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8806 8806
 		{
8807 8807
 			$temp_array['route_count'] = $row['route_count'];
8808 8808
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8829,9 +8829,9 @@  discard block
 block discarded – undo
8829 8829
 	*/
8830 8830
 	public function countAllRoutesByRegistration($registration, $filters = array())
8831 8831
 	{
8832
-		$filter_query = $this->getFilter($filters,true,true);
8832
+		$filter_query = $this->getFilter($filters, true, true);
8833 8833
 		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8834
-		$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
8834
+		$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
8835 8835
 			FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.registration = :registration 
8836 8836
                     GROUP BY route
8837 8837
                     ORDER BY route_count DESC";
@@ -8843,7 +8843,7 @@  discard block
 block discarded – undo
8843 8843
 		$routes_array = array();
8844 8844
 		$temp_array = array();
8845 8845
         
8846
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8846
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8847 8847
 		{
8848 8848
 			$temp_array['route_count'] = $row['route_count'];
8849 8849
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8871,9 +8871,9 @@  discard block
 block discarded – undo
8871 8871
 	*/
8872 8872
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
8873 8873
 	{
8874
-		$filter_query = $this->getFilter($filters,true,true);
8875
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8876
-		$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
8874
+		$filter_query = $this->getFilter($filters, true, true);
8875
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
8876
+		$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
8877 8877
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao 
8878 8878
 			    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 
8879 8879
 			    ORDER BY route_count DESC";
@@ -8885,7 +8885,7 @@  discard block
 block discarded – undo
8885 8885
 		$routes_array = array();
8886 8886
 		$temp_array = array();
8887 8887
         
8888
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8888
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8889 8889
 		{
8890 8890
 			$temp_array['route_count'] = $row['route_count'];
8891 8891
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8913,9 +8913,9 @@  discard block
 block discarded – undo
8913 8913
 	*/
8914 8914
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
8915 8915
 	{
8916
-		$filter_query = $this->getFilter($filters,true,true);
8917
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8918
-		$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
8916
+		$filter_query = $this->getFilter($filters, true, true);
8917
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8918
+		$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
8919 8919
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
8920 8920
 			    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 
8921 8921
 			    ORDER BY route_count DESC";
@@ -8926,7 +8926,7 @@  discard block
 block discarded – undo
8926 8926
 		$routes_array = array();
8927 8927
 		$temp_array = array();
8928 8928
         
8929
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8929
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8930 8930
 		{
8931 8931
 			$temp_array['route_count'] = $row['route_count'];
8932 8932
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8954,9 +8954,9 @@  discard block
 block discarded – undo
8954 8954
 	*/
8955 8955
 	public function countAllRoutesByCountry($country, $filters = array())
8956 8956
 	{
8957
-		$filter_query = $this->getFilter($filters,true,true);
8958
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
8959
-		$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
8957
+		$filter_query = $this->getFilter($filters, true, true);
8958
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
8959
+		$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
8960 8960
 			    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 
8961 8961
 			    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 
8962 8962
 			    ORDER BY route_count DESC";
@@ -8967,7 +8967,7 @@  discard block
 block discarded – undo
8967 8967
 		$routes_array = array();
8968 8968
 		$temp_array = array();
8969 8969
         
8970
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8970
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8971 8971
 		{
8972 8972
 			$temp_array['route_count'] = $row['route_count'];
8973 8973
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -8995,8 +8995,8 @@  discard block
 block discarded – undo
8995 8995
 	public function countAllRoutesByDate($date, $filters = array())
8996 8996
 	{
8997 8997
 		global $globalTimezone, $globalDBdriver;
8998
-		$filter_query = $this->getFilter($filters,true,true);
8999
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
8998
+		$filter_query = $this->getFilter($filters, true, true);
8999
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
9000 9000
 		if ($globalTimezone != '') {
9001 9001
 			date_default_timezone_set($globalTimezone);
9002 9002
 			$datetime = new DateTime($date);
@@ -9004,12 +9004,12 @@  discard block
 block discarded – undo
9004 9004
 		} else $offset = '+00:00';
9005 9005
 		
9006 9006
 		if ($globalDBdriver == 'mysql') {
9007
-			$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
9007
+			$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
9008 9008
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
9009 9009
 				    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
9010 9010
 				    ORDER BY route_count DESC";
9011 9011
 		} else {
9012
-			$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
9012
+			$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
9013 9013
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
9014 9014
 				    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
9015 9015
 				    ORDER BY route_count DESC";
@@ -9021,7 +9021,7 @@  discard block
 block discarded – undo
9021 9021
 		$routes_array = array();
9022 9022
 		$temp_array = array();
9023 9023
         
9024
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9024
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9025 9025
 		{
9026 9026
 			$temp_array['route_count'] = $row['route_count'];
9027 9027
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -9048,9 +9048,9 @@  discard block
 block discarded – undo
9048 9048
 	*/
9049 9049
 	public function countAllRoutesByIdent($ident, $filters = array())
9050 9050
 	{
9051
-		$filter_query = $this->getFilter($filters,true,true);
9052
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
9053
-		$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
9051
+		$filter_query = $this->getFilter($filters, true, true);
9052
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
9053
+		$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
9054 9054
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.ident = :ident   
9055 9055
                     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
9056 9056
                     ORDER BY route_count DESC";
@@ -9062,7 +9062,7 @@  discard block
 block discarded – undo
9062 9062
 		$routes_array = array();
9063 9063
 		$temp_array = array();
9064 9064
         
9065
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9065
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9066 9066
 		{
9067 9067
 			$temp_array['route_count'] = $row['route_count'];
9068 9068
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -9086,11 +9086,11 @@  discard block
 block discarded – undo
9086 9086
 	* @return Array the route list
9087 9087
 	*
9088 9088
 	*/
9089
-	public function countAllRoutesByOwner($owner,$filters = array())
9089
+	public function countAllRoutesByOwner($owner, $filters = array())
9090 9090
 	{
9091
-		$filter_query = $this->getFilter($filters,true,true);
9092
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
9093
-		$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
9091
+		$filter_query = $this->getFilter($filters, true, true);
9092
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
9093
+		$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
9094 9094
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.owner_name = :owner 
9095 9095
                     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
9096 9096
                     ORDER BY route_count DESC";
@@ -9102,7 +9102,7 @@  discard block
 block discarded – undo
9102 9102
 		$routes_array = array();
9103 9103
 		$temp_array = array();
9104 9104
         
9105
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9105
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9106 9106
 		{
9107 9107
 			$temp_array['route_count'] = $row['route_count'];
9108 9108
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -9126,11 +9126,11 @@  discard block
 block discarded – undo
9126 9126
 	* @return Array the route list
9127 9127
 	*
9128 9128
 	*/
9129
-	public function countAllRoutesByPilot($pilot,$filters = array())
9129
+	public function countAllRoutesByPilot($pilot, $filters = array())
9130 9130
 	{
9131
-		$filter_query = $this->getFilter($filters,true,true);
9132
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
9133
-		$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
9131
+		$filter_query = $this->getFilter($filters, true, true);
9132
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
9133
+		$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
9134 9134
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
9135 9135
                     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
9136 9136
                     ORDER BY route_count DESC";
@@ -9142,7 +9142,7 @@  discard block
 block discarded – undo
9142 9142
 		$routes_array = array();
9143 9143
 		$temp_array = array();
9144 9144
         
9145
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9145
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9146 9146
 		{
9147 9147
 			$temp_array['route_count'] = $row['route_count'];
9148 9148
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -9169,9 +9169,9 @@  discard block
 block discarded – undo
9169 9169
 	*/
9170 9170
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
9171 9171
 	{
9172
-		$filter_query = $this->getFilter($filters,true,true);
9173
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
9174
-		$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
9172
+		$filter_query = $this->getFilter($filters, true, true);
9173
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
9174
+		$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
9175 9175
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
9176 9176
                     GROUP BY route
9177 9177
                     ORDER BY route_count DESC";
@@ -9183,7 +9183,7 @@  discard block
 block discarded – undo
9183 9183
 		$routes_array = array();
9184 9184
 		$temp_array = array();
9185 9185
         
9186
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9186
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9187 9187
 		{
9188 9188
 			$temp_array['route_count'] = $row['route_count'];
9189 9189
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -9211,8 +9211,8 @@  discard block
 block discarded – undo
9211 9211
 	*/
9212 9212
 	public function countAllRoutesWithWaypoints($filters = array())
9213 9213
 	{
9214
-		$filter_query = $this->getFilter($filters,true,true);
9215
-		$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
9214
+		$filter_query = $this->getFilter($filters, true, true);
9215
+		$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
9216 9216
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.waypoints <> '' 
9217 9217
                     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
9218 9218
                     ORDER BY route_count DESC
@@ -9225,7 +9225,7 @@  discard block
 block discarded – undo
9225 9225
 		$routes_array = array();
9226 9226
 		$temp_array = array();
9227 9227
         
9228
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9228
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9229 9229
 		{
9230 9230
 			$temp_array['spotter_id'] = $row['spotter_id'];
9231 9231
 			$temp_array['route_count'] = $row['route_count'];
@@ -9250,11 +9250,11 @@  discard block
 block discarded – undo
9250 9250
 	* @return Array the callsign list
9251 9251
 	*
9252 9252
 	*/
9253
-	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
9253
+	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
9254 9254
 	{
9255 9255
 		global $globalDBdriver;
9256
-		$filter_query = $this->getFilter($filters,true,true);
9257
-		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
9256
+		$filter_query = $this->getFilter($filters, true, true);
9257
+		$query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
9258 9258
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
9259 9259
 		 if ($olderthanmonths > 0) {
9260 9260
 			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
@@ -9268,28 +9268,28 @@  discard block
 block discarded – undo
9268 9268
 		if ($year != '') {
9269 9269
 			if ($globalDBdriver == 'mysql') {
9270 9270
 				$query .= " AND YEAR(spotter_output.date) = :year";
9271
-				$query_values = array_merge($query_values,array(':year' => $year));
9271
+				$query_values = array_merge($query_values, array(':year' => $year));
9272 9272
 			} else {
9273 9273
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
9274
-				$query_values = array_merge($query_values,array(':year' => $year));
9274
+				$query_values = array_merge($query_values, array(':year' => $year));
9275 9275
 			}
9276 9276
 		}
9277 9277
 		if ($month != '') {
9278 9278
 			if ($globalDBdriver == 'mysql') {
9279 9279
 				$query .= " AND MONTH(spotter_output.date) = :month";
9280
-				$query_values = array_merge($query_values,array(':month' => $month));
9280
+				$query_values = array_merge($query_values, array(':month' => $month));
9281 9281
 			} else {
9282 9282
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
9283
-				$query_values = array_merge($query_values,array(':month' => $month));
9283
+				$query_values = array_merge($query_values, array(':month' => $month));
9284 9284
 			}
9285 9285
 		}
9286 9286
 		if ($day != '') {
9287 9287
 			if ($globalDBdriver == 'mysql') {
9288 9288
 				$query .= " AND DAY(spotter_output.date) = :day";
9289
-				$query_values = array_merge($query_values,array(':day' => $day));
9289
+				$query_values = array_merge($query_values, array(':day' => $day));
9290 9290
 			} else {
9291 9291
 				$query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day";
9292
-				$query_values = array_merge($query_values,array(':day' => $day));
9292
+				$query_values = array_merge($query_values, array(':day' => $day));
9293 9293
 			}
9294 9294
 		}
9295 9295
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
@@ -9301,7 +9301,7 @@  discard block
 block discarded – undo
9301 9301
 		$callsign_array = array();
9302 9302
 		$temp_array = array();
9303 9303
         
9304
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9304
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9305 9305
 		{
9306 9306
 			$temp_array['callsign_icao'] = $row['ident'];
9307 9307
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -9323,8 +9323,8 @@  discard block
 block discarded – undo
9323 9323
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
9324 9324
 	{
9325 9325
 		global $globalDBdriver;
9326
-		$filter_query = $this->getFilter($filters,true,true);
9327
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
9326
+		$filter_query = $this->getFilter($filters, true, true);
9327
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
9328 9328
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
9329 9329
 		 if ($olderthanmonths > 0) {
9330 9330
 			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
@@ -9343,7 +9343,7 @@  discard block
 block discarded – undo
9343 9343
 		$callsign_array = array();
9344 9344
 		$temp_array = array();
9345 9345
         
9346
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9346
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9347 9347
 		{
9348 9348
 			$temp_array['callsign_icao'] = $row['ident'];
9349 9349
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -9397,7 +9397,7 @@  discard block
 block discarded – undo
9397 9397
 		$date_array = array();
9398 9398
 		$temp_array = array();
9399 9399
         
9400
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9400
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9401 9401
 		{
9402 9402
 			$temp_array['date_name'] = $row['date_name'];
9403 9403
 			$temp_array['date_count'] = $row['date_count'];
@@ -9422,15 +9422,15 @@  discard block
 block discarded – undo
9422 9422
 			$datetime = new DateTime();
9423 9423
 			$offset = $datetime->format('P');
9424 9424
 		} else $offset = '+00:00';
9425
-		$filter_query = $this->getFilter($filters,true,true);
9425
+		$filter_query = $this->getFilter($filters, true, true);
9426 9426
 		if ($globalDBdriver == 'mysql') {
9427
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9427
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9428 9428
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
9429 9429
 								GROUP BY spotter_output.airline_icao, date_name 
9430 9430
 								ORDER BY date_count DESC
9431 9431
 								LIMIT 10 OFFSET 0";
9432 9432
 		} else {
9433
-			$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
9433
+			$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
9434 9434
 								FROM spotter_output 
9435 9435
 								WHERE spotter_output.airline_icao <> '' 
9436 9436
 								GROUP BY spotter_output.airline_icao, date_name 
@@ -9445,7 +9445,7 @@  discard block
 block discarded – undo
9445 9445
 		$date_array = array();
9446 9446
 		$temp_array = array();
9447 9447
         
9448
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9448
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9449 9449
 		{
9450 9450
 			$temp_array['date_name'] = $row['date_name'];
9451 9451
 			$temp_array['date_count'] = $row['date_count'];
@@ -9471,7 +9471,7 @@  discard block
 block discarded – undo
9471 9471
 			$datetime = new DateTime();
9472 9472
 			$offset = $datetime->format('P');
9473 9473
 		} else $offset = '+00:00';
9474
-		$filter_query = $this->getFilter($filters,true,true);
9474
+		$filter_query = $this->getFilter($filters, true, true);
9475 9475
 		if ($globalDBdriver == 'mysql') {
9476 9476
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9477 9477
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -9492,7 +9492,7 @@  discard block
 block discarded – undo
9492 9492
 		$date_array = array();
9493 9493
 		$temp_array = array();
9494 9494
         
9495
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9495
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9496 9496
 		{
9497 9497
 			$temp_array['date_name'] = $row['date_name'];
9498 9498
 			$temp_array['date_count'] = $row['date_count'];
@@ -9517,7 +9517,7 @@  discard block
 block discarded – undo
9517 9517
 			$datetime = new DateTime();
9518 9518
 			$offset = $datetime->format('P');
9519 9519
 		} else $offset = '+00:00';
9520
-		$filter_query = $this->getFilter($filters,true,true);
9520
+		$filter_query = $this->getFilter($filters, true, true);
9521 9521
 		if ($globalDBdriver == 'mysql') {
9522 9522
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9523 9523
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)";
@@ -9538,7 +9538,7 @@  discard block
 block discarded – undo
9538 9538
 		$date_array = array();
9539 9539
 		$temp_array = array();
9540 9540
         
9541
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9541
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9542 9542
 		{
9543 9543
 			$temp_array['date_name'] = $row['date_name'];
9544 9544
 			$temp_array['date_count'] = $row['date_count'];
@@ -9559,7 +9559,7 @@  discard block
 block discarded – undo
9559 9559
 	public function countAllDatesLastMonthByAirlines($filters = array())
9560 9560
 	{
9561 9561
 		global $globalTimezone, $globalDBdriver;
9562
-		$filter_query = $this->getFilter($filters,true,true);
9562
+		$filter_query = $this->getFilter($filters, true, true);
9563 9563
 		if ($globalTimezone != '') {
9564 9564
 			date_default_timezone_set($globalTimezone);
9565 9565
 			$datetime = new DateTime();
@@ -9567,13 +9567,13 @@  discard block
 block discarded – undo
9567 9567
 		} else $offset = '+00:00';
9568 9568
 		
9569 9569
 		if ($globalDBdriver == 'mysql') {
9570
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9570
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
9571 9571
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)
9572 9572
 								GROUP BY spotter_output.airline_icao, date_name 
9573 9573
 								ORDER BY spotter_output.date ASC";
9574 9574
 			$query_data = array(':offset' => $offset);
9575 9575
 		} else {
9576
-			$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
9576
+			$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
9577 9577
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS'
9578 9578
 								GROUP BY spotter_output.airline_icao, date_name 
9579 9579
 								ORDER BY date_name ASC";
@@ -9586,7 +9586,7 @@  discard block
 block discarded – undo
9586 9586
 		$date_array = array();
9587 9587
 		$temp_array = array();
9588 9588
         
9589
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9589
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9590 9590
 		{
9591 9591
 			$temp_array['date_name'] = $row['date_name'];
9592 9592
 			$temp_array['date_count'] = $row['date_count'];
@@ -9633,7 +9633,7 @@  discard block
 block discarded – undo
9633 9633
 		$date_array = array();
9634 9634
 		$temp_array = array();
9635 9635
         
9636
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9636
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9637 9637
 		{
9638 9638
 			$temp_array['month_name'] = $row['month_name'];
9639 9639
 			$temp_array['year_name'] = $row['year_name'];
@@ -9654,7 +9654,7 @@  discard block
 block discarded – undo
9654 9654
 	public function countAllMonthsByAirlines($filters = array())
9655 9655
 	{
9656 9656
 		global $globalTimezone, $globalDBdriver;
9657
-		$filter_query = $this->getFilter($filters,true,true);
9657
+		$filter_query = $this->getFilter($filters, true, true);
9658 9658
 		if ($globalTimezone != '') {
9659 9659
 			date_default_timezone_set($globalTimezone);
9660 9660
 			$datetime = new DateTime();
@@ -9662,12 +9662,12 @@  discard block
 block discarded – undo
9662 9662
 		} else $offset = '+00:00';
9663 9663
 
9664 9664
 		if ($globalDBdriver == 'mysql') {
9665
-			$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
9665
+			$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
9666 9666
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
9667 9667
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
9668 9668
 								ORDER BY date_count DESC";
9669 9669
 		} else {
9670
-			$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
9670
+			$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
9671 9671
 								FROM spotter_output 
9672 9672
 								WHERE spotter_output.airline_icao <> '' 
9673 9673
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
@@ -9681,7 +9681,7 @@  discard block
 block discarded – undo
9681 9681
 		$date_array = array();
9682 9682
 		$temp_array = array();
9683 9683
         
9684
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9684
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9685 9685
 		{
9686 9686
 			$temp_array['month_name'] = $row['month_name'];
9687 9687
 			$temp_array['year_name'] = $row['year_name'];
@@ -9708,14 +9708,14 @@  discard block
 block discarded – undo
9708 9708
 			$datetime = new DateTime();
9709 9709
 			$offset = $datetime->format('P');
9710 9710
 		} else $offset = '+00:00';
9711
-		$filter_query = $this->getFilter($filters,true,true);
9711
+		$filter_query = $this->getFilter($filters, true, true);
9712 9712
 		if ($globalDBdriver == 'mysql') {
9713
-			$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
9713
+			$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
9714 9714
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
9715 9715
 								GROUP BY year_name, month_name 
9716 9716
 								ORDER BY date_count DESC";
9717 9717
 		} else {
9718
-			$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
9718
+			$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
9719 9719
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
9720 9720
 								GROUP BY year_name, month_name 
9721 9721
 								ORDER BY date_count DESC";
@@ -9727,7 +9727,7 @@  discard block
 block discarded – undo
9727 9727
 		$date_array = array();
9728 9728
 		$temp_array = array();
9729 9729
         
9730
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9730
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9731 9731
 		{
9732 9732
 			$temp_array['month_name'] = $row['month_name'];
9733 9733
 			$temp_array['year_name'] = $row['year_name'];
@@ -9753,15 +9753,15 @@  discard block
 block discarded – undo
9753 9753
 			$datetime = new DateTime();
9754 9754
 			$offset = $datetime->format('P');
9755 9755
 		} else $offset = '+00:00';
9756
-		$filter_query = $this->getFilter($filters,true,true);
9756
+		$filter_query = $this->getFilter($filters, true, true);
9757 9757
 
9758 9758
 		if ($globalDBdriver == 'mysql') {
9759
-			$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
9759
+			$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
9760 9760
 								FROM spotter_output".$filter_query." owner_name <> ''
9761 9761
 								GROUP BY year_name, month_name
9762 9762
 								ORDER BY date_count DESC";
9763 9763
 		} else {
9764
-			$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
9764
+			$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
9765 9765
 								FROM spotter_output".$filter_query." owner_name <> ''
9766 9766
 								GROUP BY year_name, month_name
9767 9767
 								ORDER BY date_count DESC";
@@ -9773,7 +9773,7 @@  discard block
 block discarded – undo
9773 9773
 		$date_array = array();
9774 9774
 		$temp_array = array();
9775 9775
         
9776
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9776
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9777 9777
 		{
9778 9778
 			$temp_array['month_name'] = $row['month_name'];
9779 9779
 			$temp_array['year_name'] = $row['year_name'];
@@ -9794,7 +9794,7 @@  discard block
 block discarded – undo
9794 9794
 	public function countAllMonthsOwnersByAirlines($filters = array())
9795 9795
 	{
9796 9796
 		global $globalTimezone, $globalDBdriver;
9797
-		$filter_query = $this->getFilter($filters,true,true);
9797
+		$filter_query = $this->getFilter($filters, true, true);
9798 9798
 		if ($globalTimezone != '') {
9799 9799
 			date_default_timezone_set($globalTimezone);
9800 9800
 			$datetime = new DateTime();
@@ -9802,12 +9802,12 @@  discard block
 block discarded – undo
9802 9802
 		} else $offset = '+00:00';
9803 9803
 
9804 9804
 		if ($globalDBdriver == 'mysql') {
9805
-			$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
9805
+			$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
9806 9806
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
9807 9807
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9808 9808
 								ORDER BY date_count DESC";
9809 9809
 		} else {
9810
-			$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
9810
+			$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
9811 9811
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
9812 9812
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9813 9813
 								ORDER BY date_count DESC";
@@ -9819,7 +9819,7 @@  discard block
 block discarded – undo
9819 9819
 		$date_array = array();
9820 9820
 		$temp_array = array();
9821 9821
         
9822
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9822
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9823 9823
 		{
9824 9824
 			$temp_array['month_name'] = $row['month_name'];
9825 9825
 			$temp_array['year_name'] = $row['year_name'];
@@ -9846,15 +9846,15 @@  discard block
 block discarded – undo
9846 9846
 			$datetime = new DateTime();
9847 9847
 			$offset = $datetime->format('P');
9848 9848
 		} else $offset = '+00:00';
9849
-		$filter_query = $this->getFilter($filters,true,true);
9849
+		$filter_query = $this->getFilter($filters, true, true);
9850 9850
 
9851 9851
 		if ($globalDBdriver == 'mysql') {
9852
-			$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
9852
+			$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
9853 9853
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
9854 9854
 								GROUP BY year_name, month_name
9855 9855
 								ORDER BY date_count DESC";
9856 9856
 		} else {
9857
-			$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
9857
+			$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
9858 9858
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
9859 9859
 								GROUP BY year_name, month_name
9860 9860
 								ORDER BY date_count DESC";
@@ -9866,7 +9866,7 @@  discard block
 block discarded – undo
9866 9866
 		$date_array = array();
9867 9867
 		$temp_array = array();
9868 9868
         
9869
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9869
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9870 9870
 		{
9871 9871
 			$temp_array['month_name'] = $row['month_name'];
9872 9872
 			$temp_array['year_name'] = $row['year_name'];
@@ -9887,7 +9887,7 @@  discard block
 block discarded – undo
9887 9887
 	public function countAllMonthsPilotsByAirlines($filters = array())
9888 9888
 	{
9889 9889
 		global $globalTimezone, $globalDBdriver;
9890
-		$filter_query = $this->getFilter($filters,true,true);
9890
+		$filter_query = $this->getFilter($filters, true, true);
9891 9891
 		if ($globalTimezone != '') {
9892 9892
 			date_default_timezone_set($globalTimezone);
9893 9893
 			$datetime = new DateTime();
@@ -9895,12 +9895,12 @@  discard block
 block discarded – undo
9895 9895
 		} else $offset = '+00:00';
9896 9896
 
9897 9897
 		if ($globalDBdriver == 'mysql') {
9898
-			$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
9898
+			$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
9899 9899
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
9900 9900
 								GROUP BY spotter_output.airline_icao,year_name, month_name
9901 9901
 								ORDER BY date_count DESC";
9902 9902
 		} else {
9903
-			$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
9903
+			$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
9904 9904
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
9905 9905
 								GROUP BY spotter_output.airline_icao, year_name, month_name
9906 9906
 								ORDER BY date_count DESC";
@@ -9912,7 +9912,7 @@  discard block
 block discarded – undo
9912 9912
 		$date_array = array();
9913 9913
 		$temp_array = array();
9914 9914
         
9915
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9915
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9916 9916
 		{
9917 9917
 			$temp_array['month_name'] = $row['month_name'];
9918 9918
 			$temp_array['year_name'] = $row['year_name'];
@@ -9934,7 +9934,7 @@  discard block
 block discarded – undo
9934 9934
 	public function countAllMonthsAirlines($filters = array())
9935 9935
 	{
9936 9936
 		global $globalTimezone, $globalDBdriver;
9937
-		$filter_query = $this->getFilter($filters,true,true);
9937
+		$filter_query = $this->getFilter($filters, true, true);
9938 9938
 		if ($globalTimezone != '') {
9939 9939
 			date_default_timezone_set($globalTimezone);
9940 9940
 			$datetime = new DateTime();
@@ -9942,12 +9942,12 @@  discard block
 block discarded – undo
9942 9942
 		} else $offset = '+00:00';
9943 9943
 
9944 9944
 		if ($globalDBdriver == 'mysql') {
9945
-			$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
9945
+			$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
9946 9946
 								FROM spotter_output".$filter_query." airline_icao <> '' 
9947 9947
 								GROUP BY year_name, month_name
9948 9948
 								ORDER BY date_count DESC";
9949 9949
 		} else {
9950
-			$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
9950
+			$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
9951 9951
 								FROM spotter_output".$filter_query." airline_icao <> '' 
9952 9952
 								GROUP BY year_name, month_name
9953 9953
 								ORDER BY date_count DESC";
@@ -9959,7 +9959,7 @@  discard block
 block discarded – undo
9959 9959
 		$date_array = array();
9960 9960
 		$temp_array = array();
9961 9961
         
9962
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9962
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9963 9963
 		{
9964 9964
 			$temp_array['month_name'] = $row['month_name'];
9965 9965
 			$temp_array['year_name'] = $row['year_name'];
@@ -9985,15 +9985,15 @@  discard block
 block discarded – undo
9985 9985
 			$datetime = new DateTime();
9986 9986
 			$offset = $datetime->format('P');
9987 9987
 		} else $offset = '+00:00';
9988
-		$filter_query = $this->getFilter($filters,true,true);
9988
+		$filter_query = $this->getFilter($filters, true, true);
9989 9989
 
9990 9990
 		if ($globalDBdriver == 'mysql') {
9991
-			$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
9991
+			$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
9992 9992
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
9993 9993
 								GROUP BY year_name, month_name
9994 9994
 								ORDER BY date_count DESC";
9995 9995
 		} else {
9996
-			$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
9996
+			$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
9997 9997
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
9998 9998
 								GROUP BY year_name, month_name
9999 9999
 								ORDER BY date_count DESC";
@@ -10005,7 +10005,7 @@  discard block
 block discarded – undo
10005 10005
 		$date_array = array();
10006 10006
 		$temp_array = array();
10007 10007
         
10008
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10008
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10009 10009
 		{
10010 10010
 			$temp_array['month_name'] = $row['month_name'];
10011 10011
 			$temp_array['year_name'] = $row['year_name'];
@@ -10027,7 +10027,7 @@  discard block
 block discarded – undo
10027 10027
 	public function countAllMonthsAircraftsByAirlines($filters = array())
10028 10028
 	{
10029 10029
 		global $globalTimezone, $globalDBdriver;
10030
-		$filter_query = $this->getFilter($filters,true,true);
10030
+		$filter_query = $this->getFilter($filters, true, true);
10031 10031
 		if ($globalTimezone != '') {
10032 10032
 			date_default_timezone_set($globalTimezone);
10033 10033
 			$datetime = new DateTime();
@@ -10035,12 +10035,12 @@  discard block
 block discarded – undo
10035 10035
 		} else $offset = '+00:00';
10036 10036
 
10037 10037
 		if ($globalDBdriver == 'mysql') {
10038
-			$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
10038
+			$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
10039 10039
 								FROM spotter_output".$filter_query." aircraft_icao <> ''  AND spotter_output.airline_icao <> '' 
10040 10040
 								GROUP BY spotter_output.airline_icao, year_name, month_name
10041 10041
 								ORDER BY date_count DESC";
10042 10042
 		} else {
10043
-			$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
10043
+			$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
10044 10044
 								FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' 
10045 10045
 								GROUP BY spotter_output.airline_icao, year_name, month_name
10046 10046
 								ORDER BY date_count DESC";
@@ -10052,7 +10052,7 @@  discard block
 block discarded – undo
10052 10052
 		$date_array = array();
10053 10053
 		$temp_array = array();
10054 10054
         
10055
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10055
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10056 10056
 		{
10057 10057
 			$temp_array['month_name'] = $row['month_name'];
10058 10058
 			$temp_array['year_name'] = $row['year_name'];
@@ -10079,15 +10079,15 @@  discard block
 block discarded – undo
10079 10079
 			$datetime = new DateTime();
10080 10080
 			$offset = $datetime->format('P');
10081 10081
 		} else $offset = '+00:00';
10082
-		$filter_query = $this->getFilter($filters,true,true);
10082
+		$filter_query = $this->getFilter($filters, true, true);
10083 10083
 
10084 10084
 		if ($globalDBdriver == 'mysql') {
10085
-			$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
10085
+			$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
10086 10086
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
10087 10087
 								GROUP BY year_name, month_name
10088 10088
 								ORDER BY date_count DESC";
10089 10089
 		} else {
10090
-			$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
10090
+			$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
10091 10091
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
10092 10092
 								GROUP BY year_name, month_name
10093 10093
 								ORDER BY date_count DESC";
@@ -10099,7 +10099,7 @@  discard block
 block discarded – undo
10099 10099
 		$date_array = array();
10100 10100
 		$temp_array = array();
10101 10101
         
10102
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10102
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10103 10103
 		{
10104 10104
 			$temp_array['month_name'] = $row['month_name'];
10105 10105
 			$temp_array['year_name'] = $row['year_name'];
@@ -10121,7 +10121,7 @@  discard block
 block discarded – undo
10121 10121
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
10122 10122
 	{
10123 10123
 		global $globalTimezone, $globalDBdriver;
10124
-		$filter_query = $this->getFilter($filters,true,true);
10124
+		$filter_query = $this->getFilter($filters, true, true);
10125 10125
 		if ($globalTimezone != '') {
10126 10126
 			date_default_timezone_set($globalTimezone);
10127 10127
 			$datetime = new DateTime();
@@ -10129,12 +10129,12 @@  discard block
 block discarded – undo
10129 10129
 		} else $offset = '+00:00';
10130 10130
 
10131 10131
 		if ($globalDBdriver == 'mysql') {
10132
-			$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
10132
+			$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
10133 10133
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
10134 10134
 								GROUP BY spotter_output.airline_icao, year_name, month_name
10135 10135
 								ORDER BY date_count DESC";
10136 10136
 		} else {
10137
-			$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
10137
+			$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
10138 10138
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
10139 10139
 								GROUP BY spotter_output.airline_icao, year_name, month_name
10140 10140
 								ORDER BY date_count DESC";
@@ -10146,7 +10146,7 @@  discard block
 block discarded – undo
10146 10146
 		$date_array = array();
10147 10147
 		$temp_array = array();
10148 10148
         
10149
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10149
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10150 10150
 		{
10151 10151
 			$temp_array['month_name'] = $row['month_name'];
10152 10152
 			$temp_array['year_name'] = $row['year_name'];
@@ -10174,7 +10174,7 @@  discard block
 block discarded – undo
10174 10174
 			$datetime = new DateTime();
10175 10175
 			$offset = $datetime->format('P');
10176 10176
 		} else $offset = '+00:00';
10177
-		$filter_query = $this->getFilter($filters,true,true);
10177
+		$filter_query = $this->getFilter($filters, true, true);
10178 10178
 		if ($globalDBdriver == 'mysql') {
10179 10179
 			$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
10180 10180
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
@@ -10195,7 +10195,7 @@  discard block
 block discarded – undo
10195 10195
 		$date_array = array();
10196 10196
 		$temp_array = array();
10197 10197
         
10198
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10198
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10199 10199
 		{
10200 10200
 			$temp_array['year_name'] = $row['year_name'];
10201 10201
 			$temp_array['month_name'] = $row['month_name'];
@@ -10215,7 +10215,7 @@  discard block
 block discarded – undo
10215 10215
 	* @return Array the hour list
10216 10216
 	*
10217 10217
 	*/
10218
-	public function countAllHours($orderby,$filters = array())
10218
+	public function countAllHours($orderby, $filters = array())
10219 10219
 	{
10220 10220
 		global $globalTimezone, $globalDBdriver;
10221 10221
 		if ($globalTimezone != '') {
@@ -10263,7 +10263,7 @@  discard block
 block discarded – undo
10263 10263
 		$hour_array = array();
10264 10264
 		$temp_array = array();
10265 10265
         
10266
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10266
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10267 10267
 		{
10268 10268
 			$temp_array['hour_name'] = $row['hour_name'];
10269 10269
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10283,7 +10283,7 @@  discard block
 block discarded – undo
10283 10283
 	public function countAllHoursByAirlines($orderby, $filters = array())
10284 10284
 	{
10285 10285
 		global $globalTimezone, $globalDBdriver;
10286
-		$filter_query = $this->getFilter($filters,true,true);
10286
+		$filter_query = $this->getFilter($filters, true, true);
10287 10287
 		if ($globalTimezone != '') {
10288 10288
 			date_default_timezone_set($globalTimezone);
10289 10289
 			$datetime = new DateTime();
@@ -10301,7 +10301,7 @@  discard block
 block discarded – undo
10301 10301
 		}
10302 10302
 		
10303 10303
 		if ($globalDBdriver == 'mysql') {
10304
-			$query  = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10304
+			$query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10305 10305
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
10306 10306
 								GROUP BY spotter_output.airline_icao, hour_name 
10307 10307
 								".$orderby_sql;
@@ -10314,7 +10314,7 @@  discard block
 block discarded – undo
10314 10314
   */    
10315 10315
 		$query_data = array(':offset' => $offset);
10316 10316
 		} else {
10317
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10317
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10318 10318
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
10319 10319
 								GROUP BY spotter_output.airline_icao, hour_name 
10320 10320
 								".$orderby_sql;
@@ -10327,7 +10327,7 @@  discard block
 block discarded – undo
10327 10327
 		$hour_array = array();
10328 10328
 		$temp_array = array();
10329 10329
         
10330
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10330
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10331 10331
 		{
10332 10332
 			$temp_array['hour_name'] = $row['hour_name'];
10333 10333
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10350,34 +10350,34 @@  discard block
 block discarded – undo
10350 10350
 	public function countAllHoursByAirline($airline_icao, $filters = array())
10351 10351
 	{
10352 10352
 		global $globalTimezone, $globalDBdriver;
10353
-		$filter_query = $this->getFilter($filters,true,true);
10353
+		$filter_query = $this->getFilter($filters, true, true);
10354 10354
 		if ($globalTimezone != '') {
10355 10355
 			date_default_timezone_set($globalTimezone);
10356 10356
 			$datetime = new DateTime();
10357 10357
 			$offset = $datetime->format('P');
10358 10358
 		} else $offset = '+00:00';
10359 10359
 
10360
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
10360
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
10361 10361
 
10362 10362
 		if ($globalDBdriver == 'mysql') {
10363
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10363
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10364 10364
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
10365 10365
 								GROUP BY hour_name 
10366 10366
 								ORDER BY hour_name ASC";
10367 10367
 		} else {
10368
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10368
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10369 10369
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
10370 10370
 								GROUP BY hour_name 
10371 10371
 								ORDER BY hour_name ASC";
10372 10372
 		}
10373 10373
 		
10374 10374
 		$sth = $this->db->prepare($query);
10375
-		$sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset));
10375
+		$sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset));
10376 10376
       
10377 10377
 		$hour_array = array();
10378 10378
 		$temp_array = array();
10379 10379
         
10380
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10380
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10381 10381
 		{
10382 10382
 			$temp_array['hour_name'] = $row['hour_name'];
10383 10383
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10400,8 +10400,8 @@  discard block
 block discarded – undo
10400 10400
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
10401 10401
 	{
10402 10402
 		global $globalTimezone, $globalDBdriver;
10403
-		$filter_query = $this->getFilter($filters,true,true);
10404
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
10403
+		$filter_query = $this->getFilter($filters, true, true);
10404
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
10405 10405
 		if ($globalTimezone != '') {
10406 10406
 			date_default_timezone_set($globalTimezone);
10407 10407
 			$datetime = new DateTime();
@@ -10409,24 +10409,24 @@  discard block
 block discarded – undo
10409 10409
 		} else $offset = '+00:00';
10410 10410
 
10411 10411
 		if ($globalDBdriver == 'mysql') {
10412
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10412
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10413 10413
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
10414 10414
 								GROUP BY hour_name 
10415 10415
 								ORDER BY hour_name ASC";
10416 10416
 		} else {
10417
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10417
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10418 10418
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
10419 10419
 								GROUP BY hour_name 
10420 10420
 								ORDER BY hour_name ASC";
10421 10421
 		}
10422 10422
 		
10423 10423
 		$sth = $this->db->prepare($query);
10424
-		$sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset));
10424
+		$sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset));
10425 10425
       
10426 10426
 		$hour_array = array();
10427 10427
 		$temp_array = array();
10428 10428
         
10429
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10429
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10430 10430
 		{
10431 10431
 			$temp_array['hour_name'] = $row['hour_name'];
10432 10432
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10447,8 +10447,8 @@  discard block
 block discarded – undo
10447 10447
 	public function countAllHoursByRegistration($registration, $filters = array())
10448 10448
 	{
10449 10449
 		global $globalTimezone, $globalDBdriver;
10450
-		$filter_query = $this->getFilter($filters,true,true);
10451
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
10450
+		$filter_query = $this->getFilter($filters, true, true);
10451
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
10452 10452
 		if ($globalTimezone != '') {
10453 10453
 			date_default_timezone_set($globalTimezone);
10454 10454
 			$datetime = new DateTime();
@@ -10456,24 +10456,24 @@  discard block
 block discarded – undo
10456 10456
 		} else $offset = '+00:00';
10457 10457
 
10458 10458
 		if ($globalDBdriver == 'mysql') {
10459
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10459
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10460 10460
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
10461 10461
 								GROUP BY hour_name 
10462 10462
 								ORDER BY hour_name ASC";
10463 10463
 		} else {
10464
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10464
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10465 10465
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
10466 10466
 								GROUP BY hour_name 
10467 10467
 								ORDER BY hour_name ASC";
10468 10468
 		}
10469 10469
 		
10470 10470
 		$sth = $this->db->prepare($query);
10471
-		$sth->execute(array(':registration' => $registration,':offset' => $offset));
10471
+		$sth->execute(array(':registration' => $registration, ':offset' => $offset));
10472 10472
       
10473 10473
 		$hour_array = array();
10474 10474
 		$temp_array = array();
10475 10475
         
10476
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10476
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10477 10477
 		{
10478 10478
 			$temp_array['hour_name'] = $row['hour_name'];
10479 10479
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10494,8 +10494,8 @@  discard block
 block discarded – undo
10494 10494
 	public function countAllHoursByAirport($airport_icao, $filters = array())
10495 10495
 	{
10496 10496
 		global $globalTimezone, $globalDBdriver;
10497
-		$filter_query = $this->getFilter($filters,true,true);
10498
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
10497
+		$filter_query = $this->getFilter($filters, true, true);
10498
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
10499 10499
 		if ($globalTimezone != '') {
10500 10500
 			date_default_timezone_set($globalTimezone);
10501 10501
 			$datetime = new DateTime();
@@ -10503,24 +10503,24 @@  discard block
 block discarded – undo
10503 10503
 		} else $offset = '+00:00';
10504 10504
 
10505 10505
 		if ($globalDBdriver == 'mysql') {
10506
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10506
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10507 10507
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
10508 10508
 								GROUP BY hour_name 
10509 10509
 								ORDER BY hour_name ASC";
10510 10510
 		} else {
10511
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10511
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10512 10512
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
10513 10513
 								GROUP BY hour_name 
10514 10514
 								ORDER BY hour_name ASC";
10515 10515
 		}
10516 10516
 		
10517 10517
 		$sth = $this->db->prepare($query);
10518
-		$sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset));
10518
+		$sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset));
10519 10519
       
10520 10520
 		$hour_array = array();
10521 10521
 		$temp_array = array();
10522 10522
         
10523
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10523
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10524 10524
 		{
10525 10525
 			$temp_array['hour_name'] = $row['hour_name'];
10526 10526
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10539,11 +10539,11 @@  discard block
 block discarded – undo
10539 10539
 	* @return Array the hour list
10540 10540
 	*
10541 10541
 	*/
10542
-	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
10542
+	public function countAllHoursByManufacturer($aircraft_manufacturer, $filters = array())
10543 10543
 	{
10544 10544
 		global $globalTimezone, $globalDBdriver;
10545
-		$filter_query = $this->getFilter($filters,true,true);
10546
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
10545
+		$filter_query = $this->getFilter($filters, true, true);
10546
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
10547 10547
 		if ($globalTimezone != '') {
10548 10548
 			date_default_timezone_set($globalTimezone);
10549 10549
 			$datetime = new DateTime();
@@ -10551,24 +10551,24 @@  discard block
 block discarded – undo
10551 10551
 		} else $offset = '+00:00';
10552 10552
 
10553 10553
 		if ($globalDBdriver == 'mysql') {
10554
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10554
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10555 10555
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
10556 10556
 								GROUP BY hour_name 
10557 10557
 								ORDER BY hour_name ASC";
10558 10558
 		} else {
10559
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10559
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10560 10560
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
10561 10561
 								GROUP BY hour_name 
10562 10562
 								ORDER BY hour_name ASC";
10563 10563
 		}
10564 10564
 		
10565 10565
 		$sth = $this->db->prepare($query);
10566
-		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset));
10566
+		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset));
10567 10567
       
10568 10568
 		$hour_array = array();
10569 10569
 		$temp_array = array();
10570 10570
         
10571
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10571
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10572 10572
 		{
10573 10573
 			$temp_array['hour_name'] = $row['hour_name'];
10574 10574
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10590,8 +10590,8 @@  discard block
 block discarded – undo
10590 10590
 	public function countAllHoursByDate($date, $filters = array())
10591 10591
 	{
10592 10592
 		global $globalTimezone, $globalDBdriver;
10593
-		$filter_query = $this->getFilter($filters,true,true);
10594
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
10593
+		$filter_query = $this->getFilter($filters, true, true);
10594
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
10595 10595
 		if ($globalTimezone != '') {
10596 10596
 			date_default_timezone_set($globalTimezone);
10597 10597
 			$datetime = new DateTime($date);
@@ -10599,12 +10599,12 @@  discard block
 block discarded – undo
10599 10599
 		} else $offset = '+00:00';
10600 10600
 
10601 10601
 		if ($globalDBdriver == 'mysql') {
10602
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10602
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10603 10603
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
10604 10604
 								GROUP BY hour_name 
10605 10605
 								ORDER BY hour_name ASC";
10606 10606
 		} else {
10607
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10607
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10608 10608
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date
10609 10609
 								GROUP BY hour_name 
10610 10610
 								ORDER BY hour_name ASC";
@@ -10616,7 +10616,7 @@  discard block
 block discarded – undo
10616 10616
 		$hour_array = array();
10617 10617
 		$temp_array = array();
10618 10618
         
10619
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10619
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10620 10620
 		{
10621 10621
 			$temp_array['hour_name'] = $row['hour_name'];
10622 10622
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10638,8 +10638,8 @@  discard block
 block discarded – undo
10638 10638
 	public function countAllHoursByIdent($ident, $filters = array())
10639 10639
 	{
10640 10640
 		global $globalTimezone, $globalDBdriver;
10641
-		$filter_query = $this->getFilter($filters,true,true);
10642
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
10641
+		$filter_query = $this->getFilter($filters, true, true);
10642
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
10643 10643
 		if ($globalTimezone != '') {
10644 10644
 			date_default_timezone_set($globalTimezone);
10645 10645
 			$datetime = new DateTime();
@@ -10647,12 +10647,12 @@  discard block
 block discarded – undo
10647 10647
 		} else $offset = '+00:00';
10648 10648
 
10649 10649
 		if ($globalDBdriver == 'mysql') {
10650
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10650
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10651 10651
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
10652 10652
 								GROUP BY hour_name 
10653 10653
 								ORDER BY hour_name ASC";
10654 10654
 		} else {
10655
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10655
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10656 10656
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
10657 10657
 								GROUP BY hour_name 
10658 10658
 								ORDER BY hour_name ASC";
@@ -10660,12 +10660,12 @@  discard block
 block discarded – undo
10660 10660
       
10661 10661
 		
10662 10662
 		$sth = $this->db->prepare($query);
10663
-		$sth->execute(array(':ident' => $ident,':offset' => $offset));
10663
+		$sth->execute(array(':ident' => $ident, ':offset' => $offset));
10664 10664
       
10665 10665
 		$hour_array = array();
10666 10666
 		$temp_array = array();
10667 10667
         
10668
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10668
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10669 10669
 		{
10670 10670
 			$temp_array['hour_name'] = $row['hour_name'];
10671 10671
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10685,8 +10685,8 @@  discard block
 block discarded – undo
10685 10685
 	public function countAllHoursByOwner($owner, $filters = array())
10686 10686
 	{
10687 10687
 		global $globalTimezone, $globalDBdriver;
10688
-		$filter_query = $this->getFilter($filters,true,true);
10689
-		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
10688
+		$filter_query = $this->getFilter($filters, true, true);
10689
+		$owner = filter_var($owner, FILTER_SANITIZE_STRING);
10690 10690
 		if ($globalTimezone != '') {
10691 10691
 			date_default_timezone_set($globalTimezone);
10692 10692
 			$datetime = new DateTime();
@@ -10694,12 +10694,12 @@  discard block
 block discarded – undo
10694 10694
 		} else $offset = '+00:00';
10695 10695
 
10696 10696
 		if ($globalDBdriver == 'mysql') {
10697
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10697
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10698 10698
 								FROM spotter_output".$filter_query." spotter_output.owner_name = :owner 
10699 10699
 								GROUP BY hour_name 
10700 10700
 								ORDER BY hour_name ASC";
10701 10701
 		} else {
10702
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10702
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10703 10703
 								FROM spotter_output".$filter_query." spotter_output.owner_name = :owner 
10704 10704
 								GROUP BY hour_name 
10705 10705
 								ORDER BY hour_name ASC";
@@ -10707,12 +10707,12 @@  discard block
 block discarded – undo
10707 10707
       
10708 10708
 		
10709 10709
 		$sth = $this->db->prepare($query);
10710
-		$sth->execute(array(':owner' => $owner,':offset' => $offset));
10710
+		$sth->execute(array(':owner' => $owner, ':offset' => $offset));
10711 10711
       
10712 10712
 		$hour_array = array();
10713 10713
 		$temp_array = array();
10714 10714
         
10715
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10715
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10716 10716
 		{
10717 10717
 			$temp_array['hour_name'] = $row['hour_name'];
10718 10718
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10732,8 +10732,8 @@  discard block
 block discarded – undo
10732 10732
 	public function countAllHoursByPilot($pilot, $filters = array())
10733 10733
 	{
10734 10734
 		global $globalTimezone, $globalDBdriver;
10735
-		$filter_query = $this->getFilter($filters,true,true);
10736
-		$pilot = filter_var($pilot,FILTER_SANITIZE_STRING);
10735
+		$filter_query = $this->getFilter($filters, true, true);
10736
+		$pilot = filter_var($pilot, FILTER_SANITIZE_STRING);
10737 10737
 		if ($globalTimezone != '') {
10738 10738
 			date_default_timezone_set($globalTimezone);
10739 10739
 			$datetime = new DateTime();
@@ -10741,12 +10741,12 @@  discard block
 block discarded – undo
10741 10741
 		} else $offset = '+00:00';
10742 10742
 
10743 10743
 		if ($globalDBdriver == 'mysql') {
10744
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10744
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10745 10745
 								FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
10746 10746
 								GROUP BY hour_name 
10747 10747
 								ORDER BY hour_name ASC";
10748 10748
 		} else {
10749
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10749
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10750 10750
 								FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) 
10751 10751
 								GROUP BY hour_name 
10752 10752
 								ORDER BY hour_name ASC";
@@ -10754,12 +10754,12 @@  discard block
 block discarded – undo
10754 10754
       
10755 10755
 		
10756 10756
 		$sth = $this->db->prepare($query);
10757
-		$sth->execute(array(':pilot' => $pilot,':offset' => $offset));
10757
+		$sth->execute(array(':pilot' => $pilot, ':offset' => $offset));
10758 10758
       
10759 10759
 		$hour_array = array();
10760 10760
 		$temp_array = array();
10761 10761
         
10762
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10762
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10763 10763
 		{
10764 10764
 			$temp_array['hour_name'] = $row['hour_name'];
10765 10765
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10778,12 +10778,12 @@  discard block
 block discarded – undo
10778 10778
 	* @return Array the hour list
10779 10779
 	*
10780 10780
 	*/
10781
-	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
10781
+	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
10782 10782
 	{
10783 10783
 		global $globalTimezone, $globalDBdriver;
10784
-		$filter_query = $this->getFilter($filters,true,true);
10785
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
10786
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
10784
+		$filter_query = $this->getFilter($filters, true, true);
10785
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
10786
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
10787 10787
 		if ($globalTimezone != '') {
10788 10788
 			date_default_timezone_set($globalTimezone);
10789 10789
 			$datetime = new DateTime();
@@ -10791,24 +10791,24 @@  discard block
 block discarded – undo
10791 10791
 		} else $offset = '+00:00';
10792 10792
 
10793 10793
 		if ($globalDBdriver == 'mysql') {
10794
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10794
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10795 10795
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
10796 10796
 								GROUP BY hour_name 
10797 10797
 								ORDER BY hour_name ASC";
10798 10798
 		} else {
10799
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10799
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10800 10800
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
10801 10801
 								GROUP BY hour_name 
10802 10802
 								ORDER BY hour_name ASC";
10803 10803
 		}
10804 10804
 		
10805 10805
 		$sth = $this->db->prepare($query);
10806
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset));
10806
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset));
10807 10807
       
10808 10808
 		$hour_array = array();
10809 10809
 		$temp_array = array();
10810 10810
         
10811
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10811
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10812 10812
 		{
10813 10813
 			$temp_array['hour_name'] = $row['hour_name'];
10814 10814
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10829,8 +10829,8 @@  discard block
 block discarded – undo
10829 10829
 	public function countAllHoursByCountry($country, $filters = array())
10830 10830
 	{
10831 10831
 		global $globalTimezone, $globalDBdriver;
10832
-		$filter_query = $this->getFilter($filters,true,true);
10833
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
10832
+		$filter_query = $this->getFilter($filters, true, true);
10833
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
10834 10834
 		if ($globalTimezone != '') {
10835 10835
 			date_default_timezone_set($globalTimezone);
10836 10836
 			$datetime = new DateTime();
@@ -10838,24 +10838,24 @@  discard block
 block discarded – undo
10838 10838
 		} else $offset = '+00:00';
10839 10839
 
10840 10840
 		if ($globalDBdriver == 'mysql') {
10841
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10841
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
10842 10842
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
10843 10843
 								GROUP BY hour_name 
10844 10844
 								ORDER BY hour_name ASC";
10845 10845
 		} else {
10846
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10846
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
10847 10847
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
10848 10848
 								GROUP BY hour_name 
10849 10849
 								ORDER BY hour_name ASC";
10850 10850
 		}
10851 10851
 		
10852 10852
 		$sth = $this->db->prepare($query);
10853
-		$sth->execute(array(':country' => $country,':offset' => $offset));
10853
+		$sth->execute(array(':country' => $country, ':offset' => $offset));
10854 10854
       
10855 10855
 		$hour_array = array();
10856 10856
 		$temp_array = array();
10857 10857
         
10858
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10858
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10859 10859
 		{
10860 10860
 			$temp_array['hour_name'] = $row['hour_name'];
10861 10861
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -10875,29 +10875,29 @@  discard block
 block discarded – undo
10875 10875
 	* @return Integer the number of aircrafts
10876 10876
 	*
10877 10877
 	*/
10878
-	public function countOverallAircrafts($filters = array(),$year = '',$month = '')
10878
+	public function countOverallAircrafts($filters = array(), $year = '', $month = '')
10879 10879
 	{
10880 10880
 		global $globalDBdriver;
10881
-		$filter_query = $this->getFilter($filters,true,true);
10882
-		$query  = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
10881
+		$filter_query = $this->getFilter($filters, true, true);
10882
+		$query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
10883 10883
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
10884 10884
 		$query_values = array();
10885 10885
 		if ($year != '') {
10886 10886
 			if ($globalDBdriver == 'mysql') {
10887 10887
 				$query .= " AND YEAR(spotter_output.date) = :year";
10888
-				$query_values = array_merge($query_values,array(':year' => $year));
10888
+				$query_values = array_merge($query_values, array(':year' => $year));
10889 10889
 			} else {
10890 10890
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10891
-				$query_values = array_merge($query_values,array(':year' => $year));
10891
+				$query_values = array_merge($query_values, array(':year' => $year));
10892 10892
 			}
10893 10893
 		}
10894 10894
 		if ($month != '') {
10895 10895
 			if ($globalDBdriver == 'mysql') {
10896 10896
 				$query .= " AND MONTH(spotter_output.date) = :month";
10897
-				$query_values = array_merge($query_values,array(':month' => $month));
10897
+				$query_values = array_merge($query_values, array(':month' => $month));
10898 10898
 			} else {
10899 10899
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10900
-				$query_values = array_merge($query_values,array(':month' => $month));
10900
+				$query_values = array_merge($query_values, array(':month' => $month));
10901 10901
 			}
10902 10902
 		}
10903 10903
 
@@ -10912,29 +10912,29 @@  discard block
 block discarded – undo
10912 10912
 	* @return Integer the number of aircrafts
10913 10913
 	*
10914 10914
 	*/
10915
-	public function countOverallArrival($filters = array(),$year = '',$month = '')
10915
+	public function countOverallArrival($filters = array(), $year = '', $month = '')
10916 10916
 	{
10917 10917
 		global $globalDBdriver;
10918
-		$filter_query = $this->getFilter($filters,true,true);
10919
-		$query  = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
10918
+		$filter_query = $this->getFilter($filters, true, true);
10919
+		$query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
10920 10920
                     FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''";
10921 10921
 		$query_values = array();
10922 10922
 		if ($year != '') {
10923 10923
 			if ($globalDBdriver == 'mysql') {
10924 10924
 				$query .= " AND YEAR(spotter_output.date) = :year";
10925
-				$query_values = array_merge($query_values,array(':year' => $year));
10925
+				$query_values = array_merge($query_values, array(':year' => $year));
10926 10926
 			} else {
10927 10927
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10928
-				$query_values = array_merge($query_values,array(':year' => $year));
10928
+				$query_values = array_merge($query_values, array(':year' => $year));
10929 10929
 			}
10930 10930
 		}
10931 10931
 		if ($month != '') {
10932 10932
 			if ($globalDBdriver == 'mysql') {
10933 10933
 				$query .= " AND MONTH(spotter_output.date) = :month";
10934
-				$query_values = array_merge($query_values,array(':month' => $month));
10934
+				$query_values = array_merge($query_values, array(':month' => $month));
10935 10935
 			} else {
10936 10936
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10937
-				$query_values = array_merge($query_values,array(':month' => $month));
10937
+				$query_values = array_merge($query_values, array(':month' => $month));
10938 10938
 			}
10939 10939
 		}
10940 10940
 		
@@ -10949,29 +10949,29 @@  discard block
 block discarded – undo
10949 10949
 	* @return Integer the number of pilots
10950 10950
 	*
10951 10951
 	*/
10952
-	public function countOverallPilots($filters = array(),$year = '',$month = '')
10952
+	public function countOverallPilots($filters = array(), $year = '', $month = '')
10953 10953
 	{
10954 10954
 		global $globalDBdriver;
10955
-		$filter_query = $this->getFilter($filters,true,true);
10956
-		$query  = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
10955
+		$filter_query = $this->getFilter($filters, true, true);
10956
+		$query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
10957 10957
                     FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''";
10958 10958
 		$query_values = array();
10959 10959
 		if ($year != '') {
10960 10960
 			if ($globalDBdriver == 'mysql') {
10961 10961
 				$query .= " AND YEAR(spotter_output.date) = :year";
10962
-				$query_values = array_merge($query_values,array(':year' => $year));
10962
+				$query_values = array_merge($query_values, array(':year' => $year));
10963 10963
 			} else {
10964 10964
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
10965
-				$query_values = array_merge($query_values,array(':year' => $year));
10965
+				$query_values = array_merge($query_values, array(':year' => $year));
10966 10966
 			}
10967 10967
 		}
10968 10968
 		if ($month != '') {
10969 10969
 			if ($globalDBdriver == 'mysql') {
10970 10970
 				$query .= " AND MONTH(spotter_output.date) = :month";
10971
-				$query_values = array_merge($query_values,array(':month' => $month));
10971
+				$query_values = array_merge($query_values, array(':month' => $month));
10972 10972
 			} else {
10973 10973
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
10974
-				$query_values = array_merge($query_values,array(':month' => $month));
10974
+				$query_values = array_merge($query_values, array(':month' => $month));
10975 10975
 			}
10976 10976
 		}
10977 10977
 		$sth = $this->db->prepare($query);
@@ -10985,29 +10985,29 @@  discard block
 block discarded – undo
10985 10985
 	* @return Integer the number of owners
10986 10986
 	*
10987 10987
 	*/
10988
-	public function countOverallOwners($filters = array(),$year = '',$month = '')
10988
+	public function countOverallOwners($filters = array(), $year = '', $month = '')
10989 10989
 	{
10990 10990
 		global $globalDBdriver;
10991
-		$filter_query = $this->getFilter($filters,true,true);
10992
-		$query  = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
10991
+		$filter_query = $this->getFilter($filters, true, true);
10992
+		$query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
10993 10993
                     FROM spotter_output".$filter_query." spotter_output.owner_name <> ''";
10994 10994
 		$query_values = array();
10995 10995
 		if ($year != '') {
10996 10996
 			if ($globalDBdriver == 'mysql') {
10997 10997
 				$query .= " AND YEAR(spotter_output.date) = :year";
10998
-				$query_values = array_merge($query_values,array(':year' => $year));
10998
+				$query_values = array_merge($query_values, array(':year' => $year));
10999 10999
 			} else {
11000 11000
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
11001
-				$query_values = array_merge($query_values,array(':year' => $year));
11001
+				$query_values = array_merge($query_values, array(':year' => $year));
11002 11002
 			}
11003 11003
 		}
11004 11004
 		if ($month != '') {
11005 11005
 			if ($globalDBdriver == 'mysql') {
11006 11006
 				$query .= " AND MONTH(spotter_output.date) = :month";
11007
-				$query_values = array_merge($query_values,array(':month' => $month));
11007
+				$query_values = array_merge($query_values, array(':month' => $month));
11008 11008
 			} else {
11009 11009
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
11010
-				$query_values = array_merge($query_values,array(':month' => $month));
11010
+				$query_values = array_merge($query_values, array(':month' => $month));
11011 11011
 			}
11012 11012
 		}
11013 11013
 		$sth = $this->db->prepare($query);
@@ -11022,32 +11022,32 @@  discard block
 block discarded – undo
11022 11022
 	* @return Integer the number of flights
11023 11023
 	*
11024 11024
 	*/
11025
-	public function countOverallFlights($filters = array(),$year = '',$month = '')
11025
+	public function countOverallFlights($filters = array(), $year = '', $month = '')
11026 11026
 	{
11027 11027
 		global $globalDBdriver;
11028
-		$queryi  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count FROM spotter_output";
11028
+		$queryi = "SELECT COUNT(spotter_output.spotter_id) AS flight_count FROM spotter_output";
11029 11029
 		$query_values = array();
11030 11030
 		$query = '';
11031 11031
 		if ($year != '') {
11032 11032
 			if ($globalDBdriver == 'mysql') {
11033 11033
 				$query .= " AND YEAR(spotter_output.date) = :year";
11034
-				$query_values = array_merge($query_values,array(':year' => $year));
11034
+				$query_values = array_merge($query_values, array(':year' => $year));
11035 11035
 			} else {
11036 11036
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
11037
-				$query_values = array_merge($query_values,array(':year' => $year));
11037
+				$query_values = array_merge($query_values, array(':year' => $year));
11038 11038
 			}
11039 11039
 		}
11040 11040
 		if ($month != '') {
11041 11041
 			if ($globalDBdriver == 'mysql') {
11042 11042
 				$query .= " AND MONTH(spotter_output.date) = :month";
11043
-				$query_values = array_merge($query_values,array(':month' => $month));
11043
+				$query_values = array_merge($query_values, array(':month' => $month));
11044 11044
 			} else {
11045 11045
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
11046
-				$query_values = array_merge($query_values,array(':month' => $month));
11046
+				$query_values = array_merge($query_values, array(':month' => $month));
11047 11047
 			}
11048 11048
 		}
11049 11049
 		if (empty($query_values)) $queryi .= $this->getFilter($filters);
11050
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11050
+		else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
11051 11051
 		
11052 11052
 		$sth = $this->db->prepare($queryi);
11053 11053
 		$sth->execute($query_values);
@@ -11060,29 +11060,29 @@  discard block
 block discarded – undo
11060 11060
 	* @return Integer the number of flights
11061 11061
 	*
11062 11062
 	*/
11063
-	public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '')
11063
+	public function countOverallMilitaryFlights($filters = array(), $year = '', $month = '')
11064 11064
 	{
11065 11065
 		global $globalDBdriver;
11066
-		$filter_query = $this->getFilter($filters,true,true);
11067
-		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
11066
+		$filter_query = $this->getFilter($filters, true, true);
11067
+		$query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
11068 11068
                     FROM airlines,spotter_output".$filter_query." spotter_output.airline_icao = airlines.icao AND airlines.type = 'military'";
11069 11069
 		$query_values = array();
11070 11070
 		if ($year != '') {
11071 11071
 			if ($globalDBdriver == 'mysql') {
11072 11072
 				$query .= " AND YEAR(spotter_output.date) = :year";
11073
-				$query_values = array_merge($query_values,array(':year' => $year));
11073
+				$query_values = array_merge($query_values, array(':year' => $year));
11074 11074
 			} else {
11075 11075
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
11076
-				$query_values = array_merge($query_values,array(':year' => $year));
11076
+				$query_values = array_merge($query_values, array(':year' => $year));
11077 11077
 			}
11078 11078
 		}
11079 11079
 		if ($month != '') {
11080 11080
 			if ($globalDBdriver == 'mysql') {
11081 11081
 				$query .= " AND MONTH(spotter_output.date) = :month";
11082
-				$query_values = array_merge($query_values,array(':month' => $month));
11082
+				$query_values = array_merge($query_values, array(':month' => $month));
11083 11083
 			} else {
11084 11084
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
11085
-				$query_values = array_merge($query_values,array(':month' => $month));
11085
+				$query_values = array_merge($query_values, array(':month' => $month));
11086 11086
 			}
11087 11087
 		}
11088 11088
       
@@ -11099,10 +11099,10 @@  discard block
 block discarded – undo
11099 11099
 	* @return Integer the number of airlines
11100 11100
 	*
11101 11101
 	*/
11102
-	public function countOverallAirlines($filters = array(),$year = '',$month = '')
11102
+	public function countOverallAirlines($filters = array(), $year = '', $month = '')
11103 11103
 	{
11104 11104
 		global $globalDBdriver;
11105
-		$queryi  = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
11105
+		$queryi = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
11106 11106
 							FROM spotter_output";
11107 11107
       
11108 11108
 		$query_values = array();
@@ -11110,23 +11110,23 @@  discard block
 block discarded – undo
11110 11110
 		if ($year != '') {
11111 11111
 			if ($globalDBdriver == 'mysql') {
11112 11112
 				$query .= " AND YEAR(spotter_output.date) = :year";
11113
-				$query_values = array_merge($query_values,array(':year' => $year));
11113
+				$query_values = array_merge($query_values, array(':year' => $year));
11114 11114
 			} else {
11115 11115
 				$query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year";
11116
-				$query_values = array_merge($query_values,array(':year' => $year));
11116
+				$query_values = array_merge($query_values, array(':year' => $year));
11117 11117
 			}
11118 11118
 		}
11119 11119
 		if ($month != '') {
11120 11120
 			if ($globalDBdriver == 'mysql') {
11121 11121
 				$query .= " AND MONTH(spotter_output.date) = :month";
11122
-				$query_values = array_merge($query_values,array(':month' => $month));
11122
+				$query_values = array_merge($query_values, array(':month' => $month));
11123 11123
 			} else {
11124 11124
 				$query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month";
11125
-				$query_values = array_merge($query_values,array(':month' => $month));
11125
+				$query_values = array_merge($query_values, array(':month' => $month));
11126 11126
 			}
11127 11127
 		}
11128 11128
                 if ($query == '') $queryi .= $this->getFilter($filters);
11129
-                else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
11129
+                else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
11130 11130
 
11131 11131
 
11132 11132
 		$sth = $this->db->prepare($queryi);
@@ -11144,7 +11144,7 @@  discard block
 block discarded – undo
11144 11144
 	public function countAllHoursFromToday($filters = array())
11145 11145
 	{
11146 11146
 		global $globalTimezone, $globalDBdriver;
11147
-		$filter_query = $this->getFilter($filters,true,true);
11147
+		$filter_query = $this->getFilter($filters, true, true);
11148 11148
 		if ($globalTimezone != '') {
11149 11149
 			date_default_timezone_set($globalTimezone);
11150 11150
 			$datetime = new DateTime();
@@ -11152,12 +11152,12 @@  discard block
 block discarded – undo
11152 11152
 		} else $offset = '+00:00';
11153 11153
 
11154 11154
 		if ($globalDBdriver == 'mysql') {
11155
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
11155
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
11156 11156
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE()
11157 11157
 								GROUP BY hour_name 
11158 11158
 								ORDER BY hour_name ASC";
11159 11159
 		} else {
11160
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
11160
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
11161 11161
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date)
11162 11162
 								GROUP BY hour_name 
11163 11163
 								ORDER BY hour_name ASC";
@@ -11169,7 +11169,7 @@  discard block
 block discarded – undo
11169 11169
 		$hour_array = array();
11170 11170
 		$temp_array = array();
11171 11171
         
11172
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11172
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11173 11173
 		{
11174 11174
 			$temp_array['hour_name'] = $row['hour_name'];
11175 11175
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -11188,14 +11188,14 @@  discard block
 block discarded – undo
11188 11188
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
11189 11189
 	{
11190 11190
 		global $global_query, $globalDBdriver, $globalTimezone;
11191
-		$filter_query = $this->getFilter($filters,true,true);
11191
+		$filter_query = $this->getFilter($filters, true, true);
11192 11192
 		date_default_timezone_set('UTC');
11193 11193
 		$limit_query = '';
11194 11194
 		if ($limit != "")
11195 11195
 		{
11196 11196
 			$limit_array = explode(",", $limit);
11197
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
11198
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
11197
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
11198
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
11199 11199
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
11200 11200
 			{
11201 11201
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
@@ -11248,7 +11248,7 @@  discard block
 block discarded – undo
11248 11248
 			    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')
11249 11249
 			    HAVING count(spotter_output.ident) > 5$orderby_query";
11250 11250
 			//echo $query;
11251
-			$spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone));
11251
+			$spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone));
11252 11252
 			/*
11253 11253
 			$sth = $this->db->prepare($query);
11254 11254
 			$sth->execute(array(':timezone' => $globalTimezone));
@@ -11267,9 +11267,9 @@  discard block
 block discarded – undo
11267 11267
 	*/
11268 11268
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
11269 11269
 	{
11270
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
11270
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
11271 11271
 
11272
-		$query  = "SELECT spotter_output.spotter_id
11272
+		$query = "SELECT spotter_output.spotter_id
11273 11273
 								FROM spotter_output 
11274 11274
 								WHERE spotter_output.flightaware_id = '".$flightaware_id."'";
11275 11275
         
@@ -11277,7 +11277,7 @@  discard block
 block discarded – undo
11277 11277
 		$sth = $this->db->prepare($query);
11278 11278
 		$sth->execute();
11279 11279
 
11280
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11280
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11281 11281
 		{
11282 11282
 			return $row['spotter_id'];
11283 11283
 		}
@@ -11302,23 +11302,23 @@  discard block
 block discarded – undo
11302 11302
 		}
11303 11303
 		
11304 11304
 		$current_date = date("Y-m-d H:i:s");
11305
-		$date = date("Y-m-d H:i:s",strtotime($dateString." UTC"));
11305
+		$date = date("Y-m-d H:i:s", strtotime($dateString." UTC"));
11306 11306
 		
11307 11307
 		$diff = abs(strtotime($current_date) - strtotime($date));
11308 11308
 
11309
-		$time_array['years'] = floor($diff / (365*60*60*24)); 
11309
+		$time_array['years'] = floor($diff/(365*60*60*24)); 
11310 11310
 		$years = $time_array['years'];
11311 11311
 		
11312
-		$time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
11312
+		$time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24));
11313 11313
 		$months = $time_array['months'];
11314 11314
 		
11315
-		$time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
11315
+		$time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24));
11316 11316
 		$days = $time_array['days'];
11317
-		$time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60));
11317
+		$time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60));
11318 11318
 		$hours = $time_array['hours'];
11319
-		$time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60);
11319
+		$time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60);
11320 11320
 		$minutes = $time_array['minutes'];
11321
-		$time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
11321
+		$time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
11322 11322
 		
11323 11323
 		return $time_array;	
11324 11324
 	}	
@@ -11344,63 +11344,63 @@  discard block
 block discarded – undo
11344 11344
 			$temp_array['direction_degree'] = $direction;
11345 11345
 			$temp_array['direction_shortname'] = "N";
11346 11346
 			$temp_array['direction_fullname'] = "North";
11347
-		} elseif ($direction >= 22.5 && $direction < 45){
11347
+		} elseif ($direction >= 22.5 && $direction < 45) {
11348 11348
 			$temp_array['direction_degree'] = $direction;
11349 11349
 			$temp_array['direction_shortname'] = "NNE";
11350 11350
 			$temp_array['direction_fullname'] = "North-Northeast";
11351
-		} elseif ($direction >= 45 && $direction < 67.5){
11351
+		} elseif ($direction >= 45 && $direction < 67.5) {
11352 11352
 			$temp_array['direction_degree'] = $direction;
11353 11353
 			$temp_array['direction_shortname'] = "NE";
11354 11354
 			$temp_array['direction_fullname'] = "Northeast";
11355
-		} elseif ($direction >= 67.5 && $direction < 90){
11355
+		} elseif ($direction >= 67.5 && $direction < 90) {
11356 11356
 			$temp_array['direction_degree'] = $direction;
11357 11357
 			$temp_array['direction_shortname'] = "ENE";
11358 11358
 			$temp_array['direction_fullname'] = "East-Northeast";
11359
-		} elseif ($direction >= 90 && $direction < 112.5){
11359
+		} elseif ($direction >= 90 && $direction < 112.5) {
11360 11360
 			$temp_array['direction_degree'] = $direction;
11361 11361
 			$temp_array['direction_shortname'] = "E";
11362 11362
 			$temp_array['direction_fullname'] = "East";
11363
-		} elseif ($direction >= 112.5 && $direction < 135){
11363
+		} elseif ($direction >= 112.5 && $direction < 135) {
11364 11364
 			$temp_array['direction_degree'] = $direction;
11365 11365
 			$temp_array['direction_shortname'] = "ESE";
11366 11366
 			$temp_array['direction_fullname'] = "East-Southeast";
11367
-		} elseif ($direction >= 135 && $direction < 157.5){
11367
+		} elseif ($direction >= 135 && $direction < 157.5) {
11368 11368
 			$temp_array['direction_degree'] = $direction;
11369 11369
 			$temp_array['direction_shortname'] = "SE";
11370 11370
 			$temp_array['direction_fullname'] = "Southeast";
11371
-		} elseif ($direction >= 157.5 && $direction < 180){
11371
+		} elseif ($direction >= 157.5 && $direction < 180) {
11372 11372
 			$temp_array['direction_degree'] = $direction;
11373 11373
 			$temp_array['direction_shortname'] = "SSE";
11374 11374
 			$temp_array['direction_fullname'] = "South-Southeast";
11375
-		} elseif ($direction >= 180 && $direction < 202.5){
11375
+		} elseif ($direction >= 180 && $direction < 202.5) {
11376 11376
 			$temp_array['direction_degree'] = $direction;
11377 11377
 			$temp_array['direction_shortname'] = "S";
11378 11378
 			$temp_array['direction_fullname'] = "South";
11379
-		} elseif ($direction >= 202.5 && $direction < 225){
11379
+		} elseif ($direction >= 202.5 && $direction < 225) {
11380 11380
 			$temp_array['direction_degree'] = $direction;
11381 11381
 			$temp_array['direction_shortname'] = "SSW";
11382 11382
 			$temp_array['direction_fullname'] = "South-Southwest";
11383
-		} elseif ($direction >= 225 && $direction < 247.5){
11383
+		} elseif ($direction >= 225 && $direction < 247.5) {
11384 11384
 			$temp_array['direction_degree'] = $direction;
11385 11385
 			$temp_array['direction_shortname'] = "SW";
11386 11386
 			$temp_array['direction_fullname'] = "Southwest";
11387
-		} elseif ($direction >= 247.5 && $direction < 270){
11387
+		} elseif ($direction >= 247.5 && $direction < 270) {
11388 11388
 			$temp_array['direction_degree'] = $direction;
11389 11389
 			$temp_array['direction_shortname'] = "WSW";
11390 11390
 			$temp_array['direction_fullname'] = "West-Southwest";
11391
-		} elseif ($direction >= 270 && $direction < 292.5){
11391
+		} elseif ($direction >= 270 && $direction < 292.5) {
11392 11392
 			$temp_array['direction_degree'] = $direction;
11393 11393
 			$temp_array['direction_shortname'] = "W";
11394 11394
 			$temp_array['direction_fullname'] = "West";
11395
-		} elseif ($direction >= 292.5 && $direction < 315){
11395
+		} elseif ($direction >= 292.5 && $direction < 315) {
11396 11396
 			$temp_array['direction_degree'] = $direction;
11397 11397
 			$temp_array['direction_shortname'] = "WNW";
11398 11398
 			$temp_array['direction_fullname'] = "West-Northwest";
11399
-		} elseif ($direction >= 315 && $direction < 337.5){
11399
+		} elseif ($direction >= 315 && $direction < 337.5) {
11400 11400
 			$temp_array['direction_degree'] = $direction;
11401 11401
 			$temp_array['direction_shortname'] = "NW";
11402 11402
 			$temp_array['direction_fullname'] = "Northwest";
11403
-		} elseif ($direction >= 337.5 && $direction < 360){
11403
+		} elseif ($direction >= 337.5 && $direction < 360) {
11404 11404
 			$temp_array['direction_degree'] = $direction;
11405 11405
 			$temp_array['direction_shortname'] = "NNW";
11406 11406
 			$temp_array['direction_fullname'] = "North-Northwest";
@@ -11453,8 +11453,8 @@  discard block
 block discarded – undo
11453 11453
 	*/
11454 11454
 	public function getAircraftRegistrationBymodeS($aircraft_modes, $source_type = '')
11455 11455
 	{
11456
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
11457
-		$source_type = filter_var($source_type,FILTER_SANITIZE_STRING);
11456
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
11457
+		$source_type = filter_var($source_type, FILTER_SANITIZE_STRING);
11458 11458
 		if ($source_type == '' || $source_type == 'modes') {
11459 11459
 			$query  = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes AND aircraft_modes.source_type = 'modes' ORDER BY FirstCreated DESC LIMIT 1";
11460 11460
 		} else {
@@ -11481,10 +11481,10 @@  discard block
 block discarded – undo
11481 11481
 	* @return String the aircraft type
11482 11482
 	*
11483 11483
 	*/
11484
-	public function getAircraftTypeBymodeS($aircraft_modes,$source_type = '')
11484
+	public function getAircraftTypeBymodeS($aircraft_modes, $source_type = '')
11485 11485
 	{
11486
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
11487
-		$source_type = filter_var($source_type,FILTER_SANITIZE_STRING);
11486
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
11487
+		$source_type = filter_var($source_type, FILTER_SANITIZE_STRING);
11488 11488
 		if ($source_type == '' || $source_type == 'modes') {
11489 11489
 			$query  = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes AND aircraft_modes.source_type = 'modes' ORDER BY FirstCreated DESC LIMIT 1";
11490 11490
 		} else {
@@ -11512,11 +11512,11 @@  discard block
 block discarded – undo
11512 11512
 	* @param Float $longitude longitute of the flight
11513 11513
 	* @return String the countrie
11514 11514
 	*/
11515
-	public function getCountryFromLatitudeLongitude($latitude,$longitude)
11515
+	public function getCountryFromLatitudeLongitude($latitude, $longitude)
11516 11516
 	{
11517 11517
 		global $globalDBdriver, $globalDebug;
11518
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
11519
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
11518
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
11519
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
11520 11520
 	
11521 11521
 		$Connection = new Connection($this->db);
11522 11522
 		if (!$Connection->tableExists('countries')) return '';
@@ -11556,7 +11556,7 @@  discard block
 block discarded – undo
11556 11556
 	public function getCountryFromISO2($iso2)
11557 11557
 	{
11558 11558
 		global $globalDBdriver, $globalDebug;
11559
-		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
11559
+		$iso2 = filter_var($iso2, FILTER_SANITIZE_STRING);
11560 11560
 	
11561 11561
 		$Connection = new Connection($this->db);
11562 11562
 		if (!$Connection->tableExists('countries')) return '';
@@ -11588,19 +11588,19 @@  discard block
 block discarded – undo
11588 11588
 	*/
11589 11589
 	public function convertAircraftRegistration($registration)
11590 11590
 	{
11591
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11591
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11592 11592
 		$registration_prefix = '';
11593 11593
 		$registration_1 = substr($registration, 0, 1);
11594 11594
 		$registration_2 = substr($registration, 0, 2);
11595 11595
 
11596 11596
 		//first get the prefix based on two characters
11597
-		$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
11597
+		$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
11598 11598
       
11599 11599
 		
11600 11600
 		$sth = $this->db->prepare($query);
11601 11601
 		$sth->execute(array(':registration_2' => $registration_2));
11602 11602
         
11603
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11603
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11604 11604
 		{
11605 11605
 			$registration_prefix = $row['registration_prefix'];
11606 11606
 		}
@@ -11608,11 +11608,11 @@  discard block
 block discarded – undo
11608 11608
 		//if we didn't find a two chracter prefix lets just search the one with one character
11609 11609
 		if ($registration_prefix == '')
11610 11610
 		{
11611
-			$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
11611
+			$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
11612 11612
 			$sth = $this->db->prepare($query);
11613 11613
 			$sth->execute(array(':registration_1' => $registration_1));
11614 11614
 	        
11615
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11615
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11616 11616
 			{
11617 11617
 				$registration_prefix = $row['registration_prefix'];
11618 11618
 			}
@@ -11626,7 +11626,7 @@  discard block
 block discarded – undo
11626 11626
 			} else {
11627 11627
 				$registration = preg_replace("/^(.{1})/", "$1-", $registration);
11628 11628
 			}
11629
-		} else if(strlen($registration_prefix) == 2){
11629
+		} else if (strlen($registration_prefix) == 2) {
11630 11630
 			if (0 === strpos($registration, 'N')) {
11631 11631
 				$registration = preg_replace("/^(.{2})/", "$1", $registration);
11632 11632
 			} else {
@@ -11645,17 +11645,17 @@  discard block
 block discarded – undo
11645 11645
 	*/
11646 11646
 	public function countryFromAircraftRegistration($registration)
11647 11647
 	{
11648
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11648
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11649 11649
 		
11650 11650
 		$registration_prefix = '';
11651
-		$registration_test = explode('-',$registration);
11651
+		$registration_test = explode('-', $registration);
11652 11652
 		$country = '';
11653 11653
 		if ($registration_test[0] != $registration) {
11654 11654
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11655 11655
 	      
11656 11656
 			$sth = $this->db->prepare($query);
11657 11657
 			$sth->execute(array(':registration_1' => $registration_test[0]));
11658
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11658
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11659 11659
 			{
11660 11660
 				//$registration_prefix = $row['registration_prefix'];
11661 11661
 				$country = $row['country'];
@@ -11666,13 +11666,13 @@  discard block
 block discarded – undo
11666 11666
 
11667 11667
 			$country = '';
11668 11668
 			//first get the prefix based on two characters
11669
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11669
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11670 11670
       
11671 11671
 			
11672 11672
 			$sth = $this->db->prepare($query);
11673 11673
 			$sth->execute(array(':registration_2' => $registration_2));
11674 11674
         
11675
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11675
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11676 11676
 			{
11677 11677
 				$registration_prefix = $row['registration_prefix'];
11678 11678
 				$country = $row['country'];
@@ -11681,12 +11681,12 @@  discard block
 block discarded – undo
11681 11681
 			//if we didn't find a two chracter prefix lets just search the one with one character
11682 11682
 			if ($registration_prefix == "")
11683 11683
 			{
11684
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11684
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11685 11685
 	      
11686 11686
 				$sth = $this->db->prepare($query);
11687 11687
 				$sth->execute(array(':registration_1' => $registration_1));
11688 11688
 	        
11689
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
11689
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11690 11690
 				{
11691 11691
 					//$registration_prefix = $row['registration_prefix'];
11692 11692
 					$country = $row['country'];
@@ -11706,17 +11706,17 @@  discard block
 block discarded – undo
11706 11706
 	*/
11707 11707
 	public function registrationPrefixFromAircraftRegistration($registration)
11708 11708
 	{
11709
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11709
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11710 11710
 		
11711 11711
 		$registration_prefix = '';
11712
-		$registration_test = explode('-',$registration);
11712
+		$registration_test = explode('-', $registration);
11713 11713
 		//$country = '';
11714 11714
 		if ($registration_test[0] != $registration) {
11715
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11715
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11716 11716
 	      
11717 11717
 			$sth = $this->db->prepare($query);
11718 11718
 			$sth->execute(array(':registration_1' => $registration_test[0]));
11719
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11719
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11720 11720
 			{
11721 11721
 				$registration_prefix = $row['registration_prefix'];
11722 11722
 				//$country = $row['country'];
@@ -11726,13 +11726,13 @@  discard block
 block discarded – undo
11726 11726
 		        $registration_2 = substr($registration, 0, 2);
11727 11727
 
11728 11728
 			//first get the prefix based on two characters
11729
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11729
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
11730 11730
       
11731 11731
 			
11732 11732
 			$sth = $this->db->prepare($query);
11733 11733
 			$sth->execute(array(':registration_2' => $registration_2));
11734 11734
         
11735
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
11735
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11736 11736
 			{
11737 11737
 				$registration_prefix = $row['registration_prefix'];
11738 11738
 				//$country = $row['country'];
@@ -11741,12 +11741,12 @@  discard block
 block discarded – undo
11741 11741
 			//if we didn't find a two chracter prefix lets just search the one with one character
11742 11742
 			if ($registration_prefix == "")
11743 11743
 			{
11744
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11744
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
11745 11745
 	      
11746 11746
 				$sth = $this->db->prepare($query);
11747 11747
 				$sth->execute(array(':registration_1' => $registration_1));
11748 11748
 	        
11749
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
11749
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11750 11750
 				{
11751 11751
 					$registration_prefix = $row['registration_prefix'];
11752 11752
 					//$country = $row['country'];
@@ -11767,13 +11767,13 @@  discard block
 block discarded – undo
11767 11767
 	*/
11768 11768
 	public function countryFromAircraftRegistrationCode($registration)
11769 11769
 	{
11770
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
11770
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
11771 11771
 		
11772 11772
 		$country = '';
11773
-		$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1";
11773
+		$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1";
11774 11774
 		$sth = $this->db->prepare($query);
11775 11775
 		$sth->execute(array(':registration' => $registration));
11776
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11776
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11777 11777
 		{
11778 11778
 			$country = $row['country'];
11779 11779
 		}
@@ -11786,9 +11786,9 @@  discard block
 block discarded – undo
11786 11786
 	* @param String $flightaware_id flightaware_id from spotter_output table
11787 11787
 	* @param String $highlight New highlight value
11788 11788
 	*/
11789
-	public function setHighlightFlight($flightaware_id,$highlight) {
11789
+	public function setHighlightFlight($flightaware_id, $highlight) {
11790 11790
 		
11791
-		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
11791
+		$query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
11792 11792
 		$sth = $this->db->prepare($query);
11793 11793
 		$sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight));
11794 11794
 	}
@@ -11800,13 +11800,13 @@  discard block
 block discarded – undo
11800 11800
 	* @param String $date Date of spotted aircraft
11801 11801
 	* @param String $highlight New highlight value
11802 11802
 	*/
11803
-	public function setHighlightFlightByRegistration($registration,$highlight, $date = '') {
11803
+	public function setHighlightFlightByRegistration($registration, $highlight, $date = '') {
11804 11804
 		if ($date == '') {
11805 11805
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)";
11806 11806
 			$query_values = array(':registration' => $registration, ':highlight' => $highlight);
11807 11807
 		} else {
11808 11808
 			$query  = "UPDATE spotter_output SET highlight = :highlight WHERE registration = :registration AND date(date) = :date";
11809
-			$query_values = array(':registration' => $registration, ':highlight' => $highlight,':date' => $date);
11809
+			$query_values = array(':registration' => $registration, ':highlight' => $highlight, ':date' => $date);
11810 11810
 		}
11811 11811
 		$sth = $this->db->prepare($query);
11812 11812
 		$sth->execute($query_values);
@@ -11836,7 +11836,7 @@  discard block
 block discarded – undo
11836 11836
 		
11837 11837
 		$bitly_data = json_decode($bitly_data);
11838 11838
 		$bitly_url = '';
11839
-		if ($bitly_data->status_txt = "OK"){
11839
+		if ($bitly_data->status_txt = "OK") {
11840 11840
 			$bitly_url = $bitly_data->data->url;
11841 11841
 		}
11842 11842
 
@@ -11846,7 +11846,7 @@  discard block
 block discarded – undo
11846 11846
 
11847 11847
 	public function getOrderBy()
11848 11848
 	{
11849
-		$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"));
11849
+		$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"));
11850 11850
 		
11851 11851
 		return $orderby;
11852 11852
 		
@@ -11980,14 +11980,14 @@  discard block
 block discarded – undo
11980 11980
 		}
11981 11981
 		$sth = $this->db->prepare($query);
11982 11982
 		$sth->execute();
11983
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
11983
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
11984 11984
 		{
11985 11985
 			$departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']);
11986 11986
 			$arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']);
11987 11987
 			if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) {
11988
-				$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";
11988
+				$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";
11989 11989
 				$sthu = $this->db->prepare($update_query);
11990
-				$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']));
11990
+				$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']));
11991 11991
 			}
11992 11992
 		}
11993 11993
 		
@@ -12000,7 +12000,7 @@  discard block
 block discarded – undo
12000 12000
 		}
12001 12001
 		$sth = $this->db->prepare($query);
12002 12002
 		$sth->execute();
12003
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
12003
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
12004 12004
 		{
12005 12005
 			if (is_numeric(substr($row['ident'], -1, 1)))
12006 12006
 			{
@@ -12009,11 +12009,11 @@  discard block
 block discarded – undo
12009 12009
 				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
12010 12010
 				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
12011 12011
 				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
12012
-				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
12012
+				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
12013 12013
 				if (isset($airline_array[0]['name'])) {
12014
-					$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";
12014
+					$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";
12015 12015
 					$sthu = $this->db->prepare($update_query);
12016
-					$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']));
12016
+					$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']));
12017 12017
 				}
12018 12018
 			}
12019 12019
 		}
@@ -12033,18 +12033,18 @@  discard block
 block discarded – undo
12033 12033
 		}
12034 12034
 		$sth = $this->db->prepare($query);
12035 12035
 		$sth->execute();
12036
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
12036
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
12037 12037
 		{
12038 12038
 			if ($row['aircraft_icao'] != '') {
12039 12039
 				$aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']);
12040
-				if ($row['registration'] != ""){
12040
+				if ($row['registration'] != "") {
12041 12041
 					$image_array = $Image->getSpotterImage($row['registration']);
12042 12042
 					if (!isset($image_array[0]['registration'])) {
12043 12043
 						$Image->addSpotterImage($row['registration']);
12044 12044
 					}
12045 12045
 				}
12046 12046
 				if (count($aircraft_name) > 0) {
12047
-					$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";
12047
+					$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";
12048 12048
 					$sthu = $this->db->prepare($update_query);
12049 12049
 					$sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id']));
12050 12050
 				}
@@ -12059,10 +12059,10 @@  discard block
 block discarded – undo
12059 12059
 		$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";
12060 12060
 		$sth = $this->db->prepare($query);
12061 12061
 		$sth->execute();
12062
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
12062
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
12063 12063
 		{
12064 12064
 			if ($row['last_latitude'] != '' && $row['last_longitude'] != '') {
12065
-				$closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist);
12065
+				$closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist);
12066 12066
 				$airport_icao = '';
12067 12067
 				 if (isset($closestAirports[0])) {
12068 12068
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
@@ -12076,7 +12076,7 @@  discard block
 block discarded – undo
12076 12076
 								break;
12077 12077
 							}
12078 12078
 						}
12079
-					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
12079
+					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) {
12080 12080
 						$airport_icao = $closestAirports[0]['icao'];
12081 12081
 						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";
12082 12082
 					} else {
@@ -12087,28 +12087,28 @@  discard block
 block discarded – undo
12087 12087
 				}
12088 12088
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
12089 12089
 					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
12090
-					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
12090
+					$update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
12091 12091
 					$sthu = $this->db->prepare($update_query);
12092
-					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
12092
+					$sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id']));
12093 12093
 				}
12094 12094
 			}
12095 12095
 		}
12096 12096
 	}
12097 12097
 	
12098
-	public function closestAirports($origLat,$origLon,$dist = 10) {
12098
+	public function closestAirports($origLat, $origLon, $dist = 10) {
12099 12099
 		global $globalDBdriver;
12100
-		$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
12100
+		$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
12101 12101
 /*
12102 12102
 		$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 
12103 12103
                       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)) 
12104 12104
                       having distance < $dist ORDER BY distance limit 100;";
12105 12105
 */
12106 12106
 		if ($globalDBdriver == 'mysql') {
12107
-			$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 
12107
+			$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 
12108 12108
 	                      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)) 
12109 12109
 	                      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;";
12110 12110
                 } else {
12111
-			$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 
12111
+			$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 
12112 12112
 	                      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)) 
12113 12113
 	                      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;";
12114 12114
     		}
Please login to merge, or discard this patch.